Posts Tagged ‘Math’

Authoring MathML

No Comments »

I am not entirely satisfied with the result that WP LaTex produces. Obviously, the white background on every little piece of math is a problem. Moreover, it only supports the simplest of layouts – at least I can’t get environments like displaymath, align etc. to work properly. Therefore, I decided to look into MathML. MathML is a W3 Recommendation specification for describing mathematics intended for machine to machine communication. That means in particular that MathML may be used by webservers to send mathematical content to client browsers.

Thus, MathML should be able to achieve the same goal as the WP LaTeX plug-in. However, this alternative comes at a price, since it relies on the browser being able to render MathML. Alas, browser support for MathML is somewhat limited: Firefox supports MathML, but IE needs a plug-in. You would think, Google caring so much about spreading good karma, that Google’s Chrome browser would support MathML, but it doesn’t. Not in any shape or form. Since I like Chrome very much for its speed and ease of use, I find this very disappointing.

However, most of the math I am authoring is just for my personal reference, so I don’t have to adhere to browser support restrictions too much and I decided to move forward and try to find an editor capable of producing MathML (besides Notepad, obviously).

The W3 organisation has a list of MathML editors, of which I have tried a few.

FireMath

This is a Firefox plug-in (much like Firebug etc.) and may be the best free option at the moment. It has a nice preview region, a reasonable layout and the generated XML is easily accesible. I will evaluate this further, before I pass my judgement.

http://www.firemath.info/

MathML Editor for Flash

The MathML Editor for Flash is, as the name suggests, a Flash application for editing and rendering MathML. You can try MathML Editor for Flash out here. It is pretty rudimentary and, unless I am greatly deceived, it is nigh impossible to typeset anything but the most basic expressions. The process of building an expression is very hierarchical, and you have to somewhat plan this hierarchy in advance. If you have got lots of indexes, superscripts, accents etc., you are going to have to start over again and again. Trying to typeset

Polynomial covering spaces stuff

drove me crazy with frustration. Also, I gave up on this application when it took me more than a few minutes to find the symbol \mathbb{C} (I never found it).

http://code.google.com/p/mathmleditor/


Math in WordPress

1 Comment »

Last night I decided to investigate whether I would be able to publish math in my WordPress blog. I wanted to be able to write mathematical formulas and diagrams in some sort of markup language and have it rendered as it would be in a book – i.e. arrows should be real arrows, not just –>, parentheses should be properly sized etc.. At the moment, the most promising solution seems to be the LaTeX for WordPress plug-in. Using this plug-in you can embed LaTeX code directly in your blog by enclosing it in a pair of double-dollar-tags. When the page is displayed, the plug-in will append the LaTeX code to a URI and request a public Mimetex service at http://l.wordpress.com/latex.php, which will in turn respond with an image stream of the rendered formula. So, if I write

0 \to \text{Ker}(h) \stackrel{i}{\hookrightarrow} H^n(C;G) \stackrel{h}{\to} \text{Hom}(H_n(C),G) \to 0

I will get this:

$$ {0 \to \text{Ker}(h) \stackrel{i}{\hookrightarrow} H^n(C;G) \stackrel{h}{\to} \text{Hom}(H_n(C),G) \to 0} $$

Pretty sweet!
My only complaint would be that the public WordPress latex service doesn’t seem to support the rendering of commutative diagrams through the xy package: if I write

\xymatrix{ 0 \ar[r] & Z_{n+1} \ar[r]^i \ar[d]^0 & C_{n+1} \ar[r]^\partial \ar[d]^\partial & B_n \ar[r] \ar[d]^0 & 0 \\ 0 \ar[r] & Z_{n} \ar[r]^i & C_n \ar[r]^\partial & B_{n-1} \ar[r] & 0}

I get

$$ \xymatrix{ 0 \ar[r] & Z_{n+1} \ar[r]^i \ar[d]^0 & C_{n+1} \ar[r]^\partial \ar[d]^\partial & B_n \ar[r] \ar[d]^0 & 0 \\ 0 \ar[r] & Z_{n} \ar[r]^i & C_n \ar[r]^\partial & B_{n-1} \ar[r] & 0}$$

while I would have expected something like

The commutative diagram as I would have liked it

(I ran this through latex on my laptop, so I think it ought to parse).

All in all, I think the end result of the Latex for WordPress plug-in is pretty cool. In general, the lack of support for commutative diagrams in the public WordPress service is a minor issue, but since I expect to be blogging a bit about algebraic topology and category theory, I may put an effort into setting up a properly configured service, If I can find the time and a suitable environment.

It is worth noting that the browser always requests images from your webserver and never sends a request directly to the Mimetex service. Thus, the first time a formula is to be rendered, the webserver requests the image from the Mimetex service, caches the result locally and only then serves up the image to the browser. Obviously, this takes quite a burden off of the shoulders of the public Mimetex service providers.