Renumbering figure in LaTeX?
Asked Answered
E

2

55

How can I make figures be renumbered in a TeX document? I want the main figures to be 1, 2, 3, ...etc. But then I want a section to have supplementary figures, S1, S2, S3, S4. The "S" does not have to appear in the figure name, but I do want to reset the counter.

Etymologize answered 2/8, 2010 at 20:37 Comment(3)
This would be better asked on the TeX/LaTeX Stack Exchange site, now in public beta: tex.stackexchange.com/questionsGavin
have you looked at the caption package?Refractive
See tex.stackexchange.com/questions/41318/… and bytesizebio.net/2013/03/11/… for more information and tex.stackexchange.com/questions/39315/… and tex.stackexchange.com/questions/85776/… for more infoEarthward
F
80

Next to reseting the counter for the figures:

\setcounter{figure}{0}

You can also add the "S" by using:

\makeatletter 
\renewcommand{\thefigure}{S\@arabic\c@figure}
\makeatother
Fidge answered 5/8, 2010 at 13:1 Comment(3)
You should always use \makeatother after this or it will mess up the use of @ in commands.Coussoule
Works for subfigures too: \setcounter{subfigure}{0}.Guardant
For being able to restore the original behaviour: \let\originalthefigure\thefigure before this, and \let\thefigure\originalthefigure when you want to restore itIll
A
11

you can reset the figure counter with

\setcounter{figure}{0}
Argillite answered 2/8, 2010 at 20:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.