Hexo+Next+hexo-renderer-kramed 的 MathJax 显示

测试文章,本文章测试一下 Hexo+Next+hexo-renderer-kramed 的 MathJax 的显示效果.

displayMath

This is displayMath equation:

code

1
2
3
$$
H=-\sum_{i=1}^N (\sigma_{i}^x \sigma_{i+1}^x+g \sigma_{i}^z)
$$

show

inlineMath

standard

1
`$H=-\sum_{i=1}^N (\sigma_{i}^x \sigma_{i+1}^x+g \sigma_{i}^z)$`

this is inline equations: ,

simple but without complex symbol

1
$(x,y)$,  $(x, y)$,

These are inline equations: $(x,y)$, $(x, y)$,

But this cannot display normally.

1
$H=-\sum_{i=1}^N (\sigma_{i}^x \sigma_{i+1}^x+g \sigma_{i}^z)$

This is a wrong inline equations: $H=-\sum{i=1}^N (\sigma{i}^x \sigma{i+1}^x+g \sigma{i}^z)$

contains special symbol

contain $ in

1
` $some code$ `

This equation contain $ in the code:

contain $$ in text

1
\$\$

inline display issue

希望能和 story-writer app 渲染方法兼容,但是一旦公司复杂,就无法用 $$$$ 来显示 inline 公式,只能外面加上 $$$$。目前解决方法就是先不加单引号,通过显示调试后再加上单引号。通过分析发现,只要在嵌套的括号中加入了下划线同时有大括号就无法渲染,比如列表中 6,10,11,12。

This equation contain H=-\sum{i=1}^N $$ (\sigma{i}^x \sigma{i+1}^x+g \sigma{i}^z)$$

Test $X\subseteq \mathbb{R} ^n$

  1. 常表示为$H=-\sum{i=1}^N (\sigma{i}^x \sigma{i+1}^x+g \sigma{i}^z)$
  2. 常表示为$H=-\sum_{i=1}^N$
  3. 常表示为$H=\sigma_{i}^x$
  4. 常表示为$H=\sigma _{i}^x$
  5. 常表示为$H = -\sum_{i=1}^N ( \sigma )$
  6. 常表示为 $H = -\sum{i=1}^N ( \sigma{i} )$
  7. 常表示为 $H = -\sum_{i=1}^N ( \sigma_i)$
  8. 常表示为 $H = -\sum_{i=1}^N ( \sigma_i^x)$
  9. 常表示为 $H = -\sum_{i=1}^N ( \sigma_i^{x-1})$
  10. 常表示为 $H = -\sum{i=1}^N ( \sigma{i-1}^{x-1})$
  11. 常表示为 $H = -\sum{i=1}^N ( \sigma {i-1}^{x-1})$
  12. 常表示为 $H = -\sum{i=1}^N ( \sigma {i-1}^{x-1})$
  13. 常表示为 \(H = -\sum_{i=1}^N ( X_i)\)
  14. 常表示为 \(H = -\sum{i=1}^N ( X{ i-1 })\)
  1. 常表示为$H=-\sum{i=1}^N (\sigma{i}^x \sigma{i+1}^x+g \sigma{i}^z)$
  2. 常表示为$H=-\sum{i=1}^N (\sigma{i}^x \sigma{i+1}^x+g \sigma{i}^z)$
  3. 常表示为$H=-\sum{i=1}^N (\sigma{i}^x \sigma{i+1}^x+g \sigma{i}^z)$

Display equation numbering

这是一个引用公式的例子 $\eqref{eq:sample}$,另一个公式是 $\eqref{eq:heyper_plane}$

1
这是一个引用公式的例子 $\eqref{eq:sample}$,另一个公式是 $\eqref{eq:heyper_plane}$
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$$
\begin{equation}
W^TX+b=0
\label{eq:heyper_plane}
\end{equation}
$$

$$
\begin{equation}
E = mc^2
\label{eq:sample}
\end{equation}
$$

$$
\begin{equation}
E = mc^2
\end{equation}
$$

注意需要在 mathjax.swig 文件中增加配置 TeX: { equationNumbers: { autoNumber: "AMS" }}:

1
2
3
4
5
6
7
8
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
},
TeX: { equationNumbers: { autoNumber: "AMS" }}
});