I am using the thmtools
package to produce a list of theorems at the end of my document. I am also using several different theorem headings (proposition, lemma, definition, etc...), which are not numbered independently. The numbering is done according to section.
Before implementing the thmtools package I could get the section numbering to work for all theorem styles by just including
\setcounter{theorem}{0}
\numberwithin{theorem}{section}
after the first section title.
After implementing the thmtools package, this does not seem to work, and only numbers the theorems correctly. I now have to add a separate line
\numberwithin{foo}{section}
for each foo
in definition
, lemma
, fact
, exercise
, etc...
Is there a way to not have to add a separate line for each theorem style, and instead have one line that will cover all styles at once (even if I add some new ones later)?
Edit: Here is an example of what I mean.
My original code (before needing a list of theorems)
\documentclass{article}
\usepackage{amsmath, amssymb}
\usepackage[mathscr]{eucal}
\usepackage{amsthm}
\usepackage{amscd}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\begin{document}
\section{Some Results}
\setcounter{theorem}{0}
\numberwithin{theorem}{section}
\begin{lemma}
Here is a lemma.
\end{lemma}
\begin{definition}
Here is a definition.
\end{definition}
\begin{theorem}
Here is a theorem.
\end{theorem}
\begin{theorem}
Here is another theorem.
\end{theorem}
\begin{corollary}
Here is a corollary.
\end{corollary}
\end{document}
If you compile this, you'll see that the results are listed as Lemma 1.1, Definition 1.2, Theorem 1.3, Theorem 1.4, Corollary 1.5. This is what I want.
Then, I decide I need a list of theorems. So I add the \usepackage{thmtools}
and the \listoftheorems
command (at the end of the body).
So now I get the list of theorems, but the numbering is wrong. In particular, the results are numbered Lemma 1, Definition 2, Theorem 1.3, Theorem 1.4, Corollary 5. So only the theorems are inheriting the section numbering. The only way I know to fix it is to add
\numberwithin{lemma}{section}
\numberwithin{corollary}{section}
\numberwithin{definition}{section}
below the \numberwithin{theorem}{section}
line. It would be nice to not have to do this. Especially when I inevitably decide to add facts, examples, propositions, exercises, etc...
amsthm
but you don't mention that package in the question. do you, or do you not,\usepackage{amsthm}
? (a compilable example would really help us to help you.)amsthm
package is tagged because there seems to be something aboutthmtools
that is interfering with how the numbering works when just usingamsthm
.