Hi,
Which package could I use (if any) if I want to draw animated trees
(`tree' being taken in the mathematical/CS sense, evidently)?
Thanks.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --
The greatest good you can do for another is not just share your riches, but reveal to him his own. (Benjamin Disraeli)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkwb494ACgkQM0LLzLt8MhwPwACffZrPOYTjcTr804djcUSX9K1a
6oAAmwfikmuGnb4ie5gWsLafQQ8rmwmd
=j0h4
-----END PGP SIGNATURE-----
>
> Which package could I use (if any) if I want to draw animated trees
> (`tree' being taken in the mathematical/CS sense, evidently)?
Rather than defining 'tree', maybe you could define 'animated'?
Do you want them to dance? :-)
Alan
Alan Munn <am...@msu.edu> writes:
> In article <87mxusn...@merciadriluca-station.MERCIADRILUCA>,
> Merciadri Luca <Luca.Me...@student.ulg.ac.be> wrote:
>
>>
>> Which package could I use (if any) if I want to draw animated trees
>> (`tree' being taken in the mathematical/CS sense, evidently)?
>
> Rather than defining 'tree', maybe you could define 'animated'?
Okay.
> Do you want them to dance? :-)
Well, this is not mandatory. I would to show how a particular tree is
modified because of a tree's algorithm's execution (such as Dijsktra,
Kruskal, Prim-Jarnìk, etc.). I could achieve this by putting the
different steps, but it would place a burden on the document's
content: if they are, say, 10 steps, I would not like to have a serie
of images showing the 10 steps, but, better, one image which is
animated, showing e.g. the first node having a different value than in
the previous frame, etc.
I know that this is not trivial, but if I can draw a tree, at each
step, it should be possible to put all these different trees on an
animated image, just as a GIF works.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --
Fall down seven times, stand up eight.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkwcti4ACgkQM0LLzLt8MhwN+gCfQqPYjuZlYkZB5d+wcSpAWd3p
jiwAn3qQAHd0o4yCuvc0sSdd8y82Or7+
=KmNi
-----END PGP SIGNATURE-----
> I know that this is not trivial, but if I can draw a tree, at each
> step, it should be possible to put all these different trees on an
> animated image, just as a GIF works.
something like this?
http://archiv.dante.de/~herbert/PSTricks/GraphikDemo.pdf
Could also be done with trees
http://mirror.ctan.org/graphics/pstricks/contrib/pst-tree/
Herbert
Good to know. I've left out the dancing code in the example below. :-)
> I would to show how a particular tree is
> modified because of a tree's algorithm's execution (such as Dijsktra,
> Kruskal, Prim-Jarnìk, etc.). I could achieve this by putting the
> different steps, but it would place a burden on the document's
> content: if they are, say, 10 steps, I would not like to have a serie
> of images showing the 10 steps, but, better, one image which is
> animated, showing e.g. the first node having a different value than in
> the previous frame, etc.
Well as far as I know, the multiple pages approach is the only way to
animate things of this sort in LaTeX. (And beamer, in particular,
provides the mechanism to do this.)
Here's an example similar to the one Herb posted, but using TikZ. It's
based on an idea by Kjell Magne Fauske, namely to assign styles to
levels of the tree, and gradually make them visible on each successive
slide.
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
\begin{frame}
\onslide<1->{
\tikzstyle{L1} = [color=black]
\tikzstyle{L2} = [opacity=0]
\tikzstyle{L3} = [opacity=0]
\tikzstyle{L4} = [opacity=0]}
\only<2->{\tikzstyle{L2} = [color=red]}
\only<3->{\tikzstyle{L3} = [color=green!50!black]}
\begin{tikzpicture}
\node {root}
[edge from parent fork down]
child[style=L2] {node {left}}
child[style=L2] {node {right}
child[style=L3] {node {child}}
child[style=L3] {node {child}}
};
\end{tikzpicture}
\end{frame}
\end{document}
Alan
> Here's an example similar to the one Herb posted, but using TikZ. It's
> based on an idea by Kjell Magne Fauske, namely to assign styles to
> levels of the tree, and gradually make them visible on each successive
> slide.
the same example with pst-tree
\documentclass{beamer}
\usepackage{pst-tree}
\begin{document}
\begin{frame}
\pstree[edge=\ncangles,angleA=-90,angleB=90,armA=7mm,
nodesep=2mm,linecolor=red]{\Tr{root}}{\pause\red
\Tr{left}
\pstree[linecolor=green]{\Tr{right}}{\pause\green
\Tr{child}
\Tr{child}
}
}
\end{frame}
\end{document}
Herbert
Good afternoon fellow TeXists,
You may like to try quite new animate package created by Alexander
Grahn. It's already a part of TeX Live 2009+. Moreover, it's
possible to download it from ctan.org directly,
http://ctan.org/tex-archive/macros/latex/contrib/animate/.
In the documentation of this package (http://ftp.cvut.cz/tex-archive/
macros/latex/contrib/animate/animate.pdf) there are four quite
astonishing and descriptive examples plus inspiring timeline parameter
settings for complex animations. As it is based on XObject, you can
reuse such an object in your animation without worries about space as
many times as you like. You only need to prepare those objects to be
animated in advance and set the biggest bouding box for all of them.
It's a piece of cake in Metapost, if you know this trick (an idea
coming from http://ftp.cstug.cz/pub/tex/CTAN/macros/latex/contrib/animate/files/exp.mp):
path bounds;
bounds:=bbox currentpicture;
and well, of course, you shall set it for all the objects/parts/
layers:
setbounds currentpicture to bounds;
clip currentpicture to bounds;
(We could also replace first three lines in the final MPS {let's say
PostScript created in Metapost} files...)
I've seen a similar trick in TikZ (\useasboudingbox) and in PSTricks.
I enclose an animated example based on Denis Roegel's article Kissing
circles, http://tug.org/TUGboat/Articles/tb26-1/tb82roegel.pdf.
Adobe Reader 8.0+ to open (Are there some other PDF previewers
working?):
http://striz9.fame.utb.cz/comp.text.tex/apo.pdf /<1 MB/
If you would play with PDF -> raster conversions, let's say "convert -
resize 600x600 -delay 200 -loop 0 step_*.pdf apo.gif" (ImageMagick)
you are getting:
http://striz9.fame.utb.cz/comp.text.tex/apo.gif /<1 MB/
All the best,
Pavel Stříž
> You may like to try quite new animate package created by Alexander
> Grahn. It's already a part of TeX Live 2009+. Moreover, it's
> possible to download it from ctan.org directly,
a rather extreme interpretation of "quite new" -- animate has been on
ctan since march 2007.
> http://mirror.ctan.org/tex-archive/macros/latex/contrib/animate/
please
--
Robin Fairbairns, Cambridge
Thanks for both ideas! I'll exploit them. :-)
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --
The weak can never forgive. Forgiveness is the attribute of the
strong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkwd9TMACgkQM0LLzLt8MhxsDwCeOGuQX85e14e0O36E6wj1AXnX
WfUAn0vKGiZRTCiggjo1jPFBqHBUGUv6
=cXOA
-----END PGP SIGNATURE-----
Thanks all. I'll try what suits my needs best. @Robin: note that
http://ftp.snt.utwente.nl/pub/software/tex/tex-archive/macros/latex/contrib/animate/
gives a 404 error (don't know why). (I used then Google to find a good
mirror.)
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --
Procrastination is the thief of time.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkwePpEACgkQM0LLzLt8MhzMTQCcD8Pe91WXtCpy9AJSV+gn2qxS
/dIAn01jl5+aNNSni6+GdNeeKeQ3h/ja
=ebyx
-----END PGP SIGNATURE-----
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Thanks all. I'll try what suits my needs best. @Robin: note that
>http://ftp.snt.utwente.nl/pub/software/tex/tex-archive/macros/latex/contrib/animate/
>gives a 404 error (don't know why).
The "tex-archive/" portion of
http://mirror.ctan.org/tex-archive/macros/latex/contrib/animate/
should have been left out. The URL "http://mirror.ctan.org"
already returns the relevant directory (which is most often
_not_ "tex-archive/").
Thus the following worked for me each time (twice) I tried it:
http://mirror.ctan.org/macros/latex/contrib/animate/
Dan
To reply by email, change LookInSig to luecking
Dan Luecking <Look...@uark.edu> writes:
> On Sun, 20 Jun 2010 18:15:15 +0200, Merciadri Luca
> <Luca.Me...@student.ulg.ac.be> wrote:
>
>>-----BEGIN PGP SIGNED MESSAGE-----
>>Hash: SHA1
>>
>>Thanks all. I'll try what suits my needs best. @Robin: note that
>>http://ftp.snt.utwente.nl/pub/software/tex/tex-archive/macros/latex/contrib/animate/
>>gives a 404 error (don't know why).
>
> The "tex-archive/" portion of
>
> http://mirror.ctan.org/tex-archive/macros/latex/contrib/animate/
>
> should have been left out. The URL "http://mirror.ctan.org"
> already returns the relevant directory (which is most often
> _not_ "tex-archive/").
>
> Thus the following worked for me each time (twice) I tried it:
Yes, but that means that Robin's link is incorrect!
(But that does not prevent me from admirating Robin's actions for TeX stuff.)
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --
When you are courting a nice girl, an hour seems like a second. When you sit on a red-hot cinder,
a second seems like an hour. That's relativity. (Albert Einstein)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkwf1noACgkQM0LLzLt8MhxCAACgrvq9fFR3/R8+Dz5mhcZs7BCr
uLoAn165pLRe7H91vHEPp7skw9cEc+8b
=Ff27
-----END PGP SIGNATURE-----
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Dan Luecking <Look...@uark.edu> writes:
>
>> On Sun, 20 Jun 2010 18:15:15 +0200, Merciadri Luca
>> <Luca.Me...@student.ulg.ac.be> wrote:
>>
>>>-----BEGIN PGP SIGNED MESSAGE-----
>>>Hash: SHA1
>>>
>>>Thanks all. I'll try what suits my needs best. @Robin: note that
>>>http://ftp.snt.utwente.nl/pub/software/tex/tex-archive/macros/latex/contrib/animate/
>>>gives a 404 error (don't know why).
>>
>> The "tex-archive/" portion of
>>
>> http://mirror.ctan.org/tex-archive/macros/latex/contrib/animate/
>>
>> should have been left out. The URL "http://mirror.ctan.org"
>> already returns the relevant directory (which is most often
>> _not_ "tex-archive/").
>>
>> Thus the following worked for me each time (twice) I tried it:
>Yes, but that means that Robin's link is incorrect!
Of course. But you said you didn't know why, and I was
responding to that. I hope you now know.
Dan Luecking <Look...@uark.edu> writes:
> On Mon, 21 Jun 2010 23:15:39 +0200, Merciadri Luca
> <Luca.Me...@student.ulg.ac.be> wrote:
>
>>-----BEGIN PGP SIGNED MESSAGE-----
>>Hash: SHA1
>>
>>Dan Luecking <Look...@uark.edu> writes:
>>
>>> On Sun, 20 Jun 2010 18:15:15 +0200, Merciadri Luca
>>> <Luca.Me...@student.ulg.ac.be> wrote:
>>>
>>>>-----BEGIN PGP SIGNED MESSAGE-----
>>>>Hash: SHA1
>>>>
>>>>Thanks all. I'll try what suits my needs best. @Robin: note that
>>>>http://ftp.snt.utwente.nl/pub/software/tex/tex-archive/macros/latex/contrib/animate/
>>>>gives a 404 error (don't know why).
>>>
>>> The "tex-archive/" portion of
>>>
>>> http://mirror.ctan.org/tex-archive/macros/latex/contrib/animate/
>>>
>>> should have been left out. The URL "http://mirror.ctan.org"
>>> already returns the relevant directory (which is most often
>>> _not_ "tex-archive/").
>>>
>>> Thus the following worked for me each time (twice) I tried it:
>>Yes, but that means that Robin's link is incorrect!
>
> Of course. But you said you didn't know why, and I was
> responding to that. I hope you now know.
Yes. But I didn't know why Robin did this mistake!
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --
If you don't buy a ticket, you can't win the raffle.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkwg7/IACgkQM0LLzLt8MhwYcQCgpMWwPYY+N/+nB847sKCqZuHg
IL8AnAw+0HR1VK2Gx/tB3aYTuauTOiwV
=ETUH
-----END PGP SIGNATURE-----
> Dan Luecking <Look...@uark.edu> writes:
>
>> On Mon, 21 Jun 2010 23:15:39 +0200, Merciadri Luca
>> <Luca.Me...@student.ulg.ac.be> wrote:
>>>> Thus the following worked for me each time (twice) I tried it:
>>>Yes, but that means that Robin's link is incorrect!
>>
>> Of course. But you said you didn't know why, and I was
>> responding to that. I hope you now know.
> Yes. But I didn't know why Robin did this mistake!
old age and general decrepitude, i'm afraid.
fwiw, i've (today) converted the online faq to use mirror.ctan.org --
you'll see that when the current beta becomes the standard, but i've
tested it already. so you won't see anything silly, regardless of my
failings.
--
Robin Fairbairns, Cambridge
Robin Fairbairns <rf...@sxp10.cl.cam.ac.uk> writes:
Thanks. Well, no problem: I often find myself making silly and stupid
mistakes at uni exams, and that often leads me to many problems I
could have avoided if I were less stressed. So, I understand you, and
I m more punishable than you, because I'm quite young! (Which does not
mean that you're old.)
Thanks.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --
If you fall off a cliff, you might as well try to fly. After all, you got nothing to lose.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkwhzacACgkQM0LLzLt8MhyngwCffpenY5l6sHiCo/pJskKe8MS0
ZfMAnRi1i1y0TPf2ISWVOO5Ze0hfonTH
=nCLM
-----END PGP SIGNATURE-----