Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is pretty neat. A week or so ago when "MathJax turns 3.0" was on the frontpage [0], I followed a link to this very thoughtful comment [1] from 2019 by svat about the landscape of math typesetting on the web. Since then I've been thinking a little bit about MathML and how compilers from other more input-friendly formats to MathML might encourage wider adoption. So I'm excited to see this library.

I've heard of AsciiMath before but hadn't ever had a chance to play with it, so I appreciated the live demo on the project website. One thing I noticed is that AsciiMath uses whitespace around operators to determine binding order.

For example (AsciiMath on left, TeX on right)

    f(x) = x+1 / 2    ≡    f(x) = \frac{x + 1}{2}
    f(x) = x + 1/2    ≡    f(x) = x + \frac{1}{2}
When there's equal spacing around neighboring operators, normal order of operations seems to apply.

This seems fairly intuitive, but might not scale to large, complex equations as well as TeX's bracket syntax does. Nonetheless, I think I like it for simple equations.

Question for the author: you mention on the page that Mathup supports an input language inspired by AsciiMath [2]. What are the differences? Does Mathup accept a subset of AsciiMath, or are there cases where the syntax diverges? And if the latter is the case, what motivated devaiting from AsciiMath's syntax?

[0]: https://news.ycombinator.com/item?id=22582343

[1]: https://news.ycombinator.com/item?id=19347737

[2]: There's a typo in this phrase on your page, BTW: "insipired" has an extra "i"



Thanks for the comment. This project was previously called Ascii2MathML and I tried to stay as true to the original AsciiMath language as possible. But I’ve since then moved away from it (which is why I renamed it to mathup) as I found it could be improved upon in some minor ways (personal preference really).

There are some trivial differences: e.g. `bf` for boldface instead of AsciiMath’s `bb`; or the `.^` infix for overscripts instead of the `over` prefix. The matrix syntax is also quite different: AsciiMath uses nested brackets, while mathup uses row separators (`;` or `\n`). Most significant is the difference in grammar (you’ve noted the significant white space which is not a feature of AsciiMath).

You can see my attempt of writing down the grammar here[1]. However I’m very much a novice when it comes to compilers and lexical analysis, so this grammar is probably not accurate—in fact when I originally wrote Ascii2MathML I wasn’t even aware that I was writing a compiler. But in words, a set of tokens and operators with no internal white space tends to be grouped together. There are a few infixes (`/`, `^`, `_`, etc.) which generally take precedence but operate on a group of non spaced tokens if they are able to.

I originally wrote this because I wanted people that didn’t necessarily know TeX to be able to drop in a simple expression in comment threads and forums. I also liked to provide as much expressive power as possible, but I found AsciiMath lacking a little in expressiveness. The white space significance I found made writing a little easier, but in longer expressions it is a bit hard to use, but then again, this tool was always intended for smaller expressions anyway.

[1]: https://github.com/runarberg/mathup/blob/master/GRAMMAR




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: