Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Several decades ago I could compile the following code snippet with pdflatex -shell-escape main.tex to produce a PDF output with animation.

% the filename is main.tex
\documentclass[preview,border=12pt]{standalone}
\usepackage{filecontents}

\begin{filecontents*}{diagram.tex}

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\foreach \x in {1,...,10}{
\begin{pspicture}[showgrid](5,5)
    \pscircle(2.5,2.5){!\x\space 10 div}
\end{pspicture}}
\end{document}

\end{filecontents*}


\usepackage{pgffor}
\foreach \compiler/\ext in {latex/tex,dvips/dvi,{ps2pdf -dAutoRotatePages=/None}/ps}{\immediate\write18{\compiler\space diagram.\ext}}

\usepackage{animate}
\begin{document}
\animategraphics[autoplay,controls,loop,scale=1]{3}{diagram}{}{}
\end{document}

Unfortunately now it is just a PDF output with a not-working animation. What causes this problem?

Edit

I does not seem to be dependent on whether or not I use PSTricks or TikZ.

% filenanem is main.tex
% compile it with pdflatex -shell-escape main.tex

\documentclass[preview,border=12pt]{standalone}
\usepackage{filecontents}

\begin{filecontents*}{diagram.tex}

\documentclass[tikz,border=12pt]{standalone}
\begin{document}
\foreach \x in {1,...,10}{%
\begin{tikzpicture}
    \draw[white] (0,0) rectangle (5,5);
    \draw (2.5,2.5) circle (\x/10);
\end{tikzpicture}}
\end{document}

\end{filecontents*}


\immediate\write18{pdflatex diagram.tex}

\usepackage{animate}
\begin{document}
\animategraphics[autoplay,controls,loop,scale=1]{3}{diagram}{}{}
\end{document}

Edit 2

My viewer is

enter image description here

Edit 3

When using article document class instead of standalone but it does not work as well.

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/W32TeX)
 \write18 enabled.
entering extended mode
(./main.tex
LaTeX2e <2011/06/27>
Babel <3.9k> and hyphenation patterns for 78 languages loaded.
(c:/texlive/2013/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(c:/texlive/2013/texmf-dist/tex/latex/base/size10.clo))
(c:/texlive/2013/texmf-dist/tex/latex/filecontents/filecontents.sty)This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/W32TeX)
 restricted \write18 enabled.
entering extended mode
(./diagram.tex
LaTeX2e <2011/06/27>
Babel <3.9k> and hyphenation patterns for 78 languages loaded.
(c:/texlive/2013/texmf-dist/tex/latex/standalone/standalone.cls
Document Class: standalone 2012/09/15 v1.1b Class to compile TeX sub-files stan
dalone
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(c:/texlive/2013/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(c:/texlive/2013/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(c:/texlive/2013/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(c:/texlive/2013/texmf-dist/tex/generic/xkeyval/keyval.tex)))
(c:/texlive/2013/texmf-dist/tex/latex/standalone/standalone.cfg)
(c:/texlive/2013/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(c:/texlive/2013/texmf-dist/tex/latex/base/size10.clo))
(c:/texlive/2013/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty
(c:/texlive/2013/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty
(c:/texlive/2013/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(c:/texlive/2013/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex)
) (c:/texlive/2013/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(c:/texlive/2013/texmf-dist/tex/latex/ms/everyshi.sty))
(c:/texlive/2013/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex))
(c:/texlive/2013/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty
(c:/texlive/2013/texmf-dist/tex/latex/graphics/graphicx.sty
(c:/texlive/2013/texmf-dist/tex/latex/graphics/graphics.sty
(c:/texlive/2013/texmf-dist/tex/latex/graphics/trig.sty)
(c:/texlive/2013/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(c:/texlive/2013/texmf-dist/tex/latex/pdftex-def/pdftex.def
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(c:/texlive/2013/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty
(c:/texlive/2013/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex)
) (c:/texlive/2013/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def
(c:/texlive/2013/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def))
)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex
)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex
)) (c:/texlive/2013/texmf-dist/tex/latex/xcolor/xcolor.sty
(c:/texlive/2013/texmf-dist/tex/latex/latexconfig/color.cfg))
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.te
x)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric
.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.t
ex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.co
de.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex
)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.te
x)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithm
etics.code.tex)))
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex))
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.cod
e.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.te
x)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code
.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.c
ode.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex)

(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.co
de.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex
))
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code
.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex
)))
(c:/texlive/2013/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex)
(c:/texlive/2013/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.st
y)
(c:/texlive/2013/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18.st
y)) (c:/texlive/2013/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(c:/texlive/2013/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(c:/texlive/2013/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex))
(c:/texlive/2013/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex))
(c:/texlive/2013/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
(c:/texlive/2013/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.co
de.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex)
(c:/texlive/2013/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzli
brarytopaths.code.tex))))
No file diagram.aux.
ABD: EveryShipout initializing macros
(c:/texlive/2013/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (c:/texlive/2013/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty)
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/grfext.sty
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(c:/texlive/2013/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)) [1]
[2] [3] [4] [5] [6] [7] [8] [9] [10] (./diagram.aux) )
Output written on diagram.pdf (10 pages, 3756 bytes).
Transcript written on diagram.log.


LaTeX Warning: Writing file `./diagram.tex'.


(c:/texlive/2013/texmf-dist/tex/latex/animate/animate.sty
(c:/texlive/2013/texmf-dist/tex/latex/graphics/keyval.sty)
(c:/texlive/2013/texmf-dist/tex/latex/base/ifthen.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/ifdraft.sty)
(c:/texlive/2013/texmf-dist/tex/latex/tools/calc.sty)
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/atenddvi.sty
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/zref-abspage.sty
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/zref-base.sty
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/etexcmds.sty))
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty)
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/auxhook.sty))
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/atbegshi.sty))
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/zref-lastpage.sty
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/atveryend.sty)))
(c:/texlive/2013/texmf-dist/tex/latex/animate/animfp.sty)
(c:/texlive/2013/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
))
No file main.aux.
 <./diagram.pdf> <1> <./diagram.pdf> <2> <./diagram.pdf> <3> <./diagram.pdf>
<4> <./diagram.pdf> <5> <./diagram.pdf> <6> <./diagram.pdf> <7> <./diagram.pdf>
<8> <./diagram.pdf> <9> <./diagram.pdf> <10>

LaTeX Warning: Reference `LastPage' on page 1 undefined on input line 27.

[1{c:/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./main.aux

Package atenddvi Warning: Rerun LaTeX, last page not yet found.

)

LaTeX Warning: There were undefined references.


LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

 )<c:/texlive/2013/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on main.pdf (1 page, 22297 bytes).
Transcript written on main.log.
share|improve this question
1  
Looks like a bug in animate. I am looking into it. –  AlexG May 6 at 6:59

1 Answer 1

up vote 4 down vote accepted

Remove preview from the class options. It is not necessary and it causes a problem during compilation. Without, the resulting PDF with the animation is ok.

BTW, older versions of standalone used to set preview option by default. Recent versions set option crop instead.

My test file (pdflatex --shell-escape):

%\documentclass[border=12pt]{standalone} % <-- works as well
\documentclass{article}
\usepackage{filecontents}

\begin{filecontents*}{diagram.tex}

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\foreach \x in {1,...,10}{
\begin{pspicture}[showgrid](5,5)
    \pscircle(2.5,2.5){!\x\space 10 div}
\end{pspicture}}
\end{document}

\end{filecontents*}


\usepackage{pgffor}
\foreach \compiler/\ext in {latex/tex,dvips/dvi,{ps2pdf -dAutoRotatePages=/None}/ps}{\immediate\write18{\compiler\space diagram.\ext}}

\usepackage{animate}
\begin{document}
\animategraphics[autoplay,controls,loop,scale=1]{3}{diagram}{}{}
\end{document}
share|improve this answer
    
But you definitely don't need it in the main.tex document which embeds the animation. As for the document which contains the animation frames you may do what you want. –  AlexG May 6 at 8:38
    
standalone without preview already produces a tight page border (12pt, as specified) around the animation, including the controls. So why do you need preview here? It fiddles around with TeX's page shipping routine in a manner that is somehow incompatible with animate. –  AlexG May 6 at 9:30
    
@IamwhoIsayIam No problem here with \documentclass{article} instead of \documentclass[preview,border=12pt]{standalone} in your main.tex. –  AlexG May 7 at 7:08
    
I tried with AR-11.0.0.379 (Win) without problem. Not sure whether your version is more recent. –  AlexG May 7 at 15:01
    
Would you please test the examples in the animate doc (animate.pdf)? –  AlexG May 7 at 15:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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