Latex math newline line break \\

Related to but not identical to:

Try adding this to a note

$$
\wedge = \text{and} \\
\lor = \text{or} \\
\lnot = \text{not}
$$

Should render this:
image

But instead renders this:
image

Why don’t newlines work?

MacOSX
v0.10.13

9 Likes

Decent workaround for now is to split into multiple Latex sections:

$$
\wedge = \text{and}
$$
$$
\lor = \text{or}
$$
$$
\lnot = \text{not}
$$

Result:

image

1 Like

It’s not related to that bug at all. It’s another upstream problem

Related in terms of similar output appearance, not cause.

Anything I can do to speed along upstream problems?

The upstream bug is the cause of this issue. It’s scheduled to be patched in Q2 2021 according to the MathJax developers, and in the meantime you can use \displaylines{....} to wrap the whole thing as a temporary workaround.

2 Likes

I don’t see why this should be a bug in the first place. This seems to be normal LaTeX behaviour to me. If you type

$$
\wedge = \text{and} \\
\lor = \text{or} \\
\lnot = \text{not}
$$

into a LaTeX document, you get the same result that you get in Obsidian – everything is on a single line. If you want to have multiple lines you have to use \displaylines{...} as Licat says (or \begin{gathered}... \end{gathered}). If you want to have the equations to align, then you need to use the aligned environment instead:

$$
\begin{aligned}
\wedge &= \text{and} \\
\lor &= \text{or} \\
\lnot &= \text{not}
\end{aligned}
$$
5 Likes

The linebreak issue seems still not working (version 0.13.14 windows), any progresses about this issue? (p.s. mathjax seems have already fixed this bug testing page MathJax Dynamic Math Test Page)

that’s not the official mathjax 3 demo and the bug is still open upstream.

Thanks for the replay. Hope the upstream will fix it soon.

Seems to still be broken for version v0.13.23. :cry:

I don’t think it is broken, you should just use the aligned environment (in Mathjax and LaTeX), which is already shown with an example in a reply above.

Ahh, ok. I assumed the aligned environment was a workaround.
Using it now, works fine, thanks. :+1:

I guess it works but that’s super annoying to do if you have more than just a few lines

1 Like

Maybe it helps, you can also use \begin{gathered}...\end{gathered}. Then you don’t have to use the & symbols.

1 Like

Note that MathJax released their Release MathJax v4.0.0-alpha.1 pre-release in early October.

It references the following:

Support for automatic and explicit line breaks in both display and in-line expressions, automatic breaking of text elements, better breaking in tables and arrays…

Details of the implementation are in Release Notes: MathJax v4.0.0-alpha.1

1 Like

We will update to mathjax4 a couple of months after it is released as stable.

3 Likes

Any update on this?

I think the latest news would be here (also linked above):
https://github.com/mathjax/MathJax/issues/2312