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.)
Let's start with a quote from Knuth's TeXbook (Chapter 11)
TeX makes complicated pages by starting with simple individual
characters and putting together in larger units, and putting these
together in still larger units, and so on.
Whenever you look at a (La)TeX
document, imagine putting on a pair of glasses that allows you to 'x-ray' the page's structure- what you would see is that each page is made up of boxes.
In particular, there are horizontal boxes (hboxes
) and vertical boxes (vboxes
). TeX
is able to make beautiful documents by making the content of each box fit 'ideally' using its stretchable glue
. When something simply will not fit, either because it is too big or too small, then you get overfull
and underfull
boxes respectively.
When TeX
encounters such situations, it is kind enough to tell you in the .log
file so that you can make a decision for yourself as to whether you need to make changes; ultimately, you have to decide if you think they mean anything bad. Note that TeX
will also give you a badness
rating, with 10000
being the worst.
If you prefer a more visual approach, then you can load the draft
option to your documentclass
, for example
\documentclass[draft]{article}
which ensures that your output is highlighted with black boxes in any of the offending areas.
For more details see any of the 'related' links on the right hand side of this page, perhaps starting with What does "overfull hbox" mean?
In terms of your 'specific' case, it sounds like one of your graphs is over-stretching its boundaries- perhaps it is going over a minipage
, or into the page margin
. If you're happy with the output, then you typically don't have to worry too much (unless the people viewing your document are also going to grep
your .log
file).
Best Answer
According to p. 4 of the
ragged2e
documentation (thanks to Herbert for encouraging me to RTFM), theragged2e
lengths which control\leftskip
resp.\rightskip
for\Centering
& friends "must be set to a finite value, to make hyphenation possible". (By default,ragged2e
uses a value of0pt plus 2em
instead of standard LaTeX's0pt plus 1fil
.) But finit glue in turn means that "underfull\hbox
" warnings become possible. In practice, such warnings are likely to be issued for one-liner or two-liner paragraphs typeset with\Centering
& friends in effect -- i.e., they will turn up in (but are not confined to) title pages and headers.This is demonstrated in the following MWE, which typesets text within three
center
environments (which, becauseragged2e
'snewcommands
option is enabled, internally use\Centering
). The first environment will produce an underfull\hbox
with a badness of 10000, the second environment one with a badness of 4096. In the third environment, the sixth word is moved to the second line (instead of being hyphenated), and no warning is issued.To remove all those "underfull
\hbox
" warnings,\hbadness
may be set to a value of 10000 for\Centering
& friends (again thanks to Herbert for the tip). Note that, if thenewcommands
option is enabled, one must add\hbadness=10000\relax
(EDIT: or, even better,\hbadness=\@M
) to the new definitions of, e.g.,\centering
as well as to the start ofcenter
environments.