Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to write the leading superscript and subscript in Markdown syntax?

image: description of a coordinate transformation

enter image description here

I wonder how to write the leading superscript and subscript shown in the picture in Markdown syntax?

like image 299
SHAWNSHAWNSHAWN Avatar asked May 12 '26 20:05

SHAWNSHAWNSHAWN


2 Answers

Pandoc's flavor of markdown supports a math extension:

Anything between two $ characters will be treated as TeX math.

The following string returns your desired output: $_B^AR$

Pandoc's markdown also has a superscript and subscript extension:

Superscripts may be written by surrounding the superscripted text by ^ characters; subscripts may be written by surrounding the subscripted text by ~ characters. Thus, for example,

H~2~O is a liquid. 2^10^ is 1024.

But, as far as I know, there is no support for your request, a character that combines both a subscript and a superscript.

like image 154
chus Avatar answered May 15 '26 16:05

chus


There are several ways of adding superscript and subscript to a Markdown doc:

  • Use embedded HTML, such as the <sup></sup> and <sub></sub> tags, or even something like <span style="vertical-align: super; font-size: medium;"> if you want more control.
  • Use Unicode for some things, like numbers (¹, ²) and some symbols (, ). See this list of characters.
  • Embed an image with the exact rendering you want using the ![alt text](image src) syntax (like this).
  • Embed LaTeX directly in the Markdown doc using $ or $$ blocks. Eg. Water, also known as H$_2$O. See the raw version of this Gist.

The first three options should work most places that use Markdown. LaTeX support isn't as widespread. For example Pandoc and GitHub now support it but StackOverflow and many other renderers don't.

I've described these options in more detail in my answer to this related question.

like image 20
Molomby Avatar answered May 15 '26 16:05

Molomby