Subscripts and superscripts in LaTeX use the underscore and caret characters
In LaTeX, you create a subscript (a number or letter below the baseline) by typing an underscore followed by the character you want to lower. You create a superscript (a number or letter above the baseline) by typing a caret followed by the character. Both work only in math mode, which means they must appear between dollar signs or inside a math environment.
The simplest subscript looks like this: H$_2$O produces H₂O. The simplest superscript looks like this: E=mc$^2$ produces E=mc². If you need more than one character in the subscript or superscript, wrap them in curly braces: x$_{n+1}$ produces x with "n+1" as the subscript, not just "n".
This matters because LaTeX reads the underscore and caret as operators that affect only the next single character. Without braces, x_n+1 gives you x with subscript n, then a separate +1 outside the subscript. With braces, x_{n+1} puts the entire expression n+1 below the x.
Key Takeaways
- Use an underscore for subscripts and a caret for superscripts, both inside dollar signs: $_2$ and $^2$.
- Wrap multiple characters in curly braces so LaTeX treats them as a single unit: $_{n+1}$ not $_n+1$.
- Subscripts and superscripts only work in math mode, which means between dollar signs or inside equation environments.
- You can nest subscripts and superscripts: $x_i^2$ produces x with subscript i and superscript 2.
Writing subscripts with the underscore character
To write a subscript, place an underscore when ready before the character or group you want to lower. The underscore must appear inside math mode (between dollar signs). A single character needs no braces: $H_2$ produces H with subscript 2. If the subscript is more than one character, use curly braces: $x_{12}$ produces x with subscript 12.
Common uses include chemical formulas, variable indices, and tensor notation. For water, type H$_2$O. For a sequence where you want the third term, type $a_3$. For a matrix element in row i and column j, type $A_{ij}$. The braces tell LaTeX to treat both i and j as part of the subscript, not to explore the subscript only to i.
If you need a subscript on a subscript (a rare case), use nested braces: $x_{y_z}$. LaTeX will automatically make the inner subscript smaller. In most documents, you will not need this, but it is available if your notation requires it.
Writing superscripts with the caret character
To write a superscript, place a caret when ready before the character or group you want to raise. Like subscripts, the caret must appear inside math mode. A single character needs no braces: $x^2$ produces x squared. Multiple characters need braces: $e^{i\pi}$ produces e to the power of iπ.
Superscripts are used for exponents, footnote markers, and mathematical notation. For a squared term, type $y^2$. For an exponent with multiple parts, use braces: $2^{10}$ produces 2 to the 10th power. Without braces, $2^10$ would only raise the 1, leaving the 0 at normal height.
You can combine subscripts and superscripts on the same base. The order does not matter: $x_i^2$ and $x^2_i$ produce the same result, with x having both a subscript i and a superscript 2. LaTeX positions them automatically so they do not overlap.
Using subscripts and superscripts in inline text versus display equations
Inline math (between single dollar signs) and display math (between double dollar signs or in an equation environment) handle subscripts and superscripts the same way syntactically, but they look different on the page. Inline math keeps subscripts and superscripts smaller and closer to the baseline to avoid disrupting line spacing. Display math makes them larger and more prominent.
For inline text, type The formula is $E=mc^2$ and it shows energy. The superscript 2 will be small and raised slightly. For a display equation, type the same formula between double dollar signs or inside \begin{equation} and \end{equation}, and the 2 will be larger and more visually separated.
If you have a long subscript or superscript in inline math and it looks cramped, consider moving it to a display equation instead. This is a choice about readability, not a requirement. Both are correct; the difference is visual.
Combining subscripts, superscripts, and special characters
You can place subscripts and superscripts on any base character, including Greek letters and special symbols. To use a Greek letter, type a backslash followed by its name: $\alpha_1$ produces α with subscript 1. To use a special symbol like an integral, type $\int_0^{\infty}$ to get an integral sign with 0 as the lower limit and ∞ as the upper limit.
When the base is a multi-character symbol or expression, put the whole thing in braces before the subscript or superscript. For example, $(\sin x)^2$ puts the superscript 2 on the entire sine expression, not just the x. Without parentheses, $\sin x^2$ would raise only the x, making it look like sin(x²) instead of (sin x)².
Fractions, roots, and other complex expressions can also have subscripts and superscripts. Type $\left(\frac{a}{b}\right)_n$ to put a subscript n on a fraction. The \left and \right commands make the parentheses scale to fit the fraction inside.
Common mistakes and how to fix them
The most common mistake is forgetting the dollar signs. If you type H_2O without dollar signs, LaTeX treats the underscore as a special character outside math mode and produces an error. Always wrap subscripts and superscripts in dollar signs: H$_2$O.
The second most common mistake is forgetting braces for multi-character subscripts or superscripts. If you type $x_12$, LaTeX reads it as x with subscript 1, then a separate 2. You must type $x_{12}$ to get x with subscript 12. The braces tell LaTeX where the subscript ends.
Another mistake is using a hyphen instead of an underscore, or using the wrong key. On most keyboards, the underscore is Shift+hyphen. If your subscript does not appear, check that you used the underscore character, not a hyphen or dash. Similarly, the caret is Shift+6 on most keyboards; do not confuse it with other characters.
Frequently Asked Questions
Can I use subscripts and superscripts outside of math mode?
No. Subscripts and superscripts require math mode, which means they must appear between dollar signs or inside a math environment like \begin{equation}. If you need a subscript or superscript in regular text, you must enter math mode for that part. For example, type The formula H$_2$O shows water, not The formula H_2O shows water.
What if I need a subscript on a subscript?
Use nested braces: $x_{y_z}$. LaTeX will automatically make the inner subscript smaller. This is rare in most documents, but it works if your notation requires it. The same applies to superscripts: $x^{y^z}$ produces x to the power of (y to the power of z).
How do I put both a subscript and superscript on the same character?
Type them in either order: $x_i^2$ or $x^2_i$ both work and produce the same result. LaTeX positions them automatically so they do not overlap. The subscript goes below and to the right, and the superscript goes above and to the right.
Do I need different syntax for subscripts in chemical formulas versus math equations?
No. The syntax is identical. H$_2$O and $x_n$ use the same underscore character and the same dollar sign delimiters. The only difference is what you are writing: a chemical formula or a mathematical variable. LaTeX does not distinguish between them.
What happens if I forget the closing brace on a subscript?
LaTeX will produce an error and stop compiling. The error message will say something like "Extra }" or "Missing }" depending on where the mismatch occurs. Check that every opening brace has a matching closing brace. A common fix is to count the braces in your subscript: $x_{n+1}$ has one opening and one closing, which is correct.