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?
JavaScript
x
15
15
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8" />
5
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
6
</head>
7
<body>
8
<p><span class="math display">[
9
1 x x^2 \
10
1 y y^2 \
11
1 z z^2 \
12
]</span></p>
13
</div>
14
</body>
15
</html>
I expect to see 3 lines, but I get this:
Other stackoverflow posts claim that \
should work, eg: https://math.meta.stackexchange.com/questions/11720/new-line-within-mathjax
Advertisement
Answer
You should use HTML to break lines as MathJax only handles math mode and does not process the backslashes:
JavaScript
1
8
1
<p>
2
<span class="math display">
3
(1 x x^2 )</br>
4
(1 y y^2 )</br>
5
(1 z z ^2 )</br>
6
</span>
7
</p>
8