1

I am a lyx user, and made a document using subsection*(unnumbered subsection). I want to reset equation numbering each subsection and tried several methods, but all of them did not work.

What I tried(I tried adding below in the document-setting-Preamble):

1.

\makeatletter
    \@addtoreset{equation}{subsection}
    \makeatother
 \numberwithin{equation}{subsection}
\usepackage{chngcntr}    
\counterwithin*{equation}{subsection}

How I want to show: without part number, section number, just (number) only. like below. enter image description here

1 Answer 1

2

Usually the equation counter can be reset at each new subsection with \numberwithin, like in your second trial. However, this does not work when the subsection counter is not incremented.

Another simple method is to renew the usual \subsection command to reset the equation counter before calling the old command.

Here's a complete example of this method.

\documentclass{article}
\usepackage{amsmath}
\let\oldsubsection\subsection
\renewcommand{\subsection}{%
    \setcounter{equation}{0}%
    \oldsubsection%
}

\begin{document}

\section{A section}

\subsection*{A first subsection}

\begin{equation}
E = mc^2
\end{equation}

\subsection*{A second subsection}

\begin{equation}
G_{\mu\nu} + \Lambda g_{\mu\nu} = \kappa T_{\mu\nu}
\end{equation}

\end{document}
4
  • I wanna reset the numbering. In your example, I want to put (1), instead of (2), in the second equation. Nov 9, 2020 at 3:06
  • @user14261785 Wow indeed, I'm sorry. I guess I misread my own example! I'll modify my answer in a bit.
    – Vincent
    Nov 9, 2020 at 3:31
  • @user14261785 Done!
    – Vincent
    Nov 9, 2020 at 3:54
  • Thank you, you're so great! Nov 9, 2020 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.