Question about superscripts and subscripts

Is it true that Obsidian doesn’t support ordinary Markdown sub and superscripts, or am I doing something wrong?

For example:

100m^2

When I preview that, the 2 is not superscripted.

I searched the forum, and found that I could use LATEX, like so:

100m $^2$

which leaves a space between the m and the superscripted 2

or

$100m^2$

which gets rid of the space but puts the 100 into the Latex font. That’s fine, but if I want to subscript a word, in a document that has not math, it looks a bit funny, e.g.

$Equality_1$ vs. $Equality_2$

I may have just missed something obvious, but if not, what’s the reasoning behind not supporting this one bit of what I think is standard Markdown formatting?

2 Likes

Two suggestions:

  1. You can use html tag <sup>your text</sup>. But this is not practical… A more practical way is create a template using Templater plugin syntax:
<sup><% tp.file.selection() %></sup>

Then create a shortcut/hotkey (via Templater plugin settings) to this template. To use it you select the wanted text and apply the shortcut.

  1. Second way - install the plugin cMenu.

EDIT: In 1. for “subscripts” create another template with <sub><% tp.file.selection() %></sub>

6 Likes

cMenu is a great and quick option, but I just wanted to mention that workarounds using latex can have a decent look too:

100m$^2$

Equality$_1$ vs. Equality$_2$

x$_4$

H$_2$O
Word$^{label}$

Word$_{label}$
4 Likes

You can type 100m$^2$ without a space, and it will render the superscript.

Also, you can use 100m$_2$ for subscript.

image

image

4 Likes

Then create a shortcut/hotkey (via Templater plugin settings) to this template. To use it you select the wanted text and apply the shortcut.

These are helpful, but don’t answer the OP’s question (“what’s the reasoning behind not supporting this one bit of what I think is standard Markdown formatting?”)
I’m also curious because find the latex a bit tedious for this.

2 Likes

The developers explains the markdown in Obsidian here, and afaik for those, the only way to add superscripts and subscripts is the html or latex way.

The ^ character is mostly for footnotes

The right way to represent what you want is to put both quantity and unit inside the \pu command (“pu” stands for “physical unit”):

$\pu{100 m2}$

which renders as

Screenshot 2021-10-23 at 19.11.43

More examples:

$\pu{1.23 kg.m^{-3}}$

$\pu{8.31432e3 N.m.kmol^{-1}.K^{-1}}$

Screenshot 2021-10-23 at 21.05.27

For more info see Manual for: mhchem for MathJax, mhchem for KaTeX

7 Likes

Well, it’s not standard.
A remnant of the variant wars

2 Likes

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