1

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}
\def\numequation{\addtocounter{subsubsection}{1}\begin{equation}}
\renewcommand{\theequation}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}

\begin{document}

We have
\begin{equation} \label{one} 1+1 \ge 2 \end{equation}
and also
\numequation \label{two} 1+1 \le 2 \end{equation}
similar to Equation~(\ref{one}). 
We wish to have:
\begin{equation} \label{three} 1+1 \ge 2 \end{equation}
\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 \begin{equation} 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{\begin{equation}}
\renewcommand{\theequation}{\addtocounter{subsubsection}{1}\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}

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.

7
  • 2
    Welcome to TeX.SE!
    – Mensch
    Feb 5, 2023 at 18:13
  • 1
    Try replacing \renewcommand{\theequation}{\arabic{section}.\arabic{subsection}.\arabic{subsection}} with \counterwithin{equation}{subsubsection}. And, please replace \addtocounter{subsubsection}{1} with \refstepcounter{subsubsection}.
    – Mico
    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).
    – Confused
    Feb 5, 2023 at 18:58
  • 1
    Ah but maybe \newtheorem{theorem}[equation]{Theorem} then works...
    – Confused
    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. Feb 5, 2023 at 19:32

1 Answer 1

2

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
\begin{equation} \label{one} 1+1 \ge 2 \end{equation}
and also
\begin{equation} \label{two} 1+1 \le 2 \end{equation}
similar to Equation~(\ref{one}). 
We wish to have:
\begin{equation} \label{three} 1+1 \ge 2 \end{equation}
\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}{\begin{equation}}

so that it does not influence the counters.

2
  • As smooth as butter, thanks.
    – Confused
    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
    Feb 5, 2023 at 22:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .