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 beamers overlay mechanism. however, purposes describe, \subfloats 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.

sample output

\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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -