Use the underscore character to create subscript in LaTeX

In LaTeX, you create subscript by placing an underscore (_) before the character or group of characters you want to make smaller and lower. The subscript appears in math mode, which is the environment where LaTeX handles mathematical notation. For a single character, type the underscore directly: 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 only works inside math mode. If you try to use it in regular text, LaTeX will either produce an error or display the underscore literally. Math mode in LaTeX has two main forms: inline math (for notation within a sentence) and display math (for equations on their own line). Subscript works the same way in both, but the placement and size differ slightly.

Key Takeaways

  • Use an underscore followed by the subscript content to create subscript in LaTeX math mode.
  • Wrap subscript content in curly braces if it contains more than one character or any operators.
  • Inline math mode uses single dollar signs ($...$) and keeps subscript small within the text line.
  • Display math mode uses double dollar signs ($$...$$) or equation environments and makes subscript larger and easier to read.
  • Superscript uses the caret (^) character with the same syntax as subscript.

Inline subscript within sentences

Inline math mode embeds mathematical notation directly into your paragraph text. You mark the start and end of inline math with single dollar signs. Inside those dollar signs, use the underscore for subscript. For example, typing The formula is $H_2O$ for water produces the text with a properly formatted H₂O in the middle of the sentence.

When you use inline math mode, LaTeX automatically shrinks subscript characters to fit within the line height. This keeps your paragraph spacing consistent. If your subscript contains more than one character—like a variable name or an expression—always use curly braces. Type $x_{max}$ rather than $x_max$. Without the braces, only the m becomes subscript, leaving ax as regular size.

Display math for equations on their own line

Display math mode centers equations on their own line and gives subscript more visual prominence. Use double dollar signs to mark display math: $$E = mc^2$$. You can also use the equation environment, which automatically numbers the equation: \begin{equation} E = mc^2 \end{equation}. Inside display math, subscript syntax remains identical—underscore for single characters, underscore with curly braces for multiple characters.

Display math is clearer for complex equations with multiple subscripts and superscripts. For instance, $$a_{i,j} = b_{i,j} + c_{i,j}$$ shows matrix notation where each variable has two subscripts separated by a comma. The larger size makes the subscripts easier to read in printed or PDF output.

Subscript with multiple characters and expressions

Whenever your subscript is anything other than a single letter or digit, use curly braces to group it. This tells LaTeX to treat the entire group as one subscript unit. Without braces, LaTeX only subscripts the first character. Typing $x_12$ produces x₁2 (only the 1 is subscript), but $x_{12}$ produces x₁₂ (both digits subscript).

Subscripts can contain operators and variables. Type $a_{n+1}$ for a subscript that includes addition, or $T_{max}$ for a subscript that is a word. You can even nest subscripts within subscripts, though this becomes hard to read: $x_{a_{b}}$ produces x with a subscript of a, which itself has a subscript of b. For readability in your source code, add spaces inside the braces—$x_{ n + 1 }$ works identically to $x_{n+1}$ but is easier to scan.

Combining subscript and superscript

Use the caret (^) character for superscript, with the same syntax as subscript. You can place both on the same base variable. Type $x^2_i$ or $x_i^2$—LaTeX positions them correctly regardless of order. If either the superscript or subscript has multiple characters, wrap it in braces: $x^{n+1}_{i,j}$ produces x with superscript n+1 and subscript i,j.

When you have both subscript and superscript, the order in your source code does not matter. LaTeX automatically places superscript above and subscript below the base character. For readability, many writers put subscript first, then superscript, but $a_i^2$ and $a^2_i$ produce identical output.

Common subscript patterns in different fields

Chemistry uses subscript for molecular formulas: $H_2SO_4$ for sulfuric acid, $Ca(OH)_2$ for calcium hydroxide. Physics uses subscript for vector components and indices: $v_x$, $v_y$, $v_z$ for velocity components, or $F_{net}$ for net force. Mathematics uses subscript for sequences and matrix notation: $a_n$ for the nth term of a sequence, $x_{i,j}$ for matrix elements.

Statistics often uses subscript for sample size or group labels: $\bar{x}_1$ and $\bar{x}_2$ for means of two groups. Engineering uses subscript for component labels: $R_1$, $R_2$ for resistors, $V_{in}$ and $V_{out}$ for input and output voltages. The underscore syntax works identically across all these fields—only the content changes.

Troubleshooting subscript problems

If your subscript appears as a regular underscore character in your output, you are likely outside math mode. Check that you have dollar signs around the expression. If you see an error message mentioning "math mode", add dollar signs: change x_2 to $x_2$. If only the first character of a multi-character subscript is subscripted, add curly braces: change $x_max$ to $x_{max}$.

If subscript appears too small or hard to read in inline math, consider using display math instead. Inline math shrinks subscript to fit the line, which is correct behavior but sometimes makes dense notation hard to parse. Moving the equation to its own line with display math often improves clarity. If you are using a LaTeX editor like Overleaf, the preview pane shows you immediately whether subscript is rendering correctly, so you can catch these issues before compiling.

Frequently Asked Questions

Can I use subscript outside of math mode?

Not with the underscore character—it only works in math mode. If you need subscript in regular text (like a footnote marker or a chemical formula in a caption), you must enter math mode with dollar signs. Alternatively, some packages like textcomp provide text-mode subscript commands, but they are rarely needed and produce smaller, less readable output than math-mode subscript.

What is the difference between $x_2$ and x$_2$?

The first is correct: the entire expression x_2 is in math mode, so LaTeX formats both the x and the subscript 2 as mathematical notation. The second puts only the subscript in math mode, leaving the x as regular text. This creates inconsistent formatting and looks wrong. Always include the base variable inside the dollar signs with its subscript.

How do I make subscript even smaller?

LaTeX automatically sizes subscript appropriately for the context. In inline math, it shrinks subscript to fit the line. In display math, it makes subscript larger. You should not manually resize subscript—it breaks mathematical typesetting conventions and makes documents harder to read. If subscript is hard to read, the solution is usually to use display math mode instead of inline.

Can subscript contain special characters like Greek letters?

Yes. Type $x_{\alpha}$ for x with Greek alpha subscript, or $T_{\mu}$ for T with Greek mu subscript. Greek letters in LaTeX use backslash commands like \alpha, \beta, \gamma. These work identically inside subscript as they do in regular math mode—just wrap them in braces if they are part of a multi-character subscript.

Do I need to install anything extra to use subscript?

No. Subscript is built into LaTeX's core math mode and requires no additional packages. If you are using a standard LaTeX distribution like TeX Live or MiKTeX, or an online editor like Overleaf, subscript works immediately. You only need extra packages if you want specialized subscript behavior, which is rare.