[Tex/LaTex] Numbering theorems as subsubsections

numberingsectioningtheorems

I am working on a large, multi-chapter document using the memoir class. I have sections, subsections, and subsubsections within each chapter, and within the subsubsections are theorems, lemmas, propositions, etc.

I have all of the theorems, propositions, etc sharing a single counter, which is subordinate to the subsection. So currently things look like this:

Chapter 1

Section 1.1

Subsection 1.1.1

Subsubsection 1.1.1.1

Theorem 1.1.1.1

Subsubsection 1.1.1.2

Definition 1.1.1.2

Remark 1.1.1.3

Subsubsection 1.1.1.3

I want the numbering of theorems, propositions, etc to use the same counter as the subsubsections, so that things would look like this instead:

Chapter 1

Section 1.1

Subsection 1.1.1

Subsubsection 1.1.1.1

Theorem 1.1.1.2

Subsubsection 1.1.1.3

Definition 1.1.1.4

Remark 1.1.1.5

Subsubsection 1.1.1.6

I would prefer to use amsthm, but I'm open to using other packages if necessary.

Bonus points: how to get the equation numbering to use the same counter?

Best Answer

Use the first optional argument for \newtheorem:

\documentclass{book}
\usepackage{amsthm}

\newtheorem{theo}[subsubsection]{Theorem}
\newtheorem{defi}[subsubsection]{Definition}
\setcounter{secnumdepth}{3}

\begin{document}

\chapter{Test Chapter}
\section{Test Section}
\subsection{Test Subsection}
\subsubsection{Test Subsubsection}
\begin{theo}
test.
\end{theo}
\subsubsection{Test Subsubsection}
\begin{theo}
test.
\end{theo}
\begin{defi}
test.
\end{defi}
\subsubsection{Test Subsubsection}

\end{document}

enter image description here

I think this numbering schema can result hard to follow for readers (among other things, what if, for example, there's a theorem or a definition before a subsubsection is created?).

For the bonus point (and to make things even harder for the reader):

\documentclass{book}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{etoolbox}
\numberwithin{equation}{subsection}

\newtheorem{theo}[subsubsection]{Theorem}
\newtheorem{defi}[subsubsection]{Definition}
\setcounter{secnumdepth}{3}

\AtBeginEnvironment{equation}{\setcounter{equation}{\value{subsubsection}}}{}{}{}
\AtEndEnvironment{equation}{\stepcounter{subsubsection}}{}{}{}

\begin{document}

\chapter{Test Chapter}
\section{Test Section}
\subsection{Test Subsection}
\subsubsection{Test Subsubsection}
\begin{theo}
test.
\end{theo}
\subsubsection{Test Subsubsection}
\begin{theo}
test.
\end{theo}
\begin{defi}
test.
\end{defi}
\begin{equation}
a=b.
\end{equation}
\subsubsection{Test Subsubsection}
\begin{equation}
c=d.
\end{equation}

\end{document}

enter image description here

I would rather use a simpler numbering schema:

\documentclass{book}
\usepackage{amsthm}
\usepackage{amsmath}

\newtheorem{theo}{Theorem}[chapter]
\newtheorem{defi}[theo]{Definition}
\newtheorem{prop}[theo]{Proposition}
\setcounter{secnumdepth}{3}

\begin{document}
...
\end{document}