I'm writing a latex file on Overleaf and I would insert a gif image.
Is it possible? Because I didn't find any solutions.

6

1 Answer

I had the same problem and I solved it by converting the gif to a set of pngs and then using the animate package.

For the first task you can exploit one of the solution suggested here.

Once you have a series of image files named with a shared prefix (e.g. fig-) and an increasing index that track the order in which they have to appear, then the usage of `animate} is pretty simple:

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{graphicx, animate} \title{animate SO} \date{January 2022} \begin{document} This is how to insert gif in main document: % use the usual figure environment and substitute \includegraphics with \animategraphics \begin{figure} \centering % \includegraphics{} \animategraphics[width=\textwidth, loop, autoplay]{1}%frame rate {figures/fig-}%path to figures {1}%start index {4}%end index \caption{Local gif} \label{fig:my_label} \end{figure} \end{document} 

Notice that I needed to express the path to the location of the figures as./figures/<fig-prefix> in case the \animategraphics is called by an external tex file which is included in the main. I created a sample overleaf project to showcase the usage.

Finally, I'd suggest have a look to StackExchange LaTeX for latex related question :)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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