How to include, in beamer handout, a slide exactly as it appears in presentation mode on a particular transition?

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?

• You can use separate overlay specifications for presentation and handout mode with, e.g., \only<n|handout:m>{<content>}. I'll try to elaborate later when I have some time. – erik Nov 25 '14 at 23:06

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}


• Great answer, thank you a lot! Please note that there is an improvement of it (tex.stackexchange.com/questions/455444/…) that still allows to show only a subset of the frames in presentation mode. As you write, your solution shows all slides in the presentation mode. Specifying "standard" subsets is also not possible anymore, since your code requires to give "\slideselection" instead. To solve this issue, I have parametrized this command to allow specifying the subsets again. – Prof.Chaos Oct 16 '18 at 18:58

You can apply overlay specifications separately to beamer and handout mode by adding |handout:"overlay specification" after the initial (beamer) specification. In your first list you have \begin{itemize}[<+->], which flattens everything onto one handout frame because no overlay specifications are given to say otherwise. If you change this to \begin{itemize}[<+-|handout:+->], the +- behavior will apply to handout mode as well. I hope this usage is clear in the code below.

\documentclass[handout]{beamer}
\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}
\begin{frame}
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}[<+-|handout:+->]
\item Item 1
\item Item 2
\item Item 3
\item Item 4
\end{itemize}
\end{frame}
\end{document}

• But then I have to write this at each and every overlay specification. And as I said, there are like a hundred of them, so I really don't want to have to do that. Is there no way of just saying "Hey! On this slide you should generated the handout exactly as you did in beamer mode"? – gablin Nov 27 '14 at 17:24
• Try using \begin{itemize}[<handout:+->] in your definition of slideContent. – erik Nov 27 '14 at 18:18
• I understand that, but what I'm trying to say is that I have a hundred "\begin{itemize}<[+-]>" on which I would have to do this change - these slides contains complicated TikZ figures, where I heavily make use of <...> in order to make nodes appear and disappear - and therefore I'm wonder if there is some other way of achieving the same effect, but with much fewer augmentations. – gablin Nov 27 '14 at 18:34
• Since you had explicitly defined slideContent I assumed you were using it in multiple places, in which case changing the definition would affect the entire document. In what way would you like handout mode to behave different to beamer mode? If you basically want the behavior to be the same I see no reason for using handout mode. – erik Nov 28 '14 at 22:40
• I used \slideContent in order to get a new slide number for each transition, but in this case I could have done without that macro and defined the content directly within the frame. However, my problem remains. The thing is that I don't want to change the behavior of handout to be exactly like beamer mode for the entire document. I only want this behavior to be enforced for certain slides; in this case, the second frame and not the first frame. – gablin Dec 2 '14 at 23:59

Well, I finally got what I was looking for, but I had to completely circumvent usage of handout mode.

What I did was to use pdftk to take the beamer mode PDF, and chop it up in order to produce the handout mode PDF, like so:

pdftk presentation.pdf cat 1 6 10-20 60-70 76 81 [...] output handout.pdf


It's not the best solution since you have to manually pick which slides to keep, but since the command is embedded into a Makefile, and it's rare for me to add or remove slides, it's good enough to automate the task of producing the handout whenever I fix some bug in the slides.