mathbot
mathbot copied to clipboard
Adding Asciimath
So it would be super awesome if we let the user input asciimath which is just a lot easier than latex (especially for younger students), I don't how how hard that would be based on the way you've designed it. But I was thinking a simple asciimath to latex converter would be cool, then users could just do:
This is some $$\LaTeX$$ and this is some $$+text(AsciiMath)+$
The asciimath would just get converted to latex and sent to your current renderer. Thoughts?
AsciiMath sounds like a good idea. There's multiple ways to potentially go about it though.
- Convert the AsciiMath to LaTeX and render that. here's a converter written js, closed source
- Render the AsciiMath ourselves using MathJax. details on doing so with phantom.js
There may be other approaches that I haven't considered though.
Actually, I think they are just using the converter in the main repo :P
https://github.com/asciimath/asciimathml/blob/master/asciimath-based/ASCIIMath2TeX.php
Hmmmm... 800 lines of PHP. Not really something I want to tackle. I'll try searching for something more usable.
Any updates here?
Life got bad for a bit, and now I'm working full time. So apologies for being slow on this.
I did find a JS script to convert AsciiMath into LaTeX, so we could use that, but bringing all of node.js into the system for such a feature seems like overkill. The script, modified to be run from the command line, is here.
No problem. I am not sure, maybe it is slightly overkill :P Doubt it will be efficient, but this code is just creating an ast and replacing some symbols, so something like this https://github.com/PiotrDabkowski/Js2Py could work.
The official ASCIImath page has a description of the grammar on it: http://asciimath.org/#syntax There's BNF down the bottom of the page. It doesn't look TOO bad to implement, but maybe there's something I'm missing.
No it isn't so crazy. But why do that when you can just run the javascript in python 😎 I suppose its up to you though. Another implementation would probably be interesting to the folks over at asciimath though.