Math Mode – Define Additional Math Operators to be Typeset in Roman

math-modemath-operators

Mathematical operators, such as function names, should be set in roman type, not italics. Latex already has commands for some operators, including \max, \min, and \log. How can I define additional such commands?

Best Answer

\DeclareMathOperator{\foo}{foo} and \DeclareMathOperator*{\hocolim}{hocolim} for sub- and superscripts in the limits position.

This requires

\usepackage{amsmath}

which is recommended for math documents anyway.

Minimal example:

\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator{\foo}{foo}
\DeclareMathOperator*{\hocolim}{hocolim}

\begin{document}

Example of $\foo(x)$ and $\foo x$.

Example of $\hocolim_{x\in X} f(x)$ and displayed
\begin{equation*}
\hocolim_{x\in X} f(x)
\end{equation*}

\end{document}

enter image description here

Related Question