# Number equations like subsections

I would like for equations to share the same counter as subsections. For example if my document is:

\documentclass{article}
\begin{document}
\section{A}
$$1+1=2$$
\subsection{X}
$$1+1=2$$
$$1+1=2$$
\subsection{Y}
$$1+1=2$$
\end{document}


I would like this output (produced here through a sneaky use of \tag):

Something similar to how theorems of amsthm can be "siblings" with another counter. I am aware of the \numberwithin command of amsmath, but this is not what I want. I am also aware of the aliascnt package, but since "equation" is an existing counter, it doesn't work.

I hope, this is what you want:

\documentclass{article}
\pagestyle{empty}% for cropping
\makeatletter
\let\c@equation=\c@subsection
\let\theequation=\thesubsection
\makeatother
\begin{document}
\section{A}
$$1+1=2$$
\subsection{X}
$$1+1=2$$
$$1+1=2$$
\subsection{Y}
$$1+1=2$$
\end{document}


• No, this is not what I want, sorry. I'm going to include a picture of the output I'd like in my question. – Najib Idrissi Mar 6 '14 at 16:05
• @nik See my updated answer. – Henri Menke Mar 6 '14 at 16:18
• That's perfect, thank you. (Do you have a reference on how this works? I guess \stepcounter and the like work internally on \c@counter?) – Najib Idrissi Mar 6 '14 at 16:20
• @nik Your explanation is already pretty accurate. \c@counter is the TeX count register the value of the counter is stored in, \thecounter just outputs the value of that count register. – Henri Menke Mar 6 '14 at 16:23