# How to prevent a jumping picture when using tikz overlays

I have the following tikz picture in Beamer

\usetikzlibrary{fit,calc,positioning,matrix,decorations.pathmorphing}
\begin{tikzpicture}[scale=0.8,system/.style={draw,rectangle,rounded corners=3,minimum width=2cm,text width=1.8cm,text centered}]
\node [system] (fe) {Feature Extraction};
\node [system] (am) [right=of fe] {Acoustic Model};

\draw[->] (fe) |- (am);
\draw[<-,decorate,decoration={snake,pre length=6mm,segment length=2mm,amplitude=3mm}] (fe.west) -- ++(-2cm,0);

\node<2-> [above=of fe.north] {Fast Fourier Tranform};
\end{tikzpicture}


As you can see I add a node in a second slide. However, the whole picture will jump when this is added.

How can I prevent my picture from jumping?

-
When posting code, please also specify any particular packages or (as in this case) tikz libraries. The \documentclass{beamer} \usepackage{tikz} was guessable, but I had to dig to figure out which tikzlibraries you were loading. Thanks! – Loop Space Dec 6 '10 at 8:37
@Andrew Sorry for forgetting that, I'll add them still... – Peter Smit Dec 6 '10 at 8:42
Phew! And I didn't guess all of those! – Loop Space Dec 6 '10 at 13:30
Hmm, I'm now seeing that not all off them I'm actually using in this figure. Anyway, this were the libraries I included. – Peter Smit Dec 6 '10 at 15:13

The problem is due to the bounding box of the picture changing depending on whether or not that node is there. There are several ways to resolve this:

1. Explicitly tell tikz what the bounding box is, thus ensuring that it is the same on both slides, using the \useasboundingbox or \path[use as bounding box] syntax. Pros: you get exactly what you ask for. Cons: you have to know exactly what to ask for.

2. Make the extra stuff always there, but only visible on the second slide. There are a few ways of doing this; perhaps the simplest to wrap the whole node in a \visible<2->{...} rather than using \node<2->. (It would be nice if tikz commands took actions as well as bare overlay specifications, but this doesn't seem to be the case.) Another way is to put the node text in an overlay command, {\visible<2->{Fast Fourier Transform}}. Yet another way would be to place an empty node (or a coordinate) at the desired spot and then put the node with text on the next slide:

\coordinate [above=of fe.north] (pt);
\node<2-> at (pt) {Fast Fourier Transform};


Though this could still lead to a jump, you'd probably want to position the textual node so that it was below the coordinate.

-
Thanks for your excellent answer (as always!) – Peter Smit Dec 6 '10 at 8:44