8

It was asked a while ago how to make equation use the same counter as a theorem for example and one solution was to make the theorem counter use the equation instead by using

\newtheorem{thm}[equation]{Theorem}

Now what if I also want figures to follow the same pattern? Figures use the counter figure and theorem can’t have two counters.

  • 2
    This is lockstep again. :-) Please split your question/answer into one question and one answer (self-answers are allowed, although one should normally wait some time to give other users a chance to answer). BTW, I have a (hopefully) better solution. – lockstep Apr 19 '11 at 20:29
17

Adding \addtocounter{equation}{1} before every figure environment is cumbersome and error-prone. Assuming you have succeeded in connecting theorem counters to the equation counter, here's how to make equations and figures share a counter (add this to your preamble):

\makeatletter
\let\c@equation\c@figure
\makeatother
1

Note: The OP provided an answer to his own question as part of the question. I cut and pasted his text into a separate answer.

After some digging I found a (not so satisfactory) solution: put this in a preamble to the document

\renewcommand{\thefigure}{\arabic{chapter}.\arabic{equation}}

and whenever you have a figure, just before the \begin{figure}, put the following:

\addtocounter{equation}{1}

Funny enough moving the above command (which increments the equation counter) inside the \renewcommand above doesn’t work! All figures will remain with the same number... :/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy