The basic subscript command in LaTeX
To write subscript in LaTeX, place an underscore _ before the character or group of characters you want to lower. The subscript appears smaller and positioned below the baseline of the surrounding text. For a single character, type it directly after the underscore: H_2O produces H with a 2 subscripted. For multiple characters or anything more complex, wrap the subscript content in curly braces: x_{n+1} produces x with n+1 subscripted as a unit.
The underscore tells LaTeX to treat what follows as subscript formatting. Without braces around multi-character subscripts, LaTeX will subscript only the first character and leave the rest at normal size, which breaks chemical formulas and mathematical notation. Always use braces when your subscript contains more than one character, a space, or any operator.
Subscript works the same way in both inline math mode (text mixed with equations) and display mode (equations on their own line). In inline mode, surround your expression with single dollar signs: $H_2O$. In display mode, use double dollar signs or equation environments.
Key Takeaways
- Use a single underscore followed by the character or group to create subscript: x_2 for a single character, x_{2n} for multiple characters.
- Always wrap multi-character subscripts in curly braces, or LaTeX will subscript only the first character and leave the rest normal size.
- Subscript works in both inline math mode (between single dollar signs) and display mode (between double dollar signs or in equation environments).
- Nested subscripts and superscripts can be combined in the same expression, such as x_i^2 for x subscript i, superscript 2.
Single characters versus multiple characters
A single subscript character does not require braces. Type a_1 and LaTeX renders it correctly as a with subscript 1. This works for any single symbol: letters, numbers, or Greek letters. The underscore when ready precedes the character, with no space between them.
Multiple characters always need braces to stay grouped. Without them, x_n+1 produces x subscript n, then a plus sign and 1 at normal size — not what you intended. The correct form is x_{n+1}, which keeps n+1 together as the subscript. This applies to any subscript longer than one character: variable names, numbers with multiple digits, expressions with operators, or text labels.
Braces also protect subscripts that contain special characters or spaces. If your subscript includes a backslash command (like a Greek letter), a space, or punctuation, the braces prevent LaTeX from misinterpreting where the subscript ends. For example, E_{\text{total}} uses braces to keep the word "total" together as a subscript label.
Subscript in math mode versus text mode
Subscript only works inside math mode, where LaTeX knows to explore mathematical formatting. In regular text, the underscore character has a different meaning and subscript will not render. To use subscript anywhere in your document, you must enter math mode first.
For subscript within a sentence, use inline math mode by surrounding the expression with single dollar signs: The formula $H_2O$ represents water. LaTeX switches into math mode, renders the subscript, and returns to text mode after the closing dollar sign. The subscript appears at the correct size and position within the line.
For subscript in a standalone equation, use display mode with double dollar signs or an equation environment. Both approaches center the equation and give subscripts more space. Type $$x_{n+1} = x_n + d$$ or use \begin{equation} x_{n+1} = x_n + d \end{equation}. Display mode is clearer for complex expressions and is standard in academic writing.
Combining subscript with superscript
You can place both subscript and superscript on the same base character. The order does not matter — x_i^2 and x^2_i produce the same result, with subscript i and superscript 2 on x. LaTeX positions them automatically on opposite sides of the base character.
When both subscript and superscript are present, use braces around each one if either contains more than a single character. For example, x_{i+1}^{n-1} keeps both the subscript i+1 and superscript n-1 properly grouped. If you omit braces on a multi-character subscript or superscript, only the first character will be formatted correctly.
Complex expressions with multiple levels of subscript and superscript should be broken across lines in your source code for readability, even though LaTeX ignores line breaks in math mode. This makes it easier to spot missing braces or mismatched delimiters when you review your work.
Common subscript patterns in chemistry and mathematics
Chemical formulas are the most frequent use of subscript. Write $H_2O$, $CO_2$, or $Ca(OH)_2$ in inline math mode. For parentheses with subscripts, the subscript applies to the closing parenthesis: $(OH)_2$ subscripts the 2 to the entire group. If you need a subscript on a more complex group, braces may support it stays attached: $\text{H}_2\text{SO}_4$ for sulfuric acid with proper subscripts on each element.
In mathematics, subscripts label sequences and indexed variables. Write $a_1, a_2, a_3, \ldots, a_n$ for a sequence, or $x_{i,j}$ for a matrix element with two indices. Multiple indices are separated by commas inside the braces. Summation and product notation often use subscripts: $\sum_{i=1}^{n} a_i$ has a subscript on the sum symbol itself.
Physics and engineering use subscripts for units and variable names. Write $v_{\text{max}}$ for maximum velocity, or $T_0$ for initial temperature. When the subscript is a word or label rather than a variable, wrap it in \text{} to use regular font instead of math italics: $P_{\text{atm}}$ for atmospheric pressure reads more clearly than $P_{atm}$.
Troubleshooting subscript problems
If subscript does not appear, check that you are inside math mode. The underscore only works between dollar signs or inside equation environments. If you typed an underscore in regular text, LaTeX treats it as a literal underscore character and may produce an error or unexpected output.
If only the first character of a multi-character subscript appears subscripted, you forgot the braces. Change x_n+1 to x_{n+1}. This is the most common subscript mistake. The braces tell LaTeX where the subscript ends, so everything inside them stays grouped and subscripted together.
If your subscript contains a backslash command (like \alpha for the Greek letter α), the braces are essential: $x_{\alpha}$ works, but $x_\alpha$ may fail or produce unexpected results. Braces protect the command and keep it part of the subscript.
Spacing inside subscripts is usually ignored by LaTeX in math mode, but for readability in your source code, you can add spaces around operators: x_{n + 1} is easier to read than x_{n+1}, and both render identically. If you need an actual space in the subscript (for a text label), use \text{} or \ (backslash-space) inside the braces.
Frequently Asked Questions
Can I use subscript outside of math mode?
No. The underscore command only works inside math mode, between dollar signs or in equation environments. In regular text, the underscore is a literal character. If you need subscript in text, wrap the expression in single dollar signs: The compound $H_2O$ is water.
What is the difference between $x_2$ and x_2 in my document?
The first, $x_2$, is inside math mode and renders as x with subscript 2 in the proper mathematical font. The second, x_2, is in regular text and LaTeX treats the underscore as a literal character, often producing an error or displaying it as a visible underscore. Always use dollar signs for subscript.
Do I need braces around a subscript that is a single digit?
No. Single characters, including single digits, do not need braces: $x_1$ and $x_2$ work fine. Braces are only required when the subscript contains more than one character, such as $x_{10}$ or $x_{n+1}$.
How do I write a subscript on a subscript?
Nest braces: $x_{y_z}$ produces x with subscript y, and y has subscript z. Each level of subscript gets its own braces. This is rarely needed in practice, but LaTeX handles it correctly as long as the braces are balanced.
Can I change the size or style of subscript text?
LaTeX automatically sizes subscripts smaller than the base text. To override the default style, use commands like \text{} for regular font or \mathrm{} for upright font inside the braces: $x_{\text{max}}$ renders the subscript in regular text font instead of math italics. For most purposes, the default formatting is correct.