5

I am using the \listtheorems command from ntheorem to generate a list of theorems for a document. However, because I number the theorems inside sections, the theorem number is a bit on the long side, and when typeset the theorem numbers run into the theorem name.

I know that for lists of figures or the TOC I can control this using tocloft and setting numwidth, is there something similar I can do for the theorem lists generated by ntheorem?


MWE:

\documentclass{book}
\usepackage{amsmath}
\usepackage[standard,amsmath]{ntheorem}
\setcounter{chapter}{11}
\setcounter{section}{22}
\setcounter{Theorem}{33}
\numberwithin{Theorem}{section}

\begin{document}
\begin{Theorem}[False Theorem]
This is not a theorem
\end{Theorem}

List of theorems:
\listtheorems{Theorem}
\end{document}

The output looks like:

Colliding text

Here's the tail end of the log from latex building the MWE:

** Generating table of Theorem
(./listthm.thm
Overfull \hbox (12.5556pt too wide) detected at line 1
\OT1/cmr/m/n/10 11.22.34 
 []

)
\tf@thm=\write3
\openout3 = `listthm.thm'.

 [1

] (./listthm.aux) ) 
  • A MWE is needed. – egreg Feb 2 '12 at 11:39
3

Add the following after loading ntheorem:

\makeatletter
\def\thm@@thmline#1#2#3#4{%
  \@dottedtocline{-2}{0em}{5em}{\protect\numberline{#2}#3}{#4}}
\makeatother

The usual definition has 2.3em instead of 5em; adjust until you're satisfied.

  • thanks, but unfortunately I hadn't realised that the fix would also depend on the fact that I am using hyperref. In any case, a suitable modification to the appropriate lines in ntheorem.sty patches the problem. – Willie Wong Feb 2 '12 at 13:11
  • Yes, the macro is slightly more complicated, but it's sufficient to find its definition in ntheorem.sty and change the 2.3em to the desired value. – egreg Feb 2 '12 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.