Skip to content

render-pipeline: build \longmapsto from pieces like the other long arrows (GH-LONGMAPSTO-PIECES, needs #536, completes #603) - #612

Closed
d-q222 wants to merge 2 commits into
mainfrom
agent/daniel-muse-lead/longmapsto-pieces
Closed

d-q222 wants to merge 2 commits into
mainfrom
agent/daniel-muse-lead/longmapsto-pieces

Conversation

@d-q222

@d-q222 d-q222 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Scope

Fixes \longmapsto's width (GH-LONGMAPSTO-PIECES) — completes PR #603's compiler-side symbol mapping. Draft — needs #536 to merge first (this branch is stacked on it: long_arrow_pieces/symbol_atoms/long_arrow only exist there, not on main). No crates/compiler/ or vendor/ touch.

Real semantics confirmed against kernel/amsmath source: \longmapsto = amsmath's \DOTSB\mapstochar\longrightarrow = \mapstochar + \relbar\joinrel\rightarrow (plain.tex). Measured with real pdflatex (TeX Live 2026, 11pt): \mapstochar alone is 0.0pt advance width; \longmapsto alone is 17.64175pt, bit-for-bit identical to \longrightarrow; the $x\longmapsto y$ x-to-y span is 29.9832pt, identical to the existing \longrightarrow test case.

long_arrow_pieces is generalized from a fixed 2-piece (char, char) to &'static [(char, f64)] (glyph, kern-before-in-mu), and long_arrow builds the Rel nucleus from that list — all 6 existing 2-piece arrows are byte-identical joins under the new shape. \longmapsto (U+27FC) gets a 3-piece entry: [U+2223 (this compiler's existing \midglyph, reused as the flag — same font-resource-reuse preference as\textperiodcenteredreusing\cdot's U+00B7, verified via cmsy10.tfm's slot 0x6A= 0.277779em = 5.00002mu), U+2212 (minus/relbar) backed up by −5mu (nets the flag to +0.00002mu ≈ 1e-5pt, i.e. zero width like pdfTeX's zero-advance\mapstochar), U+2192 (rightarrow) with the usual −3mu \joinrel].

The flag DOES show up as a distinct positioned glyph (a normal-advance glyph cancelled by its own kern, not a truly invisible zero-width character), so the painted run is x∣−→y (5 glyphs). One disclosed nuance: the flag paints at the minus's origin (overprinting its left part) rather than at the arrow's extreme left edge like real \mapstochar ink — width and glyph presence are exact; sub-glyph tick placement is approximate, noted for a future visual-fidelity pass.

The new test row spells the literal \u{27FC} character, not the \longmapsto command — the vendored compiler pin on this branch predates #603's COMMAND_GLYPHS row, so the command itself still falls back to an unsupported-command diagnostic today. The literal char exercises the identical symbol_atoms render path. A code comment marks the row to switch to "\\longmapsto" once vendor/compiler is re-pinned past #603.

Overlap check

coord.py claims — held only by daniel-muse-lead. No other in-flight branch/PR on this issue.

Test results

Focused: cargo test --test long_arrows (1 test, includes all 9 arrow cases) and --test math_symbols (12 tests) — both fully green, independently re-run by the supervisor.

Independent mutation check (supervisor-run, fresh CARGO_TARGET_DIR): removed the '\u{27FC}' arm from long_arrow_pieces → long_arrows_are_as_wide_as_pdftex_joins FAILED with the exact reported error (⟼: x, pieces, y: "x⟼y", left: 3, right: 5 — falls back to the single too-narrow LM Math glyph); restored → passes. Matches the lane's own reported mutation result exactly.

Full cargo test in crates/render-pipeline (per the lane, re-verified by cross-checking against the unmodified base): 365 tests pass; 12 pre-existing failures in 4 unrelated binaries (letter_class_geometry, uline, underline_sout, xcolor_oracle — letter-class geometry / underline / xcolor, no math-arrow connection), identical count and identity on the unmodified base with changes stashed. 0 new failures from this PR.

Entry-point check: built flashtex-cli release and ran flashtex check on $x\longmapsto y$ → error[unsupported_feature] \longmapsto is not supported in math mode. This is EXPECTED, not a failure: flashtex-cli links the frozen vendor/compiler, which lacks #603's row until re-pinned; the long_arrows unit test above is the real verification for this PR.

Not done

Follow-up (separate slice, after vendor re-pin past #603): flip the test row from the literal \u{27FC} character to the \longmapsto command spelling, re-run long_arrows + the CLI check (the CLI's not-supported message should disappear) — no render-pipeline code change expected at that point. Also noted, not attempted: the flag's sub-glyph paint-position nuance above.

🤖 Generated with Claude Code

…normalfont are medium

What changed:
- The six long arrows (and so \implies, \iff, \impliedby) are built as
  LaTeX builds them: one relation holding the two cmr/cmsy pieces with
  \joinrel's -3mu between them. They were Latin Modern Math's single
  U+27F5..U+27FA glyphs, 1.457em wide against pdfTeX's 1.611em. On HW1
  Problem 4(b) that shifted the centred display by +0.84/-0.84bp.
- In a directly written heading title, a space with \normalfont words on
  both sides uses the medium font's \fontdimen2 (3.91571pt at \large),
  not the head's bold 4.4989pt. On HW1 "Bonus Problem [1 bonus point]",
  "[1" was 1.15bp left of pdfTeX's position.
- New tests/long_arrows.rs pins pdfTeX's x-to-y distance for all nine
  commands. heading_macros.rs pins the Bonus heading's positions and
  checks the bold/medium spaces around {\normalfont B}. math_symbols.rs
  now expects the composed pieces instead of the fallback glyph.

What was run:
- cargo test --test long_arrows: test result: ok. 1 passed; 0 failed
- cargo test --test heading_macros: test result: ok. 5 passed; 0 failed
- cargo test --test math_symbols: test result: ok. 12 passed; 0 failed
- HW1 glyph diff against pdflatex (TeX Live 2026): lines over 0.5bp went
  from 6 to 2. The 2 left are math-mode TFM kerns (r+comma). 3 pages and
  4 diagnostics, both unchanged.

Next step: math-mode Ord kerns (tex.web §752) in crates/math-layout, then a
vendor re-pin by the integration lane.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…rows (GH-LONGMAPSTO-PIECES)

U+27FC explodes in symbol_atoms to the flag (U+2223, this compiler's \mid
glyph) backed up by its own advance (cmsy10 slot "6A is 5.00002mu, so -5mu
nets ~1e-5pt) plus the usual relbar + joinrel + rightarrow join, matching
pdfTeX's \mapstochar\longrightarrow: the x-to-y span is 29.9832pt,
bit-for-bit the \longrightarrow width. long_arrow_pieces/long_arrow now
take (glyph, kern-before-mu) lists so the 3-piece arrow shares the 2-piece
path. The new long_arrows.rs case spells U+27FC literally until
vendor/compiler is re-pinned past PR #603's ("longmapsto", U+27FC) row.

Implementation-Agent: muse-spark-1.3-contributor
@GoKubar
GoKubar changed the base branch from agent/daniel-parent/hw1-fidelity to main September 15, 2026 15:37
@GoKubar
GoKubar marked this pull request as ready for review September 15, 2026 15:37
GoKubar added a commit that referenced this pull request Sep 15, 2026
… (#649)

* render-pipeline: long arrows are pdfTeX joins; heading spaces after \normalfont are medium

What changed:
- The six long arrows (and so \implies, \iff, \impliedby) are built as
  LaTeX builds them: one relation holding the two cmr/cmsy pieces with
  \joinrel's -3mu between them. They were Latin Modern Math's single
  U+27F5..U+27FA glyphs, 1.457em wide against pdfTeX's 1.611em. On HW1
  Problem 4(b) that shifted the centred display by +0.84/-0.84bp.
- In a directly written heading title, a space with \normalfont words on
  both sides uses the medium font's \fontdimen2 (3.91571pt at \large),
  not the head's bold 4.4989pt. On HW1 "Bonus Problem [1 bonus point]",
  "[1" was 1.15bp left of pdfTeX's position.
- New tests/long_arrows.rs pins pdfTeX's x-to-y distance for all nine
  commands. heading_macros.rs pins the Bonus heading's positions and
  checks the bold/medium spaces around {\normalfont B}. math_symbols.rs
  now expects the composed pieces instead of the fallback glyph.

What was run:
- cargo test --test long_arrows: test result: ok. 1 passed; 0 failed
- cargo test --test heading_macros: test result: ok. 5 passed; 0 failed
- cargo test --test math_symbols: test result: ok. 12 passed; 0 failed
- HW1 glyph diff against pdflatex (TeX Live 2026): lines over 0.5bp went
  from 6 to 2. The 2 left are math-mode TFM kerns (r+comma). 3 pages and
  4 diagnostics, both unchanged.

Next step: math-mode Ord kerns (tex.web §752) in crates/math-layout, then a
vendor re-pin by the integration lane.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* compiler: implement \obeylines as group-scoped forced line breaks (#588)

Each source newline lowers to the existing \\-primitive (Inline::LineBreak), scoped like the centering/ragged declarations; blank lines still end the paragraph and surrounding spaces are not preserved. Adds crates/compiler/tests/obeylines.rs and regenerates the supported-LaTeX inventory. Nothing under crates/render-pipeline/ touched.

Implementation-Agent: muse-spark-1.3-contributor

* render-pipeline: build \longmapsto from pieces like the other long arrows (GH-LONGMAPSTO-PIECES)

U+27FC explodes in symbol_atoms to the flag (U+2223, this compiler's \mid
glyph) backed up by its own advance (cmsy10 slot "6A is 5.00002mu, so -5mu
nets ~1e-5pt) plus the usual relbar + joinrel + rightarrow join, matching
pdfTeX's \mapstochar\longrightarrow: the x-to-y span is 29.9832pt,
bit-for-bit the \longrightarrow width. long_arrow_pieces/long_arrow now
take (glyph, kern-before-mu) lists so the 3-piece arrow shares the 2-piece
path. The new long_arrows.rs case spells U+27FC literally until
vendor/compiler is re-pinned past PR #603's ("longmapsto", U+27FC) row.

Implementation-Agent: muse-spark-1.3-contributor

* render-pipeline: align list labels with pdflatex

What changed:
- Preserve list-symbol weight and glyph identity from the compiler.
- Use Latin Modern font dimensions for list margins and honor left-extending label boxes.
- Add pdflatex-pinned itemize, enumerate, and description origin probes.

What was run:
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-itemlabel CARGO_BUILD_JOBS=4 cargo build --bin flashtex-render
- Focused render-pipeline list oracle tests
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-itemlabel CARGO_BUILD_JOBS=4 cargo test --lib

Next step:
- Parent lane can review and integrate this commit.

Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: codex (this session)
Lane-Owner: daniel-parent (mac-m5pro-dq222)

* pdf: add marked ActualText groups

What changed:
- Added typed exact-route marked-content operators with UTF-16BE ActualText encoding.
- Added optional v2 glyph_run actual_text grouping across font and BT/ET switches.
- Documented the field and added syntax, byte-identity, and PyMuPDF tests.

What was run:
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-actualtext CARGO_BUILD_JOBS=4 cargo test --manifest-path crates/pdf/Cargo.toml --lib --tests
- git diff --cached --check

Next step:
- render-pipeline can populate actual_text after the vendor/pdf re-pin.

Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: codex (this session)
Lane-Owner: daniel-parent (mac-m5pro-dq222)

* render-pipeline: enumitem labelsep, itemindent, widest and register leftmargin follow \enit@calcleft

What changed:
- Read enumitem `labelsep=`, `itemindent=` and `widest=` per list level
  (itemize/enumerate). With `leftmargin=*` the margin is
  `\labelwidth + \labelsep - \itemindent` (new `ListMargin::WidestSep`);
  otherwise `labelsep` moves only the label and `itemindent` the first
  line and its label. `\labelsep` is inherited by nested lists.
- `leftmargin=\len` resolves a preamble `\setlength` or `\settowidth`
  register (new `ListMargin::TextWidth`).
- `ListGeom` gains `labelsep_pt` and `itemindent_pt` at the end.
- New pdflatex-pinned oracle `tests/enumitem_item_text.rs` (10/11/12pt).
- The enumitem-worksheet +1.17bp item-text shift from the #609 sweep is
  already gone on #611's head (it was `\leftmargin<i>` in a 12pt em rather
  than lmr12's 11.74994pt quad); rows a-c pin it.

What was run:
- cargo test --release --test enumitem_item_text: test result: ok. 1 passed; 0 failed
- Without the src change the same test fails on 37 rows (e.g. K12e text: 101.265 vs pdflatex 112.981).

Next step:
- Full render-pipeline release suite, then PR stacked on #611.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: itemize TS1 symbols take tcrm's widths without lmodern

What changed:
- Without lmodern (OT1 or T1 body text), \textbullet, \textasteriskcentered
  and \textperiodcentered are TS1 tcrm, whose widths are the cmsy designs
  (0.499878/0.499878/0.27771 at 10pt), not ts1-lmr's 0.7778em bullet and
  period. Label boxes now take the tcrm advance (transcribed tcrm CHARWD at
  all 14 EC sizes, fonts::tcrm_symbol_width). The bullet and centred period
  are drawn with Latin Modern Math's U+2022/U+00B7, which are cmsy's glyphs
  (ink matches pdflatex's SFRM1000 to 0.03bp); the asterisk keeps LM Roman.
- leftmargin=* on itemize measures the class labels as \labelitemi..iv set
  them: the tcrm widths, and \labelitemii's en dash in bold (was regular,
  0.75pt short even with lmodern).
- Class \leftmargin<i> under T1 cmr use OT1 cmr's em (the class sets them
  before fontenc), fixing a 0.15bp shift at 11pt.
- New oracle tests/itemize_ts1_symbols.rs (OT1/T1/lmodern x 10/11/12pt,
  levels 1-4, default and leftmargin=*); enumitem_item_text now gates the
  K..j bullet x.

What was run:
- cargo test --release --no-fail-fast (render-pipeline): 82 binaries, 378 passed, 0 failed, 3 ignored
- itemize_ts1_symbols: test result: ok. 1 passed; 0 failed (78 mismatches before the src change)
- enumitem_item_text, enumitem_keys_oracle, itemize_label_offset, list_items, description_env, description_display: all ok

Next step: Times documents' TS1 symbols and class em are unmeasured.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* integration fix: math_symbols reads Page::items through #294's accessor

#294 replaced Page's items field with PageContent plus an items()
accessor; tests/math_symbols.rs still took the field, so the test
target failed to compile (E0615) and its 18 tests silently did not run.
Broken on main itself as well -- fixed there in #664.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

---------

Co-authored-by: d-q222 <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Closing: landed on main via integration PR #649 (commit 79c83aa7).

Verified by feature content, not ancestry (origin/agent/daniel-muse-lead/longmapsto-pieces is not an ancestor of main after the squash). Markers specific to this PR rather than to #536 which it stacks on: main's crates/render-pipeline/src/typeset.rs:7548 builds \longmapsto (U+27FC) from the three pieces ('\u{2223}', 0.0), ('\u{2212}', -5.0), ('\u{2192}', -3.0) with the amsmath \mapstochar\longrightarrow derivation in the comment above it, and crates/render-pipeline/tests/long_arrows.rs:52 carries the GH-LONGMAPSTO-PIECES assertion. This also completes #603.

@GoKubar GoKubar closed this Sep 15, 2026
@GoKubar
GoKubar deleted the agent/daniel-muse-lead/longmapsto-pieces branch September 16, 2026 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants