[texhax] Line-breaking algorithm
Ian.Collier at comlab.ox.ac.uk
Ian.Collier at comlab.ox.ac.uk
Wed Mar 23 11:32:55 CET 2005
lthomas at spc.edu wrote the following missive to texhax:
> 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
>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.
[log file elided]
The breakpoints you are looking at are not the same breakpoints that TeX
chose, which means that TeX may classify a line differently from how you
see it in your sequence of breakpoints.
In particular, when TeX examined breakpoint @@5 it chose to break
via @@1 which gave a decent line. Thus, when considering @@7 -> @@5 --
which is very loose -- TeX adds the \adjdemerits because @@5 was
considered decent.
--
---- Ian Collier : imc at comlab.ox.ac.uk : WWW page below
------ http://users.comlab.ox.ac.uk/ian.collier/imc.shtml
More information about the texhax
mailing list