2024.10 更新
注意,如果你显示所有公式是错误的,请刷新一下页面,至少对于我的谷歌浏览器来说刷新一下就好了
更换主题后原来那种方法不太适用了,而且 mathjax 渲染不太好看,目前我更改为 KaTeX 渲染,以某一篇要渲染公式的markdown为例子:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ...你的内容 <link rel ="stylesheet" href ="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css" integrity ="sha384-GvrOXuhMATgEsSwCs4smul74iXGOixntILdUW9XmUC6+HX0sLNAK3q71HotJqlAn" crossorigin ="anonymous" > <script defer src ="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js" integrity ="sha384-cpW21h6RZv/phavutF+AuVYrr+dA8xD9zs6FwLpaCct6O9ctzYFfFr4dgmgccOTx" crossorigin ="anonymous" > </script > <script defer src ="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/contrib/auto-render.min.js" integrity ="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin ="anonymous" > </script > <script > document.addEventListener("DOMContentLoaded", function() { renderMathInElement(document.body, { // customised options // • auto-render specific keys, e.g.: delimiters: [ {left: '$$', right: '$$', display: true}, {left: '$', right: '$', display: false}, {left: '\\(', right: '\\)', display: false}, {left: '\\[', right: '\\]', display: true} ], // • rendering keys, e.g.: throwOnError : false }); }); </script> ... 你的内容 示范, 行内公式 `$ ... $` : $G(t) = \langle S(t)S(0)\rangle$ 行间公式 `$$ ... $$` ...
不过本来最理想的效果就这么显示了,但我发现最后还是要相当于这样:
1 2 3 4 5 <span> $$ G(t) = \langle S(t)S(0)\rangle $$ </span>
$$
G(t) = \langle S(t)S(0)\rangle
$$
才可以渲染出来
参考
https://blog.kevinchu.top/2023/09/12/hexo-supports-latex/
在themes里配置好 mathjax 的环境之后,最好在 博客.md 的顶部追加:
1 2 3 4 5 --- title: 文章标题 date : 2020-09-02 20:11:42mathjax: true ---
现在无论是居中公式:
$$ -\ln \langle \frac{g(t_m)}{g(t_i)} \rangle_{\text{each rank}} \ $$
$$ \sum_{\text{rank 0}}^{50} -\ln \langle \frac{g(t_m)}{g(t_i)} \rangle = -\ln \langle \frac{g(t_m)}{g(t_i)} \rangle_{\text{each bin}} $$
Finally, we will get 10 bin data.
ZJR old MPI: $$ \text{each rank } \prod_t \langle \frac{g(t+\delta)}{g(t)} \rangle \ \ -\text{enrg1} \ \text{all rank } \prod_r \langle \frac{g(t+\delta)}{g(t)} \rangle $$
Benchmark from…
还是行内公式 都可以正常识别了.
Two dimensional $L\times L/2$ Heisenberg model, region A is chosen to be $L/2 \times L/2$ without corners. The temperatures are chosen to be $1/T = L$.
The fitting result is: $$ \color{yellow }{S^2(A) = 0.092 L + 1.00\ln L -1.63} $$ gives ==2.6145 == for $8 \times 16$ Lattice and ==1.18544 == for $4 \times 8$ Lattice.
Reference:
https://blog.xiangfa.org/2020/09/let-hexo-support-latex-formulas/