Can one show a gif in RMarkdown rendered as a pdf?

Is there an easy way to include a gif in RMarkdown when the output is going to be rendered as a PDF, specifically using beamer_presentation?

I see lots of advice about how to save a gif, but not how to display one. That suggests that either showing a gif is very hard or that I'm am missing something obvious (hopefully the latter.)

GIF won't work as is in PDF output as with HTML output. However, animation are possible with LaTeX for PDF.
It is based on the animate CTAN package. See

If you already have a GIF not created by R, you would probably need to extract several images from your GIF (using magick package ?) and then animating them. And then insertion can be done in raw Latex this way it seems

Hope it helps

Thank you @cderv. Seems like it's doable, but not trivial.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.