TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I get figure numbers to run in the same sequence as equation numbers, eg (1.2.3) equation .... figure 1.2.4? For the environments I define I use \newtheorem{thm}[equation]{THM}, but I don't know how to do the same trick with pre-defined environment like figure.

share|improve this question
But this can be confusing since figures wrote with the figure environment might float away from the point where you wrote them in the code. – Gonzalo Medina May 20 '12 at 2:31
Your question's aim is ambiguous: Do you want figures to share the same counter as equations, or do you just want a figure's number to be rendered in the same way as an equation's number is? I would assume it's the latter. If that's correct and the amsmath package is loaded, all you need to do is issue the command \numberwithin{figure}{section}. – Mico May 20 '12 at 5:07

The required numbering scheme can be confusing since figures written using the figure environment might float away from the point where you wrote them in the code (see my example code below in which the numbers appear out of their natural order).

If you want this scheme, using, for example. the amsmath package and its \numberwithin command you can make the equation and figure counters tied to section numbering: then, with the help of the etoolbox package you can make the figure environment to increase the equation counter and viceversa:







\rule{1cm}{1cm}% placeholder for `\includegraphics`
\caption{A test figure}



enter image description here

share|improve this answer

You want to use the same counter for figures as you use for equations? Here's one solution:

% \dupcntr{slave}{master} has the slave counter be an alias for the master counter
    \expandafter\let\csname c@#1\expandafter\endcsname\csname c@#2\endcsname

% snip


The solution was borrowed from a TeX stackexchange discussion on Slave Duplicate Counters

share|improve this answer

Your Answer


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.