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

[MathJax]\overline里面字符为\u2015

[复制链接]

3149

主题

8386

回帖

6万

积分

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

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-5-8 08:02 |阅读模式
\overline经过MathJax处理成MathML后mi里面的字符为\u2015(dash,"―"),和\bar处理成MathML后的字符\u00AF(upperscore,"¯")不同,而且MathML的accent属性会使mover里面的mo和上面的mi距离变小,而"―"本来就比"¯"更低,导致前者有时显示得和下方的被修饰字符距离过小甚至重叠.
打开tex-mml-chtml.js,将
  1.         overline: [
  2.           'UnderOver',
  3.           '2015'
  4.         ],
  5.         underline: [
  6.           'UnderOver',
  7.           '2015'
  8.         ],
复制代码
改为
  1.         overline: [
  2.           'UnderOver',
  3.           '00AF'
  4.         ],
  5.         underline: [
  6.           'UnderOver',
  7.           '2015'
  8.         ],
复制代码
即可

3149

主题

8386

回帖

6万

积分

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

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-5-8 08:03

3149

主题

8386

回帖

6万

积分

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

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-5-8 21:52
developer.mozilla.org/en-US/docs/Web/MathML/Element/mover
accent
If true the over-script is an accent, which is drawn closer to the base expression.
If false (default value) the over-script is a limit over the base expression.
$\overline{A_i}$在mathpix中转换为:
<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mover>
    <msub>
      <mi>A</mi>
      <mi>i</mi>
    </msub>
    <mo accent="false">¯</mo>
  </mover>
</math>
mo带有accent="false"标签并且mo里面的字符是¯(overscore)
在MathJax v3被转换为
<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mover>
    <msub>
      <mi>A</mi>
      <mi>i</mi>
    </msub>
    <mo accent="true">―</mo>
  </mover>
</math>
mo带有accent="true"标签,并且mo里的字符是―(dash).
前者是正常的,后者的$i$或$j$上面没有点!
如图所示:

$\bar i\;\overline i\;\bar j\;\overline j$
在MathJax中转换为

在MS word中转换为

在MathJax中,暂时的解决办法:
  1. document.querySelectorAll('mover:not([accent])').forEach(e=>e.setAttribute('accent','false'))
复制代码
w3.org/TR/REC-MathML/chap3_4.html#sec3.4.5中关于accent属性:
The default value of accent is false, unless overscript is an <mo> element or an embellished operator (see Section 3.2.4). If overscript is an <mo> element, the value of its accent attribute is used as the default value of accent for <mover>. If overscript is an embellished operator, the accent attribute of the <mo> element at its core is used as the default value.

3149

主题

8386

回帖

6万

积分

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

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-5-8 22:45
今年2月的一个issue
github.com/mathjax/MathJax/issues/2827

3149

主题

8386

回帖

6万

积分

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

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-5-8 23:07
Discuz编辑器HTML模式,插入HTML代码时,尖括号和引号转义(escape):
  1. insertText(getSel().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "'"))
复制代码

3149

主题

8386

回帖

6万

积分

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

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-5-8 23:26


加上accent="false"就有点儿了
但是这个accent是mover的属性.不该继承到msub里面的j啊.这个属性就不该默认继承.

3149

主题

8386

回帖

6万

积分

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

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-7-17 04:09

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

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

Powered by Discuz!

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