Some time ago I wrote a post about compiling two versions of a Beamer presentation from one source using the docmute
package. I promised to show how to compile also lecture notes from the very same source. So, here’s how.
When preparing lecture notes, we face a few problems. One of them is that we don’t want some slides’ content to end up in lecture notes. (The “Thanks for your attention” slide is an obvious example.) On the other hand, there may be quite a few things we want to have in lecture notes, but not in the presentation.
The way to accomplish this in Beamer is by means of \mode*
command. Here’s the catch, though: it must not be placed before \begin{document}
. On the other hand, when partially compiling the presentation with AUCTeX, we want it to be part of the compiled _region_.tex
file – and this file is constructed by concatenating the preamble, the \begin{document}
line, the region and the \end{document}
line. What to do?
Happily, there is a simple (though not extremely elegant) solution. It is to use \mode*
twice: once right after the \begin{document}
, which is needed when inputtingthe document using the docmute
package (since then the preamble is discarded), and then again in the preamble, in the form of the [ignorenonframetext]
option, which is needed in the case of partial compilation in AUCTeX (since then the compiled file is constructed from the preamble and the region). So, here is the presentation-slides.tex
file again.
% presentation-slides.tex \documentclass[ignorenonframetext]{beamer} \setbeameroption{show notes} \input{presentation-preamble} \begin{document} % This line is needed for \input'ing this file. \mode* \begin{frame} \titlepage \end{frame} \section{Introduction} \begin{frame} \frametitle{Introductory slide} [contents] \note{Note to self: remember to introduce yourself} \end{frame} This is a~text between slides, to be inserted only in lecture notes. \section{First real section} \begin{frame} \frametitle{First real slide} [content] \end{frame} \appendix \begin{frame}<presentation> \begin{center} Thank you for your attention! \end{center} \end{frame} \end{document}
And here’s how we generate the (pretty bare-bones) lecture notes.
% presentation-lecture-notes.tex \documentclass{article} \usepackage{beamerarticle} \usepackage{hyperref} \usepackage{docmute} \input{presentation-preamble} \begin{document} \input{presentation-slides} \end{document}
The remaining files (presentation-preamble.tex
and presentation-slides-without-notes.tex
) are unchanged from the previous example.
Notice also that the new presentation-slides.tex
file shows how to do the opposite thing: not only can we now insert some text between frames, present in the lecture notes only, but also a frame which won’t end up in the lecture notes, by using the <presentation>
mode specification. Consult the Beamer user guide for details on how those work.
That’s it for today. Hope you find it useful!
CategoryEnglish, CategoryBlog, CategoryTeX, CategoryLaTeX, CategoryBeamer