# How do I alternate images and only have captions for the first one?

I'm trying to create an itemized list with alternating images in beamer. I've got the list part and the images to work, but things break down when I try to add captions. Basically, I only want to caption the first image. Whenever I try to do only that one, the captions show up onto the later images as well.

I read the post: How do I alternate graphics in LaTeX beamer and was able to improve things, but the workaround was to add captions to the latter images, which I didn't want to do. Without captioning them the original caption would hang around, and sometimes the images would be shifted downward.

Here is the code I've got right now: (please forgive me if it looks bumbly, I'm new at this)

\documentclass{beamer}
\usepackage{graphicx}
\setbeamertemplate{caption}[]
\begin{document}
\frame{
\begin{columns}
\begin{column}{5cm}
\begin{itemize}
\item<1-> founded en el a\~{n}o de
\item<2-> populaci\'{o}n de m\'{a}s de 5000 personas
\item<3-> Hay un colegio de aproximamente 500 estudiantes
\end{itemize}
\vspace{1cm}
\end{column}
\begin{column}{8cm}
\begin{figure}
\includegraphics<1>[scale=0.25]{downtown}
\def\figurename{Image}
\caption{\only<1>{Foto por }\only<2>{Lago Flor}\only<3>{Colegio de Saranac Lake}}
\begin{center}
\includegraphics<2>[scale=0.5]{lakeflower}
\end{center}
\includegraphics<3>[scale=.21]{slhs}
\end{figure}
\end{column}
\end{columns}}
\end{document}


I've tried using only \only<1> but the same caption shows up when the later images appear. I played with \onslide a bit but didn't have any success. I tried making the later images their own figures, but that didn't solve it either.

I'm using Texmaker with the embedded PDF viewer, though I've opened the output in an external viewer and it looks the same. I'm using the pdflatex mode.

If anyone has an idea about this I would love to hear it. I feel like I'm missing something elemental that would make this work. I can always just duplicate the slide and get around this problem, but I feel like there must be a better way.

-

Here is a minimal example that allows you to show the captions at will:

\documentclass{beamer}% http://ctan.org/pkg/beamer
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\begin{document}

\begin{columns}
\begin{column}{5cm}
\begin{itemize}
\item<1-> founded en el a\~{n}o de
\item<2-> populaci\'{o}n de m\'{a}s de 5000 personas
\item<3-> Hay un colegio de aproximamente 500 estudiantes
\end{itemize}
\vspace{1cm}
\end{column}

\begin{column}{8cm}
\begin{figure}
\centering
\includegraphics<1>[scale=0.15]{tiger}%
\includegraphics<2>[scale=0.15]{tiger}%
\includegraphics<3>[scale=0.15]{tiger}%

\only<1>{{\usebeamercolor[fg]{caption name}Image:} Foto por}%
\only<2>{Lago Flor}%
\only<3>{Colegio de Saranac Lake}
\end{figure}
\end{column}
\end{columns}
\end{frame}

\end{document}


Some tips regarding the above example:

• I had to use a different image. I used tiger.eps;
• Try to indent your code. It will improve reading and debugging;
• You don't need to use the macro \caption in order to set a figure caption. Just like I used in my example, you can just set regular text as the caption. I used \usebeamercolor[fg]{caption name} to obtain the same formatting as a regular \caption.
• For completeness, to show that you can manage the captions at will, I've included a "caption" for each of the three figures, which you can keep/remove.
-
Werner- Thanks for the help- it works beautifully. I also appreciate the tips- I'll go back and indent my other slides. It certainly makes it easier to follow things. Best of luck! – Chris Mar 1 '12 at 14:39
@Chris: If this solved your problem, consider upvoting and accepting it. – Werner Mar 1 '12 at 14:44