Typesetting Tripos exam questions

A discussion paper for the Computer Laboratory Admin Support Panel

Markus Kuhn


Since 1993, Christine Northeast has typeset all Computer Science Tripos exam questions using a TeX macro setup by Frank King. The macros and question files of the past years can be seen at /home/chn2/tripos/.

These macros are for Plain TeX, Knuth’s original TeX configuration, which is hardly used today any more and has long been superseded by LaTeX. Few in the department today know Plain TeX, whereas most use LaTeX routinely for scientific publishing.

For several years, question setters have been encouraged to write and submit their exam questions and solutions in LaTeX, using a “LaTeX question template” at /home/chn2/tripos/docs/sample*.tex. This has encouraged some question setters to make full use of LaTeX's facilities for mathematical typesetting. But as much of that is not available under Plain TeX, Christine had to become an expert in transcribing LaTeX into Plain TeX, and question setters had to be careful to restrict themselves to the LaTeX subset that can be easily transcribed that way. This is clearly a cumbersome, time-consuming, and error-prone workflow.

We should replace the existing Plain TeX macros with a new LaTeX-based solution. Redesigning the setup also gives us the opportunity to fix a number of other shortcomings of the current system, namely to have


Goal of the proposed project is to develop a LaTeX document class and associated tools and documentation for typesetting, archiving and disseminating University of Cambridge Tripos questions and their solution notes. This "tripos" document class is primarily meant to replace the existing Plain TeX setup used in the Computer Laboratory, but it would be nice if other departments could equally easily use it, should it meet their requirements (e.g., course name etc. should be configurable).

The system should allow us to keep in a single *.tex file all the information related to a single question that may be needed (assuming that a “question” is a unit normally authored by a single person):

The system design may choose to encode some of this information in the file name.

[In the past (Diploma), the same question could appear with different numbers in different papers that happened on the same day. Do we still need this?]

The per-question files should be compilable on their own under LaTeX, such that the question setter can easily and immediately verify their typographic appearance in the exam already at the time of drafting, without any infrastructure needed beyond a simple, single style file. They should also be compilable via inclusion into larger documents that bundle several questions together, to produce the actual exam papers, practice exams, or course-specific question and/or solution collections.

When complied individually, options should allow the user to choose between at least two layouts:

  1. Typeset all question parts on their own, laid out as closely as possible to how they will appear on the actual exam paper, followed on a separate page by all the associated solution notes and additional metadata. This form is to help a question setter to proof-read their question on its own.
  2. Typeset all question parts immediately followed by the respective solution notes. This form is to help question setters to proof-read their solution notes.

Beyond the above two output formats, the exact same file should also be formatable in a number of other fashions:

Other potentially desirable features:

Some compliance tests could be implemented in either LaTeX or by additional script tools:

The system might in future be used in a version-control environment (see ExamOS proposal), so nothing in the design should hinder that.

Some packages that might be useful to the envisioned architecture:

Use cases

A question file (as prepared and submitted by a question setter) might be named 2009-p07-q04-ijw.tex and contain text such as:

\begin{question}[CSTpartII,year=2009,paper=7,question=4,author=IJW]{Digital Electronics}

Answer the following questions about electrons:


\item How many are there in the \emph{Universe}? \fullmarks{4}

\item Consider electrons.


\item Why are they so negative? \fullmarks{4}

Nobody knows yet.

\item Why did they recently change colour from red to brown? \fullmarks{8}

Just to keep electricians on their toes, Amendment No 2, 2004 of BS
7671:2001 to the IET Wiring regulations changed the colours to match
those they use in flexible cables.


An exam paper would be a file such as 2009-p07.tex that includes several files like the above:

\begin{paper}[CSTpartII,year=2009,day=Monday 5 June,paper=7]

Original project outline

Suggested project team:

Suggested project timeline:


Project status and outcome

Markus Kuhn started implementing tripos.cls in January 2012. An alpha test version was used for the first time in February 2012 by Markus Kuhn (Part IA/IB) and Mike Gordon (Part II) to typeset all 2012 CST papers. Markus released a functionally complete beta test version of the tripos document class with full documentation in November 2012, in time for the 2013 CST papers. The project was largely completed by April 2013, although there is ongoing work regarding documentation, use for MPhil test cover pages, and automatic management of the online archives of past papers and solution notes.

created 2009-12-11 – last modified 2013-05-13 – http://www.cl.cam.ac.uk/~mgk25/admin-support/examlatex.html