提问者:小点点

演示数学ML:如何在初等数学中正确放置十进制数的长加法的结转?


我正在尝试根据长加法的初级数学生成 MathML。从 W3 网站的例子来看,只有没有小数点的赋值,例如

<mstack>
  <mscarries crossout='updiagonalstrike'>
    <mn>2</mn>  <mn>12</mn>  <mscarry crossout='none'> <none/> </mscarry>
  </mscarries>
  <mn>2,327</mn>
  <msrow> <mo>-</mo> <mn> 1,156</mn> </msrow>
  <msline/>
  <mn>1,171</mn>
</mstack>

所以,我刚刚创建了自己的MathML文件,其中包含带小数点的数字。我的MathML是:

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mstack>
    <mn>789.255</mn>
    <msrow>
       <mo>+</mo>
       <mn>56.86</mn>
    </msrow>
    <mscarries>
       <mn>1</mn>
       <mn>1</mn>
       <mn>1</mn>
       <mn>1</mn>
       <none/>
       <none/>
    </mscarries>
    <msline/>
    <mn>846.115</mn>
  </mstack>
</math>

您可以看到结转没有正确放置。它们从左边的(不可见的)小数点前面开始,而不是从最右边的列开始到左边。

有人知道如何根据MathML使用初等数学正确放置这些结转吗?(我也试着用< code>stackalign='right'作为< code>mstack的属性但是看起来也不怎么样。)

提前感谢!


共1个答案

匿名用户

据我所知,没有一个基于Web的MathML渲染器足够支持MathML 3的所谓“初等数学”部分。

正如评论中提到的,fmath似乎不支持location=“s”。

WIRIS是最接近的(有轻微的视觉故障),MathJax的实验扩展对此有问题(由于其hackymsline技巧),但可以大致正确。

不幸的是,它们在bug方面有所不同,因此这里为每个示例提供一个MathML示例。

以下内容在WIRIS(但不是MathJax)中运行良好:

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mstack>
    <mn>789.255</mn>
    <mscarries location="s">
       <mn>1</mn>
       <mn>1</mn>
       <mn>1</mn>
        <none/>
       <mn>1</mn>
        <none/>
        <none/>
    </mscarries>
    <msrow>
       <mo>+</mo>
       <mn>56.86</mn>
       <none/>
    </msrow>
    <msline/>
    <mn>846.115</mn>
  </mstack>
</math>

下一个在MathJax上可以正常工作(使用mml3扩展,例如使用http://codepen.io/pkra/pen/QwbJWa ),但在WIRIS上不行。

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mstack>
    <mn>789.255</mn>
    <mscarries position="-2" location="s">
       <mn>1</mn>
       <mn>1</mn>
       <mn>1</mn>
        <none/>
       <mn>1</mn>
    </mscarries>
    <msrow>
       <mo>+</mo>
       <mn>56.86</mn>
       <none/>
    </msrow>
    <msline/>
    <mn>846.115</mn>
  </mstack>
</math>

免责声明:我是MathJax团队的一员。