[Tex/LaTex] minitoc package: overfull \hbox

minitoctable of contentswarnings

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

Best Answer

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}
Related Question