mathjax - MathML 标签:“stretchy”属性问题
问题描述
我想知道,在下面的示例中,为什么标签的弹性属性mo
给出了类似的显示。我认为MathML
下面的第二个(with<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]:
第二个 MathML 的所需显示(带有<mo stretchy="false">∑</mo>
):
解决方案
您使用了错误的属性。这不是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>
但是请注意,这些会产生不同的输出。第一个使用较小的求和符号(因为它是内联数学样式),第二个使用单独的行,以数学为中心,第三个是内联,但使用显示模式布局规则。
推荐阅读
- node.js - 有没有办法让机器人在 Discord 上创建公会?
- python - 正确处理 bash 命令转义字符
- reactjs - 如何添加偏移材质-ui Grid
- branch.io - 合并 Branch.io 和 Segment.io 用户在 Amplitude 上的归因数据时出现问题
- javascript - 我正在用javascript编写一个基本的国际象棋引擎。如何在 3d 数组中的特定元素处插入字符串?
- php - 未定义属性:Illuminate\Pagination\LengthAwarePaginator::$images
- macos - 将字符打印到标准输出,x86 mac
- php - Polylang - 如何在触发“plugins_loaded”操作之前在插件或 mu-plugin 中添加“add_filter”
- javascript - Javascript使用导航器将url链接复制到剪贴板
- php - 当使用带有 HTML 下拉框选择器的 PHP 时,它给了我一个未定义的错误?