문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top