Graphics, Figures & TablesAnimations in TeXShop

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sweete
Posts: 3
Joined: Fri Sep 10, 2010 2:18 am

Animations in TeXShop

Post by sweete »

Good day,

I have been using Latex for a few years now and have recently discovered that you can put animations into the generated PDF's. However, I cannot seem to get it to work.

I am using TeXShop with the following

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{animate}

\begin{document}

\animategraphics[controls, loop]{4}{Parabola_}{1}{5}

\end{document}

I have 5 images saved as PDF's named Parabola_1.pdf, Parabola_2.pdf, ... .

As stated this does not produce an animation, rather, it simply produces a document with the first image, Parabola_1.pdf, as a figure. Any advice on how to insert animations from a set of pdf's would be appreciated.

Thanks in advance,

Erik Sweet
Last edited by sweete on Sat Sep 11, 2010 10:37 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

alex
Posts: 32
Joined: Mon May 19, 2008 10:53 am

Re: Animations in TeXShop

Post by alex »

Which PDF viewer do you use? Note that only AdobeReader is able to play the animations.

Alexander
sweete
Posts: 3
Joined: Fri Sep 10, 2010 2:18 am

Re: Animations in TeXShop

Post by sweete »

I currently have Adobe Reader 9

Erik Sweet
alex
Posts: 32
Joined: Mon May 19, 2008 10:53 am

Re: Animations in TeXShop

Post by alex »

Check Adobe Reader settings with regard to JavaScript. It needs to be enabled.
Are the graphics files of the sequence really different?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Animations in TeXShop

Post by localghost »

Consider to rename your graphics files. Perhaps there is the same problem a with graphics inclusion by means of the graphicx package. So avoid special characters like blank space or underscores in the name and the path of the files.


Thorsten
sweete
Posts: 3
Joined: Fri Sep 10, 2010 2:18 am

Re: Animations in TeXShop

Post by sweete »

It appears as though I had it all along. I was not aware that you needed to view the pdf on its own rather than the one produced by Typesetting.

Thank you though, I would not have realized that had I not attempted to enable the Java Script.

I ended up using the following

\begin{animateinline}[autoplay]{1}

\includegraphics{parabola1.pdf}

\newframe[1]

\includegraphics{parabola2.pdf}

\newframe[1]

\includegraphics{parabola3.pdf}

\newframe[1]

\includegraphics{parabola4.pdf}

\newframe[1]

\includegraphics{parabola5.pdf}

\end{animateinline}

to show each pdf at a rate of 1 frame per second.

Thanks again,

Erik Sweet
alex
Posts: 32
Joined: Mon May 19, 2008 10:53 am

Animations in TeXShop

Post by alex »

sweete wrote: I was not aware that you needed to view the pdf on its own rather than the one produced by Typesetting.
Of course. If you \includegraphics a pdf containing an animation, the special PDF stuff (widgets, frames, JavaScript etc.) needed by the animation gets lost, as it would be the case with more common PDF features like hyperlinks.
... I ended up using the following

Code: Select all

\begin{animateinline}[autoplay]{1}
 \includegraphics{parabola1.pdf}
\newframe[1]
 \includegraphics{parabola2.pdf}
\newframe[1]
 \includegraphics{parabola3.pdf}
\newframe[1]
 \includegraphics{parabola4.pdf}
\newframe[1]
 \includegraphics{parabola5.pdf}
\end{animateinline}
Why so complicated.

Firstly, you do not need to repeat the frame rate with every \newframe command if it does not change. The frame rate argument of \newframe is optional, as it is indicated by the brackets around the number.

Secondly, in your case, an external graphics file sequence is to be animated. This is what the \animategraphics command is intended for:

Code: Select all

\animategraphics[autoplay]{1}{parabola}{1}{5}
will suffice. Run a LaTeX document (article, presentation, whatsoever) containing this line through pdfLaTeX and watch the result.

Alexander
Post Reply