找回密码
 快速注册
搜索
查看: 42|回复: 0

[MathJax] 长数字分隔符 Decimal separator

[复制链接]

3149

主题

8386

回帖

6万

积分

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

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-9-5 04:58 |阅读模式
en.wikipedia.org/wiki/Decimal_separator#Digit_grouping
tex.stackexchange.com/questions/110281
在MathJax中,长数字分隔符读号 , 用大括号 {} 括住
  1. $$1{,}411{,}778{,}724$$
复制代码
会被识别为一个整体, 生成MathML
  1. <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  2.   <mn>1,411,778,724</mn>
  3. </math>
复制代码


  1. $$1,411,778,724$$
复制代码

不会被识别为整体, 生成MathML
  1. <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  2.   <mn>1</mn>
  3.   <mo>,</mo>
  4.   <mn>411</mn>
  5.   <mo>,</mo>
  6.   <mn>778</mn>
  7.   <mo>,</mo>
  8.   <mn>724</mn>
  9. </math>
复制代码

见源码的正则表达式
$$\verb'/^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/'$$
Screenshot 2022-09-02 at 02-02-12 mspace - MathML MDN.png

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

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

Powered by Discuz!

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