LaTeX error "Missing { inserted": cause and fix
TeX expected an opening brace { and found something else. In formulas this happens after ^ or _ when the exponent or index is a command such as \sqrt{x} without braces around it.
Why it happens
- An exponent or index begins with a command and has no braces around it:
e^\sqrt{x},x_\hat{a},T_\max. - With
amsmathloaded, the same holds for\dfrac,\binom,\boldsymboland\operatornamedirectly after^or_. \leftfollows^or_directly:x^\left(a+b\right).- A cell of a
tabularcontains one}too many. TeX reports this error where the cell ends: at the next&or, for the last cell of a row, at the start of the next row. With thearraypackage loaded, the message isExtra }, or forgotten \endgroupinstead.
How to fix it
- Put the whole exponent or index in braces:
e^{\sqrt{x}},x_{\hat{a}},T_{\max}. - Write the braces after
^and_every time. Without them TeX takes only the next character or symbol, as inx^2orx^\alpha. - If the line the log names is a table row, look for a surplus
}in the cell before the marked place. That can be the last cell of the row above.
A document that produces the message
\documentclass{article}
\begin{document}
The function $e^\sqrt{x}$ is positive.
\end{document}The corrected document
\documentclass{article}
\begin{document}
The function $e^{\sqrt{x}}$ is positive.
\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 Missing } inserted
- Error Double superscript
- How-to Exponents and subscripts in LaTeX
- How-to Square root and nth root in LaTeX