The block math equation produce extra <br>

@dae I use the 2.1.52rc3
When I use the \[ and \] to type block math equation, when i first type \[ then type enter,As shown below

\[
x_{1}=\frac{D_{1}}{D}, x_{2}=\frac{D_{2}}{D}, \cdots, x_{n}=\frac{D_{n}}{D}
\]

the html show extra <br>

but, if similary to below picture, it works normal

\[x_{1}=\frac{D_{1}}{D}, x_{2}=\frac{D_{2}}{D}, \cdots, x_{n}=\frac{D_{n}}{D}\]

I think this is relevant:

If you want to use newlines in a MathJax expression, please use Shift+Enter instead of just Enter, as a normal newline will prevent MathJax from working correctly.

https://docs.ankiweb.net/math.html#mathjax

(I can’t reproduce the issue on 2.1.51 though; Anki is stripping the line breaks when rendering the equations)

UPDATE: Shift+Enter doesn’t work for me on 2.1.52, so this is apparently a bug.

Thanks for your reply.
Yes,2.1.51 works normally in mac. so I returned 2.1.51 :rofl:.

for 2.1.52, Whether it’s MAC or Windows, it already appear.

I already prepared a fix: Transform <br> in Mathjax to newlines by hgiesel · Pull Request #1866 · ankitects/anki · GitHub

3 Likes

An alternative to waiting for the fix would be to use the MathJax shortcuts instead. If you press ctrl+m then e, you’ll open the MathJax editor and will get a live preview as you type, and shift+enter will work correctly in there.