# Beamer vs. TikZ: uncover nodes step-by-step

I'm trying to uncover a TikZ image piece-by-piece like so:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{frame}{Linearity}
\begin{center}
\begin{tikzpicture}
\node (Ctx) {\visible<2->{$\Gamma$}};
\node[below right=0.5cm and 0.1cm of Ctx] (E) {$E$};
\node[below right=0.5cm and 0.1cm of E] (psi1) {\visible<3->{$\Psi_1$}};
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}


However, this gives the following error message:

! Package tikz Error: Giving up on this path. Did you forget a semicolon?.

See the tikz package documentation for explanation.
Type  H <return>  for immediate help.
...

l.16 \end{frame}


If I use \only instead of \visible, pdflatex runs OK but the output jumps around when going from slide to slide, since the invisible nodes don't take up space and thus the E node's position changes. So \visible is what I need.

• I don't know why (which is why I'm leaving this as a comment rather than an answer), but adding another layer of grouping fixes it for me, namely {{\visible<2->{$\Gamma$}}} (and similarly for the other node). (An alternative strategy is to lay out coordinates to get the positioning right then to "hang" the nodes on the relevant spots afterwards; these nodes can safely be switched on and off via \node<2-> etc since they no longer play a part in the positioning.) Jan 16, 2011 at 21:54

In the one case I overlayed TikZ I was using \uncover<n-m>{ELEMENT} in order to show ELEMENT in slides n to m.

• Just remember to put the semicolon for ELEMENT inside the curly braces when using TikZ. That was a frustrating 2 minutes... Dec 19, 2011 at 6:57
• How can that be marked as a solution and even have so many votes?? This is not an answer, it is barely correct English. If this sequence of words is somehow answering the problem, can please somebody, based on that, give an actual answer that solves the problem? At the moment it hardly qualifies as such, I'd say. Feb 4, 2021 at 0:20
• As stated above and below. This here is not the solution. The actual solution is given below consisting of adding an additional pair of curled brackets to resolve the compilation error. Feb 4, 2021 at 0:28

It works if you place the \visible command and its arguments into a { } group:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{frame}{Linearity}
\begin{center}
\begin{tikzpicture}
\node (Ctx) {{\visible<2->{$\Gamma$}}};
\node[below right=0.5cm and 0.1cm of Ctx] (E) {$E$};
\node[below right=0.5cm and 0.1cm of E] (psi1) {{\visible<3->{$\Psi_1$}}};
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}


It seems that the scanning code from \visible removes the ; or otherwise interferes with the \node code. Note that \node doesn't read its content as argument but as box content to allow verbatim inside. The \visible macro might do the same and therefore such errors can happen.

• This here is actually the solution to the problem, not the one above. To emphasize, because for some reason this was not explicitly stated here: The solution consists of adding an additional pair or curled parentheses into the node. Only then the compilation error is resolved and visible/uncover/onslide can be used as intended. Feb 4, 2021 at 0:27

Here is another solution using \setbeamercovered{invisible} and \pause

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{frame}{Linearity}
\setbeamercovered{invisible}
\begin{center}
\begin{tikzpicture}
\node(Ctx){$E$};\pause
\node[above left=0.5cm and 0.1cm of Ctx] (gamma) {$\Gamma$};\pause
\node[below right=0.5cm and 0.1cm of Ctx] (psi1){$\Psi_1$};\pause
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}


This can also be contained in \columns where one can have tables, minipages or other nodes to explain what is going on in a diagram using \onslide<n->. I use this frequently to simultaneously expose a geometric diagram and a two-column proof. Hope it is of interest.