I am writing a document with several figures with subsections numbers in the 2.1, 2.2, etc. format. I would like to number the figures in each subsection with a 3 digit format, for example: Figure 2.1.1, Figure 2.1.2, Figure 2.2.1, etc. How do I go about doing this? I am very new to latex.
Asked
Active
Viewed 1,104 times
1 Answers
0
The below code should do the trick; chngcntr is a small package that resets a counter (1st argument) each time another counter (2nd argument) is increased, and ensures the first counter is displayed as 2nd counter.1st counter. If you want only to reset the first counter, and display this counter alone, use \counterwithin*.
\usepackage{chngcntr}
\counterwithin{figure}{subsection}
\counterwithin{table}{subsection}
Bernard
- 271,350
-
I thought the name of the command is self-explanatory, but I can add some explanations… – Bernard Aug 04 '15 at 21:19
-
Thank you, this worked. It doesn't work the same way for equations it seems, and I need to number those the same way. I'm using the article document class. – Andrew Aug 04 '15 at 22:11
-
-
Solved the equation problem with \numberwithin, didn't work in my main tex file but it did in the section tex file. Thanks again for your help. – Andrew Aug 04 '15 at 23:12
-
\begin{figure}\caption{dummy caption}\end{figure}should be enough; no actual graphics need to be included. – barbara beeton Aug 04 '15 at 20:45sectiontosubsectionin the answer to the duplicate question. – Gonzalo Medina Aug 04 '15 at 21:03