11

I'm wondering if there is some macro I can use to take a snapshot of an entire Beamer frame (in its last slide) and reuse it in another frame. The following code does not work, is just for illustrating the idea.

\documentclass{beamer}
\begin{document}
\begin{frame}
\mymacro{
%normal frame content goes here
}
\end{frame}

\begin{frame}
\insertmymacro[scale=.30] %this will insert the snapshot of the previous frame, possibly scaled 
\end{frame}
\end{document}

There should also be a way to tell the macro which frame has to be inserted if more than one has been snapshotted.

Does something like this already exist?

7
  • \againframe[myframelabel] where you have named a particular frame myframelabel Welcome to TeX.SX! ;-)
    – user31729
    Oct 19 '14 at 17:06
  • Do you want to provide a smaller 'snapshot' or the complete frame again?
    – user31729
    Oct 19 '14 at 17:09
  • a smaller snapshot, like when you put a snapshot of a web page into a book to illustrate its content. So I can't use \againframe
    – S.Key
    Oct 19 '14 at 17:12
  • You want to show the frame content only again or the whole frame with borders etc?
    – user31729
    Oct 19 '14 at 17:18
  • the complete frame (scaled of course). Exaclty as if I took a real snapshot with a screen capture software and included it via \includegraphics
    – S.Key
    Oct 19 '14 at 17:21
6

Here, I save the first frame in a named \vbox. I can then recall the content (as is, or scaled and framed) with a \usebox.

I had to horizontally pad out the saved box a little; I think the padding is needed because the \vbox is of width \textwidth whereas the slide width is wider than that.

EDITED to remove stray blank frame.

MANUAL VERSION:

\documentclass{beamer}
\newsavebox\saveframe
\fboxsep=0pt
\begin{document}
%SAVE-FRAME
\savebox{\saveframe}{\vbox{
\begin{frame}
{1st Frame}
frame text from the first frame.  I will now begin an itemized list.  And we begin:
\begin{itemize}
\item AAA
\item BBB
\item CCC
\end{itemize}
\end{frame}}}

%PRESENT THE SAVE-FRAME AS IS
\begin{frame}
\usebox{\saveframe}
\end{frame}

%PRESENT THE 2ND FRAME INCLUDING A SCALED SAVE-FRAME
\begin{frame}
{2nd frame}
Here is my prior frame\par
\fbox{\scalebox{.6}{\hspace{1cm}\usebox{\saveframe}\hspace{1cm}}}
\end{frame}
\end{document}

enter image description here

enter image description here


AUTOMATED VERSION:

If one would like the boxing automated, I provide the sframe{} environment in the following MWE to output and save a frame. A {title} is a mandatory argument to the environment. A boxed, scaled version of the saved frame can be obtained with \savedframe{scale}, invoked inside a frame environment. The following MWE behaves identically to the manual version above.

\documentclass{beamer}
\global\newsavebox\thesaveframe

\newenvironment{sframe}[1]%
{\setbox0=\vbox\bgroup\begin{frame}{#1}}
{\end{frame}\leavevmode\unskip\setbox0=\lastbox \egroup%
 \global\sbox{\thesaveframe}{\box0}
 \begin{frame}\usebox{\thesaveframe}\end{frame}
}

\newcommand\savedframe[1]{\fboxsep=0pt%
  \fbox{\scalebox{#1}{\hspace{1cm}\usebox{\thesaveframe}\hspace{1cm}}}%
}
\begin{document}
%SAVE-FRAME AND OUTPUT IT
\begin{sframe}{1st Frame}
frame text from the first frame.  I will now begin an itemized list.  And we begin:
\begin{itemize}
\item AAA
\item BBB
\item CCC
\end{itemize}
\end{sframe}

%PRESENT THE 2ND FRAME INCLUDING A SCALED SAVE-FRAME
\begin{frame}
{2nd frame}
Here is my prior frame\par
\savedframe{.6}
\end{frame}
\end{document}
3
  • What if the frame I want to include contains animations? How can I include the very last slide, which has all the animations unfolded?
    – Jessy09
    Mar 15 '19 at 17:43
  • @Jessy09 I wish I could offer advice, but I have no experience with animations. Perhaps you should ask it as a new question, so other eyes can see it. Mar 15 '19 at 17:46
  • I just did that. Thank you anyways for your reply.
    – Jessy09
    Mar 15 '19 at 19:20
3

I needed this today as well, and I expanded a bit on Steven's answer, defining two commands which allow you to save and use immediately multiple frames and then reuse them later:

% \saveuseframe{id}{...} saves a frame to \saveid and uses it immediately, to be reused with \reuseframe{id}
\newcommand{\saveuseframe}[2]{%
  \expandafter\newsavebox\csname save#1\endcsname%
  \expandafter\savebox\csname save#1\endcsname{\vbox{\vspace{-.1em}#2}}%
  \begin{frame}\expandafter\usebox\csname save#1\endcsname\end{frame}}
\newcommand{\reuseframe}[1]{\fbox{\scalebox{.25}{\hspace{.9cm}\expandafter\usebox\csname save#1\endcsname\hspace{.8cm}}}}

This allows you to do this:

\savedframe{motivation}{\begin{frame}{Motivation}
  why?
\end{frame}}

... more stuff ...

\savedframe{future}{\begin{frame}{Future work}
  future stuff
\end{frame}}

\begin{frame}{Thank you!}
  \reuseframe{motivation}
  \reuseframe{future}
\end{frame}
2

For the special case the the previous frame should be inserted again, one can use the \insertslideintonotes{<scale>} macro:

\documentclass{beamer}

\makeatletter
\edef\beamer@origlmargin{\Gm@lmargin}%
\edef\beamer@origrmargin{\Gm@rmargin}%
\makeatother

\begin{document}
\begin{frame}
normal frame
\end{frame}

\begin{frame}
\insertslideintonotes{0.3}
\end{frame}
\end{document}

If the frame in question should be saved for later reuse, one could do something like this:

\documentclass{beamer}

\makeatletter
\edef\beamer@origlmargin{\Gm@lmargin}%
\edef\beamer@origrmargin{\Gm@rmargin}%
\makeatother

\newsavebox{\mybox}

\begin{document}
\begin{frame}
interesting frame
\end{frame}
\savebox{\mybox}{\insertslideintonotes{0.3}}

\begin{frame}
some other stuff
\end{frame}

\begin{frame}
\usebox{\mybox}
\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.