I am trying to get my figure to counter to follow my theorem counter. I created a few different environments: lemma, example, definitions, etc. I have gotten all of them to follow my theorem counter.
The numbering goes Chapter.Section.theorem. So it will go like this:
Chapter 2 "The Second Chapter"
Section 2.1 The First Section
Definition 2.1.1 – First Definition
Theorem 2.1.2 – The First Theorem
Section 2.2 The Second Section
Chapter 3 "The Third Chapter"
etc…
However, the figures don't seem to follow the counter. The first figure (in section 2.4) is number Figure 2.3 … So I'm trying to get it to fall in line with the rest so that it would look like:
Example 3.2.5 – The Example
Figure 3.2.6 – The Figure for Example 3.2.5
Any suggestions? I put all the code that I think is applicable below. Let me know if you need more/something else…
\documentclass{thesis} %This is my school's self-made document class
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\theoremstyle{definition} %Added by me
\newtheorem{example}[theorem]{Example}
%\makeatletter %Added by me
%\let\c@theorem\c@figure
%\makeatother
\begin{document}
\begin{figure}
\caption{The Figure}
\end{figure}
\end{document}
I've attempted the \let\c@theorem\c@figure
but that doesn't seem to work.
Best Answer
A proposition:
\begin{figure}...\end{figure}
around the graphics and captioncaption
package and\captionof{figure}{foo text}
instead of standard\caption
command\thefigure
to obtain the\thetheorem.\arabic{figure}
output@addtoreset{figure}{theorem}
If this is not wanted, just comment that line