LaTeX error "Double superscript": cause and fix
A base has two exponents in a row, as in x^2^3. TeX cannot tell whether you mean an exponent on the exponent or a power of the whole term, so the grouping has to come from braces.
Why it happens
- Two
^follow each other on the same base:x^2^3. - A prime stands behind an exponent:
x^2'. The prime is a superscript itself. - A command of your own already ends with an exponent, and another
^follows it:\sq^3with\newcommand{\sq}{x^2}.
How to fix it
- For an exponent on the exponent, write
x^{2^3}. - For a power of the whole term, group the base:
{x^2}^3or(x^2)^3. - Put the prime first:
x'^2.
A document that produces the message
\documentclass{article}
\begin{document}
The result is $y = x^2^3$.
\end{document}The corrected document
\documentclass{article}
\begin{document}
The result is $y = x^{2^3}$.
\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.