# How to create multilevel figure / table numbers?

How to create figure numbers like 1.1.1 and then 1.2.1, not 1.2.2? I mean even if I added \arabic{section} into the command, the order of figures is still continuous, not accordingly rearranged by sections. Is there any mistake I made? Below is the command line:

\renewcommand{\thefigure}{\arabic{chapter}.\arabic{section}.\arabic{figure}}
-
Can you give more detail about what the numbers refer to . In '1.2.1' I guess the first number is the chapter. What about the other two? –  Joseph Wright Aug 28 '10 at 5:30

For numbering figures and tables per chapter you could use the command \numberwithin of amsmath:

\usepackage{amsmath}
\numberwithin{figure}{section}
\numberwithin{table}{section}

amsmath is very recommendable if you write mathematical expressions in your document.

Alternatively, use the package chngcntr which is specialized in such manipulations of counters:

\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{table}{section}
-
Contrary to amsmath, chngcntr also provides a command for decoupling counters (\counterwithout). –  lockstep Aug 28 '10 at 9:35
chngcntr is also embedded in memoir –  Brent.Longborough Aug 28 '10 at 15:38
Perhaps you could also mention the keys tablewithin=..., and figurewithin=... from the caption package. –  Gonzalo Medina Aug 22 '11 at 1:54
@Peter Grill: Yes, thanks, corrected. That package has a strange name, completely without vocals, inviting for typos. –  Stefan Kottwitz Sep 11 '11 at 22:36

We solved this by using the following piece of code

\numberwithin{figure}{section}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{section}.\arabic{figure}}

Make sure to place the \numberwithin command before the renewcommand snippet, otherwise it won't work.

-