[Tex/LaTex] When line breaking goes wrong: does \hfuzz influence \emergencystretch

line-breaking

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.)

Best Answer

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
Related Question