12

I need to put an animation into a slideshow I am making using the beamer package for LaTex. Ideally I would like it to loop and play again and again like a GIF, but anything similar would work as well. I used MatLab to generate the figures (right now I just have a sequence of pictures, but I should be able to put it into any format necessary). I know there is an animator function in beamer, but I've no idea how to really use it. I've also seen some places that using PNG files can accomplish the same result as GIF's, but once again I'm not sure how to do this.

I found a similar question on this site, but they seem to have LaTex generating the figures??? Besides when I copied the code into my editor it didn't run. I really like the format of the animation in this example, but no idea how to adapt it to work for me. Here is the link to the page: Similar Question with Answer.

Any advice would be greatly appreciated.

Logan
  • 123

1 Answers1

11

Use the animate package. Its \animategraphics command will take your external images and put them in an animation. So, assuming that you have images image1.jpg, ... image6.jpg (or in any other format recognized by LaTeX), write:

\animategraphics[controls]{1}{image}{1}{6}

(Btw, this works also in a "normal" document, i.e. in a non-beamer class.)

  • Thanks so much it works great. Quick question, is there a way to get the controls like the one in the example and/or tell it how many frames (pictures) to do per second. I know I'm being picky now, but I thought I'd ask. – Logan Feb 22 '13 at 02:30
  • Sure: the controls are already present in whta I wrote (optional arg controls). The first mandatory arg controls the framerate (above, 1 (Hz)). And, it's all the manual! ;-) – Sašo Živanović Feb 22 '13 at 02:33
  • Oh, I took the word controls out to change the size. Oops XD I didn't know that there was a manual. Thanks you so much!!! This is going to MAKE my presentation. – Logan Feb 22 '13 at 02:38
  • @Logan: You asked for playing in a loop: Just add ,loop to the option list. – AlexG Feb 22 '13 at 08:14
  • 1
    This currently isn't working for me. Is this feature widely implemented by PDF readers, or could that be my problem? – MaxAxeHax Jun 09 '13 at 18:34
  • @MHaaZ: You need Adobe Reader for this. – AlexG Jul 17 '13 at 07:40
  • 1
    @SašoŽivanović, what about only one gif image? How to include it and animate it? – Sigur Jun 03 '14 at 00:16
  • @Sigur I'm not sure I understand what you mean by animating a single image. – Sašo Živanović Jun 04 '14 at 06:40
  • 1
    @SašoŽivanović, I mean: how to include a gif file so that when I show the frame containing it the gif starts to animate (as it does when we open it with the browser, for example). But I guess that gif is not supported. – Sigur Jun 04 '14 at 17:03
  • 1
    @Sigur You can use Imagemagick to convert the GIF to a series of PNG frames, and use this method to play back the series of image files. – Vortico Jul 17 '14 at 23:40
  • Does LaTeX support APNG (Animated PNG)? – Royi Aug 28 '17 at 15:48