# If preview package connot work together with animate, how do you test the code fragment efficiently in the development phase?

Making sub-files, that are compiled separately, not only helps reducing the compilation time for the main input file but also helps us to separately test the sub-file in the development phase. Sub-files often use preview package to produce tight PDF images that will be imported later from within the main input file.

From my experience, preview package cannot work together with animate package. Shortly speaking, is there a good way to separately test code fragments with animate package loaded? Putting these code fragments in the main input file seems a bad strategy because during the development phase you will waste much time to compile them. Separating each of them in a not-standalone as follows

% shrinking.tex
\animateinline[palindrome,autoplay]{10}
\multiframe{11}{r=1+-0.1}{%
\pspicture(2,2)
\pscircle*[linecolor=red,opacity=0.5](1,1){\r}
\endpspicture}
\endanimateinline


and importing it later in the main input file can work. But the question is, how do you compile shrinking.tex during the development phase to get a tight paper size? You might think why do you need a tight paper size in the development phase if the imported PDF animate will no longer work. OK. It is my personal restriction that does not make sense of course!

-
In your main document, you could use draft as document or animate package option and final as local command option for the animation you are currently working on. Perhaps, this saves some time, at least for the dvips and ps2pdf steps. –  AlexG Aug 17 '11 at 13:37
@Alexander: Which method will produce faster animation viewed on Adobe Reader, animateinline or animategraphics? –  xport Aug 17 '11 at 13:43
They seem to produce identical results (I used the measure option for getting the FPS). The PDF file structure is similar for both. Some differences (in the file structure) result from using different drivers (dvips/ps2pdf vs. pdftex) but they don't impinge on animation performance. –  AlexG Aug 17 '11 at 14:18

## 1 Answer

Run this document with

\documentclass{article}
\pagestyle{empty}
\usepackage{pst-pdf,pstricks,multido}

\begin{document}
\multido{\r=1.0+-0.1}{11}{%
\pspicture(2,2)
\pscircle*[linecolor=red,opacity=0.5](1,1){\r}
\endpspicture}}

\end{document}

latex <file>
dvips <file>
ps2pdf <file>.ps


then create a new document and use with pdflatex \animategraphics[controls,loop]{5}{<file>}{}{}. Here is an example of such a document: http://latex.userpage.fu-berlin.de/animate.pdf

-
I will test it now. Whether it is what I am looking for. –  xport Aug 17 '11 at 12:33
I think I don't need pst-pdf because it internally invokes preview. –  xport Aug 17 '11 at 13:07
but then you have to use \PreviewEnvironment{pspicture}` –  Herbert Aug 17 '11 at 13:23