Turn off auto-pairing of underscores

Things I have tried

I tried turning off the auto-pair brackets function in the editor settings but nothing happened.
I searched for “underscore” in community plugins but found nothing.
I tried variations of the search “obsidian double underscore” on Google and the forums but didn’t find anything relevant.

What I’m trying to do

Whenever I type _ in Obsidian it auto-pairs the underscore with another one. So I get like two underscores with the cursor in the middle like so: _|_

This has become an annoyance as I use the underscore a lot for subscripts in mathematical notation. I would like to turn this “feature” off, but I’m not sure how.

I’ve only encountered this issue in Obsidian, and not any other editors I use.

I use Obsidian v0.12.10 on macOS Catalina v10.15.7

1 Like

In settings, after “Auto pair brackets” you find “Auto pair Markdown syntax”: _ is the symbol for italic!

1 Like

Thank you! This solves the problem, however it creates a new one: I frequently use the auto pairing function for Markdown syntax such as * for italics or ** for bold. Is there a way to only turn off auto pairing of _?

Here’s a relevant post from March: Add option to ignore `$` when pairing markdown symbols

Based on that post there doesn’t seem to be a satisfactory solution at the moment…

Have you thought of putting the mathematical notation in the code markdown segment like this?

__ Text here __

1 Like

I don’t think I understand. Could you elaborate?

For mathematical notation I use MathJax, and the code for subscript is a single underscore.

Sorry that I wasn’t clear.

Can you put your mathematical notation in Obsidian Code blocks? You can find out more about it in Format Your Notes. Search for “code blocks”, it’s about half-way down the page.

If I understand correctly, you’re suggesting to put the MathJax code in a code block? I don’t see how that solves my problem, since whether or not you’re in a code block doesn’t appear to affect auto pairing. Moreover, MathJax code written in a code block won’t be rendered in preview mode.

Please let me know if I’m missing something.

I’ve noticed that auto-pairing does not occur if the underscore is preceded by a letter or number. However, it does occur if it is preceded by }, which is typically the case for me. I’m not sure about the inner workings of the auto pairing function, but if somehow this symbol was treated a number or letter, it would have solved my problem.

If you turn “Auto pair Markdown syntax” off, you can use CMD I for italics and CMD B for bold, with both keystrokes automatically pairing the single / double asterisks used in Markdown.

Would that work for your needs?

Angel

2 Likes

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