6. Text in math formulas | LaTeX manual

6.1. The \text command

To put normal text inside mathematics, it’s better to use \text command rather than commands like \mathrm. The \text command ensures that the text is set using the correct font size. The font will be the text font in use outside the current math material.

1\usepackage{amsmath}
2% -------------------------------------------------------------------------------
3\begin{gather}
4\text{Also, if } \Delta_{\text{max up}} = \Delta_{\text{min down}} \notag \\
5\text{(for all ups and downs) then} \notag \\
6\Delta_{\text{sum of ups}} = \Delta_{\text{sum of downs}}
7\end{gather}

Text inside mathematics

6.2. Operator names

The names of common math functions (e.g., sin and log) and operators (e.g., min and sup) are typically preferred to be distinguished from variable names that are set in italics. So, they are traditionally set as text in Roman type. There are predefined commands in standard LaTeX for the most common functions and operators. The amsmath package sufficiently extends the set of such commands. The following table lists both the “standard” commands and the commands provided by amsmath. The latter are highlighted in bold. Those set in italics may have a subscript/superscript in the limit position when used in displayed formulas.

“Arccos”\arccos“Arcsin”\arcsin“Arctan”\arctan
“Arg”\arg“Cos”\cos“Cosh”\cosh
“Cot”\cot“Coth”\coth“Csc”\csc
“Deg”\deg“Det”\det“Dim”\dim
“Exp”\exp“Gcd”\gcd“Hom”\hom
“Inf”\inf“Injlim”\injlim“Ker”\ker
“Lg”\lg“Lim”\lim“Liminf”\liminf
“Limsup”\limsup“Ln”\ln“Log”\log
“Max”\max“Min”\min“Pr”\Pr
“Projlim”\projlim“Sec”\sec“Sin”\sin
“Sinh”\sinh“Sup”\sup“Tan”\tan
“Tanh”\tanh“Varinjlim”\varinjlim“Varliminf”\varliminf
“Varlimsup”\varlimsup“Varprojlim”\varprojlim
 1\usepackage[fleqn]{amsmath}
 2\newcommand\abs[1]{\lvert#1\rvert}
 3\setlength\mathindent{0pt}
 4% -------------------------------------------------------------------------------
 5\begin{gather*}
 6\lim_{x \rightarrow 0} \frac{ \sin^2(x) }{ x^2 } = 1 \\
 7\varliminf_{n \rightarrow \infty}
 8\abs{a_{n+1}} / \abs{a_n} = 0 \\
 9\varinjlim (m_i^\lambda \cdot M)^* \le
10\varprojlim_{A/p \rightarrow \lambda(A)}A_p \le 0
11\end{gather*}

Functions and operators

It often turns out that this list is not enough. The amsmath package defines a general method to define new “operator names”.

1\DeclareMathOperator*{cmd}{text}

The \DeclareMathOperator command defines cmd to produce text in the appropriate font for “textual operators”. If the new operator is expected to have subscripts/superscripts in the limit position (when used in displays), then the starred form \DeclareMathOperator* should be used. In addition to using the proper font, \DeclareMathOperator sets up good spacing on either side of the operator name. The text argument is processed using a “pseudo-text mode” in which

The following example shows how to provide the command \meas for the new function name “meas” (measure) and the operator functions \esssup and \supminus (both may have subscripts/superscripts in the limit position).

 1\usepackage[fleqn]{amsmath}
 2\DeclareMathOperator \meas {meas}
 3\DeclareMathOperator*\esssup {ess \, sup}
 4\DeclareMathOperator*\supminus{sup - minus*}
 5\newcommand\abs [1]{\lvert#1\rvert}
 6\newcommand\norm[1]{\lVert#1\rVert}
 7% -------------------------------------------------------------------------------
 8\begin{gather*}
 9  \norm{f}_\infty = \esssup_{x \in R^n} \abs{f(x)} \\
10  \meas_1 \{ u \in R_+^1 \colon f^*(u)>\alpha \} \\
11  \quad \esssup_{x \in R^i} \; \meas_i
12  \{ u \in R^n \colon \abs{f(u)} \geq \alpha \} \\
13  \quad (\forall \alpha \in \supminus_{f^*} R_{*+})
14\end{gather*}

New function names and operator names

Such declarations must appear in the preamble, and it’s impossible to change them temporarily. Strictly speaking, \DeclareMathOperator can be used only for command names that haven’t previously been used. To replace an existing command, you must first remove the previous definition before redeclaring it.

 1\usepackage{amsmath}
 2%% Low-level TeX needed here to cancel the old the definition of \csc:
 3\let \csc \relax
 4\DeclareMathOperator\csc{cosec}
 5\newcommand\calQ{\mathcal{Q}}
 6% -------------------------------------------------------------------------------
 7\[
 8\varlimsup_{n\to\infty} \calQ (u_n, u_n - u^{\#})
 9  \ge \csc (\calQ' (u^{\#}))
10\]

Redefining a function name

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.