Repository navigation
compiler: report \\[<dimen>]'s optional argument on Inline::LineBreak - #478
Merged
Merged
Conversation
The parser has always *consumed* the `[<dimen>]` of `\\[<dimen>]` -- it must
never reach the page as text -- but threw the parsed value away, leaving every
consumer to re-read the brackets out of the source bytes that follow the
node's span.
That re-reading is only correct for a `\\` written literally in the document.
Expanded out of a macro body, the node's span is the *invocation*
(`expansion::Converter::place` places a replacement-text token at the call
site), so the bytes after it are the call's own arguments -- the `{Education}`
of `\cvsection{Education}` -- and the skip is unreachable. latex.ltx's `\\` is
`\@normalcr`, and `\@xnewline` turns the argument into a `\vspace{<dimen>}`
after the broken line, so what is lost is real vertical space: in
`fixtures/real-world/cv` the `\\[-6pt]` inside `\cvsection` is worth 5.977 bp
per call, five calls on its single page.
`Inline::LineBreak` now carries `skip_pt: Option<f64>`, filled from the
`skip_line_break_length()` the parser was already calling. The value is
reported, not acted on: the compiler's own fallback layout is untouched, so
this changes no compiler output and no golden.
Wiring it into `layout.rs`'s `newline` as well is deliberately left out: it
moves a `\begin{align}` recovery paragraph onto another page and fails
`local_recovery::half_typed_input_never_changes_layout_after_its_paragraph`,
which is a question for that path's owner, not for this one.
Consumer side: `crates/render-pipeline` reads the field behind a
`linebreak-skip` feature (a separate PR), so this change has to reach
`crates/render-pipeline/vendor/compiler` in a re-pin before that feature can
be turned on. Another lane owns re-pinning today; no vendor file is touched
here.
Test: `crates/compiler/tests/line_break_skip.rs` (5 cases -- literal, absent,
inside a `\newcommand` body, two calls of one macro, unit conversion plus the
argument never being typeset). On main the file does not compile:
error[E0026]: variant `flashtex_compiler::parser::Inline::LineBreak` does
not have a field named `skip_pt`
--> tests/line_break_skip.rs:41:40
Gates: `cargo test --release --no-fail-fast` on `crates/compiler`: 56 test
binaries, 0 failed (`local_recovery` included).
Implementation-Agent: Claude Opus 5 (lane nixos-cv-lecture, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
This was referenced Sep 15, 2026
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.
compiler: report
\\[<dimen>]'s optional argument on Inline::LineBreakThe parser has always consumed the
[<dimen>]of\\[<dimen>]-- it mustnever reach the page as text -- but threw the parsed value away, leaving every
consumer to re-read the brackets out of the source bytes that follow the
node's span.
That re-reading is only correct for a
\\written literally in the document.Expanded out of a macro body, the node's span is the invocation
(
expansion::Converter::placeplaces a replacement-text token at the callsite), so the bytes after it are the call's own arguments -- the
{Education}of
\cvsection{Education}-- and the skip is unreachable. latex.ltx's\\is\@normalcr, and\@xnewlineturns the argument into a\vspace{<dimen>}after the broken line, so what is lost is real vertical space: in
fixtures/real-world/cvthe\\[-6pt]inside\cvsectionis worth 5.977 bpper call, five calls on its single page.
Inline::LineBreaknow carriesskip_pt: Option<f64>, filled from theskip_line_break_length()the parser was already calling. The value isreported, not acted on: the compiler's own fallback layout is untouched, so
this changes no compiler output and no golden.
Wiring it into
layout.rs'snewlineas well is deliberately left out: itmoves a
\begin{align}recovery paragraph onto another page and failslocal_recovery::half_typed_input_never_changes_layout_after_its_paragraph,which is a question for that path's owner, not for this one.
Consumer side:
crates/render-pipelinereads the field behind alinebreak-skipfeature (a separate PR), so this change has to reachcrates/render-pipeline/vendor/compilerin a re-pin before that feature canbe turned on. Another lane owns re-pinning today; no vendor file is touched
here.
Test:
crates/compiler/tests/line_break_skip.rs(5 cases -- literal, absent,inside a
\newcommandbody, two calls of one macro, unit conversion plus theargument never being typeset). On main the file does not compile:
error[E0026]: variant
flashtex_compiler::parser::Inline::LineBreakdoesnot have a field named
skip_pt--> tests/line_break_skip.rs:41:40
Gates:
cargo test --release --no-fail-fastoncrates/compiler: 56 testbinaries, 0 failed (
local_recoveryincluded).Implementation-Agent: Claude Opus 5 (lane nixos-cv-lecture, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)
Co-Authored-By: Claude Opus 5 [email protected]
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu