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.

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?

share|improve this question
1  
The subfigure package is obsolete. Use the subfig package package instead. –  Werner Sep 8 '11 at 8:50
    
You should use subcaption instead of the deprecated subfigure. subfig is also deprecated. –  Stefan Majewsky Sep 8 '11 at 11:52
    
subfig is not deprecated. –  Gonzalo Medina Sep 8 '11 at 11:59
add comment

1 Answer

up vote 7 down vote accepted

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
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.