0

This question already has an answer here:

I am trying to change a node color of Tikz node with only option as:

\documentclass[10pt,xcolor=dvipsnames,xcolor=table]{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{frame}
    \centering
    \begin{tikzpicture}[sibling distance=12em, level distance=3em,
        every node/.style = {shape=rectangle, rounded corners,
          draw, align=center, font=\footnotesize,
    top color=Red, bottom color=Red, color=white}]]
    \node {Foo}
    child {node{Bar1}}
    \only<1>{child {node{Bar2}}
    \only<2>{child[top color=Blue] {node{Bar2}}
      child {node{bar21}}
    child {node{bar22}}};
  \end{tikzpicture}

\end{frame}
\end{document}

This works fine when no only thing is involved, but with only, its giving error:

Runaway argument?
\centering \begin {tikzpicture}[sibling distance=12em, level distance\ETC.
! File ended while scanning use of \frame.
<inserted text> 
                \par 
<*> mwe.tex

What I am doing wrong here? Please help.

marked as duplicate by user36296 beamer May 1 '18 at 15:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    There is a TikZ library for beamer overlay specifications. I just forget the name every time... – Skillmon May 1 '18 at 14:46
  • 1
    @Skillmon \usetikzlibrary{overlay-beamer-styles} :) – user36296 May 1 '18 at 14:49
  • ctan.org/pkg/aobs-tikz – Skillmon May 1 '18 at 14:51
  • @samcarter thank you. Why must it have such a horrible name. I always think: It has beamer and overlay in its name. Must be tikz-beamer-overlay. No, wrong. Or perhaps... – Skillmon May 1 '18 at 14:52
  • @Skillmon Me too! I can only remember that the letters b, s, o and a are in the package name. I then usually use texdoc and try as many combinations of these until a pdf opens :) – user36296 May 1 '18 at 14:56