3

Successfully using constructs like

\node<3-> (something) ...;

or

\draw<2-> (from here) -- (to here);

in tikzpictures inside beamer with overlays, I've now encountered a problem. Suppose in a tikzpicture I have something like

\draw[->] (X) -- (Y) node[midway,above] {$f$};

and I want the arrow appear from the beginning, but the $f$ above it on a later slide. How to achieve this? Seems that things like <2-> only work with \node<2-> but produce errors with node<2-> (when without a "\"): TikZ complains about a node not having label text, although label text is present.

1 Answers1

6

The aobs-tikz defines a bunch of styles for this purpose. In particular, the famous visible on (originally in Mindmap tikzpicture in beamer (reveal step by step) is needed).

Then:

\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles}

\begin{document}
\begin{frame}{title}
\begin{tikzpicture}
\draw[->] (0,0) -- (3,0) node[midway,above,visible on=<2>] {$f$};
\end{tikzpicture}
\end{frame}
\end{document}

gives

enter image description here