I wish to display some animations in my beamer presentation. The most trivial way that comes to my mind is to use a gif image. How can I put it in the presentation and what should I use to display it? Is there any other way of doing it?
[Tex/LaTex] gif image in beamer presentation
animationsbeamergif
Related Solutions
Yes, use the movie15 package (in Latex), which supports GIFs directly. You will need to use a PDF viewer that has the right plugin to supported GIF animations.
Note on media9
The movie15 package has been marked deprecated on CTAN for some time in favour of the media9 package, because media9 uses the better supported approach to embedding media of Adobe's Rich Media Annotations, rather than the old, ad-hoc, plug-in based approach of movie15. This has the consequence that building rich media documents in media9 is a more flexible process, supporting several workflows, and the results typically can be displayed with more viewers. However, media9 does not support animated GIFs - the GIFs would have to be converted to a supported format such as FLV or MP4 before embedding.
How about this: you have three commands:
\imagenode
for inserting the picture and setting up some dimensions- the optional
\imagegrid
which helps putting the frame \highlightbox
for drawing the frame
Code
\documentclass{beamer}
\usepackage{tikz}
\newcommand{\imagenode}[2][1]% [scale], filename
{ \node[above right,inner sep=0] (myimage) {\includegraphics[scale=#1]{#2}};
\path (myimage.north east);
\pgfgetlastxy{\myimagex}{\myimagey}
\pgfmathsetmacro{\myimagewidth}{\myimagex/28.453}
\pgfmathsetmacro{\myimageheight}{\myimagey/28.453}
}
\newcommand{\imagegrid}[4][help lines]% [options], steps, font, precision
{ \pgfkeys{/pgf/number format/.cd,fixed,precision=#4}
\foreach \x in {0,...,#2}
{ \draw[#1] (\x/#2*\myimagewidth,\myimageheight) -- (\x/#2*\myimagewidth,0) node[below] {#3\pgfmathparse{\x/#2}\pgfmathprintnumber{\pgfmathresult}};
\draw[#1] (\myimagewidth,\x/#2*\myimageheight) -- (0,\x/#2*\myimageheight) node[left] {#3\pgfmathparse{\x/#2}\pgfmathprintnumber{\pgfmathresult}};
}
}
\newcommand{\highlightbox}[8][densely dashed,thick]% [options], left, low, right, up, node options, node text, overlay spec
{ \only<#8>{\draw[#1] (#2*\myimagewidth, #3*\myimageheight) rectangle node[#6] {#7} (#4*\myimagewidth, #5*\myimageheight);}
}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\imagenode[3]{book.png}
\imagegrid{10}{\tiny}{1}
\highlightbox[red,very thick]{0.1}{0.1}{0.7}{0.2}{blue}{red frame}{2}
\highlightbox{0}{0.3}{0.3}{0.7}{circle,draw,fill=green!50!gray,solid}{dash}{2-3}
\highlightbox[blue,fill=blue,fill opacity=0.3]{0.42}{0.23}{0.65}{0.74}{opacity=0.8,fill=orange,text opacity=1}{!?}{1,3}
\end{tikzpicture}
\end{frame}
\end{document}
Best Answer
In a single run you will get 4 separate files as follows,
Requirements
How to compile
The following input file, named as
main.tex
, must be compiled withpdflatex -shell-escape main
. WARNING: If your OS is not Windows, then please adapt the Windows shell command to your OS shell command.Notes:
The auxiliary file named
frames.pdf
must be removed manually because I cannot remove it from withinmain.tex
. If you know how to do this, let me know!