# Missing } inserted, yet braces are balanced

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.)

-

The \mathrm macro sets its input in a roman font, but it is still in (display) math mode. So the $s inside \mathrm are confusing TeX. It's as if you are trying to embed math mode within display math mode. I think what you want instead is $\textstyle \lambda_k := \sum_{\text{I\subseteq\N_n such that |I|=k}}x_I.$ But that won't work either until you tell TeX what you mean by \N. So if you insert into the preamble or someplace else before the first use: \newcommand{\N}{\mathbb{N}} your document will successfully compile. A few comments: • Why are you using \textstyle? In display math some symbols like the \sum operator are bigger. Try it without; you might like TeX's default choices. • Whitespace is your friend. When I type displayed equations I put the $and$ on their own lines and indent the equation in the middle. That way the source somewhat resembles the final document in that displayed math mode is "displayed." • You might find this discussion we had on colon-equals interesting: How to typseset$:=\$ correctly?