1

This question already has an answer here:

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. enter image description here

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, Bobyandbob May 2 '18 at 17:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

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: enter image description here

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

  • 2
    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
  • 1
    Look for tagged questions, entering [animate] [pgfplots] in the search bar. – AlexG May 3 '18 at 4:53

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