I am trying to run two pictures in one beamer slide step by step. But I have a duplicate of the "caption" name.
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{figure}[ht]
\begin{center}
\leavevmode \subfloat[first]{%
\includegraphics[width=4cm,height=4cm]<1>{example-1}}
\hspace{2cm}
\subfloat[second]{%
\includegraphics[width=4cm,height=4cm]<2>{example-2}}
\end{center}
\end{figure}
\end{frame}
\end{document}
Do you know why?
Your posted code does not compile without extra packages. I presume you are using
subfig
, which is the only standard package that will compile without errors. However as you notice it produces two captions; this is because there is no compatibility code to work withbeamer
s overlay mechanism. However, for the purposes you describe, the\subfloat
s are not really necessary.Here are two different approaches. The first places to the two figures at about the same position on each slide, the second places the first to the left on the first slide and the second to right on the following slide.