LaTeX and Open University TMAs

I decided early on that typing my TMA answers up would be the best way for me to go. This was due to my awful handwriting, and also as a means to ensure that I proofread them properly (I have a horrible habit of not checking work). The actual use of LaTeX wasn’t a problem as I’ve played around with it a few times in the murky past for work. But trying to think of a decent layout for TMAs was a different matter as I’d always worked in predefined styles before. The following is what I came up with (Link to a PDF output version)

\documentclass[a4page]{article}

Just let latex know that we’re using A4 paper

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{verbatim}
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage{mathtools}

Here we load all the packages we need for use in this document. Most of these just enable all the maths features we’ll use, plus fancyhdr which lets us set the nice headers

\mathtoolsset{showonlyrefs}  %

This line ensures that LaTeX only prints equation numbers for equations that are specifically marked to be labelled/numbered

\pagestyle{fancy}
\fancyhead[LO,LE] {Joe Student}
\fancyhead[CO,CE] {B1234567}
\fancyhead[RO,RE] {MS123 - TMA01}

This sets our headers, these are what the OU recommend. Adjust to taste.

\numberwithin{equation}{section}

Set the numbering scheme for equations

\begin{document}

Let LaTeX know that from here on this is the actual content of the document

\setcounter{section}{1}
\setcounter{equation}{0}
\section* {Question 1}
\subsection*{a)}
\subsubsection*{i)}

Reset counters, and then put in the subsections. It is possible to skip sections if they’re not needed for a specific question. I you omit the * then Latex will number each section, which may not be what you want.

From here down it’s just normal LaTeX formatting.

\begin{align}
a=b+c \label{q1eq1}\\
c=a-b\\
\end{align}
\subsubsection*{ii)}
blah, blah, blah, refer to equation \eqref{q1eq1}\\
\subsection*{b)}
Answer question 1) b) here\\
equation labeling:\\
\begin{align}
a^2=b^2+c^2 \label{q1eq2}
\end{align}
Labels as \eqref{q1eq2}\\
\setcounter{section}{2}
\setcounter{equation}{0}
\section*{Question 2}
Equation numbering here:
\begin{align}
y^2=b^2+38 \label{q2eq1}\\
\end{align}
So the label is \eqref{q2eq1}\\
\end{document}

And here’s a link to the source tex file without any comments. (LaTeX source file with no comments)

4 comments on “LaTeX and Open University TMAsAdd yours →

  1. I have set up a Latex document class for my OU math assigments, will see how it goes typing out the equations is tex rather than on paper!

    If your interested here is my code, it has some nice re-usability and custom macros to help with title and header generation and also to auto increment the question numbers in the OU style, e.g. Question 1, (a), (i).

    https://gist.github.com/789708

  2. Cheers, I’ll have a trawl through that. I knocked up a quick template for MST121/MS221 last year, but it look like your scripts will take some of the tedium out of using mine.

Leave a Reply

Your email address will not be published. Required fields are marked *


*