Monday 15 September 2008

User Interfaces and MathML

An article on linguistic user interfaces caught my attention the other day. I like Jono DiCarlo's theory about what makes for a good user interface: easy to learn; efficient; expressive.

It struck me later that DiCarlo's theory helps to explain what I see as the main difficulty in working with MathML. If you are someone who wants to construct equations in MathML to display on your website, in all likelihood you have been using some tool, probably a WYSIWYG one with a drag-and-drop or palette-based interface, to construct the equations which then generates the MathML for you. You then need to transplant this into your website.

So what's wrong with this? While these tools and their interfaces meet the criteria of easy to learn (usually) and expressive (usually), they are definitely not efficient. GUI-based interfaces are easy to learn and use, but they are also comparatively slow next to keyboard-based input methods. And having to move the generated MathML to your webpage is another bottleneck.

But thankfully there appears to be some light on the horizon. Peter Jipsen of Chapman University has created a javascript script (called ASCIIMathML) that converts structured text to presentation MathML. So you can type `x=(-b +- sqrt(b^2-4ac))/(2a)` into your webpage and what appears is the quadratic formula. If the ASCIIMathML script is missing, the expression is still reasonably comprehensible. Compare that to the following MathML for the same formula:
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo>−</mo>
<mi>b</mi>
<mo>±</mo>
<msqrt>
<msup>
<mi>b</mi>
<mn>2</mn>
</msup>
<mo>−</mo>
<mn>4</mn>
<mi>ac</mi>
</msqrt>
</mrow>
<mrow>
<mn>2</mn>
<mi>a</mi>
</mrow>
</mfrac>
</math>

ASCIIMathML in my opinion represents a huge step forward. It begins to address the efficiency problem by allowing the user to enter equations without needing another tool, or having to open up and click on palettes, or having to copy the MathML from one place to another.

I've added ASCIIMathML to my school's Moodle server - my students can now enter equations simply by typing. They can mouse over equations that I've placed in pages on Moodle and copy the ASCIIMath expression and then change it as they need to. And all this without sacrificing ease of learning or expressiveness. The basic syntax is very easy to learn, but extends in a logical manner to cover even extremely complicated expressions.

Now all that's needed is for the makers of all browsers to include support for MathML, including the requisite fonts, by default.