
ドキュメント内のすべての方程式のリストを生成しようとしています。検索したところ、 を使用するとthmtools
、すべての定理のリストを生成できる (正しければ) のが良い解決策のようです。探しているのは (次の例の CheatSheet の章で) すべての等式定理の内容を含むリストです (LaTeX フォーマットを使用)。
$Some_{Lowtext}$ (1)
$Some^{Hightext}$ (2)
最小限の(非)動作例:
\documentclass[a4paper,12pt]{report}
\usepackage{theorem}
\newtheorem{equate}{}
\usepackage{thmtools}
\renewcommand{\listtheoremname}{List of Equations}
\begin{document}
\tableofcontents
\newpage
\chapter{Name of Chapter}
\section{Name of Section}
\subsection{Name of SubSection}
sometext
\begin{equate}
$Some_{Lowtext}$
\end{equate}
Some other Text
\begin{equate}
$Some^{Hightext}$
\end{equate}
And some more
\chapter{CheatSheet}
\listoftheorems
\end{document}
これにより、次のエラーが発生します (24 行目は の後の行です\listoftheorems
)。
test.tex:24: Missing \endcsname inserted. []
test.tex:24: Too many }'s. []
これがそのようなリストを作成する方法であるかどうか、また、どうすればエラーを解決できるのか疑問に思っています。
答え1
declaretheorem
代わりに使用する\newtheorem
およびtheorem
パッケージthmtools
は、定理環境を定義するために異なるメカニズムを使用します。Frank Mittelbach のtheorem
パッケージは LaTeX カーネル\newtheorem
マクロを使用しますが、Ulrich Schwarz のthmtools
パッケージは\declaretheorem
マクロを提供します。
パッケージにはマクロthmtools
も用意されている\listoftheorems
が、後者は で宣言された定理環境のみをリストする\declaretheorem
。ないこれらは単に で宣言されます\newtheorem
。したがって、 を利用したい場合は\listoftheorems
、すべての定理を で宣言しthmtools
、を明示的に\declaretheorem
使用しないでください\newtheorem
。
\documentclass[a4paper,12pt]{report}
\usepackage{thmtools}
\declaretheorem{equate}
\renewcommand{\listtheoremname}{List of Equations}
\begin{document}
\begin{equate}[Low text]
$Some_{Lowtext}$
\end{equate}
Some other Text
\begin{equate}[High text]
$Some^{Hightext}$
\end{equate}
\listoftheorems
\end{document}
報告したエラーの詳細
\declaretheorem
入力ファイルで が少なくとも 1 回使用されていない場合は、\listoftheorems
報告した 2 つのエラーが生成されます。問題を再現する最小限のコードは次のとおりです。
\documentclass{report}
\usepackage{thmtools}
%\declaretheorem{foo}
\begin{document}
\listoftheorems
\end{document}
上記のコードの 3 行目のコメントが解除されている場合、エラーは生成されません。私の意見では、この動作は意図したものではなく、バグに該当するため、作成者に通知する必要があるでしょう。