分為幾個部分的定理列表

分為幾個部分的定理列表

我想建立一個定理列表,分成不同的部分,如下所示。我對輸出感到滿意,但由於其他不值得深入的原因,我想知道是否有一種方法可以使用ntheorems\theoremprework\theorempostwork命令來達到相同的效果,而無需定義內部環境,然後包裝環境。

\documentclass{article}
    \usepackage{ntheorem}

    \newtheorem{theoreminner}{}
    \newenvironment{theorem}[1][]
    {
        \begin{theoreminner}[#1]
        \addcontentsline{toc}{subsection}{\protect\numberline{\thetheoreminner}#1}
    }
    {
        \end{theoreminner}
    }

\begin{document}

\tableofcontents

\section{title of section 1}

\begin{theorem}[title of theorem 1.1]
text of theorem 1.1
\end{theorem}

\begin{theorem}[title of theorem 1.2]
text of theorem 1.2
\end{theorem}

\section{title of section 2}

\begin{theorem}[title of theorem 2.1]
text of theorem 2.1
\end{theorem}

\begin{theorem}[title of theorem 2.2]
text of theorem 2.2
\end{theorem}

\end{document}

答案1

你可以,但我的解決方案透過重新定義定理樣式來取代 theoreminner 環境以及與之相關的所有內容。粗略地說,這個想法是在 TeX 命令 (\titlethm) 中捕獲定理(可選)參數 ##3 的標題。因此,用以下程式碼取代序言中 theorem 和 theoreminner 的定義(假設您使用的是普通樣式):

\makeatletter
\renewtheoremstyle{plain}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ (##3)\theorem@separator]\def\titlethm{##3}}%
 \makeatother

\theorempostwork{ \addcontentsline{toc}{subsection}{\protect\numberline {\thetheorem}\titlethm}}%
\theoremstyle{plain}
\newtheorem{theorem}{}

如果沒有可選參數,我沒有修改定義,因為我不知道您是否願意在目錄中寫入某些內容。

相關內容