3

a handy feature of beamer is to be able to produce slides or a handout. you "just" have to change a line in the source. a known solution is to use 2 different files forthe different options with a common input to the slides, but find this solution non economic.

however, I wished to produce the slides and the handout more naturally using a Makefile.

Is it possible to pass at the command line (for instance to lualatex) an option that can be used by beamer and include that in a Makefile?

5

You can execute it like that:

pdflatex  '\PassOptionsToClass{handout}{beamer} \input{presentation}'

This will still create presentation.pdf and overwrite the normal version of the PDF.

Or alternatively you can use three files and create the following documents:

% notes.tex
\PassOptionsToClass{notes=only}{beamer}
\input{presentation}

% handout.tex
\PassOptionsToClass{handout}{beamer}
\input{presentation}

which will create notes.pdf and handout.pdf instead without any need for a compiler options.

The main file can now easily be compiled simply using pdflatex presentation and the notes and handout with pdflatex notes and pdflatex handout, respectively.

0

My solution to this is to use sed. I'm not great with Regualr Expressions but here's the basic command to do it.

sed "s/documentclass[[?][a-zA-Z0-9,]*[]?]/documentclass[handout]/g" main.tex > handout.tex

This will create a second file. I know there is a way to store the options it finds and keep them in. It's not that complicated but I haven't taken the time to do it (another problem for another day).

Anyway, I then string the sed command with the lualatex commands for both the presentation and the handouts like so:

sed "s/documentclass[[?][a-zA-Z0-9,]*[]?]/documentclass[handout]/g" main.tex > handout.tex && lualatex --jobname=Presentation --synctex=1 --output-directory=Presentation main.tex && lualatex --jobname=Handout --synctex=1 --output-directory=Handout handout.tex

This could obviously be done as three separate commands.

  • May be worth writing a script for this. Would simplify things. – bteres Apr 9 '14 at 16:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.