In my presentation, I want to successively highlight different parts of my image using the TikZ spy library.
Due to size constraints, the actual highlight is outside of the included image.
Therefore, I use beamers overprint environment with onslide.
This works fine for \node, but I cannot get it to work for \spy.
Below is a minimal, not working, example. I described the problems in the comments.
\documentclass[12pt]{beamer}
\usepackage{tikz}
\usetikzlibrary{spy}
\begin{document}
\begin{frame}
\begin{overprint}
\begin{tikzpicture}[spy using outlines={circle, blue, magnification=6, connect spies}]
% bluemarble from http://en.wikipedia.org/wiki/File:Apollo17WorldReversed.jpg
\node<1-> (image) at (0,0) {\includegraphics[width=6cm]{bluemarble}};
% this one compiles, but image jumps around
% \only<2->{\spy [size=3cm] on (1,1) in node at (4, 4);}
% this one fails to compile with: ! Extra }, or forgotten \endgroup.
% \onslide<2->\spy [size=3cm] on (1,1) in node at (4, 4);
% this one fails to compile with:
% Runaway argument?
% ]<2-> [size=3cm] on (1,1) in node at (4, 4); \end {tikzpicture} \end \ETC.
% ! Paragraph ended before \tikz@lib@spy@parse@opta was complete.
\spy<2-> [size=3cm] on (1,1) in node at (4, 4);
% these compile, but 'spy' is on every slide
% \onslide<2->{\spy [size=3cm] on (1,1) in node at (4, 4);}
% \uncover<2->{\spy [size=3cm] on (1,1) in node at (4, 4);}
\end{tikzpicture}
\end{overprint}
\end{frame}
\end{document}
The beamer user guide, section 6.3.1., Making Commands and Environments Overlay Specification-Aware, but I'm not sure how to apply this \renewcommand<> thing to \spy to make it overlay-specification aware, since \spy does not look like an "ordinary" command as I would create with (re)newcommand.
How can I use \spy without my image "jumping around", e.g. with a (preferably automatically calculated) bounding box remaining constant for the different slides?
tikzpictureto have the same bounding box. But I'd like a more robust solution. – gerrit Dec 1 '11 at 16:24