8

In plain TeX, \cos is defined as \mathop {\rm cos}\nolimits but \gcd as \mathop {\rm gcd}.

In what case to use \nolimits when defining a math operator to be typeset in roman?

3 Answers 3

2

I'm afraid this is not a TeX question, but a math one. Anyway, this is the list in plain.tex:

\def\log{\mathop{\rm log}\nolimits}
\def\lg{\mathop{\rm lg}\nolimits}
\def\ln{\mathop{\rm ln}\nolimits}
\def\lim{\mathop{\rm lim}}
\def\limsup{\mathop{\rm lim\,sup}}
\def\liminf{\mathop{\rm lim\,inf}}
\def\sin{\mathop{\rm sin}\nolimits}
\def\arcsin{\mathop{\rm arcsin}\nolimits}
\def\sinh{\mathop{\rm sinh}\nolimits}
\def\cos{\mathop{\rm cos}\nolimits}
\def\arccos{\mathop{\rm arccos}\nolimits}
\def\cosh{\mathop{\rm cosh}\nolimits}
\def\tan{\mathop{\rm tan}\nolimits}
\def\arctan{\mathop{\rm arctan}\nolimits}
\def\tanh{\mathop{\rm tanh}\nolimits}
\def\cot{\mathop{\rm cot}\nolimits}
\def\coth{\mathop{\rm coth}\nolimits}
\def\sec{\mathop{\rm sec}\nolimits}
\def\csc{\mathop{\rm csc}\nolimits}
\def\max{\mathop{\rm max}}
\def\min{\mathop{\rm min}}
\def\sup{\mathop{\rm sup}}
\def\inf{\mathop{\rm inf}}
\def\arg{\mathop{\rm arg}\nolimits}
\def\ker{\mathop{\rm ker}\nolimits}
\def\dim{\mathop{\rm dim}\nolimits}
\def\hom{\mathop{\rm hom}\nolimits}
\def\det{\mathop{\rm det}}
\def\exp{\mathop{\rm exp}\nolimits}
\def\Pr{\mathop{\rm Pr}}
\def\gcd{\mathop{\rm gcd}}
\def\deg{\mathop{\rm deg}\nolimits}

and you can see that \nolimits is for symbols of function taking a fixed number of arguments (mostly one, but \hom takes two), whereas \limits is for functions with any number of arguments (or whose standard argument is a set).

Exception: the limit related symbols (which originated the others not taking \nolimits).

11

Trig functions are often used with superscripts

enter image description here

You can see why \nolimits are needed as you don't want limits


$$ \mathop{\rm cos}^2  + \mathop{\rm cos}^2  = 1$$

$$ \mathop{\rm cos}\nolimits^2  + \mathop{\rm cos}\nolimits^2  = 1$$

\bye
6
  • 13
    er I think one of those cos ought to be sin :-) Oct 27, 2021 at 22:51
  • If you fixed it, you could also add $$\max_{x \in I} f(x)$$. Oct 28, 2021 at 19:31
  • Will \operatorname save us having to introduce \nolimits?
    – hesham
    Oct 30, 2021 at 11:44
  • @hesham I don't understand the question, you almost never need \nolimits in a document \cos is defined to use \nolimits, \operatorname is just an amsmath macro that defines commands using \mathop and optionally with \nolimits so it is the same as shown here. Oct 30, 2021 at 11:49
  • 1
    @hesham you wouldn't normally use \operatorname either, normally you would declare a command like \cos using \DeclareMathOperator but in either case you have the same choice \operatorname* or \operatorname with the star form controlling whether \nolimits is used. Oct 30, 2021 at 12:03
6

Use \nolimits when you do not want superscripts and subscripts to appear above and below the operator in display mode, the way they do for \lim, \sum or \int. An example is \cos^2 t, which should display as cos² t, and not with a 2 above the letter o.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy