# tikz and beamer overlays. How to avoid repositioning of images?

I want to slowly uncover nodes in a tree. however when I use overlays the resulting image will jump around in the slides. how do I get rid of that?

\documentclass{beamer}
\usepackage{tikz}

\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\begin{document}
\begin{frame}
\frametitle{Standard Approach}
\begin{tikzpicture}
\draw node[circle,draw] (0) at (0,0) {$s_0$};

\draw <2-> node[circle,draw] (1) at (-1,-1) {$s_1$};
\draw <2-> node[circle,draw] (2) at (1,-1) {$s_2$};
\draw <2-> [->, dashed] (0) to (1);
\draw <2-> [->] (0) to (2);

\draw <3-> node[circle,draw] (3) at (-0.5,-2) {$m$};
\draw <3-> node[circle,draw] (4) at (-1.5,-2) {$j$};
\draw <3-> [->] (1) to (3);
\draw <3-> [->, dashed] (1) to (4);

\draw <4-> node[circle,draw] (5) at (0.5,-2) {$s$};
\draw <4-> node[circle,draw] (6) at (1.5,-2) {$s_3$};
\draw <4-> node[circle,draw] (7) at (1,-3) {$a_r$};
\draw <4-> node[circle,draw] (8) at (2,-3) {$a_i$};
\draw <4-> [->, dashed] (2) to (5);
\draw <4-> [->] (2) to (6);
\draw <4-> [->] (6) to (8);
\draw <4-> [->, dashed] (6) to (7);
\end{tikzpicture}
\end{frame}
\end{document}

-
use \visible or \onslide – Thorsten Feb 19 '12 at 14:34
possible duplicate of beamer: \only with columns makes things move down – Thorsten Feb 19 '12 at 14:35

Your friend in cases like this is \onslide.

\documentclass{beamer}
\usepackage{tikz}

\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\begin{document}
\begin{frame}
\frametitle{Standard Approach}
\begin{tikzpicture}
\draw node[circle,draw] (0) at (0,0) {$s_0$};

\onslide<2->{\draw node[circle,draw] (1) at (-1,-1) {$s_1$};
\draw node[circle,draw] (2) at (1,-1) {$s_2$};
\draw [->, dashed] (0) to (1);
\draw [->] (0) to (2);}

\onslide<3->{\draw node[circle,draw] (3) at (-0.5,-2) {$m$};
\draw node[circle,draw] (4) at (-1.5,-2) {$j$};
\draw [->] (1) to (3);
\draw [->, dashed] (1) to (4);}

\onslide<4->{\draw node[circle,draw] (5) at (0.5,-2) {$s$};
\draw node[circle,draw] (6) at (1.5,-2) {$s_3$};
\draw node[circle,draw] (7) at (1,-3) {$a_r$};
\draw node[circle,draw] (8) at (2,-3) {$a_i$};
\draw [->, dashed] (2) to (5);
\draw [->] (2) to (6);
\draw [->] (6) to (8);
\draw [->, dashed] (6) to (7);}
\end{tikzpicture}
\end{frame}
\end{document}

-
oh yes that what I want! – Alex Feb 19 '12 at 14:35