arthanzel / evaluatex

Latex and ASCIIMath evaluator for Javascript.
http://arthanzel.github.io/evaluatex
MIT License
72 stars 16 forks source link

Add support for cdot and times LaTeX commands #6

Closed whatl3y closed 3 years ago

whatl3y commented 4 years ago

Fixes the times problem mentioned in #1, but could probably as you mention add a thorough test suite for LaTeX commands in the future. For my use case I at least need support for cdot and times. All other iterations I've tried for my needs work otherwise though.

arthanzel commented 4 years ago

Why are \cdot and \times implemented like the \frac macro? They're infix operators. The simplest way to implement them would be to replace their tokens with a TIMES token in the lexer.

What's the use case here?

whatl3y commented 4 years ago

Apologies, I read through the code to get a better understanding and made an incorrect assumption I should use the localFunctions pattern to add support for these instead of the lexer (since they're infix ops as you mention). I made the changes you mention, updated my tests and all are passing.

The use case is to support MathQuill syntax, which here is an example on their doc website.

Screen Shot 2020-07-27 at 9 38 01 AM

LennyLip commented 3 years ago

Any chance you merge this?

arthanzel commented 3 years ago

Any chance you merge this?

Merged and published version 2.2.0