I want to uncover/draw a picture bit by bit for beamer slides. I imagined that using \only inside a \foreach loop should work, for instance:
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{tikzpicture}[every node/.style={draw,circle}]
\node (n0) {$0$};
\foreach \i [evaluate=\i as \j using \i-1] in {1,...,3} {%
\only<\i->{%
\node[right of=n\j] (n\i) {$\i$};
}
}
\end{tikzpicture}
\end{frame}
\end{document}
Unfortunately, two problems occur.
Something goes wrong with node names; I get errors of the form
Package pgf Error: No shape named n0.0 is known.When using
\jin the parameter of\only, I get hundreds of errors and pages.
What is going on here?
evaluatework as intended and I used it wrong? – Raphael Oct 21 '13 at 09:50\foreach \i [evaluate=\i as \j using int(\i-1)]; see percusse's comment. – Claudio Fiandrino Oct 21 '13 at 09:55evaluatevariables withonly, bad stuff happens. I think that should be searchable. – Raphael Oct 21 '13 at 13:16<0.0->,<1.0->and so on for the overlays. Usingint,countorremember(withinitiallyhere) works for me for the overlays, too. Either way, it is linked now and can be found.:)By the way, you can also say\node<\i-1> …. – Qrrbrbirlbel Oct 21 '13 at 13:23