Forgot password?
 Create new account
View 193|Reply 6

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

[Copy link]

3151

Threads

8498

Posts

610K

Credits

Credits
66208
QQ

Show all posts

hbghlyj Posted at 2022-5-28 02:30:48 |Read mode
Last edited by hbghlyj at 2022-5-29 10:13:00在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
Copy the Code

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
Copy the Code

3151

Threads

8498

Posts

610K

Credits

Credits
66208
QQ

Show all posts

 Author| hbghlyj Posted at 2022-5-29 12:19:26
Build Firefox on your own computer!
测试一下:
QQ图片20220401132641.png
修改成功!

3151

Threads

8498

Posts

610K

Credits

Credits
66208
QQ

Show all posts

 Author| hbghlyj Posted at 2022-6-10 06:13:28
Last edited by hbghlyj at 2022-6-10 10:26:00还需要增加:
\gcd
\det
\bmod (binary mod,很窄间隔空白的那种)
因为这些在mathjax里面是mathoperator

3151

Threads

8498

Posts

610K

Credits

Credits
66208
QQ

Show all posts

 Author| hbghlyj Posted at 2022-7-4 00:42:37
编辑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"

Comment

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

手机版Mobile version|Leisure Math Forum

2025-4-21 14:12 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list