Superscript and subscript in LaTeX
Updated:
A superscript (power) is written with ^ and a subscript with _. If the index has more than one character, wrap it in braces; otherwise only the first character ends up in the index.
Power and index
x_1^2 + x_2^2The order of ^ and _ does not matter: x_1^2 and x^2_1 give the same result. LaTeX stacks both indices above each other on the same letter.
Copying this from handwritten notes? Snap a photo of the page and CamteX turns the formulas into LaTeX. Try it free
Multi-character index
a_{n+1} = 2^{10}The braces mark the whole content of the index. Without them a_n+1 gives a with subscript n followed by an ordinary +1, which changes the meaning.
Text subscript
E_{\text{kin}}\text sets the subscript upright, like ordinary text. That matters because kin is an abbreviation of a word, not a product of three variables.
Power of a power
e^{x^2}Indices can be nested, and each level is smaller than the one before. With three or more levels the formula gets hard to read; write \exp(x^2) instead.
Double index
a_{ij} \quad a_{i,j} \quad a_{1,12}With two one-letter indices a_{ij} is enough. A comma removes ambiguity once numbers appear: a_{112} could mean row 11 or row 1.
Indices on the left
{}^{14}_{6}\mathrm{C}The empty group {} gives the indices a base, so they land to the left of the symbol. This is how isotopes are written; for chemical formulas the mhchem package is more convenient.
Powers of 10 and negative exponents
c = 3 \cdot 10^{8}\,\mathrm{m/s}, \quad 10^{-3}, \quad x^{-1/2}A minus sign counts as a character, so 10^-3 puts only the minus in the exponent. In a lab report with many such numbers, \num{3e8} from siunitx writes the power of 10 for you.
Superscript and subscript in normal text
1\textsuperscript{st} place, H\textsubscript{2}OOutside math mode ^ and _ are errors. \textsuperscript and \textsubscript keep the letters upright in the font of the paragraph, while $^{st}$ would set them in math italics.
Common mistakes
- x^10 gives x to the power of 1 followed by a plain 0. Correct: x^{10}.
- A word subscript without \text: E_{kin} is set in italics like the product of variables k, i and n.
- Two superscripts in a row: x^2^3 stops with a Double superscript error. Write the nesting as x^{2^3}.
See also
- Fraction in LaTeX
- Text in equations in LaTeX
- Logarithms and exponentials in LaTeX
- Chemical formulas in LaTeX
Don't want to memorize commands?
Draw a formula or paste a screenshot, and CamteX turns it into ready LaTeX.