AsciiMath to LaTeX conversion has trouble with `\in` operator
Description
AsciiMath to LaTeX conversion has trouble with the \in operator.
Steps to Reproduce
The following can be done at the JavaScript console in a page with MathLive loaded.
> MathLive.convertAsciiMathToLatex('x in')
'x\\in'
> MathLive.convertAsciiMathToLatex('x in R')
'xinR'
> MathLive.convertAsciiMathToLatex('x in A')
'xinA'
> MathLive.convertAsciiMathToLatex('x !in A')
'x !\\in A'
> MathLive.convertAsciiMathToLatex('x notin A')
'xnotinA'
Actual Behavior
See above.
Expected Behavior
> MathLive.convertAsciiMathToLatex('x in')
'x\\in'
> MathLive.convertAsciiMathToLatex('x in R')
'x\\in R'
> MathLive.convertAsciiMathToLatex('x in A')
'x\\in A'
> MathLive.convertAsciiMathToLatex('x !in A')
'x\\notin A'
> MathLive.convertAsciiMathToLatex('x notin A')
'x\\notin A'
See AsciiMath definitions here.
Environment
I do not know if this is a regression; I just noticed it today.
MathLive version 0.98.5
Operating System macOS 12.4
Browser Verified same behavior on Brave v1.61.109 (on Chromium 120.0.6099.144), Chrome 120.0.6099.129, Firefox 115.0 and 121.0.
This was the first AsciiMath conversion problem I had encountered, and it prompted me to run a larger test on all of the examples on the AsciiMath website linked to above. That test unearthed at least 35 other discrepancies between the official definition of AsciiMath and the version supported in MathLive. How would you like those reported? Just list them all here?
I see from https://github.com/arnog/mathlive/blob/master/src/formats/parse-math-string.ts#L13 that partial support for AsciiMath is a known limitation, not an accidental bug. Is it correct that the code starting here https://github.com/arnog/mathlive/blob/master/src/formats/parse-math-string.ts#L80 is where the partial AsciiMath support is located? If so, would you want PRs for that section of code that extend AsciiMath support?
Rather than upgrade MathLive with full AsciiMath support, I've adopted the following tool (compiles to one JS file) that seems to come indirectly from the official AsciiMath repo. https://github.com/tylerlong/asciimath-to-latex Just posting that here in case it's of any value to MathLive going forward.
Thanks for the info. A PR that improves the ASCIIMath support in MathLive would be welcome.