Repository navigation
compiler: page and paragraph control commands as penalty, discretionary and parameter nodes (#64) - #568
Merged
Conversation
…ry and parameter nodes (#64) What changed: - New AST: Inline::Penalty {value, unskip} (\penalty, \nobreak, \allowbreak, \linebreak[n], \nolinebreak[n]), Inline::PagePenalty (\pagebreak[n] and \nopagebreak[n] inside a paragraph: \vadjust, the paragraph is not broken), Inline::Discretionary (\-, \discretionary{}{}{}), Block::Penalty {value, fil} (vertical-mode \penalty/\nobreak, \pagebreak[n<4], \nopagebreak[n], \goodbreak, \filbreak). Values are latex.ltx's \@getpen 0/51/151/301/10000. - Parsed::parameters: \tolerance, \pretolerance, \looseness, \widowpenalty, \clubpenalty, \interlinepenalty, \emergencystretch (also \setlength), \sloppy, \fussy, sloppypar, \samepage (and its environment), \raggedbottom, \flushbottom, \enlargethispage(*), each with the group end that restores it. Parsed::hyphenation: \hyphenation words. - \- is a command in the lexer and the expansion pass, so it is never typeset as a hyphen; \penalty's number and parameter values no longer leak as text. - Core 14 layout: forced penalties break lines/pages; \pagebreak in a paragraph ends the page after its line (FlowState carries the pending eject). - Inventory, vocabulary and generated supported-LaTeX artefacts regenerated. What was run: - cargo test (crates/compiler): 573 passed; 0 failed before the inventory move, then --lib: test result: ok. 347 passed; 0 failed - --test supported_latex: test result: ok. 8 passed; 0 failed - --test hw1_preamble/hw2_gate/corpus_gate/pinned_fixtures/incremental_json_identity/ local_recovery/preamble_page_commands/line_break_skip: all ok - pdflatex \showlists / \showthe oracle for every value (in the PR body). Next step: render-pipeline consumes the nodes after vendor/compiler is re-pinned. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
#64) What changed: - Inline::Penalty/PagePenalty spans now include `[n]` and `\penalty`'s number, so a consumer reading the source after a node starts past them (the pipeline decides whether LaTeX ate the blanks after the command from this). What was run: - cargo test --lib (crates/compiler): test result: ok. 347 passed; 0 failed Next step: open the compiler PR and the render-pipeline draft. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
This was referenced Sep 15, 2026
Merged
Kept both sides of the supported.rs inventory (main's \xspace entry plus this branch's penalty-based page/paragraph-control entries) and regenerated docs/user/compiler.md, supported-latex.json, coverage.md and the Mac bundled copy via render_supported_latex.sh. Implementation-Agent: fable-rebase-c Commit-Executor: fable-rebase-c (direct; Cursor usage limit)
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
…followups Brings in origin/main via the parent PR #568 branch's merge commit; regenerated docs/user/compiler.md and the supported-latex inventories. Implementation-Agent: fable-rebase-c Commit-Executor: fable-rebase-c (direct; Cursor usage limit)
Kept main's \fnsymbol dispatch arm alongside this branch's penalty-based \linebreak/\nolinebreak arms; regenerated the supported-latex artefacts. Implementation-Agent: fable-rebase-c Commit-Executor: fable-rebase-c (direct; Cursor usage limit)
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
…wups Records the parent PR #568 branch's own origin/main merge; no tree changes. Implementation-Agent: fable-rebase-c Commit-Executor: fable-rebase-c (direct; Cursor usage limit)
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
…rew the inventory docs/user/compiler.md (generated) conflicted once more after main's page and paragraph control commands (#568) landed. Took main's copy and regenerated via crates/compiler/scripts/render_supported_latex.sh so \Box and main's additions both appear; Mac bundled supported-latex.json synced, --check clean. Implementation-Agent: fable-rebase-a Commit-Executor: fable-rebase-a (direct; Cursor usage limit)
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
/#568) Conflicts: - crates/compiler/src/parser.rs: both sides appended P fields; kept both. - crates/compiler/src/expansion.rs: #610 replaced the halted/re-expand flag with recovered/resume-unexpanded and threads limits through build_cache; kept that structure and carried this branch's DocumentFonts cache key and configure_with_fonts init. - crates/tex-expansion/src/expand.rs, incremental.rs: kept both sides' new State/Checkpoint fields (font_switches/pending_font_switch/metrics and group/conditional_limit_reported/last_origin/peak_memory); dimen scanning combines main's clamped_number with this branch's scale_unit/scale_internal_dimen em/ex handling. Regenerated supported-latex artifacts; bundled copy in sync. Implementation-Agent: fable-rebase-d Commit-Executor: fable-rebase-d (direct; Cursor usage limit)
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
Parent #568 is squashed on main; kept this branch's own changes (nobreakdash, bare-penalty vertical \pagebreak, doc comments) over the squash and main's #610 parser changes. Regenerated the supported-latex artefacts. Implementation-Agent: fable-rebase-c Commit-Executor: fable-rebase-c (direct; Cursor usage limit)
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
…fields The #568 squash and this branch both carried pagebreak_inside_a_paragraph_ends_the_page_after_its_line_not_the_paragraph (byte-identical); kept one. kernel_untested_b.rs's Block::VSpace pattern now ignores #606's stretch_pt/shrink_pt (it asserts only pt) - note main's tip has the same flat pattern and needs the same fix. Implementation-Agent: fable-rebase-c Commit-Executor: fable-rebase-c (direct; Cursor usage limit)
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
…NMENTS; regenerate docs; fix main's VSpace pattern break crates/compiler/src/vocabulary.rs conflicted because this branch removed dcases/rcases (now implemented here) while main removed samepage/sloppypar (implemented by #568); kept both removals (the intersection). docs/user/compiler.md and the supported artefacts were regenerated via render_supported_latex.sh; Mac bundled copy sync --check clean. Also carries the one-line semantic fix current main needs: #606 added stretch_pt/shrink_pt to Block::VSpace but tests/kernel_untested_b.rs:251 still matched 'Block::VSpace { pt }' (E0027); widened to '{ pt, .. }'. Implementation-Agent: fable-rebase-a Commit-Executor: fable-rebase-a (direct; Cursor usage limit)
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
…NMENTS; regenerate docs; fix main's VSpace pattern break crates/compiler/src/vocabulary.rs conflicted because this branch removed 'frame' (implemented here) while main removed samepage/sloppypar (implemented by #568); kept both removals. Regenerated the supported-latex artefacts via render_supported_latex.sh; Mac bundled copy sync --check clean. Also the one-line fix current main needs: tests/kernel_untested_b.rs:251 'Block::VSpace { pt }' fails E0027 after #606 added stretch_pt/shrink_pt; widened to '{ pt, .. }'. Implementation-Agent: fable-rebase-a Commit-Executor: fable-rebase-a (direct; Cursor usage limit)
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
…#64; stacked on #568) (#583) * compiler: page and paragraph control commands as penalty, discretionary and parameter nodes (#64) What changed: - New AST: Inline::Penalty {value, unskip} (\penalty, \nobreak, \allowbreak, \linebreak[n], \nolinebreak[n]), Inline::PagePenalty (\pagebreak[n] and \nopagebreak[n] inside a paragraph: \vadjust, the paragraph is not broken), Inline::Discretionary (\-, \discretionary{}{}{}), Block::Penalty {value, fil} (vertical-mode \penalty/\nobreak, \pagebreak[n<4], \nopagebreak[n], \goodbreak, \filbreak). Values are latex.ltx's \@getpen 0/51/151/301/10000. - Parsed::parameters: \tolerance, \pretolerance, \looseness, \widowpenalty, \clubpenalty, \interlinepenalty, \emergencystretch (also \setlength), \sloppy, \fussy, sloppypar, \samepage (and its environment), \raggedbottom, \flushbottom, \enlargethispage(*), each with the group end that restores it. Parsed::hyphenation: \hyphenation words. - \- is a command in the lexer and the expansion pass, so it is never typeset as a hyphen; \penalty's number and parameter values no longer leak as text. - Core 14 layout: forced penalties break lines/pages; \pagebreak in a paragraph ends the page after its line (FlowState carries the pending eject). - Inventory, vocabulary and generated supported-LaTeX artefacts regenerated. What was run: - cargo test (crates/compiler): 573 passed; 0 failed before the inventory move, then --lib: test result: ok. 347 passed; 0 failed - --test supported_latex: test result: ok. 8 passed; 0 failed - --test hw1_preamble/hw2_gate/corpus_gate/pinned_fixtures/incremental_json_identity/ local_recovery/preamble_page_commands/line_break_skip: all ok - pdflatex \showlists / \showthe oracle for every value (in the PR body). Next step: render-pipeline consumes the nodes after vendor/compiler is re-pinned. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz * compiler: penalty nodes' spans cover their number and priority bracket (#64) What changed: - Inline::Penalty/PagePenalty spans now include `[n]` and `\penalty`'s number, so a consumer reading the source after a node starts past them (the pipeline decides whether LaTeX ate the blanks after the command from this). What was run: - cargo test --lib (crates/compiler): test result: ok. 347 passed; 0 failed Next step: open the compiler PR and the render-pipeline draft. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz * compiler: \include clears the page, vertical \pagebreak is a bare penalty, \nobreakdash (#64) What changed: - \include{file} emits latex.ltx \@include's \clearpage before the file and after it (expansion.rs: the closing one precedes the first token read once the engine has left the file). A file \includeonly skips keeps only the first; a missing file keeps both. \input is unchanged. - A vertical-mode \pagebreak (priority 4) is Block::Penalty { value: -10000 } instead of Block::PageBreak: latex.ltx has no \vfil before it, unlike \newpage, so a \flushbottom page it ends is stretched. - amsmath \nobreakdash: the following -, -- or --- as text, then Inline::Penalty 10000 (\setboxz@h{--\nobreak}\unhbox\z@). Supported-LaTeX artefacts regenerated. What was run: - cargo test --lib: test result: ok. 349 passed; 0 failed - cargo test --no-fail-fast (whole crate): every target ok after render_supported_latex.sh (supported_latex: ok. 8 passed; includeonly: ok. 10 passed) - pdflatex probes with the render pipeline (scratch export): include 3/3 pages, include-para, include-two 4, include-last 2, includeonly-excluded 2: all match. Next step: render-pipeline draft consumes the bare penalty (flushbottom) and \nobreakdash's hyphenation; vendor re-pin past #568 and this PR. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz * compiler: leave \include's page breaks to #578 (#64) What changed: - Reverted the \include \clearpage emission in expansion.rs and the includeonly test changes from the previous commit: #578 (render pipeline, agent/daniel-parent/include-float-numbering) already clears the page before and after an \include'd file, and the coordinator moved that item there. The vertical \pagebreak penalty and \nobreakdash stay. What was run: - cargo test --lib: test result: ok. 349 passed; 0 failed - cargo test --test includeonly: test result: ok. 9 passed; 0 failed - cargo test --test supported_latex: test result: ok. 8 passed; 0 failed Next step: render-pipeline draft for \pagebreak under \flushbottom, \nobreakdash hyphenation, \enlargethispage and the \clearpage float flush. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz * Post-merge fixups: dedupe squashed test, VSpace pattern gains rubber fields The #568 squash and this branch both carried pagebreak_inside_a_paragraph_ends_the_page_after_its_line_not_the_paragraph (byte-identical); kept one. kernel_untested_b.rs's Block::VSpace pattern now ignores #606's stretch_pt/shrink_pt (it asserts only pt) - note main's tip has the same flat pattern and needs the same fix. Implementation-Agent: fable-rebase-c Commit-Executor: fable-rebase-c (direct; Cursor usage limit) --------- Co-authored-by: GoKubar <[email protected]>
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
Parents #568/#583 are squashed on main; kept this branch's own mode-based horizontal-\pagebreak logic, comment and test over the squash state, and took main's #587 parser state fields (length_scopes, pending_global, latin_modern, preamble_latin_modern). Regenerated supported-latex artefacts. Implementation-Agent: fable-rebase-c Commit-Executor: fable-rebase-c (direct; Cursor usage limit)
GoKubar
added a commit
that referenced
this pull request
Sep 15, 2026
…rizontal (GH-PAGEBREAK-MIDPARAGRAPH; stacked on #583) (#616) * compiler: page and paragraph control commands as penalty, discretionary and parameter nodes (#64) What changed: - New AST: Inline::Penalty {value, unskip} (\penalty, \nobreak, \allowbreak, \linebreak[n], \nolinebreak[n]), Inline::PagePenalty (\pagebreak[n] and \nopagebreak[n] inside a paragraph: \vadjust, the paragraph is not broken), Inline::Discretionary (\-, \discretionary{}{}{}), Block::Penalty {value, fil} (vertical-mode \penalty/\nobreak, \pagebreak[n<4], \nopagebreak[n], \goodbreak, \filbreak). Values are latex.ltx's \@getpen 0/51/151/301/10000. - Parsed::parameters: \tolerance, \pretolerance, \looseness, \widowpenalty, \clubpenalty, \interlinepenalty, \emergencystretch (also \setlength), \sloppy, \fussy, sloppypar, \samepage (and its environment), \raggedbottom, \flushbottom, \enlargethispage(*), each with the group end that restores it. Parsed::hyphenation: \hyphenation words. - \- is a command in the lexer and the expansion pass, so it is never typeset as a hyphen; \penalty's number and parameter values no longer leak as text. - Core 14 layout: forced penalties break lines/pages; \pagebreak in a paragraph ends the page after its line (FlowState carries the pending eject). - Inventory, vocabulary and generated supported-LaTeX artefacts regenerated. What was run: - cargo test (crates/compiler): 573 passed; 0 failed before the inventory move, then --lib: test result: ok. 347 passed; 0 failed - --test supported_latex: test result: ok. 8 passed; 0 failed - --test hw1_preamble/hw2_gate/corpus_gate/pinned_fixtures/incremental_json_identity/ local_recovery/preamble_page_commands/line_break_skip: all ok - pdflatex \showlists / \showthe oracle for every value (in the PR body). Next step: render-pipeline consumes the nodes after vendor/compiler is re-pinned. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz * compiler: penalty nodes' spans cover their number and priority bracket (#64) What changed: - Inline::Penalty/PagePenalty spans now include `[n]` and `\penalty`'s number, so a consumer reading the source after a node starts past them (the pipeline decides whether LaTeX ate the blanks after the command from this). What was run: - cargo test --lib (crates/compiler): test result: ok. 347 passed; 0 failed Next step: open the compiler PR and the render-pipeline draft. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz * compiler: \include clears the page, vertical \pagebreak is a bare penalty, \nobreakdash (#64) What changed: - \include{file} emits latex.ltx \@include's \clearpage before the file and after it (expansion.rs: the closing one precedes the first token read once the engine has left the file). A file \includeonly skips keeps only the first; a missing file keeps both. \input is unchanged. - A vertical-mode \pagebreak (priority 4) is Block::Penalty { value: -10000 } instead of Block::PageBreak: latex.ltx has no \vfil before it, unlike \newpage, so a \flushbottom page it ends is stretched. - amsmath \nobreakdash: the following -, -- or --- as text, then Inline::Penalty 10000 (\setboxz@h{--\nobreak}\unhbox\z@). Supported-LaTeX artefacts regenerated. What was run: - cargo test --lib: test result: ok. 349 passed; 0 failed - cargo test --no-fail-fast (whole crate): every target ok after render_supported_latex.sh (supported_latex: ok. 8 passed; includeonly: ok. 10 passed) - pdflatex probes with the render pipeline (scratch export): include 3/3 pages, include-para, include-two 4, include-last 2, includeonly-excluded 2: all match. Next step: render-pipeline draft consumes the bare penalty (flushbottom) and \nobreakdash's hyphenation; vendor re-pin past #568 and this PR. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz * compiler: leave \include's page breaks to #578 (#64) What changed: - Reverted the \include \clearpage emission in expansion.rs and the includeonly test changes from the previous commit: #578 (render pipeline, agent/daniel-parent/include-float-numbering) already clears the page before and after an \include'd file, and the coordinator moved that item there. The vertical \pagebreak penalty and \nobreakdash stay. What was run: - cargo test --lib: test result: ok. 349 passed; 0 failed - cargo test --test includeonly: test result: ok. 9 passed; 0 failed - cargo test --test supported_latex: test result: ok. 8 passed; 0 failed Next step: render-pipeline draft for \pagebreak under \flushbottom, \nobreakdash hyphenation, \enlargethispage and the \clearpage float flush. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz * compiler: \pagebreak right after \noindent, \indent or \textbf{ is horizontal (GH-PAGEBREAK-MIDPARAGRAPH) What changed: - The `\pagebreak`/`\nopagebreak` arm decided the mode from whether the paragraph had collected any inline. `\noindent`, `\indent` and the text font commands (`\hmode@bgroup` = `\leavevmode\bgroup`) start the paragraph without adding one, so `\noindent\pagebreak text` was a vertical penalty before the paragraph (on an empty page it was dropped entirely). A new parser flag `paragraph_started` is set by those commands and cleared when a block is pushed or the paragraph is flushed; with it set the command is `Inline::PagePenalty` (latex.ltx `\@no@pgbk`'s `\vadjust`). - A paragraph holding only `\label`s is still vertical: `\label{a}\pagebreak text` is a `Block::Penalty` again. pdflatex (TeX Live 2026, article): `\noindent\pagebreak`, `\indent\pagebreak` and `\textbf{\pagebreak Bold}` before a two-line paragraph end page 1 after the paragraph's first line; `\label{a}\pagebreak` ends it before the paragraph. A mid-paragraph `\pagebreak` (inline, on its own line, `[1]`, `[2]`, `\nopagebreak`) was already right on this stack. What was run: - cargo test --lib -- pagebreak: test result: ok. 6 passed; 0 failed - cargo test (crates/compiler): see the PR Next step: re-pin vendor/compiler for the pipeline tests in the stacked pipeline PR. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz --------- Co-authored-by: GoKubar <[email protected]>
ItsAkilesh
pushed a commit
to ItsAkilesh/flashtex
that referenced
this pull request
Sep 18, 2026
What changed: - `crates/render-pipeline/Cargo.toml` declares a new off-by-default feature `compiler-node-surface`. It carries no behaviour of its own: every arm it adds is the inert answer the pipeline already gave for a compiler node the current pin (`c95977d6`) cannot produce. - The pipeline's exhaustive matches and node constructors now cover main's compiler surface behind that feature: `parser::Block::Penalty`/`Tabbing`, `parser::Inline::ThePage`/`PageNumbering`/`TabStop`/`TabJump`/`Marginpar`/ `Penalty`/`PagePenalty`/`Discretionary`, `VSpace`/`HSpace` glue components, `math::Nucleus::TextRun`/`SideSet`/`Lap` and `math::Accent::Mathring` (compiler flash-tex#549, flash-tex#551, flash-tex#555, flash-tex#568, flash-tex#581, flash-tex#583, flash-tex#587, flash-tex#606, flash-tex#616). `adapter::vspace_block` is a new cfg'd constructor beside the existing `line_break_inline`; the one open-coded `Inline::LineBreak { .. }` left in the `\opening` lowering now goes through `line_break_inline` too. - `tabbing` is lowered to flush-left paragraphs with one `unsupported_block` limitation, the way `LetterBlock` is, so no row is dropped by the re-pin. - `docs/integration/repin-runbook.md`: the exact re-pin commands, the three vendor directories that must move (`compiler`, `tex-expansion`, and a new `bibliography`), the lockfile and `#[ignore]` edits `--locked` CI needs, the measured test deltas and the PRs the pin unblocks. No file under `vendor/` is touched: the vendor swap used to measure all of this was scratch-only and reverted. `git diff --stat origin/main...HEAD` contains zero `vendor/` paths. What was run: Whole `crates/render-pipeline` suite, CARGO_BUILD_JOBS=4, --no-fail-fast: origin/main, pinned vendor, feature off: 469 passed, 13 failed this branch, pinned vendor, feature off: 469 passed, 13 failed (same 13) this branch, vendor re-pinned, feature on: 485 passed, 0 failed The 13 red-on-main tests (letter_class_geometry x5, frame_env, underline_sout x4, uline x2, xcolor_oracle) all pass after the re-pin. Two re-pin-gated #[ignore]s also pass against the re-pinned vendor: test frame_draws_a_rule_border_around_its_content ... ok test coloneqq_decomposes_like_mathtools ... ok crates/flashtex-cli against the same re-pinned vendor: test result: ok. 58 passed; 0 failed cargo check --all-targets on this branch at the current pin: 0 errors. Next step: The integration lane applies docs/integration/repin-runbook.md section 3 -- swap the three vendor trees, move `compiler-node-surface` (and `linebreak-skip`) into `default`, refresh both Cargo.locks, drop the two `#[ignore]`s, update vendor/VENDORING.md. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
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.
What
Compiler side of issue #64: the page and paragraph control commands become nodes and parameters the render pipeline can act on, instead of unknown commands whose numbers leak onto the page.
crates/compiler/src/parser.rs):Inline::Penalty { value, span, unskip }:\penalty,\nobreak,\allowbreak,\linebreak[n],\nolinebreak[n](latex.ltx\@getpen0/51/151/301/10000;unskipis\@no@lnbk's space move).Inline::PagePenalty { value, span }:\pagebreak[n]/\nopagebreak[n]inside a paragraph (\vadjust). The paragraph is no longer broken.Inline::Discretionary { pre, post, nobreak, hyphen, span, style }:\-(now a command in the lexer and the expansion pass, never a hyphen character) and\discretionary{}{}{}.Block::Penalty { value, fil, span }: vertical-mode\penalty/\nobreak/\allowbreak,\pagebreak[n<4],\nopagebreak[n],\goodbreak,\filbreak.Parsed::parameters(BreakParameter+ the group end that restores it):\tolerance,\pretolerance,\looseness,\widowpenalty,\clubpenalty,\interlinepenalty,\emergencystretch(also\setlength),\sloppy,\fussy,sloppypar,\samepage(command and environment),\raggedbottom,\flushbottom,\enlargethispage(*)(includingn\baselineskip).Parsed::hyphenation:\hyphenationwords.\pagebreakinside a paragraph ends the page after its line (FlowStatecarries the pending eject).render_supported_latex.sh(kernel coverage 183/410 -> 190/410).Why
pdflatex evidence (full table below):
\-was painted as a hyphen,\penalty10000typeset10000,\pagebreakinside a paragraph split it and added a page,\linebreakwas set ragged, and 15 of the 24 audited commands were unsupported. The render pipeline builds againstvendor/compiler, so this PR changes no rendered output by itself. The companion draft render-pipeline PR consumes these nodes and needs a re-pin ofvendor/compilerpast this PR.Overlap check
gh pr list --state open --searchfor every audited command name. None implements these commands. Hits were unrelated uses: render-pipeline: charge \brokenpenalty, and set the float column's glue (vertical parity) #356 (topskip,\brokenpenalty), compiler: longtable, multirow, booktabs extras and colortbl colours in tables #173/render-pipeline: longtable, multirow, cmidrule trims and colortbl fills #176/render-pipeline: longtable regions through footnote and float pagination #184/render-pipeline: \@makecol packs the whole float+footnote column to \@colht (extends #154) #192/render-pipeline: \@makecol packs the whole float+footnote column to \@colht (rebase of #192 onto current main) #284 (longtable/float columns), render-pipeline: \maketitle layout, titlepage, twocolumn title, book matter #114/render-pipeline: sectioning headings from class-geometry's \@startsection specs (oracle 38/41 exact) #151 (maketitle/headings), compiler: the tie is a space, not a tilde #332 (tie), compiler: soul \so letterspacing and \hl highlight (#502) #513 (soul), render-pipeline: strike cancel/bcancel/xcancel corner-to-corner — needs #514 re-pin (#500) #515 (cancel). Also FT-070: engine performance harness, committed baseline and a >5% regression gate #206 (perf harness, its own crate, no shared files).\addvspace: compiler: \addvspace inserts vertical space (documented simplification) #504 edits the same generated inventory files, so expect a regenerate-only conflict), render-pipeline:\\[<dimen>]inside a\newcommandbody is a real skip (needs the #478 re-pin) #479/render-pipeline: an amsthm theorem is a \trivlist — it has \topsep #480/render-pipeline: an alignment right after a heading has no line above it #483 (integration vertical spacing, merged).coord.py claims: compiler: page and paragraph control commands audit #64-PAGE-PARA-CONTROL claimed by daniel-parent. No other claim on these commands.agent/daniel-parent/page-controllane) predates the render pipeline. Its\linebreak/\pagebreakarms are replaced here by pdflatex-exact nodes.Test results
New tests, each pinned to pdflatex
\showlists/\showtheor its PDF:horizontal_penalties_carry_latex_values,vertical_penalties_are_blocks_with_latex_values,goodbreak_ends_the_paragraph_it_is_written_in,vertical_penalty_forces_a_page_only_at_eject,penalty_line_break_is_still_a_line_break_in_the_core14_layout,discretionaries_are_nodes_not_text,breaking_parameters_are_reported_with_their_scope,pagebreak_inside_a_paragraph_ends_the_page_after_its_line_not_the_paragraph.pagebreak_at_default_or_explicit_priority_four_forces_a_fresh_pagenow puts the command between paragraphs: pdflatex setsFirst page\pagebreak Second pageon one page. They fail first on origin/main: the node tests do not compile there (no such variants), and the layout assertions (1 page for an in-paragraph\pagebreak, no-item formanu\-scripts, no10000text) contradict main's output (main's own test asserted 2 pages).cargo clippy --all-targets -D warningsandcargo fmt --checkare not clean on origin/main (20 clippy findings, 119 rustfmt hunks in parser.rs). None of the clippy findings are in lines this PR adds. Only this PR's own hunks were formatted.Not done
vendor/compilerre-pin (integrator action).\nobreakdash(amsmath, 6 files): untouched.\discretionarykeeps only the plain text of its arguments.\samepagereports only\interlinepenalty(not its list, display and section penalties).\enlargethispageand\loosenessare parsed and reported here, but the pipeline does not apply them (see the draft PR).Audit: page and paragraph control commands (GH-64)
State on
origin/main@36fe7ec3, measured withflashtex check/build(render pipeline, vendor compiler pinc95977d6) against pdflatex (TeX Live 2026,article10pt,\pagestyle{empty}). Line and page outcomes were read from both PDFs with PyMuPDF (words grouped by baseline) on engineered documents; each engineered probe was checked to discriminate (pdflatex sets different lines/pages without the command). Node values come from pdflatex\showlists/\showthe."After" is the compiler PR plus the render-pipeline draft, built together in a scratch export with
vendor/compilerreplaced by the compiler branch (the repository'svendor/is untouched).Usage = files using the command among the 12,038
.texfiles of TeX Live 2026texmf-dist/doc(real documents; the in-repo corpus has almost none of these commands).\newpagea\newpage b: 2 pages (FlashTeX 2)\clearpagea\clearpage b: 2 pages (FlashTeX 2)\-manu-scripts)Inline::Discretionary; a flagged\hyphenpenaltybreak with the face's hyphen, invisible unbroken; the word gets no automatic points (TeX §899)manuscripts; engineered: line 1 endsqwrtzp-, with 2 morexxin frontqwrtzplkjhgfdstarts line 2\pagebreak[n][n<4]still forces a pageBlock::PageBreak(n=4) /Block::Penalty-\@getpen{n}; in a paragraphInline::PagePenaltyafter the line it is set ona\pagebreak{} banda\pagebreak[1] b: one linea b, 1 page (FlashTeX 2);a\par\pagebreak[1] b: 1 page (FlashTeX 2);\showlists:\vadjust\penalty -10000\nobreakunknown_commanderror)Inline::Penalty/Block::Penalty10000Figure\nobreak\ 7: line 1 endsFigure 7; between paragraphs 46/47: page 1 endsLine 45.\penaltyFig-ure10000)\penalty10000\:Figure 7;\penalty-10000afterLine 43.: page 1 ends there\sloppy/\fussy/sloppypar\sloppyonly (source scan);\fussyunknown;sloppyparwarned and ignoredParsed::parameters(tolerance 9999, emergencystretch 3em, hfuzz .5pt / 200, 0, .1pt) with the group end that restores them; read where each paragraph endssloppypar:floccinaucini-/hilipilification ... hippopotomon-;\sloppy\fussy:floccinaucinihilip-\hyphenation{}Parsed::hyphenation; the pipeline adds them to the English patterns\hyphenation{flocc-inaucinihilipilification}: line 1 ends with the whole word (control:floccinaucinihilip-)\enlargethispage/*\baselineskip)EnlargeThisPage {pt, shrink}(pt, cm, ...,n\baselineskip), no diagnostic. Pipeline: not applied\enlargethispage{2\baselineskip}: page 1 holds 47 lines; FlashTeX 46\linebreak[n]\\;[n<4]ignoredInline::Penalty-\@getpen{n}with the space before it moved after it; a forced break ends a justified lineShort words hereends at x 477.5 bp (FlashTeX before: 207.8, the\\position);\showlists:\penalty -151for[2]\cleardoublepageBlock::PageBreak); pipeline: the odd-page test\chapteralready usesbook:a\cleardoublepage b3 pages (FlashTeX 2);article: 2\tolerance/\pretolerance\tolerance=9999:floccinaucini-(controlfloccinaucinihilip-);\pretoleranceprobe did not discriminate\raggedbottom/\flushbottomFlushBottomparameter; the last top-level one decides the page glue\flushbottom;book674 → 626 with\raggedbottom\nopagebreak[n]\@getpen{n}penalty, both modesLine 46.andLine 47.: page 1 endsLine 45.(FlashTeX beforeLine 46.)\widowpenalty/\clubpenaltyLine 43.: 45 lines on page 1, 46 with\widowpenalty=0; afterLine 45.: 45, 46 with\clubpenalty=0\emergencystretch\setlength{\emergencystretch}warned\emergencystretch=3em:floccinaucini-\allowbreak\penalty0nodeFigure/\allowbreak seven/: line 1 endsFigure/\discretionary{}{}{}Inline::Discretionary(plain text of each argument); pipeline breaks with the pre-break text. Non-empty post-break/no-break text: the no-break text is set with no break (painter limitation)qwrtzp\discretionary{=}{}{}lkjhgfd: line 1 endsqwrtzp=\interlinepenalty\interlinepenalty=10000: the 4-line paragraph moves whole, page 1 holds 43 lines\loosenessLoosenessparameter, no diagnostic. Pipeline: not applied (paragraph-layout has no looseness)\goodbreak/\filbreak\par+Block::Penalty-500 / -200 with\vfil…\vfilnegLine 43.: page 1 endsLine 43.(FlashTeX beforeLine 46.)\samepageInterlinePenalty(10000)for the groupLine 43./44.moves whole to page 2\nolinebreak[n]Inline::Penalty\@getpen{n}, space moved after itFigure \nolinebreak 7:Figure 7(FlashTeX before:Figure/7 shows)\nobreakdashCounts (24 rows). Before: supported 2, accepted no-op 2, partial 1, wrong 4, unsupported 15. After: 21 rows match pdflatex on their probes (one,
\discretionary, with the post-break/no-break limitation); not done 3 (\enlargethispageand\loosenessparsed by the compiler but not applied by the pipeline;\nobreakdashuntouched). Still open: under\flushbottoma page ended by a vertical\pagebreakkeeps natural glue (pdflatex stretches it; FlashTeX treats it like\newpage).🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz