6

I am trying to generate a list of all equations in a document. I have searched and it seemed a good solution would be to use the thmtools, which can generate a list of all theorems(if im correct). What I am looking for is (in the following example, at the chapter CheatSheet) a list with the contents of all equate-theorems, as such (with LaTeX formatting):

$Some_{Lowtext}$                                   (1)
$Some^{Hightext}$                                  (2)

Minimal (not) Working Example:

\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}

This gives me the following errors (line 24 is the line after \listoftheorems):

test.tex:24: Missing \endcsname inserted. []
test.tex:24: Too many }'s. []

I am wondering if this is the way to produce such a list and how I can solve my error.

4
  • 1
    At first sight, using both the theorem and thmtools packages seems to be a bad idea, as they are likely incompatible. Those two packages use different macros to define theorems: theorem uses \newtheorem whereas thmtools provides \declaretheorem. If you only load thmtools (not theorem) and use \declaretheorem to define your theorems, \listoftheorems won't generate any error.
    – jub0bs
    Commented Dec 31, 2013 at 15:02
  • 1
    You're right about the theorem and thmtools. \listoftheorems does however not output the expected output, but only acts as a table of contents for equations. It seems I cannot use thmtools for that, am I right?
    – Snicksie
    Commented Dec 31, 2013 at 17:43
  • You can look at this question: tex.stackexchange.com/questions/14317/…
    – Bernard
    Commented Jan 1, 2014 at 14:48
  • @Jubobs : your comment solves the error, if you post this as an answer I'll accept it
    – Snicksie
    Commented Jan 2, 2014 at 12:03

1 Answer 1

3

Use declaretheorem instead of \newtheorem

The theorem and thmtools packages use different mechanisms for defining theorem environments: Frank Mittelbach's theorem package uses the LaTeX-kernel \newtheorem macro, whereas Ulrich Schwarz's thmtools package provides a \declaretheorem macro.

The thmtools package also provides a \listoftheorems macro, but the latter only lists the theorem environments declared with \declaretheorem, not those simply declared with \newtheorem. Therefore, if you want to take advantage of \listoftheorems, you should declare all your theorems with thmtools's \declaretheorem and not use \newtheorem explicitly.

\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}

enter image description here

More details on the errors you report

If \declaretheorem is not used at least once in the input file, \listoftheorems generates the two errors you report. Here is some minimum code that reproduces the issue:

\documentclass{report}
\usepackage{thmtools}
%\declaretheorem{foo}
\begin{document}
\listoftheorems
\end{document}

No errors are generated if the third line of the code above is uncommented. In my opinion, that behaviour is unintended and qualifies as a bug; the author should probably be notified about it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .