Compare commits

...

1 Commits

Author SHA1 Message Date
Christopher Spinrath 281626481c 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.
2018-06-28 12:25:22 +02:00
1 changed files with 40 additions and 1 deletions

View File

@ -671,7 +671,46 @@
\@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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%