Repository navigation
compiler + tex-expansion: scope user-defined environment bodies as real groups (#928) - #950
Merged
Merged
Conversation
do_begin opened the environment group silently while do_end already emitted \endgroup, so a \newenvironment whose begin/end code expands inline left a lone closer and no scope behind: downstream declarations leaked past \end. Emit the matching \begingroup (queued for output, not re-executed), and give the pushed \endgroup the \end span. Implementation-Agent: muse-spark-1.3-contributor Commit-Executor: muse-spark-1.3-contributor
The expansion pass now delivers balanced group boundaries around every \begin/\end; map \begingroup/\endgroup to parser groups so declarations (\bfseries, \large, ...) stop at \end instead of leaking. The two source-text range scanners (verbatim, comment) consume the reconstituted \end tag structurally so the trailing close survives; runaway scans treat the env LBrace as the boundary; the end-of-input brace sweep skips \begin-spanned openers already covered by environment diagnostics. Implementation-Agent: muse-spark-1.3-contributor Commit-Executor: muse-spark-1.3-contributor
…ts and regenerate derived artefacts Implementation-Agent: muse-spark-1.3-contributor Commit-Executor: daniel-parent Co-authored-by: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
This was referenced Sep 19, 2026
Closed
Member
|
Not merged in the integration batch (main 6196051): its |
jay3332
added a commit
that referenced
this pull request
Sep 19, 2026
… heads Two integration fixes for the merges just above, each pinned by a test. #863 (factor-by-length dimensions) made `parse_dimen_pt_current` accept `<factor>\baselineskip` as an unvalued `FACTOR_LENGTHS` reference, which shadowed main's own `baselineskip_multiple` fallback for list lengths (8a24707): `\setlength{\topsep}{0.6\baselineskip}` inside a list warned "unsupported length expression" instead of resolving 7.2pt (`list_topsep_accepts_a_baselineskip_factor`). The leading multiple is now tried first, in `apply_length_value` and in `calc_chain_term_pt_current` — the same reorder #863 itself applied to `\enlargethispage`. #950 (environment bodies as real groups) emits the environment's `\begingroup` brace directly ahead of every reconstituted `\begin{name}`, so beamer's optional `{title}{subtitle}` scan after `\begin{frame}` read a nested `\begin{itemize}`/`\begin{columns}` as a title group and reported "argument to \frame is missing its closing brace" (5 failures in `beamer_blocks`/`beamer_overlays`). `environment_group_open_at` tells that brace apart (a literal `{` ahead of an environment is followed by the environment's own brace, never by `\begin` itself), and the four `\@ifnextchar\bgroup`-style scans — frame head, `\onslide`, `\note`, the theme declarations — use `next_opens_literal_group`. Real `\column{...}` / `\frame{...}` argument parsing is untouched (their braces are literal). Implementation-Agent: Claude Code (mac-claude-a / lane-integrate2) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
jay3332
added a commit
that referenced
this pull request
Sep 19, 2026
…he integration batch + package definitions The pin reads main again after the second integration pass (#827 cherry-picks, #863, #950, #737/#739/#758/#732/#740/#825, visual-oracle tooling) and the `metadata.packages` work (`crate::package_definitions`, tex-expansion's `package_defs.rs`). `git archive` of this tree's `crates/compiler` and `crates/tex-expansion`, PINs at the merge commit, VENDORING.md rows updated, `scripts/check-vendor-pins.sh` both "up to date". render-pipeline 819/0 in both profiles against the new pins; compiler 1368/0, tex-expansion 150/0 release; Mac inventory sync current; swift build clean. Implementation-Agent: Claude Code (mac-claude-a) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
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.
Closes #928.
The issue's own title states the thesis: "Complexity needs user-defined environments, not more built-ins." This is the mechanism by which users extend LaTeX themselves — every custom homework class defines its own environments — and it matters more than any individual package we could add.
\newenvironment{name}{before}{after}now defines an environment whose\begin{name}/\end{name}expand their before/after code, so the body is processed normally instead of falling through.Two halves:
tex-expansionemits balanced\begingroup/\endgrouparound\begin/\end, so the environment's declarations scope the way LaTeX's do rather than leaking into the surrounding text.compilerscopes environment bodies as parser groups, which is what makes the body a real nested context rather than a flat token run.Oracle
Verified against TeX Live 2026 pdflatex with PyMuPDF span origins: a body
\bfseriessets on its own baseline with the after-code\rmfamilytext on a later one; abigtextbody sets at 14.4 pt with the after-code returning to 12.0 on the shared baseline y=86.40 — matching pdflatex's structure exactly. Absolute values differ (the repro is 12 pt Times against 10 pt Computer Modern), which is why the check is on structure and relative baselines, not absolute coordinates. Zero diagnostics on both documents.Tests
Both profiles, both crates:
No
supported-latexregeneration was needed, so nothing to sync intoapps/.Reach
Like every
crates/compiler/crates/tex-expansionchange right now, this is inert for users of the shipped CLI untilcrates/render-pipeline/vendor/is re-pinned — see #896 and the build evidence in #945. Merging this does not yet put it in anyone's hands.Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: daniel-parent
🤖 Generated with Claude Code