找回密码
 快速注册
搜索
查看: 64|回复: 1

MathML pseudoscript

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-9-5 06:33 |阅读模式
本帖最后由 hbghlyj 于 2022-9-6 18:01 编辑
有一些Unicode是专门为了在纯文本中作为上标/下标, 例如 prime(minute) ′ 与 double prime(second) ″ 与 triple prime ‴ ,在通常的字体中已经被缩小、升高了, 如果放到<msup>或<msub>中, 就会被再次缩小、升高 (Miscrosoft Word) Screenshot 2022-09-02 at 02-02-12 mspace - MathML MDN.png
MathML规定, 当这些字符作为上标/下标时, 当pseudoScripts属性为true时(默认为true)会作特殊处理: 将它们放到正常的大小和位置. Screenshot 2022-09-02 at 02-02-12 mspace - MathML MDN.png

比如
  1. \[a^′\]
复制代码

MathJax生成的MathML为
  1. <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  2.   <msup>
  3.     <mi>a</mi>
  4.     <mrow data-mjx-texclass="ORD">
  5.       <mo data-mjx-pseudoscript="true">&#x2032;</mo>
  6.     </mrow>
  7.   </msup>
  8. </math>
复制代码

这样 a^′ (上标撇号) 显示的效果与 a' (直单引号) 一致. 但是 a′ 效果为 $a′$ , \text{a′} 效果为 $\text{a′}$.

参考资料
hawkeslearning.com/Accessibility/guides/mathml_content.html#pseudoscripts
davidcarlisle.github.io/mathml/#chars_pseudo-scripts
w3.org/TR/MathML3/chapter7.html#chars.pseudo-scripts
antennahouse.com/hubfs/xsl-fo-sample/graphics/mathml-encloseCirc ... ipts-1.pdf?hsLang=en
github.com/w3c/mathml/issues/251
github.com/mathjax/MathJax/issues/2791

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-9-5 06:44
core/MmlTree/SerializedMmlVisitor.ts 行204
  1.     node.getProperty('pseudoscript') && this.setDataAttribute(data, 'pseudoscript', 'true');
复制代码

core/MmlTree/MmlNodes/mo.ts 行435-445
  1.   protected checkPseudoScripts(mo: string) {
  2.     const PSEUDOSCRIPTS = (this.constructor as typeof MmlMo).pseudoScripts;
  3.     if (!mo.match(PSEUDOSCRIPTS)) return;
  4.     const parent = this.coreParent().Parent;
  5.     const isPseudo = !parent || !(parent.isKind('msubsup') && !parent.isKind('msub'));
  6.     this.setProperty('pseudoscript', isPseudo);
  7.     if (isPseudo) {
  8.       this.attributes.setInherited('lspace', 0);
  9.       this.attributes.setInherited('rspace', 0);
  10.     }
  11.   }
复制代码

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 15:47

Powered by Discuz!

× 快速回复 返回顶部 返回列表