1

I am trying to use the command \listoftheorems from the package thmtools in a document with class amsart. I am compiling through pdflatex. The example

\documentclass{amsart}

\usepackage{thmtools} 
\declaretheorem{theorem}

\begin{document}

    \begin{theorem}[From somewhere]\label{thm1} A theorem.
    \end{theorem}

    \listoftheorems

\end{document}

generates the following error in the log file (I have copy-pasted what I think is the relevant part).

(test2.loe
! Undefined control sequence.
\@dottedtocline ... \hbox {$\m@th \mkern \@dotsep 
                                                  mu\hbox {.}\mkern \@dotsep...
l.1 ...eorem\thmtformatoptarg {From somewhere}}{1}
                                                  %
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing number, treated as zero.
<to be read again> 
                   m
l.1 ...eorem\thmtformatoptarg {From somewhere}}{1}
                                                  %
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Undefined control sequence.
\@dottedtocline ...sep mu\hbox {.}\mkern \@dotsep 
                                                  mu$}\hfill \nobreak \hb@xt...
l.1 ...eorem\thmtformatoptarg {From somewhere}}{1}
                                                  %
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing number, treated as zero.
<to be read again> 
                   m
l.1 ...eorem\thmtformatoptarg {From somewhere}}{1}
                                                  %
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

)
\tf@loe=\write3
\openout3 = `test2.loe'.

It is worth noting two things:

  1. If I compile the MWE above with the command "\listoftheorems" commented out, then there is no error, and if I then uncomment the \listoftheorems back in, then the pdf seems to be correctly output, also with hyperlinks working, but the compiler is still giving me the error message.
  2. If I replace the documentclass back with article, for example, then there is no issue. But I need to get it working with amsart.

Please help!

2
  • 1
    Only the first error is useful here; all the others are a consequence of the first, and essentially meaningless. Essentially, the problem is that the definition of lines for the LOT conflicts with that defined for regular contents lines in amsart. (Contents lines in amsart do not connect text and page number with dots; the lines with thmtools are more like the lines defined for article.) I may or may not be able to define a patch, but the relevant code is in the module thm-listof.sty, in case someone else gets to it first. Apr 19, 2020 at 23:20
  • Thanks a lot for your appraisal! Unfortunately I am not well-versed enough in coding of tex to fix the issue myself at this point...
    – Lentes
    Apr 20, 2020 at 1:38

2 Answers 2

2
+50

The problem here is a style incompatibility between amsart (in fact, all the AMS document classes) and several packages that implement "lists of". The AMS class style for tables of and lists of doesn't use dots between a heading and the associated page number, while the basic LaTeX classes and a number of packages do. (This is also the subject of other questions, such as listings package's \lstlistoflistings command generates an error, but I haven't found an answer to link this to as a duplicate.)

It's quite easy to provide a fix that will get rid of the error, at the cost of having inconsistent style between different lists of. The following example does just that. Making the styles of these lists of parallel is more complicated, and won't be addressed here.

The definition of \@dotsep is copied from article.cls and is defined here with \providecommand so that if another package loaded earlier defines it, it won't be overwritten.

\documentclass{amsart}

\makeatletter
\providecommand\@dotsep{4.5}
\makeatother

\usepackage{thmtools} 
\declaretheorem{theorem}

\begin{document}

    \begin{theorem}[From somewhere]\label{thm1} A theorem.
    \end{theorem}

    \listoftheorems

\end{document}

output of example code

2
  • Thanks a lot for your answer; it is working for me now!
    – Lentes
    Jun 15, 2020 at 20:43
  • Hello barbara, currently thmtools 0.72 uses \ifdefined\@tocline to test whether it is used with an AMS class. Is it safe enough? Aug 1, 2020 at 18:06
1

I've added the required changes to thmtools and released v0.72 2020/08/01. Now \listoftheorems used in AMS classes will have styles similar to list of tables and figures. The related changes can be seen in this commit.

A full example:

\documentclass{amsart}

\usepackage{thmtools} 
\declaretheorem{theorem}
\declaretheorem[numbered=no]{definition}

\begin{document}
\listoffigures
\listoftheorems
\listoftheorems[title={List of Theorems (number swapped)}, swapnumber]

\section{title}
\subsection{title}
\begin{figure}[b]
  content
  \caption{Figure caption}
\end{figure}

\begin{theorem}[Numbered]
  A theorem.
\end{theorem}

\begin{definition}[Unnumbered]
  A definition.
\end{definition}

\end{document}

enter image description here

You must log in to answer this question.

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