找回密码
 快速注册
搜索
查看: 72|回复: 2

[MathJax]\mmlToken

[复制链接]

3147

主题

8384

回帖

6万

积分

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

积分
65372
QQ

显示全部楼层

hbghlyj 发表于 2022-5-9 03:44 |阅读模式
  1. \mmlToken{mi}[mathvariant=script]{kuing}
复制代码
$$\mmlToken{mi}[mathvariant=script]{kuing}$$来自mathjax.pdf第60页,源代码为
  1. /**
  2. * The mapping of control sequence to function calls
  3. */
  4. const MmlMap = new CommandMap('mmlMap', {
  5. mi: ['mmlToken', 'mi'],
  6. mo: ['mmlToken', 'mo'],
  7. mn: ['mmlToken', 'mn'],
  8. ms: ['mmlToken', 'ms'],
  9. mtext: ['mmlToken', 'mtext']
  10. }, {
  11. mmlToken(parser, name, type) {
  12. const typeClass = parser.configuration.nodeFactory.mmlFactory.
  13. ˓→getNodeClass(type);
  14. const def = parseAttributes(parser.GetBrackets(name), typeClass);
  15. const text = convertEscapes(parser.GetArgument(name));
  16. const mml = parser.create('node', type, [parser.create('text', text)], def);
  17. if (type === 'mi') mml.setTeXclass = classORD;
  18. parser.Push(mml);
  19. }
  20. });
复制代码
语法    \mmlToken{type}[attributes]{text}
(第3个参数text内含的指令不会被处理)

3147

主题

8384

回帖

6万

积分

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

积分
65372
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-5-9 04:11
$\mmlToken{mover}{}$
报错: mover is not a token element
根据MathML文档第3章, token element只有以下六种:
mi		identifier
mn		number
mo		operator, fence, or separator
mtext		text
mspace		space
ms		string literal

3147

主题

8384

回帖

6万

积分

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

积分
65372
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-5-9 04:13
那么怎样使用mover元素呢? MathJax的指令\overset可以做到这一点:

$\overset{\text{top}}{\text{bottom}}$
  1. <math xmlns="http://www.w3.org/1998/Math/MathML">
  2.   <mover>
  3.     <mtext>bottom</mtext>
  4.     <mtext>top</mtext>
  5.   </mover>
  6. </math>
复制代码
利用\mmlToken可以把“等号”拉长成为“双上划线”:

$\overset{=}{aaaaaaaa}$

$\overline{\overline{aaaaaaaa}}$

$\def\overscore{\mmlToken{mo}[stretchy="true"]{=}}
\overset{\overscore}{aaaaaaaa}$

$\def\overscore{\mmlToken{mo}[stretchy="true" accent="true"]{=}}
\overset{\overscore}{aaaaaaaa}$
  1. $\overset{=}{aaaaaaaa}$
  2. $\overline{\overline{aaaaaaaa}}$
  3. $\def\overscore{\mmlToken{mo}[stretchy="true"]{=}}
  4. \overset{\overscore}{aaaaaaaa}$
  5. $\def\overscore{\mmlToken{mo}[stretchy="true" accent="true"]{=}}
  6. \overset{\overscore}{aaaaaaaa}$
复制代码
注意,最后一个例子中,stretchy和accent属性是用空格分隔的,这是原先的设计,但是为了适应用户习惯,后来加入了对逗号分隔的支持

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

GMT+8, 2025-3-4 19:26

Powered by Discuz!

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