# How to make specific equations follow theorem counter

I don't want equations to be numbered in general, but I want to be able to reference specific equations and have them follow the theorem counter. For instance, in my example there are two equations within theorem 1.1, and I want the first one to be labeled 1.2 so I can reference it in the proof.

\documentclass{article}

\usepackage{amsmath}
\usepackage{amsthm}

\newtheorem{theorem}{Theorem}[section]

\begin{document}
\section{Section}
\begin{theorem}
We have some equations
\begin{align*}
\label{first}
1 + 1 = 2,
\end{align*}
and
\begin{align*}
2 + 2 = 4.
\end{align*}
\end{theorem}
\begin{proof}
See \ref{first}.
\end{proof}
\begin{theorem}
I want this counter to be 1.3
\end{theorem}
\end{document}

• You could use the aliascnt package. – user31729 Jan 18 '18 at 19:42
• since you're using amsthm you can set the theorem counter to use the equation counter: \newtheorem{theorem}{Theorem}[equation]. this is documented in the amsthm users guide (texdoc amsthm) with an explanation of how theorem numbering works. since you also want the theorems numbered by section, the obvious approach is then to number the equations by section: \numberwithin{equation}{section}. – barbara beeton Jan 18 '18 at 20:01
• You're interested in this: Slave duplicate counter (possible duplicate) – Werner Jan 18 '18 at 20:03
• @Werner No, it's a different problem – egreg Jan 18 '18 at 22:55

since you're using amsthm you can set the theorem counter to use the equation counter:

\newtheorem{theorem}[equation]{Theorem}


this is documented in the amsthm users guide (texdoc amsthm) with an explanation of how theorem numbering works.

you have edited the question so that theorems are numbered by section. this should produce the result you say you want. since equations (all displays, actually) have the primary counter, there shouldn't be any confusion if you have numbered displays that are not within theorems.

a full example follows.

\documentclass{article}

\usepackage{amsmath}
\usepackage{amsthm}
%\usepackage{cleveref}

\numberwithin{equation}{section}
\newtheorem{theorem}[equation]{Theorem}

\begin{document}

\section{Section}

\begin{theorem}\label{firsttheorem}
We have some equations
$$\label{equation} 1 + 1 = 2,$$
and
\begin{equation*}
2 + 2 = 4.
\end{equation*}
\end{theorem}
\begin{proof}
See \ref{equation}.
\end{proof}

\begin{theorem}\label{secondtheorem}
I want this counter to be 1.3
\end{theorem}

%References: \Cref{firsttheorem}, \Cref{secondtheorem}
%and \Cref{equation}.

\end{document}


if the commented lines about cleveref are uncommented, the output will be as follows.