# Uncover parts of a tree in TikZ

I'm trying to apply Daniel's method to uncover the bottom right part of the tree in the following MWE. However, when I pass the option [visible on=<2->] to one of the children, it appears to affect all the codes that follow: the children drawn after disappeared (which is what I wanted), the label e on the right edge disappeared (not what I wanted), and the next path (the dashed line) also disappeared (not what I wanted). What's the reason for this, and how can I fix it?

\documentclass{beamer}

\usepackage{tikz}
% Two node styles for game trees: solid and hollow
\tikzset{
solid node/.style={circle,draw,inner sep=1.0,fill=black},
hollow node/.style={circle,draw,inner sep=1.0}
}

% use option [visible on=<+->] to uncover parts of a tikzpicture
\tikzset{
invisible/.style={opacity=0},
visible on/.style={alt=#1{}{invisible}},
alt/.code args={<#1>#2#3}{%
\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
},
}

\begin{document}

\begin{frame}

\centering
\begin{tikzpicture}[font=\scriptsize]
\tikzstyle{level 1}=[sibling distance=30mm]
\tikzstyle{level 2}=[sibling distance=12mm]
\tikzstyle{level 3}=[sibling distance=10mm]
\node(0)[hollow node,label=above:1]{}
child{node[solid node]{}
child{node[solid node,label=below:{$\binom{2}{1}$}]{}edge from parent node[left]{$c$}}
child{node[solid node,label=below:{$\binom{-1}{0}$}]{}edge from parent node[right]{$d$}}
edge from parent node[left]{$a\phantom{b}$}
}
child{node[solid node]{}
child{node[solid node,label=below:{$\binom{0}{0}$}]{}edge from parent node[left]{$c$}}
child{node[solid node,label=below:{$\binom{0}{1}$}]{}edge from parent node[right]{$d$}}
edge from parent node[left]{$b$}
}
child{node[solid node,label=right:2]{}
%%%%% The following part of the tree to be uncovered in slide 2 %%%%%
child[sibling distance=20mm,visible on=<2->]{node[solid node,label=left:1]{}
child{node[solid node,label=below:{$\binom14$}]{}edge from parent node[left]{$h$}}
child{node[solid node,label=below:{$\binom03$}]{}edge from parent node[right]{$i$}}
edge from parent node[left]{$f$}
}
child[sibling distance=20mm]{node[solid node,label=right:1]{}
child{node[solid node,label=below:{$\binom04$}]{}edge from parent node[left]{$j$}}
child{node[solid node,label=below:{$\binom23$}]{}edge from parent node[right]{$k$}}
edge from parent node[right]{$g$}
}
edge from parent node[right]{$\phantom{b}e$}
}
;
\draw[dashed](0-1)--(0-2)node[midway,above]{2};
\end{tikzpicture}

\end{frame}

\end{document}


-
When I compile your code, only the edges f, h and i and their nodes appear on slide 2 and nothing disappears. What version of PGF do you use (write \pgfversion on your frame). – Qrrbrbirlbel Mar 18 '13 at 0:25
@Qrrbrbirlbel: my PGF version is 2.10, and I'm using BaKoMa TeX 10.10 – Herr K. Mar 18 '13 at 3:06
@Qrrbrbirlbel: It looks like a problem with BaKoMa TeX. There's no problem when I compile using MikTeX. By the way, how did you make the image? – Herr K. Mar 18 '13 at 3:23
@KevinC: If your problem is solved by using another TeX distro, please post this as an answer, so that the question does not remain unanswered. – Daniel Mar 20 '13 at 19:54

It looks like my problem is not related to TikZ or Beamer, but BaKoMa TeX. When compiling the code using MikTeX, the output looks fine, as is posted above. However, when the same code is compiled using BaKoMa, the output is wrong, as below.