# When to use Roman and Italic Font in Math

I am wondering when to use roman or italic font in math mode. I found that variables should be italicized and functions like max should be put in roman.

I found some sites on the topic, e.g. this or this, but I still have some uncertainties. Somewhere else I found that concrete entities should be put in roman font.

• I am not sure what a concrete entity is.
• In the following example: should letter or startmarker etc. appear in roman font?
• The subscript free is not a variable, but descriptional text. Thus, it should be romanized?

Edit 1: The formulas startmarker, letter, only etc. are abbreviations for formulas in some logic such as First Order Logic.

• Using words as variables is SOP in programming, but not math. Using words in subscripts is okay. Jun 9, 2015 at 13:51
• Put every text in \text{}, every variable is italicized by default, and each constant (concrete entity) like e or pi can be set \mathrm{e}. No rule for that but personally I strongly recommend that. Just try to distinguish between text and math. Right now, your are writing "f times r times e times e" in your subscript. Most people set functions and operators upright as well: \sin\max\mathrm{d}x... (Off topic: you forgot the spaces after your \equiv) Jun 9, 2015 at 13:51
• Please tell us what the meaning of "only", "letter", "startmarker", and "endmarker" is: are they names of variables, operators (like "sin" and "log"), constants (like the base of the natural logarithms), or something else?
– Mico
Jun 9, 2015 at 13:53
• never use the default math italic for multi-letter words so never $only$ if you need italic words in math use $\mathit{only}$ Jun 9, 2015 at 14:27
• @JohnKormylo: I prefer to have speaking names, as I use many more such formulas. @David Carlisle: I put all words in formulas in \mathit. @LaRiFaRi: Thanks for the remark Jun 9, 2015 at 14:55

This is going to be opinion-based, so I'll first suggest a strategy for typing your document.

\usepackage{amsmath}

\newcommand{\func}[1]{\operatorname{\mathit{#1}}}  % or \mathrm
\newcommand{\const}[1]{\mathit{#1}}                % or \mathrm
\newcommand{\wsub}[1]{\mathrm{#1}}                 % 'word' subscript


Then you can type

$\func{letter}(\sigma,c)\equiv\func{startmarker}(c)$
$\func{only}_{\wsub{free}}(\{c_{0}\})$


Of course you can add shorthands for the functions you use most often

\newcommand{\letter}{\func{letter}}
\newcommand{\startmarker}{\func{startmarker}}
\newcommand{\only}[1][]{%
\func{only}%
\if\relax\detokenize{#1}\relax _{\wsub{#1}}\fi
}


and the above formulas would be

$\letter(\sigma,c)\equiv\startmarker(c)$
$\only[free](\{c_{0}\})$


The definition of \only with an optional textual subscript can be simpler if xparse is used:

\usepackage{xparse}
\NewDocumentCommand{\only}{o}{%
\func{only}%
\IfValueT{#1}{_{\wsub{#1}}}%
}


Or you can opt for an even simpler \newcommand{\only}{\func{only}} and type

$\only_{\wsub{free}}(\{c_{0}\})$


Now my opinions. A function such as startmarker is not a “standard” function like max, log or sin. Those function names should always be typeset upright in order to emphasize their “fixed” meaning. The function you define in your document are not of universal use, so you can choose between upright or italic. Just be consistent and that's the purpose of the definitions I propose.

If you later decide that functions such as startmarker should be typeset upright, just remove \mathit from the definition of \func (or replace it by \mathrm, but since we are already under \operatorname this is not needed).

For constants it's a similar problem. I never typeset constants upright (that's something I leave to physicists), but I understand others can have different ideas.

Surely you won't place two multiletter constants next to each other without an explicit multiplication sign: so

\const{foo}\cdot\const{bar}


and not \const{foo}\const{bar}.

• Thanks for the example with xparse Jun 10, 2015 at 10:11