# Animation not running in presentation made using beamer class [duplicate]

I wish to include an .gif animation in my latex beamer presentation. Based on my reading from various sources, including this website, what I understood was that I need to convert .gif into a series of .jpg images. I have converted .gif into 10 .jpg images titled from foo-1.jpg to foo-10.jpg. I have put all these images in the same folder where I have my template file and other images which are used subsequently. Next, I am using the below commands to include it as an animation

\begin{frame}
\animategraphics{12}{foo-}{0}{10}
\end{frame}


On doing this, I get no error, but the slide is shown as given in the attached image.

As it can be clearly seen, the animation does not fit on the slide, nor is it showing a set of moving images like a .gif file. What shall I do to get the animation nicely on the slide. I am ready to share all the 10 images if needed as a MWE, but please help me to overcome this problem.

## marked as duplicate by TeXnician, Phelype Oleinik, Zarko, Stefan Pinnow, BobyandbobMay 2 '18 at 17:54

• \animategraphics[loop,controls,width=\linewidth]{12}{foo-}{0}{10} or whatever width you want – user36296 May 2 '18 at 15:06
• to view it, you need a pdf viewer with of java script – user36296 May 2 '18 at 15:07
• or use tex.stackexchange.com/a/240247/36296 which I personally find safer – user36296 May 2 '18 at 15:07
• Also off-topic, but your figure seems to be simple enough that it could be drawn with TikZ/pgfplots or pstricks. – user121799 May 2 '18 at 15:16
• Yes, but such things can be drawn in TikZ/pgfplots/pstricks. I am doing this all time. You just need to animate a parameter. – user121799 May 2 '18 at 15:47

The answer to the problem has been borrowed from the comment of @samcarter. The correct latex code used is as follows

\begin{frame}[t]
\animategraphics[loop,controls,width=8.5cm]{12}{foo-}{0}{20}
\end{frame}


Using the above code, the screenshot of the solution slide is given as follows:

As it can be seen, it is possible to play, pause and some other options are also there, which makes it look better in a presentation

• It would look even better if you used a LaTeX-based plotting/graphing package such as pgfplots together with animate. As @marmot suggests, you will get high quality vector graphics which can be animated by animating a parameter. – AlexG May 2 '18 at 20:03
• @AlexG I don't know aboutpgfplotspackage. If possible, please post an answer on how it can be done – ShiS May 3 '18 at 1:19
• Look for tagged questions, entering [animate] [pgfplots] in the search bar. – AlexG May 3 '18 at 4:53