Skip to content

compiler: parse a \footnote argument as \long (port of #142 to required_group_bounded) - #259

Merged
GoKubar merged 1 commit into
mainfrom
rebase/142-footnote-long-argument
Sep 14, 2026
Merged

GoKubar merged 1 commit into
mainfrom
rebase/142-footnote-long-argument

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Port of #142 onto current main. Supersedes #142 — its branch is untouched.

#142 merged cleanly but did not compile: it called long_required_group, a thin wrapper main no longer has. What that wrapper wrapped is still there — required_group_bounded(command, span, long) — and its long arm already does exactly what the change needs:

  • a paragraph boundary inside the argument is recorded but does not end it;
  • an argument that is never closed at all is still closed at the end of its first paragraph, so a missing brace cannot swallow the document.

Until now nothing passed true, so the flag had no caller. \footnote/\footnotetext is the first, and the doc comment that lived on the deleted wrapper moves onto it. Behaviour is unchanged from #142, so its own two tests pass as written.

In latex.ltx \@footnotetext is \long, so a blank line inside \footnote{...} is a paragraph break in the note. The parser used to close the argument there, report "missing its closing brace" and "unmatched '}'", and move the rest of the note into the host paragraph. Found by the render-pipeline footnote oracle (fixture 14-multipar-note).

Gates, measured on this tree

gate control (main @ 5e6c65be) this branch
crates/compiler cargo test --release --no-fail-fast 485 passed, 0 failed 487 passed, 0 failed

The delta is exactly this PR's own tests/footnote_long_argument.rs (a_blank_line_inside_a_footnote_is_a_paragraph_break_in_the_note, an_unclosed_footnote_is_still_closed_at_the_end_of_its_paragraph). No render-pipeline change, so no vendor re-pin is needed for this one on its own.


Rebased and re-measured against main 5e6c65be. main moved 53 commits during this work, including changes to parser.rs, typeset.rs and mathtex.rs; every number in this PR is from the final tree, not the earlier base.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

latex.ltx defines \@footnotetext with \long: a blank line inside
\footnote{...} or \footnotetext{...} is a paragraph break in the note.
The parser closed the argument at the blank line instead, reported a
missing brace and an unmatched '}', and moved the rest of the note into
the host paragraph.

Found by the render-pipeline footnote oracle (fixture 14-multipar-note).

Ported from PR #142, which merged cleanly but did not compile: it called
`long_required_group`, a thin wrapper `main` no longer has. What that wrapper
wrapped is still there -- `required_group_bounded(command, span, long)` --
and its `long` arm already does exactly what this needs: a paragraph boundary
inside the argument is recorded but does not end it, and an argument that is
never closed at all is still closed at the end of its first paragraph, so a
missing brace cannot swallow the document. Until now nothing passed `true`,
so the flag had no caller; `\footnote`/`\footnotetext` is the first, and the
doc comment that lived on the deleted wrapper moves onto it. Behaviour is
unchanged from #142.

crates/compiler `cargo test --release` on this tree: 471 passed, 0 failed.
The same command on `main` (eea975c) gives 469, so the delta is exactly this
PR's own `tests/footnote_long_argument.rs`.

Rebase-Agent: Claude Opus 5 (engine lane, linux-primary)
Implementation-Agent: Claude Opus 5 (subagent kabir-claude footnotes render, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar
GoKubar force-pushed the rebase/142-footnote-long-argument branch from f99c8a8 to 13da5d9 Compare September 14, 2026 02:22
@GoKubar
GoKubar merged commit 6246a19 into main Sep 14, 2026
17 of 20 checks passed
GoKubar added a commit that referenced this pull request Sep 14, 2026
… regions (#343)

Closes the second silent-content-loss bug: every \footnote on a page containing a float was dropped. floatpage::paginate now charges the longtable region's reserve alongside the insertion state, so a continuation foot and a note compete for one page as in TeX, and settle_inserts is shared rather than duplicated. Measured end to end: hyperref-toc, lab-report and lmodern-report were silently dropping footnote text on main and now set it; 17 of 23 documents byte-identical. Footnotes oracle 19/24 -> 35/39, float-notes 10/10, tabular still 106/106, amsmath 59/59, HW1/HW2 unchanged. Carries the vendor re-pin, which un-inerts #259, #281, the ~/\nobreakspace fix, text-mode spacing in macro bodies and the amsmath limit operators.
@GoKubar
GoKubar deleted the rebase/142-footnote-long-argument branch September 16, 2026 04:17
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