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.

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?

share|improve this question
    
I did find a workaround by adding an invisible node in an earlier slide, just to force the tikzpicture to have the same bounding box. But I'd like a more robust solution. –  gerrit Dec 1 '11 at 16:24
add comment

1 Answer

You could try making the node an overlay: \only<2->{\spy [size=3cm] on (1,1) in node[overlay] at (4, 4);} Then you don't need the overprint environment at all. An overlay node means it is not added to the bounding box.

share|improve this answer
add comment

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.