Animations in PDF using LaTeX

There is the "animate" package for LaTeX that allows you to embed animations into PDFs. These animations are stored frame-by-frame, which can lead to quite large output files.

This is a simple examle, which just outputs the number 1 through 10 and then repeats:

\documentclass{article}
\usepackage{animate}

\begin{document}
\begin{animateinline}[autoplay,loop]{2}
\multiframe{11}{n=0+1}{
\strut\makebox[2em][r]{\n}
}
\end{animateinline}
\end{document}

It compiles nicely with pretty much any output profile built into TeXnicCenter. The magic hapens in the \begin{animateinline} block, where we just write the the counter \n into a fixed-size box. The box size is the same for all frames, and it is determined by the size of the first frame. If you are not careful, this can lead to clipping. As the nice folks at tex.stackexchange pointed out, you should use a wider box, so that double-digit numbers won't be squeezed (this is what \makebox is for), and you also have to enforce a higher box (with \strut), because TeX chooses too small boxes by default. The last one is a bit weird.