Inline LaTex is not Rendering Right Curly Brace

What I’m trying to do

I am trying to get the following right.
Please help me find out what is wrong.

a = {1, 2, 3}

When I write LaTeX code between $$, it renders. However, when I try to write above using the code below, the right curly brace is not rendered correctly.

$$
a = {1, 2, 3}
$$

It looks something like below. It is the same in the exported PDF.

a = {1, 2

Things I have tried

I tried to add an extra backslash but it give me an error.
Having pasted above code to a site that support MathJax and it renders fine.

Obsidian version is Version 1.5.3 (Installer 1.4.16) on macOS 14.2.1(23C71).

Thank you in advance,
hisaotsu

This is not Obsidian specific. That’s how latex works. You need to escape the braces with backslashes because they are reserved for commands like \sqrt{}.

1 Like

See MathJax basic tutorial and quick reference - Mathematics Meta Stack Exchange
As said write \{ and \}. You can use \left and \right to apply auto resize:

$$
\left\{ \frac{1}{x^2+2x} \right\} \quad
\{ \frac{1}{x^2+2x} \}
$$

You may want to turn this setting off:
Settings->Editor->Behavior->Auto pair brackets

1 Like

Thank you for your reply.

I tested with backslashes as escape characters before curly braces, but the right curly brace is not rendered correctly.
It

a = \{1, 2, 3\}

Also it seems I need an escape character to display a backslash here…

Thanks,
hisaotsu

Run command Open sandbox vault and enter source mode. This code should work:

$$a = \{1, 2, 3\}$$

Mathjax can behave unexpectedly sometimes. You should use source mode and restart Obsidian if you have Mathjax problems.

1 Like

Thank you – restarting Obsidian works.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.