Document Classesamsbook and listoftheorems (thmtools)

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
tsx
Posts: 1
Joined: Thu Nov 11, 2010 2:33 pm

amsbook and listoftheorems (thmtools)

Post by tsx »

Hello,

I'm having difficulties creating a list of theorems via thmtools when using amsbook as documentclass. The code looks as follows:

Code: Select all

\documentclass{amsbook}

\usepackage{amsthm}
\usepackage{thmtools}

\declaretheorem{theorem}

\begin{document}
\begin{theorem}[Theorem A]This is a theorem.\end{theorem}

\listoftheorems
\end{document}
Running the code results in the following error message:

Code: Select all

! Undefined control sequence.
\@dottedtocline ... \hbox {$\m@th \mkern \@dotsep 
                                                  mu\hbox {.}\mkern \@dotsep...
l.2 ... {t}heorem\thmtformatoptarg {Theorem A}}{1}
It seems to be related to the integration of amsthm into amsbook. If I remove amsthm from the list of packages, the same error message occurs (obviously). Yet, by changing the documentclass to any other (e.g. scrreprt) and using the amsthm package, the list of theorems works perfectly. How can I use amsbook in combination with thmtools?

Thanks in advance for any help given

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
natema
Posts: 1
Joined: Fri Sep 16, 2016 11:56 am

amsbook and listoftheorems (thmtools)

Post by natema »

I had the same issue and posted a question here:
https://tex.stackexchange.com/questions ... ools-issue.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

amsbook and listoftheorems (thmtools)

Post by Stefan Kottwitz »

Hi natema,

welcome to the forum!
That question here was posted before TeX StackExchange was opened. :-) Our forum has a long history, back to 2007.

So, a good occasion to answer it! I would do it differently to the suggestions at StackExchange.
  • defining the undefined \@dotsep would remove the error, yes, but the lists would be inconsistent: the list of theorems would have dots, list of tables and figures would not have dots.
  • copying and editing the corresponding internal macros takes time and space (53 lines there), and can lead to an error if thmstools would be changed.
So, instead of patching, we could (re)define \@dottedtocline to behave like ams book's \@tocline, that is, to call that one. We won't have dotted toc lines anyway.

Simple solution, 1 line plus the usual \makeatletter/other:

Code: Select all

\makeatletter
\def\@dottedtocline#1#2#3#4#5{\@tocline{#1}{0pt}{#2}{#3}{}{#4}{#5}}
\makeatother
Complete code:

Code: Select all

\documentclass{amsbook}
\usepackage[english]{babel}
\usepackage{thmtools}
\declaretheorem{theorem}
\makeatletter
\def\@dottedtocline#1#2#3#4#5{% redefined for consistency
  \@tocline{#1}{0pt}{#2}{#3}{}{#4}{#5}}
\makeatother
\begin{document}
\listoftables
\listoftheorems
\begin{theorem}
    This is my favorite theorem.
\end{theorem}
\begin{table}
    \caption{This is my favorite table}
\end{table}
\end{document}
Stefan
LaTeX.org admin
Post Reply