Repository navigation
take linebreak v1.12.0, and \looseness with it - #825
Merged
Merged
Conversation
v1.10.0 -> v1.12.0, which brings two library changes: linebreak #21 a break discards the whole RUN of discardables, not one glue linebreak #22 \looseness: the state is (position, line, fitness), not (position, fitness) — tex.web:16107-16114, :16716, :17197-17237 and one line of engine: `Looseness: e.namedInt("looseness")`. ## \looseness, measured looseness 0 3 lines looseness 1 4 lines A paragraph of twelve 10pt words on a 50pt measure, glue 4pt plus 8 minus 2: four to the line at 52pt shrinking, three at 38pt stretching, both decent — which is what gives the choice something to choose between. The register was declared in texparams.go and read by nothing (#754 item C, linebreak#12 item 7), so a document that set it was obeyed in silence. Three rows: the move, the control (\looseness=0 is byte-for-byte the old behaviour), and an unreachable \looseness=5 that must still set the paragraph — tex.web:17203 keeps what the final pass reached. ## ⛔ AND THE FIXTURE IS \hskip, NOT \spaceskip, FOR A REASON WORTH THE NEXT HOUR My first draft set `\spaceskip=4pt plus 8pt minus 2pt` and produced EIGHTEEN rows in which \looseness changed nothing — 6 to 15 words across three measures, flat in both directions. I was one commit from publishing that as evidence that the parameter does not reach the breaker. It was the fixture. \spaceskip is a \newskip register in this engine and NOT the base interword glue; spacefactor.go:104-109 says so in as many words. So every one of those rows was measured on spMock's own 3pt plus 1.5 space, where a three-word line needs ratio 4.7 and no second ending survives \adjdemerits. The parameter was reaching the breaker the whole time and there was nothing for it to choose. What separated it: driving the LIBRARY's fixture from inside this engine's binary (it moved, 3 -> 4), then dumping the item stream the engine hands over and seeing `w=3.00 y=1.50 z=1.00` where the source said 4/8/2. ## The bump itself is inert on every witness I have Seven documents compiled by a binary built from origin/main and one from this branch, compared BYTE FOR BYTE: prose, front, sect, floats (the four that agree page-for-page with tectonic, #813), foot (\flushbottom), foottwo ([twocolumn]), lccode (a 110pt \parbox hyphenating hard). All seven identical; suite green on all 11 packages. ⚠ "Inert on seven witnesses" is not "inert on the corpus", and the corpus is not on this machine. The discard-run change touches break_width only where a break is followed by a RUN of discardables, which synthetic prose may never build. Refs #754, Refs #813, Refs go-typeset/linebreak#21, Refs go-typeset/linebreak#22. Co-Authored-By: Claude Opus 5 <[email protected]>
tannevaled
force-pushed
the
take-linebreak-1-12-0
branch
from
November 17, 2026 19:40
84b8698 to
d0d8ed9
Compare
This was referenced Nov 17, 2026
spaceskip and xspaceskip are accept-and-ignore: a document that sets either gets the font space
#826
Closed
tannevaled
added a commit
that referenced
this pull request
Nov 18, 2026
Both were accept-and-ignore: declared as registers, read by nothing, so a
document that set either was handed the font's own space in silence.
## The rule, both branches
tex.web:20358-20370, app_space:
if (space_factor>=2000)and(xspace_skip<>zero_glue) then
q:=new_param_glue(xspace_skip_code)
else begin if space_skip<>zero_glue then main_p:=space_skip
else <Find the glue specification...>;
main_p:=new_spec(main_p);
<Modify the glue specification in main_p according to the space factor>;
and :20332-20338 for the ordinary space. They are NOT the same rule:
* \xspaceskip is taken VERBATIM — whole, unscaled, no \fontdimen7 — and only
when the factor is at least 2000;
* \spaceskip replaces the FONT's space as the base and is then scaled by the
factor exactly as the font's would have been, extra_space included (§1044
adds extra_space(cur_font) whatever the base is).
⛔ ZERO IS "UNSET", NOT A WIDTH. :20328-20330 says TeX compares the parameter
against zero_glue by POINTER, so a \spaceskip of 0pt plus 0pt minus 0pt means
nobody set it and the font's space is used. nonZeroSkip asks that question and
not "width > 0", because `0pt plus 2pt` IS set — a space that can only grow. The
float skips had the same conflation in the other direction (#815).
## Why both halves at once
The note this replaces said half an implementation would be worse than none, and
it was right while only half could be written:
⚠ Two parts of §1043 are NOT here … the \xspaceskip branch … and \spaceskip
as the base glue … a document that sets them is unaffected today and would
be wrongly affected by half an implementation.
Taking \spaceskip without the \xspaceskip branch would scale a parameter TeX uses
whole; taking \xspaceskip without the base would leave every ordinary space wrong.
## Tests
Seven rows. Five on the ordinary factor — the font's space as the CONTROL, the
document's glue, a zero \spaceskip falling back, `0pt plus 2pt` counting as set,
and \xspaceskip ignored below 2000 — and two at 2000, where the rules part: the
\xspaceskip taken whole (its 5pt of stretch stays 5, where scaling would double
it) against the control of the same factor with no \xspaceskip, which scales
\spaceskip's stretch to 8 and halves its shrink and adds \fontdimen7.
⭐ ATTRIBUTED: with the \spaceskip branch disabled, four rows go red and the two
CONTROL rows stay green. A witness that fired on its own controls would be
measuring something else.
## What this cost before it existed
A line-breaking fixture that set \spaceskip=4pt plus 8pt minus 2pt was handed the
mock font's 3pt plus 1.5, and eighteen configurations of it reported that
\looseness has no effect. It has one (#825). A silent parameter is worse than a
missing one: the fixture looks like it says something.
⚠ No corpus figure: gotex-paramcensus can say how many of the 154 measured papers
set either, and I have not run it.
Closes #826.
Co-authored-by: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
⚠ Rewritten at 20:40. The first version of this body withheld the
\loosenesswiring and offered an eighteen-row table as evidence that theparameter could not reach the breaker. The table was measured on the wrong
glue. The wiring is here, measured, with the correction kept in view below.
v1.10.0→v1.12.0, plus one line of engine:\looseness: the state is (position, line, fitness) —tex.web:16107-16114,:16716,:17197-17237paragraph.goLooseness: e.namedInt("looseness")\looseness, measured\looseness0\looseness1Twelve 10pt words on a 50pt measure, glue 4pt plus 8 minus 2: four to the line at
52pt shrinking, three at 38pt stretching — both decent, which is what gives the
choice something to choose between. The register was declared in
texparams.goand read by nothing (#754 item C, go-typeset/linebreak#12 item 7), so a document
that set it was obeyed in silence.
Three rows: the move, the control (
\looseness=0is the old behaviourexactly), and an unreachable
\looseness=5that must still set the paragraph —tex.web:17203keeps what the final pass reached.⛔ The fixture uses
\hskip, not\spaceskip, and that cost an hourMy first draft set
\spaceskip=4pt plus 8pt minus 2ptand produced eighteenrows in which
\loosenesschanged nothing — 6 to 15 words across three measures,flat in both directions. I was one commit from publishing that as evidence that
the parameter does not reach the breaker.
It was the fixture.
\spaceskipis a\newskipregister in this engine andnot the base interword glue —
spacefactor.go:104-109says so in as manywords. So every row was measured on
spMock's own3pt plus 1.5space, where athree-word line needs ratio 4.7 and no second ending survives
\adjdemerits.The parameter was reaching the breaker the whole time; there was nothing for it
to choose.
What separated it: driving the library's fixture from inside this engine's
binary (it moved, 3 → 4), then dumping the item stream the engine hands over and
reading
w=3.00 y=1.50 z=1.00where the source said 4/8/2.The bump itself is inert on every witness I have
Seven documents compiled by a binary built from
origin/mainand one from thisbranch, compared byte for byte:
prosefrontsectfloats(the fourthat agree page-for-page with
tectonic, #813),foot(\flushbottom),foottwo([twocolumn]),lccode(a 110pt\parboxhyphenating hard). Allseven identical; suite green on all 11 packages.
⚠ "Inert on seven witnesses" is not "inert on the corpus", and the corpus is
not on this machine. The discard-run change touches
break_widthonly where abreak is followed by a run of discardables, which synthetic prose may never
build.
Refs #754, Refs #813,
Refs go-typeset/linebreak#21, Refs go-typeset/linebreak#22,
Refs go-typeset/linebreak#12.
🤖 Generated with Claude Code