Skip to content

fix: render text macros in pspicture labels - #36

Merged
pyramation merged 2 commits into
mainfrom
fix/rput-label-text
Aug 25, 2026
Merged

fix: render text macros in pspicture labels#36
pyramation merged 2 commits into
mainfrom
fix/rput-label-text

Conversation

@pyramation

Copy link
Copy Markdown
Collaborator

Summary

\rput(1.5,1){\LaTeX} rendered the literal string \LaTeX instead of the logo — visible on mathapedia's How it works diagram, which the old site rendered correctly. Labels were stored as raw source (text: m[3]) and handed to MathJax verbatim; MathJax only touches delimited math, so a bare \LaTeX survives as text. Prose doesn't have the problem because the parser runs the Text transforms over it, and those map \LaTeX$\LaTeX$.

So labels now get the same Text pass as prose — not a \LaTeX special case, so {\bf ...}, ''``, --- etc. work in labels too.

The catch is that a label often is math, and the transforms must not touch it: -- inside $...$ means two minus signs, and rewriting it to – feeds MathJax broken input (there's a test pinning exactly that, from when this last regressed). parseLabel therefore splits on $...$ spans and transforms only the text between them, reassembling math byte-for-byte:

{\LaTeX\ vs $a--b$}   ->  {$\LaTeX$ vs $a--b$}
{$a--b$}              ->  {$a--b$}          (unchanged)
{\LaTeX}              ->  {$\LaTeX$}

parseText (prose) is unchanged — it keeps calling the transforms over the whole line, now via the extracted parseTextTransforms. rputgroup (an rput whose contents are shapes, not a label) is untouched.

Verified by rendering mathapedia against these builds: the diagram label now matches the old site pixel-for-pixel. Full suite (591 tests, 10 projects) and the workspace build pass; the tracked browser bundle is regenerated.

Link to Devin session: https://app.devin.ai/sessions/e51e8ecb94d241bd8d89e65e642c3e43
Requested by: @pyramation

@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@pyramation
pyramation merged commit ed73993 into main Aug 25, 2026
4 checks passed
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.

1 participant