Math functions such as
,
, and
are
traditionally typeset in roman type to make them visually more distinct
from one-letter math variables, which are set in math italic. The more
common ones have predefined names, log, sin, lim, and so
forth, but new ones come up all the time in mathematical papers, so the
amsopn package provides a general mechanism for defining new
`operator names'. As the amsopn package is loaded internally by
the amsmath package, the following features are available there
also. To define a math function xxx to work like sin, you
write
\DeclareMathOperator{\xxx}{xxx}
whereupon ensuing uses of xxx will produce xxx in the
proper font and automatically add proper spacing on either side when necessary, so that you
get
instead of
. In the second argument of
DeclareMathOperator (the name text), a pseudo-text mode prevails:
the hyphen character will print as a text hyphen rather than a
minus sign and an asterisk will print as a raised text asterisk
instead of a centered math star. (Compare
a-b*c and
.) But otherwise the name
text is printed in math mode, so that you can use, e.g., subscripts and
superscripts there.
If the new operator should have subscripts and superscripts placed in
`limits' position above and below as with
,
, or
, use
the form of the DeclareMathOperator command:
\DeclareMathOperator*{\Lim}{Lim}
A few special operator names are predefined by the amsopn package: varinjlim, varprojlim, varliminf, and varlimsup:
