Typesetting mathematical expressions

Dear users,

As part of my slow learning curve in Prolog, I wrote a little package that translates mathematical expressions to MathML so that they are nicely rendered on a Web browser.

Example 1.

mathml(sin(alpha), M), html(math(M), Tokens, []).
M = mrow([mi(sin), mo(\['⁡']), mi(\['α'])]) ;

Let’s see if this renders in a pretty way:

mathml(sin(alpha), M), html(math(M), Tokens, []), print_html(Tokens).

(I just copied the output here, use Firefox to see it in all it’s glory)


Example 2, a bit more complicated:

mathml(qbinom(alpha,'N',pi)=argmax(k,1,10,pbinom(k,'N',pi)=<alpha), M).

It is rendered like this:


[Strange that it looks terrible in Discourse although I use Firefox. I’ll find out what’s wrong here…]

So far, it is very preliminary, but I like it. I think such a thing does not exist, although I guess some people would really love it.

Best wishes,