Repository navigation
a paragraph shape lasts one paragraph: normal_paragraph - #796
Merged
Merged
Conversation
tex.web:20756-20761, called from nine places including vmode+par_end — every
\par:
procedure normal_paragraph;
begin if looseness<>0 then eq_word_define(int_base+looseness_code,0);
if hang_indent<>0 then eq_word_define(dimen_base+hang_indent_code,0);
if hang_after<>1 then eq_word_define(int_base+hang_after_code,1);
if par_shape_ptr<>null then eq_define(par_shape_loc,shape_ref,null);
end;
This engine kept the shape for ever.
⛔⛔ AND THAT BECAME A DEFECT THE MOMENT THE PARAMETER STARTED WORKING. While
\hangindent was accept-and-ignore, never resetting it cost nothing and no test
could have noticed. #795 made it shape the line breaker; the same omission then
hung every FOLLOWING paragraph. Measured before this landed, the same second
paragraph in two documents differing only in what their FIRST paragraph asked:
after a hung first: "measure that is wrong" / "by a centimetre is wrong"
after a plain first: "sure that is wrong by a cen-" / "timetre is wrong on every"
and the three parameters read back unchanged after \par — \hangindent 1572864
sp, \hangafter 3, \looseness 2, where TeX gives 0, 1 and 0.
⚠ Most LaTeX survived it anyway: an assignment inside a group is restored by the
save stack, and \@hangfrom and friends are grouped. The top-level assignment is
the one that leaked.
It writes through setCount/setDimen rather than the register slices, so the reset
takes part in grouping exactly as eq_word_define does — a reset that escaped its
group would be a second bug of the same family.
\parshape is absent because this engine has no such primitive yet; its reset
belongs on the line below when it grows one.
Co-Authored-By: Claude Opus 5 <[email protected]>
tannevaled
added a commit
that referenced
this pull request
Nov 16, 2026
…wrote down The README describes the line breaker and never mentioned \hangindent, \hangafter or \parshape, although #795 implemented the first two, #796 made them last one paragraph, and this branch adds the third. A reader of the README could not tell that a document's own per-line measure reaches the breaker at all. It now says so, with the three facts a reader would otherwise get wrong: - the parameters reach the BREAKER, not only the placement; - \parshape WINS over \hangindent (tex.web:16706 tests par_shape_ptr first and consults hang_indent only in the else branch); - and all of them last ONE paragraph (:20756-20761). And it states the corpus result as what it is: \parshape set by 0 of the 154 measured papers and \hangindent by 3, so the A/B's Σ|page deviation| 306 -> 306 with 0 papers moved is the PREDICTED result and a no-regression check, not a fidelity win. Anything else would have meant a bug. Co-Authored-By: Claude Opus 5 <[email protected]>
tannevaled
added a commit
that referenced
this pull request
Nov 16, 2026
…reaker (#798) * \parshape is a primitive, so a document's own line widths reach the breaker tex.web:23275-23286 is the whole of the scanner: scan_optional_equals, scan_int, then n pairs of (indent, width) read as normal dimens. The engine had no \parshape at all, so a document asking for its own per-line measure was silently set on the uniform one. MEASURED, on a 120pt measure with \parindent=0pt: uniform 5 lines "ofeverypaper,andamea-" ... \parshape=2 7 lines "ofeverypaper," "andameasure" ... 0pt 120pt 0pt 60pt The words move, which is the observable that shows the shape reaching the BREAKER rather than only the placement. Line 1 keeps the full measure and is identical on both sides; every later line gets 60pt, because the last pair repeats (:16680-16681). TWO RULES THAT A MUTATION SETTLED RATHER THAN MY READING: - \parshape WINS OVER \hangindent (:16706 tests par_shape_ptr first and consults hang_indent only in the else branch). Reading \hangindent first in paragraphShape makes the precedence test, and only that test, fail: "with both set the paragraph does not match the \parshape alone". - the n<=0 early return is a PANIC GUARD, not an over-read guard. Removing it leaves \parshape=0 unharmed -- the pair loop is bounded by n and runs zero times either way -- while \parshape=-1 panics in make([]Shape, 0, n) on a negative capacity. An earlier draft of the comment claimed the guard stopped the scanner eating the document's next two dimensions; it cannot, and the mutation said so. The comment now records what was measured. The shape lasts one paragraph: normal_paragraph clears par_shape_ptr (:20756-20761), with the caveat, stated in the code, that parShape is not on the save stack. Also: the box WIDTH is the wrong observable for any of this, and the witness says so -- a positive indent keeps the box at the full measure with a rigid kern inside it, so every box is hsize wide either way. The text per line is what moves. Plan #792, item B3b. Co-Authored-By: Claude Opus 5 <[email protected]> * README: the per-line measure, which three merged pull requests never wrote down The README describes the line breaker and never mentioned \hangindent, \hangafter or \parshape, although #795 implemented the first two, #796 made them last one paragraph, and this branch adds the third. A reader of the README could not tell that a document's own per-line measure reaches the breaker at all. It now says so, with the three facts a reader would otherwise get wrong: - the parameters reach the BREAKER, not only the placement; - \parshape WINS over \hangindent (tex.web:16706 tests par_shape_ptr first and consults hang_indent only in the else branch); - and all of them last ONE paragraph (:20756-20761). And it states the corpus result as what it is: \parshape set by 0 of the 154 measured papers and \hangindent by 3, so the A/B's Σ|page deviation| 306 -> 306 with 0 papers moved is the PREDICTED result and a no-regression check, not a fidelity win. Anything else would have meant a bug. Co-Authored-By: Claude Opus 5 <[email protected]> --------- 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.
A paragraph shape lasts exactly one paragraph. This engine kept it for ever — and that only became a defect twenty minutes ago, when
\hangindentstarted working. Refs #792, which stays open. The change that made this load-bearing is the\hangindentPR merged earlier this evening.tex.web:20756-20761, whole
Called from nine places,
vmode+par_end(:21152) among them — so every\par. This engine called it from none.⛔⛔ The shape of this defect is worth more than the fix
While
\hangindentwas accept-and-ignore, never resetting it cost nothing, and no test could have noticed. The\hangindentPR made it shape the line breaker, and the same omission immediately began hanging every following paragraph.A parameter's lifetime only matters once the parameter matters. I found this by asking, after that merge, what the change had just made load-bearing — not by re-reading the code.
Measured before this landed. Two documents identical except for what their FIRST paragraph asks; the comparison is their SECOND, which asks for nothing:
and the three parameters read back unchanged after
\par:Both tests fail on
mainand pass here.⚠ Why most LaTeX survived it, and why the corpus says nothing
An assignment inside a group is restored by the save stack, and
\@hangfromand friends are grouped. Only a top-level assignment leaked, and no paper in the 154-paper list makes one:⭐ That zero is the same zero the
\hangindentPR's A/B produced, and it now has an explanation rather than two candidates: group restoration was already doing the work for every path the corpus uses. A document that writes\hangindentoutside a group is the case that was broken, and it is not in this corpus.The reset writes through the setters, deliberately
setCount/setDimen, not the register slices, so the assignment takes part in grouping exactly aseq_word_definedoes. A reset that escaped its own group would be a second bug of the same family as the one it fixes.⚠
\parshapeis absent because this engine has no such primitive; its reset belongs on the line below when it grows one.go-typeset/linebreak'sParShapeis already released and waiting.gofmt -l .prints nothing,go vet ./...clean,go test ./...green on all nine packages, 154 of 154 papers scored.⚠ Not claimed
normal_paragraphfrom\par, the output group,\insert,\vadjust,\vcenterand-vmodeamong others; this lands it at the end of a paragraph, which isvmode+par_end. The others are not addressed and a shape could still outlive, say, a\vcenterhere.\loosenessdoes anything. It is reset because tex.web resets it; it remains unimplemented — finding 7 ofgo-typeset/linebreak's nine-divergence census, and 0 of 154 papers set it.🤖 Generated with Claude Code