LaTeX error "Limit controls must follow a math operator": cause and fix
\limits and \nolimits set where the limits of an operator such as \sum or \int are placed. They only work directly behind such an operator. TeX found one behind something else and ignores it.
Why it happens
\limitsfollows text that only looks like an operator:\mathrm{argmax}\limits_{x}.\limitsfollows a letter or a plain symbol:X\limits_i.- Something stands between the operator and
\limits, or the operator is wrapped in braces:{\sum}\limits_i.
How to fix it
- Turn the text into an operator with
\mathop:\mathop{\mathrm{argmax}}\limits_{x}. - With
amsmath, write\operatorname*{argmax}_{x}, or define the operator once in the preamble:\DeclareMathOperator*{\argmax}{arg\,max}. - To place something below or above a symbol that is no operator, use
\underset{x}{...}or\overset{x}{...}fromamsmath. - Put
\limitsdirectly behind the operator:\sum\limits_{i}.
A document that produces the message
\documentclass{article}
\begin{document}
\[ \hat{x} = \mathrm{argmax}\limits_{x} f(x) \]
\end{document}The corrected document
\documentclass{article}
\begin{document}
\[ \hat{x} = \mathop{\mathrm{argmax}}\limits_{x} f(x) \]
\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
- How-to Define a math operator in LaTeX
- How-to Sums and products in LaTeX
- How-to Limits in LaTeX
- Package
amsmath