This question already has an answer here:

I have a question about \text{}.

For convenience, I define many new commands, for example \def\im{\text{Im}}, \def\coker{\text{coker}}, etc.. I expect my new commands work like \ker, and really work that way in usual situation. But, in italic font enviroments(thm, prop, etc..), \im and \coker typed in italic font. I want they type in normal font like \ker.

Is there any way to solve this problem.

marked as duplicate by Loop Space, egreg fonts Sep 5 '16 at 9:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Since ker is an operator, \coker should be defined using \DeclareMathOperator{\coker}{coker}, in my point of view. This will use upright letters – user31729 Sep 5 '16 at 9:24
  • Never ever use \text for this, try using it in an italic context, and you'll see why it is so wrong. Use the solutions either linked to or provided by others. – daleif Sep 5 '16 at 10:01

Use this in your preamble (I suppose you already load amsmath or mathtools):




if you write in French (and possibly some other languages).


You should consider using amsmath's


in the first place, which handles this for you.

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