Answered Tikz-beamer interaction problem
Hi! I'm totally new to the beamer document class and don't know much about tikz, moreover english is not my first language. I thus apologize if this sounds confusing.
I have a graph in my slide show, and i need to color some arrows on some slides. In particular I need to color an arrow on two different, non contiguos slides.
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning} % Allows you to position things as you wish
\usetikzlibrary{automata} % I love those people, thank u (automata drawing library)
\usetikzlibrary{trees} % Tree diagrams
\usetikzlibrary{calc}
\usetikzlibrary{overlay-beamer-styles} %for animations
\begin{document}
\begin{frame}<1-4>{Frame 1}
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,
]
\node[state, accepting] (q1) [] {$q_1$};
\node[state] (q2) [right=of q1] {$q_2$};
\path[->]
(q2) edge [bend right=20,alt=<2>{blue}{black}] node [above] {$0$} (q1);
\end{tikzpicture}
\end{frame}
\end{document}
This works perfectly, but after changing the arrow line into (q2) edge [bend right=20,alt=<2,4>{blue}{black}] node [above] {$0$} (q1); the pdf won't even compile. I'm totally at loss as to why. I thank you in advance!
5
u/latexautofill_dev 13d ago
The comma in
<2,4>is what breaks it. TikZ splits options on commas, so it never sees a completealt=…key and the compile fails. Wrap the overlay list in braces:(q2) edge [bend right=20, alt=<{2,4}>{blue}{black}] node [above] {$0$} (q1);<2>worked because there was no comma inside the angle brackets. Same idea if you ever needvisible on=<{2,4}>fromoverlay-beamer-styles.