I'm used to prepare tikz graphics with preview or standalone packages to crop them. Now I've started to experiment with animations and wanted to do the same. My first test was with Alexander Grahn's answer to Animating Protocols, but as soon as I include
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
in its preamble, pdflatex complains with
! Package animate Error: Contents of first frame must not have zero width.
I've found some examples prepared with preview but all of them use \animategraphics
command instead of animateinline environment with \multiframe command.
So my first question is, has any sense to do what I want? It is producing an animated clipped graphic to be included in another file. "No, it hasn't" can be a good answer but if it has, what am I doing wrong?
Here you have the code to test it. I've also tested adding a \usebaoundingbox but without any succes.
\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\begin{document}
\begin{frame}
\begin{animateinline}[loop]{10}
\multiframe{10}{rPos=0.1+0.1}{
\begin{tikzpicture}[every node/.style={draw}]
%\useasboundingbox (-2,-2) rectangle (7,2);
\node (s) {sender};
\node (r) at (5,0) {receiver};
\path (s) -- (r) node[pos=\rPos,coordinate] (p) {};
\draw[->] (s) -- (p);
\end{tikzpicture}
}
\end{animateinline}
\end{frame}
\end{document}
beamerdoesn't work nicely withpreviewas well. – Martin Scharrer Aug 05 '11 at 09:59previewwithanimateother than getting a tightly cropped PDF around the animation. You cannot\includegraphicsor\includepdfit into another document, because the PDF annotations, which provide interactivity, get lost in this process. They have to be re-built in every new PDF document. Thereforestandaloneis probably the better choice. – AlexG Aug 05 '11 at 12:00