Skip to content

render-pipeline tests: \item[<label>] geometry pinned against pdflatex — already 1:1 (#676, PR 2 of 2) - #705

Merged
d-q222 merged 1 commit into
mainfrom
agent/daniel-parent/item-label-geometry
Sep 17, 2026
Merged

d-q222 merged 1 commit into
mainfrom
agent/daniel-parent/item-label-geometry

Conversation

@d-q222

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

Copy link
Copy Markdown
Contributor

What

A pdflatex oracle for the explicit \item[<label>] label — issue #676 point 3 — in all three
list environments at 10pt, with a label that fits \labelwidth and one that does not.

tests/itemize_label_offset.rs pins the default markers (•, 1., (a), …). The explicit
label, the one the owner reports as "not 1:1 all of the time", had no oracle at all. This adds
tests/item_label_explicit_offset.rs and its fixture.

What it pins, in pdflatex's own terms:

  • itemize / enumerate set the label through \makelabel = \hbox to\labelwidth{\hss #1}
    inside \llap. So a short label is right-aligned, ending \labelsep before the body edge
    (Ix at 144.838), and an over-wide one overhangs to the left (IwideLabelHere at 85.727)
    without moving the body — IA and IB share an x.
  • description uses \descriptionlabel = \hspace\labelsep\normalfont\bfseries #1 with
    \labelwidth\z@ and \itemindent-\leftmargin. Both labels are left-flushed at the item's
    indent (133.768 for the short one and the wide one) and the body follows on the same line
    \labelsep after the label ends — so DA and DB deliberately do not share an x.

Those three properties are asserted directly as well as through the coordinates, so a future
regression says which rule it broke rather than just which number moved.

Why

The finding is the point: the geometry half of #676 is already 1:1. The issue's gate is 0.5 bp
on the label x; the engine is within 0.0004 bp on every label and 0.034 bp on every body, in
every environment, short label and over-wide label alike. Nothing needed fixing — but nothing was
holding it either, and the explicit-label path is exactly what the rest of #676 is about to change
(ListGeom.label is due to start carrying inline content instead of a plain string). This is the
pin that has to exist before that lands.

Coordinates read from /Library/TeX/texbin/pdflatex on the fixture with PyMuPDF's
get_texttrace() glyph origins. Tolerance is the suite's usual 0.1 bp, which is already five
times tighter than the issue asks.

Overlap check

Test results

Actual vs pdflatex, printed from the test run (label x, then body x):

              Ix label 144.8379 vs 144.8380 (d=-0.0001)  body 158.6750 vs 158.6760 (d=-0.0010)
  IwideLabelHere label  85.7266 vs  85.7270 (d=-0.0004)  body 158.6750 vs 158.7031 (d=-0.0281)
              Ex label 141.6553 vs 141.6550 (d=+0.0003)  body 158.6750 vs 158.6811 (d=-0.0061)
  EwideLabelHere label  82.5440 vs  82.5440 (d=+0.0000)  body 158.6750 vs 158.7081 (d=-0.0331)
              Dx label 133.7684 vs 133.7680 (d=+0.0004)  body 153.5826 vs 153.5836 (d=-0.0010)
  DwideLabelHere label 133.7684 vs 133.7680 (d=+0.0004)  body 222.3746 vs 222.3953 (d=-0.0207)
item_label_explicit_offset   test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
itemize_label_offset         test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.09s
enumitem_item_text           test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.27s
enumitem_keys_oracle         test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s
enumitem_nextline            test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
list_items                   test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.24s
nested_list_end_skips        test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s

HW1/HW2 through the exact route (flashtex-cli):

test hw1_builds_three_pages_through_the_exact_route ... ok
test hw2_builds_three_pages_through_the_exact_route ... ok
test result: ok. 26 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.30s

This PR adds only a test and a fixture, so no rendered byte can move.

Not done

🤖 Generated with Claude Code

https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

#676)

What changed:
- `tests/item_label_explicit_offset.rs` and its 10pt fixture: the explicit
  `\item[<label>]` label and body origins in itemize, enumerate and
  description, with a label that fits `\labelwidth` and one that does not,
  measured against /Library/TeX/texbin/pdflatex with PyMuPDF glyph origins.
- Only the DEFAULT markers were pinned before (`itemize_label_offset.rs`).
  Issue #676 point 3 asks for the explicit label, which had no oracle at all.
- The result is that the geometry half of #676 is already 1:1: `\makelabel` =
  `\hbox to\labelwidth{\hss #1}` right-aligns a short label and lets a wide
  one overhang left without moving the body, and `\descriptionlabel` flushes
  every label at the item's indent with the body after it on the same line.

What was run:
  Ix label 144.8379 vs 144.8380 (d=-0.0001)  body 158.6750 vs 158.6760 (d=-0.0010)
  IwideLabelHere label 85.7266 vs 85.7270 (d=-0.0004)  body 158.6750 vs 158.7031 (d=-0.0281)
  Ex label 141.6553 vs 141.6550 (d=+0.0003)  body 158.6750 vs 158.6811 (d=-0.0061)
  EwideLabelHere label 82.5440 vs 82.5440 (d=+0.0000)  body 158.6750 vs 158.7081 (d=-0.0331)
  Dx label 133.7684 vs 133.7680 (d=+0.0004)  body 153.5826 vs 153.5836 (d=-0.0010)
  DwideLabelHere label 133.7684 vs 133.7680 (d=+0.0004)  body 222.3746 vs 222.3953 (d=-0.0207)
  test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

Next step: the remaining pipeline half of #676 — `ListGeom.label` carrying the
label's inline content rather than a plain string, so styles and nested math
are set and the clusters point at the bracket text.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
@d-q222
d-q222 merged commit 4a97873 into main Sep 17, 2026
21 of 22 checks passed
d-q222 added a commit that referenced this pull request Sep 17, 2026
 #784

All eight independently reviewed APPROVE. Batch verification: compiler
935/0, render-pipeline 487/0, perf-bench 14/0, perf gate OK (270 metrics,
no regression), swift build --build-tests OK, CompletionTests 29/0.

Commit-Executor: daniel-parent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
ItsAkilesh pushed a commit to ItsAkilesh/flashtex that referenced this pull request Sep 18, 2026
…ash-tex#706)

What changed:
`\end{<list>}` is `\@endparenv`'s `\addvspace\@topsepadd` and the
`\begin{<list>}` beside it is `\@trivlist`'s `\addvspace\@topsep`. Both are
`\addvspace`, so they keep the larger natural skip; the pipeline summed them.
`\@endparenv` also leaves TeX in vertical mode, so the second `\begin` is read
in vertical mode and takes `\partopsep` with no blank line in between; the
pipeline read it as horizontal mode and dropped `\partopsep`.

At 10pt that made a list/list boundary 10pt + 8pt = 18pt where pdflatex puts
max(10pt, 10pt) = 10pt. Every list after the first sat 8pt low and the error
grew 6pt at each further boundary (4 adjacent lists: +7.971, +13.948,
+19.925 bp).

The environment never mattered: `itemize`, `enumerate` and `description` are
all `\list` with `\@listI`'s skips, and `list_seps_from` does not branch on the
name for vertical spacing. flash-tex#706 saw only `itemize` match because `itemize` came
first in its fixture.

New `tests/adjacent_list_skips.rs` pins the adjacency coverage flash-tex#705's oracle
left out: all six orderings of the three environments, all nine ordered pairs,
four of a kind and a mixed chain of four, plus the `\topsep`-only vs
`\topsep`+`\partopsep` pair that separates the two lengths.

What was run:
  cargo test -p render-pipeline --test adjacent_list_skips
    test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
  same test on unfixed origin/main (dbe3cac), to show it catches the bug:
    test result: FAILED. 1 passed; 3 failed; 0 ignored; 0 measured
    ied: bravo: 164.653 bp, pdflatex 156.682 bp (+7.970)
  28-document pdflatex sweep (MacTeX 2026, PyMuPDF glyph origins), engine vs
  pdflatex: worst |dy| = 0.0001 bp, worst |dx| = 0.0379 bp, all within 0.5 bp.

Next step:
Full `cargo test -p render-pipeline` diffed against origin/main for regressions.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
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.

1 participant