# Beamer: handout/article mode - produce multiple copies of a frame with distinct overlay numbers

Similar questions have been asked before, but I was unable to come up with a general purpose solution out of the answers provided.

First, here is a MWE:

%\documentclass{beamer}
\documentclass[handout]{beamer}
%\documentclass{article}
%\usepackage{beamerarticle}

\begin{document}

\begin{frame}[label=foo]\frametitle{My only frame}
\begin{enumerate}[]
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\end{enumerate}
\end{frame}

\againframe{foo}
\againframe{foo}
\end{document}


As can be seen in the example, the challenge is in producing two snapshots of the evolution of the frame that is built. In the example, I try, but fail to produce two such snapshots: one at overlay 5 and another at (the final) overlay 10.

I am search for a solution that would make this possible, without modifying the overlay instructions within the frame. If this is not possible, I guess not only me, but others would be interested in a solution that uses O(k) modifications to the frame, where k is the number of snapshots (rather than O(n) work, where n is the total number of overlays.

It would be really nice to achieve this in both the article and the handout modes. I suspect that the former is more challenging.

I conjecture that this is not possible. If this is indeed the case, a definite answer will also be useful. At least one stop searching if this is the case, and perhaps beamer will offer this some day.

Related previous questions

• What do you mean by "overlay numbers"? Jan 26, 2015 at 20:52
• In presentation mode, there is no 5 or 10: your example yields 3 identical frames. I don't understand your requirements either because I don't understand the 'O(k)' and 'O(n)' or what exactly it is OK to need to specify.
– cfr
Jan 27, 2015 at 0:22
• Here is what I mean by "overlaynumber": \newcommand*{\overlaynumber}{\number\beamer@slideinframe} Jan 27, 2015 at 19:06

You do need to tell beamer what you want to appear in each frame of the handout version. You can use \onslide specifications to do this so that you do not need to modify the existing overlay specifications at all. (I'm not sure this is what you want - probably not.)

The following code modifies your MWE so that, in presentation mode, there would actually be 10 slides within the frame. These are then placed on slides 1 or 2 of the handout. This is a waste of code: if you only want to show slide 5 and slide 10, you do not need two \againframe but only one. But, anyway, with the two:

\documentclass[handout]{beamer}

\begin{document}

\begin{frame}<1-| handout:0>[label=foo]{My only frame}
\begin{enumerate}[<+->]% or whatever you like for presentation mode
\onslide<1-| handout:1-2>
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\onslide<1-| handout:2>
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\end{enumerate}
\end{frame}

\againframe<0| handout:1>{foo}
\againframe<0| handout:2>{foo}
\end{document}


More efficiently with only one repeat:

\documentclass[handout]{beamer}

\begin{document}

\begin{frame}<1-| handout:1>[label=foo]{My only frame}
\begin{enumerate}[<+->]% or whatever you like for presentation mode
\onslide<1-| handout:1-2>
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\onslide<1-| handout:2>
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\item Item \arabic{enumi}
\end{enumerate}
\end{frame}

\againframe<0| handout:2>{foo}
\end{document}


I'm not sure how this could apply to article mode since then there are no frames or slides.

I have been trying to solve the same problem but - as you - failed to find a beamer-only solution. A possible workaround could be to extract the interesting frames from the 'slides' version of the presentation. In linux, the following works for me:

MWE (example of merge sort):

\documentclass{beamer}

\usepackage{tikz}

\begin{document}

\begin{frame}{Merge Example}

\begin{center}
\begin{tikzpicture}
\tikzstyle{num}=[rectangle,draw,minimum size=1.65em]
\tikzstyle{invis}=[rectangle,minimum size=1.65em,draw,color=gray!30]
\tikzstyle{sorted}=[rectangle,draw,green,inner sep=0.3em,very thick]
\node<3->[num,right of=s] (s-1) { 5};
\node<5->[num,right of=s-1] (s-2) { 6};
\node<7->[num,right of=s-2] (s-3) { 7};
\node<8->[num,right of=s-3] (s-4) { 9};
\node<9->[num,right of=s-4] (s-5) { 19};
\node<-4>[num,right of=s1] (s1-1) {6};
\node<5->[invis,right of=s1] (s1-1) {6};
\node<-6>[num,right of=s1-1] (s1-2) {7};
\node<7->[invis,right of=s1-1] (s1-2) {7};
\node<-2>[num,right of=s2] (s2-1) {5};
\node<3->[invis,right of=s2] (s2-1) {5};
\node<-7>[num,right of=s2-1] (s2-2) {9};
\node<8->[invis,right of=s2-1] (s2-2) {9};
\node<-8>[num,right of=s2-2] (s2-3) {19};
\node<9->[invis,right of=s2-2] (s2-3) {19};
\draw<2>[latex-latex] (s1-1) edge[out=-90,in=90] (s2-1);
\draw<4>[latex-latex] (s1-1) edge[out=-90,in=90] (s2-2);
\draw<6>[latex-latex] (s1-2) edge[out=-90,in=90] (s2-2);
\end{tikzpicture}
\end{center}

\end{frame}

\end{document}


With the above example stored in the file merge.tex, the following commands will generate a 2-by-2 handout version with overlays 1,2,3,9:

pdflatex merge.tex
pdftk merge.pdf cat 1 2 3 9 output - | pdfnup --nup 2x2 --outfile merge-2x2.pdf


The obvious drawbacks are:

1. You would need to keep track of the actual page numbers in merge.pdf as they would shift if you insert/remove a frame and/or overlay before the interesting frame.
2. The generated 2-by-2 page would need to be spliced into the "vanilla" handout generated by the beamer handouts mode.

There might be ways to automate that, e.g., using Makefiles, but I haven't tried that yet.

Still, if you have a long enough animation and want to capture, e.g. the first, some intermediate, and last overlay, it might be acceptable.