Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于数学公式 #79

Open
Skyer19 opened this issue May 22, 2020 · 16 comments
Open

关于数学公式 #79

Skyer19 opened this issue May 22, 2020 · 16 comments
Labels
discuss This issue is just a discuss. invalid This question doesn't seem right.

Comments

@Skyer19
Copy link

Skyer19 commented May 22, 2020

您好,我这边好像出现了一个问题,您这边方便帮我看一下吗?谢谢。
我这边启用了mathjax
然后用了LaTeX公式

\left\{\begin{matrix} x' = x + \frac{b}{gcd}*K 
\\ 
y' = y - \frac{a}{gcd}*K 
\end{}\right.`

想要有一下效果:
CodeCogsEqn

发现不能被渲染,我查询了以前的issue,发现是Markdwon本身的特殊符号与Latex中的符号会出现冲突,于是我将所有的\改为\,发现还是不能被渲染,想请问我这个该怎么解决?谢谢。

@Siricee
Copy link
Owner

Siricee commented May 29, 2020

你好,你的issue中tex代码写法明显有问题。

请你在提问时确认一下你写的公式是否正确,这样可以节省调试时间。

我先写一下这个公式的正常Tex代码:

\left \{ 
\begin{array}{c}
x'=x+\frac{b}{gcd}*K \\ 
y'=y-\frac{a}{gcd}*K
\end{array}
\right.

在HTML中,乘号也就是*会被转义、左侧大括号反斜杠\{ 会被转义、换行符双反斜杠\\会被转义。因此在主题中,你粘贴以下代码可以直接生效

$$\left \\{ 
    \begin{array}{c}
        x'=x+\frac{b}{gcd}\*K \\\\
        y'=y+\frac{b}{gcd}\*K
    \end{array}
\right.$$

粘贴完成就是这个效果

@Siricee Siricee closed this as completed May 29, 2020
@Siricee Siricee added discuss This issue is just a discuss. invalid This question doesn't seem right. labels May 29, 2020
@Baileyswu
Copy link

为了符合html的规则去改变markdown的规则是种坏的科学😂

@Siricee
Copy link
Owner

Siricee commented Jan 12, 2021 via email

@Baileyswu
Copy link

确实 我也这么认为……然而我还没研究出解析公式的同时跳过markdown转换html的办法。。

---原始邮件--- 发件人: "Baileys"<[email protected]> 发送时间: 2021年1月12日(周二) 下午5:35 收件人: "Siricee/hexo-theme-Chic"<[email protected]>; 抄送: "State change"<[email protected]>;"Liu Zijian"<[email protected]>; 主题: Re: [Siricee/hexo-theme-Chic] 关于数学公式 (#79) 为了符合html的规则去改变markdown的规则是种坏的科学😂 — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

虽然宁(我也)比较鄙视直接改node_modules里的文件的行为,but it works.
我把这个文件改了以后直接放在外部,用travis自动替换,这里
然后公式没问题了,比如这篇博客 最后的公式没有再乱码辽

@Siricee Siricee reopened this Jan 18, 2021
@bujiuzhi
Copy link

我的公式会重复显示,这是为什么

@bujiuzhi
Copy link

image

@Siricee
Copy link
Owner

Siricee commented May 25, 2021 via email

@bujiuzhi
Copy link

https://arost01.github.io/2021/05/25/1009-Product-of-Polynomials/

有网址吗 我看下

---原始邮件--- 发件人: @.> 发送时间: 2021年5月25日(周二) 中午12:34 收件人: @.>; 抄送: "Liu @.>;"State @.>; 主题: Re: [Siricee/hexo-theme-Chic] 关于数学公式 (#79) 我的公式会重复显示,这是为什么 — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

https://arost01.github.io/2021/05/25/1009-Product-of-Polynomials/

@bujiuzhi
Copy link

可以通过math: true这种方式吗显示吗

@bujiuzhi
Copy link

大佬,公式这个还能解决吗

@bujiuzhi
Copy link

bujiuzhi commented May 26, 2021

我找到问题所在了,我这边公式重复显示是因为,我换成了另一个主题的渲染器

自带的渲染器会出现乱码的原因我也找到了,公式内部不能屏蔽 * 字符,会被识别为加粗。要想避免这种情况,必须每次在公式内部把 * 符号前后空出一格。
修改成功后

@Myoontyee
Copy link

@TTomDuan
Copy link

为啥不集成katex? mathjax似乎比较慢,每次渲染都要一两秒

head.ejs中添加了

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC" crossorigin="anonymous">

<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-X/XCfMm41VSsqRNQgDerQczD69XqmjOOOwYQvr/uuC+j4OPoNhVgjdGFwhvN02Ja" crossorigin="anonymous"></script>

<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
        onload="renderMathInElement(document.body);"></script>

就可以了

@Siricee
Copy link
Owner

Siricee commented Aug 18, 2022

为啥不集成katex? mathjax似乎比较慢,每次渲染都要一两秒

head.ejs中添加了

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC" crossorigin="anonymous">

<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-X/XCfMm41VSsqRNQgDerQczD69XqmjOOOwYQvr/uuC+j4OPoNhVgjdGFwhvN02Ja" crossorigin="anonymous"></script>

<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
        onload="renderMathInElement(document.body);"></script>

就可以了

因为我不会用KaTeX,一直用LaTeX也没去学,你需要KaTeX的话自行添加就好了

@2112529
Copy link

2112529 commented Jan 31, 2024

想问一下想要支持行内数学公式应该怎么做呢?
写了这样一个内容:设(X,$$\rho$$)为距离空间
显示的结果是:
image

@Siricee
Copy link
Owner

Siricee commented Feb 12, 2024

行内公式用单$符包围 $$fomula$$ -> $fomula$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss This issue is just a discuss. invalid This question doesn't seem right.
Projects
None yet
Development

No branches or pull requests

7 participants