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

On Sat, Apr 21, 2012 at 9:48 AM, Dirk Schulze <> 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 "";
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 <> wrote:
> I really like the way wikipedia creates formulas:
> It's simple and the
> output looks very good.
> Maybe we can have texcv ( 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 UTC