# Scoped route-D fidelity goal Start baseline: engine `c6743e2`, 1089 tests, fidelity 0.8944 against `/tmp/texrra-arxiv-reference/template.pdf` (freshly compiled), warm preview 32–50 ms. ## Scope 1. **Page 2/3 flow** — implement a bounded microtype-like text-width expansion/line-fit model for Times body text so 2.1 is six lines and `3.3 Tables` returns to the bottom of page 2. 2. **Display-math internal geometry** — fraction density and sum/script vertical spacing, checked with the arXiv equation bbox. 3. **Float placement** — verify the arXiv and article samples without regressing the Times table column fix. ## Acceptance - 2.1 paragraph: six lines. - `3.3 Tables` on page 2. - Page ink bbox no regression; page 3 right edge 540. - Formula tag `y≈174.9`, formula text span close to `x=132.7..540.7`. - At least 1089 tests; warm arXiv preview under 100 ms. - Fresh TeX-vs-route comparison and fidelity score in the final report. ## Rejected approaches - Vertical glue/space_before swaps: moved sections but never fit 3.3 and lowered the fidelity score. - Uniform 1%/3% body font shrink (9.9/9.7 pt): 3.3 stayed on page 3. - Uniform 3 pt spaces between every top-level math atom: visually over-spaced. ## Planned model A line-level bounded expansion model: allow a small, symmetric glyph-width expansion window during line breaking (microtype-like), record the chosen expansion per line, and apply the same factor when painting PDF/SVG text. This keeps line targets and glyph advances consistent instead of adding overflow or collapsing interword glue. ## First result - Added `ParagraphStyle.line_expansion` (thousandths), per-line `line_scales` on `Paragraph`, and renderer x-advance compression. - Times text uses a 2% expansion window. The 2.1 paragraph is now **six lines** (was seven). Text still renders with visible word spaces. - `3.3 Tables` remains on page 3. The reason is now localized in the page builder: a top float that does not fit flushes the current page at `VerticalItem::Float` instead of deferring only the float, so following text cannot continue on page 2. - Fidelity moved 0.8944 -> 0.8916 because line breaks and `pdftotext` word boundaries changed; this is a geometry/flow tradeoff, not a claimed win. ## Next Defer non-fitting top floats instead of flushing the page, then re-test 3.3.