Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}

enter image description here

share|improve this question
2  
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 –  Kevin C 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? –  Kevin C 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
add comment

1 Answer

up vote 2 down vote accepted

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. compiled using BaKoMa

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.