Homework template for LaTeX

2012-03-11

Since I couldn't find a suitable homework template, I decided to hack one together myself. It is based on the exam document class, so one can quite neatly present both the questions and their solutions. As I am a computer science student, I also took special care to make sure both pseudocode and freely formatted text work properly.

The pseudocode is formatted with algorithm, algorithmicx and algpseudocode packages. The non-formatted text is achieved with alltt and striked out text with ulem package (\sout command). And who could do without amsmath. Get the packages somewhere if you lack them.

The exam document class didn't support leaving some of the questions out (a feature not really needed while making exams), so I included a hack for it, skipquestion. It allows you to answer questions 1 and 4 while keeping the question numbering sane. See the template for example, it's all there.

Here are an example of the result pdf and the latex template.

Note: To get the page numbering right you might need to run latex a couple of times.

Update

Documentation for the algorithms package (usable commands, examples etc.) can be found at http://mirrors.ctan.org/macros/latex/contrib/algorithms/algorithms.pdf.

Also, as discussed in the comments, the linked template is designed for version 2.4 of the exam package and might not even compile with older version (Debian stable users beware! ;).