Repository navigation
compiler: \numberwithin, \counterwithin and subequations on one counter table (display-math blocker 2 of #146) - #155
Merged
Conversation
…ons on one counter table
Equations and figure captions now number through xref::Counters, the
table sections already used, instead of plain u32 counters:
- Counters keep LaTeX's reset lists (\@addtoreset, several parents) and
\the<name> as pieces (\the<parent>, text, \arabic/\alph/\Alph/
\roman/\Roman{counter}); article defines equation, figure, table and
amsmath's parentequation (define_body_counters, for report/book to
reuse with chapter resets).
- amsmath \numberwithin[\style]{counter}{parent} (preamble or body):
reset by parent, printed \theparent.\style{counter}; unknown counters
are LaTeX's "No counter defined" error. A \newtheorem counter follows
section through the existing theorem numbering.
- \counterwithin(*)/\counterwithout(*): the expansion prelude lets them
pass to the parser (they were engine primitives the parser never saw).
A \numberwithin[\alph] format is renamed like enumitem label markers
so the engine's \alph does not read ']'.
- amsmath subequations: \refstepcounter{equation} (a \label right after
\begin gets the parent number), \theequation = frozen parent + \alph,
counter restored from parentequation at \end.
pdflatex numbers of display-placement fixtures 17/18: (1.1) (2.1), and
(1) (2a) (2b) (2c) (3) with \eqref{sub} = (2). Supported inventory
regenerated (numberwithin, counterwithin, counterwithout, subequations).
cargo test --release (compiler): all suites pass (lib 257, new
tests/equation_numbering.rs 3, supported_latex 8, xref_toc 7).
Implementation-Agent: Claude Opus 5 (subagent kabir-claude math glue + numbering, 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
added a commit
that referenced
this pull request
Sep 13, 2026
Semantic overlap with #153 resolved to one counter model: equation/figure/table step through xref::Counters (#155); Counters::report() registers them within chapter (#153's numbering), so \chapter's step resets them, and #153's hand-kept equation/figure/table counters and within_chapter are removed. Kept #131's caption/equation hyperref anchors and label_inline. Conflicts: HOST_PRELUDE (amsthm defaults + \counterwithin/\counterwithout pass-through), parser.rs fields/dispatch/captions/bibliography OpenList + subequations begin/end/equation/multirow/labels, supported.rs (counter commands + main's hyperref url/href). Also: Counters::set_within rewritten on #155's Vec reset_by/pieces; #149's \numberwithin arm and fn removed (shadowed #155's counter_numbering with [style]); #155's theorem-counter special case removed (theorem counters are Counters entries since #149); TEXT_EXTRA_ARMS drops numberwithin (now in BUILT_INS); unused HashMap import in parser/boxes.rs. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, 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
added a commit
that referenced
this pull request
Sep 13, 2026
Conflicts: parser.rs modules (+ algorithmic), initialisers/fields (main's subequations + #159's algorithm_counter; equation/figure counters stay in xref::Counters per #155), preamble dispatch (hyperref/boxes/counter commands + algnewcommand/algrenewcommand/algsetup/floatname), \caption (algorithm branch before main's figure/table check), float \begin/\end (figure, table, algorithm, algorithm*; #159's stale theorem clause dropped), package matches (listings + algorithm packages); supported.rs TEXT_EXTRA_ARMS and caption/item descriptions (main's item [label]). Integration fix: parser/algorithmic.rs Block::Styled gains #147's lists/line_break_before. Generated docs took main. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, 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
added a commit
that referenced
this pull request
Sep 13, 2026
…ession handoff) Stage 1 partly done: #131, #137, #153 (incl. #142), #144, #147, #149, #150, #155, #159, #163, #164 merged with conflicts and post-expansion fixes recorded in docs/evidence/integration-2026-09-13b/merge-log.md. Remaining: #166, #169, #148, #161, then the inventory regeneration and stages 2-4. The helper scripts under tools/ hard-code the original worktree path. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, 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
added a commit
that referenced
this pull request
Sep 13, 2026
…merges Every stage 1 merge took main's side of the generated inventory and deferred the regeneration to the end of the stage. Running crates/compiler/scripts/render_supported_latex.sh picks up #131, #137, #144, #147, #149, #150, #153, #155, #159, #163, #164, #166 and #169, so supported_latex::generated_artifacts_are_current passes again. The TeX Live-derived canonical denominator is deliberately untouched: this machine has TeX Live 2025, not the MacTeX the committed file was pinned from. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
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.
Part B of the two blockers left by #146 (fixtures 17
\numberwithin{equation}{section}and 18subequations).What
xref::Countersis the one counter mechanism. It keeps LaTeX reset lists (\@addtoreset, several parents, transitive\@stpelt) and\the<name>as pieces (\the<parent>, text,\arabic/\alph/\Alph/\roman/\Roman). The parser'sequation_counter/figure_counteru32s are gone.define_body_counters()definesequation/figure/table/parentequation, so report/book (footnotes-2'sCounters::report()) can reuse it and addcounter_within(.., "chapter").\numberwithin[\style]{counter}{parent}works in the preamble or the body. An unknown counter gives LaTeX's "No counter defined" error. A\newtheoremcounter followssectionthrough the existing theorem numbering. For the theorems lane: they can switch toCounters::define+step.\counterwithin(*)/\counterwithout(*):HOST_PRELUDElets these tex-expansion kernel primitives pass through to the parser.\numberwithin[\alph]'s format is renamed like enumitem label markers, so the engine's\alphdoesn't consume]. No tex-expansion edits. If compiler: adopt tex-expansion (r2) without the HW1 keystroke regression (supersedes #108) #130's LaTeX layer later owns counters, this parser path is the one to retire.subequations:\refstepcounter{equation}(a leading\labelgets the parent number),\theequation= frozen parent +\alph, and the counter is restored fromparentequationat\end.numberwithin,counterwithin,counterwithout,subequations.apps/mac's bundledsupported-latex.jsonis not touched here (no apps/ edits); it needs the usual sync.Evidence
pdflatex numbers for display-placement fixture 17: (1.1) (2.1),
\eqref(2.1). Fixture 18: (1) (2a) (2b) (2c) (3), with\eqref{e:sub}= (2) and\eqref{e:s1}= (2a).cargo test --release(compiler): every suite passes. That includes lib 257 (new xref and parser tests), newtests/equation_numbering.rs3 (full expansion path),supported_latex8,xref_toc7 andcorpus_gate.Re-pin order
A (#148, math-layout) and B (this PR) are independent. C (render-pipeline) re-pins both.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu