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:

\documentclass{beamer} \usepackage{ifthen} \provideboolean{handout} \ifhandout \usepackage{pgfpages} \pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm] \fi ...

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:

LATEX=lualatex %.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.