mdwmath.dtx: Add `\defop' for defining new operators, and use it.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 24 Jul 2022 16:42:23 +0000 (17:42 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 24 Jul 2022 16:42:23 +0000 (17:42 +0100)
mdwmath.dtx

index 869302e..dbd707a 100644 (file)
@@ -30,7 +30,7 @@
 %<+oldeqnarray>                [2020/09/06 1.14.0 Old enhanced eqnarray]
 % \end{meta-comment}
 %
-% \CheckSum{740}
+% \CheckSum{728}
 %% \CharacterTable
 %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
 %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
 % $p(\cdot)$, there is an integer $N$ such that $\nu(n) < 1/p(n)$ for all $n
 % > N$; $\negl(n)$ is some negligible function of $n$.
 %
+% \DescribeMacro\defop
+% New operators can be defined using |\defop|:
+% \begin{quote} \syntax{"\\defop"["*"]"{"<command>"}{"<text>"}"} \end{quote}
+% defines \<command> to be an operator which typesets \<text>.  By default,
+% limits will be placed above and below the operator in display style; with
+% |*|, limits are always written as super- and subscripts.
+%
 % \subsection{Standard set names}
 %
 % \DescribeMacro\Z
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\defop}
+% Defining new operator names.
+%    \begin{macrocode}
+\def\defop{\@ifstar{\defop@\nolimits}{\defop@\limits}}
+\def\defop@#1#2#3{\def#2{\mathop{\operator@font #3}#1}}
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\keys}
 % \begin{macro}{\dom}
 % \begin{macro}{\ran}
 % And the new operator names.
 %
 %    \begin{macrocode}
-\def\keys{\mathop{\operator@font keys}\nolimits}
-\def\dom{\mathop{\operator@font dom}\nolimits}
-\def\ran{\mathop{\operator@font ran}\nolimits}
-\def\supp{\mathop{\operator@font supp}\nolimits}
-\def\lcm{\mathop{\operator@font lcm}\nolimits}
-\def\poly{\mathop{\operator@font poly}\nolimits}
-\def\negl{\mathop{\operator@font negl}\nolimits}
-\def\ord{\mathop{\operator@font ord}\nolimits}
+\defop*\keys{keys}
+\defop*\dom{dom}
+\defop*\ran{ran}
+\defop*\supp{supp}
+\defop*\lcm{lcm}
+\defop*\poly{poly}
+\defop*\negl{negl}
+\defop*\ord{ord}
 %    \end{macrocode}
 %
 % \end{macro}