2

I am using a piece of code (\tikzset) which people have repeatedly been posting in various questions, e.g. Mindmap tikzpicture in beamer (reveal step by step) and highlight a node in tikz.

But now, I want to specify a piece of animation that highlights in step 1 and 3, separately (alt=<1,3>). However, this code gives pgf error. How should this problem be resolved?

\documentclass{beamer}

\usepackage{tikz}

\tikzset{ invisible/.style={opacity=0,text opacity=0}, visible on/.style={alt=#1{}{invisible}}, alt/.code args={<#1>#2#3}{% \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} }, }

\begin{document}

\begin{frame} \begin{tikzpicture} \node[circle, draw, alt=<1,3>{red}{black}]{}; \end{tikzpicture} \end{frame}

\end{document}

Jason Hu
  • 199
  • 1
    Have you seen this question? It deals specifically with the case alt=<1,3>. https://tex.stackexchange.com/questions/84513/highlighting-in-beamer-using-tikz-nodes – PatrickT Oct 01 '21 at 06:42
  • @PatrickT sorry I don't understand that answer. it didn't change the definition of alt. in my example, I directly use alt= which is not quite the same as that answer which uses BeamerAlert – Jason Hu Oct 01 '21 at 14:01

1 Answers1

1

To prevent tikz from thinking the , would be the end of the key value, place your list of overlays in {1,3}:

\documentclass{beamer}

\usepackage{tikz}

\usetikzlibrary{overlay-beamer-styles}

\begin{document}

\begin{frame} \begin{tikzpicture} \node[circle, draw, alt=<{1,3}>{red}{black}]{}; \end{tikzpicture} \end{frame}

\end{document}