Payload LogoOctree

LaTeX Subscripts and Superscripts: Complete Guide

Date Published

Subscripts and Superscripts in LaTeX

Subscripts and superscripts are fundamental to mathematical notation. Here's everything you need to know.

Basic Syntax

Superscript (Power/Exponent)

Use the caret ^:

$x^2$ — x squared

$e^x$ — exponential

$2^{10}$ — 2 to the 10th power

Subscript (Index)

Use the underscore _:

$x_1$ — x sub 1

$a_n$ — nth term

$x_{ij}$ — double index

Multiple Characters

For more than one character, use braces:

Wrong: $x^10$ renders as x¹0

Right: $x^{10}$ renders as x¹⁰

Same for subscripts:

Wrong: $a_12$ renders as a₁2

Right: $a_{12}$ renders as a₁₂

Combined Subscripts and Superscripts

You can use both on the same base:

$x_i^2$ — x sub i, squared

$a_n^{(k)}$ — nth term, kth derivative

$T_\mu^\nu$ — tensor notation

Order doesn't matter: $x^2_i$ = $x_i^2$

Stacked Scripts

Limits on Sums and Products

$\sum_{i=1}^{n}$ — sum from i=1 to n

$\prod_{j=1}^{m}$ — product

$\int_0^\infty$ — integral

Display vs. Inline Style

In display mode, limits appear above/below:

$\displaystyle \sum_{i=1}^{n} x_i$

In inline mode, they appear as sub/superscripts.

Special Superscripts

Primes

$f'$ — first derivative (just apostrophe)

$f''$ — second derivative

$f^{(n)}$ — nth derivative

Transpose

$A^T$ or $A^{\top}$ — matrix transpose

Inverse

$A^{-1}$ — matrix inverse

$f^{-1}$ — inverse function

Complement

$A^c$ or $\bar{A}$ — set complement

Superset and Subset Symbols

Not to be confused with superscripts:

$A \supset B$ — A is superset of B

$A \subset B$ — A is subset of B

$A \supseteq B$ — superset or equal

$A \subseteq B$ — subset or equal

Chemical Formulas

Subscripts for quantities:

$H_2O$ — water

$CO_2$ — carbon dioxide

$C_6H_{12}O_6$ — glucose

For ions, combine with superscripts:

$Fe^{2+}$ — iron(II) ion

$SO_4^{2-}$ — sulfate ion

Physics Notation

Tensor Indices

$T^{\mu\nu}$ — contravariant tensor

$T_{\mu\nu}$ — covariant tensor

$T^\mu_\nu$ — mixed tensor

Quantum Numbers

$|n, l, m\rangle$ — quantum state

$\psi_{nlm}$ — wave function

Positioning Tweaks

Raise/Lower Adjustment

For fine control:

$x^{\!\!2}$ — negative space before 2

$x_{\!i}$ — tighter subscript

Pre-scripts (Left Side)

Use \prescript from mathtools:

$\prescript{14}{6}{C}$ — carbon-14

Write Subscripts with Octree

Octree makes notation easy:

- Smart autocomplete for ^ and _ - Preview complex expressions instantly - AI fixes common mistakes - Export perfect PDFs

Try it at https://useoctree.com