LaTeX Subscript and Superscript
A LaTeX subscript is written with _ and a superscript with ^ inside math mode: $x_1$ gives x₁ and $x^2$ gives x². When the script is longer than one character, wrap it in braces: $x^{10}$.
$x_1$, \quad $x^2$, \quad $x_1^2$, \quad $e^{i\pi} + 1 = 0$Full document you can compile
\documentclass{article}
\begin{document}
$x_1$, \quad $x^2$, \quad $x_1^2$, \quad $e^{i\pi} + 1 = 0$
\end{document}How do you write a LaTeX subscript and superscript together?
Put both after the base, in either order: x_1^2 and x^2_1 give the same result, with the subscript set below the superscript. Both only work in math mode, between $…$ or in an equation. Outside math, _ and ^ stop the compile with ! Missing $ inserted.
Why does x^10 show only the 1 raised?
Without braces, _ and ^ take exactly one character. $x^10$ raises the 1 and leaves the 0 on the baseline, and $a_ij$ lowers only the i. Braces group the whole script.
Without braces: $x^10$ and $a_ij$
With braces: $x^{10}$ and $a_{ij}$Full document you can compile
\documentclass{article}
\begin{document}
Without braces: $x^10$ and $a_ij$
With braces: $x^{10}$ and $a_{ij}$
\end{document}How do you put a subscript in normal text?
Use \textsubscript{…} and \textsuperscript{…}. They work outside math, keep the text font, and need no package in current LaTeX. This is the right choice for chemical formulas in a sentence and for ordinals like 1st.
Water is H\textsubscript{2}O and this is the
1\textsuperscript{st} draft.Full document you can compile
\documentclass{article}
\begin{document}
Water is H\textsubscript{2}O and this is the
1\textsuperscript{st} draft.
\end{document}Can you nest a LaTeX subscript inside another?
Yes. A script can have its own script, as in a double exponent 2^{2^n} or an index of an index x_{i_k}. Each level is set smaller, down to a minimum size.
$2^{2^n}$, \quad $x_{i_k}$, \quad $e^{-x^2/2}$Full document you can compile
\documentclass{article}
\begin{document}
$2^{2^n}$, \quad $x_{i_k}$, \quad $e^{-x^2/2}$
\end{document}Why do limits on a sum move to the side?
Inside a paragraph, LaTeX places the limits of \sum, \prod and \lim to the right so the line spacing stays even. In a displayed equation they go above and below. To force the stacked form inline, write \sum\limits_{i=1}^{n}. The sum sign and ∞ have their own pages: the sigma symbol and the infinity symbol.
Inline: $\sum_{i=1}^{n} i$ \quad Displayed:
\[ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} \]Full document you can compile
\documentclass{article}
\begin{document}
Inline: $\sum_{i=1}^{n} i$ \quad Displayed:
\[ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} \]
\end{document}How do you write a subscript before a symbol?
For isotopes and tensor notation, load mathtools and use \prescript{sup}{sub}{base}. It right-aligns the two left scripts against the base, which an empty group like {}^{14}_{6}\mathrm{C} doesn't do.
Carbon-14: $\prescript{14}{6}{\mathrm{C}}$Needs \usepackage{mathtools} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage{mathtools}
\begin{document}
Carbon-14: $\prescript{14}{6}{\mathrm{C}}$
\end{document}How do you write chemical formulas with subscripts?
For more than the odd H₂O, the mhchem package is easier: inside \ce{…}, numbers after an element become subscripts and charges after ^ become superscripts, all in upright type.
\ce{H2SO4}, \quad \ce{SO4^2-}, \quad \ce{^{14}_{6}C}Needs \usepackage{mhchem} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage{mhchem}
\begin{document}
\ce{H2SO4}, \quad \ce{SO4^2-}, \quad \ce{^{14}_{6}C}
\end{document}How do you get subscripts on a web page?
The LaTeX to HTML and MathML converter turns x_1 into MathML that browsers render, and the equation editor lets you build the formula with a preview. HTML's own <sub> and <sup> tags are fine for text such as H₂O, as the symbol table notes.
Sources
- LaTeX2e: An unofficial reference manual, Subscripts & superscripts, read Nov 28, 2026
- mathtools package documentation (CTAN), read Nov 28, 2026
- mhchem package documentation (CTAN), read Nov 28, 2026
Text drafted with AI from the cited documentation; every example compiled with TeX Live 2026; checked by Cem Demir. See the editorial policy.