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 often see those warnings about "overfull \hbox" when I'm preparing my document. Because the document is still in the early stage, I see no point in correcting them on-the-spot - since the document will change anyway.

But I also want to get rid of that ugly overflow (by increasing the possible width of space between words), so I can show that draft to somebody.

Is there a way to do it?

share|improve this question
2  
perhaps \emergencystretch[=]<dimen> –  morbusg Apr 22 '12 at 7:10
    
@morbusg - Yes, that helped. But I can't accept the comment as the answer :) –  Rogach Apr 22 '12 at 7:18

2 Answers 2

up vote 19 down vote accepted

TeX has a primitive parameter for that kind of situation: \emergencystretch, of which Knuth writes in the TeXbook chapter 14

If you want to avoid overfull boxes at all costs without trying to fix them manually, you might be tempted to set \tolerance=10000; this allows arbitrarily bad lines to be acceptable in tough situations. But infinite tolerance is a bad idea, because TEX doesn’t distinguish between terribly bad and preposterously horrible lines. Indeed, a tolerance of 10000 encourages TEX to concentrate all the badness in one place, making one truly unsightly line instead of two moderately bad ones, because a single “write-off” produces fewest total demerits according to the rules. There’s a much better way to get the desired effect: TEX has a parameter called \emergencystretch that is added to the assumed stretchability of every line when badness and demerits are computed, in cases where overfull boxes are otherwise unavoidable. If \emergencystretch is positive, TEX will make a third pass over a paragraph before choosing the line breaks, when the first passes did not find a way to satisfy the \pretolerance and \tolerance. The effect of \emergencystretch is to scale down the badnesses so that large infinities are distinguishable from smaller ones. By setting \emergencystretch high enough (based on \hsize) you can be sure that the \tolerance is never exceeded; hence overfull boxes will never occur unless the line-breaking task is truly impossible.

So you could use, for example

\emergencystretch=.5em
share|improve this answer

LaTeX has a declaration \sloppy for this use, it sets \emergencystretch but also some of the other relevant parameters, it is defined as

\def\sloppy{%
  \tolerance=9999
  \emergencystretch=3em
  \hfuzz .5pt
  \vfuzz=\hfuzz}

So in addition to increasing \emergencystretch it increases \tolerance (to allow line breaking that causes greater "badness") and to increase \hfuzz and \vfuzz so TeX does not warn about overfull boxes unless they are more than half a point overfull.

share|improve this answer

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.