Disable markdown writing assistance inside math / latex environments (disable autoclose bold, italics, link suggestion)

Once you’ve done the above, delete everything above this line.

Steps to reproduce

Inside a fresh vault enable the “Editor > auto pair markdown syntax” option, insert $$ and place the cursor between the $ signs. Type an * or a _.

Expected result

In a math environment, it’s more common for these characters to mean either

  • a subscript when using an underscore _
  • a complex conjugate (at least in physics) when using a astrisk *

I would there expect obsidian to ignore this feature when inside a math environment.

Actual result

Instead we get two of the character with the cusror placed in between them.

Environment

SYSTEM INFO:
	Obsidian version: v1.2.8
	Installer version: v1.2.7
	Operating system: Windows 10 Home 10.0.22621
	Login status: logged in
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Additional information

I can’t find any discussion of this or a community plugin that would handle this. Regardless, it feels like a bug to me as I would expect a mathjax user to want to insert markdown syntax inside mathjax.

1 Like

Moved to Feature request.

This is in the same vein as

1 Like

Use case or problem

The underscore character is used for subscripts in LaTeX expressions. Sometimes Obsidian errantly pairs the underscore with a second underscore, as if it were Markdown.

Proposed solution

Disable markdown pairing within inline LaTeX, or block LaTeX. E.g.
Within a sentence $x_a=1$, or in a block:
$$
x_a=1
$$

Related feature requests

This has been mentioned a couple of times here on the forum, but I don’t see a feature request.

2 Likes

Rather than disabling it completely, I think it should be a separate option nested under “Auto pair Markdown syntax” to enable or disable auto pairing within LaTeX. That way, user’s can choose based on their own preference.

1 Like