I want to define \ext
to behave exactly like \lim
.
I tried \newcommand{\ext}{{\mathrm{ext}}\,}
but that doesn't behave exactly like \lim
.
If you use amsmath
, which is recommendable for math texts in any way, a similar definition to \lim
is
\def\ext{\qopname\relax m{ext}}
since amsmath
, specifically amsopn.sty
, defines:
\def\lim{\qopname\relax m{lim}}
\operatorname
? I think it is a robust command.
Commented
Mar 16, 2011 at 0:26
\ext
shall behave exactly like \lim
, not a bit different or even better. So I suggested the original definition of \lim
in amsmath.
\operatorname
?
\DeclareMathOperator*\ext{ext}
which will behave exactly like \lim
and has the advantage of not using internal amsmath
macros. (The one difference is that there will be some local assignments that are totally irrelevant inside the \mathop
for this particular example. Cf. \DeclareMathOperator*\good{foo-bar}
\def\bad{\qopname\relax m{foo-bar}}
.)
Use \DeclareMathOperator
or its starred form (if the operator should take limits):
\usepackage{amsmath}
% \DeclareMathOperator{<command>}{<text>}
% if the operator shouldn't take limits
\DeclareMathOperator\ext{ext}
% if the operator should take limits
% \DeclareMathOperator*\ext{ext}
\lim
.
try
\makeatletter
\def\ext{\mathop{\operator@font ext}}
\makeatother
As an alternative to \DeclareMathOperator
, there is also \mathop
to be used with \newcommand
. For example:
\newcommand{\ext}{\mathop{\mathrm{ext}}
\mathop
is a tex primitive, so this definition is a hybrid, non-latexy. if you look into the documentatin for amsopn.sty
(texdoc mathopn
) you will see that \mathop
is used there for the "internal" definitions, but command naming quickly shifts into the latex realm. you will also see that the choice of commands is stated to be governed by the amount of memory they use. remember, amsmath
and its kin were written when memory use still mattered.
Commented
Mar 16, 2011 at 13:25