# Text in equations in the statement of a theorem

I have defined the new command ord by

\newcommand{\ord}[2]{\text{ord}_{#1}(#2)}


This works well normally, giving me ord_p(a) for \ord{p}{a}, which is what I want. However, when I am in theorem mode, the ord becomes italicized, as the text within a theorem is italicized. Is there some way that I can modify my definition of \ord so that it doesn't italicize ord when in theorem mode?

• I suppose this command is used in an equation? You should have simply defined a new math operator with \DeclareMathOperator{\ord}{ord} and type in your equation \ord_p(a) for a better spacing (and upshape, of course). – Bernard Jun 28 '17 at 0:10
• @Bernard has already given what, in all probability, is the correct answer for your case. More generally, for abbreviations and words that are not operator names, but rather annotations, you can use \mathrm (for example, $x_{\mathrm{max}}-x_{\mathrm{min}}$); for words that are “logically” text, yet should not change shape depending on the surrounding context, or for short sentences with the same requirement, you can use \textup (for example, $\frac{x^{m}+\textup{lower order terms}} {x^{n}+\textup{lower order terms}}$; note that, here, \mathrm would ignore the spaces). – GuM Jun 28 '17 at 0:53