ueaexam v4.14: LaTeX 2"Class for Writing UEA Exam Sheets

## ueaexam v4.14: LATEX2" Class for Writing UEA Exam Sheets

2012-01-22

### 1 Introduction

This is the documentation for ueaexam, a class le for typesetting exam sheets. It is loosely based on the sys-exam package and on the standard article class le1.

Top

### 2 Required Packages

The following packages are automatically loaded:

• amsmath
• etoolbox
• probsoln allows questions and answers to be stored in and loaded from databases. Must be at least version 3.02. Earlier versions will cause an error.
• drawwatermark provides facility to put DRAFT or SOLUTIONS across the background of each page.
• geometry sets up page layout.
• ifthen provides high-level conditional commands.
• calc used for counter calculations.
• fp used for adding up the marks for each question.
• graphicx images can be included using \includegraphics[hkey=value optionsi]{hlenamei}.
• xcolor text colour may be changed using \textcolor{hcolouri}{htexti}.
• enumerate provides optional argument to enumerate environment to change the item labels.
• paralist provides inparaenum enviroment for numbered lists within a paragraph. Note that probsoln also provides textenum for in-line enumerations.
• fmtcount provides command to convert numerics into words.

If the times class option is specied, the following packages are also loaded:

• mathptmx
• helvet
• courier
• lmodern

The exsizes bundle is required if any of the class options 14pt, 17pt or 20pt are used.

Top

### 3 Class Options

times
Use Times/Helvetica/Courier fonts instead of Computer Modern. (Default.)
notimes
Use Computer Modern fonts.
solutions
Display solutions given by

\Solution  \Solution{htexti}

and put SOLUTIONS banner across every page.

nosolutions
Hide solutions given by \Solution.
watermarkfirst
Only put watermark on rst page instead of on all pages. Has no eect if neither solutions nor draft used.
scorecheck
Check that the scores for each question add up to the correct total given by \questiontotal. (Default.)
notesallowed
Species that notes are allowed in the exam.
nonotesallowed
Species that notes are not allowed in the exam. (Default.)
noscorecheck
Don't check the scores.
10pt
Set the normal font size to 10pt.
11pt
Set the normal font size to 11pt.
12pt
Set the normal font size to 12pt. (Default.)
14pt
Set the normal font size to 14pt.
17pt
Set the normal font size to 17pt.
20pt
Set the normal font size to 20pt.
a4paper
Set the paper size to A4. (Default.)
a3paper
Set the paper size to A3.
oneside
Set the page formatting for one-sided printing.
twoside
Set the page formatting for double-sided printing. (Default.)
draft
Draft mode on and puts DRAFT banner across every page. This also sets draft mode for all loaded packages, included graphicx, so you won't see included images. You can override this with
\setkeys{Gin}{draft=false}

final
Draft mode o. (Default.)
leqno
Left equation numbers.
fleqn
Flush left equations.

\ueaexamhook  \ueaexamhook

If this command has been dened before ueaexam is loaded, it will be executed during the option processing stage. This can be used to set up a script to generate exam sheet and solution sheet without having to modify the document. For example, suppose the document is called exam2011.tex and loads ueaexam without any class options:

\documentclass{ueaexam}

then the exam sheet (exam2011.pdf) can be create using:

pdflatex exam2011

and the solution sheet (exam2011-solutions.pdf) can be created using (no line breaks):

pdflatex -jobname exam2011-solutions

Top

### 4 Large Font Sizes for Partially Sighted Students

As from version 2.01, there are extra class options 14pt, 17pt and 20pt in order to produce larger font sizes. Note that to use these options you must have the extsizes bundle installed2.

Returning to the example in the previous section where the document is called exam2011.tex, the large-font exam sheet (exam2011-large.pdf) can be created using (no line breaks):

pdflatex -jobname exam2011-large
"\\def\\ueaexamhook{\setptsize{20}\\setexampapersize{a3}}"
\\input{exam2011}

Alternatively, you can use an external application to resize the A4 document. For example (no line breaks):

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=a3
-dFIXEDMEDIA -dPDFFitPage -sOutputFile=exam2011-large.pdf
exam2011.pdf

Top

### 5 Available Commands

Top

#### 5.1 Preamble Commands

The following commands may be used in the preamble:

\questiontotal  \questiontotal{hnumberi}

Used to specify the total number of marks for each question. (Default: 15). If the marks for a question don't add up to this value, a warning is issued in draft mode and an error is issued in nal mode. You can suppress the score check using the noscorecheck class option.

\gquestiontotal  \gquestiontotal{hnumberi}

As \questiontotal but has a global eect.

\university  \university{huniversity namei}

Used to specify the name of the university. Defaults to University of East Anglia.

\school  \school{hschool namei}

Used to specify the name of the school. Defaults to School of Computing Sciences.

\sitting  \sitting{htexti}

Used to specify the sitting of the exam. For example:

\sitting{May/June UG}

or

\sitting{UG Reassessment/Delayed First Sit}

\examyear  \examyear{hyeari}

Used to specify the academic year (e.g. 2010/11). Defaults to the current academic year.

\course  \course{hcodei}{hnamei}

Used to specify the course code and name. For example:

\course{CMP-1A4Y}{Programming --- Languages and Software Construction}

\timeallowed  \timeallowed{htime limiti}

Used to specify the time allowed. For example:

\timeallowed{2 hours}

\version  \version{hnumberi}

Used to specify the exam version number, as required by the new regulations. For example:

\version{1}

\contact  \contact{hnamei}

Used to specify the module contact name, as required by the new regulations. For example:

\contact{Dr A.N. Other, CMP}

\rubric  \rubric{htexti}

The rubric on the front page regarding the number of questions to be done in each section can be automatically generated using the \section command (see below), however additional information can be added using the command \rubric. For example:

\rubric{Use separate answer books for each section.}

\turnovertrue  \turnovertrue

This will put the words TURN OVER at the bottom of each page3 except for the last page. (This is the default.)

\turnoverfalse  \turnoverfalse

Prevents the words TURN OVER appearing at the bottom of each page.

Top

#### 5.2 Document Commands

The following commands may be used within the document:

\maketitle  \maketitle

This makes the title page. It should be the rst command in the document environment.

\score  \score{hnumberi}

This is used to indicate the maximum number of marks for a question or part of question. For example:

Find the derivative of $f(x)=x^2 - x + 1$.\score{5}

This adds hnumberi to the running total for the current question and displays the mark using

\scoreformat  \scoreformat{hnumberi}

which has the default denition: \marginpar{[\marklabel{hmarki}]} where

\marklabel  \marklabel{hmarki}

prints hmarki followed by either mark (where hmarki is 1) or marks.

The \score command must be used within an enumerate environment.

Warning: don't attempt to use or redene \mark or \marks to specify the mark. These commands are TEX primitives and should not be meddled with.

\section  \section{hNumber of Questions to Be Answeredi}

This is the only sectioning command dened within this class le. This command issues a \clearpage, prints SECTION followed by the section letter (e.g. A), and on the following line it prints the argument. Both lines are centrally aligned. As usual, the section can be referenced using \label and \ref. For example, the input:

\section{2}

would produce the output:

SECTION A

Answer TWO questions from this Section.

The \section command may occur within an enumerate or any of the other list-making environments, provided at least one \item precedes it. This means that all the exam questions can be placed within a single enumerate environment, ensuring consistent numbering throughout the document. Note that there is no starred version of this command.

If the argument hNumber of Questions to Be Answeredi is a number or the strings all or the, the full section title and rubric information will be generated automatically. For example:

\section{all}

will produce:

SECTION A

Answer ALL questions from this Section.

and it will add ALL questions from Section A to the rubric information on answering questions.

Alternatively, the section title and the rubric information can be explicitly entered using:

\section[hrubric infoi]{htitle texti}

For example:

Note: It is best not to have any commands within the optional argument of \section, unless they expand to a simple text string4. At best, this will cause LATEX to keep complaining that the title page is not up to date, at worse it will cause a TEX capacity exceeded error.

This may be used to insert any additional text to the rubric. The above note also applies to this command.

\Solution  \Solution{htexti}

(Note the initial capital letter.) This may be used to specify the solution to the problem. The solution is only displayed if the solutions class option is used. Figures and tables within the argument of \Solution will have dierent numbering to those outside of \Solution. This ensures that the gures and tables that form part of the questions retain the same numbering in the solution sheet. The solution text is formatted according to

\solutionfont  \solutionfont

This defaults to slanted sans-serif.

As from v4.08, the argument of \Solution may contain verbatim text.

Top

### 6 Dening Problems and their Solutions in External Files

It's possible to dene the exam questions in a dierent le. This makes it easier to change the ordering of the questions within the exam. Questions can be dened using:

defproblem  \begin{defproblem}{hlabeli}
htexti
\end{defproblem}

For example:

\begin{defproblem}{compute-factorial}
Compute $4!$, $5!$ and $6!$.\score{3}
\Solution
{%
\begin{align*}
4! &= 4 \times 3 \times 2 \times 1 = 24\\
5! &= 5 \times 4! = 5 \times 24 = 120\\
6! &= 6 \times 5! = 6 \times 120 = 720
\end{align*}
}
\end{defproblem}

There is a short-cut command

For example, the above can also be written as:

\newproblem{compute-factorial}
{%
Compute $4!$, $5!$ and $6!$.\score{3}
}
{%
\begin{align*}
4! &= 4 \times 3 \times 2 \times 1 = 24\\
5! &= 5 \times 4! = 5 \times 24 = 120\\
6! &= 6 \times 5! = 6 \times 120 = 720
\end{align*}
}

textenum  \begin{textenum}

You can use the textenum environment for in-line numbered lists. This environment uses the same counter as the corresponding enumerate level, so answers that require longer passages than the question can use the same numbering system. For example:

\newproblem{compute-factorial}
{%
Compute
\begin{textenum}
\item $4!$, \item $5!$ and \item $6!$.
\end{textenum}\score{3}
}
{%
\begin{enumerate}
\item $4! = 4 \times 3 \times 2 \times 1 = 24$
\item $5! = 5 \times 4! = 5 \times 24 = 120$
\item $6! = 6 \times 5! = 6 \times 120 = 720$
\end{enumerate}
}

In your document, you can load the questions using one of the following:

Loads all problems dened in hlei into a database named hdb namei.

Loads the problems dened in hlei whose labels are given in hlabel listi into a database named hdb namei.

Loads the problems dened in hlei whose labels are not given in hlabel listi into a database named hdb namei.

Loads hni randomly selected problems dened in hlei into a database named hdb namei.

Once you have loaded the required problems, you can either explicitly select problems using:

\useproblem  \useproblem[hdb namei]{hlabeli}

or you can iterate over all problems using:

\foreachproblem  \foreachproblem[hdb namei]{hbodyi}

Within hbodyi, you can use

\thisproblem  \thisproblem

to use the current problem and

\thisproblemlabel  \thisproblemlabel

to access the current label.

Top

### 7 Example Documents

The following is a short sample document illustrating the use of this class le:

\documentclass{ueaexam}
\course{ABC-1XY}{SAMPLE COURSE}
\timeallowed{2 hours}
\version{1}
\contact{Dr A.N. Other}
\begin{document}
\maketitle
\section{the}
\begin{enumerate}
\item This is the first question, it has two parts.
\begin{enumerate}
\item The first part  \score{20}
\Solution{This is the solution to the first part.}
\item The second part \score{20}
\Solution{This is the solution to the second part.}
\end{enumerate}
\section{2}
\item This is the first question of the second part,
but because we are still in the same enumerate environment,
this question is question number 2.  If the last line of this
paragraph is long, it will run into the marks so in this
case, we can put the marks on the following line to make it neater.
\par\mbox{}\score{30}
\Solution{This is the solution.}
\item This is question number 3.\score{30}
\Solution{This is the solution to question number 3.}
\item This is the last question.\score{30}
\Solution{This is the solution to the last question.}
\end{enumerate}
\end{document}

In the following example, the exam is made up of three sections, where each section is written by a dierent lecturer (call them Dr A, Dr B and Dr C.) Rather than the lecturers trying to determine who has the most up-to-date version of the le, the questions for each section are dened in three separate les, say A.tex, B.tex and C.tex. In this way, each lecturer can independently edit their own questions.

Suppose Dr A is providing questions on counting, then A.tex might look like:

\newproblem{compute-factorial}
{%
Compute
\begin{textenum}
\item $4!$, \item $5!$ and \item $6!$.
\end{textenum}\score{15}
}
{%
\begin{enumerate}
\item $4! = 4 \times 3 \times 2 \times 1 = 24$
\item $5! = 5 \times 4! = 5 \times 24 = 120$
\item 6! = 6 \times 5! = 6 \times 120 = 720$\end{enumerate} } \newproblem{factorial-terms}% {% Write in terms of factorials: \begin{textenum} \item$21\times20$, \item$\frac{1}{9\times8}$, \item$42$. \end{textenum}\score{15} }% {% \begin{enumerate} \item$21\times20 = \frac{21!}{19!}$\item$\frac{1}{9\times8} = \frac{7!}{9!}$\item$42 = \frac{42!}{41!}$\end{enumerate} } Suppose Dr B is providing questions on dierentiation, then B.tex might look like: \begin{defproblem}{diff-f} Differentiate each of the following functions with respect to$x$: \begin{enumerate} \item$f(x) = x^2$.\score{5} \Solution{$f’(x) = 2x$.} \item$f(x) = 3x^3$.\score{5} \Solution{$f’(x) = 9x^2$.} \item$f(x) = 2x^2 + x$.\score{5} \Solution{$f’(x) = 4x + 1$.} \end{enumerate} \end{defproblem} Suppose Dr C is providing questions on set theory, then C.tex might look like: \newproblem{sets-showequal}% {% Which of these sets are equal:$\{a, b, c\}$,$\{c, b, a\}$,$\{c, b, b, a\}$,$\{a, c, b, c\}\$?\score{15}
}%
{%
They are all equal. Order and repetition do not change a set.
}

The main le might then look as follows:

\documentclass{ueaexam}
\course{ABC-2XY}{SAMPLE COURSE II}
\timeallowed{3 hours}
\rubric{Use a separate answer book for each section.}
\version{1}
\contact{Dr A. Other, CMP}
\begin{document}
\maketitle
\section{2}
\begin{enumerate}
\foreachproblem[counting]{\item\thisproblem}
\section{1}
\foreachproblem[differentiation]{\item\thisproblem}
\section{all}
\foreachproblem[sets]{\item\thisproblem}
\end{enumerate}
\end{document}

Top

### Acknowledgements

Some of the code was amended by G. Janacek.

### Index

A

amsmath package  2
article class  3
article.cls class  4

C calc package  5
class options:
10pt  6
11pt  7
12pt  8
14pt  9, 10, 11
17pt  12, 13, 14
20pt  15, 16, 17
a3paper  18
a4paper  19
draft  20, 21
final  22
fleqn  23
leqno  24
nonotesallowed  25
noscorecheck  26
nosolutions  27
notesallowed  28
notimes  29
oneside  30
scorecheck  31
solutions  32, 33, 34
times  35, 36
twoside  37
watermarkfirst  38
\contact  39
courier package  40
\course  41

D defproblem (environment)  42
drawwatermark package  43

E enumerate (environment)  44, 45, 46, 47, 48
enumerate package  49
environments:
defproblem  50
enumerate  51, 52, 53, 54, 55
inparaenum  56
textenum  57, 58, 59
etoolbox package  60
\examyear  61
exsizes package  62
extsizes package  63

F fmtcount package  64
\foreachproblem  65
fp package  66

G geometry package  67
\gquestiontotal  68
graphicx package  69, 70

H helvet package  71

I ifthen package  72
inparaenum (environment)  73
\item  74

L lmodern package  75

M \maketitle  80
\marklabel  81
mathptmx package  82

N \newproblem  83

P package options:
noscorecheck  84
paralist package  85
probsoln package  86, 87

Q \questiontotal  88, 89

R \rubric  90

S \school  91
\score  92
\scoreformat  93
\section  94, 95
\sitting  96
\Solution  97, 98, 99
\solutionfont  100
sys-exam package  101

T textenum (environment)  102, 103, 104
\thisproblem  105
\thisproblemlabel  106
\timeallowed  107
\turnoverfalse  108
\turnovertrue  109

U ueaexam class  110, 111, 112
\ueaexamhook  113
\university  114
\useproblem  115

V \version  116

X xcolor package  117

1although not all the commands dened in the article.cls article are available in this class le

2If you don't have this package it can be download from http://www.ctan.org/pkg/extsizes

3odd pages only, if two sided printing specied

4This shouldn't be much of a problem as it's unlikely that there will be any, although it does mean that you can't use any spacing macros (such as ˜) either.