我通过添加以下代码来使 MathJax 与 WordPress 一起使用footer.php
。它适用于简单的数学符号和方程。
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true
}
});
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
但它不适用于多行方程,例如,
它被渲染为一行,如下所示。
这是渲染造成的\\
as \
默认情况下在 WordPress 或 Markdown 编辑器中。一种可能的解决方案是将所有\\
within $$...$$
into \\\\
.
我希望我可以使用\\
直接作为换行符。它适用于堆栈编辑 https://stackedit.io/,但我不知道怎么办,可能是逃跑\\
对于 MathJax。
这是源代码。 (我使用 Markdown 编辑器。)
$$
\begin{bmatrix}
PR(p_1) \\
PR(p_2) \\
\vdots \\
PR(p_N)
\end{bmatrix} =
\begin{bmatrix}
{(1-d)/ N} \\
{(1-d) / N} \\
\vdots \\
{(1-d) / N}
\end{bmatrix}
+ d
\begin{bmatrix}
\ell(p_1,p_1) & \ell(p_1,p_2) & \cdots & \ell(p_1,p_N) \\
\ell(p_2,p_1) & \ddots & & \vdots \\
\vdots & & \ell(p_i,p_j) & \\
\ell(p_N,p_1) & \cdots & & \ell(p_N,p_N)
\end{bmatrix}
\cdot
\begin{bmatrix}
PR(p_1) \\
PR(p_2) \\
\vdots \\
PR(p_N)
\end{bmatrix}
$$