Hacker News new | ask | show | jobs
by bmacho 196 days ago
AsciiMath makes easy equations read easy.

1 and 2 would be

  1) d/dx e^y = e^y dy/dx = 1
  2) d/dx e^y = d/dx x = 1
edit: edited, first got them wrong
1 comments

When you render it for proper typesetting, do the parentheses around dy/dx disappear? (Oh, I guess you've removed them in your edit.)

If they do, it seems like an error-prone way to write your math.

If they don't, it seems like it will make your math look terrible.

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", or (worse) in the denominator in "d/dx e^y"?

It seems somewhat less noisy than the LaTeX version, but not much; assuming I can insert whitespace harmlessly:

  \frac d{dx}e^y = e^y\frac{dy}{dx} = 1
        d/dx e^y = e^y      dy/dx   = 1

  \frac d{dx}e^y = \frac d{dx}x = 1
        d/dx e^y =       d/dx x = 1
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.

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.

Why would you want to manually set the sizes of parens? I always use \left \right when writing LaTeX (and having to do it is one of the reasons I hate LaTeX math notation).
Because \left( ... \right) doesn't give very readable results in cases like that; all the parens end up the same size.