mathbot icon indicating copy to clipboard operation
mathbot copied to clipboard

Adding Asciimath

Open saivan opened this issue 6 years ago • 8 comments

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?

saivan avatar Oct 22 '18 10:10 saivan

AsciiMath sounds like a good idea. There's multiple ways to potentially go about it though.

There may be other approaches that I haven't considered though.

DXsmiley avatar Oct 31 '18 23:10 DXsmiley

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

saivan avatar Nov 01 '18 00:11 saivan

Hmmmm... 800 lines of PHP. Not really something I want to tackle. I'll try searching for something more usable.

DXsmiley avatar Nov 01 '18 10:11 DXsmiley

Any updates here?

saivan avatar Dec 01 '18 03:12 saivan

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.

DXsmiley avatar Dec 03 '18 10:12 DXsmiley

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.

saivan avatar Dec 03 '18 10:12 saivan

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.

DXsmiley avatar Dec 16 '18 04:12 DXsmiley

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.

saivan avatar Dec 16 '18 09:12 saivan