3

I have been reading the source code for the template: https://www.overleaf.com/latex/templates/beamer-arrows/wmqkckggvjsd which clearly shows that path supports overlays, so you can have edges on certain slides only.

However I needed the same with \draw and doing something like \draw<2-> doesn't work (compile error). Do overlays not work with draw? Where do I find an exhaustive list of overlays friendly tikz commands?

Stefan Pinnow
  • 29,535
omglol
  • 33
  • 1
    Are you by chance looking for the aobs package? –  Jun 02 '18 at 03:30
  • some related question: https://tex.stackexchange.com/questions/146908/beamer-overlay-specifications-for-a-tikzpicture https://tex.stackexchange.com/questions/185870/beamer-overlays-changing-font-between-slides https://tex.stackexchange.com/questions/6135/how-to-make-beamer-overlays-with-tikz-node – samcarter_is_at_topanswers.xyz Jun 02 '18 at 12:03

2 Answers2

4

I'm not sure I understand the question. But there is a special library for doing TikZ overlays in beamer: aobs. In addition, you can always work with \only.

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,overlay-beamer-styles}
\begin{document}
\begin{frame}[t]
\frametitle{An example}
\begin{tikzpicture}
\node[background fill=red!50,%
fill on=<2>,%
rounded corners,%
] (koala) {koala bear};
\node[right=3cm of koala,
background fill=blue!50,%
fill on=<3>,%
rounded corners,%
] (marmot) {marmot};
\only<2>{
\draw[-latex] (koala) -- (marmot) node[midway,above]{envy};
}
\only<3>{
\draw[latex-] (koala) -- (marmot) node[midway,above]{like};
}
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

3

Till Tantau being the creator of BEAMER and Tikz-PGF the overlay work with tikz. Just add the overlay specification after the command name.

For example, here to make the transparency visible on the second and all subsequent images: draw<2->(0,0)--(2,0);

If you had a compilation error it is not from the overlay placed on the \draw command. I place overlays on almost all my slideshows with tikz and I haven't had a compilation error yet.

Give a minimal example so that this error can be reproduced and corrected.

AndréC
  • 24,137