[Tex/LaTex] Beamer + subfigure numbering

beamersubfloats

When using beamer with the subfigure package, the subfigure labels (a), (b) etc. are not reset at the beginning of a new figure.

Example:

    \documentclass{beamer}
    \usepackage{subfigure}  
    \begin{document}


    \begin{frame}
        \begin{figure}[htbp]
            \centering
            \subfigure[Text 1]{Testing subfigure}

            \subfigure[Text 2]{Testing subfiguare even more}      
        \end{figure}
    \end{frame}

    \begin{frame}
        \begin{figure}[htbp]
            \centering
            \subfigure[Text 1]{Testing subfigure}

            \subfigure[Text 2]{Testing subfiguare even more}      
        \end{figure}
    \end{frame}

    \end{document}

How can I fix this?

Best Answer

With beamer's heavily redefined environments and macros to its custom overlay specification, the subfigure counter does not reset at the start of every figure environment. Easiest is to insert

\setcounter{subfigure}{0}% Reset subfigure counter

between the two frames (or before the next frame). If you're willing to have the frame be the designated "master" counter, you could add

\makeatletter
\@addtoreset{subfigure}{framenumber}% subfigure counter resets every frame
\makeatother

at your document start. Alternatively, if you want to tie the subfigure counter to a figure (rather than a frame), you could use

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\AtBeginEnvironment{figure}{\setcounter{subfigure}{0}}% Resets subfigure counter at start of figure environment