MathML标签:“ stretchy”属性问题

问题描述 投票:0回答:1

[我想知道,在下面的示例中,为什么stretchy标签的mo属性给出相似的显示。我以为下面的第二个MathML(带有<mo stretchy="false">∑</mo>会在求和符号的顶部和底部显示上限和下限(如下图2所示)。但是两个示例(带有<mo stretchy="true">∑</mo><mo stretchy="false">∑</mo>分别)在求和符号的两侧显示极限:

备注:我正在使用MathJax

带有MathML的HTML

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>MathJax TeX to MathML Page</title>
    <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
    </script>
</head>
<body>
    <p>With stretchy="true"</p>
    <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><msubsup><mo stretchy="true">∑</mo><mrow><mi>k</mi><mo>=</mo><mn>0</mn></mrow><mrow><mi>n</mi></mrow></msubsup><mrow><mfenced separators="|"><mrow><mfrac linethickness="0pt"><mrow><mi>n</mi></mrow><mrow><mi>k</mi></mrow></mfrac></mrow></mfenced><msup><mrow><mi>x</mi></mrow><mrow><mi>k</mi></mrow></msup><msup><mrow><mi>a</mi></mrow><mrow><mi>n</mi><mo>-</mo><mi>k</mi></mrow></msup></mrow></mrow></math>
    <p>With stretchy="false"</p>
    <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><munderover><mo stretchy="false">∑</mo><mrow><mi>k</mi><mo>=</mo><mn>0</mn></mrow><mrow><mi>n</mi></mrow></munderover><mrow><msup><mrow><mi>r</mi></mrow><mrow><mi>k</mi></mrow></msup></mrow></mrow></math>
</body>
</html>

上述HTML的显示 [使用MathJax]:

enter image description here

期望显示第二个MathML(带有<mo stretchy="false">∑</mo>):

enter image description here

mathjax mathml
1个回答
0
投票

您使用了错误的属性。不是您想要的strethy="false",而是movablelimits="false"(或在表达式周围使用<math display="block"><mstyle displaystyle="true">)。

例如:

<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/mml-chtml.js"></script>

<p>
<b>movablelimits="false"</b>
<br>

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <munderover>
    <mo movablelimits="false">∑</mo>
    <mrow>
      <mi>k</mi>
      <mo>=</mo>
      <mn>0</mn>
    </mrow>
    <mi>n</mi>
  </munderover>
  <msup>
    <mi>r</mi>
    <mi>k</mi>
  </msup>
</math>

</p><p>

<b>display="block"</b>
<br>

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <munderover>
    <mo>∑</mo>
    <mrow>
      <mi>k</mi>
      <mo>=</mo>
      <mn>0</mn>
    </mrow>
    <mi>n</mi>
  </munderover>
  <msup>
    <mi>r</mi>
    <mi>k</mi>
  </msup>
</math>

</p><p>

<b>mstyle displaystyle="true"</b>
<br>

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mstyle displaystyle="true">
  <munderover>
    <mo>∑</mo>
    <mrow>
      <mi>k</mi>
      <mo>=</mo>
      <mn>0</mn>
    </mrow>
    <mi>n</mi>
  </munderover>
  <msup>
    <mi>r</mi>
    <mi>k</mi>
  </msup>
  </mstyle>
</math>

</p>

但是请注意,它们会产生不同的输出。第一个使用较小的求和符号(因为它是嵌入式数学样式),第二个使用单独的一行以数学为中心,第三个使用嵌入式,但是使用显示模式布局规则。

© www.soinside.com 2019 - 2024. All rights reserved.