Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
Thanks, but I am still getting the error msg: "Overfull \hbox (10.0pt too wide) in paragraph at lines 27--27" –  user3232 Jan 8 '13 at 12:12
    
I just re-copied the code in my answer and ran it through pdftex and no overfull box. Are you sure you are picking up the modified version? –  David Carlisle Jan 8 '13 at 12:17
    
Hmm, yes I did run your code. But, I cleaned the temporary files and recompiled and it works. –  user3232 Jan 8 '13 at 13:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.