Wednesday, May 16, 2007

HTML: a pain in the math

If you're unfamiliar with the trials and tribulations of trying to create web pages discussing math, the page Math in HTML (and CSS) sums up the abysmal state of affairs pretty well.

At this point, MathML is still more a dream than reality. Usually, my preferred solution involves rendering LaTeX to GIF or PNG and uploading the images (my favorite online renderer).

Lately, given the goal of learning several things at once, I've been posting little applets here and there. Today's offering attempts to address some of the math + HTML challenges I've encountered.

Given the caps of HTML and CSS, we can:

1. Create tables.
2. Nest tables inside cells of other tables.
3. Define top, left, right and bottom cell borders independently.
4. Specify alignment and justification of cell contents.

These pieces are enough to cobble together fairly decent looking matrix expressions in HTML. Plus, unlike rendered expressions, the elements of these matrices can be selected and copied to the clipboard, because the matrices are constructed from HTML tables.

Here's a sample capture of a matrix expression I created in HTML:

(I'd embed the actual HTML, but Blogger likes to muck with pasted HTML.)

The brackets are a combination of cell borders (top / bottom) and table borders (left / right).

Not exactly rocket science, but two big motivators are my own needs and the fact that there appear to be a lot of frustrated people on the Net who are resorting to techniques that are less aesthetically pleasing and/or hackier.

Here's a link to a little applet that constructs matrix expressions using a simple syntax (to which I should probably devote a little more effort towards documenting):

Matrices in HTML Applet.


Note: If you think about it, the ability to nest tables within tables and define sizes coupled with the layout engine of the browser offers some promise in laying out mathematical expressions fairly easily. At this point, I'm left pondering how many LaTex expressions could be reasonably supported.

Update (5/28/2007): I discovered a list of programs that convert LaTeX to HMTL. Also, Approaches to WWW Mathematics Documents.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home