Subscript basics in LaTeX
In LaTeX, you create a subscript by typing an underscore followed by the character or characters you want to appear below the line. The underscore tells LaTeX to shift what comes next into subscript position. If you want more than one character in the subscript, wrap them in curly braces.
The simplest subscript is a single character: H_2O produces H with a 2 below it. For multiple characters, use braces: x_{n+1} produces x with n+1 below it. Without the braces, only the first character after the underscore becomes a subscript.
Subscripts work in both text mode and math mode, though they behave slightly differently. In text mode, you must be inside a math environment (between dollar signs or in an equation block) for the underscore to function as a subscript command rather than a regular character.
Key Takeaways
- Use a single underscore followed by the subscript content: x_2 or x_{subscript}.
- Wrap multiple characters in curly braces so all of them appear as subscript, not just the first one.
- Subscripts only work inside math mode, which you enter with dollar signs or equation environments.
- Nested subscripts are possible: you can place a subscript on a subscript, though readability suffers quickly.
Single versus multiple subscript characters
A single character after the underscore automatically becomes subscript. Type a_1 and LaTeX renders it as a with 1 below. This works because LaTeX knows where the subscript ends: after one character.
Multiple characters require curly braces to stay together as one subscript. Without braces, a_12 produces a with only 1 below, and the 2 appears at normal height. With braces, a_{12} produces a with 12 below it. The braces tell LaTeX that everything inside them belongs to the subscript.
This rule applies to any subscript content: variables, numbers, expressions, or words. x_{max} puts max below x. E_{kinetic} puts kinetic below E. The braces group the content so it all shifts together.
Subscripts in math mode versus text mode
Math mode is where subscripts work properly. You enter math mode by surrounding your content with dollar signs: $x_2$ for inline math, or by using an equation environment for display math. Inside math mode, the underscore is a command that creates subscripts.
In regular text outside math mode, the underscore is just a character. If you type x_2 in plain text, it prints as x_2 with no subscript effect. To get a subscript in text, you must enter math mode first: type $x_2$ and the subscript appears.
Display math (centered, on its own line) uses the same subscript syntax as inline math. Whether you write $x_2$ in a sentence or use \[x_2\] on its own line, the subscript works the same way. The difference is only in positioning and size.
Subscripts with special characters and expressions
Subscripts can hold more than just letters and numbers. You can place mathematical expressions, Greek letters, or other symbols below a variable. Use braces to group whatever goes in the subscript: x_{\alpha} puts the Greek letter alpha below x. y_{i+j} puts i+j below y.
If your subscript contains a command (like \alpha for α or \beta for β), the braces are required. Type x_{\alpha}, not x_\alpha. Without braces, LaTeX reads only the first character of the command as the subscript.
Fractions, integrals, and other complex expressions can also be subscripts, though they may look cramped. x_{\frac{1}{2}} puts a fraction below x. For readability, keep subscripts straightforward when possible.
Stacking subscripts and superscripts together
You can combine subscripts and superscripts on the same variable. The order does not matter: x_2^3 and x^3_2 both produce x with 2 below and 3 above. LaTeX positions them correctly regardless of which you type first.
If either the subscript or superscript contains multiple characters, use braces: x_{12}^{34} puts 12 below and 34 above. You can also nest them: x_{y_2} creates a subscript within a subscript, though this quickly becomes hard to read.
When both subscript and superscript are single characters, you can omit the braces: x_2^3 works fine. For anything longer or more complex, braces prevent LaTeX from misinterpreting where one subscript ends and the next begins.
Common mistakes and how to fix them
The most frequent error is forgetting braces for multi-character subscripts. If you type x_ab expecting both a and b below x, only a appears as subscript and b prints at normal height. Add braces: x_{ab}.
Another mistake is using subscripts outside math mode. If you type x_2 in regular text without dollar signs, nothing happens—the underscore prints as a character. Always wrap subscript content in $...$ or use an equation environment.
Forgetting to escape special characters inside subscripts can also cause problems. If your subscript contains a backslash or other LaTeX command, make sure it is formatted correctly. For example, x_{\text{max}} uses the \text command to write "max" in regular font inside the subscript.
Subscripts in different document environments
Subscripts behave the same way in article, report, book, and other standard LaTeX document classes. The underscore command works identically across all of them. What changes is the overall font size and spacing of your document, which can make subscripts appear larger or smaller relative to the text.
In presentation software like Beamer, subscripts follow the same rules. Type $x_2$ in a slide and it renders as expected. Font sizes in presentations are often larger, so subscripts remain readable even when they are smaller than the main text.
When you include subscripts in tables, figures, or captions, the same syntax applies. Whether the subscript appears in a caption, a table cell, or a figure label, you must still be in math mode for the underscore to work as a subscript command.
Frequently Asked Questions
What is the difference between an underscore and a subscript in LaTeX?
An underscore is the character you type. A subscript is what LaTeX creates when it sees an underscore inside math mode. Outside math mode, the underscore prints as a regular character. Inside math mode, it tells LaTeX to shift the next character or group of characters below the baseline.
Do I need braces around a single number subscript?
No. Single characters do not require braces: x_1 works fine. Braces are only necessary when the subscript contains more than one character, a command, or an expression. Using braces when they are not needed does not hurt, so x_{1} is also correct.
Can I put a subscript on a subscript?
Yes. Type x_{y_2} to create a subscript within a subscript. The inner subscript (y_2) becomes the subscript of x. This is technically possible but often looks cramped and confusing, so use it sparingly.
What happens if I forget the dollar signs around a subscript?
LaTeX treats the underscore as a regular character instead of a subscript command. The underscore prints in your output, and the character after it appears at normal height. Always wrap subscripts in $...$ or place them inside an equation environment.
Can subscripts contain spaces or punctuation?
Spaces inside subscripts are ignored by LaTeX. Punctuation like commas or periods can appear in subscripts, but they are treated as mathematical symbols rather than text. If you want readable text in a subscript, use the \text{} command: x_{\text{max value}}.