Managing slides and handouts in LaTeX

Now that my teaching season has started, I need to produce slides and handouts for lots of lectures. For saving paper I print the handouts in 2-up, so two slides per page. Till now I normally did this by hand-editing, but I finally got around to automate it. Probably trivial and well known, I just document it in case someone needs it:

I assume that you are using the beamer documentclass. The setup consists of one master file, say lecture.tex and in addition one Makefile. The idea is that one encapsulates all the stuff needed for the handouts in \ifhandout and ensures it is set properly:

So here is the head of the lecture.tex file:

  \pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]

Without anything, running any LaTeX compiler on this document the \ifhandout will be set to false when defining it, and the normal code will run.

Now for the handout: Here we add a Makefile:

%.pdf: %.tex
        $LATEX $<
%-handout.pdf: %.tex
        $LATEX -jobname $*-handout '\newif\ifhandout\handouttrue\PassOptionsToClass{handout}{beamer}\input{$<}'

Note I am using lualatex, that needs to be changed for your purpose. The trick is that before loading the file we define the \ifhandout and set it to true, which later on is recognized by the ifthen package's \provideboolean{handout}. Furthermore, we pass the handout option to the beamer class, set the output file and load the orginal document.

If you need more configuration within the document (like putting less information on the handout, hiding some special information, just enclose them in \ifhandout...\else...\fi.

Voilà, running make lecture.pdf produces normal slides, while make lecture-handout.pdf produces the handouts. The actual setup is of course a bit more complicated, but this is the core.

Hope it helps.

Leave a Reply

Your email address will not be published.

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=""> <s> <strike> <strong>