[Tex/LaTex] How to include, in beamer handout, a slide exactly as it appears in presentation mode on a particular transition

beameroverlays

I have a beamer presentation where I do something like in the following MWE:

\documentclass[handout]{beamer}

\include{tikz}% To get \foreach

\begin{document}

\begin{frame}
  These I want to uncover one by one in presentation mode, but to appear
  as a single slide in the handout

  \begin{itemize}[<+->]
    \item Item 1
    \item Item 2
    \item Item 3
    \item Item 4
  \end{itemize}
\end{frame}

\def\slideContent{
  These I want to uncover one by one in presentation mode *and* do the same
  in the handout. But that's not what I get!

  \begin{itemize}[<+->]
    \item Item 1
    \item Item 2
    \item Item 3
    \item Item 4
  \end{itemize}
}

\foreach \i in {1, ..., 4} {
  \begin{frame}<\i>
    \slideContent
  \end{frame}
}

\end{document}

The first frame is generated as expected in handout mode, but the last 4 frames are not since handout collapses all effects onto a single slide. And that's not what I want. Instead, I want those last 4 slides to appear exactly as they do in presentation mode. I know this can somehow be achieved by explicitly adding handout:0 to suppress effects from the handout, but I have some really complicated figures where it's just not maintainable to go in and do this for each and every single overlay. Note that this is not about excluding certain slides, because then I would have just added handout:0 to those slides, but here it's more about limiting the effects seen at handout to a certain number of transitions.

So, in a nutshell, how can I get handout mode to behave exactly as the presentation mode for certain slides?

Best Answer

A workaround on your problem is to temporarily change from handout to beamer mode while compiling. This way you can select a subset of slides, exactly as they are compiled in presentation mode. The trick is to change the internal variable \beamer@currentmode that Beamer uses (I don't know if messing with this can break any thing). I created a new environment to encapsulate this change for my slides, so I hope it can be useful.

What you have to do is:

  1. copy the definitions to the preamble
  2. put your frame in a \begin{handoutframeselect}[2,4-5], changing the specification to whatever you need
  3. put a selection macro in front of your frame: \begin{frame}<\slideselection>

The macro \slideselection will select the whole set of slides when in presentation mode, but only you specification when in handout mode. Check the example:

\documentclass[handout]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{default}
\usepackage{tikz}

\makeatletter
\newif\ifOnBeamerModeTransition
\newcommand{\slideselection}{1-}%
\newenvironment{handoutframeselect}[1][1-]{%
  \begingroup%
  \mode<handout>{%
    \gdef\beamer@currentmode{beamer}%
    \OnBeamerModeTransitiontrue%
    \renewcommand{\slideselection}{#1}}%
}{%
  \ifOnBeamerModeTransition%
    \OnBeamerModeTransitionfalse%
    \gdef\beamer@currentmode{handout}%
  \fi%
  \endgroup%
}
\makeatother

\begin{document}

\begin{frame}{Normal frame}
No selection in this frame:
\begin{itemize}[<+->]
  \item slide 1
  \item slide 2
  \item slide 3
\end{itemize}
\end{frame}

\begin{handoutframeselect}[2,4-5]
\begin{frame}<\slideselection>{Custom frame}
slideselection will be
\begin{itemize}
\item 1- in beamer mode
\item 2,4-5 in handout mode
\end{itemize}

This slides will be shown : \slideselection
\begin{itemize}[<+->]
  \item custom slide 1
  \item custom slide 2
  \item custom slide 3
  \item custom slide 4
  \item custom slide 5
\end{itemize}
\end{frame}
\end{handoutframeselect}

\begin{frame}{Other normal frame}
In this frame, we return to handout mode, no selection either:
\begin{itemize}[<+->]
  \item slide 1
  \item slide 2
  \item slide 3
\end{itemize}
\end{frame}

\end{document}

example