arthanzel/evaluatex

[Issue] LaTeX commands

Opened this issue · 2 comments

First off,

This library seems great! ~80 commits, all by one person, and works really well! I don't know why this isn't getting more attention!

On a 'not quite there yet' note, despite the partial LaTeX support (the reason why I am here). There seem to be some issues with very basic functionality. See below.

>>> evaluatex('a \\times b', options={latex: true})
Thrown: Parsing error: Expected end of input, but got COMMAND undefined

I haven't done any sort of entensive testing yet, but I had hoped that I would be able to use this to make a VS Code extension that evaluates lines of math in LaTeX code.
I still hope I will, since this seems to have all the groundwork done, but would be all the better for an extra few steps 😁

Thanks for the positive feedback! Unfortunately, I haven't given LaTeX the love it deserves. I've mostly been using Evaluatex with ASCIIMath because it fit my use case at the time.

The times LaTeX command is not implemented yet. I suspect you could implement it by adding the appropriate code in util/localFunctions.js and util/arities.js, or by modifying the lexer to replace the \\times command token with a multiplication token, since they're semantically equal.

I would also welcome a PR containing a diverse set of test cases for LaTeX math. If there's enough new features to make it worth my time, I'd consider diving into this project again.

Rich converter from LaTex to sympy https://github.com/jackatbancast/latex2sympy/ . This can help.