本文介绍了无法使用MathJax和MathML垂直渲染两个数字的加法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在网页上绘制两个数字,如下所示:

I would like to render two numbers on a web page like this:

    123
  + 456
 ______

我找到了这个例子:

<mstack>
  <mn>496</mn>
  <msrow> <mo>+</mo> <none/> <mn>28</mn> </msrow>
  <msline/>
</mstack>

但是 MathJax不支持mstack,msrow和msline元素.尝试使用mtable

but MathJax doesn't support mstack, msrow and msline elements.I've attempted to use a mtable

<body>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
        <mtable id="test" columnalign="right">
            <mtr><mtd></mtd><mtd><mn>12321</mn></mtd></mtr>
            <mtr><mtd><mo>+</mo></mtd><mtd><mn>45665445</mn></mtd></mtr>
       </mtable>
    </math>
</body>

使用此CSS:

 <style type="text/css">
       #test
       {
           border-bottom:1px solid black;
       }
    </style>

,但底部边框与较低的数字重叠.有没有办法通过MathJax/MathML来实现这种布局?

but the bottom border is overlapping the lower number. Is there a way to achieve this layout with MathJax/MathML?

推荐答案

您可以在MathML规范中查看这种布局的示例,网址为

You can see examples of this kind of layout in the MathML spec at

http://www.w3.org/Math/draft-spec/mathml.html#chapter3_presm.elemmath.examples

如果在文档加载后选择使用MathJax转换并显示"按钮,则MathML3 mstack标记将转换为MathJax可以理解的MathML2.该页面上所有相关的javascript都是可用的链接.

If, once the document has loaded, you select the button "convert and display with MathJax" then the MathML3 mstack markup will be transformed to some MathML2 that MathJax understands. The relevant javascript is all available linked from that page.

我和MathJax开发人员之间的讨论也很重要

Also relevant is the discussion between myself and the MathJax developer at

https://groups.google.com/forum/#!msg/mathjax-users/wa85p5TAIe4/hgUoLEXrweoJ

这篇关于无法使用MathJax和MathML垂直渲染两个数字的加法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 21:00