Regard the following document:
\documentclass[a4paper,reqno]{amsart}
\usepackage{amssymb,amsmath,amsthm,fullpage}
\begin{document}
For each $k$ we denote by $\lambda_k$ the $k$th symmetric polynomial
in the $x_i$s; that is, we define
\[\textstyle\lambda_k := \sum_\mathrm{$I\subseteq\mathbb{N}_n$ such that $|I|=k$}x_I.\]
\end{document}
When I try to compile it, I get:
! Missing } inserted.
<inserted text>
}
l.9 ...\mathrm{$I\subseteq\mathbb{N}_n$ such that $|I|=k$}
x_I.\]
Why? The braces are surely balanced.
(Surrounding the call to \mathrm in a set of braces makes no difference.)