2

I am trying to define two operators, FM0 and FM4, using the code below \DeclareMathOperator{\FM0}{FM0} \DeclareMathOperator{\FM4}{FM4}

But when I use them as

\FM0(x) = \frac{\PP(x)}{\sum_{i=1}^{N} A(i)} \FM4(x) = \frac{\PP(x)}{\sum_{i=1}^{N} A(i)}

I get this error: "Use of \FM doesn't match its definition"

Is it not allowed to use numbers in the name of math operators? Is there a simple way of defining these operators with numbers in them?

  • only letters are allowed in a multi-character "control sequence" (command name). this is a basic tex requirement. – barbara beeton Apr 13 '18 at 18:56
1

...or you could define \FM as a \mathop that takes an argument.

Without amsmath, here is how:

\documentclass{article}
\newcommand\FM[1]{\mathop{\mathrm{FM#1}}\nolimits}% OR THIS
\newcommand\PP{\mathcal{P}}
\begin{document}
\[
 \FM0(x) = \frac{\PP(x)}{\sum_{i=1}^{N} A(i)}
\]
\[
 \FM4(x) = \frac{\PP(x)}{\sum_{i=1}^{N} A(i)}
\]
\end{document}

and with amsmath, egreg suggests an even better way:

\newcommand\FM[1]{\operatorname{FM#1}}

resulting, in either case, with

enter image description here

With the \nolimits, sub- and superscripts behave in the manner of \DeclareMathOperator, for example, \FM0_i^2(x):

enter image description here

If you remove the \nolimits from the \FM definition (or use the star variant \operator* with the amsmath version), then it behaves like the star version, \DeclareMathOperator*:

enter image description here

  • 1
    Since the OP is clearly loading amsmath, you should too, so you can define \newcommand\FM[1]{\operatorname{FM#1}}, which is much simpler (and much better, for various reasons). Use \operatorname* for limits above and below. – egreg Apr 13 '18 at 20:23
1

use

\DeclareMathOperator{\FMzero}{FM0}
\DeclareMathOperator{\FMiv}{FM4}
  • 1
    You mean \FMzero or similar instead of the two tokens \FM and 0? – Heiko Oberdiek Apr 13 '18 at 19:03
  • ah sure, didn't realize the 0 ... – user2478 Apr 13 '18 at 19:05
  • Yes, this is what I am doing now, but I wished to have the operator name match the operator value. – Kavka Apr 13 '18 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.