[Tex/LaTex] LaTeX beamer package and growing figures

beamer

I'm using beamer package in LaTeX to build my slides. I saw in some final examples in LaTeX (I mean, I saw the PDF format and not the tex format), that contains an image that is being build along several slides. For example:

On slide1:

>

On slide2:

->

On slide3:

-->

On slide4:

--->

Please imagine this picture as an arrow growing.

In this case, I'm building an arrow, but what I really like is having a state diagram appearing along the slides.

Is it possible to build this?

2 – If I have the state diagram as an PDF file, and I import the PDF file to the LaTeX, can I put the feature explained on 1) in the imported file?

Best Answer

In beamer, the \includegraphics command understands overlay specifications, so you can do things like

\begin{frame}
  \includegraphics<1>[height=2cm]{step1.pdf}%
  \includegraphics<2>[height=2cm]{step2.pdf}%
  \includegraphics<3>[height=2cm]{step3.pdf}%
\end{frame}

(taken from the Graphics section in the beamer user manual).

That will include the file step1.pdf on the first slide, replace it with step2.pdf on the second slide, etc. You can also have all the steps in one pdf file, say steps.pdf, as individual pages, and include them as

\begin{frame}
  \includegraphics<1>[height=2cm,page=1]{steps.pdf}%
  \includegraphics<2>[height=2cm,page=2]{steps.pdf}%
  \includegraphics<3>[height=2cm,page=3]{steps.pdf}%
\end{frame}

I usually use the Ipe graphics editor to create multi-page pdf files that can be used like this, because its concept of layers and views is especially well suited for this.

Another possibility is to create your graphics directly in LaTeX using the tikz package. There are examples of using tikz to incrementally build pictures for beamer presentations.