6

I read the excellent reply by David Carlisle on a line breaking question. However, one question remained open for me.

Carlisle wrote:

\hfuzz does not affect the typesetting in any way but just stops TeX complaining if the box is is only slightly over-full.

and

[...] \emergencystretch does not change the setting of "good" paragraphs, it only changes the setting of paragraphs that would have produced over-full boxes.

Both options on their own are clear. Does \hfuzz only remove warnings from the stdout and log file or does it also prevent emergency stretching?

As an example assume \emergencystretch = 1emand \hfuzz=5pt. If an hbox were overfull by 3 pt would the whitespace still be stretched to avoid it? (If it were, the considerably increased whitespace between words might be worse than overrunning a paragraph by an amount which is under the threshold of the writer.)

4

No, \hfuzz doesn't affect the line breaking decisions.

TeX will use a sequence of line breaks so that no line is overfull/underfull, if it's able to find one. Otherwise it will use the sequence the least amount of demerits even if a line is overfull/underfull; the value of \hfuzz only affects the console/log output: if a line is overfull beyond \hfuzz, you'll be warned.

If I take Ulrike’s example and set \tracingparagraphs=1, the first two paragraphs show exactly the same trace:

@firstpass
@secondpass
[]\OT1/cmr/m/n/10.95 blub xxxxxxx xxxxxxx 
@ via @@0 b=* p=0 d=*
@@1: line 1.3 t=0 -> @@0
xxxxxxx xxxxxxx 
@ via @@1 b=8 p=0 d=324
@@2: line 2.2 t=324 -> @@1
xxxxxxx xxxxxxx 
@\par via @@2 b=0 p=-10000 d=*
@@3: line 3.2- t=324 -> @@2


Overfull \hbox (38.70877pt too wide) in paragraph at lines 7--8
[]\OT1/cmr/m/n/10.95 blub xxxxxxx xxxxxxx
 []

@firstpass
@secondpass
[]\OT1/cmr/m/n/10.95 blub xxxxxxx xxxxxxx 
@ via @@0 b=* p=0 d=*
@@1: line 1.3 t=0 -> @@0
xxxxxxx xxxxxxx 
@ via @@1 b=8 p=0 d=324
@@2: line 2.2 t=324 -> @@1
xxxxxxx xxxxxxx 
@\par via @@2 b=0 p=-10000 d=*
@@3: line 3.2- t=324 -> @@2

The only difference is that no warning message is shown in the second case, where \hfuzz has been set to 40pt.

Now change the example to

\documentclass[11pt]{article}
\textwidth=3cm

\tracingparagraphs=1

\begin{document}
blub xxxxxxxxxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx

\emergencystretch=\maxdimen
blub xxxxxxxxxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx

\hfuzz=40pt
blub xxxxxxxxxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx

\end{document}

The first paragraph will have a line which is overfull by 36.27544pt. The second and third paragraphs are typeset exactly in the same way, regardless of the changed value of \hfuzz, which would allow the third paragraph to be set alike the first one, if it affected the line breaking decision. Here's the log.

First paragraph

@firstpass
@secondpass
[]\OT1/cmr/m/n/10.95 blub xxxxxxxxxxxxxx 
@ via @@0 b=* p=0 d=*
@@1: line 1.3 t=0 -> @@0
xxxxxxx xxxxxxx 
@ via @@1 b=8 p=0 d=324
@@2: line 2.2 t=324 -> @@1
xxxxxxx xxxxxxx 
@\par via @@2 b=0 p=-10000 d=*
@@3: line 3.2- t=324 -> @@2

Second paragraph

@firstpass
@secondpass
@emergencypass
[]\OT1/cmr/m/n/10.95 blub 
@ via @@0 b=0 p=0 d=100
@@1: line 1.2 t=100 -> @@0
xxxxxxxxxxxxxx 
@ via @@1 b=0 p=0 d=100
@@2: line 2.2 t=200 -> @@1
xxxxxxx 
@ via @@2 b=0 p=0 d=100
@@3: line 3.2 t=300 -> @@2
xxxxxxx 
@ via @@2 b=0 p=0 d=100
@ via @@3 b=0 p=0 d=100
@@4: line 3.2 t=300 -> @@2
xxxxxxx 
@ via @@3 b=0 p=0 d=100
@ via @@4 b=0 p=0 d=100
@@5: line 4.2 t=400 -> @@4
xxxxxxx 
@\par via @@4 b=0 p=-10000 d=100
@\par via @@5 b=0 p=-10000 d=100
@@6: line 4.2- t=400 -> @@4

Third paragraph

@firstpass
@secondpass
@emergencypass
[]\OT1/cmr/m/n/10.95 blub 
@ via @@0 b=0 p=0 d=100
@@1: line 1.2 t=100 -> @@0
xxxxxxxxxxxxxx 
@ via @@1 b=0 p=0 d=100
@@2: line 2.2 t=200 -> @@1
xxxxxxx 
@ via @@2 b=0 p=0 d=100
@@3: line 3.2 t=300 -> @@2
xxxxxxx 
@ via @@2 b=0 p=0 d=100
@ via @@3 b=0 p=0 d=100
@@4: line 3.2 t=300 -> @@2
xxxxxxx 
@ via @@3 b=0 p=0 d=100
@ via @@4 b=0 p=0 d=100
@@5: line 4.2 t=400 -> @@4
xxxxxxx 
@\par via @@4 b=0 p=-10000 d=100
@\par via @@5 b=0 p=-10000 d=100
@@6: line 4.2- t=400 -> @@4

Console output

Overfull \hbox (36.27544pt too wide) in paragraph at lines 7--8
[]\OT1/cmr/m/n/10.95 blub xxxxxxxxxxxxxx

Underfull \hbox (badness 10000) in paragraph at lines 10--11
[]\OT1/cmr/m/n/10.95 blub

Underfull \hbox (badness 10000) in paragraph at lines 10--11
\OT1/cmr/m/n/10.95 xxxxxxxxxxxxxx

Underfull \hbox (badness 10000) in paragraph at lines 13--14
[]\OT1/cmr/m/n/10.95 blub

Underfull \hbox (badness 10000) in paragraph at lines 13--14
\OT1/cmr/m/n/10.95 xxxxxxxxxxxxxx
4

Try it out:

\documentclass[11pt]{article}
\textwidth=3cm

\begin{document}
blub xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx

\hfuzz=40pt
blub xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx

\emergencystretch=1em
blub xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx
\end{document}
  • Thanks, that was an effective demonstration.. That's rather interesting, I did not expect that hfuzz and emergencystretch could be changed for parts of a document. – gschenk Apr 29 '16 at 6:43
  • I normally use \emergencystretch only for one paragraph, or e.g. before the bibliography. – Ulrike Fischer Apr 29 '16 at 6:44
  • It is quite useful in paragraphs with a couple of those too-many-word-containing compounds. – gschenk Apr 29 '16 at 6:48
  • I didn't mean that it is not useful, but I'm not using it for the complete document but enable it only for the paragraphs where it is really needed (after checking if a rewording or some additional hyphenation is possible). – Ulrike Fischer Apr 29 '16 at 6:53
  • Yes, and sorry, that I didn't mention that I completely concur. It is very useful for those paragraphs to obtuse to set properly. However, for then entire document the side-effect seem a bit too much. Thanks for pointing that out (at what must be an early Saturday morning in Germany, thanks twice) – gschenk Apr 29 '16 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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