3

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.

David Duran
  • 1,786
  • 1
  • 25
  • 36
  • I'd prefer MathJAX over MathML. LaTeX is the best math typesetting software ever written: http://www.mathjax.org/ – duffymo Sep 06 '13 at 12:15
  • Thank you. I knew LaTeX, but I didn't know that is supported in html. Another point for LaTeX. – David Duran Sep 06 '13 at 13:41
  • It's a very nice JavaScript engine. Works beautifully. – duffymo Sep 06 '13 at 14:01
  • While MathJAX works *very* well in practice, it has a number of drawbacks in the long run. It relies on JavaScript being enabled client-side, it takes time to render stuff, it might not be as accessible to the visually impaired, or so good for digital interchange. MathML, if supported properly, should be the better solution in the long run. We are not there yet, though. – MvG Sep 06 '13 at 14:56
  • 2
    Please don't confuse MathJax with LaTeX -- TeX and LaTeX are specific programs (or programming languages, depending on your pov). MathJax is modular and extensible in its input, currently supporting MathML, asciimath and a restricted TeX/LaTeX syntax. In addition, MathJax implements the TeX layout algorithm in its output -- but that does not make it TeX ;) In addition, MathJax's internal format is MathML and its rendering renders said MathML as HTML/CSS or SVG (again, it's modular). MathML is the web standard for mathematical notation and should be preferred when possible. – Peter Krautzberger Sep 06 '13 at 16:28

2 Answers2

13

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.

Peter Krautzberger
  • 5,145
  • 19
  • 31
  • 2
    Since this still gets upvotes: MathJax [supports Content MathML](http://docs.mathjax.org/en/latest/mathml.html#content-mathml) very well these days and can also be [used server-side](http://docs.mathjax.org/en/latest/advanced/mathjax-node.html). – Peter Krautzberger Feb 10 '17 at 08:45
1

I'd guess that this problem is due to your mix of presentation and content markup. The <cos/> and <sin/> elements are content markup and as such make sense almost exclusively in the body of an <apply>. You might be better off sticking to presentation markup exclusively, using <mo>cos</mo> and <mo>sin</mo> to denote the operators.

MvG
  • 57,380
  • 22
  • 148
  • 276