Mathjax多线方程渲染问题

时间:2013-09-17 22:06:03

标签: javascript mathjax

我正在使用MathJax在网页中显示数学。我的MathJax代码如下所示:

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

    <script type="text/javascript"
    src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ],
         processEscapes: true
        }
      });
</script>

MathJax似乎工作得很好,但我根本无法弄清楚如何编写多线方程。例如,此多线方程无法正确呈现。整个等式在一行而不是3行:

$$
\begin{eqnarray} 
y &=& x^4 + 4      \nonumber \\
  &=& (x^2+2)^2 -4x^2 \nonumber \\
  &\le&(x^2+2)^2    \nonumber
\end{eqnarray} 
$$

2 个答案:

答案 0 :(得分:3)

$$想要触及数学,以便被认为是分隔符。要使您的示例正常工作,请在打开/关闭$$之前/之后删除换行符:

$$\begin{eqnarray} 
y &=& x^4 + 4      \nonumber \\
&=& (x^2+2)^2 -4x^2 \nonumber \\
&\le&(x^2+2)^2    \nonumber
\end{eqnarray}$$

(这适用于我在MathJax模式下使用Marked2):

答案 1 :(得分:0)

MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"] ],
        displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
        processEscapes: false,
    }
})