校样中的零件编号

校样中的零件编号

我正在使用proof环境 fromamsthm来键入证明。有些证明很长,因此最好将它们分成编号的部分。proofpart为此,我定义了新的定理环境 called。

问题是proofpart计数器不会在新的证明中重置,而是继续增长。所以我想知道在这种情况下如何重置计数器。

示例文件:

\documentclass{article}
\usepackage{amsthm}


\theoremstyle{definition}
\newtheorem{proofpart}{Part}
\newtheorem{theorem}{Theorem}

\begin{document}
  \begin{theorem}
    Some theorem
  \end{theorem}

  \begin{proof}
    Proof of some theorem
    \begin{proofpart} % 1
      First part 
    \end{proofpart}
    \begin{proofpart} % 2
      Second part
    \end{proofpart}
  \end{proof}


  \begin{theorem}
    Another theorem
  \end{theorem}

  \begin{proof}
    Proof of another theorem
    \begin{proofpart} % 3, but should be 1
      First part
    \end{proofpart}
    \begin{proofpart} % 4, but should be 2
      Second part
    \end{proofpart}
  \end{proof}

\end{document}

答案1

一种选择是使用\@addtoreset

\documentclass{article}
\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{proofpart}{Part}
\newtheorem{theorem}{Theorem}
\makeatletter
\@addtoreset{proofpart}{theorem}
\makeatother

\begin{document}
  \begin{theorem}
    Some theorem
  \end{theorem}

  \begin{proof}
    Proof of some theorem
    \begin{proofpart} % 1
      First part 
    \end{proofpart}
    \begin{proofpart} % 2
      Second part\qedhere
    \end{proofpart}
  \end{proof}


  \begin{theorem}
    Another theorem
  \end{theorem}

  \begin{proof}
    Proof of another theorem
    \begin{proofpart} % it is 1
      First part
    \end{proofpart}
    \begin{proofpart} % it is 2
      Second part\qedhere
    \end{proofpart}
  \end{proof}

\end{document}

在此处输入图片描述

摘自以下简短描述source2e

\@addtoreset{foo}{bar} : Adds counterfoo to the list of counters \cl@bar to be reset when counterbar` 是阶梯式的。

另一种选择(由沃纳\newtheorem)将在定义中使用第二个可选参数proofpart(这需要定义此结构环境theorem)以及对相关计数器表示的重新定义:

\documentclass{article}
\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{theorem}{Theorem}
\newtheorem{proofpart}{Part}[theorem]
\renewcommand\theproofpart{\arabic{proofpart}}

\begin{document}
  \begin{theorem}
    Some theorem
  \end{theorem}

  \begin{proof}
    Proof of some theorem
    \begin{proofpart} % 1
      First part 
    \end{proofpart}
    \begin{proofpart} % 2
      Second part\qedhere
    \end{proofpart}
  \end{proof}


  \begin{theorem}
    Another theorem
  \end{theorem}

  \begin{proof}
    Proof of another theorem
    \begin{proofpart} % it is 1
      First part
    \end{proofpart}
    \begin{proofpart} % it is 2
      Second part\qedhere
    \end{proofpart}
  \end{proof}

\end{document}

\newtheorem{env-name}{doc-name}[counter],其中counter是现有的或先前定义的计数器,env-name每当父计数器counter增加时,都会重置计数器;但是,标签将在 counter前面添加数字,因此需要重新定义表示以抑制前面添加的字符串。

我也曾经\qedhere校正过结束标记的位置。

相关内容