找回密码
 快速注册
搜索
查看: 47|回复: 6

[MathML]手动在Operator dictionary中增加\sup,\inf

[复制链接]

3149

主题

8387

回帖

6万

积分

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

积分
65397
QQ

显示全部楼层

hbghlyj 发表于 2022-5-28 02:30 |阅读模式
本帖最后由 hbghlyj 于 2022-5-29 10:13 编辑 在Firefox MathML中,发现<mo>lim</mo>和<mo>sup</mo>的默认的lspace,rspace值不同:
Screenshot 2022-05-27 at 18-12-23 测试.png
这是因为lim,max,min的lspace,rspace值在字典中有定义,而sup没有在字典中,所以按默认值thickmathspace,即5/18 em.(见Bugzilla:The default value for attributes lspace/rspace of <mo>)
浏览器使用的Operator dictionary可以在C:\mozilla-source\mozilla-unified\layout\mathml\mathfont.properties中找到:
QQ图片20220401132641.png
  1. operator.\u006C\u0069\u006D.prefix = lspace:0 rspace:3 movablelimits # lim
  2. operator.\u006D\u0061\u0078.prefix = lspace:0 rspace:3 movablelimits # max
  3. operator.\u006D\u0069\u006E.prefix = lspace:0 rspace:3 movablelimits # min
复制代码

W3C MathML2附录F中的值相同:
Screenshot 2022-05-27 at 18-12-23 测试.png
所以我们在mathfont.properties中加上两行:
  1. operator.\u0073\u0075\u0070.prefix = lspace:0 rspace:3 movablelimits # sup
  2. operator.\u0069\u006E\u0066.prefix = lspace:0 rspace:3 movablelimits # inf
复制代码

3149

主题

8387

回帖

6万

积分

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

积分
65397
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-5-29 12:19
Build Firefox on your own computer!
测试一下:
QQ图片20220401132641.png
修改成功!

3149

主题

8387

回帖

6万

积分

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

积分
65397
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-6-10 06:13
本帖最后由 hbghlyj 于 2022-6-10 10:26 编辑 还需要增加:
\gcd
\det
\bmod (binary mod,很窄间隔空白的那种)
因为这些在mathjax里面是mathoperator

3149

主题

8387

回帖

6万

积分

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

积分
65397
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-7-4 00:42


编辑1#的mathfont.properties时需要将字符串转换为16进制码点,可以使用以下简易代码
»'det'.split('').map(a=>a.charCodeAt(0).toString(16))
.map(hex=>"\\u" + "0000".substring(0, 4 - hex.length)+hex).join('')
«"\\u0064\\u0065\\u0074"

点评

这里的\u其实是\\u
为什么吞了双斜杠...不明原因  发表于 2022-7-4 01:28
'\\' being converted to single backslash  发表于 2022-7-4 01:47

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

GMT+8, 2025-3-4 18:16

Powered by Discuz!

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