# How to pause figures in beamer

I would to \pause two different images (as I can to do with text). This is the ideal code:

\documentclass{beamer}

\usetheme{Copenhagen}
\setbeamercovered{dynamic}

\begin{document}

\begin{frame}
\centering
\includegraphics{gfx/img1} \\
\pause
\includegraphics{gfx/img2}
\end{frame}

\end{document}


What is the real code?

I see both the images on each pause.

Edit: I would to preserve the absolute position of the images and the dynamic behaviour.

-
Your code is the real code (adding \par or a blank line after the second \includegraphics). –  Gonzalo Medina Dec 7 '11 at 19:32
@GonzaloMedina It doesn't work =( –  Baduel Dec 7 '11 at 19:41
Saying just "it doesn't work" is useless. What exactly doesn't work? What error(s) do you get? I did a test before posting my comment and it worked, so please explain what exactly doesn't work. –  Gonzalo Medina Dec 7 '11 at 19:44
@GonzaloMedina It compiles but I see both the images. I now also add something in the preamble. Maybe the dynamic option is the problem? –  Baduel Dec 7 '11 at 19:47
Yes, dynamic was the key here! –  Gonzalo Medina Dec 7 '11 at 19:58

You can also use

\visible<1>{content}


in order to have content only visible on slide 1, but reserve space for it on the other slides. This may help you with your positioning problem.

-
I added to my answer a complete example using your suggestion; I hope it's OK with you. –  Gonzalo Medina Dec 7 '11 at 23:33
Thank you. Is it possible to preserve the dynamic behaviour? i.e. not visible image semitransparent. –  Baduel Dec 8 '11 at 10:26
@Baduel I don't think it is possible with \includegraphics, as beamer does not know how to make the image semitransparent. That is in fact why you saw both images in your first version. You can try drawing a tikz picture instead of using \includegraphics, and it should show semitransparent even in your first code version. –  silvado Dec 8 '11 at 11:49
Ok thanks. I don't know tikz, but I will remedy. –  Baduel Dec 8 '11 at 11:56

You can use \only:

\documentclass{beamer}
\setbeamercovered{dynamic}

\begin{document}

\begin{frame}
\centering
\only<1->{\includegraphics[width=4cm]{ctanlion}}
\only<2>{\includegraphics[width=4cm]{ctanlion}}\par
\end{frame}

\end{document}


To preserve the relative position in slide one, you can use overlayarea:

\documentclass{beamer}
\setbeamercovered{dynamic}

\begin{document}

\begin{frame}
\vskip10pt
\begin{overlayarea}{\textwidth}{.45\textheight}
\centering
\only<1-|handout:0>{\includegraphics[width=4cm]{ctanlion1}}
\end{overlayarea}%
\begin{overlayarea}{\textwidth}{.45\textheight}
\centering
\only<2>{\includegraphics[width=4cm]{ctanlion2}}
\end{overlayarea}
\end{frame}

\end{document}


and, since \includegraphics is overlay-aware, you can also say

\documentclass{beamer}
\setbeamercovered{dynamic}

\begin{document}

\begin{frame}
\vskip10pt
\begin{overlayarea}{\textwidth}{.45\textheight}
\centering
\includegraphics<1-|handout:0>[width=4cm]{ctanlion}
\end{overlayarea}%
\begin{overlayarea}{\textwidth}{.45\textheight}
\centering
\includegraphics<2>[width=4cm]{ctanlion}
\end{overlayarea}
\end{frame}

\end{document}


or, even simpler, \visible, as suggested by silvado; here's a complete version of the code:

\documentclass{beamer}
\setbeamercovered{dynamic}

\begin{document}

\begin{frame}
\centering
\visible<1-|handout:0>{\includegraphics[width=4cm]{ctanlion1}\\}
\visible<2>{\includegraphics[width=4cm]{ctanlion2}}\par
\end{frame}

\end{document}

-
Perfect, is possible to preserve the original position? I wouldn't that first image disappears. –  Baduel Dec 7 '11 at 20:02
@Baduel: see my updated answer. –  Gonzalo Medina Dec 7 '11 at 20:06
Just make only the second one only. Also note that you can use ranges, e.g. only<2-> for one image and only<3-> fo the next. Then in the first subslide no image would be seen, in the second only the first, and in the third (and all following, if any follow) both. –  celtschk Dec 7 '11 at 20:06
@GonzaloMedina Very nearly to what I want. Is it possible to preserve the absolute position in each step? –  Baduel Dec 7 '11 at 20:42
Also note that want to do this in order to print the frame in only one slide, when I will put the handouts option. –  Baduel Dec 7 '11 at 20:50

I have just answered a very similar question here on tex.stackexchange, and I figured it would be a good solution for your problem too.

So, in short, your code is almost perfect if you download this custom style file and add it with a usepackage statement:

\documentclass{beamer}

%% %% %% ADD THIS LINE
\usepackage{fixpauseincludegraphics}

\usetheme{Copenhagen}
\setbeamercovered{dynamic}

\begin{document}

\begin{frame}
\centering
\includegraphics{gfx/img1} \    \pause
\includegraphics{gfx/img2}
\end{frame}

\end{document}


(the style file contains a rewritten version of \includegraphics that will draw your image with some added opacity).

-
I just tried this and I get "! Undefined control sequence. <argument> \transparent@value /100 " –  felix Oct 22 '13 at 16:01
@Jealie, the second link is not working as expected. –  epsilone Dec 4 '14 at 9:18
Check this for the package –  Arturo Volpe Apr 27 at 1:15
@ArturoVolpe: thank you for the new link! I have updated the response. –  Jealie Apr 27 at 17:58
@felix apparenlty, you need a \begin{itemize}[<+->] somewhere before the \includegraphics. –  Arturo Volpe Apr 27 at 21:52