[Tex/LaTex] (Beamer) Numbering captions by section in beamer

beamercaptionsfloatsnumbering

I'm writing-up a lecture course in LaTeX with an essentially identical set of slides in beamer. I'd like to have the figure numbering in the beamer slides to match those of the lecture notes, for the sake of consistency in cross-referencing.

The lecture notes are written in the article document style (in particular there are no chapters), and have figures numbered by section (i.e. \section.\figure). Is there some simple preamble-trick or workaround that will change the way that the captions are produced in beamer to number them consistently with the lecture notes?

I'm trying to avoid having to write a new macro to use in the main body, since I'm compiling the notes and slides from the same set of source-files using \input.

Best Answer

It's actually very easy, though I had to read the manual for a while. Add these lines to your preamble:

\setbeamertemplate{caption}[numbered]
\numberwithin{figure}{section}

The first line uses another template for captions, one that inserts the figure's number. Luckily this functionality is already built into beamer.

The second line declares that the figure counter is subordinate to the section counter, so resets for each new \section and labels figures 1.1, 1.2, ..., 2.1, 2.2, .... This is built into LaTeX.

That's it!

Related Question