using tikz trees with beamer

View: New views
2 Messages — Rating Filter:   Alert me  

using tikz trees with beamer

by Lucio Chiappetti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[posted to Latex-beamer-users list]

Is it possible to use beamer and tikz tree syntax to draw animated trees ?
I'd expect it since they've been written by the same author, but can't
find a working syntax !

Also the examples I've found on the net use the <n> slide number in
conjunction with \path operator, but not with trees.

... but trees are so much handier !

What I want to achieve is partially illustrated by the attached minimal
test.  The test shows two columns with a linear tree (the actual tree will
be longer, and with ramifications ... at least during the animation)

The left hand side is what should be shown in slide <1>. It is a tree of
steps at levels 0, 2 and 4. The children at levels 1 and 3 are just empty,
without a real node : this occurs at lines 29 and 31 in the file, the
empty "child {" lines below.

   \node at(0,0) {pre-imaging observation @ UT3}
     child {
      child {node[fill=green, text width=2.5cm] {position slits @ home}
       child {
        child {node[fill=blue, text width=2cm] {cut mask @ MMU}
                  } } } }

The right hand side is what should appear in slide <2>, The children at
level 1 (a single one in this example, but should be several siblings and
use a different shape/colour corresponding to file interfaces across
steps) do show up.  Similarly I plan to add further slides in which the
children at levels 3, 5 etc, do show up. The first empty child has been
replaced by a real node

     child { node {FITS img}

I thought I could achieve an animation in the same frame (without all the
two-column business), just replacing the empty child with a statement like

child { node<2>{FITS img}
child<2> { node{FITS img}
child { \onslide<2>{node{FITS img}}
child { node{\onslide<2>{FITS img}}

the first gives "Package tikz Error: Cannot parse this node", the other
three "Package tikz Error: Giving up on this path"

What is the correct syntax, if any, to generate animated trees ?
Thanks

--
------------------------------------------------------------------------
Lucio Chiappetti - INAF/IASF - via Bassini 15 - I-20133 Milano (Italy)
------------------------------------------------------------------------
Citizens entrusted of public functions have the duty to accomplish them
with discipline and honour
                           [Art. 54 Constitution of the Italian Republic]
------------------------------------------------------------------------
For more info : http://www.iasf-milano.inaf.it/~lucio/personal.html
------------------------------------------------------------------------
\documentclass[10pt]{beamer}    %USE THIS     % not terribly different
%  \usetheme{Lambrate}
   \setbeamercolor{normal text}{fg=white,bg=black}
\setbeamertemplate{itemize items}[ball]
\setbeamertemplate{enumerate items}[circle]
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage[T1]{fontenc}
% test graphics
\usepackage{tikz}
\usepackage{pgflibrarytikztrees}
\usepackage{pgflibraryarrows}

\begin{document}

\begin{frame}[label=part3]
 \begin{columns}[T]
 \column[T]{0.5\textwidth}
 \begin{center}
 \scriptsize
 \begin{tikzpicture}[edge from parent,
                     level distance=0.65cm,
                     grow=down,
                     parent anchor=south, child anchor=north]
  \tikzstyle{every node}=[fill=red, rounded corners,              text width=4.0cm, text badly centered]
  \tikzstyle{edge from parent}=[draw,->,thick,yellow]
  \node at(0,0) {pre-imaging observation @ UT3}
    child {
     child {node[fill=green, text width=2.5cm] {position slits @ home}
      child {
       child {node[fill=blue, text width=2cm] {cut mask @ MMU}
                 } } } }
   ;
 \end{tikzpicture}
 \end{center}
 \column[T]{0.5\textwidth}
 \begin{center}
 \scriptsize
 \begin{tikzpicture}[edge from parent,
                     level distance=0.65cm,
                     grow=down,
                     parent anchor=south, child anchor=north]
  \tikzstyle{every node}=[fill=red, rounded corners,              text width=4.0cm, text badly centered]
  \tikzstyle{edge from parent}=[draw,->,thick,yellow]
  \node at(0,0) {pre-imaging observation @ UT3}
    child { node {FITS img}
     child {node[fill=green, text width=2.5cm] {position slits @ home}
      child {
       child {node[fill=blue, text width=2cm] {cut mask @ MMU}
                 } } } }
   ;
 \end{tikzpicture}
 \end{center}
 \end{columns}
\end{frame}

\end{document}

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Latex-beamer-users mailing list
Latex-beamer-users@...
https://lists.sourceforge.net/lists/listinfo/latex-beamer-users

Re: using tikz trees with beamer

by Kjell Magne Fauske :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 29, 2009 at 6:06 PM, Lucio Chiappetti
<lucio@...> wrote:

> [posted to Latex-beamer-users list]
>
> Is it possible to use beamer and tikz tree syntax to draw animated trees ?
> I'd expect it since they've been written by the same author, but can't find
> a working syntax !
>
> Also the examples I've found on the net use the <n> slide number in
> conjunction with \path operator, but not with trees.
>
> ... but trees are so much handier !
>
> What I want to achieve is partially illustrated by the attached minimal
> test.  The test shows two columns with a linear tree (the actual tree will
> be longer, and with ramifications ... at least during the animation)
>
> The left hand side is what should be shown in slide <1>. It is a tree of
> steps at levels 0, 2 and 4. The children at levels 1 and 3 are just empty,
> without a real node : this occurs at lines 29 and 31 in the file, the empty
> "child {" lines below.
>
>  \node at(0,0) {pre-imaging observation @ UT3}
>    child {
>     child {node[fill=green, text width=2.5cm] {position slits @ home}
>      child {
>       child {node[fill=blue, text width=2cm] {cut mask @ MMU}
>                 } } } }
>
> The right hand side is what should appear in slide <2>, The children at
> level 1 (a single one in this example, but should be several siblings and
> use a different shape/colour corresponding to file interfaces across steps)
> do show up.  Similarly I plan to add further slides in which the children at
> levels 3, 5 etc, do show up. The first empty child has been
> replaced by a real node
>
>    child { node {FITS img}
>
> I thought I could achieve an animation in the same frame (without all the
> two-column business), just replacing the empty child with a statement like
>
> child { node<2>{FITS img}
> child<2> { node{FITS img}
> child { \onslide<2>{node{FITS img}}
> child { node{\onslide<2>{FITS img}}
>
> the first gives "Package tikz Error: Cannot parse this node", the other
> three "Package tikz Error: Giving up on this path"
>
> What is the correct syntax, if any, to generate animated trees ?
> Thanks
>

You may find some useful information in this thread from the pgf-users
mailing list:
http://www.nabble.com/successive-creation-of-tikz-mindmap-in-beamer-td22478489.html

The topic of the thread is mindmaps, but they are essentially the same as trees.

- Kjell Magne Fauske

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Latex-beamer-users mailing list
Latex-beamer-users@...
https://lists.sourceforge.net/lists/listinfo/latex-beamer-users