What does "overfull hbox" mean? (Why is there a black mark at the end of a line?)
The first answer doesn't really help somebody fix the problem, though. Take a look at:
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=overfull
and
http://en.wikibooks.org/wiki/LaTeX/Text_Formatting#Hyphenation
to learn about \tolerance
, \pretolerance
, and \hyphenpenalty
and how they affect the overfull/underfull behavior. Also, if you're fixing the document by hand, you can add hyphenation dictionary entries with \hyphenation
or add discretionary hyphens into words with \-
.
This message means that a line of your document is too long to fit within the horizontal space on the page, and TeX couldn't find a good way to break it apart. This will usually result in text hanging out past the margin, possibly even running off the side of the page. Common causes are long words without proper hyphenation information and long displayed equations.
Quoting Phil Miller answer, for completeness:
This message means that a line of your document is too long to fit within the horizontal space on the page, and TeX couldn't find a good way to break it apart. This will usually result in text hanging out past the margin, possibly even running off the side of the page. Common causes are long words without proper hyphenation information and long displayed equations.
These warnings can also happen by manually breaking works with -
as commented by Sebastian. This can be fixed by importing the package \usepackage{hyphenat}
and using its command \hyp{}
to break words, i.e., hyphenated\hyp{}word
instead of hyphenated-word
. But as can be easily noted, typing \hyp{}
all the time can be quite annoying. Here come in the babel
package shorthands. See the question How to create an alternative to shortcut "= or \hyp{}?, to learn about the usage of the ~=
shorthand. So you can write like hyphenated~=word
, instead of hyphenated\hyp{}word
.
Badboxes warnings can also be caused by breaking lines with \\
and \hbox
as demonstrated on this other question: How to stop \newsavebox giving me bad boxes warnings or how to use better names with \setbox?
You can control how the overfull hbox, badness
work configuring these latex parameters explained on:
badness
is an integer from 0 to 10000 that is a measure of the quality of the spacing in any given box. https://en.wikibooks.org/wiki/TeX/definition/badness\tolerance
A parameter that tells TeX how much badness is allowable without error. [number] can range from 0 to 10000, and there are no units. https://en.wikibooks.org/wiki/TeX/toleranceThe TeX primitive
\pretolerance
is an integer parameter that is used in TeX's line breaking algorithm as described below. The quantity is an integer from -1 to 10000.If
\pretolerance
is an integer from 0 to 10000, then TeX's line breaking algorithm first attempts to break up a paragraph without hyphenation. In this attempt TeX ties to minimize the badness of each line. If TeX can break up a paragraph so that none of the lines have badness greater than\pretolerance
, then TeX accepts it. If this is not possible, TeX will re-attempt to break up the paragraph with the allowance of hyphenation of words. In this second attempt, the integer parameter \tolerance is used instead of\pretolerance
. If TeX is unsuccessful in the second attempt an error is reported in the log file.If
\pretolerance
is-1
, then TeX bypasses the first attempt at breaking a paragraph without hyphenation. https://en.wikibooks.org/wiki/TeX/pretolerance
On these questions there are more related information about line breaking:
- What is the meaning of \fussy, \sloppy, \emergencystretch, \tolerance, \hbadness?
- What's the difference between \tolerance and \badness ?
- Why is Latex hyphenating some words automatically, but others dont?
- Long blank space in the middle of paragraph
Hyphenation:
- Is it still worthwhile to let TeX try line-breaking without hyphenation?
- How to add global hyphenation rules?
- How to manually set where a word is split?
Bad boxes:
- Do I have to care about bad boxes?
- How to avoid using \sloppy document-wide to fix overfull \hbox problems?
- Overfull hbox - How do I fix this?
Table of Contents:
- Fixing overfull hbox in table of contents removes too many dots
- Memoir mysterious overfull hbox in TOC when mathptmx is used
- Overfull \hbox warning for TOC entries when using memoir documentclass
- titletoc: section titles ragged right
- How to typeset the table of contents raggedright in memoir?
- Table of contents: section titles ragged right
Miscellaneous:
- underfull \vbox
- What is the difference between \hspace*{\fill} and \hfill?
- how to suppress "Underfull \vbox (badness 10000) ... while \output is active"?
- http://www.tex.ac.uk/FAQ-overfull.html (La)TeX makes overfull lines
- http://www.tex.ac.uk/FAQ-paraparam.html Why does it ignore paragraph parameters?