ums: verify MathJax locally when the preview is blocked; \providecommand no-op gotcha - #238
Conversation
…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
This comment has been minimized.
This comment has been minimized.
| proxy), then `require('mathjax').init({...}).then(MJ => MJ.tex2mml(defs + expr))` | ||
| and check the output. With the `noundefined` package an undefined macro shows |
There was a problem hiding this comment.
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.
| `\hat{\v{\mu}}` showed a red `\v`). Use `\vec` / `\vecf` (the macros | ||
| `\renewcommand` `\vec`), and fix upstream by switching `\providecommand` → |
There was a problem hiding this comment.
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:
| `\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` → |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYf8XrzEWCDWht1YSHWqZc
|
Claude finished @d-morrison's task in 2m 0s —— View job Review
Confirming review — both prior nits are addressed; no new findings. Commit
The prior review's factual checks (tex2mml API, |
UMS checkpoint from an rme/gha session. Two new sub-points on the existing "verify math actually renders" preference in
memories/preferences.md:Sandbox preview can be unreachable. In a remote/web session the network policy may block the
d-morrison.github.ioPages host (proxy answers403to CONNECT), so "open the PR preview to check the math" doesn't work. Fallback: verify locally with themathjaxnpm package +tex2mml, grepping the output formathcolor="red"(hownoundefinedrenders an undefined macro).MathJax ignores
\providecommand. Only\newcommand/\def/\renewcommanddefine a macro, so\providecommand{\X}is a silent no-op when\Xshadows 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