# Inserting a line break in a display equation cause equation to not work

**URL:** <https://forums.ankiweb.net/t/inserting-a-line-break-in-a-display-equation-cause-equation-to-not-work/57357>\
**Category:** Suggestions\
**Created:** [March 16, 2025, 3:03am UTC](https://forums.ankiweb.net/t/inserting-a-line-break-in-a-display-equation-cause-equation-to-not-work/57357 "2025-03-16T03:03:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pwintz](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/pwintz/32/10112_2.png) [@pwintz](https://forums.ankiweb.net/u/pwintz)\
**Post date:** [March 16, 2025, 3:03am UTC](https://forums.ankiweb.net/t/inserting-a-line-break-in-a-display-equation-cause-equation-to-not-work/57357/1 "2025-03-16T03:03:56Z")

</div>

Using the card browser, I am editing a card that has a MathJax display equation `\[... \]`.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/5/1/51c946a939638c29b3532e0442ec682a2f390e41.png)  
I prefer to put the equation delimiters on different lines than the equation contents, so I added a line break at the location of my cursor in the above image.  
When I do this, Anki adds `&nbsp;</div><div>` to the HTML code, causing the equation to stop working, as shown here:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/f/c/fc07ca92b5b3081de991db062f71aa1ec74edb10.png)  
Changing `</div><div>` to `<br>` fixes the problem.

I don’t know why Anki uses a `div` block here, instead of using `<br>` (it seems to be because the code already has `div` blocks), but inserting `<br>` would fix this problem.

```auto
Version <U+2068>24.11 (87ccd24e)<U+2069>
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1

```

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [March 16, 2025, 5:06am UTC](https://forums.ankiweb.net/t/inserting-a-line-break-in-a-display-equation-cause-equation-to-not-work/57357/2 "2025-03-16T05:06:40Z")

</div>

> 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. [[Math & Symbols - Anki Manual](https://docs.ankiweb.net/math.html#mathjax)]

---

<div class="post-metadata">

**Author:** ![SuhasK](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@SuhasK](https://forums.ankiweb.net/u/SuhasK)\
**Post date:** [March 16, 2025, 9:07am UTC](https://forums.ankiweb.net/t/inserting-a-line-break-in-a-display-equation-cause-equation-to-not-work/57357/3 "2025-03-16T09:07:12Z")

</div>

You could use \displaylines{} and then use \\ to denote a linebreak.

---

<div class="post-metadata">

**Author:** ![pwintz](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/pwintz/32/10112_2.png) [@pwintz](https://forums.ankiweb.net/u/pwintz)\
**Post date:** [March 18, 2025, 9:32am UTC](https://forums.ankiweb.net/t/inserting-a-line-break-in-a-display-equation-cause-equation-to-not-work/57357/4 "2025-03-18T09:32:04Z")

</div>

That is a solution for inserting a line break in the displayed equation, but I was talking about just code line breaks. (I’ve never heard of \displayedlines, though. I’ll have to check that out!)

---

<div class="post-metadata">

**Author:** ![pwintz](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/pwintz/32/10112_2.png) [@pwintz](https://forums.ankiweb.net/u/pwintz)\
**Post date:** [March 18, 2025, 9:37am UTC](https://forums.ankiweb.net/t/inserting-a-line-break-in-a-display-equation-cause-equation-to-not-work/57357/5 "2025-03-18T09:37:52Z")

</div>

I don’t think that’s always true. Sometimes ENTER inserts `<br>`, which works fine. Anyway, it seems like a bug (or at least bad UI design that) that Anki sometimes inserts div tags inside MathJax equations when this causes them to break

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [March 18, 2025, 3:19pm UTC](https://forums.ankiweb.net/t/inserting-a-line-break-in-a-display-equation-cause-equation-to-not-work/57357/6 "2025-03-18T15:19:50Z")

</div>

You didn’t code-block whatever you were trying to say, so the forum interface ate it – but I think I get the gist.

If it “sometimes” works, then just insert the word “sometimes” in the advisement from the manual. You get to the same place!

> [@Danika\_Dakika](#):
>
> If you want to use newlines in a MathJax expression, please use Shift+Enter instead of just Enter, as a normal newline will _ **sometimes** _ prevent MathJax from working correctly. [[Math & Symbols - Anki Manual](https://docs.ankiweb.net/math.html#mathjax)]

---

<div class="post-metadata">

**Author:** ![SuhasK](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@SuhasK](https://forums.ankiweb.net/u/SuhasK)\
**Post date:** [March 19, 2025, 1:22pm UTC](https://forums.ankiweb.net/t/inserting-a-line-break-in-a-display-equation-cause-equation-to-not-work/57357/7 "2025-03-19T13:22:44Z")

</div>

It’s displaylines, not displayedlines.
