How to define equation counters and subsections counters in LaTeX?

Here I asked how to identify the subnet and theorem counters in LaTeX. It turns out that I should also identify the counters of equations and subsections for my purposes. The methods proposed as answers to this question will not work. Please help me if you can. Thank you very much.

+3
source share
1 answer

Not sure if this is exactly what you are looking for, but here is an example showing one way to add numbering to your previous solution. This involves using the user environment "myequation" instead of the environment "equation":

\documentclass{article}

\newtheorem{theorem}[subsection]{Theorem}

\newenvironment{myequation}
{\setcounter{equation}{\value{subsection}}\begin{equation}}
{\stepcounter{subsection}\end{equation}}
\renewcommand{\theequation}{\mbox{\arabic{section}.\arabic{equation}}}

\begin{document}
\section{My Section}
\subsection{A subsection}

\begin{theorem}adfadfadf
\end{theorem}
\begin{myequation}abcdefg
\end{myequation}
\begin{myequation}abcdefg
\end{myequation}
\subsection{A subsection}

\begin{theorem}adfadfadf
\end{theorem}
\begin{theorem}adfadfadf
\end{theorem}
\begin{myequation}abcdefg
\end{myequation}


\end{document}
+2
source

Source: https://habr.com/ru/post/1753806/


All Articles