1

I want to animate parts of a beamer presentation. Experiments with \transduration have been somewhat promising, but since the animation is only for a graphics image on the page with changing time parameter, so I searched on for a better solution than explicitly creating multiple graphics files externally and a corresponding multitude of \includegraphics in the LaTeX document, one for each point in time.

A search has quickly led to AlexG's answer to “Animations in LaTeX”, which appeals to me because the animation is encapsulated in a single \multiframe and seems not to require any tools external to LaTeX to generate the animation's frames.

However, I cannot get AlexG's LaTeX code to work like so:

latex alexg.tex
dvips alexg.dvi
ps2pdf alexg.ps
pdfpc alexg.pdf

In fact, I see a media-player like box with some controls below and one thick blue vertical line inside, but nothing happens when I push the controls.

(Also attempts to apply okular and evince for display have failed. I have also tried pdflatex for conversion, but this has not worked either and has, moreover, led to problems in unrelated other places when importing postscript graphics.)

4
  • Try to view the resulting .pdf-file in Adobe Acrobat! The documentation of the animate-package states the supported pdf-viewers, which are Adobe Acrobat, Foxit Reader and PDF-XChange. Although i've tried it with Foxit and it didn't work for me. vesta.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/macros/… – Tim Hilt Jan 14 '20 at 11:49
  • I do not have Acrobat available, so next thing I have tried is tex.stackexchange.com/questions/235139/… but here I see only the final image: the whole tree. – Bernardo o Louco Jan 14 '20 at 12:33
  • My workaround was to install Acrobat through Wine. I've tried every listed editor from the docs and didn't get it to work. The animate-package adds a Javascript layer to the resulting pdf and only Acrobat is able to display its contents properly. – Tim Hilt Jan 14 '20 at 12:47
  • Sorry, animated PDF only works in Acrobat Reader, which is not available for Linux. Alternatively, if SVG is chosen as output format instead of PDF, embedded animations can be run in modern Web browsers, such as Chromium, which are available on many platforms, including mobile ones. See tex.stackexchange.com/q/235139 – AlexG Jan 14 '20 at 13:23
2

Unlike Acrobat Reader, Evince and Okular are minimalistic PDF viewers that don't come with a JavaScript engine. It is necessary to run the embedded animations produced by means of the animate package.

On Linux and mobile platforms, PDF viewers with the required functionality are not available. Here, SVG could be chosen as an alternative output format and a Web browser for viewing. See "Using the animate package without Adobe" for further information.

The example linked in the OP, with slight modifications (turned into beamer-class document, dvisvgm set as global option):

latex texsx-524206
latex texsx-524206
dvisvgm --zoom=-1 --font-format=woff texsx-524206

\documentclass[dvisvgm, aspectratio=169]{beamer}

\usepackage{animate}
\usepackage{tikz}
\usetikzlibrary{lindenmayersystems}
\pgfdeclarelindenmayersystem{A}{%
  \symbol{F}{\pgflsystemstep=0.6\pgflsystemstep\pgflsystemdrawforward}
  \rule{A->F[+A][-A]}
}

\begin{document}

\begin{frame}{Embedded animation}

  Press \fbox{F11} for presentation mode.
  \begin{center}
    \begin{animateinline}[controls,loop]{2}
    \multiframe{8}{n=1+1}{
      \begin{tikzpicture}[scale=10,rotate=90]
        \draw (-.1,-.2) rectangle (.4,0.2);
        \draw [blue,opacity=0.5,line width=0.1cm,line cap=round]
          l-system [l-system={A,axiom=A,order=\n,angle=45,step=0.25cm}];
      \end{tikzpicture}
    }
    \end{animateinline}
  \end{center}

\end{frame}

\end{document}
````
5
  • Thanks, this looks good. However, when I try myself, dvisvgm (version 1.10) yields unknown option --font-format. If I leave out the option, it produces an svg file showing the whole tree, but no animation steps. – Bernardo o Louco Jan 14 '20 at 19:47
  • I have now version 2.8.2 installed. This knows the option. But still, it produces a different svg from yours, which only shows the final image. – Bernardo o Louco Jan 14 '20 at 21:48
  • Did you open the SVG in a Web browser (preferably Chrome, for its performance, also Chromium (open source) or Opera)? How did you install the new dvisvgm binary, by compiling it from source in the current TeX-Live SVN source tree? (I did it that way.) – AlexG Jan 15 '20 at 8:12
  • Yes, I open in the web browser. Your SVG works, mine does not. I took dvisvgm from dvisvgm.de/Downloads and compiled myself. – Bernardo o Louco Jan 16 '20 at 7:40
  • 1
    In a private communication, Martin Gieseking, the dvisvgm developper, advised me to compile the dvisvgm binary inside the SVN TeXLive source tree and to copy the binary over to the vanilla TeXLive installation used for production. Compilation instructions for a single component are given here: tug.org/texlive/doc/tlbuild.html#Build-one-package – AlexG Jan 16 '20 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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