# Divide long presentation into multiple pdfs

I am giving three lectures and have a Beamer presentation containing the slides for all three lectures (so I can easily go back and forth between the content). However, after the first and second lectures I want to give to the students a pdf file containing the slides for the respective lecture by preferably "subsetting" the main document and producing a pdf only containing the parts belonging to that lecture. Last year, I just copied the lecture 1 stuff into a new file and compiled it, but obviously if I make changes to the main document I need to change it as well.

So basically, suppose my main document looks like this:

\documentclass[12pt]{beamer}
\title{Lectures}

\begin{document}
\maketitle

\begin{frame}
Lecture 1
\end{frame}

\begin{frame}
Lecture 2
\end{frame}

\begin{frame}
Lecture 3
\end{frame}

\end{document}


Ideally, I want a way to keep only using the main document but getting output which is similar to:

\documentclass[12pt]{beamer}
\title{Lecture X}

\begin{document}
\maketitle

\begin{frame}
Lecture X
\end{frame}

\end{document}


where I can change X from 1 to 2 to 3 to eventually end up with slides for each lecture in separate documents produced in the main document. But, what I want is also for the navigation bar on each slide to be from the main document, so that it's clearly shown what was done before and what is ahead. I've been looking at using \part or something like that, but haven't figured out how. Is this doable?

• try subfiles package – touhami May 9 '16 at 12:56
• \include with associated \includeonly should work. – Ignasi May 9 '16 at 13:38

Using the \lecture{<name>}{<label>} command of beamer makes it easy to create a pdf with just a specific part of the slides.

\documentclass{beamer}

\includeonlylecture{lec2}

\begin{document}

\lecture{lecture 1}{lec1}
\begin{frame}
content 1
\end{frame}

\lecture{lecture 2}{lec2}
\begin{frame}
content 2
\end{frame}

\end{document}

• Is there any way to generate the PDF for all lectures in one go ? – Vincent Fourmond Mar 9 at 13:52