3

In beamer, when I try to reference a node outside the current picture but inside an overprint-environment, like this,

\documentclass[12pt]{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{overprint}
\begin{tikzpicture}[remember picture]
 \node<1->[draw] (xxx) at (0,0) {Spam};
 \node<2->[draw] (yyy) at (1, 1) {Eggs};
\end{tikzpicture}
Some text, tra la la.
\tikz<2>[remember picture] \draw[overlay,->] (xxx.north) -- (yyy.south);
\end{overprint}
\end{frame}
\end{document}

and compiling with pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011), using beamer 2011/09/12 development version 3.12, tikz 2010/10/13 v2.10 (rcs-revision 1.76), I receive the following error message:

! Package pgf Error: No shape named yyy is known.

My questions:

  • Is it possible to refer to a node inside an overprint-environment?
  • If yes, how?
  • If no, is this a fundamental limitation, or a limitation to the current implementation?
  • Why is this?

Related but different questions:

  • The following seems to compile but you need a little work to fix the position of the graphics. Remove the overprint environment and replace it with: \begin{tikzpicture}[remember picture] \node<1->[draw] (xxx) at (0,0) {Spam}; \node<2->[draw] (yyy) at (1, 1) {Eggs}; \draw<2>[overlay,->] (xxx.north) -- (yyy.south); \end{tikzpicture} Some text, tra la la. – percusse Nov 30 '11 at 18:11
  • In my actual example (removed for the MWE) I have a different image (outside the tikzpicture environment) in one of the slides. But Andrew's solution works. – gerrit Nov 30 '11 at 20:35
3

The problem with your code is that the \tikz command itself is not overlay-aware. (I think that it would be quite difficult to make it so.) So the \tikz stuff is getting executed on every slide, but the yyy node doesn't exist until the second slide so it doesn't know what to do with it. If you shift the <2> to the \draw instead then it works.

\documentclass[12pt]{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{overprint}
\begin{tikzpicture}[remember picture]
 \node<1->[draw] (xxx) at (0,0) {Spam};
 \node<2->[draw] (yyy) at (1, 1) {Eggs};
\end{tikzpicture}
Some text, tra la la.
\tikz[remember picture] \draw<2>[overlay,->] (xxx.north) -- (yyy.south);
\end{overprint}
\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.