悠闲数学娱乐论坛(第2版)'s Archiver

kuing 发表于 2021-9-4 17:26

今起用新的 MathJax 3 支持数学公式

用 MathJax 3 的目的是为了提高显示速度,各位可以在数学区下方的草稿本里测试,看是不是爽了许多。

据 MathJax 官网介绍,MathJax 3 重写了代码,与 MathJax 2.x 从原理上就不同,所以会与以前有一些差别,如果你发现有什么变化或者问题,请回帖提出。

目前发现的一些区别如下:

$\bullet$ 关于换行,如下代码:[code]\[ A \\ BB \][/code]在以前是能够换行的,现在遵从真 LaTeX,显示为:\[ A \\ BB \]因此多行公式得用 gather* 之类的环境:[code]\begin{gather*} A \\ BB \end{gather*}[/code]显示:\begin{gather*} A \\ BB \end{gather*}如果你实在不想用环境,就拆成两个公式吧,即[code]\[ A \]\[ BB \][/code]显示:\[ A \]\[ BB \]当然我建议用前者(反正草稿本里有按钮可点)

$\bullet$ 公式外的两个 \\ 会变成一个,这有一个好处,可以通过输入[code]\\[ a^2 \\][/code]得到 \\[ a^2 \\] 而不会变成公式。

$\bullet$ 超长公式(超过页面宽度)在以前能够自动换行,现在不行(官网说等以后实现)。

$\bullet$ \cancel、\xcancel 等命令可以直接使用(以前需要 \require{cancel} 才能用)。

$\bullet$ begin 之后加空格这招不灵了:以前我发现像[code]\begin  {xxx}
...
\end  {xxx}[/code]这样,在 begin 和 end 之后加空格,mathjax 就不处理它,从而用于呈现代码,现在它也会处理了。

$\bullet$ 关于“错误”代码的显示,就拿上面那段代码为例,xxx 是未定义环境,mathjax 会报错。
像这种报错,在以前,会原样显示+外框,可以利用它来呈现代码(特别是一大段的)。
而现在是\begin  {xxx}
...
\end  {xxx}虽然也能呈现,但区别在于它没有了换行,不利于阅读,而且当代码很长,就会超出右边界,看不到了。
所以,以后[b]要呈现代码,请使用论坛编辑器上的“代码”按钮[/b]。
为此我已经对 TeX 区的部分帖子作了编辑,但肯定还有疏漏。
[b]各位如果发现还有需要编辑的帖子,请告诉我[/b](如果是你自己帖子那就自行编辑好啦)。

(多行代码复制问题已解决)
[color=Silver][s]$\bullet$ 关于右键菜单中的复制代码,现在有个严重的问题:
对多行的代码,复制出来会有多余的空行。比如我用以下代码来输入的公式:[code]\begin{align*}
0 = 0 & = 0\\
0 \iff 0 & \iff 0
\end{align*}[/code]\begin{align*}
0 = 0 & = 0\\
0 \iff 0 & \iff 0
\end{align*}对上述公式右键选择 Copy to Clipboard - TeX Commands ,粘贴出来会变成:[code]\begin{align*}

0 = 0 & = 0\\

0 \iff 0 & \iff 0

\end{align*}[/code]然鹅!如果在草稿本里测试,却不存在以上问题,只有复制帖子内的公式才会如此!不知道为什么。[/s][/color]

kuing 发表于 2021-9-4 17:45

MathJax 3 与 KaTeX 似乎无法一起使用,现已去掉 KaTeX,反正速度已经相差不大,而且少加载一些 js 也能提高速度,以及降低被 Qiang 的概率(这个其实更重要)。

isee 发表于 2021-9-4 21:57

{:victory:}


乌贼快来看换行,分开写,或者用gather*

乌贼 发表于 2021-9-6 01:26

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=41051&ptid=8195]3#[/url] [i]isee[/i] [/b]

怪不得,又要学{:mad:}

色k 发表于 2021-9-6 01:44

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=41060&ptid=8195]4#[/url] [i]乌贼[/i] [/b]

差不了多少,因为有草稿本可以点啊。

kuing 发表于 2021-9-8 14:32

新增了两点变化——关于呈现代码的。

kuing 发表于 2021-9-21 14:20

align 的 & 之后的 \iff 距离有问题:[code]\begin{align*}
0 = 0 & = 0\\
0 \iff 0 & \iff 0
\end{align*}[/code]\begin{align*}
0 = 0 & = 0\\
0 \iff 0 & \iff 0
\end{align*}以前应该没有这问题,不然早就会发现

kuing 发表于 2021-10-15 16:30

mathjax 3 的向量箭头与字母的距离:$\overrightarrow{AB}$,总感觉以前没那么远吧?

isee 发表于 2021-10-24 00:04

[i=s] 本帖最后由 isee 于 2021-10-24 00:06 编辑 [/i]

用 [inlinecode]$[/inlinecode]   测试间距$\sin x$中文与公式间,
用 [inlinecode]`[/inlinecode]   测试间距`\sin x`中文与公式间,

===========

一样,要手动调?

kuing 发表于 2021-10-24 00:09

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=41580&ptid=8195]10#[/url] [i]isee[/i] [/b]

这个一向如此啊,没变过。
所以置顶教程里一直都建议 “中文与行内公式之间空一格会好看一点。”

kuing 发表于 2022-1-1 14:20

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42483&ptid=8195]12#[/url] [i]hbghlyj[/i] [/b]

这么快就发现了,我刚想说。

[size=5]为存档需要,这几天暂时将 mathjax 降回 2.7,以及暂时关闭草稿本,存完即恢复,见谅。[/size]

kuing 发表于 2022-1-1 14:40

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42485&ptid=8195]14#[/url] [i]hbghlyj[/i] [/b]

我不是所有帖都存,只存我撸的一些题,又到弄“懒人版”撸题集的时间了啊,就是另存为 PDF 然后分类合并。
用 2.7 方便搜索公式。

kuing 发表于 2022-1-1 19:00

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42489&ptid=8195]17#[/url] [i]hbghlyj[/i] [/b]

mathjax 3 的 html 在本论坛上显示会有瑕疵(原因未明),之前还试过在手机上显示的字体有问题,过几天给你示范一下。

还有一点,就是太长的公式不会自动折行(以前有些帖有长公式)。

hbghlyj 发表于 2022-1-1 19:14

[i=s] 本帖最后由 hbghlyj 于 2022-1-7 19:24 编辑 [/i]

media显示成链接呀

青青子衿 发表于 2022-1-7 10:26

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42484&ptid=8195]13#[/url] [i]kuing[/i] [/b]
[quote]回复  hbghlyj

这么快就发现了,我刚想说。

为存档需要,这几天暂时将 mathjax 降回 2.7,以及暂时关闭 ...
[size=2][color=#999999]kuing 发表于 2022-1-1 14:20[/color] [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42484&ptid=8195][img]http://kuing.orzweb.net/images/common/back.gif[/img][/url][/size][/quote]

“草稿箱”终于解封了!{:lol:}

isee 发表于 2022-1-7 23:28

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42569&ptid=8195]20#[/url] [i]青青子衿[/i] [/b]

其实,这个草稿本(箱)效率还比较高

爪机专用 发表于 2022-1-13 21:04

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42666&ptid=8195]21#[/url] [i]hbghlyj[/i] [/b]

我这里之前试过是方程组那种大的花括号会断开一截一截。

kuing 发表于 2022-1-13 21:51

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42668&ptid=8195]23#[/url] [i]hbghlyj[/i] [/b]

页面下方有:
[quote]免责声明:非本网注明原创的信息,皆为程序自动获取互联网,目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责;如此页面有侵犯到您的权益,请给站长发送邮件,并提供相关证明(版权证明、身份证正反面、侵权链接),站长将在收到邮件12小时内删除。[/quote]

kuing 发表于 2022-1-30 21:18

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42876&ptid=8195]26#[/url] [i]hbghlyj[/i] [/b]

这是啥网页?

hbghlyj 发表于 2022-1-30 22:58

[i=s] 本帖最后由 hbghlyj 于 2022-1-30 23:28 编辑 [/i]

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42881&ptid=8195]27#[/url] [i]kuing[/i] [/b]
[url=https://cjhb.site/input/mathjax.html]测试页[/url]啊
playground

补:
[url=https://cjhb.site/input/tex2svg.html]tex2svg[/url]
[url=https://cjhb.site/input/tex-svg.html]tex-svg[/url]
[url=https://cjhb.site/input/tex-mml.html]tex-mml[/url]
[url=https://cjhb.site/input/tex-macros.html]tex-macros[/url]
[url=https://cjhb.site/input/mml2svg.html]mml2svg[/url]
[url=https://cjhb.site/input/mml2chtml.html]mml2chtml[/url]
[url=https://cjhb.site/input/mml.html]mml[/url]
[url=https://cjhb.site/input/mml-chtml.html]mml-chtml[/url]
[url=https://cjhb.site/input/mml-attribute.html]mml-attribute[/url]
[url=https://cjhb.site/input/equation-refs.html]equation-refs[/url]
[url=https://cjhb.site/input/equation-numbers.html]equation-numbers[/url]
注:mathml output只能在火狐里看{:sad:}

kuing 发表于 2022-1-31 00:51

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42883&ptid=8195]28#[/url] [i]hbghlyj[/i] [/b]

原来是你自己网站上的测试页,还那么多{:shocked:}。
但是我在 mathjax 官网上的 [url=https://www.mathjax.org/#demo]demo[/url] 里试 26# 的公式倒是没有问题。

关于横向滚动条的问题:
我前天对 CSS 设了 .t_msgfont {overflow: auto;},为的是当帖内出现大于页面宽度的超长公式时就会出现横向滚动条。
未设这个之前,超长公式超出部分是看不到的,有滚动条就能拉过去看了。
没想到会出现带图的也这样,我自己没发现估计是因为我的窗口开得够大……
奇怪,按道理,图的最大宽度我设定为帖子宽度的 100%,应该不会超出去的呀,回头我设成 99% 再看看。
=====
果然 99% 就好了,看来这 100% 不是准确的 100%,估计存在某个细节产生误差。

hbghlyj 发表于 2022-1-31 01:57

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42886&ptid=8195]31#[/url] [i]kuing[/i] [/b]
发现一个和字体有关的怪事
φ ϕ
[font=Consolas]φ ϕ[/font]
第一行是默认字体,第二行是Consolas字体
Consolas字体下的varphi和phi竟是反的!

kuing 发表于 2022-1-31 02:23

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42888&ptid=8195]33#[/url] [i]hbghlyj[/i] [/b]

你试试这个公式的 math settings -> math renderer -> chtml 看花括号会不会断开一截截
\[\left\{\dfrac{\dfrac12}{\dfrac34}\right\}\]

hbghlyj 发表于 2022-1-31 02:51

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42887&ptid=8195]32#[/url] [i]hbghlyj[/i] [/b]
原来早有人发现了{:sweat:}
[url=https://meta.stackexchange.com/questions/313993/unicode-phi-characters-inconsistent-between-body-and-preview-and-across-platform]链接1[/url]
[url=https://github.com/JuliaLang/julia/issues/8429]链接2[/url]

kuing 发表于 2022-2-1 00:58

[quote]又发现一个离谱的现象

svg也一样:
$Ω≠ω$ vs $Ω=ω$
第一个是直体,第二个是斜体! ...
[size=2][color=#999999]hbghlyj 发表于 2022-1-30 23:00[/color] [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42884&ptid=8195][img]http://kuing.orzweb.net/images/common/back.gif[/img][/url][/size][/quote]
ΩΩ
这两个本身就是不同的字符,前者 \u2126 后者 \u03a9。

kuing 发表于 2022-2-1 14:59

[quote]回复  kuing
确实,而且官网demo上没有断,而且测试页也没断,在我的网站上的帖子内测试也没断
看来真的是咱这里才有的问题
[size=2][color=#999999]hbghlyj 发表于 2022-1-31 02:46[/color] [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42891&ptid=8195][img]http://kuing.orzweb.net/images/common/back.gif[/img][/url][/size][/quote]
我的草稿本里也不会断,就只有帖子里面才会断{:dizzy:}

kuing 发表于 2022-2-4 10:52

[quote]用    测试间距$\sin x$中文与公式间,
用    测试间距`\sin x`中文与公式间,

===========

一样,要手动 ...
[size=2][color=#999999]isee 发表于 2021-10-24 00:04[/color] [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=41580&ptid=8195][img]http://kuing.orzweb.net/images/common/back.gif[/img][/url][/size][/quote]
已自动加空格(汉字与公式、英文、数字)

hbghlyj 发表于 2022-2-4 21:54

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42954&ptid=8195]39#[/url] [i]kuing[/i] [/b]
发现一个怪事情

$\def\b0{{\boldsymbol{0}}}
x=\b0$[code]$\def\b0{{\boldsymbol{0}}}
x=\b0$[/code]多出一个零?
预期的效果: $x=\boldsymbol0$

kuing 发表于 2022-2-4 22:30

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42956&ptid=8195]40#[/url] [i]hbghlyj[/i] [/b]

说明 mathjax 里 \def 的定义不是完全与真 latex 一样呗。
这里的 \def 可能不接受数字,忽略了 0,只定义了 \b

hbghlyj 发表于 2022-2-6 11:02

[i=s] 本帖最后由 hbghlyj 于 2022-3-1 15:44 编辑 [/i]

$\Huge\unicode{x1F600}$
代码:
\Huge\unicode{x1F600}

用clap画数轴:

$\require{mathtools}\quad\quad\mathclap{----}\mathclap{--•}--\mathclap{--•-}\mathclap{-------}\quad\mathclap{------}\qquad>$
$\hskip{28pt}0\hskip{11pt}1$

\的三种写法:
[table][tr][td]\backslash[/td][td]$\backslash$[/td][/tr]
[tr][td]\text{\\\}[/td][td]$\text{\\}$[/td][/tr]
[tr][td]\setminus[/td][td]$\setminus$[/td][/tr][/table]

kuing 发表于 2022-2-6 12:21

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42992&ptid=8195]42#[/url] [i]hbghlyj[/i] [/b]

{:shocked:}还能这样发emoji

isee 发表于 2022-2-6 14:25

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42992&ptid=8195]42#[/url] [i]hbghlyj[/i] [/b]

真的假的~~~

[url]https://www.haomeili.net/Code/UnicodeDetail?quwei=1F600-1F64F[/url]

isee 发表于 2022-2-6 14:26

二进制                                八进制        十进制        16进制        字符        说明
11111011000000000                373000        128512        1F600       

kuing 发表于 2022-2-6 14:33

我在电脑上看不见 42# 的 emoji

改为 1F605 的话 \$\Huge\unicode{x1F605}\$: $\Huge\unicode{x1F605}$

看来是视系统字体的情况不同而显示不同。

kuing 发表于 2022-2-6 14:49

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42995&ptid=8195]44#[/url] [i]isee[/i] [/b]

电脑上看这链接:
[attach]11043[/attach]

爪机上:
[attach]11044[/attach]

爪机看有趣多了哇

isee 发表于 2022-2-6 19:17

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=42998&ptid=8195]47#[/url] [i]kuing[/i] [/b]


尔电脑被你玩坏了

kuing 发表于 2022-2-6 20:07

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=43003&ptid=8195]48#[/url] [i]isee[/i] [/b]

emmm...你电脑看到的是啥样的呢?

isee 发表于 2022-2-6 21:10

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=43004&ptid=8195]49#[/url] [i]kuing[/i] [/b]

kuing 发表于 2022-2-6 21:32

[b]回复 [url=http://kuing.orzweb.net/redirect.php?goto=findpost&pid=43006&ptid=8195]50#[/url] [i]isee[/i] [/b]

系统/字体不同[img]http://qzonestyle.gtimg.cn/qzone/em/e10270.gif[/img]

hbghlyj 发表于 2022-2-6 22:30

😅
开启Html以后,可使用Html实体[code]😅[/code]

页: [1] 2

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.