[texhax] Line-breaking algorithm

Thomas, Larry lthomas at spc.edu
Thu Mar 17 21:37:04 CET 2005


Hi, all
  I've been using the log file shown at the end of this message
 to try to understand TeX's linebreaking algorithm. My problem has to do
with the demerits assigned if two lines are "visually incompatible"
(TeXbook, page 97).

I tried tracing the path through breakpoints 0->2->5->7->8 which gives 4
lines of text:

line 1: badness = 86, demerits = 9216, tight fit
line 2: b = 958, d = 947024, very loose fit
line 3: b = 733, d = 562049, very loose fit
line 4: b = 0, d = 100 decent fit

The demerits of these lines before accounting for visual incompatiblity
are
line 1: (10+86)^2 = 9216
line 2: (10+958)^2 = 937024
line 3: (10+733)^2 = 552049
line 4: (10+0)^2 = 100

One sees that an extra 10000 demerits have been added to lines 2 and 3.
I can account for the extra in line 2 since the fit changes from tight to
loose in going from line 1 to line 2. But I can't account for the extra
demerits in line 3 since the fit does not change in going from line 2 to
line 3.

And that is my question: why are 10000 demerits added to line 3?

Thanks for the help of anyone who might be interested in such things.
-Larry

Here is the log file:

This is pdfTeXk, Version 3.141592-1.11b (Web2c 7.5.2) (format=pdftex
2004.8.2)  17 MAR 2005 10:45
 %&-line parsing enabled.
 (c:/Program Files/TeXLive/texmf/web2c/cp8bit.tcx)
**johnson.tex
(./johnson.tex{c:/Program Files/TeXLive/texmf-var/pdftex/config/pdftex.cfg}
Babel <v3.7o> and hyphenation patterns for english, dumylang, nohyphenation,
ba
sque, czech, slovak, german, ngerman, spanish, catalan, french, ukenglish,
ital
ian, dutch, polish, portuguese, loaded.
@firstpass
[]/cmr10/Mrs. Johnson, the last living relative of Albert 
@ via @@0 b=86 p=0 d=9216
@@1: line 1.3 t=9216 -> @@0
@secondpass
[]/cmr10/Mrs. John-son, the last liv-ing rel-a-tive of Al-
@\discretionary via @@0 b=24 p=50 d=3656
@@1: line 1.1- t=3656 -> @@0
bert 
@ via @@0 b=86 p=0 d=9216
@@2: line 1.3 t=9216 -> @@0
John-son, was sur-prised when she in-her-
@\discretionary via @@1 b=991 p=50 d=1014501
@@3: line 2.0- t=1018157 -> @@1
ited 
@ via @@1 b=66 p=0 d=5776
@@4: line 2.1 t=9432 -> @@1
a 
@ via @@1 b=0 p=0 d=100
@ via @@2 b=958 p=0 d=947024
@@5: line 2.2 t=3756 -> @@1
small---but in the end adequate---collection 
@ via @@3 b=0 p=0 d=10100
@@6: line 3.2 t=1028257 -> @@3
of 
@ via @@4 b=48 p=0 d=3364
@ via @@5 b=733 p=0 d=562049
@@7: line 3.1 t=12796 -> @@4
etch-ings. 
@\par via @@6 b=0 p=-10000 d=100
@\par via @@7 b=0 p=-10000 d=100
@@8: line 4.2- t=12896 -> @@7

[1{c:/Program Files/TeXLive/texmf/fonts/map/pdftex/updmap/pdftex.map}]
){c:/Pro
gram Files/TeXLive/texmf/dvips/tetex/f7b6d320.enc}<c:/Program
Files/TeXLive/tex
mf/fonts/type1/bluesky/cm/cmr10.pfb>
Output written on johnson.pdf (1 page, 10568 bytes).



More information about the texhax mailing list