L TEX For Examinations A Short Style Guide: Formatting Macros

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

LATEX for Examinations

A Short Style Guide


Given that LATEX has been adopted for all examination papers we are now in a position to
introduce a consistent style across all exam papers. This document sets out a minimum
set of simple style rules that will also assist the secretarial staff in the final preparation
of the papers.

Formatting Macros
There is an examination style file exampaper.sty used by the secretaries in the final
preparation of examination papers. For obvious, security reasons this is not available on
the networked Unix machines. However the question formatting macros are available in
examquestion.sty which can be downloaded from the Wiki page or direclty from:
www.ph.ed.ac.uk/ wjh/tex/latex/styles/examquestion.sty
these macros are identical to those used in examppaer.sty but without those to format
the front page which will be added by the Teaching Office staff.
The style file automatically includes the [pdftex]graphicx and epstopdf which should
be standard in all LATEX distributions.
Please Note: You must not use any other group or personal style files that are not
part of the normal MikTeX package on the secreterial machines. If you need extra macro
definitions in your examination source please explicitely add them in the preamble.
To make use of these macros you must start your document with
\documentclass[a4paper,12pt,twoside]{article}
\usepackage{question}
\begin{document}

Question Macros
The macros included in this style file are:
\question
Start of a question. This must be preceded by one or more blank lines. This will label
the question (in the left margin), and leave space between questions. All other normal
LATEXcommands work in questions,
If you need part numbering within a question use the standard enumerate environment,
but with the item labels set to lower case letters, the recipe is:
\begin{enumerate}
\renewcommand{\theenumi}{\alph{enumi}}
\item The text for the first item.
\item The text for the second item.
1

\item The text for the third item.


\end{enumerate}
\partmark{text}
This places a bold partial question mark in the right margin on the line currently being
formatted.
\eqpartmark{text}
This places a bold partial question mark opposite a displayed equation, this is added for
some Mathematical Physics examination papers.

Figure Macros
Figures should be supplied in pdf, but also since the epstopdf package is being used,
eps files should be automatically converted.
There are three simple macros to includes to figures supplied these being:
\Pictx{psfile.pdf/eps}{xsize}
which inserts the file psfile.pdf/eps centred in the page with its horizontal dimension
scaled to xsize.
\Picty{psfile.eps}{ysize}
which inserts the file psfile.eps centred in the page with its vertical dimension scaled
to ysize.
\MissingPict{xsize}{ysize}
inserts a centred framed box of horizontal size xsize and vertical size ysize with the
centred test Insert figure here.
the two Pict macros are simplified calls to \includegraphics people wanting to do
fancier things for example two figures side-by-side must format it themselves using any
of the standard LATEX graphicx calls.

Multi-part examination macros


For multi-part examinations, there are three additional macros:
\examinationpart{text}
This prints a large central heading with text. The question numbers in the section are
then numbered A.1 A.n then B.1 B.n.
\subexaminationpart{text}
This prints a large left aligned heading with text. The questions numbers, for Section
B say, as B1.1 B1.n. This is included for the combined 3-hour JH papers which have
Section A and Section B with is then subdived into B1 and B2.
\RomanParts
Changes the defaults parts label from capital letters to upper case Roman numerals (as
used in some Junior Honours papers). This is not longer use in any papers but is includes
for compatibility.

Fine Tuning
The style attempts to put page breaks in sensible places, but papers usually do require
some fine tuning. This should be done by the secretarial staff during the final formatting.

Formatting Style
In order to obtain a reasonable degree of uniformity across the examination papers the
following set of simple style points should be adhered to.

Additional Space
LATEX normally make a very good job of formatting text, but with equations it is often
necessary to introduce additional spacing commands to make equations clear. In maths
mode there are a range of space options, these being
Command
\!
\,
\:
\;
\t
\quad
\qquad

||
||
||
||
||
||
| |
|

Description
negative thin space
normal maths space
thin space
medium space
thick space
interword space
quad space
qquad space

These are used in many of the examples below.

Numbers, Units and Variables


All exponential form numbers should be of the form 2.99987 108 which is typeset as
$2.99987\times10^8$ using the maths mode \times character and not x or ..
All units must be in same typeface as the main document, this normally being proportionally spaced Roman . This includes when they are part of a display equation, for
example:
c = 2.99987 108 m s1
Also the units should be separated from the number by a small space so the correct way
to format the above is:
\[
c = 2.99987\times10^8\,\mathrm{m\,s^{-1}}
\]

The normal typeface in Maths Mode is equi-spaced italic

where \mathrm{} sets maths Roman mode.


Variables in the text must be in the same font as used in the equations, for example
where c is the speed of light the c must be set as $c$. Note that {\it c} is not the
same as $c$.
When text is used in displayed equations it must be in the same font as the main document, for example
f (x) = x only when x > 0
is most easily set using the \mbox{} construct that inserts a box of text in the equations
giving:
\[
f(x) = x \quad\mbox{only when $x > 0$}
\]

Brackets
LATEXis very good at getting the correct bracket size if you use the \left<bracket> and
\right<bracket> construct. For example

1
1 +  v2 
c2

was formatted by
\[
\left\{1 + \frac{1}{\left(\frac{v^2}{c^2}\right)}\right\}^2
\]
This scheme should always be used and not the \Large etc. commands. It also checks
that the opening and closing brackets match! Note the \left and \right commands
must occur in pairs, but the delimiters need not be the same, (see Bra-Kets below), and
a . means an invisible delimiter, allowing formulas like
(

H(u, v) =

1 for u2 + v 2 w02
0 otherwise

Vectors
There are many conventions for vectors used in the current examination papers, the most
common being, ~a, a and a. This is at best unsightly and worst confusing. We should
move to a consistent notation, which I suggest is a which is set as $\underline{a}$.
This was chosen over the ~a to allow for vector operators to be set as pb.
In the short term this uniformity is impossible since clearly the notation in the examination paper must match that in the lecture notes and tutorial questions/solutions. However
it is essential that a consistent notation is adopted across individual papers even when
these papers contain multiple courses.
4

Scalar and vector products should be set as


s = ab and c = ab
using the \cdot for scalar and \times for vector products. The above being set by
\[
s = \underline{a}\!\cdot\!\underline{b}\quad\mbox{and}\quad
\underline{c} = \underline{a}\!\times\!\underline{b}
\]
where the negative space commands make the spacing more attractive.
Similarly the Div and Curl should be
s = a and b = a
using the \nabla character and not Div and Curl as is currently in the formula
sheet.

Matrices
Again, as with vectors, we should adopt a common convention. One possible notation is
bold capitals A. Note that lower and upper case Greek characters are available in bold,
for example by using $\mathbf{\Omega}$. Also the components of A should be

A=

A1 1
A2 1
..
.

A1 2
A2 2
..
.

..
.

A1 N
A2 N
..
.

AM 1 AM 2 AM N

where the subscripts are separated by a thinspace.


The identity matrix should be I and not 1.
Matrix-matrix and matrix-vector multiplies do not have an explicit symbol, but should
be separated by a thin or medium space , so
y = M x and = A B
with the space given by thin and medium spaces.

Functions
The trigometric and log functions must all be set in Roman font, for example,
x = cos() and b = sinh(x)

Which ever looks better will depend on the shapes of the variables.

where the () should normally be included. LATEX has built-in functions for the normal
functions, for example \cos, \log, \tanh, but for the odder ones you may have to doit-yourself; for example,
J1 (x)
jinc(x) =
x

needs to be set as :
\[
\mathrm{jinc}(x) = {\mathrm{J}_1(x)\over x}
\]
The inverse trigometric functions should be set as x = cos1 () rather than x = arccos().
The exponential function can either be set as
eix

or

exp(ix)

but the e form should be avoided when in involves complex expression like
2
(ux+vy)
i f

2
(ux + vy)
exp i
f

since the superscripts tend to get rather small and difficult to read.
Log functions should use ln() for natural logs and log10 () for base-10 logs. The log()
should be avoided since it always tend to cause confusion.

Integrals
The LATEX defaults nearly always get one-dimensional integrals correct, so that
Z

f (x) exp (i2ux) dx

should be set as
\[
\int_{-\infty}^\infty f(x)\exp\left(-i2\pi ux\right)\,dx
\]
Note that there should be a thinspace before the dx.
With multi-dimensional integrals with long limits you may have to do a considerable
amount of LATEX hacking to get it to look right, which may involve you having to
consult a LATEXpert.
A
LT

EXperts are likely to use the macro facility to simplify this!

Bra-Kets
Bras and Kets should be formatted with the \langle and \rangle brackets rather that
<> symbols since they scale correctly with the \left and \right commands, with
hx|

and

|yi

formatted by
\[
\left\langle\,x\,\right|\quad\mbox{and}\quad
\left|\,y\,\right\rangle
\]
Note you typically have to insert thin or medium spaces to make it look nice.
Will Hossack
Updated: October 1, 2013

You might also like