Search code examples
htmlmathmathml

MathML not working


I have tried to display a simple equation but it doesn't work. My code is as follow (html5):

<math xmlns="http://www.w3.org/1998/Math/MathML" display = 'block'>
    <mrow>
        <msub>
            <mi>a</mi>
            <mi>i</mi>
        </msub>
        <mo>=</mo>
        <msub>
            <mi>a</mi>
            <mi>z</mi>
        </msub>
        <sin/>
        <mi mathvariant='normal' fontfamily='Times New Roman'>α</mi>
        <mo>&minus;</mo>
        <msub>
            <mi>a</mi>
            <mi>x</mi>
        </msub>
        <cos/>
        <mi mathvariant='normal' fontfamily='Times New Roman'>α</mi>
    </mrow>
</math>

In Opera or Chrome I cannot see neither the trigonometrical operations nor the subindices. While in Firefox I can see the subindices but not the trigonometrical operations. Can someone say where the error is? Thanks in advance.


Solution

  • The answer is unfortunately simple: MathML is not supported in Chrome, Opera and IE.

    Firefox has a very solid implementation (but not yet complete), Safari only a very partial implementation. Neither Firefox nor Safari support Content MathML.

    That's why you'll need to use a polyfill like MathJax (cf MathML support) or jqmath.

    Neither of those polyfills supports Content MathML, so you'll want to follow MvG's advice to produce Presentation MathML.

    On older IE (6-9), users can install the MathPlayer plugin which is the only implementation supporting all of Presentation and Content MathML.