# Why the placement of \title makes a difference when using amsart with nag?

% !TeX program = pdfLaTeX
\RequirePackage[l2tabu,orthodox]{nag}
\documentclass{amsart}
\begin{document}
\title{The $n$-th term}
\maketitle
\end{document}


If the \title command is placed after \begin{document}, as shown above, then the math mode n is capitalized. It is not capitalized if either \title is placed before \begin{document} or we do not use the amsart document class or the l2tabu option of the nag package. Why is that, and where should I put the \title by best practice?

amsart uses the macro \uppercasenonmath to prevent uppercasing of math characters. This could change the meaning of a variable, for example n could mean a number but N may be the name for a set.
The nag package makes the \$ sign an active character and uses it for syntax checks. In that case \uppercasenonmath simply doesn't work any more, so math letters within capitalized text can get capitalized too.
A good practice is to put the title after \begin{document}, so for example babel shortcuts would work within the title. Though such a package clash may require a workaround.