# Fixing an equation numbering issue

I'm writing a paper with multiple authors and I'm having trouble fixing an equation numbering issue.

The desire was for equations to be numbered within subsections. At the same time, the goal was for all numberings to be unique, and so Lemma 2.2.3 would be followed by equation 2.2.4 and subsection 2.2.5. Whatever the motivations, the result is the following:

\documentclass[12pt]{amsart}

\newtheorem{theorem}[subsubsection]{Theorem}
\renewcommand{\theequation}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}

\begin{document}

We have
\label{one} 1+1 \ge 2
and also
\numequation \label{two} 1+1 \le 2
similar to Equation~(\ref{one}).
We wish to have:
$$\label{three} 1+1 \ge 2$$
\begin{theorem} $1+1=2$.
\end{theorem}
Proof: Equations~(\ref{one}) and~(\ref{two}) imply equation~(\ref{three}).

\end{document}


This compiles with no errors, but the equations are numbered (0.0.0), (0.0.1), and then equation (0.0.1), whereas the last equation should be numbered (0.0.2), and then the Theorem should be (0.0.3). (I guess (0.0.1)-(0.0.4) would be better.)

This paper is several hundred pages with multiple uses of and \numequation. Moreover the paper is in the proof stage, so I would really desire a solution which can be done with as few changes as possible.

Question: Is there a simple fix to the preamble which will correct the numbering issue? Note that we are using a custom style file for the relevant journal.

I had hoped that changing the preamble to

\def\numequation{}


would fix things, but now the equations are labelled (0.0.1), (0.0.2), and (0.0.4) --- somehow the reference is adding one to the numbering.

• Welcome to TeX.SE! Commented Feb 5, 2023 at 18:13
• Try replacing \renewcommand{\theequation}{\arabic{section}.\arabic{subsection}.\arabic{subsection}} with \counterwithin{equation}{subsubsection}. And, please replace \addtocounter{subsubsection}{1} with \refstepcounter{subsubsection}.
– Mico
Commented Feb 5, 2023 at 18:29
• @Mico This fixes some issues but is no longer compatible with Theorem numbering: equations (0.0.1)-(0.0.3) are now followed by Theorem (0.0.2) not Theorem (0.0.4). Commented Feb 5, 2023 at 18:58
• Ah but maybe \newtheorem{theorem}[equation]{Theorem} then works... Commented Feb 5, 2023 at 18:59
• Since you are using amsart, the facilities of amsthm apply. Sharing theorem and equation numbers is mentioned in the amsthm user guide through a pointer to this FAQ entry: ams.org/faq?faq_id=289 which does identify using [equation] as the shared numbering for theorems. Commented Feb 5, 2023 at 19:32

I guess that with what you already have, the easiest thing to do is just to make the equation environment step the subsubsection counter.

\documentclass[12pt]{amsart}

\newtheorem{theorem}[subsubsection]{Theorem}
\renewcommand{\theequation}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}
\AtBeginEnvironment{equation}{\stepcounter{subsubsection}}

\begin{document}

We have
$$\label{one} 1+1 \ge 2$$
and also
$$\label{two} 1+1 \le 2$$
similar to Equation~(\ref{one}).
We wish to have:
$$\label{three} 1+1 \ge 2$$
\begin{theorem} $1+1=2$.
\end{theorem}
Proof: Equations~(\ref{one}) and~(\ref{two}) imply equation~(\ref{three}).

\end{document}


In the above I removed the \numequation command since it was not really needed, but if you want to keep it because of the code you already have, you could just use

\newcommand*{\numequation}{}


so that it does not influence the counters.

• As smooth as butter, thanks. Commented Feb 5, 2023 at 19:27
• +1. You could further simplify the code by replacing \renewcommand{\theequation}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}} with \renewcommand{\theequation}{\thesubsubsection}.
– Mico
Commented Feb 5, 2023 at 22:00