Skip to content

fix(abstracts): keep explanations with declarations and reserve footer space (#529) - #749

Merged
SamuelSchlesinger merged 1 commit into
mainfrom
fix/abstracts-pagination-footer-529
Oct 24, 2026
Merged

SamuelSchlesinger merged 1 commit into
mainfrom
fix/abstracts-pagination-footer-529

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

Fixes #529 by resolving three layout and validation defects in the formal-abstract TeX/PDF renderer:

  1. Bottom-aligned declaration measurement (\NewEnviron{leandeclaration}): \begin{minipage}{\linewidth} inside \sbox{\leandeclarationbox} defaulted to [c] vertical centering, splitting the box height equally between \ht\leandeclarationbox and \dp\leandeclarationbox. Because TeX's page builder compares only page_total + \ht against \pagegoal and clamps page depth to \maxdepth (4pt), the bottom half of \leandeclarationbox protruded below \textheight into the provenance footer (yMax = 734.67pt > footer_top = 734.56pt on Page 1 of gsw-security.pdf, Page 1 of communication.pdf, and Page 33 of catalogue.pdf). Switching to \begin{minipage}[b]{\linewidth} places the full height in \ht\leandeclarationbox.
  2. Paragraph preservation and long-declaration breaking (render_tex_paragraphs & render_sections): Splits docstring prose on blank lines (\n\s*\n), joins source-wrapped lines within each paragraph before escaping inline formatting, emits preceding paragraphs above \begin{leandeclaration}, and attaches the complete final explanatory paragraph to short following declarations (< 0.35\textheight). Long declarations (>= 0.35\textheight) remain breakable while avoiding orphaned or mid-paragraph split explanations at the bottom of a page (\ifdim\pagetotal>0.80\textheight\newpage\fi + {\interlinepenalty=10000\BODY\par}).
  3. Footer space reservation and non-text code-box border verification (page_drawn_bounds & build_pdf): Sets bottom=1.1in,footskip=44pt with \widowpenalty=10000 and \clubpenalty=10000, extracts vector path bounding boxes from each page's PDF content stream in page_drawn_bounds, and enforces >= 12pt clearance above the provenance footer (footer_top - y_max >= 12) for both body text and drawn leanbox borders.

Validation & Artifact Evidence

  • All six ./scripts/check.sh gates (lake build --wfail --iofail, lake exe mk_all --check, lake test --wfail --iofail, lake lint, lake exe lint-style, lake exe checkInitImports), python3 -B scripts/check_hygiene.py, python3 -B scripts/build_abstracts.py --check, and all 75 unit and TeX/Poppler integration tests in scripts/test_*.py pass (0 skipped).
  • Clean-checkout PDF builds at commit 1334176d81b3e27326b28ed87161f25906dd69a1 (tree 83ae934ce8dca798a68e689b56b83ecc10af22c8, source_dirty: false) pass all margin and footer-clearance checks across all 14 catalogue abstracts (min_text_clear >= 14.19pt, min_box_clear >= 17.34pt), the 41-page catalogue.pdf (b9cb6e3eace50e94fe95bce52ca690d56ce90a8509b086dd12f380c17ea25cc2), and the 6-page gsw-security.pdf regression fixture (d5d855d88cc3fd369ad2af11a16aafe15ab6c7f7ed5766c116ac06b73b1fb97c, min_text_clear = 35.76pt, min_box_clear = 27.45pt). No generated PDFs are committed.
  • Abstracts assessment: Tooling/renderer fix only; no Lean theorem statements, scope notes, or abstracts/catalogue.json entries changed.
  • AI disclosure & review: Authored by worker-jetski-73aa4b5a (Jetski / Gemini, session 73aa4b5a-fa3d-4195-8024-b19f43bfa557). Independent code and page-by-page visual review of all 25 rendered pages across gsw-security.pdf (6 pages), communication.pdf (2 pages), cook-levin.pdf (5 pages), cryptography.pdf (7 pages), and pcp.pdf (5 pages) at commit 1334176d81b3e27326b28ed87161f25906dd69a1 by non-authoring reviewer subagent 65922026-e5f4-4d9d-830a-78dbd75e3336: APPROVE with no remaining findings.

…r space

Bottom-align the measurement minipage inside `\NewEnviron{leandeclaration}`
(`\begin{minipage}[b]{\linewidth}`) so TeX's page builder counts the full
height of a short declaration and its explanatory paragraph against `\pagegoal`
instead of hiding half the box in depth (`\dp\leandeclarationbox`) and letting
the code box protrude below `\textheight` into the provenance footer.

Split docstring prose into complete LaTeX paragraphs (`render_tex_paragraphs`)
that join source-wrapped lines while preserving blank-line paragraph boundaries,
attach the final explanatory paragraph to short following declarations, prevent
long declarations from orphaning or splitting their explanatory paragraph at the
bottom of a page, and reserve vertical space for the multi-line provenance
footer (`bottom=1.1in,footskip=44pt`).

Extend `build_pdf` with `page_drawn_bounds` to extract vector path bounding
boxes from page content streams and enforce >=12pt clearance above the
provenance footer for both body text and non-text code-box borders.

Closes #529.

Copy link
Copy Markdown
Collaborator Author

Independent coordinator review claimed by coordinator-reviewer-codex-20261023 (not Samuel) at 1334176d81b3e27326b28ed87161f25906dd69a1. I will reuse the reported nonauthor pre-PR review of the 25 representative pages after checking its source/artifact scope, and cover the uncovered renderer/checker and exact-head artifact integration questions. The #666 and #747 safety deltas take priority when ready. No mathematical/catalogue expansion is requested.

Copy link
Copy Markdown
Collaborator Author

Independent coordinator verdict — coordinator-reviewer-codex-20261023 (not Samuel): APPROVED at exact head 1334176d81b3e27326b28ed87161f25906dd69a1.

The paragraph splitter preserves deliberate boundaries and joins wrapped prose before inline escaping. The complete final explanation stays with a short declaration; the long-declaration regression still breaks across pages. Bottom alignment and reserved footer space address the original measured overlap. The new border/text collision negatives pass; independent near-footer probes accept 19.66pt clearance and reject 0.22pt/negative clearance, with border coordinates checked against MuPDF. The vector scanner is scoped to the renderer's current translation-only PGF path format; documenting that limit would be a useful nonblocking clarification.

I adopt reviewer65922026's recorded 25-page pre-PR review at this head. Additional independent review inspected the remaining 29 standalone pages and eight catalogue pages, with no finding. PDF run40064375035, artifact12549016302, has clean-merge provenance naming this PR head; all 34 input and 15 PDF digests match. Abstract source bytes, declaration positions and normalized presentation content are preserved; declaration/source links check out. No catalogue promotion or mathematical change.

All 34 builder tests pass, and CI40064375024 has all six required Lean gates successful. Review outputs were isolated; no shared/full Lean build or duplicate 25-page audit was run. Recheck the exact head before enqueueing; a later source change needs a bounded delta review.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit e5905ed Oct 24, 2026
4 checks passed
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.

fix(abstracts): keep explanations with declarations and reserve footer space

1 participant