# \DeclareMathOperator won't take arguments

I'd like to define a family of math operators that have the same superscript, but different subscripts. My first attempt was:

\DeclareMathOperator{\Upd}[1]{U^M_{#1}}


But the log tells me that:

l.3 \DeclareMathOperator{\Upd}[1
]{U^M_{#1}}
! Missing $inserted. <inserted text>$
l.3 \DeclareMathOperator{\Upd}[1]{U^
M_{#1}}
! You can't use macro parameter character #' in math mode.
l.3 \DeclareMathOperator{\Upd}[1]{U^M_{#
1}}
\end{document}


-
It's not a good idea, in my opinion, to add \ensuremath; why should it be? Disclaimer: this is part of my \ensuremath`-only-when-really-needed campaign. :) – egreg Nov 14 '11 at 16:39
You might be right :) – Boris Nov 14 '11 at 16:41