ronkok / Temml

TeX-to-MathML conversion library in JavaScript
https://temml.org/
MIT License
142 stars 12 forks source link

Negative vs minus #31

Closed kelvinsjk closed 9 months ago

kelvinsjk commented 11 months ago

The typesetting of negative and minus signs seems to be off after = signs

Screenshot from 2023-10-26 02-22-58

PS: Thanks for the awesome library

ronkok commented 11 months ago

If you want unary operators to have different spacing than binary operators, I'll think you'll have to raise that issue elsewhere.

Maybe at the MathML-Core issue tracker.

kelvinsjk commented 11 months ago

Ah, so the issue is with mathml. Thanks for the insight!

mk12 commented 9 months ago

I think this is an issue with Temml, not MathML. Temml should emit form="prefix" for unary operators. For now I'm post-processing the Temml output with this regex:

.replaceAll(
  /(<\/mo>(?:<\/mrow>)?(?:<mrow>)?)<mo>(−|-|\+)<\/mo>/g,
  "$1<mo form=\"prefix\">$2<\/mo>"
)
ronkok commented 9 months ago

I think this is an issue with Temml ... Temml should emit form="prefix" for unary operators.

@mk12 You are correct! Thank you for pointing that out. I'll have it fixed sometime later this week.

xigoi commented 9 months ago

Also happens inside brackets ((-x)) and after word operators (\exp -x).

ronkok commented 9 months ago

Fixed by release v0.10.20.