# Newline command (\\\\) in Mathjax is broken in the latest versions of Anki

**URL:** <https://forums.ankiweb.net/t/newline-command-in-mathjax-is-broken-in-the-latest-versions-of-anki/7718>\
**Category:** Card Design\
**Created:** [February 22, 2021, 8:34am UTC](https://forums.ankiweb.net/t/newline-command-in-mathjax-is-broken-in-the-latest-versions-of-anki/7718 "2021-02-22T08:34:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![piet](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@piet](https://forums.ankiweb.net/u/piet)\
**Post date:** [February 22, 2021, 8:34am UTC](https://forums.ankiweb.net/t/newline-command-in-mathjax-is-broken-in-the-latest-versions-of-anki/7718/1 "2021-02-22T08:34:15Z")

</div>

Hello there,  
I have recently upgraded to Anki 2.1.40 (I think I had version 2.1.35 before, or even older), and apparently the newline command (\) in Mathjax does not work anymore (no errors, it simply does not produce a line break). I looked at the changelog and it seems that version 2.1.36 comes with Mathjax 3.0, which apparently does not support this command yet.

Has anybody found a workaround, or do I have to reverse back to 2.1.35 to use the command? If someone is aware of a different command that works I am willing to use it, since I don’t have that many cards to fix.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [February 22, 2021, 12:26pm UTC](https://forums.ankiweb.net/t/newline-command-in-mathjax-is-broken-in-the-latest-versions-of-anki/7718/2 "2021-02-22T12:26:25Z")

</div>

That’s a rather unfortunate omission. Perhaps you could wrap the code in displaylines? [The line break(\\) is not work · Issue #2312 · mathjax/MathJax · GitHub](https://github.com/mathjax/MathJax/issues/2312#issuecomment-538185951)

---

<div class="post-metadata">

**Author:** ![piet](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@piet](https://forums.ankiweb.net/u/piet)\
**Post date:** [February 22, 2021, 12:56pm UTC](https://forums.ankiweb.net/t/newline-command-in-mathjax-is-broken-in-the-latest-versions-of-anki/7718/3 "2021-02-22T12:56:28Z")

</div>

Thank you! This workaround does the trick for me. Hopefully it will not be needed in future versions.

---

<div class="post-metadata">

**Author:** ![Margoulin](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@Margoulin](https://forums.ankiweb.net/u/Margoulin)\
**Post date:** [September 5, 2021, 9:30am UTC](https://forums.ankiweb.net/t/newline-command-in-mathjax-is-broken-in-the-latest-versions-of-anki/7718/4 "2021-09-05T09:30:31Z")

</div>

That’s indeed a pity !

For those coming from google because this topic is well referenced, you can use a search and replace with regex if you have thousands of mathjax notes :

1. Select all notes
2. Notes \> Search and Replace (CTRL + ALT + F)
3. Tick regex
4. Search `\\\[(.*?)\\\]` and replace by `\[\displaylines{$1}\]`

In case you use tiny/small/normalsize/… to alter the font size, you have to put `displaylines{}` after the tiny/small/normalsize command so the regex gets more sophisticated : `\\\[?\\(small|normalsize|tiny|scriptsize)\{(.*?)\} ?\\\]` by `\[\$1{\displaylines{$2}}\]`.  
Please export your collection and check the regex works on a few notes before generalization (and reverse the test before generalization so you don’t get 2 nested displaylines).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [May 1, 2023, 7:39am UTC](https://forums.ankiweb.net/t/newline-command-in-mathjax-is-broken-in-the-latest-versions-of-anki/7718/5 "2023-05-01T07:39:05Z")

</div>

Closed on May 1, 2023, 7:39am UTC


