[Tex/LaTex] “undefined control sequence” error with curly brackets


I'm writing a math equation inside which I have to express curly brackets. What I intend to write should look like {h_n}^infinity_0

My code is:

    The problem asks for estimates of the sizes of the coefficients $\{h_{n}\}\limit_{0}^{\infty}$.

While the preview shows this as exactly what I want, when I try compiling it I get an error message that calls it an "undefined control sequence".

I don't understand why: could anyone help explain this?

Best Answer

I wouldn't use \limits in this case since it'll end up placing the lower and upper limits of the sequence below and above the right-hand curly brace -- probably not what you intended.

If you write \{h_{n}\}_{0}^{\infty}$ (see the middle example below, labelled "not awful"), the upper and lower limits may look like they're too close to each other, especially in text-style math mode. One way to fix this is to encase the closing curly brace, \}, in a pair of braces to change its status from "math-close" to "math-ordinary"; doing so will loosen the spacing quite a bit.

It may be best, though, to define a custom macro called, say, \seqwlimits to standardize the task at hand and to assure adequate vertical separation of the upper and lower limits.

enter image description here

huh??    & ${\{h_{n}\}}\limits_{0}^{\infty}$\\[2ex]
awful    & $\{h_{n}\}\limits_{0}^{\infty}$\\[2ex]
not awful& $\{h_{n}\}_{0}^{\infty}$\\[2ex]
better   & $\{h_{n}{\}}_{0}^{\infty}$\\[2ex]  % note the extra { and }
best     & $\seqwlimits{h_n}{0}{\infty}$\\