10

I look for a sensible way to keep different versions of the same talk in one beamer file: e.g., 15 min and 1 hour versions, where some content is common, but some is not. Is there a nice way to toggle between versions?

\documentclass{beamer}
\begin{document}

\title{Presentation} 
\begin{frame}
\titlepage
\end{frame}

\begin{frame}{Issue 1} % both 
\end{frame}

\begin{frame}{Issue 2 - the gist of it} % only short 
\end{frame}

%\begin{frame}{Issue 2 - the detailed version } % only long
%\end{frame}

%\begin{frame}{Issue 2 - the detailed version, contd.} % only long
%\end{frame}

\begin{frame}{Issue 3} % both
\end{frame}

% etc.

\end{document}
10

You can label each frame \begin{frame}[label=both] and then use

\includeonlyframes{<frame label list>}

A sample:

\documentclass{beamer}
%\includeonlyframes{title,both,short1,both1}      %% for short
\includeonlyframes{title,both,long1,long2,both1}  %% for long
\begin{document}

\title{Presentation}
\begin{frame}[label=title]
\titlepage
\end{frame}

\begin{frame}[label=both]{Issue 1} % both
both
\end{frame}

\begin{frame}[label=short1]{Issue 2 - the gist of it} % only short
short 1
\end{frame}

\begin{frame}[label=long1]{Issue 2 - the detailed version } % only long
long 1
\end{frame}

\begin{frame}[label=long2]{Issue 2 - the detailed version, contd.} % only long
long 2
\end{frame}

\begin{frame}[label=both1]{Issue 3} % both
both 1
\end{frame}

% etc.

\end{document}
  • 1
    Why not use just long, short and both? – Adobe Nov 2 '15 at 17:38
  • 1
    @Adobe Certainly, if you can live with lots of warnings :) – user11232 Nov 3 '15 at 1:01
8

You could use the environ package to create a new lvframe environment for frames that will appear in the "long version" of the presentation. The frame environment would be used for those in both. A boolean could then be used to switch between the two:

\documentclass{beamer}
\usepackage{environ}

\newif\iflongversion \longversiontrue%change to \longversiontrue to include the frames in the long version
\NewEnviron{lvframe}[3][]{%
    \iflongversion\begin{frame}[environment=lvframe,#1]{#2}{#3}
    \BODY
    \end{frame}\fi}

\begin{document}

\title{Presentation} 
\begin{frame}
\titlepage
\end{frame}

\begin{frame}{Issue 1} % both 
\end{frame}

\begin{frame}{Issue 2 - the gist of it} % only short 
\end{frame}

\begin{lvframe}{Issue 2 - the detailed version }{} % only long
\end{lvframe}

\begin{lvframe}{Issue 2 - the detailed version, contd.}{} % only long
\end{lvframe}

\begin{frame}{Issue 3} % both
\end{frame}

% etc.

\end{document}

Change \longversionfalse to \longversiontrue to get the "long version".

Edit:

The above is the corrected answer based on the comments from the OP and @MickG below. This definition should handle the most common implementations of \begin{frame}, specifically those of the form \begin{frame}[options]{title}{subtitle}. Note that {} is required if the subtitle argument is not wanted (lvframe does not have the same complex optional argument parsing of frame). Also, this will not work if <overlay> is needed.

  • Very nice and tidy solution. – R. Schumacher Nov 2 '15 at 4:14
  • Nice approach. The literal solution just adds stuff, but I guess one can use same trick to create svframe for short-only material. – dzeltzer Nov 2 '15 at 5:06
  • 1
    Also a minor point: frame title only work when given as \frametitle{} not as an argument to the frame environment. – dzeltzer Nov 2 '15 at 5:07
  • 1
    Should the titles of lvframes not be in []s rather than {}s? I seem to see an empty default for that #1 – MickG Nov 2 '15 at 16:28
  • OP and @MickG: Excellent observations. I have updated the answer. – Guho Nov 2 '15 at 19:27
3

I manage it with versions package that lets me easily include/exclude possibly many contiguous frames:

\documentclass{beamer}
\usepackage{xifthen}
\usepackage{versions}
%
\newboolean{longversion}
%
% Uncomment the following line to get the long version
% \setboolean{longversion}{true}
%
\ifthenelse{\boolean{longversion}}{%
  \includeversion{longversion}
  \excludeversion{shortversion}
}{%
  \excludeversion{longversion}
  \includeversion{shortversion}
}
\begin{document}

\title{Presentation}
\begin{frame}
\titlepage
\end{frame}

\begin{frame}{Issue 1} % both
\end{frame}

\begin{shortversion}
  \begin{frame}{Issue 2 - the gist of it} % only short
  \end{frame}
\end{shortversion}

\begin{longversion}
  \begin{frame}{Issue 2 - the detailed version } % only long
  \end{frame}

  \begin{frame}{Issue 2 - the detailed version, contd.} % only long
  \end{frame}
\end{longversion}

\begin{frame}{Issue 3} % both
\end{frame}

% etc.

\end{document}
  • by far the most useful answer for me. thanks! – Florian Oswald Jun 21 '17 at 13:36
  • Also works inside frames to hide parts of it and with verbatim environments like listings package. Note: The \begin and \end don't have to be in the beginning of the line, like with the comment package. – John Jun 10 at 12:03
1

There is a package exactly for this purpose, the beameraudience package:

\documentclass{beamer}

\usepackage[
    audience=experts
%   audience=beginners  
]{beameraudience}


\begin{document}

\begin{frame}{Title}
 all version
\end{frame}

\justfor{beginners}{
    \begin{frame}{Title}
      long version
    \end{frame}
}

\justfor{experts}{
    \begin{frame}{Title}
      short version
    \end{frame}
}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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