定理的子編號,但子定理作為單獨的區塊

定理的子編號,但子定理作為單獨的區塊

我想要字母作為子編號一些定理,類似這個問題,但我希望「分開」這兩個子定理,以便能夠包含它們之間的任何內容。

我找到了一種方法newcounter作為一個稍微不同的問題的答案,並嘗試修改它以執行我想要的操作,但我無法讓它工作。這是我嘗試過的:

\documentclass{article}

\usepackage{amsthm}

\newtheorem{theorem}{Theorem}
\newtheorem{theorem2}{Theorem}

\newcounter{pretheorem}
\counterwithin{theorem2}{pretheorem}
\renewcommand\thetheorem{\arabic{pretheorem}\alph{theorem2}}
\newcommand{\theoremgroup}{\refstepcounter{pretheorem}}

\begin{document}

\begin{theorem}
This should be Theorem 1.
\end{theorem}

\theoremgroup
\begin{theorem2}
This should be Theorem 2a.
\end{theorem2}

\begin{theorem2}
This should be Theorem 2b.
\end{theorem2}

\begin{theorem}
This should be Theorem 3.
\end{theorem}

\end{document}

答案1

經過反覆試驗,我找到了一個方法。事實證明,在這種情況下,Latex 不喜歡定理名稱以數字結尾。

\newtheorem{theorem}{Theorem}
\newtheorem{theoremgrp}{Theorem}

\newcounter{subtheorem}
\counterwithin{theoremgrp}{subtheorem}
\renewcommand\thetheoremgrp{\arabic{theorem}\alph{theoremgrp}}
\newcommand{\theoremgroup}{\refstepcounter{subtheorem}\refstepcounter{theorem}}

用法是

\begin{theorem}
Lorem ipsum
\end{theorem}

對於具有單一數字的正規定理,以及

\theoremgroup
\begin{theoremgrp}
Lorem ipsum
\end{theoremgrp}

\begin{theoremgrp}
Lorem ipsum
\end{theoremgrp}

...

對於多部分定理。編號很常見,例如 1、2a、2b、2c、3...

我還是不知道為什麼這有效,所以歡迎任何解釋!

相關內容