INDICES & POWERS

LaTeX subscripts and superscripts: group indices correctly

Examples checked with MathTexLab’s base and AMS math renderer · Display style

Use an underscore for a subscript and a caret for a superscript. Braces decide how many characters belong to that script; they are grouping instructions, not visible brackets.

Group more than one character

In x^2, the next character is the exponent. Write x^{12} for twelve: x^12 puts only the first digit in the exponent. The same rule applies to a_{ij} and a_i j. Add braces before adjusting the visual size.

Combine an index and a power

An item can have one lower and one upper script. The example uses a matrix-style index and a power on the same base. Inside the final sum, the braces keep the entire upper limit together.

LaTeX subscripts and superscripts: group indices correctly example
a_{ij}^{2}+\sum_{k=1}^{n+1}k^2
Open example in editor

Repair a double script

Do not write x^2^3 when you mean a power of a power. Use (x^2)^3 for a grouped base, or x^{2^3} for a nested exponent. These expressions have different meanings. A successful preview cannot decide which one you intended.

Check the result in context

Type only the mathematical expression into the editor, without document commands or dollar delimiters. Try Inline and Display math styles, then choose the overall font size. If a script looks crowded, change the notation or grouping before increasing the font size. Export only after the live preview shows the intended base and scripts.

Syntax reference

MathJax supported-command reference. The examples above are limited to the features described here; additional packages are not implied.