Introduce \newoperator
\newoperator mimics amsamth's \DeclareMathOperator; that is, it defines a macro for an operator name which is consistent with the standard operators like \max, \lim, and \lim w.r.t. appearance and behavior. The star variant \newoperator* permits the operator to take limits like \max and \lim (e.g. \lim_{x\rightarrow\infty}) instead of a subscript.
This commit is contained in:
parent
fb9d553134
commit
281626481c
|
@ -671,7 +671,46 @@
|
||||||
\@NNAddEntry{#3}{\string#3}{#4}{#7}{#8}%
|
\@NNAddEntry{#3}{\string#3}{#4}{#7}{#8}%
|
||||||
}
|
}
|
||||||
|
|
||||||
|
% *************************************
|
||||||
|
% \newoperator
|
||||||
|
% *************************************
|
||||||
|
% Define macro for an operator name and add entry to current group.
|
||||||
|
%
|
||||||
|
% Arguments:
|
||||||
|
% 1. star: use limits (like \max or \lim)
|
||||||
|
% 2. optional: class name
|
||||||
|
% 3. mandatory: macro name
|
||||||
|
% 4. optional: IGNORED
|
||||||
|
% 5. optional: IGNORED
|
||||||
|
% 6. mandatory: replacement
|
||||||
|
% 7. optional: description for table of notation
|
||||||
|
% 8. optional: description of arguments for table of notation
|
||||||
|
\DeclareDocumentCommand{\newoperator}{s o m O{0} o m O{} O{}}{%
|
||||||
|
% Check whether macro is already defined:
|
||||||
|
\ifdef{#3}%
|
||||||
|
{\PackageError{newnotation}{newoperator: Command '\string#3' already defined.}{Misspelled name?}}{}%
|
||||||
|
%
|
||||||
|
\@NNPrepareEntry{\string#3}%
|
||||||
|
\newrobustcmd{#3}[#4]{%
|
||||||
|
\IfNoValueTF{#2}%
|
||||||
|
% CLASS: no --------------------------------------------
|
||||||
|
%{no class defined}{class defined}
|
||||||
|
{\IfBooleanTF{#1}%
|
||||||
|
% STAR: yes
|
||||||
|
{\ensuremath{\operatorname*{#6}}}%
|
||||||
|
% STAR: no
|
||||||
|
{\ensuremath{\operatorname{{#6}}}}}%
|
||||||
|
% CLASS: yes -------------------------------------------
|
||||||
|
{\IfBooleanTF{#1}%
|
||||||
|
% STAR: yes
|
||||||
|
{\ensuremath{\operatorname*{\@nameuse{@NNClass#2}{#6}}}}%
|
||||||
|
% STAR: no
|
||||||
|
{\ensuremath{\operatorname{\@nameuse{@NNClass#2}{#6}}}}}%
|
||||||
|
\ifthenelse{\boolean{@NNInListMode}}{}{\protect\stepcounter{@NNCounter\string#3}}%
|
||||||
|
\xspace%
|
||||||
|
}%
|
||||||
|
\@NNAddEntry{#3}{\string#3}{0}{#7}{#8}%
|
||||||
|
}
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
\makeatother %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
\makeatother %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
Loading…
Reference in New Issue