Homework template for LaTeX

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.

Example of what the result pdf could look like is here, and the template can be found here.

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! ;).

This entry was posted in Misc and tagged , , . Bookmark the permalink.

2 Responses to Homework template for LaTeX

  1. Sam says:

    By default shows warning:

    ! Undefined control sequence.
    l.19 \unframedsolutions

    , and frames soluntions. In which package that is defined, what I’m missing here.

  2. harski says:

    According to the, the \unframedsolutions tag (along with the whole \SolutionEmpahis system) was introduced in version Version 2.301$\beta$, 2008/09/22. So any version older than that (<=2.3) doesn’t recognice the control sequence.

    The version I have is 2.4 and I haven’t tried compiling the template with an older version, but my guess is you’ll achieve more or less the same output if you just leave that tag out.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>