diff --git a/docs/support_table.md b/docs/support_table.md index 3d166d10..0723c57e 100644 --- a/docs/support_table.md +++ b/docs/support_table.md @@ -801,6 +801,7 @@ use `\ce` instead| |\ominus|$\ominus$|| |\operatorname|$\operatorname{asin} x$|`\operatorname{asin} x`| |\operatorname\*|$\operatorname*{asin}\limits_y x$|`\operatorname*{asin}\limits_y x`| +|\operatornamewithlimits|$\operatornamewithlimits{asin}\limits_y x$|`\operatornamewithlimits{asin}\limits_y x`| |\oplus|$\oplus$|| |\or|Not supported|| |\origof|$\origof$|| diff --git a/docs/supported.md b/docs/supported.md index fdc89050..2f0222e7 100644 --- a/docs/supported.md +++ b/docs/supported.md @@ -421,10 +421,10 @@ Direct Input: $+ - / * ⋅ ± × ÷ ∓ ∔ ∧ ∨ ∩ ∪ ≀ ⊎ ⊓ ⊔ ⊕ | $\argmin$ `\argmin` | $\lim$ `\lim` | $\plim$ `\plim` | $\varliminf$ `\varliminf` | | $\det$ `\det` | $\liminf$ `\liminf` | $\Pr$ `\Pr` | $\varlimsup$ `\varlimsup` | | $\gcd$ `\gcd` | $\limsup$ `\limsup` | $\projlim$ `\projlim` | $\varprojlim$ `\varprojlim` | -| $\inf$ `\inf` | $\max$ `\max` | $\sup$ `\sup` |$\operatorname*{f}$ `\operatorname*{f}`| +| $\inf$ `\inf` | $\max$ `\max` | $\sup$ `\sup` || +| $\operatorname*{f}$ `\operatorname*{f}` | $\operatornamewithlimits{f}$ `\operatornamewithlimits{f}` ||| - -Functions in the bottom five rows of this table can take `\limits`. +Functions in the bottom six rows of this table can take `\limits`. ### \sqrt diff --git a/src/Lexer.js b/src/Lexer.js index 849eee63..7bd9023d 100644 --- a/src/Lexer.js +++ b/src/Lexer.js @@ -59,7 +59,6 @@ const tokenRegexString = `(${spaceRegexString}+)|` + // whitespace `${combiningDiacriticalMarkString}*` + // ...plus accents "|\\\\verb\\*([^]).*?\\4" + // \verb* "|\\\\verb([^*a-zA-Z]).*?\\5" + // \verb unstarred - "|\\\\operatorname\\*" + // \operatorname* `|${controlWordWhitespaceRegexString}` + // \macroName + spaces `|${controlSymbolRegexString})`; // \\, \', etc. diff --git a/src/functions/operatorname.js b/src/functions/operatorname.js index 4aa3327e..d348d490 100644 --- a/src/functions/operatorname.js +++ b/src/functions/operatorname.js @@ -1,5 +1,6 @@ // @flow import defineFunction, {ordargument} from "../defineFunction"; +import {defineMacro} from "../macros"; import buildCommon from "../buildCommon"; import mathMLTree from "../mathMLTree"; import {SymbolNode} from "../domTree"; @@ -140,7 +141,7 @@ const mathmlBuilder: MathMLBuilder<"operatorname"> = (group, options) => { // amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@ defineFunction({ type: "operatorname", - names: ["\\operatorname", "\\operatorname*"], + names: ["\\operatorname@", "\\operatornamewithlimits"], props: { numArgs: 1, }, @@ -150,7 +151,7 @@ defineFunction({ type: "operatorname", mode: parser.mode, body: ordargument(body), - alwaysHandleSupSub: (funcName === "\\operatorname*"), + alwaysHandleSupSub: (funcName === "\\operatornamewithlimits"), limits: false, parentIsSupSub: false, }; @@ -159,3 +160,5 @@ defineFunction({ mathmlBuilder, }); +defineMacro("\\operatorname", + "\\@ifstar\\operatornamewithlimits\\operatorname@");