[pdftex] pdftex Digest, Vol 190, Issue 2
Doug McKenna
doug at mathemaesthetics.com
Tue Feb 27 19:46:18 CET 2024
\interlinepenalties 3 10 20 30
\clubpenalties 3 66 77 88
The etex.ch file introduces code to add the interlinepenalties to the clubpenalties:
@x [39] m.890 l.17427 - eTeX penalties
begin pen:=inter_line_penalty;
if cur_line=prev_graf+1 then pen:=pen+club_penalty;
if cur_line+2=best_line then pen:=pen+final_widow_penalty;
@y
begin q:=inter_line_penalties_ptr;
if q<>null then
begin r:=cur_line;
if r>penalty(q) then r:=penalty(q);
pen:=penalty(q+r);
end
else pen:=inter_line_penalty;
q:=club_penalties_ptr;
if q<>null then
begin r:=cur_line-prev_graf;
if r>penalty(q) then r:=penalty(q);
pen:=pen+penalty(q+r);
end
else if cur_line=prev_graf+1 then pen:=pen+club_penalty;
if d then q:=display_widow_penalties_ptr
else q:=widow_penalties_ptr;
if q<>null then
begin r:=best_line-cur_line-1;
if r>penalty(q) then r:=penalty(q);
pen:=pen+penalty(q+r);
end
else if cur_line+2=best_line then
if d then pen:=pen+display_widow_penalty
else pen:=pen+widow_penalty;
@z
but the plain text run log file shows no adding:
Completed box being shipped out [1]
\vbox(667.20255+0.0)x469.75499
.\vbox(0.0+0.0)x469.75499, glue set 14.0fil
..\glue -22.5
..\hbox(8.5+0.0)x469.75499, glue set 469.75499fil
...\vbox(8.5+0.0)x0.0
...\glue 0.0 plus 1.0fil
..\glue 0.0 plus 1.0fil minus 1.0fil
.\vbox(643.20255+0.0)x469.75499, glue set 585.20255fill
..\glue(\topskip) 5.69446
..\hbox(4.30554+0.0)x469.75499
...\hbox(0.0+0.0)x20.0
...\tenrm a
...\penalty -10000
...\glue(\rightskip) 0.0
..\penalty 66
..\glue(\baselineskip) 5.05556
..\hbox(6.94444+0.0)x469.75499, glue set 273.18797
...\tenrm b
...\tenrm b
...\glue 3.33333 plus 1.66666 minus 1.11111
...\penalty -10000
...\glue(\rightskip) 0.0
..\penalty 77
..\glue(\baselineskip) 7.69446
..\hbox(4.30554+0.0)x469.75499, glue set 277.18802
...\tenrm c
...\glue 3.33333 plus 1.66666 minus 1.11111
...\penalty -10000
...\glue(\rightskip) 0.0
..\penalty 88
..\glue(\baselineskip) 5.05556
..\hbox(6.94444+0.0)x469.75499, glue set 276.52135
...\tenrm d
...\glue 3.33333 plus 1.66666 minus 1.11111
...\penalty -10000
...\glue(\rightskip) 0.0
..\penalty 238
..\glue(\baselineskip) 7.69446
..\hbox(4.30554+0.0)x469.75499, glue set 465.31055fil
...\tenrm e
...\penalty 10000
...\glue(\parfillskip) 0.0 plus 1.0fil
...\glue(\rightskip) 0.0
..\glue 0.0 plus 1.0fill
.\glue(\baselineskip) 17.55556
.\hbox(6.44444+0.0)x469.75499, glue set 232.37749fil
..\glue 0.0 plus 1.0fil minus 1.0fil
..\tenrm 1
..\glue 0.0 plus 1.0fil minus 1.0fil
I tried your sample code in my own private JSBox interpreter, which I developed using the etex.ch file to understand the algorithms to write my code. Mine adds them (the right thing, as near as I can tell). Here's the JSBox log for shipped page:
Shipping out a completed page with \count 0..0 = [1]:
vbox : [id=15] (667.20255 + 0.0) ✕ 469.75499 [rigid], contains 4 items
vbox : [id=12] (0.0 + 0.0) ✕ 469.75499, stretched using 14.0fil, contains 3 items
glue : [\vskip] -22.5
hbox : [id=11] (8.5 + 0.0) ✕ 469.75499, stretched using 469.755fil, contains 2 items
vbox : [id=10] (8.5 + 0.0) ✕ 0.0 [empty]
glue : [\hfil] 0.0 plus 1.0fil
glue : [\vss] 0.0 plus 1.0fil minus 1.0fil
vbox : [id=13] (643.20255 + 0.0) ✕ 469.75499, stretched using 585.20251fill, contains 15 items
glue : [\topskip] 5.69446
hbox : [id=4] (4.30554 + 0.0) ✕ 469.75499, contains 4 items
[uses font \tenrm = cmr10.tfm [unscaled]]
hbox : [id=3, \parindent] (0.0 + 0.0) ✕ 20.0 [rigid] [empty]
text : \tenrm a [1 char, wd=5.00002pt] [`a = "61 = 97]
cost : \penalty -10000 [always]
glue : [\rightskip] 0.0
cost : \penalty 76
glue : [\baselineskip (adjusted)] 5.05556
hbox : [id=5] (6.94444 + 0.0) ✕ 469.75499, stretched using 273.18799, contains 5 items
[uses font \tenrm = cmr10.tfm [unscaled]]
text : \tenrm bb [2 chars, total wd=11.11115pt] [`b = "62 = 98] [`b = "62 = 98]
glue : [interword space] 3.33333 plus 1.66666 minus 1.11111
cost : \penalty -10000 [always]
glue : [\rightskip] 0.0
cost : \penalty 97
glue : [\baselineskip (adjusted)] 7.69446
hbox : [id=6] (4.30554 + 0.0) ✕ 469.75499, stretched using 277.18802, contains 4 items
[uses font \tenrm = cmr10.tfm [unscaled]]
text : \tenrm c [1 char, wd=4.44444pt] [`c = "63 = 99]
glue : [interword space] 3.33333 plus 1.66666 minus 1.11111
cost : \penalty -10000 [always]
glue : [\rightskip] 0.0
cost : \penalty 118
glue : [\baselineskip (adjusted)] 5.05556
hbox : [id=7] (6.94444 + 0.0) ✕ 469.75499, stretched using 276.52133, contains 4 items
[uses font \tenrm = cmr10.tfm [unscaled]]
text : \tenrm d [1 char, wd=5.55557pt] [`d = "64 = 100]
glue : [interword space] 3.33333 plus 1.66666 minus 1.11111
cost : \penalty -10000 [always]
glue : [\rightskip] 0.0
cost : \penalty 268
glue : [\baselineskip (adjusted)] 7.69446
hbox : [id=8] (4.30554 + 0.0) ✕ 469.75499, stretched using 465.31055fil, contains 4 items
[uses font \tenrm = cmr10.tfm [unscaled]]
text : \tenrm e [1 char, wd=4.44444pt] [`e = "65 = 101]
cost : \penalty 10000 [never]
glue : [\parfillskip] 0.0 plus 1.0fil
glue : [\rightskip] 0.0
glue : [\vfill] 0.0 plus 1.0fill
glue : [\baselineskip (adjusted)] 17.55556
hbox : [id=14] (6.44444 + 0.0) ✕ 469.75499, stretched using 232.37749fil, contains 3 items
[uses font \tenrm = cmr10.tfm [unscaled]]
glue : [\hss] 0.0 plus 1.0fil minus 1.0fil
text : \tenrm 1 [1 char, wd=5.00002pt] [`1 = "31 = 49]
glue : [\hss] 0.0 plus 1.0fil minus 1.0fil
76 = 66 + 10
97 = 77 + 20
118 = 88 + 30
268 = 238 + 30
So it's a mystery to me what "reality" is here, or where a bug may have been introduced. Sure seems like cumulative penalties is the intent, especially given the original tex.web code that etex.ch changes.
Doug McKenna
More information about the pdftex
mailing list.