Include/exclude defined frames in Beamer

Viewed 2329

I have a large Beamer file with many frames. Based on the presentation purpose, I want to include/exclude certain slides from the presentation. Is there a way to define the frames at the end of the document and call them up when wanted? Something like the following:

\documentclass{beamer}
\begin{document}

% including the frames
\include{F1}
\include{F2}
% \include{F3}
\include{F4}


% frame definitions
\begin{frame}[F1]
1
\end{frame}
\begin{frame}[F2]
2
\end{frame}
\begin{frame}[F3]
3
\end{frame}
\begin{frame}[F4]
4
\end{frame}
\end{document}

I know that I can go frame by frame and add <beamer:0> to exclude that frame, but since the presentation is too long it would be great if I had the possibility to do as above.

2 Answers

This is exactly what the \includeonlyframes command is made for:

\documentclass{beamer}

\includeonlyframes{%
F1,%
F2,%
%F3,%
F4,%
}


\begin{document}

\begin{frame}[label=F1]
1
\end{frame}
\begin{frame}[label=F2]
2
\end{frame}
\begin{frame}[label=F3]
3
\end{frame}
\begin{frame}[label=F4]
4
\end{frame}

\end{document}
Related