I don't know... a proof is a proof. What kind of a proof? It's a proof. A proof is a proof, and when you have a good proof, it's because it is proven.

— The Right Honourable Joseph Jacques Jean Chrétien, P.C., C.C., Q.C., B.A., LL.L., LL.D.

Monday, June 22, 2009

Testing math stuff #1: MathML

So, before we embark into this maniacal venture, I need to find a way to include math typesetting into our posts... Everything points to using MathML, which is "a recommended standard for internet publishing of mathematics."

Problem is, this "recommended standard" doesn't seem to be able to lift itself to anything higher than a recommendation, and thus, a couple of things need to be done on the client side (a.k.a. browser in the host machine) such as:

  • Downloading more fonts: This seems pretty much necessary, but fortunately is also very simple and straightforward.
  • Making sure you have a browser capable of reading MathML. From what I've learnt today, Mozilla Firefox essentially provides native support for MathML. Internet Explorer needs a plug-in. In any case, this is not worrying me too much either.


I am using Mozilla Firefox 3.0.11 as of now.

Now, there is a catch. MathML is ridiculously verbose to author directly and so needs authoring tools that can translate from a standard mathematics authoring markup such as TeX. There is this tool called TtM (TeX to MathML) which provides this capability. The idea is that one feeds LaTeX into TtM and this produces the desired MathML output... Which then a MathML capable browser can read and render nicely...

LaTeX Input:
\section{A ridiculous equation}
A sample ridiculous equation pirated from the TtM website,
$$\Omega=\sum_{i=0}^{\infty}\left(x_i^2+1 \over x_i-1\right)^{p_i}$$
which supposedly is to be nicely translated into HTML by TtH.

\section{A ridiculous macro}
\def\ridiculous_macro#1{{\it #1}}
And the ridiculous_macro does this: \ridiculous_macro{ridiculous text to be macroed}.


This is the generated MathML:
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mstyle displaystyle="true">
<mrow>
<mi>&Omega;</mi>
<mo>=</mo>
<munderover>
<mo>&sum;</mo>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>0</mn>
</mrow>
<mrow>
<mi>&infin;</mi>
</mrow>
</munderover>
<msup>
<mrow>
<mo>(</mo>
<mfrac>
<mrow>
<msubsup>
<mrow>
<mi>x</mi>
</mrow>
<mrow>
<mi>i</mi>
</mrow>
<mrow>
<mn>2</mn>
</mrow>
</msubsup>
<mo>+</mo>
<mn>1</mn>
</mrow>
<mrow>
<msub>
<mrow>
<mi>x</mi>
</mrow>
<mrow>
<mi>i</mi>
</mrow>
</msub>
<mo>-</mo>
<mn>1</mn>
</mrow>
</mfrac>
<mo>)</mo>
</mrow>
<mrow>
<msub>
<mrow>
<mi>p</mi>
</mrow>
<mrow>
<mi>i</mi>
</mrow>
</msub>
</mrow>
</msup>
</mrow>
</mstyle>
</math>


All this sounds fantastic, but somehow when I include this bloody MathML markup into my post content, it ain't look no good at all!@#$%^&* Ahhhgrrrrrrr...

This is the browser rendered MathML:

Ω=i=0(xi2+1xi-1)pi

Totally unacceptable...

2 comments:

Bob Mathews said...

Here's an article about using MathML in Blogger: http://mathmlblogs.blogspot.com/2008/11/how-to-render-mathml-in-blogs-hosted-by.html

(Incidentally, HTML 4.01 and XML 1.0 are "only" recommendations too.)

khovanskiiªn said...

Gee... LOL (I'm actually surprised people has begun to post and this place still looks like my laundry...)

Thanks! I will follow up with that article.

Post a Comment