Subscript syntax in LaTeX

To write a subscript in LaTeX, place an underscore _ before the character or group of characters you want to subscript. The subscripted text appears smaller and lower than the surrounding text. If your subscript is a single character, type it directly after the underscore: H_2O produces H with a 2 subscripted. If your subscript contains multiple characters or special formatting, wrap it in curly braces: x_{n+1} produces x with n+1 subscripted as a group.

The underscore only affects the immediately following character unless you use braces. Without braces, x_n+1 subscripts only the n, leaving the +1 at normal size. This is a common mistake that breaks mathematical notation. Always use braces when your subscript is more than one character.

Subscripts work in both text mode and math mode, though they are most common in math mode. In text mode, you may need to enter math mode first with dollar signs or equation environments. For example, The formula is $H_2O$ in chemistry places the subscript inside the math environment while keeping the surrounding words in regular text.

Key Takeaways

  • Use an underscore followed by the character or group to create a subscript: x_2 or x_{n+1}.
  • Always wrap multi-character subscripts in curly braces to keep them together as one subscript unit.
  • Subscripts in text mode require entering math mode with dollar signs or an equation environment first.
  • Nested subscripts and superscripts can be combined, such as x_i^2 for x subscript i, superscript 2.

Single character versus multiple character subscripts

A single character subscript does not require braces because LaTeX knows where it ends. Writing a_1 produces a with 1 subscripted. However, if you type a_10, LaTeX subscripts only the 1, leaving the 0 at normal size. To subscript both digits, use braces: a_{10}.

This distinction matters most in variable names and indices. Chemical formulas like H_2O work without braces because only one digit follows the underscore. But in sequences or matrices where you reference a_{12} or x_{i,j}, braces are essential. The rule is simple: if your subscript is anything other than a single character, use braces.

Subscripts in math mode versus text mode

Math mode is where subscripts are most useful and most common. You enter math mode by surrounding text with dollar signs for inline math ($...$) or using an equation environment for display math. Inside math mode, subscripts work exactly as described: underscore followed by the subscripted content.

In regular text mode outside math environments, the underscore character has a different meaning in LaTeX and may produce an error or unexpected output. To use subscripts in text, you must enter math mode first. For example, The variable $x_1$ represents the first value places only the subscript inside math mode, while the rest of the sentence remains in text mode. This keeps your document readable and prevents formatting errors.

Combining subscripts with superscripts

You can write both a subscript and superscript on the same character by using both underscore and caret symbols. The order does not matter: x_i^2 and x^2_i produce identical output, with i subscripted and 2 superscripted. Use braces around each if they contain multiple characters: x_{i+1}^{n-1}.

When combining subscripts and superscripts, LaTeX positions them automatically so they do not overlap. The subscript appears lower and to the left, while the superscript appears higher and to the right. This is especially useful in scientific notation, matrix indices, and mathematical formulas where both notations appear together.

Common subscript patterns in scientific writing

Chemical formulas use subscripts for atom counts: H_2O, CO_2, Ca(OH)_2. For the last example, you subscript the entire group by wrapping it in braces: Ca(OH)_{2}. Physics and mathematics use subscripts for variable indices: v_x for velocity in the x direction, a_{ij} for matrix elements, x_n for the nth term in a sequence.

Subscripts also appear in partial derivatives and limits. The notation \frac{\partial f}{\partial x_i} shows a partial derivative with respect to x subscript i. In summation notation, \sum_{i=1}^{n} places the starting index as a subscript and the ending index as a superscript. Learning these patterns helps you write standard mathematical and scientific notation correctly in LaTeX.

Troubleshooting subscript errors

The most common error is forgetting braces on multi-character subscripts. If x_n+1 produces unexpected output, add braces: x_{n+1}. Another frequent issue is using subscripts outside math mode without entering math mode first. If you get an error about an undefined control sequence or unexpected underscore, wrap the subscripted content in dollar signs.

Nested subscripts—subscripts on subscripts—are rarely needed but possible. Write x_{y_z} to subscript y, then subscript z to that result. This produces very small text and is usually avoided in favor of clearer notation. If your subscript contains special characters like Greek letters or mathematical symbols, ensure you are in math mode where those symbols are defined.

Frequently Asked Questions

Can I use subscripts outside of math mode?

Not directly. The underscore character has special meaning in LaTeX text mode and will cause errors. To use subscripts in text, enter math mode first with dollar signs: The value $x_1$ is important. This keeps the subscript formatted correctly while the surrounding text remains in text mode.

What is the difference between _ and ^?

The underscore _ creates a subscript (text below the baseline), while the caret ^ creates a superscript (text above the baseline). Both follow the same rules: single characters do not need braces, but multiple characters do. You can use both on the same character: x_i^2.

Do I need braces around a single digit subscript?

No. Single characters, including single digits, do not require braces. x_1 works fine. However, x_10 subscripts only the 1, so use x_{10} for two digits. When in doubt, braces do not hurt and make your code clearer.

How do I subscript an entire expression like (a+b)?

Wrap the expression in braces: x_{(a+b)}. The braces tell LaTeX to treat everything inside as a single subscript unit. Without braces, only the opening parenthesis would be subscripted, leaving the rest at normal size.

Can subscripts contain Greek letters or symbols?

Yes, as long as you are in math mode where those symbols are defined. For example, $x_{\alpha}$ subscripts the Greek letter alpha. Use the backslash command for the symbol: \alpha, \beta, \gamma, and so on. This works in any subscript, whether single or multi-character.