2

I would like to mimic the spacing behavior of DeclareMathOperator without using a macro. I would like there to be a space after Spec when I write (in math mode)

\mathrm{Spec} k.

But I would like there to be no space after Spec when I write

\mathrm{Spec} (k).

Is there a way to do this? Sort of like \xspace but not in a macro.

1 Answers1

9

With amsmath package loaded

\[ \operatorname{Spec} k - \operatorname{Spec} (k) \]

or without amsmath

\[ \mathop{\mathrm{Spec}} k - \mathop{\mathrm{Spec}} (k) \]

If you ever want superscripts or subscripts with the primitive \mathop, you should add \nolimits

\[ \mathop{\mathrm{Spec}}\nolimits^2 k - \mathop{\mathrm{Spec}} (k^2) \]