From 9ddc24c9f15104f1de771b43895a84f6c71c2d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Filip?= Date: Sun, 13 Jan 2019 00:36:36 +0100 Subject: [PATCH] add \argmax and \argmin (#1820) * add \argmax and \argmin * add reference to argmin and argmax --- docs/support_table.md | 2 ++ docs/supported.md | 3 ++- src/macros.js | 7 +++++++ test/katex-spec.js | 8 ++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/support_table.md b/docs/support_table.md index cb7f268a..202b904e 100644 --- a/docs/support_table.md +++ b/docs/support_table.md @@ -94,6 +94,8 @@ table td { |\arctan|$\arctan$|| |\arctg|$\arctg$|| |\arg|$\arg$|| +|\argmax|$\argmax$|| +|\argmin|$\argmin$|| |{array}|$\begin{array}{cc}a&b\\c&d\end{array}$ | `\begin{array}{cc}`
   `a & b \\`
   `c & d`
`\end{array}`| |\array|Not supported|see `{array}`| |\arraystretch|$\def\arraystretch{1.5}\begin{array}{cc}a&b\\c&d\end{array}$|`\def\arraystretch{1.5}`
`\begin{array}{cc}`
   `a & b \\`
   `c & d`
`\end{array}`| diff --git a/docs/supported.md b/docs/supported.md index 7a40477e..56da3dc3 100644 --- a/docs/supported.md +++ b/docs/supported.md @@ -360,7 +360,8 @@ Direct Input: $+ - / * ⋅ ± × ÷ ∓ ∔ ∧ ∨ ∩ ∪ ≀ ⊎ ⊓ ⊔ ⊕ | $\cos$ `\cos` | $\exp$ `\exp` | $\tanh$ `\tanh`| $\min$ `\min` | | $\cosec$ `\cosec` | $\hom$ `\hom` | $\tg$ `\tg` | $\Pr$ `\Pr` | | $\cosh$ `\cosh`| $\ker$ `\ker` | $\th$ `\th` | $\sup$ `\sup` | -| $\cot$ `\cot` | $\lg$ `\lg`| $\operatorname{f}$ `\operatorname{f}` | +| $\cot$ `\cot` | $\lg$ `\lg`| $\operatorname{f}$ `\operatorname{f}` | $\argmax$ `\argmax` | +|$\argmin$ `\argmin`| Functions on the right column of this table can take `\limits`. diff --git a/src/macros.js b/src/macros.js index d4c8ab2e..881ef3cd 100644 --- a/src/macros.js +++ b/src/macros.js @@ -876,3 +876,10 @@ defineMacro("\\thetasym", "\\vartheta"); // TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}"); defineMacro("\\weierp", "\\wp"); defineMacro("\\Zeta", "\\mathrm{Z}"); + +////////////////////////////////////////////////////////////////////// +// statmath.sty +// https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf + +defineMacro("\\argmin", "\\DOTSB\\mathop{\\operatorname{arg\\,min}}\\limits"); +defineMacro("\\argmax", "\\DOTSB\\mathop{\\operatorname{arg\\,max}}\\limits"); diff --git a/test/katex-spec.js b/test/katex-spec.js index 00ea68e9..27134de6 100644 --- a/test/katex-spec.js +++ b/test/katex-spec.js @@ -3140,6 +3140,14 @@ describe("A macro expander", function() { it("should expand \\liminf as expected", () => { expect`\liminf`.toParseLike`\mathop{\operatorname{lim\,inf}}\limits`; }); + + it("should expand \\argmin as expected", () => { + expect`\argmin`.toParseLike`\mathop{\operatorname{arg\,min}}\limits`; + }); + + it("should expand \\argmax as expected", () => { + expect`\argmax`.toParseLike`\mathop{\operatorname{arg\,max}}\limits`; + }); }); describe("\\tag support", function() {