Skip to main content
Master subscripts and superscripts in LaTeX for mathematical expressions, scientific notation, and technical documentation. This comprehensive guide covers everything from basic usage to advanced techniques for complex notation.
Quick start: Use _ for subscripts and ^ for superscripts. For multiple characters, enclose in braces: x_{12} and x^{2n}.Prerequisites: Basic LaTeX knowledge. For math mode basics, see Mathematical Expressions.

What You’ll Learn

  • ✅ Basic subscript and superscript syntax
  • ✅ Multiple levels and combined notation
  • ✅ Special cases (limits, operators, tensors)
  • ✅ Chemical formulas and isotopes
  • ✅ Advanced positioning and formatting
  • ✅ Common errors and how to fix them
  • ✅ Best practices for readability

Basic Syntax

Subscripts (Indices)

\documentclass{article}
\usepackage{amsmath}
\begin{document}

% Single character subscript
$x_1$, $x_2$, $x_n$

% Multiple character subscript (requires braces)
$x_{12}$, $x_{n+1}$, $x_{max}$

% Variables with subscripts
$a_i$, $b_j$, $c_{ij}$

% Greek letters with subscripts
$\alpha_1$, $\beta_{n}$, $\gamma_{i,j}$

\end{document}
Rendered output:
x₁, x₂, xₙ
x₁₂, xₙ₊₁, xₘₐₓ
aᵢ, bⱼ, cᵢⱼ
α₁, βₙ, γᵢ,ⱼ

Superscripts (Exponents)

\documentclass{article}
\usepackage{amsmath}
\begin{document}

% Single character superscript
$x^2$, $x^n$, $x^*$

% Multiple character superscript (requires braces)
$x^{10}$, $x^{2n}$, $x^{n+1}$

% Common exponents
$e^x$, $2^n$, $10^{-3}$

% Special notations
$x^{\prime}$, $x^{\dagger}$, $x^{\ast}$

\end{document}
Rendered output:
x², xⁿ, x*
x¹⁰, x²ⁿ, xⁿ⁺¹
eˣ, 2ⁿ, 10⁻³
x′, x†, x*

Important Rule: Braces for Multiple Characters

Critical: Without braces, only the first character after _ or ^ becomes sub/superscript:
  • x_12 renders as x₁2 (only 1 is subscript)
  • x_{12} renders as x₁₂ (both 1 and 2 are subscript)

Combined Subscripts and Superscripts

Basic Combinations

\documentclass{article}
\usepackage{amsmath}
\begin{document}

% Both subscript and superscript
$x_1^2$, $a_n^m$, $x_i^{j+1}$

% Order doesn't matter
$x_1^2 = x^2_1$

% Complex combinations
$x_{n+1}^{2m}$, $a_{ij}^{kl}$

% With operators
$\sum_{i=1}^n$, $\int_0^{\infty}$

% Tensor notation
$T_{\mu\nu}^{\rho\sigma}$

\end{document}
Rendered output:
x₁², aₙᵐ, xᵢʲ⁺¹
x₁² = x₁²
xₙ₊₁²ᵐ, aᵢⱼᵏˡ
i=1n, 0
Tμνρσ

Nested Subscripts and Superscripts

\documentclass{article}
\usepackage{amsmath}
\begin{document}

% Nested superscripts
$x^{2^n}$, $e^{x^2}$, $2^{2^{2^2}}$

% Nested subscripts
$x_{i_j}$, $a_{n_{k+1}}$

% Mixed nesting
$x_i^{j^k}$, $a_{m_n}^{p^q}$

% Using additional braces for clarity
${(x^2)}^3 = x^6$

% Tower notation
$2^{2^{2^{\cdot^{\cdot^{\cdot}}}}}$

\end{document}
Rendered output:
x2n, ex2, 2222
xij, ank+1
xijk, amnpq
(x²)³ = x⁶
222···

Special Use Cases

Limits and Operators

\documentclass{article}
\usepackage{amsmath}
\begin{document}

% Inline limits
$\lim_{x \to 0} f(x)$

% Display style limits
\[\lim_{x \to \infty} \frac{1}{x} = 0\]

% Summation
\[\sum_{i=1}^{n} i = \frac{n(n+1)}{2}\]

% Product
\[\prod_{k=1}^{n} k = n!\]

% Integration
\[\int_0^1 x^2 \, dx = \frac{1}{3}\]

% Multiple limits
\[\lim_{\substack{x \to 0 \\ y \to 0}} f(x,y)\]

\end{document}
Rendered output:
limx→0 f(x)
lim
x→∞
1x= 0
n
i=1
i =n(n+1)2

Chemical Formulas

\documentclass{article}
\usepackage{amsmath}
\usepackage{mhchem} % Better chemistry support
\begin{document}

% Basic chemical formulas
$\mathrm{H_2O}$, $\mathrm{CO_2}$, $\mathrm{H_2SO_4}$

% Isotopes
$^{14}\mathrm{C}$, $^{235}\mathrm{U}$, $^2\mathrm{H}$

% Ions
$\mathrm{Na^+}$, $\mathrm{Cl^-}$, $\mathrm{SO_4^{2-}}$

% With mhchem package (recommended)
\ce{H2O}, \ce{CO2}, \ce{H2SO4}
\ce{^{14}C}, \ce{Na+}, \ce{SO4^{2-}}

% Chemical equations
\ce{2H2 + O2 -> 2H2O}

\end{document}
Rendered output:
H₂O, CO₂, H₂SO₄
14C, 235U, 2H
Na⁺, Cl⁻, SO₄²⁻
H₂O, CO₂, H₂SO₄
14C, Na⁺, SO₄²⁻
2H₂ + O₂ → 2H₂O

Physics and Engineering Notation

\documentclass{article}
\usepackage{amsmath}
\usepackage{tensor} % For tensor notation
\begin{document}

% Vector components
$\vec{v} = v_x\hat{i} + v_y\hat{j} + v_z\hat{k}$

% Derivatives
$\frac{d^2y}{dx^2}$, $\frac{\partial^2 f}{\partial x^2}$

% Tensors
$g_{\mu\nu}$, $R^{\alpha}_{\beta\gamma\delta}$

% Four-vectors
$x^\mu = (ct, x, y, z)$

% Christoffel symbols
$\Gamma^{\lambda}_{\mu\nu}$

% Units
$10^{-9}\,\mathrm{m}$, $3.0 \times 10^8\,\mathrm{m/s}$

\end{document}
Rendered output:
v⃗ = vₓî + vᵧĵ + vᵤk̂
d²ydx², ∂²f∂x²
gμν, Rαβγδ
xμ = (ct, x, y, z)
Γλμν
10⁻⁹ m, 3.0 × 10⁸ m/s

Advanced Techniques

Primes and Multiple Primes

\documentclass{article}
\usepackage{amsmath}
\begin{document}

% Single prime
$f'(x)$, $y'$

% Multiple primes
$f''(x)$, $f'''(x)$

% Alternative notation
$f^{\prime}(x)$, $f^{\prime\prime}(x)$

% With subscripts
$x'_1$, $x''_n$

% Prime on subscript
$x_{n'}$, $x_{n''}$

\end{document}
Rendered output:
f′(x), y′
f″(x), f‴(x)
f′(x), f″(x)
x′₁, x″ₙ
xₙ′, xₙ″

Positioning and Spacing

\documentclass{article}
\usepackage{amsmath}
\begin{document}

% Pre-subscripts and superscripts
${}_a^b X_c^d$

% Tensor notation with prescript package
\usepackage{tensor}
\tensor[^a_b]{X}{_c^d}

% Manual spacing adjustments
$x_{\!n}$ % negative thin space
$x_{\,n}$ % thin space
$x_{\:n}$ % medium space
$x_{\;n}$ % thick space

% Phantom subscripts for alignment
\begin{align}
x_1 &= a \\
x_{\phantom{1}2} &= b
\end{align}

\end{document}

Accents with Sub/Superscripts

\documentclass{article}
\usepackage{amsmath}
\begin{document}

% Accents with subscripts
$\hat{x}_i$, $\tilde{y}_n$, $\bar{z}_k$

% Accents with superscripts
$\hat{x}^2$, $\vec{v}^T$, $\dot{x}^n$

% Combined
$\hat{x}_i^2$, $\tilde{\phi}_{nm}^{kl}$

% Wide accents
$\widehat{xyz}_1^2$, $\widetilde{ABC}_{ij}$

\end{document}
Rendered output:
x̂ᵢ, ỹₙ, z̄ₖ
x̂², v⃗ᵀ, ẋⁿ
x̂ᵢ², φ̃ₙₘᵏˡ
^xyz₁², ~ABCᵢⱼ

Text Mode Subscripts and Superscripts

\documentclass{article}
\usepackage{fixltx2e} % For \textsubscript
\begin{document}

% In text mode
H\textsubscript{2}O is water.
E = mc\textsuperscript{2} is Einstein's equation.

% Or use math mode
H$_2$O is water.
E = mc$^2$ is Einstein's equation.

% Ordinals
1\textsuperscript{st}, 2\textsuperscript{nd}, 3\textsuperscript{rd}

% Footnote markers
Text\textsuperscript{a}, Reference\textsuperscript{1}

\end{document}
Rendered output:
H2O is water.
E = mc2 is Einstein’s equation.
H₂O is water.
E = mc² is Einstein’s equation.
1st, 2nd, 3rd
Texta, Reference1

Common Errors and Solutions

Problem: x_a_b causes “Double subscript” error.Solution: Use braces to clarify structure:
x_{a_b}    % a with subscript b, all subscript to x
x_a{}_{b}  % separate subscripts a and b
Problem: x_12 shows as x₁2 instead of x₁₂.Solution: Always use braces for multiple characters:
x_{12}     % Correct
x_12       % Wrong
Problem: Limits appear cramped in inline math.Solution: Use display style or \limits:
$\lim\limits_{x \to 0}$     % Forces display style
\[\lim_{x \to 0}\]          % Use display math
Problem: x'^2 doesn’t work as expected.Solution: Use proper grouping:
{x'}^2     % Correct
x'^2       % May cause issues
x^{\prime 2}  % Alternative

Best Practices

1. Readability Guidelines

✅ Good Practices

  • Use meaningful subscripts: v_x not v_1 for x-component
  • Avoid deep nesting: x_ is okay, deeper is confusing
  • Be consistent: If using i,j,k for indices, stick to it
  • Use semantic notation: \max not max

❌ Poor Practices

  • Overusing sub/superscripts: x_{a_{b_{c_{d}}}}
  • Mixing notation styles in same document
  • Using subscripts for non-mathematical text
  • Forgetting braces: x_min instead of x_{min}

2. Consistency Rules

  • Indices: Use consistent letters (i, j, k or m, n, p)
  • Coordinates: Be consistent (x, y, z or r, θ, φ)
  • Time derivatives: Choose notation and stick to it (ẋ or dx/dt)
  • Vector components: Consistent notation (subscripts or superscripts)

3. Special Notation Standards

% Tensors - superscripts before subscripts
$T^{\mu\nu}_{\rho\sigma}$  % Correct
$T_{\rho\sigma}^{\mu\nu}$  % Less standard

% Derivatives - use consistent notation
$\frac{\partial^2 f}{\partial x^2}$  % Standard
$f_{xx}$                              % Alternative

% Units - use upright text
$10^{-3}\,\mathrm{m}$     % Correct
$10^{-3}\,m$              % Wrong (italic m)

4. Accessibility Considerations

  • Avoid excessive nesting that’s hard to read
  • Use \text{} for words in subscripts: x_{\text{max}}
  • Consider alternative notations for complex expressions
  • Break very complex expressions into parts

Quick Reference Card

Subscripts & Superscripts Quick Reference

Basic Commands

x_1 → x₁x^2 → x²x_ → x₁₂x^ → x²ⁿx_i^j → xᵢʲ

Special Cases

\sum_{i=1}^n\lim_{x \to 0}f’(x) or f^{\prime}{}_a^b X_c^d

Text Mode

\textsubscript{2}\textsuperscript{2}H2_2Ox2^2

Common Patterns

x_{n+1}a_{ij}^{kl}T^{\mu\nu}_{\rho}^{14}C
LaTeX Cloud Studio tip: Use our equation preview feature to instantly see how your subscripts and superscripts render. No compilation needed!
I