# How to define an anonymous math operator? [duplicate]

I use DeclareMathOperator all the time, but it has a side effect and creates a new definition that pollutes my namespace.

So I have a definition like this \DeclareMathOperator{\case}{case}, and then when I want to use case, I type \case.

I'd like to be able to define a function like op (e.g. \op{case}) and have that behave just like an operator created using DeclareMathOperator. For the most part, I currently use \text{...} if I'm only using something once or twice, which has the drawback that I have to explicit handle spaces myself.

Is it possible to define something like \op?

## marked as duplicate by egreg, Community♦Jun 28 '17 at 22:21

• \operatorname{case} – egreg Jun 28 '17 at 22:18
• You have \operatorname{case}, but you shouldn't use operators only to have text in roman. You have \text or \mathrm for that. – Bernard Jun 28 '17 at 22:19