Repository navigation
render-pipeline: squeeze too-wide displays, numbers on their own line, subequations label line (display-placement 33/36; needs #148 + #155 re-pin, includes #146) - #157
Merged
Conversation
…no, \tag*, after headings, lists; oracle 29/36)
Display rules of TeX 1145/1199-1205 and amsmath's \mathdisplay, measured
by a new 36-fixture pdflatex oracle (fixtures/display-placement; main 19/36):
- amsmath leqno: numbers left, normal skips (1203); fleqn: formula at
\@mathmargin, tags per \emdf@R/\emdf@L; align/gather under both.
- primitive $$ ... \eqno/\leqno $$ numbers (read from source).
- \tag* without parentheses; counter numbers formatted in the adapter.
- a display right after a heading sets no empty line (1145).
- text after a display carrying \label, and displays inside quote and
list items, continue the paragraph (no indent, short skips).
- the short-skip test is d + s <= \predisplaysize, not a too-wide flag.
Not yet: glue shrink of too-wide formulas (math-layout glue has no shrink),
\numberwithin/subequations (compiler counter), \tag{$..$}, nested list
labels. amsmath corpus 42/42; HW1/HW2 byte-identical to main.
Implementation-Agent: Claude Opus 5 (subagent kabir-claude display math placement, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…display-too-wide C wires math-layout pack_to (#148) and compiler numbering (#155) into the display placement of #146, which is not merged yet. Implementation-Agent: Claude Opus 5 (subagent kabir-claude math glue + numbering, mac-m5pro-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]>
…their own line, label lines (display-placement 33/36)
tex.web 1199-1205 in display_block, on math-layout's MathBox::pack_to:
- a formula wider than \displaywidth beside its number is set with
hpack(p, z - q, exactly) when its shrink reaches (or any infinite shrink
exists); otherwise the number goes on a line of its own (\eqno below the
formula without \belowdisplayskip, \leqno above it without
\abovedisplayskip, kept together by \penalty10000) and the formula alone
is packed to z if still too wide; d is 0 when the formula starts with
glue. Overfull displays are reported by the amount the shrink cannot
absorb.
- layout_kerned splices each run's hlist into one flat list and sets the
spacing across a \quad split as muskip glue, so glue_totals sees every
glue of the formula (positions unchanged).
- equation numbers and \tag labels are an \hbox of words with natural
interword glue (\maketag@@@), not one shaped run with T1's visible-space
glyph (a spaced \tag was 1.67pt per space too wide).
- a \label left in horizontal mode after a display (\begin{subequations}
\label{..}) is set as an empty line before the next display, as TeX's
line_break does with a whatsit-only list (predisplaysize -\maxdimen).
Depends on #148 (math-layout pack_to, glue stretch/shrink) and #155
(compiler \numberwithin/subequations): it builds only once vendor/
math-layout and vendor/compiler are re-pinned to them. Merges #146 (not yet
on main).
Verified in an uncommitted scratch copy (vendor math-layout = #148,
vendor/compiler = the #146 pin plus #155's parser/xref/supported diff):
display-placement oracle 33/36 (was 29; now 09, 10, 18, 33 pass; 17's
numbers are right but \eqref misses LaTeX's \sw@slant italic correction
before its space, 0.78bp; 15 and 20 out of scope); amsmath corpus 42/42;
cargo test --release 146 passed, 0 failed; HW1, HW2 and the seven other
real-world fixtures produce byte-identical v2 output to the same build
without this commit.
Implementation-Agent: Claude Opus 5 (subagent kabir-claude math glue + numbering, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
This was referenced Sep 13, 2026
GoKubar
added a commit
that referenced
this pull request
Sep 13, 2026
Kept #157's label-only empty line before a display together with main's stretched_left predisplaysize. The merge log also records why #145 was aborted rather than merged. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar
added a commit
that referenced
this pull request
Sep 13, 2026
Clean merge; supplies MathBox::tag throughout. #157's new squeezed-display MathBox literal takes SourceTag::NONE, like #165's synthetic glue. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar
added a commit
that referenced
this pull request
Sep 13, 2026
16 conflicts (adapter.rs 10, typeset.rs 5, incremental.rs 1). All but one were misalignments: git shared common tails between this branch's additions and #156's, so each side ended mid-construct and a plain "keep both" would not compile. Rebuilt as complete separate pieces, as the merge log records for #154 and #170. - `Item` / `BoxRec` / `AItem` / `Paragraph`: both sides add variants and fields (#156's Glue, Rigid, Penalty, EmptyBox, Qed, Rules, LocalRule, `theorem_head`). Kept from both, with the enclosing enum, struct and match arms closed explicitly where git had shared a brace. - **Incremental cache tags renumbered.** #156 numbered its five new `hash_items` arms 10-14, which this branch already uses for Footnote/TextBox/SetLength/LengthGlue/HSs. These tags key the incremental layout cache, so a collision serves one item's cached layout for another -- the same hazard #170 hit, fixed the same way. #156's are now 19-23, the first free run. The two pre-existing collisions (Logo/Table at 9, Footnote/Rule at 10) are left for #182, which replaces the hand-numbering with `mem::discriminant`. - `\qedhere` in a display: #156's block computes e/q before the display is placed, so it goes ahead of #157's fleqn/§1201 squeeze rather than the plain §1199 centring #156 carried with it. The symbol is built into a `NumberBox` (this branch's representation, which is where display_block reads the height and depth from) instead of #156's bare `(run, rec)` pair. - `\addvspace`: kept main's `\@xaddvskip` rule (a negative amount after a non-negative `\lastskip` is added to it) together with #156's flex, so the surviving skip keeps its own stretch and shrink. - `gap_has_list_end` came back. The origin/main merge had dropped it as having no caller; #156's theorem-skip code needs it. It is now written in terms of `LIST_ENVS` so it cannot drift from the other list predicates. The one real disagreement, found by measurement, not by reading #156 guards display continuation with `*prev_style == ParaStyle::Plain && prev_list.is_none()`. Merged as written, display-placement fell from 33/36 to 31/36: every new failure was a display inside a list or a quote, shifted 12 to 20 pt vertically (`20-enumerate-nested-display`, `29-quote-display`, and `19-itemize-display` got worse). Those two conjuncts are #156's older, coarser form of two conditions this branch already states more precisely two lines above -- `same_list` (which compares level and margins, not merely "no list") and `styled.unwrap_or_ default() == *prev_style`. Keeping them disabled display continuation inside every list. Only `&& !theorem_head`, the genuinely new theorem condition, is kept; display-placement is back to 33/36. Gates (NixOS PC, TeX Live 2025, bundled tree plus nix-store `ec`; no committed oracle data regenerated; zero font diagnostics on every run): - amsmath 59/59, tabular 59/59, display-placement 33/36 -- all unchanged. - theorem_oracle passes (#156's own corpus, MacTeX references). - real-world 10/10 recovered, every page count still equal to its committed reference. lecture-notes drops from 7 diagnostics to 6: a theorem construct that was recovered is now supported. - `cargo test --release` in render-pipeline: the same 11 known failures as before this merge, no more. Eight of them also fail on unmerged origin/main on this machine (the four NewCM controls, metrics_provenance, font_families_oracle, footnotes_oracle, page_frame); the other three (float_bodies, headings, list) have no baseline on a non-MacTeX host. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
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.
Part C of the display-math blockers left by #146. It includes #146's branch (merged in, #146 is not on main yet). It builds only after
vendor/math-layoutis re-pinned to #148 andvendor/compilerto #155. No vendor edits in this PR.What (tex.web §1199-§1205,
typeset.rs/adapter.rs)display_block: a formula too wide beside its number is packed toz - qwith math-layout'sMathBox::pack_towhen its shrink reaches (or any infinite shrink exists). Otherwise the number goes on its own line:\eqnobelow with no\belowdisplayskip,\leqnoabove with no\abovedisplayskip, joined by\penalty10000. The formula alone is packed tozif it is still too wide, andd = 0when it starts with glue. The overfull warning reports what the shrink cannot absorb.layout_kernedbuilds one flat hlist: each run's list is spliced in, and the spacing across a\quadsplit becomes muskip glue, soglue_totalssees every glue of the formula. Positions are unchanged.\taglabels are an\hboxof words with natural interword glue (\maketag@@@). Before, they were one shaped run with T1's visible-space glyph, so a spaced tag was 1.67pt too wide per space.\labelleft in horizontal mode after a display (\begin{subequations}\label{..}) is set as an empty line before the next display, as TeX's line_break does for a whatsit-only list.Evidence (uncommitted scratch copy: vendor math-layout = #148, vendor/compiler = the #146 pin plus #155's parser/xref/supported diff)
\eqref: LaTeX's\sw@slant(latex.ltx 14268-14290, confirmed by\showlists:\kern0.7922before the space) adds the precedingf's italic correction before any upright\text…command. That is a general text-font rule for the text/HW lane, not display math.\tag{$..$}) and 20 (nested list labels) are out of scope.cargo test --release(render-pipeline): 146 passed, 1 ignored, 0 failed.tests/display_placement.rsnow also covers 09, 10, 18 and 33.--v2output to the same build without this commit.fixtures/display-placement/baseline-render-pipeline.jsonis refreshed to 33/36.Re-pin order
vendor/math-layoutandvendor/compiler.vendor/compileron main is behindcrates/compiler; the render-pipeline: display math placement (leqno, fleqn, \eqno, \tag*, after headings, lists; oracle 19→29/36) #146 pipeline does not build against main's newer compiler (Inline::Logo/Rule/Kern,Nucleus::Rule), so the integrator's usual re-pin covers that.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu