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.

I want to create animation in Beamer using the animate package. I easily created a basic example following the "all-in-one approach" from this older post but I can not use pdflatex to compile, which leads to my issue.

I use this minimal code (copied from mentioned post) in a file called main.tex:

\documentclass{beamer}
\usepackage{filecontents}

%====================== BEGIN FILE CONTENTS ==========================
\begin{filecontents*}{dummy.tex}
\documentclass{article}
\usepackage{pstricks-add}

\usepackage[active,tightpage]{preview}
\PreviewBorder=0pt
\PreviewEnvironment{pspicture}

\newcommand\RotatingArrow[1]{%
    \begin{pspicture}(-1,-1)(10,11)
        \psframe*[linecolor=cyan,opacity=0.3](-1,-1)(10,11)
        \psset{arrows=->}
        \psaxes(0,0)(-0.5,-0.5)(9,10)[$x$,0][$y$,90]
        \rput(4.5,0.6){\Huge{Temps = #1 s}}
        \rput{#1}(4.5,5.5){%
            \psset{arrowsize=5pt}
            \pnode(2,0){A}
            \pnode(2,3){B}
            \psline[linecolor=blue](A)
            \uput[0]{-#1}(A){\Huge{$\textcolor{blue}{\vec{a}}$}}
            \psline[linecolor=red](A)(B)
            \uput[90]{-#1}(B){\Huge{$\textcolor{red}{\vec{v}}$}}}
\end{pspicture}}

\begin{document}
    \multido{\i=0+10}{36}{\RotatingArrow{\i}}
\end{document}
\end{filecontents*}
%====================== END FILE CONTENTS =========================

\usepackage{graphicx}
\usepackage{animate}

\begin{document}
\immediate\write18{latex dummy}
\immediate\write18{dvips dummy}
\immediate\write18{ps2pdf dummy.ps}
\begin{frame}{Circular motion in action}
    \animategraphics[controls,scale=0.5]{10}{dummy}{}{}
\end{frame}
\end{document}

This works fine when I compile in command line using:

pdflatex -shell-escape main.tex

However, as because of other tricks I usually use in my presentations, I need to use the route latex->dvips->ps2pdf, but when I compile doing:

latex main.tex
dvips main.dvi
ps2pdf main.ps

I get the error: Package animate Error: Missing frame number in \animategraphics command. THis error occurs after the step: latex main.tex

According to the animate package documentation, I think it should work but I'm obviously doing something wrong. Though the documentation mentions some issue with this way of compiling, I do not manage to work through it. Any pointer ?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

use \animateinline instead. It makes life easier:

\documentclass{beamer}
\usepackage{etex}
\usepackage{animate}
\usepackage{pstricks-add}

\newcommand\RotatingArrow[1]{%
    \psset{unit=0.5}\footnotesize
    \begin{pspicture}(-1,-1)(10,11)
        \psframe*[linecolor=cyan,opacity=0.3](-1,-1)(10,11)
        \psset{arrows=->}
        \psaxes(0,0)(-0.5,-0.5)(9,10)[$x$,0][$y$,90]
        \rput(4.5,0.6){Temps = #1 s}
        \rput{#1}(4.5,5.5){%
            \psset{arrowsize=5pt}
            \pnode(2,0){A}
            \pnode(2,3){B}
            \psline[linecolor=blue](A)
            \uput[0]{-#1}(A){$\textcolor{blue}{\vec{a}}$}
            \psline[linecolor=red](A)(B)
            \uput[90]{-#1}(B){$\textcolor{red}{\vec{v}}$}}
\end{pspicture}}

\begin{document}

\begin{frame}
\begin{animateinline}[poster=last, controls, palindrome]{12}%
\multiframe{36}{iAngle=0+10}{\RotatingArrow{\iAngle}}%
\end{animateinline}%
\end{frame}

\end{document}
share|improve this answer
    
Thanks, works a s a charm with latex->dvipsps->ps2pdf. I use it jointly with matlabfrag to get some simple animations out of Matlab. –  Castim Jun 1 at 18:06

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.