# newcommand in math mode error

I am making a presentation and I need to use the following expression quite a lot, so I made the following new command

\newcommand{\extreig}[1][\lambda]{\ensuremath{{#1}_{\mbox{{\footnotesize extr}}}(\omega)}}

So when I use the command $\extreig{\mu}$, I expect to get $\mu_{\mbox{{\footnotesize extr}}}(\omega)$ (why is on the forum not a latex-editor?), the strange thing is that I get $\lambda_{\mbox{{\footnotesize extr}}\mu$.


How is this possible?

• You have specified that \extreig takes an optional argument so should write \extreigh[\mu] with square brackets. – Andrew Swann Jan 15 '18 at 10:52
• rather than _{\mbox{{\footnotesize extr}} it would be better to use _{\mathrm{extr}} and then sizing is automatic, even if the expression appears in a subscript – David Carlisle Jan 15 '18 at 10:53