Skip to content

compiler: \thepage is unsupported (#519) - #562

Closed
d-q222 wants to merge 1 commit into
mainfrom
agent/daniel-muse-lead-2/thepage
Closed

d-q222 wants to merge 1 commit into
mainfrom
agent/daniel-muse-lead-2/thepage

Conversation

@d-q222

@d-q222 d-q222 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #519.

What changed

  • \thepage parses to a new Inline::ThePage, resolved at layout time on the same late-binding path as \pageref (the page isn't known until pagination completes).
  • \pagenumbering{style} emits a zero-width Inline::PageNumbering marker that resets the displayed counter to 1 and switches style (arabic/roman/Roman/alph/Alph; unknown styles fall back to arabic, still accepted silently).
  • Labels capture the styled page text, so \pageref/cleveref page refs print the style in force at the label.
  • Displayed counter steps on every shipped page, including footnote-overflow pages.
  • No render-pipeline change needed or made — builds against the pinned vendor/compiler, untouched, no split needed for this one.
  • Generated inventory artifacts regenerated (both copies, Mac bundle included).

Tests

  • crates/compiler: full suite independently re-verified fresh, 100% green (339+ passed, 0 failed), including 7 new thepage tests (single page, explicit-break per-page values, roman reset, alph, mid-paragraph switch, styled \pageref, preamble \pagenumbering) — all 7 confirmed failing on base code via stash before the fix.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor

🤖 Generated with Claude Code

\thepage parses to a new Inline::ThePage resolved at layout time to the
physical page being set, formatted in the \pagenumbering style in force
there (previously: unknown_command). \pagenumbering now emits a
zero-width Inline::PageNumbering marker that resets the displayed page
counter to 1 and switches the style; labels capture the styled page text
so \pageref (and cleveref page refs) match. Unknown styles fall back to
arabic, keeping the command accepted as before.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor
GoKubar added a commit that referenced this pull request Sep 15, 2026
* compiler: implement \thepage via the \pageref late-binding path

\thepage parses to a new Inline::ThePage resolved at layout time to the
physical page being set, formatted in the \pagenumbering style in force
there (previously: unknown_command). \pagenumbering now emits a
zero-width Inline::PageNumbering marker that resets the displayed page
counter to 1 and switches the style; labels capture the styled page text
so \pageref (and cleveref page refs) match. Unknown styles fall back to
arabic, keeping the command accepted as before.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor

* compiler: support \captionof{figure/table}[short]{text} outside floats

caption.sty's standalone caption form reuses \caption's exact machinery
(counter step, Figure/Table N: prefix, FigureCaption block) with the float
type given explicitly instead of read from the enclosing environment.
The [short] list-of-figures argument is consumed and ignored; unknown
types diagnose and fall back to paragraph text like \caption outside a
figure. Inventory entry plus regenerated supported-LaTeX artifacts.

Implementation-Agent: muse-spark-1.3-contributor

* compiler: parse \marginpar and set the note in the right margin (#505)

\marginpar[<left>]{<right>} now parses to a new Inline::Marginpar
carrying the one-sided {<right>} note (a present [<left>] is consumed
with a warning); the unsupported_feature diagnostic is gone in the real
compiler, incremental span-shifting/block signatures and the Core 14
layout (skips the note, no mark) updated. Stated simplification: always
the right margin (no two-sided alternation, \reversemarginpar), no
collision avoidance between close notes.

Render-pipeline placement lands separately (needs a vendor/compiler
re-pin past this commit to compile the new Inline variant) — see the
paired draft PR.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: daniel-muse-lead-2 (Claude Sonnet Muse supervisor; split
compiler-only files from muse/marginpar 3473c632/9c819976 for the
compiler-PR-first/pipeline-draft-second pattern)
Co-authored-by: d-q222 <[email protected]>

* compiler: add basic biblatex support

What changed:
- add project-relative biblatex resource loading, numeric citations, notes, sorting, and bibliography rendering
- route biblatex commands through a dedicated compiler module

What was run:
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-biblatex cargo test --manifest-path crates/compiler/Cargo.toml --test biblatex -- --nocapture: 7 passed

Next step:
- commit focused coverage and regenerated support inventories

Lane-Owner: daniel-parent (mac-m5pro-dq222)
Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: codex (this session); trailers added by daniel-parent
Lane-Owner: daniel-parent (mac-m5pro-dq222)

* compiler: cover biblatex support

What changed:
- add coverage for citations, notes, textcite, nocite, sorting, undefined keys, and headings
- regenerate compiler and macOS supported-LaTeX inventories and user docs

What was run:
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-biblatex cargo test --manifest-path crates/compiler/Cargo.toml --test biblatex -- --nocapture: test result: ok. 7 passed; 0 failed
- sh crates/compiler/scripts/render_supported_latex.sh: completed

Next step:
- run the final full compiler test suite

Lane-Owner: daniel-parent (mac-m5pro-dq222)
Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: codex (this session); trailers added by daniel-parent
Lane-Owner: daniel-parent (mac-m5pro-dq222)

* compiler: route eqnarray/eqnarray* through multirow displays (#520)

eqnarray/eqnarray* now parse via multirow_environment (rows on \\, 3
cells on &), numbered against the shared equation counter (* unnumbers
all, \nonumber/\notag unnumbers one row); N rows consume N+1 numbers
per ltmath.dtx. Both envs moved from the unimplemented to the
implemented inventory.

Render-pipeline layout (RowsEnv::EqnArray, right/centred/left columns,
kernel arraycolsep spacing) lands separately — see the paired draft PR;
it has no compile-time dependency on this commit (RowsEnv reads the
environment name from source text), but its end-to-end geometry test
stays #[ignore]d until a vendor/compiler re-pin lets it see real
eqnarray output instead of the vendored plain-text fallback.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: daniel-muse-lead-2 (Claude Sonnet Muse supervisor; split
compiler-only files from muse/eqnarray for the compiler-PR-first/
pipeline-draft-second pattern)
Co-authored-by: d-q222 <[email protected]>

* compiler: keep biblatex's parser arms out of the recursive command frame

What changed:
- `\addbibresource` and `\printbibliography` move out of `P::command` into
  `#[inline(never)]` helpers (`add_bib_resource`, `print_bibliography`);
  `biblatex_cite` is `#[inline(never)]` too.
- The biblatex `\citeauthor`/`\citeyear` dispatch moves from the `command`
  arm to the top of `natbib_cite`.
- Why: `P::command` is on the stack once per nested sub-parse. In debug
  builds every local of every arm gets its own slot, so #558's inline arms
  grew each nesting level by 1440 bytes. Combined with #601, 32 nested
  tabulars (#577's STREAM_DEPTH_LIMIT, kept at 32) overflowed the 2 MiB
  debug test thread in
  robustness::nested_sub_parses_hit_tex_grouping_capacity_instead_of_the_stack
  (found by the integration preview, #609).

What was run:
- Stack per nesting level (debug), measured with a scratch probe that prints
  the stack address in `parse_stream` at each depth (not committed):
  | construct | #601 | #601+#558 before | #601+#558 after |
  | tabular   | 57232 | 58672 | 57360 |
  | footnote  | 31424 | 32864 | 31552 |
  | colorbox  | 30928 | 32368 | 31056 |
  | rotatebox | 32048 | 33488 | 32176 |
  | uline     | 30336 | 31776 | 30464 |
- #601 + #558 (merge), debug, CARGO_BUILD_JOBS=4:
  cargo test --test robustness --test biblatex
  biblatex: test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
  robustness: test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 41.06s
- This branch, debug:
  biblatex: test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
  robustness: test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 40.81s
  natbib: test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
  --lib cite: test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 331 filtered out; finished in 0.00s

Next step: merge into the integration preview (#609) and rerun there.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* integration: regenerate supported-latex artifacts on the combined head

crates/compiler/scripts/render_supported_latex.sh over the five merged
PRs: 333 -> 341 text commands, 62 -> 64 environments (eqnarray,
eqnarray*), 23 -> 24 packages (biblatex); Mac bundled copy synced.

Implementation-Agent: fable-integration-cmp
Commit-Executor: fable-integration-cmp (direct; Cursor usage limit)

* integration: regenerate bridge and paragraph-layout lockfiles for flashtex-bibliography

PR #558 added flashtex-bibliography to flashtex-compiler's dependencies
but only updated crates/compiler/Cargo.lock. bridge and paragraph-layout
path-depend on the real compiler, so their lockfiles gain the same entry;
flashtex-cli and render-pipeline build against the vendored compiler
snapshot and are unchanged. Verified CI-style with
cargo build --release --locked for all five crates.

Implementation-Agent: fable-integration-cmp
Commit-Executor: fable-integration-cmp (direct; Cursor usage limit)

---------

Co-authored-by: muse-spark-1.3-contributor <[email protected]>
Co-authored-by: d-q222 <[email protected]>
@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Landed via #645, an integration branch that merged this PR with git merge --no-ff alongside its siblings — so your commits and authorship are preserved in main's history.

GitHub could not auto-close this: #645 was squash-merged, which creates a new commit, so this branch's tip is not an ancestor of main even though its content is. I verified the feature is present on main before closing.

Why the work was batched: these PRs all append to the same compiler/pipeline hub files (parser.rs, supported-latex.json, supported.rs, vocabulary.rs, adapter.rs), so every individual merge knocked the rest into conflict. Merging them one at a time lost several PRs to repeated races; batching them into one --no-ff branch landed them cleanly.

Reopen if you find anything of yours that did not make it across.

— orchestrator-astra (Commander)

@GoKubar GoKubar closed this Sep 15, 2026
@GoKubar
GoKubar deleted the agent/daniel-muse-lead-2/thepage branch September 16, 2026 04:18
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.

compiler: \thepage is unsupported (late-bound page number, like \pageref)

2 participants