Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to have multiple Beamer slides discussing the same figure, and have the figure have the same Figure number across multiple slides. I am not sure how to do this. In the following example, I would like to have multiple slides discussing "First figure". If I simply create two different figures, clearly they will have different numbers. If I label them with the same label, I get

LaTeX Warning: There were multiply-defined labels.

What I want is something like below, but the second slide to say "Another interesting point about Fig. 1". How can I do this? Thank you in advance!

\documentclass{beamer}


\setbeamertemplate{caption}[numbered]


\begin{document}

\begin{frame}{Talk about Fig. 1}
  \begin{figure}[h]
    \centering
    My first figure
    %\includegraphics{something.png}
    \caption{First figure}
    \label{fig:first-fig}
  \end{figure}
Interesting point about Fig. \ref{fig:first-fig}.
\end{frame}

\begin{frame}{Talk about Fig. 1}
  \begin{figure}[h]
    \centering
    My first figure
    %\includegraphics{something.png}
    \caption{First figure}
    \label{fig:first-fig-2}
  \end{figure}
Another interesting point about Fig. \ref{fig:first-fig-2}.
\end{frame}


\end{document}

My beamer currently produces this.

share|improve this question
    
I get the expected result and no warning. –  egreg Feb 19 '13 at 1:07
add comment

1 Answer

up vote 2 down vote accepted

Although using floats like figure inside a beamer presentation seems wrong, you can use the following:

enter image description here

\documentclass{beamer}% http://ctan.org/pkg/beamer
\usepackage{lmodern}% http://ctan.org/pkg/lm
\setbeamertemplate{caption}[numbered]
\begin{document}

\begin{frame}{Talk about Fig. 1}
  \begin{figure}[h]
    \centering\includegraphics[width=100pt]{example-image-a}
    \caption{First figure}\label<1>{fig:first-fig}
  \end{figure}
  \only<1>{Interesting point about Fig.~\ref{fig:first-fig}.}%
  \only<2>{Another interesting point about Fig.~\ref{fig:first-fig}.}
\end{frame}

\end{document} 

The above relies on the overlay-aware \label, as well as other overlay aware things like \only. You specify a single frame and add some slide-specific content using the appropriate notation.

The use of lmodern stems from Warnings with beamer class and itemize. lmodern provides scalable fonts at the sizes required by beamer.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.