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.

I am getting lots of "Underfull \hbox" warnings that point to the *.bbl file. It looks like these messages appear only when URLs are very long, like in the below example:

@techreport{nistguidesec,
  author    = {Wayne Jansen and Timothy Grance},
  title     = {Guidelines on Security and Privacy in Public Cloud Computing},
  month    = {January},
  note     = {Draft Special Publication 800-144. Available at \url{http://csrc.nist.gov/publications/drafts/800-144/Draft-SP-800-144_cloud-computing.pdf}},
}

In the produced PDF text is correctly hyphened and links are correctly split over several lines (I am using hyperref package)

How can I avoid annoying warning messages about "underfull \hbox" pointing to bibliography?

share|improve this question
1  
lockstep already gave a very nice answer, but one thing I've found sometimes works it to insert a \\ before the \url Of course, this is a manual solution. –  TH. Jun 25 '11 at 10:10

1 Answer 1

up vote 22 down vote accepted

Because "line-breaking in the bibliography is often more difficult than in the body text" (biblatex manual, p. 91), LaTeX typesets the bibliography using the \sloppy macro which relaxes some of TeX's parameters/penalties for line-breaking. However, \sloppy (maybe for some good reason!) does not touch \hbadness which is (among other things) responsible for "Underfull \hbox" warnings. The following code (to be added to your preamble) appends \hbadness 10000 to \sloppy which should remove those warnings.

\usepackage{etoolbox}
\apptocmd{\sloppy}{\hbadness 10000\relax}{}{}

Alternatively (and without possible adverse affects), you could typeset the bibliography \raggedright:

\usepackage{etoolbox}
\apptocmd{\thebibliography}{\raggedright}{}{}

Minimal example (compilable):

\documentclass{article}

\textwidth 300pt

\usepackage{etoolbox}
% Variant A
\apptocmd{\sloppy}{\hbadness 10000\relax}{}{}
% Variant B
% \apptocmd{\thebibliography}{\raggedright}{}{}

\usepackage{hyperref}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@techreport{nistguidesec,
  author    = {Wayne Jansen and Timothy Grance},
  title     = {Guidelines on Security and Privacy in Public Cloud Computing},
  month    = {January},
  note     = {Draft Special Publication 800-144. Available at \url{http://csrc.nist.gov/publications/drafts/800-144/Draft-SP-800-144_cloud-computing.pdf}},
}
\end{filecontents}

\begin{document}

\nocite{*}

\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}

(The filecontents environment is only used to include some external files directly into the example, so that it compiles. It is not necessary for the solution.)

share|improve this answer
1  
IMHO it should be \apptocmd{\sloppy}{\hbadness 10000\relax}{}{}, just to be sure. Or use \@M for 10000 if \makeatletter is already in affect. –  Martin Scharrer Feb 12 '11 at 18:22
1  
@Martin: I corrected my code samples to include \relax. –  lockstep Feb 12 '11 at 18:27
1  
Alternatively, you could have just put a space after the number. Since you mention \raggedright, it's probably worth mentioning that \RaggedRight from ragged2e is almost certainly a better choice. –  TH. Jun 25 '11 at 10:06

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.