Mathjax Multiline Equation Problem

I am using MathJax to display math on a web page. My MathJax code is as follows:

<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 just fine, however I just can't figure out how to write multi-line equations on earth. For example, this multi-line equation is not displayed properly. The whole 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} $$ 
+4
source share
2 answers

$$ wants to touch the math to be recognized as delimiters. To make your sample work, delete new lines after / before 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):

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

Source: https://habr.com/ru/post/1502693/


All Articles