4

Probably asked before but these type of search queries are not very google friendly.

In mathmode, you can type \cos to quickly get the cosine, in normal typeset. Can you do something similar for "if"? Preferably a single command rather than \text{if}.

[edit] Bonus: get some spacing after the if, ie. I am looking for the best way to write "if n = 1" after one case of an equation.

Scipio
  • 283

1 Answers1

6

There's no such command, but you can create one. As you've probably already noticed, $if$ isn't right: the font and spacing represent i times f, not the word if. $\mathrm{if}$ or the like isn't right either; depending on the choice of fonts, this may or may not look similar to \text{if}. \text{if} is the way to go, either directly or via another command.

\newcommand{\ifm}[1]{\text{if $#1$}}

\[ n! = n (n-1)! \quad \ifm{n \ge 1} \]

Don't call the command \if as it's used internally by TeX.