# Another instance of beamer <-> TikZ interaction

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.

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

• Thank you very much! Is the overlay-beamer-styles library documented somewhere? I suspect it is capable of many more nice things :) – მამუკა ჯიბლაძე Jan 12 '15 at 9:37
• @მამუკაჯიბლაძე: Yes, the first link I provided in my answer points to the package and there you can find the documentation. – Claudio Fiandrino Jan 12 '15 at 10:08
• Yes I've seen it but sorry it is too technical for me to understand. For example, I would never discover in that document the wonderful solution to my problem that you gave in your answer here. I thought maybe there are some simple key usage examples like this one you provided here. – მამუკა ჯიბლაძე Jan 12 '15 at 11:33
• @მამუკაჯიბლაძე: Yes, you can find some simple examples in tex.stackexchange.com/q/84513/13304 – Claudio Fiandrino Jan 12 '15 at 11:39