[Tex/LaTex] overfull hbox in the chapter

line-breakingsectioning

What is the preferred way of fixing an overfull hbox problem when it complains about the chapter title.

MWE (complains about the \chapter{Chapter title} line):

\documentclass[12pt,twoside]{book}
\textwidth 150mm
\usepackage[Bjornstrup]{fncychap}

\oddsidemargin 5mm
\evensidemargin 5mm
\topmargin 0mm
\headheight 0mm
\textheight 225mm

\begin{document}
\chapter{Chapter title}
lorem impsum.

\end{document}

Looking at the different threads on TeX.se I could not find the answer. Since I have many chapters, I would appreciate a more general solution.

Best Answer

Looks like a bug in fncychap It is always 10pt too much,

\documentclass[12pt,twoside]{book}
\textwidth 150mm

\usepackage[Bjornstrup]{fncychap}
\makeatletter
  \renewcommand{\DOCH}{%
    \settowidth{\py}{\CNoV\thechapter}%
    \addtolength{\py}{-10pt}%     % Amount of space by which the
%                                  % number is shifted right
    \fboxsep=0pt%
    \colorbox[gray]{.85}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}%
\kern-\myhi
    \kern-\py\raise20pt%
    \hbox{\color[gray]{.5}\CNoV\thechapter}%
%\kern-\myhi
\\%
  }
\makeatother
\oddsidemargin 5mm
\evensidemargin 5mm
\topmargin 0mm
\headheight 0mm
\textheight 225mm

\begin{document}
\chapter{Chapter title}
lorem impsum.

\end{document}

You can add a -10pt kern to fix it, I show a couple of places (one commented out, depending on the look you prefer)

enter image description here

enter image description here