Skip to content

ums: verify MathJax locally when the preview is blocked; \providecommand no-op gotcha - #238

Merged
d-morrison merged 2 commits into
mainfrom
ums-rme-gha-session
Jun 27, 2026
Merged

ums: verify MathJax locally when the preview is blocked; \providecommand no-op gotcha#238
d-morrison merged 2 commits into
mainfrom
ums-rme-gha-session

Conversation

@d-morrison

Copy link
Copy Markdown
Collaborator

UMS checkpoint from an rme/gha session. Two new sub-points on the existing "verify math actually renders" preference in memories/preferences.md:

  1. Sandbox preview can be unreachable. In a remote/web session the network policy may block the d-morrison.github.io Pages host (proxy answers 403 to CONNECT), so "open the PR preview to check the math" doesn't work. Fallback: verify locally with the mathjax npm package + tex2mml, grepping the output for mathcolor="red" (how noundefined renders an undefined macro).

  2. MathJax ignores \providecommand. Only \newcommand/\def/\renewcommand define a macro, so \providecommand{\X} is a silent no-op when \X shadows a LaTeX built-in (\v, \b, …) — the cause of rme's broken \hat{\v{\mu}}. Use \vec/\vecf; fix upstream with \def/\renewcommand.

Checked existing memory first — the gha v1-frozen/v2-slide behavior, the tag-push 403 caveat, and the huge-MCP-result quirk were already recorded, so nothing duplicated.

🤖 Generated with Claude Code


Generated by Claude Code

…and no-op gotcha

From an rme/gha session:
- In a remote/web sandbox the github.io PR-preview host can be blocked by the
  network policy (proxy 403), so the existing "open the preview to check math"
  instruction can't be followed. Add the local-verification fallback: the
  `mathjax` npm package + `tex2mml`, grepping for `mathcolor="red"`.
- MathJax ignores `\providecommand`, so `\providecommand{\X}` silently no-ops
  when `\X` shadows a LaTeX built-in (e.g. `\v`), rendering broken. Use
  `\vec`/`\vecf`; fix upstream with `\def`/`\renewcommand`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XYf8XrzEWCDWht1YSHWqZc
@claude

This comment has been minimized.

Comment thread memories/preferences.md Outdated
Comment on lines +289 to +290
proxy), then `require('mathjax').init({...}).then(MJ => MJ.tex2mml(defs + expr))`
and check the output. With the `noundefined` package an undefined macro shows

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The {...} placeholder for init() needs to include the noundefined extension to get the mathcolor="red" behavior described below. Without it, undefined macros may produce <merror> or an exception instead. At minimum, note what to put there — e.g. add "(config must load the [tex]/noundefined extension)" so a future session doesn't have to guess.

Comment thread memories/preferences.md Outdated
Comment on lines +297 to +298
`\hat{\v{\mu}}` showed a red `\v`). Use `\vec` / `\vecf` (the macros
`\renewcommand` `\vec`), and fix upstream by switching `\providecommand` →

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parenthetical (the macros \\renewcommand` `\vec`)is hard to parse. Two backtick-fenced tokens next to each other reads like a list of two items, not a phrase. The intended meaning seems to be "which are defined via\renewcommand{\vec}{...}` in rme's preamble." Consider:

Suggested change
`\hat{\v{\mu}}` showed a red `\v`). Use `\vec` / `\vecf` (the macros
`\renewcommand` `\vec`), and fix upstream by switching `\providecommand` →
`\hat{\v{\mu}}` showed a red `\v`). Use `\vec` / `\vecf` (rme defines these with `\renewcommand{\vec}{...}`, which properly overrides the built-in), and fix upstream by switching `\providecommand` →

@claude

claude Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 2m 0s —— View job


Review

  • Gather context and read changed files
  • Check prior nits from previous review
  • Review for new issues / hallucinations

Confirming review — both prior nits are addressed; no new findings.

Commit d72689c ("ums: clarify noundefined requirement and \vec definition (review nits)") resolves the two inline comments from the prior review:

  • Nit 1 (memories/preferences.md:289-290): The text now reads "init MathJax with the [tex]/noundefined extension loaded" and includes the full config object init({tex:{packages:{'[+]':['noundefined']}}}) — the ambiguity is gone. ✓
  • Nit 2 (memories/preferences.md:297-298): The confusing (the macros \\renewcommand` `\vec`)is replaced with(rme defines these with `\renewcommand{\vec}{...}`, which properly overrides the built-in)` — clear and parseable. ✓

The prior review's factual checks (tex2mml API, mathcolor="red" rendering, \providecommand no-op semantics) remain accurate for the current text. Nothing new to flag.

@d-morrison
d-morrison merged commit adebb17 into main Jun 27, 2026
4 checks passed
@d-morrison
d-morrison deleted the ums-rme-gha-session branch June 27, 2026 01:48
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