8

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?

Pengyy
  • 37,383
  • 15
  • 83
  • 73
SHAWNSHAWNSHAWN
  • 91
  • 1
  • 1
  • 2
  • Too broad: You need to explain how you are rendering your Markdown: as **HTML**, as **PDF**, as **NSAttributedString** (iOS), etc. And what are the base rules that you are applying: **GitHub-flavored**, **BitbucketServer Markup**, **StackOverflow Markup**, **MultiMarkdown**, **CommonMark**, **Kramdown**, etc. You can find [a list of Markups variations here](https://github.com/laptobbe/TSMarkdownParser/blob/3.x/ROADMAP.md) – Cœur Apr 12 '17 at 05:36

4 Answers4

5

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.

chus
  • 1,577
  • 15
  • 25
5

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.

Molomby
  • 5,859
  • 2
  • 34
  • 27
4

Try using <sup></sup> (<sub></sub>), as suggested in this other SO post (but indeed, the solution depends on the way it's rendered)

jjrr
  • 1,038
  • 2
  • 13
  • 26
0

What are you doing? Are you using Github or compiling a markdown file to pdf? Or using Jekyll? In any case you can display that (and any other math symbol) using latex inside markdown.

  • If you are using Github: No idea how to do it
  • If you are blogging using Jekyll: Use MathJax
  • If you want to compile the markdown file to pdf: Use pandoc! just compile the file using: pandoc test.md -o test.pdf

In latex you can write leading superscripts with this code:

\documentclass{article}
\begin{document}
\[
^gp = {}^gR^l_l+{}^go_l
\]
\end{document}

as explained here.

Community
  • 1
  • 1