latex - Why did I get my subfloat twice? -
i trying run 2 pictures in 1 beamer slide step step. have duplicate of "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 know why?
your posted code not compile without packages. presume using subfig
, standard package compile without errors. notice produces 2 captions; because there no compatibility code work beamer
s overlay mechanism. however, purposes describe, \subfloat
s not necessary.
here 2 different approaches. first places 2 figures @ same position on each slide, second places first left on first slide , second right on following slide.
\documentclass{beamer} \begin{document} \begin{frame} \begin{figure}[ht] \begin{center} \leavevmode \only<1>{\caption{first}% \includegraphics[width=4cm,height=4cm]{example-image-a}} \only<2>{\caption{second}% \includegraphics[width=4cm,height=4cm]{example-image-b}} \end{center} \end{figure} \end{frame} \begin{frame} \begin{columns} \begin{column}<1>{0.45\textwidth} \begin{figure} \centering \includegraphics[width=4cm,height=4cm]{example-image-a} \caption{first} \end{figure} \end{column} \begin{column}<2>{0.45\textwidth} \begin{figure} \centering \includegraphics[width=4cm,height=4cm]{example-image-b} \caption{second} \end{figure} \end{column} \end{columns} \end{frame} \end{document}
Comments
Post a Comment