Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathjax multi-line equation rendering issue

I'm using MathJax to display math in a webpage. My MathJax code looks like this:

<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 seems to work great, however I simply can't figure out how on earth to write multi-line equations. For example, this multi-line equation doesn't render properly. The entire equation is on one line instead of 3:

$$
\begin{eqnarray} 
y &=& x^4 + 4      \nonumber \\
  &=& (x^2+2)^2 -4x^2 \nonumber \\
  &\le&(x^2+2)^2    \nonumber
\end{eqnarray} 
$$
like image 741
turtle Avatar asked Sep 17 '13 22:09

turtle


2 Answers

The $$ wants to be touching the math in order to be recognized as delimiters. To make your sample work, remove the newlines after/before the opening/closing $$:

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

(This works for me using Marked2 in MathJax mode):

like image 139
smallberries Avatar answered Oct 22 '22 20:10

smallberries


MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"] ],
        displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
        processEscapes: false,
    }
})
like image 1
tarikakyol Avatar answered Oct 22 '22 22:10

tarikakyol