Shlomi Fish ([info]shlomif) wrote,
@ 2006-09-13 00:18:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Current location:Home
Current mood:accomplished
Current music:Churchills - Chorale for Young Lovers
Entry tags:firefox, formulae, formulas, hacking, html, konqueror, mathematics, mathml, mozilla, opera, web design, xhtml

Adventures in MathML Land

A long time ago I decided that in order to make the Math-Ventures part of my homesite more attractive, I'd like to convert all the mathematical formulae that had been written using ASCII Art (%-)) into MathML - an XML grammar for writing mathematics. Knowing that MathML was extremely verbose, I decided to try converting to HTML+MathML from LaTeX using TeX4ht. However, when viewed using Firefox (which has a built-in MathML support), the test page rendered all the formulae as plain text, which made me believe it was a bug in TeX4ht.

I left it at that for a long time, but a few days ago decided to give it another try. Again displaying it did not render it nicely. However, copy and pasting the notation into the MathML Tester on the Mozilla homepage, yielded perfect results. After a little thought, my woman (OK - programmer) intuition told me that maybe Mozilla displayed it badly due to the fact the file ended in the .html extension and as thus was treated with the content-type of text/html.

Changing the extension to .xhtml (with a content type of application/xhtml+xml), solved the problem and the formulae were redisplayed. So I finished converting the page from its ASCII-art mess into TeX and rendered it into XHTML+MathML. I needed to change the DOCTYPE to XHTML+MathML which involved some Latemp voodoo. (As it turned out, I didn't do it properly the first time, and as a result the page did not validate).

I also had to install and configure the MathML fonts, or otherwise got weird artifacts and missing symbols in the formulas.

Then I discovered that when served as .xhtml, the Google AdSense ads don't get displayed. I found a workaround here, and after a lot of experimenting got it to work. Then I needed to modify the <object> tag CSS to the following:

.ads_side, .ads_top_wide
{
    overflow: hidden;
}
.ads_side
{
    width:120px;
    height:600px;
}
.ads_top_wide
{
    width:500px;
    height:70px;
}

Otherwise, I got annoying scrollbars and clipped content at all the same reason. Many thanks to someone I talked with on the IRC who helped a lot.

So then the Google Ads worked. Afterwards, I decided to convert a diagram to SVG to make it l33ter. I had to write a Perl script and experiment a bit with affine transformations. The SVG works in Opera and Firefox 1.5.0.x, but doesn't work in Konqueror from some reason. The MathML works only in Firefox, because Opera and Konqueror don't support it. Here's the final result.

The way I see it, when more and more sites like mine will integrate cutting-edge technologies, then more people will have them on their browsers, and web designers will have an easier life. Similarly my Music Recommendations Page now uses display: table and display: table-cell which works well in Firefox, Konqueror and Opera but is broken in MSIE 6. This will provide further motivation for people to stop using MSIE.

Together, we can make the revolution happen! Well, in any case, cheers.




(Post a new comment)

XHTML woes
[info]leoc
2006-09-13 05:06 am UTC (link)
Unfortunately there are a couple of nasty gotchas with XHTML+MathML pages.

  1. MSIE <= 7 doesn't support XHTML. At all. It doesn't complain when you give it XHTML served as text/html, but that's only because XHTML served as text/html is actually invalid HTML tag-soup. (There's a rather dodgy special dispensation from the W3C to serve (some) XHTML 1.0 documents thus, but XHTML 1.1 should only ever be served as XHTML.)

  2. Google is completely feckless about XHTML. Google Search archives XHTML(-as-XHTML) pages as "File type: Unrecognised"; a while ago it didn't list them at all.

(Reply to this)(Thread)

Re: XHTML woes
[info]shlomif
2006-09-14 06:38 pm UTC (link)
MSIE <= 7 doesn't support XHTML. At all.

Didn't you mean "MSIE < 7" and not "<= 7"? Or does MSIE 7 also has the problem of not accepting the application/xml+xhtml content-type? I'm well aware of it, but as the other responder noted, it works fine with the MathML plugin. And plus, MSIE is declining, and I hope and expect that Firefox will become the defacto standard soon.

Google is completely feckless about XHTML.

I see the links very nicely in your URL you gave. What is the problem exactly?

(Reply to this)(Parent)

your page DOES work fine in IE+MathPlayer
[info]paul_topping
2006-09-14 04:25 pm UTC (link)
As usual, the anti-Microsoft hype is overblown. MathPlayer helps IE deal with XHTML (to some extent) and does a good job of displaying (and speaking!) MathML. Our free MathPlayer plugin is available here (http://www.dessci.com/mathplayer) along with some info on publishing cross-browser XHTML+MathML which you seem to have dealt with anyway.

We are coming out with a new version soon that will fix a couple of small bugs with IE7 but the current version still works fine.

Paul Topping
Design Science, Inc.

(Reply to this)(Thread)

Re: your page DOES work fine in IE+MathPlayer
[info]shlomif
2006-09-14 06:47 pm UTC (link)
Thanks for letting me know. Yes, I'm well aware of it. In any case, the page will not be displayed properly or half-properly by a vanilla MSIE, which is what I was talking about. And it will require more plugins for it to view the SVG image, etc.

And this page which I also mentioned, will not be displayed well at all due to the use of display: table and display: table-cell.

So MSIE still sucks.

(Reply to this)(Parent)(Thread)

Re: your page DOES work fine in IE+MathPlayer
[info]paul_topping
2006-09-14 08:31 pm UTC (link)
I'm not pro-Microsoft or even pro-IE, but it still amazes me the lengths that people will go to make their content inaccessible to those that prefer IE. Shouldn't making your writing available to the widest audience possible trump the value of griping about Microsoft? It's not like anyone's paying you to make Firefox's case.

I like to think of myself as someone who will stand on principles too but I would not go this far just to make a point against Microsoft who doesn't care what I say anyway.

Paul

(Reply to this)(Parent)(Thread)

Re: your page DOES work fine in IE+MathPlayer
[info]shlomif
2006-09-15 09:36 am UTC (link)
it still amazes me the lengths that people will go to make their content inaccessible to those that prefer IE.

I'm not going to any great lengths. It's just that when designing web pages, (according to the standards) I often encounter features that don't work in MSIE, and recently started deciding that working around them would be too much work, and not really worth it. Most of the audience I care about is using a non-MSIE browser anyway, and I have an anti-MSIE browser on my home site to educate the surfers.

Shouldn't making your writing available to the widest audience possible trump the value of griping about Microsoft?

Not at all costs. If MS did not suck, and actually improved their browser in the last few years where they did practically nothing to improve it, then maybe I'll cater for them. But right now with MSIE 7 they're doing too little and too late, and I couldn't care less about the people who are using MSIE, because they're probably going to switch to Firefox soon anyway. I recently converted a British lady with whom I talked on IRC to Firefox, and she's not a geek. (And she said she's going to convert her sister and her friend).

As more and more webmasters start enhancing their sites for non-MSIE (but standards-compliant) browsers, there will be more pressure on people to convert, and we'll be better off ditching MSIE for good.

I like to think of myself as someone who will stand on principles too but I would not go this far just to make a point against Microsoft who doesn't care what I say anyway.

They will start to care once more and more sites (like mine) will be incompatible with MSIE, and less and less people will use it. Or they won't and simply lose their share of the browser market.

(Reply to this)(Parent)


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…