1

I have a simple tree in a tikz picture in a beamer presentation. There is a root node at the top ("Name"), a series of child nodes at the bottom ("E1", "E2", etc.) and edges from the root to each child.

I want reveal, on subsequent slides, the root node, then the children, then the edges.

I have got as far as the root node, then the children-with-the-nodes:

MWE:

\documentclass[presentation]{beamer}
\usepackage{tikz}                         
\usetikzlibrary{positioning}
\tikzset{hide on/.code={\only<#1>{\color{fg!0}}}}
\usetheme{default}

\begin{document}
\begin{frame}{Foo}

Foo.

% (this is how my actual doc is structured)
\pause{}

The theory must posit:\pause{}\onslide<3->{ a \alert{name},
\onslide<4->{some \alert{objects}, \onslide<5->{and
some \alert{relation} between them on each precisification.}}}

\begin{tikzpicture}[
  on grid,
  every child/.={edge from parent},
  font=\footnotesize,
  level distance=2cm,
  sibling distance=1cm]
  % Stuff here.
  \node[hide on=-2] (name) {Name}
  child[hide on=-3] {node {E1}}
  child[hide on=-3] {node {E2}}
  child[hide on=-3] {node {E3}}
  child[hide on=-3] {node {E4}}
  child[hide on=-3] {node {E5}}
  child[hide on=-3] {node {etc.}};
\end{tikzpicture}
\end{frame}
\end{document}

1 Answer 1

1

I think that is not possible to separate children and their path to the root if you use the child operation. You have to do the tree by your own. This could be a semi-automatic tree in which you can easily decide what and when to show.

\documentclass[presentation]{beamer}

\usepackage{tikz}   

\usetheme{default}

\begin{document}

\begin{frame}{Foo}

Foo.

% (this is how my actual doc is structured)
\pause{}

The theory must posit:\pause{}\onslide<3->{ a \alert{name},
\onslide<4->{some \alert{objects}, \onslide<5->{and
some \alert{relation} between them on each precisification.}}}

\begin{tikzpicture}

\node(name) at (2.5,1.5) {Name}; % in order to obtain the x to put the root node at center you can do (last edge x +1)/2, in this case (4+1)/2=2.5

\onslide<4->{
\foreach \x/\y in {1/E1, 2/E2, 3/E3, 4/E4} \node(\y) at (\x,0) {\y}; %element list is positon/children, this shows childrens
}

\onslide<5->{
\foreach \y in {E1, E2} \draw (\y)--(name); %list of the children, this shows paths root-children you want
}

\onslide<6->{
\foreach \y in {E3, E4} \draw (\y)--(name);%if you want to show all edges togheter do one list with all of them
}
\end{tikzpicture}

\end{frame}

\end{document} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .