To customize the appearance of our Table of contents we use the tocloft package. One point we would like to implement is to underline the chapter entries in the ToC.
However, if we use the \cftchapaftersnum
command to specify a horizontal line we always get a weird overfull hbox warning. (Weird, because if I shorten the line, the overfull hbox is shown in the middle of the page.
Small example compiled with MikTeX and pdfLaTeX:
\documentclass[draft]{book} % use draft to show overfull hboxes
\usepackage{tocloft}
% underline chapter entries:
\renewcommand{\cftchapaftersnum}{\hspace{4mm}\rule[-0.5mm]{0.5\textwidth}{.4pt}}
\begin{document}
\tableofcontents
\chapter{Antelope}
Antelope is a term referring to many even-toed ungulate
species found all over the world.
\rule[-0.5mm]{0.5\textwidth}{.4pt}
This \verb|\rule| does not generate a warning!
\section{Impala}
An impala is a medium-sized African antelope.
\emph{fin \dots}
\end{document}
Note that I've placed 0.5\textwidth
as ruler width in the example above. This way, my draft PDF shows the black rectangle for the overfull box in the middle of the page (just at the end of the \rule
)
What's going on here?