1

I'd like to include the GIF in the link (https://spin.atomicobject.com/wp-content/uploads/ms_2d_bw_2.gif) into my beamer presentation. I've seen several threads that converts the GIF into a sequence of PNG's, and then run them one after another. But being a beginner, I'm still confused. I'd really appreciate if you could just give me the exact code to include in between

\begin{frame}

\end{frame}

so that the GIF will run like a movie.

P.S. Ideally it'd be the best if I can have a code that'd make the beamer presentation access the link above, run it like a movie and then continue with the rest of the presentation, without having to download the GIF. But other codes are fine too :)

Thanks a lot!!!

1
  • 1
    Have a look at this answer. You can use the online converter, then upload the set of png's into a new folder, that you create in your overleaf project. Then you can animate the set as described.
    – Nico
    Commented Jan 31, 2020 at 12:32

2 Answers 2

2

The PDF file format does not support animated and static GIFs as direct embeds. For PDF you will need to split an animated GIF into a PNG sequence and follow, for example, instructions given in Getting Gif and/or moving images into a LaTeX presentation .

However, the SVG format allows animated GIFs to be directly embedded in SVGs. SVG can be produced from TeX input by means of latex and dvisvgm. The SVG file can be opened and displayed in a WEB browser.


Click and press F11 to put the Web browser to full-screen:


Commands for producing SVG

latex file.tex
latex file.tex
dvisvgm --zoom=-1 --font-format=woff file.dvi

For every GIF to be embedded, the bounding box information must be provided by the user in an .xbb file. In the example code, ms_2d_bw_2.xbb is written by means of the filecontents environment. Also, a GIF embedding rule must be defined, such that the graphicx package knows how to deal with remote (online) GIF files.

The latex input:

\documentclass[dvisvgm]{beamer}

%Graphics rule for Web-located Gifs (use local .xbb file and prepend base URL)
\DeclareGraphicsRule{.gif}{bitmap}{.xbb}{https://spin.atomicobject.com/wp-content/uploads/#1}

% write auxiliary file with BoundingBox information
%
%   %%BoundingBox 0 0 <width in pixels> <height in pixels>
%
\begin{filecontents*}{ms_2d_bw_2.xbb}
%%BoundingBox: 0 0 1013 715
\end{filecontents*}

\begin{document}
\begin{frame}{Animated Gif}

\includegraphics[width=0.8\linewidth]{ms_2d_bw_2.gif}

\end{frame}
\end{document}
0
\documentclass{beamer}
\begin{document}
\begin{frame}
\transduration{1.5}
A movie:\vfill\centering
\only<1>{\includegraphics[scale=0.5]{example-image-a}}
\only<2>{\includegraphics[scale=0.5]{example-image-b}}
\only<3>{\includegraphics[scale=0.5]{example-image-c}}
\end{frame}
\end{document}

This example should work as is since you must have these images in your TeX distro. In case of GIF images it should be converted to PNG, JPG or PDF in your working directory, a searchable path, or alternatively add the route before of the filename.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .