# Output Beamer notes to a separate PDF file?

Is there a simple way to have Beamer output the presentation notes to a separate PDF file whenever compiling the presentation? I know one way is to create two master files, one for the presentation and one for the notes, and compile them both every time, but I find this somewhat awkward.

-
Getting TeX to output more than one PDF is covered at this question: tex.stackexchange.com/q/5228/86. Although it's possible, it's done by subverting the system (as bloodworks' solution does) and effectively calling a shell script to run pdflatex enough times. For getting two outputs from one input, you can see some solutions at this question: tex.stackexchange.com/q/1423/86. For example, my current lecture notes consist of one file and nearly 100 symlinks that produce the various versions when compiled. –  Loop Space Jan 9 '12 at 12:48

There is an option called \setbeameroption{show only notes}

\documentclass{beamer}

%\setbeameroption{show notes}
\setbeameroption{show only notes}
\begin{document}
\frame{\frametitle{FIRST}
On slide
\note{Whatever}
}

\end{document}

Compile, copy the pdf (another name!), comment out the second setbeameroption as well and compile again. Sure you could write a makefile (depending on your OS), but if you don´t need the two files after every run it is much easier (or less to code) this way. For the writing process i recommend to work with the show notes option on (remove %).

Edit

Here comes a one compilation (one click) solution. It makes use of \write18 so pdflatex needs the --shell-escape option.

\write18{./file.sh }

\documentclass{beamer}

\input{out.out}
\begin{document}
\frame{\frametitle{FIRST}
On slide one.
\note{Whatever you want}
}

\end{document}

While file.sh is

#! /bin/bash
echo  > out.out
pdflatex yourname
cp yourname.pdf nonotes.pdf
echo \\setbeameroption{show only notes} > out.out

this file must be executable with e.g. chmod 777 file.sh an it must be in the same directory as the yourname.tex. This is of course bash so it will only work on unix-like systems.

Replace yourname with the actual name of your tex-file.

What does it do? First pdflatex will call file.sh which executes pdflatex then copies the resulting pdf into nonotes.pdf. Afterwards it fills out.out with the show only notes option. write18 is finish and the parent pdflatex process will continue. But now that out.out is filled, the parent process will produce a pdf with that option on.

-
@marc-van-dongen I am looking for an automated way to generate both the presentation and notes. I am well aware of the "show only notes" option. What I want is to get that file without commenting, uncommenting, and renaming files manually. –  Little Bobby Tables Jan 9 '12 at 7:52
@LittleBobbyTables did mac mention show only notes? As i said before a makefile could easily be written, when one would know which OS you´re using. Would a makefile work for you? –  bloodworks Jan 9 '12 at 11:35
It's a hack if I ever saw one - I didn't know write18 does that - But I guess it's what I asked for. I ended up writing a makefile, but it's good to know there's a way around it. –  Little Bobby Tables Jan 10 '12 at 8:55

I don't use master files. Instead I have a user-defined class that takes an option that determines the kind of presentation. If the option isn't provided, the class results in a beamer presentation. Otherwise, it uses the article class in combination with beamerarticle to get a handout version. In addition, it redefines some beamer commands which would otherwise provide output. For example, \frametitle and \framesubtitle.

If I want to generate the presentation, all I have to do is making sure the extra option isn't provided. If I want to provide the handouts then all I have to do is adding the extra option. This is a lot less work than having to implement multiple master files.

You can even take this idea further by providing the option at run time. This way you can let a script generate the presentation and the notes version.

The main idea is explained in more detail in Chapter 15 (Writing Classes and Packages) of LaTeX and Friends.

-