1

I know the many postprocessive threads from .tex to .ppt/.pptx/... where the main thread Export beamer slides to powerpoint/openoffice-impress/keynote editable format. However, their idea is mainly to postprocessively convert Beamer generated PDFs to ppt/pptx/libre office/... However, I would like to generate presentations with animations (.gif) from LaTeX source files. Pseudocode

  1. 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 on the thread Putting animations into latex beamer presentation. Use png, gif? Run the command on the example penguin .gif animation and you get a directory of files out00000.png, out00001.png, ... and out00016.png

    # https://stackoverflow.com/a/12828048/54964
    convert -coalesce giphy.gif out%05d.png
    
  2. Use the .tex code in the same directory as 16 .png images.

    \documentclass{beamer}
    
    \usepackage{animate}
    \usepackage{graphicx}
    
    \begin{document}
    
    \begin{frame}
        \begin{figure}
        % https://tex.stackexchange.com/a/99361/13173
        % https://tex.stackexchange.com/a/355306/13173
            \animategraphics[controls,autoplay,loop]{2}{out000}{00}{16}
        \end{figure}            
    \end{frame}
    
    \end{document}
    
  3. Present LaTeX beamer + .gif animations in any presentation format base based on the thread Putting animations into latex beamer presentation. Use png, gif? and how to include external animation (with animate) in Beamer

Output: pdf file does not run any animation in acroread, but only a starting picture of the animation there; also the size of the figure is going over the frame size

Fig. 1 Example .gif animation where you see the animation after clicking it, Fig. 2 Output in acroread with only starting picture, no capability to start the animation, Fig. 3 Output of Sharelatex here by AlexG where the penguins do not move if code generated in my system, Fig. 4 Output of Sharelatex here by AlexG where the penguis do move if download ShareLaTeX version of the document and view through acroread, like in Fig. 1!

enter image description here enter image description here enter image description here

Expected output: one slide with the animation on one page

Testing AlexG's proposal

Generate images as stated first. Have \animategraphics[width=\textwidth, ...]{12}... in contrast to the starting point. The picture is now correctly in the center. TODO why {12} and not {2}. Only relevant changes of the code from the first code

% AlexG
\begin{frame}
    \begin{figure}
    % https://tex.stackexchange.com/a/99361/13173
    % https://tex.stackexchange.com/a/355306/13173
        \animategraphics[controls,autoplay,loop]{2}{out000}{00}{16}
    \end{figure}
\end{frame}

Output: generated in my system and viewed in acroread, no response to action of buttons, the animation is not moving at start neither

Output of same code in ShareLaTeX: download the document from ShareLaTeX and view it with acroread, you get expected output - the animation is in action from the start correctly

This phase difference proposes there is a problem in my TeXLive.

TeXLive: 2016
PDF viewer: Adobe Acrobat 9.5 (acroread) installed as described here
OS: Debian 8.7
Internet browsers for ShareLatex: Firefox, Google Chrome

2

Of course you could spend your precious time and hack beamer to remove the - (hint: the command to you have to modify is probably

\define@key{mpm}{format}[\@mpm@defaultformat]{%
  \global\def\@mpm@format##1{##1-\the\@mpm@count.#1}}

the single - should be easy to find), but then your are still left with the problem, that you export your images with a fixed number of characters ... so in summary: this can be done in tex, but why reinventing the wheel?

So don't wast your time and either rename the files (for very major operating system solutions exist to bunch rename files) or simply export them in a naming scheme compatible to beamer, e.g.:

convert -coalesce cOB2w.gif out-%d.png

With

\documentclass{beamer}
\usepackage{xmpmulti}
\begin{document}

    \begin{frame}
        \frametitle{Penguins are cute!}
        \transduration<0-16>{0}
        \multiinclude[<+->][format=png, graphics={width=\textwidth}]{out}
    \end{frame}

\end{document}

the result is as expected 17 slides within the frame, which will automatically be animated with a suitable pdf viewer in presenter mode:

enter image description here

  • @LéoLéopoldHertz준영 What's wrong with 17 slides? Your linked penguin consists of 17 images, so I would not expect anything else. – user36296 Jun 5 '17 at 19:25
  • @LéoLéopoldHertz준영 That's the beamer way to deal with animations. If you don't like it, use some third party package, but this is much more risky concerning pdf viewers. – user36296 Jun 5 '17 at 19:27
  • 1
    @Léo : You will need Acrobat Reader or Foxit (available for Windows) for viewing animate generated animations. – AlexG Jun 6 '17 at 9:02
2

I did not manage run correctly AlexG's proposal in my old TeXLive 2016 installation because of two separate TeXLive 2016 installations in the system + their conflicts so I decided to remove both installations and move to TeXLive 2017. However, my new TeXLive 2017 installation output is showed correctly in acroread after a few compilations. AlexG's proposal + move to TeXLive 2017

\documentclass{beamer}

\usepackage{animate}
\usepackage{graphicx}

\begin{document}

\begin{frame}
    \begin{figure}
    % https://tex.stackexchange.com/a/99361/13173
    % https://tex.stackexchange.com/a/355306/13173
        \animategraphics[
          width=\textwidth,
          controls,autoplay,loop
        ]{12}{out000}{00}{16}
    \end{figure}
\end{frame}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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