W3C home > Mailing lists > Public > public-fx@w3.org > April to June 2012

Re: [Filter Effects][css3-transforms] Using MathML for formulas

From: Aryeh Gregor <ayg@aryeh.name>
Date: Sun, 22 Apr 2012 12:11:57 +0300
Message-ID: <CAKA+AxmW+31ya_Hg41kXYrMTA9D_xC9HrcoyRW8Cf2M0_Jo0mQ@mail.gmail.com>
To: Dirk Schulze <dschulze@adobe.com>, Rik Cabanier <cabanier@gmail.com>
Cc: "public-fx@w3.org" <public-fx@w3.org>
On Sat, Apr 21, 2012 at 9:48 AM, Dirk Schulze <dschulze@adobe.com> wrote:
> Even if viewers are not consistent, at least specifications should be. Ideally we use MathML and provide some fallback. Sadly I have no idea how it can be done without JS (which is not necessarily enabled and shouldn't be required to read a specification).

I think you can do something sneaky using CSS selectors, like

@namespace mathml "http://www.w3.org/1998/Math/MathML";
math { display: none }
mathml|math { display: block }
mathml|math + .fallback { display: none }

Then use markup like

<math><!-- MathML here --></math>
<img class="fallback" ...>

In a browser that puts <math> in the MathML namespace in text/html per
HTML5, and supports CSS Namespaces, the <math> element will be visible
and the <img> will vanish.  In browsers that don't support MathML or
don't support CSS Namespaces, the <math> will vanish.  The only case
in which it will fail unpleasantly is if the browser doesn't support
CSS at all, in which case you'll get some mangled version of the
<math> tag as well as the image.

You still have to contend with the possibility that browsers will have
bad MathML implementations and would be better served by using the
<img>, though.

On Sun, Apr 22, 2012 at 12:10 AM, Rik Cabanier <cabanier@gmail.com> wrote:
> I really like the way wikipedia creates formulas:
> http://en.wikipedia.org/wiki/Help:Displaying_a_formula. It's simple and the
> output looks very good.
> Maybe we can have texcv (http://en.wikipedia.org/wiki/Wikipedia:Texvc) on
> the server when we send the HTML to the w3c server for post-processing.

texvc is basically just a thin wrapper around LaTeX, whose primary
purpose in life is to sanitize input so users can't throw Wikimedia
servers into infinite loops by defining recursive macros or whatever.
It's also written in OCaml, and nobody understands it.  You're
probably better off just shelling out to latex directly.
Received on Sunday, 22 April 2012 09:12:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 22 April 2012 09:12:47 GMT