# What is the difference between the several definitions of mathematic operators?

I am defining a new math operator, and I found that I can define it using 4 different commands:

• \DeclareMathOperator (package amsmath)
• \operatorname (package amsmath)
• \DeclareMathOperator* (package amsmath)
• \mathop (TeX command)

What is the formatting difference between them?

With the MWE below, we see that the main differences are following:

• The operator's font changes: all commands write an upright operator, but \mathop write it slanted.
• In display mode both \DeclareMathOperator* and \mathop set sub- and superscripts right below and above the operator, while the other operators set them shifted to the right.
• The operator stands right on the baseline for all commands but for\mathop there it sinks below it (both in inline and display mode)

See picture and code below:

\documentclass{article}
\usepackage{amsmath}

%All operators are declared as commands
\DeclareMathOperator{\Ti}{T}
\newcommand{\Tii}{\operatorname{T}}
\DeclareMathOperator*{\Tiii}{T}
\newcommand{\Tiv}{\mathop{T}}

\begin{document}

%DeclareMathOperator
\verb|\DeclareMathOperator|\\
Inline:
$$x \Ti^a_b y$$
\\
Display:
$x \Ti^a_b y$

%Operatorname
\verb|\operatorname|\\
Inline:
$$x \Tii^a_b y$$
\\
Display:
$x \Tii^a_b y$

%DeclareMathOperator*
\verb|\DeclareMathOperator*|\\
Inline:
$$x \Tiii^a_b y$$
\\
Display:
$x \Tiii^a_b y$

%Mathop
\verb|\mathop|\\
Inline:
$$x \Tiv^a_b y$$
\\
Display:
$x \Tiv^a_b y$

\end{document}

• you are just missing use of fonts and \limits in the primitive \mathop but this answer misses the more subtle technical differences such as the different behaviour of single-ketter operators \operatorname is essentially \mathop{\mathrm{ with or without the use of \limits depending on * May 28, 2020 at 10:01
• @DavidCarlisle thanks for your experienced feedback. I think the answer is a first good guideline for beginners-intermediate users. I wrote what it first was evident to me. Please, add another answer with the deepest technical differences for advanced users. :) Of course you may edit my answer, but I think, that would spoil the simplicity and clearness. :-\ May 28, 2020 at 10:04
• note that T is vertically centered with mathop not on the baseline May 28, 2020 at 10:04
• beginners shouldn't be using TeX primitives in latex documents:-) May 28, 2020 at 10:05
• But they surely do! And even find them in the code of others ;-) By the way, I added your information about the baseline, thanks! May 28, 2020 at 10:21