I'm trying to troubleshoot an overfull hbox warning that arises with some long chapter titles in memoir
. I've narrowed it down to the following minimal example. The problem arises with mathptmx
but not with CM. Also, the overfull box is not really real, since there is nothing overlapping the actual margin, but I would like to know how to remove the warning nonetheless, since this code is actually part of a custom document class.
\documentclass[draft,12pt]{memoir}
\usepackage{mathptmx} % comment out to remove the overfull box
\settypeblocksize{9in}{6.5in}{*}
\setlrmargins{1in}{*}{*}
\setulmargins{1in}{*}{*}
\setheadfoot{\baselineskip}{.5in}
\checkandfixthelayout
\makeatletter
\renewcommand*{\l@chapter}[2]{%
\l@chapapp{\MakeUppercase{#1}}{#2}{\cftchaptername}}
\makeatother
\renewcommand*{\cftchaptername}{Chapter\space}
\setlength{\cftchapternumwidth}{3em}
\setrmarg{3.5em} % better wrapping of long titles
\makeatother
\begin{document}
\frontmatter
\tableofcontents*
\mainmatter
\chapter{A chapter with a really long title to see whether the chapter titles wrap correctly}
\end{document}
mathptmx
change the font ;-) YOu can see the wrong hyphen by:\chapter[A chapter with a really long title to see whet\-her the chapter titles wrap correctly] {A chapter with a really long title to see whether the chapter titles wrap correctly}
-- This is one solution. The other one:\begingroup \sloppy \tableofcontents* \endgroup
\chapter{A chapter with a really long title whether the chapter titles wrap correctly}
, you will also get an overfull\hbox
I did some tests and apparently TeX has a hard time hyphenating "whether".