<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

瀏覽器相容性

另見