LaTeX error "Double subscript": cause and fix
A base has two indices in a row, as in a_i_j. TeX needs braces to know how the indices belong together.
Why it happens
- Two
_follow each other on the same base:a_i_j. - A command of your own already ends with an index, and another
_follows it:\xn_1with\newcommand{\xn}{x_n}.
How to fix it
- For two indices side by side, write
a_{i,j}ora_{ij}. - For an index on the index, write
a_{i_j}. - To attach the second index to the whole term, group the base:
{a_i}_j.
A document that produces the message
\documentclass{article}
\begin{document}
The entry $a_i_j$ is zero.
\end{document}The corrected document
\documentclass{article}
\begin{document}
The entry $a_{i,j}$ is zero.
\end{document}Both documents were compiled with pdfLaTeX from TeX Live 2023. The first produces the message, the second compiles without an error.
Finding the line in the editor
The editor lists every error and warning of a compile run with file and line. Select an entry and the cursor jumps to that line. See Error list with jump to the line.
Related pages
- Error Double superscript
- Error Missing { inserted
- How-to Exponents and subscripts in LaTeX
- How-to Matrices in LaTeX