Define additional math operators to be typeset in roman

\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


Alternatively, if you are using any of the packages from the AMS (amsart.cls or amsmath.sty) then there is a command \DeclareMathOperator which does what it says on the tin! For example,

\DeclareMathOperator{\Det}{Det}

I think that it can handle variants, but I don't recall off the top of my head.


As mentioned before, the amsmath command \DeclareMathOperator{\Det}{Det} is a good way to do this, but this is actually basically a wrapper for \newcommand{\Det}{\operatorname{Det}}. So if you only want to use the command once and don't want to define a symbol (especially useful if you are using an online tex editor), then just use \operatorname

And just like \DeclareMathOperator*, you can use \operatorname* to specify that underbraces should go underneath. This is useful for something like \operatorname*{minimize}. More info here