<mmultiscripts>

Baseline 已广泛支持

此功能已成熟,并且在众多设备和浏览器版本上都能正常工作。自 2023 年 1 月以来,它已在各浏览器中可用。

<mmultiscripts> MathML 元素用于一次性为表达式附加任意数量的下标和上标,这是对 <msubsup> 元素的泛化。脚本可以是前置脚本(放在表达式前面)或后置脚本(放在表达式后面)。

MathML 使用以下语法:一个基本表达式,后跟任意数量的后置下标和后置上标对(按给定顺序附加),之后可选择性地跟一个 <mprescripts> 元素,然后是任意数量的前置下标和前置上标对(按给定顺序附加)。此外,空 <mrow> 元素可用于表示缺失的脚本。

html
<mmultiscripts>
  base
  post-sub-script-1 post-sup-script-1
  post-sub-script-2 post-sup-script-2
  post-sub-script-3 post-sup-script-3
  ...
  post-sub-script-N post-sup-script-N
  <mprescripts />                    ⎫
  pre-sub-script-1 pre-sup-script-1  ⎪
  pre-sub-script-2 pre-sup-script-2  ⎬ Optional
  pre-sub-script-3 pre-sup-script-3  ⎪
  ...                                ⎪
  pre-sub-script-M pre-sup-script-N  ⎭
</mmultiscripts>

属性

此元素的属性包括 全局 MathML 属性以及以下已弃用的属性

subscriptshift 已弃用 不标准

一个 <length-percentage> 值,表示下标基线向下移动的最小量。

superscriptshift 已弃用 不标准

一个 <length-percentage> 值,表示上标基线向上移动的最小量。

注意:对于 subscriptshiftsuperscriptshift 属性,某些浏览器也可能接受 旧版 MathML 长度

示例

使用 <mprescripts>

<mprescripts> 元素之后的子元素被放置为前置脚本(在基本表达式之前)

html
<math display="block">
  <mmultiscripts>
    <mi>X</mi> <!-- base expression -->
    <mi>a</mi> <!-- post-sub-script -->
    <mi>b</mi> <!-- post-sup-script -->
    <mprescripts />
    <mi>c</mi> <!-- pre-sub-script -->
    <mi>d</mi> <!-- pre-sup-script -->
  </mmultiscripts>
</math>

空脚本

<mrow> 元素可用于表示缺失的脚本

html
<math display="block">
  <mmultiscripts>
    <mi>X</mi>    <!-- base expression -->
    <mrow></mrow> <!-- post-sub-script -->
    <mi>b</mi>    <!-- post-sup-script -->
    <mprescripts />
    <mi>c</mi>    <!-- pre-sub-script -->
    <mrow></mrow> <!-- pre-sup-script -->
  </mmultiscripts>
</math>

脚本顺序

这是一个更复杂的示例,包含许多脚本,以便您可以看到它们附加到基值上的顺序

html
<math display="block">
  <mmultiscripts>
    <mi>X</mi> <!-- base expression -->
    <mn>1</mn> <!-- post-sub-script-1 -->
    <mn>2</mn> <!-- post-sup-script-1 -->
    <mn>3</mn> <!-- post-sub-script-2 -->
    <mn>4</mn> <!-- post-sup-script-2 -->
    <mprescripts />
    <mn>5</mn> <!-- pre-sub-script-1 -->
    <mn>6</mn> <!-- pre-sup-script-1 -->
    <mn>7</mn> <!-- pre-sub-script-2 -->
    <mn>8</mn> <!-- pre-sup-script-2 -->
  </mmultiscripts>
</math>

技术摘要

隐式 ARIA 角色 None

规范

规范
MathML Core
# prescripts-and-tensor-indices-mmultiscripts

浏览器兼容性

另见