Skip to content

Add EqEdit triangle symbol support - #93

Open
kilomanyo wants to merge 1 commit into
airmang:mainfrom
kilomanyo:agent/eqedit-triangle-token
Open

Add EqEdit triangle symbol support#93
kilomanyo wants to merge 1 commit into
airmang:mainfrom
kilomanyo:agent/eqedit-triangle-token

Conversation

@kilomanyo

@kilomanyo kilomanyo commented Aug 22, 2026

Copy link
Copy Markdown

Summary

  • map the documented uppercase TRIANGLE token and source-evidenced lowercase triangle token to LaTeX \triangle
  • preserve operator/symbol semantics in EqEdit preview MathML without rewriting serialized XML
  • cover reader, renderer, authoring round-trip, and ordinary-identifier negative cases

Verification

  • full upstream gate: 3135 passed, 18 skipped, 1 xfailed
  • Ruff, mypy, pyright, contract/hygiene checks, build, twine check, and clean-wheel smoke passed

The change is a general EqEdit token-map correction; it has no document-, school-, hash-, or full-script-specific behavior.

@kilomanyo
kilomanyo requested a review from airmang as a code owner August 22, 2026 08:09

@airmang airmang left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for this PR — the diagnosis is exactly right (latex2mathml does classify \triangle as an identifier while \angle already comes out as an operator, so the minimal scope here is well chosen), and I really appreciate the negative test cases around identifier splitting. Nice work.

While playing with the branch locally I ran into one edge case I'd like to fix before merging:

\text{...} content gets rewritten too. The regex substitution runs over the whole LaTeX string, so a quoted EqEdit literal containing \triangle breaks:

render_equation(r'"\triangle" + x')
# main: <mtext>\triangle</mtext><mo>+</mo><mi>x</mi>
# PR:   <mtext>\mathop{\triangle</mtext><mi>}</mi><mo>+</mo>...

Rare input, but the tokenizer accepts it and main renders it cleanly. Skipping \text{...} arguments before the substitution (plus a negative test for this script) should cover it. Happy to handle this in a follow-up if you'd prefer.

One question on the authoring direction: since _invert is first-seen, \triangle now authors as lowercase triangle. We got burned by this once with forall — the real Hancom build renders the lowercase form as literal text, which is why authoring emits FORALL (ff79bd8). Do you know whether lowercase triangle has been render-verified on a real build? If it's only been observed in the reading direction, it might be safer to add an explicit "\triangle": "TRIANGLE" override matching the documented spelling until we can verify.

Everything else looks good to me — once the \text case is covered I'm happy to merge.

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