How to do superscripts and subscripts in Jupyter Notebook? How to do superscripts and subscripts in Jupyter Notebook? python python

How to do superscripts and subscripts in Jupyter Notebook?


You can do this inside of a markdown cell. A markdown cell can be created by selecting a cell then pressing the esc key followed by the M key. You can tell when you have converted a cell to markdown when In [ ]: seen to the right of the default code cell is gone. Then you can input the following code that uses latex with markdown to represent sub/super-scripts:

Latex subscript:$x_{2}$Latex superscript:$x^{2}$

You can find more detailed examples here.

Please comment below if you are still having difficulty.


<sup>superscript text </sup> also works, and might be better because latex formatting changes the whole line etc.


What a meta question! One needs to use Markdown to answer Markdown syntax questions. Markdown does have the <sup></sup> and <sub></sub> tags that will adjust text to super- or sub- script, respectively in the typeface of the current block. If you are using the scripts for mathematical statements like thisthe LaTeX transformation makes sense. If you are using the scripts for footnotes or perhaps for something like chemical formulas (e.g. H2O) it might be preferable to use the first method rather than LaTeX. Mixing fonts is generally not considered a good graphics/typography practice!