So in my Beamer slides, I'm using this to highlight various parts of a tikz figure on different slides.
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,automata}
\tikzset{onslide/.code args={<#1>#2}{%
\only<#1>{\pgfkeysalso{#2}}
}}
\tikzstyle{highlight}=[red,ultra thick]
\begin{document}
\begin{frame}
\begin{figure}
\centering
\begin{tikzpicture}[->]
\node[state, onslide={<1>{highlight}}, initial by arrow, initial text={}, initial where=above, label={above left:\(\varnothing\)}] (1) {\(s_1\)};
\node[state, onslide=<1>{highlight}, label={above left:\(\{a\}\)}] (2) [right= of 1] {\(s_2\)};
\draw[onslide={<2>{highlight}}] (1) edge node [above] {0.3} (2);
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
Note: I'm using the tikz libraries positioning and automata.
It works fine for highlighting the nodes and the edge. However, on the next slides I want to be able to highlight:
- The labels of the states
- The labels of the edges (and optimally not highlight them on the second slide)
- (optionally) the initial by arrow of
s_1
I tried inserting onslide=... into label={...} for the states, but that gives the following error:
! Package PGF Math Error: Unknown function `onslide' (in 'onslide').

\documentclass{...}and ending with\end{document}. – Mar 21 '15 at 11:31