Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a frame where I uncover a tikz-diagram in 12 slides. In the next frame, I want to repeat a scaled-down version of the full diagram (slide 12). I've tried to use a combination of \savebox, \usebox, \scalebox, but can't get the overlay specifications to work with saving and using boxes.

A trimmed-down example of what I'm trying to achieve is like this:

\documentclass{beamer}
\usepackage{tikz}
\usepackage{graphicx}
\begin{document}

\newsavebox{\mybox}
\savebox{\mybox}{
\begin{overprint}
\begin{tikzpicture}
\onslide<1->{\node (A) at (0, 0) {Spam};}
\onslide<2->{\node (S) at (1, 1) {Eggs};}
\end{tikzpicture}
\end{overprint}
}

\begin{frame}
\usebox{\mybox} % here, I want to show ALL slides in the frame
\end{frame}

\begin{frame}
\scalebox{2}{\usebox{\mybox}} % here, I want only the LAST slide in the frame
\end{frame}

\end{document}

This appears to store only the first slide of the frame into \mybox. However, I want to have all slides in the first \usebox and only the last slide in the second \usebox.

I've also tried compiling the first frame as usual and then something like \savebox{\mybox}{\againframe<2>{myframe}}, but this resulted in an error message Missing \endgroup inserted.. And anyway, I don't want to repeat the full frame, but only the tikzpicture.

So, my question:

  • How do I repeat a scaled-down version of a specific overlay of a tikzpicture from a previous frame?
share|improve this question

1 Answer 1

up vote 7 down vote accepted

The saveboxes and the overlay mechanism are not compatible which each other. The savebox fixes the typeset output of its content and does not allow this animations. You should consider storing the code into a macro instead which is used twice. This is less efficient as a box but works with overlays.

Only having the last slide in the second frame is actually an additional issue. You can use the overlay argument of frame to only have certain overlay steps displayed, but this will count for the whole frame. While OK in your minimal example it is no good if you have different overlay material in the frame with the scaled picture. In this case I would need more details on that.

Here a principal example. Note that I replaced the box with a macro. I also added some % at the end of some lines to avoid spurious spaces there (line endings can be taken as spaces).

\documentclass{beamer}
\usepackage{tikz}
\usepackage{graphicx}
\begin{document}

\newcommand{\mypic}{%
\begin{overprint}
\begin{tikzpicture}
\onslide<1->{\node (A) at (0, 0) {Spam};}
\onslide<2->{\node (S) at (1, 1) {Eggs};}
\end{tikzpicture}
\end{overprint}%
}

\begin{frame}
    \mypic
\end{frame}

\begin{frame}<2>
    \scalebox{2}{\mypic} % here, I want only the LAST slide in the frame
\end{frame}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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