5

Does anyone of you know how to format a ToC created with the minitoc package in LaTeX? My problem is that I always get the following warning:

./hauptdokument.mtc.1:21:Overfull \hbox (2.83262 pt too wide) detected

This happens if the page number is greater than 10 e. g. 1-10 or 1-12. I've read the minitoc documentation but I didn't find a solution to widen the box around the page numbers so I appreciate any help you could give.

I use the following commands to format my minitoc:

\mtcselectlanguage{german}

\renewcommand{\mtcSfont}{\small\rm}

\dominitoc
0

1 Answer 1

8

The warning is not specific to minitoc. The standard classes typeset ToC page numbers in a box of width \@pnumwidth (note: this is a command, not a length), and minitoc adopts the setting of \@pnumwidth. The command's default value is 1.55em, which is sufficient for three-digit numbers. In your case, the warning disappears by setting \@pnumwidth to 2.5em.

\documentclass{book}

\usepackage{minitoc}

\makeatletter
\renewcommand{\@pnumwidth}{2.5em}% default is 1.55em
\makeatother

\renewcommand{\thepage}{XY-\arabic{page}}

\begin{document}

\dominitoc% Initialization
\faketableofcontents

\chapter{bla}
\minitoc% Creating an actual minitoc

\section{blubb}

\section{foo}

\end{document}
3
  • Die lockstep! Thank you for your very useful answer. I knew about @pnumwidth but it has never worked for me because I've allways used it between the \begin{document}..\end{document} tags. From your post I've learned to use the before opening the document. Many thanks and best regards. Florian
    – user865294
    Mar 30, 2012 at 6:54
  • 1
    Small addition to lockstep answer, make sure that \@tocrmarg (default 2.55em) is greater than \@pnumwidth.
    – mythealias
    Mar 30, 2012 at 7:26
  • @user865294 a) I hope you don't want me to die b) You may thank me by upvoting my answer (with the upward pointing arrow to the left of it; you need 15 reputation points before you can upvote) and possibly accepting it (by clicking on the checkmark).
    – lockstep
    Mar 30, 2012 at 15:26

You must log in to answer this question.

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