MML MathJax <mi mathvariant =“double-struck”>常见HTML无法在iOS和Android手机中正常显示

时间:2016-04-28 12:56:21

标签: mathjax

我们正在将我们的MathJax渲染选项从HTML-CSS更新为Common HTML。使用HTML-CSS我们在显示数学内容时没有任何问题,但是使用新的Common HTML配置,我们现在在iOS和Android手机中存在字符显示问题。我附上了一个代码示例。任何人都可以指出MML中的潜在问题。使用iPhone 6或Android http://codepen.io/Terminalpunk/pen/pyxPWV

可以在此CodePen上看到此问题

Here is an example image of the problem

<!DOCTYPE html>
<html lang="en" xmlns:mml="http://www.w3.org/1998/Math/MathML">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
</head>
<body>
    <h2>Working in Android and iOS</h2>
    <p>
        <span data-equation-construct="true" class="math-equation-construct">
            <span data-equation-mathml="true" class="math-equation-mathml">
                <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
                    <msubsup xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mrow>
                            <mover accent="true">
                                <mo stretchy="true">ˆ</mo>
                                <mrow>
                                    <mi>γ</mi>
                                </mrow>
                            </mover>
                        </mrow>
                        <mrow>
                            <mi mathvariant="double-struck">G</mi>
                            <mo>+</mo>
                            <mi mathvariant="double-struck">B</mi>
                        </mrow>
                        <mrow>
                            <mtext>GLM</mtext>
                        </mrow>
                    </msubsup>
                </mml:math>
            </span>
        </span>.
    </p>

    <p>
        <span data-equation-construct="true" class="math-equation-construct">
            <span data-equation-mathml="true" class="math-equation-mathml">
                <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
                    <msubsup xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mover accent="true">
                            <mrow>
                                <mrow>
                                    <mi mathvariant="double-struck">ℙ</mi>
                                </mrow>
                            </mrow>
                            <mo stretchy="true">ˆ</mo>
                        </mover>
                        <mi>i</mi>
                        <mrow>
                            <mspace width="thinmathspace"></mspace>
                            <mrow></mrow>
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mrow></mrow>
                        </mrow>
                    </msubsup>
                    <mo xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">=</mo>
                    <msubsup xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mrow>
                            <mover accent="true">
                                <mi>p</mi>
                                <mo stretchy="true">ˆ</mo>
                            </mover>
                        </mrow>
                        <mi>i</mi>
                        <mrow>
                            <mspace width="thinmathspace"></mspace>
                            <mrow></mrow>
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mrow></mrow>
                        </mrow>
                    </msubsup>
                    <msub xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mrow>
                            <mrow>
                                <mi mathvariant="double-struck">ℙ</mi>
                            </mrow>
                        </mrow>
                        <mn>0</mn>
                    </msub>
                </mml:math>
            </span>
        </span> and
        <span data-equation-construct="true" class="math-equation-construct">
            <span data-equation-mathml="true" class="math-equation-mathml">
                <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
                    <msubsup xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mover accent="true">
                            <mrow>
                                <mrow>
                                    <mi mathvariant="double-struck">ℙ</mi>
                                </mrow>
                            </mrow>
                            <mo stretchy="true">ˆ</mo>
                        </mover>
                        <mi>i</mi>
                        <mrow>
                            <mspace width="thinmathspace"></mspace>
                            <mrow></mrow>
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mrow></mrow>
                        </mrow>
                    </msubsup>
                    <mo xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">=</mo>
                    <msubsup xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mrow>
                            <mover accent="true">
                                <mi>p</mi>
                                <mo stretchy="true">ˆ</mo>
                            </mover>
                        </mrow>
                        <mi>i</mi>
                        <mrow>
                            <mspace width="thinmathspace"></mspace>
                            <mrow></mrow>
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mrow></mrow>
                        </mrow>
                    </msubsup>
                    <msub xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mrow>
                            <mrow>
                                <mi mathvariant="double-struck">ℙ</mi>
                            </mrow>
                        </mrow>
                        <mn>0</mn>
                    </msub>
                </mml:math>
            </span>
        </span>
    </p>

    <h2>Not Working Android and iOS</h2>
    <p>
        <span data-equation-construct="true" class="math-equation-construct">
            <span data-equation-mathml="true" class="math-equation-mathml">
                <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
                    <msubsup xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mrow>
                            <mi mathvariant="bold">γ</mi>
                        </mrow>
                        <mrow>
                            <mspace width="thinmathspace"></mspace>
                            <mrow></mrow>
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mo>+</mo>
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mrow></mrow>
                        </mrow>
                        <mtext>GLM</mtext>
                    </msubsup>
                </mml:math>
            </span>
        </span>
    </p>

    <p>
        <span data-equation-construct="true" class="math-equation-construct">
            <span data-equation-mathml="true" class="math-equation-mathml">
                <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
                    <msub xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mover accent="true">
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mo stretchy="true">ˆ</mo>
                        </mover>
                        <mrow>
                            <mspace width="thinmathspace"></mspace>
                            <mrow></mrow>
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mrow></mrow>
                        </mrow>
                    </msub>
                </mml:math>
            </span>
        </span>,
        <span data-equation-construct="true" class="math-equation-construct">
            <span data-equation-mathml="true" class="math-equation-mathml">
                <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
                    <msub xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mover accent="true">
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mo stretchy="true">ˆ</mo>
                        </mover>
                        <mrow>
                            <mspace width="thinmathspace"></mspace>
                            <mrow></mrow>
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mrow></mrow>
                        </mrow>
                    </msub>
                </mml:math>
            </span>
        </span>,
        <span data-equation-construct="true" class="math-equation-construct">
            <span data-equation-mathml="true" class="math-equation-mathml">
                <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
                    <msub xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1998/Math/MathML">
                        <mover accent="true">
                            <mrow>
                                <mi mathvariant="double-struck"></mi>
                            </mrow>
                            <mo stretchy="true">ˆ</mo>
                        </mover>
                        <mi mathvariant="normal">Z</mi>
                    </msub>
                </mml:math>
            </span>
        </span>
    </p>

    <!-- This Works -->
    <!-- script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_HTMLorMML"></script-->

    <!-- This doesn't work -->
    <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_CHTML"></script>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

MathJax库已经接受了一个问题,但是已经提供了对MML的内容修复Git Hub Issue 1451

  

当你引用像

这样的双重字符时      

<mi mathvariant="double-struck">&#x1D53D;</mi>   你实际上是在过度指定变体。字符?已经被双击,因此在这种情况下不需要指定mathvariant =“double-struck”。 CommonHTML仍然应该正确处理这种情况,但目前还没有。发生的事情是,MathJax实际上并没有在其字体中找到这个字符,因此制作了一个Unicode参考,希望可以在系统上安装的某些字体中找到该字符。当您从台式机查看时,您显然有包含这些字符位置的字体(可能是STIX字体?),因此系统可以显示它们。大多数移动设备没有这些字体,因此它们不会显示在那里。

     

在移动设备上运行的示例使用双击P,它位于ℙ,事实证明,CommonHTML可以正确识别找到此字符的Letterlike Symbols块中的字符,因此可以正确处理你(但注意方程中缺少的双击B和G,包括P')。双击B(和G)在初始方程中起作用的原因是你使用了

     

<mi mathvariant="double-struck">B</mi>而不是使用?。

中的数学字母表参考      

CommonHTML输出应该将Math Alphabetic引用转换为它自己的字体中的正确位置,但它当前没有这样做(HTML-CSS和SVG输出这样做,这就是为什么它之前适用于你)。这应该是固定的,但是现在,你可以使用

     

<mi mathvariant="double-struck">F</mi>而不是<mi mathvariant="double-struck">&#x1D53D;</mi>

     

@dpvc提供的答案