Skip to content

compiler: \includegraphics in running text and graphicx box transforms as structured inline nodes - #169

Merged
jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/inline-graphics-compiler
Sep 13, 2026
Merged

jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/inline-graphics-compiler

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Structured inline nodes for graphicx outside floats (parser only; no macro-pass change). Base: main.

  • Inline::Graphic(Graphic { starred, options, path, span, space_before }): \includegraphics[*][keys]{file} in running text, keys and file as exact source text; graphics.sty [llx,lly][urx,ury] recorded as viewport=… (pdftex.def \Gin@iii@vp). Replaces the "\includegraphics is unsupported" parser warning.
  • Inline::Transform(TransformBox { kind, content, span, space_before }): \scalebox{x}[y], \resizebox*{w}{h}, \rotatebox[keys]{angle}, \reflectbox; the content is parsed with the ordinary dispatch (math, nested boxes, images).
  • \graphicspath consumed without a diagnostic; graphics::graphics_path_entries.
  • Core 14 layout (runtime-v1) reports both nodes (unsupported_feature) and sets transform content untransformed; incremental span shifting covers both.
  • Inventory regenerated (includegraphics leaves TEXT_DIAGNOSTIC_ONLY; 5 new text arms).

Tests: new tests/graphics_nodes.rs; cargo test --release all suites pass (lib 253). Note: in debug builds supported_latex::canonical_names_outside_the_inventory_are_diagnosed trips the existing debug_assert! on \and/\today, independent of this change.

Consumer: the render-pipeline PR agent/kabir-claude/inline-graphics (needs this re-pinned into vendor/compiler).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

…s as structured inline nodes

New module `graphics` and two inline variants, parsed outside the macro
pass and never measured by the parser:

- `Inline::Graphic(Graphic { starred, options, path, span, space_before })`
  for `\includegraphics[*][keys]{file}` in running text. Keys and file
  keep their exact source text (`width=0.5\textwidth, trim={1 2 3 4}`).
  graphics.sty's two-bracket bounding-box form `[llx,lly][urx,ury]` is
  recorded as `viewport=llx lly urx ury` (pdftex.def `\Gin@iii@vp`).
  Replaces the old "\includegraphics is unsupported" parser warning.
- `Inline::Transform(TransformBox { kind, content, span, space_before })`
  for `\scalebox{x}[y]`, `\resizebox*{w}{h}` (`!` kept verbatim),
  `\rotatebox[keys]{angle}` and `\reflectbox`. The content is parsed with
  the ordinary dispatch in the current style (math, nested transforms,
  images), sharing `argument_inlines` with footnote text.
- `\graphicspath{..}` is consumed without a diagnostic (preamble or
  body); `graphics::graphics_path_entries` splits its groups for a
  consumer that reads image files.

Parser helpers: `bracket_argument` (exact source text, splits a `[a][b]`
word), `take_star_prefix` (`\includegraphics*[..]` lexes as one word),
`argument_text` (exact source text of a braced argument, token
reconstruction for macro expansions).

The Core 14 layout (runtime-v1) reports both nodes with an
`unsupported_feature` warning and sets transform content untransformed;
incremental span shifting covers both (`TransformBox::try_map_spans`).

Inventory: `includegraphics` leaves TEXT_DIAGNOSTIC_ONLY; `scalebox`,
`resizebox`, `rotatebox`, `reflectbox`, `graphicspath` are text
dispatch arms. Regenerated with scripts/render_supported_latex.sh.

Tests: new tests/graphics_nodes.rs (keys/path/span, starred and bbox
forms, transform parameters and nested content, edit span shifting);
references_and_figures' includegraphics test now checks the layout
warning. `cargo test --release`: all suites pass (lib 253).
Debug-only note: supported_latex's canonical-names test trips the
existing `debug_assert!(!BUILT_INS.contains(..))` on `\and`/`\today`
(TEXT_CONTEXT_ONLY), independent of this change; release passes.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude inline graphics, 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
Conflicts: lib.rs module order; incremental.rs span arms (ColorBox brace restored); layout.rs reference/emit arms; parser.rs Inline enum (variants reordered around a shared brace), \graphicspath dispatch and the siunitx_group_at/bracket_inner shared tail (duplicated).

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
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
@jay3332
jay3332 merged commit b3ce9bd into main Sep 13, 2026
11 of 18 checks passed
@GoKubar
GoKubar deleted the agent/kabir-claude/inline-graphics-compiler branch September 13, 2026 18:12
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.

2 participants