
以下に示すように、異なるセクションにグループ化された定理のリストを作成したいと考えています。出力には満足していますが、詳しく説明する価値のない他の理由から、内部環境を定義してからラッパー環境を定義しなくても、またはntheorem
コマンドを使用して同じ効果を実現する方法があるかどうかを知りたいです。\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 環境とそれに付随するすべてのものを theoremstyles を再定義して置き換えます。大まかに言うと、定理のタイトル (オプション) パラメーター ##3 を TeX コマンド (\titlethm) で取得するという考え方です。したがって、プリアンブルで 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}{}
オプションの引数がない場合は、目次に何かを書き込む必要があるかどうかわからないため、定義を変更しませんでした。