Why doesn't \\ display a newline in mathjax?


I am under the impression that you should use \\ for newlines with mathjax, however I can’t get it to work. What am I doing wrong here?

<!DOCTYPE html>
  <meta charset="utf-8" />
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<p><span class="math display">\[
    1 x x^2 \\
    1 y y^2 \\
    1 z z^2 \\

I expect to see 3 lines, but I get this:

unexpected formatting

Other stackoverflow posts claim that \\ should work, eg: https://math.meta.stackexchange.com/questions/11720/new-line-within-mathjax


You should use HTML to break lines as MathJax only handles math mode and does not process the backslashes:

    <span class="math display">
        \(1 x x^2 \)</br>
        \(1 y y^2 \)</br>
        \(1 z z ^2 \)</br>

Answered By – Thanos T.

Answer Checked By – Pedro (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.