Superscript and subscript in LaTeX use the caret (^) and underscore (_) symbols

In LaTeX, superscript (text raised above the line) uses the caret symbol ^, and subscript (text lowered below the line) uses the underscore symbol _. Both work the same way: type the symbol, then the character or group of characters you want raised or lowered. If you need more than one character, wrap them in curly braces.

These symbols work in math mode (between dollar signs) and in text mode, though they behave slightly differently depending on where you use them. Math mode is the most common place you'll use them, especially for equations, chemical formulas, and mathematical notation.

Key Takeaways

  • Use the caret (^) for superscript and the underscore (_) for subscript, followed by the character or {group} you want raised or lowered.
  • Single characters don't need braces, but multiple characters must be wrapped in curly braces to stay together.
  • Math mode (between $ signs) is where superscript and subscript work most reliably and look most professional.
  • You can combine superscript and subscript on the same base character by using both symbols in sequence.
  • In text mode outside math, superscript and subscript may not render properly depending on your font and LaTeX engine.

Superscript for exponents and footnote markers

Superscript is most useful for mathematical exponents. In math mode, type the base number or variable, then the caret, then the exponent. For a single character, you don't need braces: $x^2$ produces x squared. For multiple characters, use braces: $x^{2n+1}$ keeps the entire exponent together.

Outside math mode, you can use the \textsuperscript{} command for footnote numbers or ordinal indicators like 1st, 2nd, 3rd. Type 1\textsuperscript{st} to get 1st. This command only works in text mode, not inside math mode.

Subscript for indices and chemical notation

Subscript is the counterpart to superscript and works the same way. In math mode, type the base, then the underscore, then the subscript character. A single character needs no braces: $x_1$ produces x with a subscript 1. Multiple characters need braces: $H_2O$ produces the chemical formula for water with the 2 as a subscript.

Subscript is especially common in chemistry, where you write formulas like $CO_2$ or $H_2SO_4$. It's also used in mathematics for sequences and indexed variables, like $a_n$ for the nth term of a sequence.

Combining superscript and subscript on the same character

You can place both a superscript and a subscript on the same base character. The order doesn't matter — LaTeX will position them correctly. Type $x^2_1$ or $x_1^2$ and both produce x with a superscript 2 and a subscript 1. The underscore and caret can appear in either order.

This is common in physics and advanced mathematics, where you might write something like $E^2_n$ for an energy level or $T^i_j$ for a tensor component. Keep each part straightforward — if your superscript or subscript has multiple characters, wrap it in braces.

Using math mode for reliable formatting

Math mode (text between single dollar signs for inline math, or double dollar signs for display math) is where superscript and subscript work most reliably. In math mode, the caret and underscore are reserved for this purpose, and LaTeX automatically adjusts font size and spacing to look correct.

If you try to use ^ or _ in regular text mode, LaTeX will either produce an error or give unexpected results. For text-based superscript outside math mode, use \textsuperscript{} instead. For subscript in text mode, there is no standard command — you must switch to math mode or use a package like fixltx2e.

Nested superscript and subscript

You can nest superscript and subscript, though this is rare and can look cluttered. For example, $x^{2^3}$ produces x to the power of 2 to the power of 3. The inner braces keep the nested part together. Avoid nesting more than two levels deep, as it becomes hard to read.

If you find yourself writing deeply nested exponents, consider using the \exp command or rewriting the expression. For instance, instead of $e^{x^2}$, you might write $\exp(x^2)$ for clarity.

Common mistakes and how to fix them

The most common mistake is forgetting braces around multi-character superscripts or subscripts. If you type $x^10$, LaTeX only raises the 1, leaving the 0 at normal height. Always use $x^{10}$ for the entire exponent to be raised. The same rule applies to subscripts: $x_10$ is wrong; use $x_{10}$.

Another mistake is using ^ or _ outside math mode. If you type This is x^2 without dollar signs, LaTeX will produce an error. Always wrap mathematical notation in dollar signs. If you need superscript in text, use \textsuperscript{} instead.

Frequently Asked Questions

Can I use superscript and subscript in regular text without math mode?

Superscript in text mode works with \textsuperscript{}, but subscript has no standard command in text mode. For both, it's simpler and more reliable to use math mode with dollar signs. Type $x^2$ instead of trying to force it into text.

What if my superscript or subscript looks too small?

LaTeX automatically reduces font size for superscript and subscript. If it's too small to read, your expression may be too complex. Consider breaking it into multiple lines or using \displaystyle to force normal-size fonts, though this is rarely needed.

How do I write a superscript or subscript with multiple operations, like x to the power of 2n+1?

Use braces to group the entire exponent: $x^{2n+1}$. Without braces, only the 2 would be raised. Braces tell LaTeX to treat everything inside as a single unit.

Can I use superscript and subscript in section headings or titles?

Yes, but wrap the math in dollar signs: \section{The formula $E=mc^2$}. LaTeX will render the superscript correctly in the heading and in the table of contents.

What's the difference between ^ and \textsuperscript{}?

The caret (^) only works in math mode. \textsuperscript{} works in text mode and uses the font's built-in superscript characters if available. Use ^ for math, \textsuperscript{} for text like footnote markers or ordinals.