定理的编号

定理的编号

我正在根据当天的情况在一个 tex 文件中输入讲座笔记。

第一天讲座中的定理编号如下:

\newtheorem{theorem}{Theorem}

\begin{theorem}

This is Theorem number 1.

\end{theorem}

....

\begin{theorem}

This is Theorem number 20.

\end{theorem}

然后我继续用同一个文件输入第二天的讲义。但在那里,我想再次将定理编号为 1、2……而不是 21、22……

这个怎么做?

答案1

每当新的“一天”(实际上是部分)开始时,这将重置定理编号。

\documentclass{article}

\usepackage{amsmath}
\usepackage{chngcntr}

\newtheorem{theorem}{Theorem}
\counterwithin*{theorem}{section}  % Remove the day number in front of the theorem number.





\begin{document}

\section{First Day}

    \begin{theorem}

    This is Theorem number 1.

    \end{theorem}

    ....

    \begin{theorem}

    This is Theorem number 20.

    \end{theorem}

\section{Another Day}

    \begin{theorem}

    This is Theorem number 1.

    \end{theorem}

    ....

    \begin{theorem}

    This is Theorem number 20.

    \end{theorem}
\end{document}

相关内容