logoalt Hacker News

bmachotoday at 12:09 AM1 replyview on HN

Here is an online renderer and the description: https://asciimath.org/

The rules are basically the same as LaTeX, with saner symbol names, support for fractions, \ is not needed before symbols and () can be used instead of {}.

> Supposing that the parentheses aren't necessary, as implied by your edit: how does AsciiMath determine that e^y isn't in the numerator in "e^y dy/dx"

It seems to me that dx,dy,dz,dt behave like numbers, single letter variables and symbols (probably they are symbols, but not listed for some reason). Just as LaTeX doesn't need {} parentheses for numbers, single letter variables and symbols, AsciiMath allows omitting them too.

So `/` captures a single number/symbol/variable left to it, and that is `dy`. But if there was `du` for example it would only capture u, and you would need to put du between parentheses.


Replies

kragentoday at 1:46 AM

Thanks! It does better than I expected on tricky input like [0, 1/2). It seems like there are a lot of special cases, though. It does indeed remove parentheses from the output in some cases but not others.

Probably figuring out how to write things in AsciiMath is more trouble than copying and pasting them from Wikipedia though. (The alt text on equation images is the LaTeX source preceded with \displaystyle.)

How do you do \bigg(\big((4x + 2)x + 1\big)x - 3\bigg)x + 5 in AsciiMath? (((4x + 2)x + 1)x - 3)x + 5 makes all the parens the same size.