katex 0.16.46 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +5 -10
  2. package/contrib/copy-tex/README.md +2 -2
  3. package/contrib/mathtex-script-type/README.md +5 -5
  4. package/contrib/mhchem/README.md +1 -1
  5. package/contrib/render-a11y-string/render-a11y-string.ts +1 -1
  6. package/dist/README.md +5 -10
  7. package/dist/katex-swap.css +1 -1
  8. package/dist/katex-swap.min.css +1 -1
  9. package/dist/katex.css +1 -1
  10. package/dist/katex.js +255 -434
  11. package/dist/katex.min.css +1 -1
  12. package/dist/katex.min.js +1 -1
  13. package/dist/katex.mjs +243 -415
  14. package/katex.ts +1 -1
  15. package/package.json +1 -2
  16. package/src/MacroExpander.ts +1 -1
  17. package/src/Namespace.ts +1 -1
  18. package/src/ParseError.ts +1 -1
  19. package/src/Parser.ts +42 -48
  20. package/src/Settings.ts +1 -1
  21. package/src/SourceLocation.ts +2 -2
  22. package/src/buildCommon.ts +6 -6
  23. package/src/buildHTML.ts +4 -5
  24. package/src/buildMathML.ts +1 -1
  25. package/src/buildTree.ts +1 -1
  26. package/src/defineEnvironment.ts +1 -2
  27. package/src/defineFunction.ts +104 -112
  28. package/src/environments/array.ts +8 -12
  29. package/src/environments/cd.ts +8 -8
  30. package/src/functions/accent.ts +10 -13
  31. package/src/functions/accentunder.ts +4 -4
  32. package/src/functions/arrow.ts +5 -5
  33. package/src/functions/char.ts +3 -4
  34. package/src/functions/color.ts +10 -13
  35. package/src/functions/cr.ts +3 -5
  36. package/src/functions/def.ts +15 -19
  37. package/src/functions/delimsizing.ts +23 -23
  38. package/src/functions/enclose.ts +22 -33
  39. package/src/functions/environment.ts +4 -5
  40. package/src/functions/font.ts +15 -27
  41. package/src/functions/genfrac.ts +19 -23
  42. package/src/functions/hbox.ts +6 -6
  43. package/src/functions/horizBrace.ts +4 -4
  44. package/src/functions/href.ts +10 -11
  45. package/src/functions/html.ts +5 -5
  46. package/src/functions/htmlmathml.ts +5 -5
  47. package/src/functions/includegraphics.ts +7 -7
  48. package/src/functions/kern.ts +6 -6
  49. package/src/functions/lap.ts +4 -4
  50. package/src/functions/math.ts +8 -10
  51. package/src/functions/mathchoice.ts +5 -5
  52. package/src/functions/mclass.ts +16 -28
  53. package/src/functions/op.ts +16 -30
  54. package/src/functions/operatorname.ts +4 -4
  55. package/src/functions/overline.ts +3 -3
  56. package/src/functions/phantom.ts +8 -8
  57. package/src/functions/pmb.ts +5 -5
  58. package/src/functions/raisebox.ts +5 -5
  59. package/src/functions/relax.ts +4 -5
  60. package/src/functions/rule.ts +7 -7
  61. package/src/functions/sizing.ts +6 -6
  62. package/src/functions/smash.ts +5 -5
  63. package/src/functions/sqrt.ts +4 -4
  64. package/src/functions/styling.ts +5 -5
  65. package/src/functions/supsub.ts +1 -1
  66. package/src/functions/symbolsOrd.ts +3 -3
  67. package/src/functions/symbolsSpacing.ts +1 -1
  68. package/src/functions/text.ts +7 -7
  69. package/src/functions/underline.ts +4 -4
  70. package/src/functions/utils/assembleSupSub.ts +1 -1
  71. package/src/functions/vcenter.ts +5 -5
  72. package/src/functions/verb.ts +5 -5
  73. package/src/parseNode.ts +2 -476
  74. package/src/parseTree.ts +1 -6
  75. package/src/spacingData.ts +2 -1
  76. package/src/stretchy.ts +1 -1
  77. package/src/svgGeometry.ts +2 -2
  78. package/src/types/index.ts +12 -0
  79. package/src/types/nodes.ts +456 -0
  80. package/src/units.ts +1 -2
  81. package/src/utils.ts +1 -1
package/dist/katex.mjs CHANGED
@@ -770,7 +770,7 @@ var path = {
770
770
  var tallDelim = function tallDelim(label, midHeight) {
771
771
  switch (label) {
772
772
  case "lbrack":
773
- return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v" + midHeight + " v1759 h84z";
773
+ return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v1759 v84 h347 v-84\nH403z M403 1759 V0 H319 V1759 v" + midHeight + " v1759 v84 h84z";
774
774
  case "rbrack":
775
775
  return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v" + midHeight + " v1759 h84z";
776
776
  case "vert":
@@ -4797,7 +4797,9 @@ var boldSymbol = function boldSymbol(value, mode, type) {
4797
4797
  /**
4798
4798
  * Makes either a mathord or textord in the correct font and color.
4799
4799
  */
4800
- var makeOrd = function makeOrd(group, options, type) {
4800
+ var makeOrd = function makeOrd(group, options) {
4801
+ // Spacing nodes are rendered as textord.
4802
+ var type = group.type === "mathord" ? "mathord" : "textord";
4801
4803
  var mode = group.mode;
4802
4804
  var text = group.text;
4803
4805
  var classes = ["mord"];
@@ -5267,6 +5269,9 @@ var staticSvg = function staticSvg(value, options) {
5267
5269
  return span;
5268
5270
  };
5269
5271
 
5272
+ /**
5273
+ * Describes spaces between different classes of atoms.
5274
+ */
5270
5275
  var thinspace = {
5271
5276
  number: 3,
5272
5277
  unit: "mu"
@@ -5375,29 +5380,17 @@ var _htmlGroupBuilders = {};
5375
5380
  */
5376
5381
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5377
5382
  var _mathmlGroupBuilders = {};
5378
- function defineFunction(_ref) {
5383
+ function defineFunction(data) {
5379
5384
  var {
5380
5385
  type,
5381
5386
  names,
5382
- props,
5383
- handler,
5384
5387
  htmlBuilder,
5385
5388
  mathmlBuilder
5386
- } = _ref;
5387
- // Set default values of functions
5388
- var data = {
5389
- type,
5390
- numArgs: props.numArgs,
5391
- argTypes: props.argTypes,
5392
- allowedInArgument: !!props.allowedInArgument,
5393
- allowedInText: !!props.allowedInText,
5394
- allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath,
5395
- numOptionalArgs: props.numOptionalArgs || 0,
5396
- infix: !!props.infix,
5397
- primitive: !!props.primitive,
5398
- handler
5399
- };
5389
+ } = data;
5400
5390
  for (var i = 0; i < names.length; ++i) {
5391
+ // To avoid destructuring and rebuilding an object,
5392
+ // we store the entire FunctionDefSpec object,
5393
+ // even though Parser only needs the FunctionSpec fields.
5401
5394
  _functions[names[i]] = data;
5402
5395
  }
5403
5396
  if (type) {
@@ -5414,24 +5407,18 @@ function defineFunction(_ref) {
5414
5407
  * if the function's ParseNode is generated in Parser.js rather than via a
5415
5408
  * stand-alone handler provided to `defineFunction`).
5416
5409
  */
5417
- function defineFunctionBuilders(_ref2) {
5410
+ function defineFunctionBuilders(_ref) {
5418
5411
  var {
5419
5412
  type,
5420
5413
  htmlBuilder,
5421
5414
  mathmlBuilder
5422
- } = _ref2;
5423
- defineFunction({
5424
- type,
5425
- names: [],
5426
- props: {
5427
- numArgs: 0
5428
- },
5429
- handler() {
5430
- throw new Error('Should never be called.');
5431
- },
5432
- htmlBuilder,
5433
- mathmlBuilder
5434
- });
5415
+ } = _ref;
5416
+ if (htmlBuilder) {
5417
+ _htmlGroupBuilders[type] = htmlBuilder;
5418
+ }
5419
+ if (mathmlBuilder) {
5420
+ _mathmlGroupBuilders[type] = mathmlBuilder;
5421
+ }
5435
5422
  }
5436
5423
  var normalizeArgument = function normalizeArgument(arg) {
5437
5424
  return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg;
@@ -6840,7 +6827,7 @@ function assertSymbolNodeType(node) {
6840
6827
  return typedNode;
6841
6828
  }
6842
6829
  /**
6843
- * Returns the node more strictly typed iff it is of the given type. Otherwise,
6830
+ * Returns the node more strictly typed if it is of the given type. Otherwise,
6844
6831
  * returns null.
6845
6832
  */
6846
6833
  function checkSymbolNodeType(node) {
@@ -6925,7 +6912,7 @@ var htmlBuilder$a = (grp, options) => {
6925
6912
  type: "textord",
6926
6913
  mode: group.mode,
6927
6914
  text: group.label
6928
- }, options, "textord");
6915
+ }, options);
6929
6916
  accent = assertSymbolDomNode(accent);
6930
6917
  // Remove the italic correction of the accent, because it only serves to
6931
6918
  // shift the accent over to a place we don't want.
@@ -7016,9 +7003,7 @@ var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\t
7016
7003
  defineFunction({
7017
7004
  type: "accent",
7018
7005
  names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"],
7019
- props: {
7020
- numArgs: 1
7021
- },
7006
+ numArgs: 1,
7022
7007
  handler: (context, args) => {
7023
7008
  var base = normalizeArgument(args[0]);
7024
7009
  var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);
@@ -7039,13 +7024,11 @@ defineFunction({
7039
7024
  defineFunction({
7040
7025
  type: "accent",
7041
7026
  names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"],
7042
- props: {
7043
- numArgs: 1,
7044
- allowedInText: true,
7045
- allowedInMath: true,
7046
- // unless in strict mode
7047
- argTypes: ["primitive"]
7048
- },
7027
+ numArgs: 1,
7028
+ allowedInText: true,
7029
+ allowedInMath: true,
7030
+ // unless in strict mode
7031
+ argTypes: ["primitive"],
7049
7032
  handler: (context, args) => {
7050
7033
  var base = args[0];
7051
7034
  var mode = context.parser.mode;
@@ -7061,18 +7044,14 @@ defineFunction({
7061
7044
  isShifty: true,
7062
7045
  base: base
7063
7046
  };
7064
- },
7065
- htmlBuilder: htmlBuilder$a,
7066
- mathmlBuilder: mathmlBuilder$9
7047
+ }
7067
7048
  });
7068
7049
 
7069
7050
  // Horizontal overlap functions
7070
7051
  defineFunction({
7071
7052
  type: "accentUnder",
7072
7053
  names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
7073
- props: {
7074
- numArgs: 1
7075
- },
7054
+ numArgs: 1,
7076
7055
  handler: (_ref, args) => {
7077
7056
  var {
7078
7057
  parser,
@@ -7133,10 +7112,8 @@ defineFunction({
7133
7112
  "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium",
7134
7113
  // The next 3 functions are here only to support the {CD} environment.
7135
7114
  "\\\\cdrightarrow", "\\\\cdleftarrow", "\\\\cdlongequal"],
7136
- props: {
7137
- numArgs: 1,
7138
- numOptionalArgs: 1
7139
- },
7115
+ numArgs: 1,
7116
+ numOptionalArgs: 1,
7140
7117
  handler(_ref, args, optArgs) {
7141
7118
  var {
7142
7119
  parser,
@@ -7273,9 +7250,6 @@ function mathmlBuilder$8(group, options) {
7273
7250
  } else if (group.mclass === "mopen" || group.mclass === "mclose") {
7274
7251
  node.attributes.lspace = "0em";
7275
7252
  node.attributes.rspace = "0em";
7276
- } else if (group.mclass === "minner") {
7277
- node.attributes.lspace = "0.0556em"; // 1 mu is the most likely option
7278
- node.attributes.width = "+0.1111em";
7279
7253
  }
7280
7254
  // MathML <mo> default space is 5/18 em, so <mrel> needs no action.
7281
7255
  // Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo
@@ -7286,10 +7260,8 @@ function mathmlBuilder$8(group, options) {
7286
7260
  defineFunction({
7287
7261
  type: "mclass",
7288
7262
  names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
7289
- props: {
7290
- numArgs: 1,
7291
- primitive: true
7292
- },
7263
+ numArgs: 1,
7264
+ primitive: true,
7293
7265
  handler(_ref, args) {
7294
7266
  var {
7295
7267
  parser,
@@ -7300,7 +7272,6 @@ defineFunction({
7300
7272
  type: "mclass",
7301
7273
  mode: parser.mode,
7302
7274
  mclass: "m" + funcName.slice(5),
7303
- // TODO(kevinb): don't prefix with 'm'
7304
7275
  body: ordargument(body),
7305
7276
  isCharacterBox: isCharacterBox(body)
7306
7277
  };
@@ -7325,9 +7296,7 @@ var binrelClass = arg => {
7325
7296
  defineFunction({
7326
7297
  type: "mclass",
7327
7298
  names: ["\\@binrel"],
7328
- props: {
7329
- numArgs: 2
7330
- },
7299
+ numArgs: 2,
7331
7300
  handler(_ref2, args) {
7332
7301
  var {
7333
7302
  parser
@@ -7345,9 +7314,7 @@ defineFunction({
7345
7314
  defineFunction({
7346
7315
  type: "mclass",
7347
7316
  names: ["\\stackrel", "\\overset", "\\underset"],
7348
- props: {
7349
- numArgs: 2
7350
- },
7317
+ numArgs: 2,
7351
7318
  handler(_ref3, args) {
7352
7319
  var {
7353
7320
  parser,
@@ -7372,12 +7339,16 @@ defineFunction({
7372
7339
  suppressBaseShift: funcName !== "\\stackrel",
7373
7340
  body: ordargument(baseArg)
7374
7341
  };
7375
- var supsub = {
7342
+ var supsub = funcName === "\\underset" ? {
7376
7343
  type: "supsub",
7377
7344
  mode: shiftedArg.mode,
7378
7345
  base: baseOp,
7379
- sup: funcName === "\\underset" ? null : shiftedArg,
7380
- sub: funcName === "\\underset" ? shiftedArg : null
7346
+ sub: shiftedArg
7347
+ } : {
7348
+ type: "supsub",
7349
+ mode: shiftedArg.mode,
7350
+ base: baseOp,
7351
+ sup: shiftedArg
7381
7352
  };
7382
7353
  return {
7383
7354
  type: "mclass",
@@ -7386,9 +7357,7 @@ defineFunction({
7386
7357
  body: [supsub],
7387
7358
  isCharacterBox: isCharacterBox(supsub)
7388
7359
  };
7389
- },
7390
- htmlBuilder: htmlBuilder$9,
7391
- mathmlBuilder: mathmlBuilder$8
7360
+ }
7392
7361
  });
7393
7362
 
7394
7363
  // \pmb is a simulation of bold font.
@@ -7398,10 +7367,8 @@ defineFunction({
7398
7367
  defineFunction({
7399
7368
  type: "pmb",
7400
7369
  names: ["\\pmb"],
7401
- props: {
7402
- numArgs: 1,
7403
- allowedInText: true
7404
- },
7370
+ numArgs: 1,
7371
+ allowedInText: true,
7405
7372
  handler(_ref, args) {
7406
7373
  var {
7407
7374
  parser
@@ -7647,9 +7614,7 @@ function parseCD(parser) {
7647
7614
  defineFunction({
7648
7615
  type: "cdlabel",
7649
7616
  names: ["\\\\cdleft", "\\\\cdright"],
7650
- props: {
7651
- numArgs: 1
7652
- },
7617
+ numArgs: 1,
7653
7618
  handler(_ref, args) {
7654
7619
  var {
7655
7620
  parser,
@@ -7692,9 +7657,7 @@ defineFunction({
7692
7657
  defineFunction({
7693
7658
  type: "cdlabelparent",
7694
7659
  names: ["\\\\cdparent"],
7695
- props: {
7696
- numArgs: 1
7697
- },
7660
+ numArgs: 1,
7698
7661
  handler(_ref2, args) {
7699
7662
  var {
7700
7663
  parser
@@ -7724,10 +7687,8 @@ defineFunction({
7724
7687
  defineFunction({
7725
7688
  type: "textord",
7726
7689
  names: ["\\@char"],
7727
- props: {
7728
- numArgs: 1,
7729
- allowedInText: true
7730
- },
7690
+ numArgs: 1,
7691
+ allowedInText: true,
7731
7692
  handler(_ref, args) {
7732
7693
  var {
7733
7694
  parser
@@ -7779,11 +7740,9 @@ var mathmlBuilder$7 = (group, options) => {
7779
7740
  defineFunction({
7780
7741
  type: "color",
7781
7742
  names: ["\\textcolor"],
7782
- props: {
7783
- numArgs: 2,
7784
- allowedInText: true,
7785
- argTypes: ["color", "original"]
7786
- },
7743
+ numArgs: 2,
7744
+ allowedInText: true,
7745
+ argTypes: ["color", "original"],
7787
7746
  handler(_ref, args) {
7788
7747
  var {
7789
7748
  parser
@@ -7803,11 +7762,9 @@ defineFunction({
7803
7762
  defineFunction({
7804
7763
  type: "color",
7805
7764
  names: ["\\color"],
7806
- props: {
7807
- numArgs: 1,
7808
- allowedInText: true,
7809
- argTypes: ["color"]
7810
- },
7765
+ numArgs: 1,
7766
+ allowedInText: true,
7767
+ argTypes: ["color"],
7811
7768
  handler(_ref2, args) {
7812
7769
  var {
7813
7770
  parser,
@@ -7827,9 +7784,7 @@ defineFunction({
7827
7784
  color,
7828
7785
  body
7829
7786
  };
7830
- },
7831
- htmlBuilder: htmlBuilder$8,
7832
- mathmlBuilder: mathmlBuilder$7
7787
+ }
7833
7788
  });
7834
7789
 
7835
7790
  // Row breaks within tabular environments, and line breaks at top level
@@ -7837,11 +7792,9 @@ defineFunction({
7837
7792
  defineFunction({
7838
7793
  type: "cr",
7839
7794
  names: ["\\\\"],
7840
- props: {
7841
- numArgs: 0,
7842
- numOptionalArgs: 0,
7843
- allowedInText: true
7844
- },
7795
+ numArgs: 0,
7796
+ numOptionalArgs: 0,
7797
+ allowedInText: true,
7845
7798
  handler(_ref, args, optArgs) {
7846
7799
  var {
7847
7800
  parser
@@ -7932,10 +7885,8 @@ defineFunction({
7932
7885
  type: "internal",
7933
7886
  names: ["\\global", "\\long", "\\\\globallong" // can’t be entered directly
7934
7887
  ],
7935
- props: {
7936
- numArgs: 0,
7937
- allowedInText: true
7938
- },
7888
+ numArgs: 0,
7889
+ allowedInText: true,
7939
7890
  handler(_ref) {
7940
7891
  var {
7941
7892
  parser,
@@ -7960,11 +7911,9 @@ defineFunction({
7960
7911
  defineFunction({
7961
7912
  type: "internal",
7962
7913
  names: ["\\def", "\\gdef", "\\edef", "\\xdef"],
7963
- props: {
7964
- numArgs: 0,
7965
- allowedInText: true,
7966
- primitive: true
7967
- },
7914
+ numArgs: 0,
7915
+ allowedInText: true,
7916
+ primitive: true,
7968
7917
  handler(_ref2) {
7969
7918
  var {
7970
7919
  parser,
@@ -8039,11 +7988,9 @@ defineFunction({
8039
7988
  type: "internal",
8040
7989
  names: ["\\let", "\\\\globallet" // can’t be entered directly
8041
7990
  ],
8042
- props: {
8043
- numArgs: 0,
8044
- allowedInText: true,
8045
- primitive: true
8046
- },
7991
+ numArgs: 0,
7992
+ allowedInText: true,
7993
+ primitive: true,
8047
7994
  handler(_ref3) {
8048
7995
  var {
8049
7996
  parser,
@@ -8064,11 +8011,9 @@ defineFunction({
8064
8011
  type: "internal",
8065
8012
  names: ["\\futurelet", "\\\\globalfuture" // can’t be entered directly
8066
8013
  ],
8067
- props: {
8068
- numArgs: 0,
8069
- allowedInText: true,
8070
- primitive: true
8071
- },
8014
+ numArgs: 0,
8015
+ allowedInText: true,
8016
+ primitive: true,
8072
8017
  handler(_ref4) {
8073
8018
  var {
8074
8019
  parser,
@@ -8808,10 +8753,8 @@ function checkDelimiter(delim, context) {
8808
8753
  defineFunction({
8809
8754
  type: "delimsizing",
8810
8755
  names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
8811
- props: {
8812
- numArgs: 1,
8813
- argTypes: ["primitive"]
8814
- },
8756
+ numArgs: 1,
8757
+ argTypes: ["primitive"],
8815
8758
  handler: (context, args) => {
8816
8759
  var delim = checkDelimiter(args[0], context);
8817
8760
  return {
@@ -8860,10 +8803,8 @@ function assertParsed(group) {
8860
8803
  defineFunction({
8861
8804
  type: "leftright-right",
8862
8805
  names: ["\\right"],
8863
- props: {
8864
- numArgs: 1,
8865
- primitive: true
8866
- },
8806
+ numArgs: 1,
8807
+ primitive: true,
8867
8808
  handler: (context, args) => {
8868
8809
  // \left case below triggers parsing of \right in
8869
8810
  // `const right = parser.parseFunction();`
@@ -8876,17 +8817,15 @@ defineFunction({
8876
8817
  type: "leftright-right",
8877
8818
  mode: context.parser.mode,
8878
8819
  delim: checkDelimiter(args[0], context).text,
8879
- color: color // undefined if not set via \color
8820
+ color // undefined if not set via \color
8880
8821
  };
8881
8822
  }
8882
8823
  });
8883
8824
  defineFunction({
8884
8825
  type: "leftright",
8885
8826
  names: ["\\left"],
8886
- props: {
8887
- numArgs: 1,
8888
- primitive: true
8889
- },
8827
+ numArgs: 1,
8828
+ primitive: true,
8890
8829
  handler: (context, args) => {
8891
8830
  var delim = checkDelimiter(args[0], context);
8892
8831
  var parser = context.parser;
@@ -8985,10 +8924,8 @@ defineFunction({
8985
8924
  defineFunction({
8986
8925
  type: "middle",
8987
8926
  names: ["\\middle"],
8988
- props: {
8989
- numArgs: 1,
8990
- primitive: true
8991
- },
8927
+ numArgs: 1,
8928
+ primitive: true,
8992
8929
  handler: (context, args) => {
8993
8930
  var delim = checkDelimiter(args[0], context);
8994
8931
  if (!context.parser.leftrightDepth) {
@@ -9224,11 +9161,9 @@ var mathmlBuilder$6 = (group, options) => {
9224
9161
  defineFunction({
9225
9162
  type: "enclose",
9226
9163
  names: ["\\colorbox"],
9227
- props: {
9228
- numArgs: 2,
9229
- allowedInText: true,
9230
- argTypes: ["color", "hbox"]
9231
- },
9164
+ numArgs: 2,
9165
+ allowedInText: true,
9166
+ argTypes: ["color", "hbox"],
9232
9167
  handler(_ref, args, optArgs) {
9233
9168
  var {
9234
9169
  parser,
@@ -9250,11 +9185,9 @@ defineFunction({
9250
9185
  defineFunction({
9251
9186
  type: "enclose",
9252
9187
  names: ["\\fcolorbox"],
9253
- props: {
9254
- numArgs: 3,
9255
- allowedInText: true,
9256
- argTypes: ["color", "color", "hbox"]
9257
- },
9188
+ numArgs: 3,
9189
+ allowedInText: true,
9190
+ argTypes: ["color", "color", "hbox"],
9258
9191
  handler(_ref2, args, optArgs) {
9259
9192
  var {
9260
9193
  parser,
@@ -9271,18 +9204,14 @@ defineFunction({
9271
9204
  borderColor,
9272
9205
  body
9273
9206
  };
9274
- },
9275
- htmlBuilder: htmlBuilder$7,
9276
- mathmlBuilder: mathmlBuilder$6
9207
+ }
9277
9208
  });
9278
9209
  defineFunction({
9279
9210
  type: "enclose",
9280
9211
  names: ["\\fbox"],
9281
- props: {
9282
- numArgs: 1,
9283
- argTypes: ["hbox"],
9284
- allowedInText: true
9285
- },
9212
+ numArgs: 1,
9213
+ argTypes: ["hbox"],
9214
+ allowedInText: true,
9286
9215
  handler(_ref3, args) {
9287
9216
  var {
9288
9217
  parser
@@ -9298,9 +9227,7 @@ defineFunction({
9298
9227
  defineFunction({
9299
9228
  type: "enclose",
9300
9229
  names: ["\\cancel", "\\bcancel", "\\xcancel", "\\phase"],
9301
- props: {
9302
- numArgs: 1
9303
- },
9230
+ numArgs: 1,
9304
9231
  handler(_ref4, args) {
9305
9232
  var {
9306
9233
  parser,
@@ -9313,17 +9240,13 @@ defineFunction({
9313
9240
  label: funcName,
9314
9241
  body
9315
9242
  };
9316
- },
9317
- htmlBuilder: htmlBuilder$7,
9318
- mathmlBuilder: mathmlBuilder$6
9243
+ }
9319
9244
  });
9320
9245
  defineFunction({
9321
9246
  type: "enclose",
9322
9247
  names: ["\\sout"],
9323
- props: {
9324
- numArgs: 1,
9325
- allowedInText: true
9326
- },
9248
+ numArgs: 1,
9249
+ allowedInText: true,
9327
9250
  handler(_ref5, args) {
9328
9251
  var {
9329
9252
  parser,
@@ -9339,18 +9262,14 @@ defineFunction({
9339
9262
  label: funcName,
9340
9263
  body
9341
9264
  };
9342
- },
9343
- htmlBuilder: htmlBuilder$7,
9344
- mathmlBuilder: mathmlBuilder$6
9265
+ }
9345
9266
  });
9346
9267
  defineFunction({
9347
9268
  type: "enclose",
9348
9269
  names: ["\\angl"],
9349
- props: {
9350
- numArgs: 1,
9351
- argTypes: ["hbox"],
9352
- allowedInText: false
9353
- },
9270
+ numArgs: 1,
9271
+ argTypes: ["hbox"],
9272
+ allowedInText: false,
9354
9273
  handler(_ref6, args) {
9355
9274
  var {
9356
9275
  parser
@@ -10069,14 +9988,13 @@ var alignedHandler = function alignedHandler(context, args) {
10069
9988
  validateAmsEnvironmentContext(context);
10070
9989
  }
10071
9990
  var cols = [];
10072
- var separationType = context.envName.includes("at") ? "alignat" : "align";
10073
9991
  var isSplit = context.envName === "split";
10074
9992
  var res = parseArray(context.parser, {
10075
9993
  cols,
10076
9994
  addJot: true,
10077
9995
  autoTag: isSplit ? undefined : getAutoTag(context.envName),
10078
9996
  emptySingleRow: true,
10079
- colSeparationType: separationType,
9997
+ colSeparationType: context.envName.includes("at") ? "alignat" : "align",
10080
9998
  maxNumCols: isSplit ? 2 : undefined,
10081
9999
  leqno: context.parser.settings.leqno
10082
10000
  }, "display");
@@ -10462,11 +10380,9 @@ defineFunction({
10462
10380
  type: "text",
10463
10381
  // Doesn't matter what this is.
10464
10382
  names: ["\\hline", "\\hdashline"],
10465
- props: {
10466
- numArgs: 0,
10467
- allowedInText: true,
10468
- allowedInMath: true
10469
- },
10383
+ numArgs: 0,
10384
+ allowedInText: true,
10385
+ allowedInMath: true,
10470
10386
  handler(context, args) {
10471
10387
  throw new ParseError(context.funcName + " valid only within array environment");
10472
10388
  }
@@ -10479,10 +10395,8 @@ var environments = _environments;
10479
10395
  defineFunction({
10480
10396
  type: "environment",
10481
10397
  names: ["\\begin", "\\end"],
10482
- props: {
10483
- numArgs: 1,
10484
- argTypes: ["text"]
10485
- },
10398
+ numArgs: 1,
10399
+ argTypes: ["text"],
10486
10400
  handler(_ref, args) {
10487
10401
  var {
10488
10402
  parser,
@@ -10560,20 +10474,15 @@ defineFunction({
10560
10474
  "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt",
10561
10475
  // aliases, except \bm defined below
10562
10476
  "\\Bbb", "\\bold", "\\frak"],
10563
- props: {
10564
- numArgs: 1,
10565
- allowedInArgument: true
10566
- },
10477
+ numArgs: 1,
10478
+ allowedInArgument: true,
10567
10479
  handler: (_ref, args) => {
10568
10480
  var {
10569
10481
  parser,
10570
10482
  funcName
10571
10483
  } = _ref;
10572
10484
  var body = normalizeArgument(args[0]);
10573
- var func = funcName;
10574
- if (func in fontAliases) {
10575
- func = fontAliases[func];
10576
- }
10485
+ var func = funcName in fontAliases ? fontAliases[funcName] : funcName;
10577
10486
  return {
10578
10487
  type: "font",
10579
10488
  mode: parser.mode,
@@ -10587,9 +10496,7 @@ defineFunction({
10587
10496
  defineFunction({
10588
10497
  type: "mclass",
10589
10498
  names: ["\\boldsymbol", "\\bm"],
10590
- props: {
10591
- numArgs: 1
10592
- },
10499
+ numArgs: 1,
10593
10500
  handler: (_ref2, args) => {
10594
10501
  var {
10595
10502
  parser
@@ -10615,10 +10522,8 @@ defineFunction({
10615
10522
  defineFunction({
10616
10523
  type: "font",
10617
10524
  names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"],
10618
- props: {
10619
- numArgs: 0,
10620
- allowedInText: true
10621
- },
10525
+ numArgs: 0,
10526
+ allowedInText: true,
10622
10527
  handler: (_ref3, args) => {
10623
10528
  var {
10624
10529
  parser,
@@ -10639,9 +10544,7 @@ defineFunction({
10639
10544
  body
10640
10545
  }
10641
10546
  };
10642
- },
10643
- htmlBuilder: htmlBuilder$5,
10644
- mathmlBuilder: mathmlBuilder$4
10547
+ }
10645
10548
  });
10646
10549
 
10647
10550
  var htmlBuilder$4 = (group, options) => {
@@ -10822,10 +10725,8 @@ defineFunction({
10822
10725
  // can’t be entered directly
10823
10726
  "\\\\bracefrac", "\\\\brackfrac" // ditto
10824
10727
  ],
10825
- props: {
10826
- numArgs: 2,
10827
- allowedInArgument: true
10828
- },
10728
+ numArgs: 2,
10729
+ allowedInArgument: true,
10829
10730
  handler: (_ref, args) => {
10830
10731
  var {
10831
10732
  parser,
@@ -10893,10 +10794,8 @@ defineFunction({
10893
10794
  defineFunction({
10894
10795
  type: "infix",
10895
10796
  names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
10896
- props: {
10897
- numArgs: 0,
10898
- infix: true
10899
- },
10797
+ numArgs: 0,
10798
+ infix: true,
10900
10799
  handler(_ref2) {
10901
10800
  var {
10902
10801
  parser,
@@ -10943,11 +10842,9 @@ var delimFromValue = function delimFromValue(delimString) {
10943
10842
  defineFunction({
10944
10843
  type: "genfrac",
10945
10844
  names: ["\\genfrac"],
10946
- props: {
10947
- numArgs: 6,
10948
- allowedInArgument: true,
10949
- argTypes: ["math", "math", "size", "text", "math", "math"]
10950
- },
10845
+ numArgs: 6,
10846
+ allowedInArgument: true,
10847
+ argTypes: ["math", "math", "size", "text", "math", "math"],
10951
10848
  handler(_ref3, args) {
10952
10849
  var {
10953
10850
  parser
@@ -11000,11 +10897,9 @@ defineFunction({
11000
10897
  defineFunction({
11001
10898
  type: "infix",
11002
10899
  names: ["\\above"],
11003
- props: {
11004
- numArgs: 1,
11005
- argTypes: ["size"],
11006
- infix: true
11007
- },
10900
+ numArgs: 1,
10901
+ argTypes: ["size"],
10902
+ infix: true,
11008
10903
  handler(_ref4, args) {
11009
10904
  var {
11010
10905
  parser,
@@ -11023,10 +10918,8 @@ defineFunction({
11023
10918
  defineFunction({
11024
10919
  type: "genfrac",
11025
10920
  names: ["\\\\abovefrac"],
11026
- props: {
11027
- numArgs: 3,
11028
- argTypes: ["math", "size", "math"]
11029
- },
10921
+ numArgs: 3,
10922
+ argTypes: ["math", "size", "math"],
11030
10923
  handler: (_ref5, args) => {
11031
10924
  var {
11032
10925
  parser,
@@ -11158,9 +11051,7 @@ var mathmlBuilder$2 = (group, options) => {
11158
11051
  defineFunction({
11159
11052
  type: "horizBrace",
11160
11053
  names: ["\\overbrace", "\\underbrace", "\\overbracket", "\\underbracket"],
11161
- props: {
11162
- numArgs: 1
11163
- },
11054
+ numArgs: 1,
11164
11055
  handler(_ref, args) {
11165
11056
  var {
11166
11057
  parser,
@@ -11181,11 +11072,9 @@ defineFunction({
11181
11072
  defineFunction({
11182
11073
  type: "href",
11183
11074
  names: ["\\href"],
11184
- props: {
11185
- numArgs: 2,
11186
- argTypes: ["url", "original"],
11187
- allowedInText: true
11188
- },
11075
+ numArgs: 2,
11076
+ argTypes: ["url", "original"],
11077
+ allowedInText: true,
11189
11078
  handler: (_ref, args) => {
11190
11079
  var {
11191
11080
  parser
@@ -11221,11 +11110,9 @@ defineFunction({
11221
11110
  defineFunction({
11222
11111
  type: "href",
11223
11112
  names: ["\\url"],
11224
- props: {
11225
- numArgs: 1,
11226
- argTypes: ["url"],
11227
- allowedInText: true
11228
- },
11113
+ numArgs: 1,
11114
+ argTypes: ["url"],
11115
+ allowedInText: true,
11229
11116
  handler: (_ref2, args) => {
11230
11117
  var {
11231
11118
  parser
@@ -11271,12 +11158,10 @@ defineFunction({
11271
11158
  defineFunction({
11272
11159
  type: "hbox",
11273
11160
  names: ["\\hbox"],
11274
- props: {
11275
- numArgs: 1,
11276
- argTypes: ["text"],
11277
- allowedInText: true,
11278
- primitive: true
11279
- },
11161
+ numArgs: 1,
11162
+ argTypes: ["text"],
11163
+ allowedInText: true,
11164
+ primitive: true,
11280
11165
  handler(_ref, args) {
11281
11166
  var {
11282
11167
  parser
@@ -11299,11 +11184,9 @@ defineFunction({
11299
11184
  defineFunction({
11300
11185
  type: "html",
11301
11186
  names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"],
11302
- props: {
11303
- numArgs: 2,
11304
- argTypes: ["raw", "original"],
11305
- allowedInText: true
11306
- },
11187
+ numArgs: 2,
11188
+ argTypes: ["raw", "original"],
11189
+ allowedInText: true,
11307
11190
  handler: (_ref, args) => {
11308
11191
  var {
11309
11192
  parser,
@@ -11393,11 +11276,9 @@ defineFunction({
11393
11276
  defineFunction({
11394
11277
  type: "htmlmathml",
11395
11278
  names: ["\\html@mathml"],
11396
- props: {
11397
- numArgs: 2,
11398
- allowedInArgument: true,
11399
- allowedInText: true
11400
- },
11279
+ numArgs: 2,
11280
+ allowedInArgument: true,
11281
+ allowedInText: true,
11401
11282
  handler: (_ref, args) => {
11402
11283
  var {
11403
11284
  parser
@@ -11445,12 +11326,10 @@ var sizeData = function sizeData(str) {
11445
11326
  defineFunction({
11446
11327
  type: "includegraphics",
11447
11328
  names: ["\\includegraphics"],
11448
- props: {
11449
- numArgs: 1,
11450
- numOptionalArgs: 1,
11451
- argTypes: ["raw", "url"],
11452
- allowedInText: false
11453
- },
11329
+ numArgs: 1,
11330
+ numOptionalArgs: 1,
11331
+ argTypes: ["raw", "url"],
11332
+ allowedInText: false,
11454
11333
  handler: (_ref, args, optArgs) => {
11455
11334
  var {
11456
11335
  parser
@@ -11566,12 +11445,10 @@ defineFunction({
11566
11445
  defineFunction({
11567
11446
  type: "kern",
11568
11447
  names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
11569
- props: {
11570
- numArgs: 1,
11571
- argTypes: ["size"],
11572
- primitive: true,
11573
- allowedInText: true
11574
- },
11448
+ numArgs: 1,
11449
+ argTypes: ["size"],
11450
+ primitive: true,
11451
+ allowedInText: true,
11575
11452
  handler(_ref, args) {
11576
11453
  var {
11577
11454
  parser,
@@ -11614,10 +11491,8 @@ defineFunction({
11614
11491
  defineFunction({
11615
11492
  type: "lap",
11616
11493
  names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
11617
- props: {
11618
- numArgs: 1,
11619
- allowedInText: true
11620
- },
11494
+ numArgs: 1,
11495
+ allowedInText: true,
11621
11496
  handler: (_ref, args) => {
11622
11497
  var {
11623
11498
  parser,
@@ -11676,11 +11551,9 @@ defineFunction({
11676
11551
  defineFunction({
11677
11552
  type: "styling",
11678
11553
  names: ["\\(", "$"],
11679
- props: {
11680
- numArgs: 0,
11681
- allowedInText: true,
11682
- allowedInMath: false
11683
- },
11554
+ numArgs: 0,
11555
+ allowedInText: true,
11556
+ allowedInMath: false,
11684
11557
  handler(_ref, args) {
11685
11558
  var {
11686
11559
  funcName,
@@ -11706,11 +11579,9 @@ defineFunction({
11706
11579
  type: "text",
11707
11580
  // Doesn't matter what this is.
11708
11581
  names: ["\\)", "\\]"],
11709
- props: {
11710
- numArgs: 0,
11711
- allowedInText: true,
11712
- allowedInMath: false
11713
- },
11582
+ numArgs: 0,
11583
+ allowedInText: true,
11584
+ allowedInMath: false,
11714
11585
  handler(context, args) {
11715
11586
  throw new ParseError("Mismatched " + context.funcName);
11716
11587
  }
@@ -11733,10 +11604,8 @@ var chooseMathStyle = (group, options) => {
11733
11604
  defineFunction({
11734
11605
  type: "mathchoice",
11735
11606
  names: ["\\mathchoice"],
11736
- props: {
11737
- numArgs: 4,
11738
- primitive: true
11739
- },
11607
+ numArgs: 4,
11608
+ primitive: true,
11740
11609
  handler: (_ref, args) => {
11741
11610
  var {
11742
11611
  parser
@@ -12031,9 +11900,7 @@ var singleCharBigOps = {
12031
11900
  defineFunction({
12032
11901
  type: "op",
12033
11902
  names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22c0", "\u22c1", "\u22c2", "\u22c3", "\u2a00", "\u2a01", "\u2a02", "\u2a04", "\u2a06"],
12034
- props: {
12035
- numArgs: 0
12036
- },
11903
+ numArgs: 0,
12037
11904
  handler: (_ref, args) => {
12038
11905
  var {
12039
11906
  parser,
@@ -12055,15 +11922,11 @@ defineFunction({
12055
11922
  htmlBuilder: htmlBuilder$2,
12056
11923
  mathmlBuilder: mathmlBuilder$1
12057
11924
  });
12058
- // Note: calling defineFunction with a type that's already been defined only
12059
- // works because the same htmlBuilder and mathmlBuilder are being used.
12060
11925
  defineFunction({
12061
11926
  type: "op",
12062
11927
  names: ["\\mathop"],
12063
- props: {
12064
- numArgs: 1,
12065
- primitive: true
12066
- },
11928
+ numArgs: 1,
11929
+ primitive: true,
12067
11930
  handler: (_ref2, args) => {
12068
11931
  var {
12069
11932
  parser
@@ -12077,9 +11940,7 @@ defineFunction({
12077
11940
  symbol: false,
12078
11941
  body: ordargument(body)
12079
11942
  };
12080
- },
12081
- htmlBuilder: htmlBuilder$2,
12082
- mathmlBuilder: mathmlBuilder$1
11943
+ }
12083
11944
  });
12084
11945
  // There are 2 flags for operators; whether they produce limits in
12085
11946
  // displaystyle, and whether they are symbols and should grow in
@@ -12096,9 +11957,7 @@ var singleCharIntegrals = {
12096
11957
  defineFunction({
12097
11958
  type: "op",
12098
11959
  names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"],
12099
- props: {
12100
- numArgs: 0
12101
- },
11960
+ numArgs: 0,
12102
11961
  handler(_ref3) {
12103
11962
  var {
12104
11963
  parser,
@@ -12112,17 +11971,13 @@ defineFunction({
12112
11971
  symbol: false,
12113
11972
  name: funcName
12114
11973
  };
12115
- },
12116
- htmlBuilder: htmlBuilder$2,
12117
- mathmlBuilder: mathmlBuilder$1
11974
+ }
12118
11975
  });
12119
11976
  // Limits, not symbols
12120
11977
  defineFunction({
12121
11978
  type: "op",
12122
11979
  names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
12123
- props: {
12124
- numArgs: 0
12125
- },
11980
+ numArgs: 0,
12126
11981
  handler(_ref4) {
12127
11982
  var {
12128
11983
  parser,
@@ -12136,18 +11991,14 @@ defineFunction({
12136
11991
  symbol: false,
12137
11992
  name: funcName
12138
11993
  };
12139
- },
12140
- htmlBuilder: htmlBuilder$2,
12141
- mathmlBuilder: mathmlBuilder$1
11994
+ }
12142
11995
  });
12143
11996
  // No limits, symbols
12144
11997
  defineFunction({
12145
11998
  type: "op",
12146
11999
  names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222b", "\u222c", "\u222d", "\u222e", "\u222f", "\u2230"],
12147
- props: {
12148
- numArgs: 0,
12149
- allowedInArgument: true
12150
- },
12000
+ numArgs: 0,
12001
+ allowedInArgument: true,
12151
12002
  handler(_ref5) {
12152
12003
  var {
12153
12004
  parser,
@@ -12165,9 +12016,7 @@ defineFunction({
12165
12016
  symbol: true,
12166
12017
  name: fName
12167
12018
  };
12168
- },
12169
- htmlBuilder: htmlBuilder$2,
12170
- mathmlBuilder: mathmlBuilder$1
12019
+ }
12171
12020
  });
12172
12021
 
12173
12022
  // NOTE: Unlike most `htmlBuilder`s, this one handles not only
@@ -12277,9 +12126,7 @@ var mathmlBuilder = (group, options) => {
12277
12126
  defineFunction({
12278
12127
  type: "operatorname",
12279
12128
  names: ["\\operatorname@", "\\operatornamewithlimits"],
12280
- props: {
12281
- numArgs: 1
12282
- },
12129
+ numArgs: 1,
12283
12130
  handler: (_ref, args) => {
12284
12131
  var {
12285
12132
  parser,
@@ -12316,9 +12163,7 @@ defineFunctionBuilders({
12316
12163
  defineFunction({
12317
12164
  type: "overline",
12318
12165
  names: ["\\overline"],
12319
- props: {
12320
- numArgs: 1
12321
- },
12166
+ numArgs: 1,
12322
12167
  handler(_ref, args) {
12323
12168
  var {
12324
12169
  parser
@@ -12368,10 +12213,8 @@ defineFunction({
12368
12213
  defineFunction({
12369
12214
  type: "phantom",
12370
12215
  names: ["\\phantom"],
12371
- props: {
12372
- numArgs: 1,
12373
- allowedInText: true
12374
- },
12216
+ numArgs: 1,
12217
+ allowedInText: true,
12375
12218
  handler: (_ref, args) => {
12376
12219
  var {
12377
12220
  parser
@@ -12398,10 +12241,8 @@ defineMacro("\\hphantom", "\\smash{\\phantom{#1}}");
12398
12241
  defineFunction({
12399
12242
  type: "vphantom",
12400
12243
  names: ["\\vphantom"],
12401
- props: {
12402
- numArgs: 1,
12403
- allowedInText: true
12404
- },
12244
+ numArgs: 1,
12245
+ allowedInText: true,
12405
12246
  handler: (_ref2, args) => {
12406
12247
  var {
12407
12248
  parser
@@ -12431,11 +12272,9 @@ defineFunction({
12431
12272
  defineFunction({
12432
12273
  type: "raisebox",
12433
12274
  names: ["\\raisebox"],
12434
- props: {
12435
- numArgs: 2,
12436
- argTypes: ["size", "hbox"],
12437
- allowedInText: true
12438
- },
12275
+ numArgs: 2,
12276
+ argTypes: ["size", "hbox"],
12277
+ allowedInText: true,
12439
12278
  handler(_ref, args) {
12440
12279
  var {
12441
12280
  parser
@@ -12472,11 +12311,9 @@ defineFunction({
12472
12311
  defineFunction({
12473
12312
  type: "internal",
12474
12313
  names: ["\\relax"],
12475
- props: {
12476
- numArgs: 0,
12477
- allowedInText: true,
12478
- allowedInArgument: true
12479
- },
12314
+ numArgs: 0,
12315
+ allowedInText: true,
12316
+ allowedInArgument: true,
12480
12317
  handler(_ref) {
12481
12318
  var {
12482
12319
  parser
@@ -12491,13 +12328,11 @@ defineFunction({
12491
12328
  defineFunction({
12492
12329
  type: "rule",
12493
12330
  names: ["\\rule"],
12494
- props: {
12495
- numArgs: 2,
12496
- numOptionalArgs: 1,
12497
- allowedInText: true,
12498
- allowedInMath: true,
12499
- argTypes: ["size", "size", "size"]
12500
- },
12331
+ numArgs: 2,
12332
+ numOptionalArgs: 1,
12333
+ allowedInText: true,
12334
+ allowedInMath: true,
12335
+ argTypes: ["size", "size", "size"],
12501
12336
  handler(_ref, args, optArgs) {
12502
12337
  var {
12503
12338
  parser
@@ -12586,10 +12421,8 @@ var htmlBuilder = (group, options) => {
12586
12421
  defineFunction({
12587
12422
  type: "sizing",
12588
12423
  names: sizeFuncs,
12589
- props: {
12590
- numArgs: 0,
12591
- allowedInText: true
12592
- },
12424
+ numArgs: 0,
12425
+ allowedInText: true,
12593
12426
  handler: (_ref, args) => {
12594
12427
  var {
12595
12428
  breakOnTokenText,
@@ -12624,11 +12457,9 @@ defineFunction({
12624
12457
  defineFunction({
12625
12458
  type: "smash",
12626
12459
  names: ["\\smash"],
12627
- props: {
12628
- numArgs: 1,
12629
- numOptionalArgs: 1,
12630
- allowedInText: true
12631
- },
12460
+ numArgs: 1,
12461
+ numOptionalArgs: 1,
12462
+ allowedInText: true,
12632
12463
  handler: (_ref, args, optArgs) => {
12633
12464
  var {
12634
12465
  parser
@@ -12723,10 +12554,8 @@ defineFunction({
12723
12554
  defineFunction({
12724
12555
  type: "sqrt",
12725
12556
  names: ["\\sqrt"],
12726
- props: {
12727
- numArgs: 1,
12728
- numOptionalArgs: 1
12729
- },
12557
+ numArgs: 1,
12558
+ numOptionalArgs: 1,
12730
12559
  handler(_ref, args, optArgs) {
12731
12560
  var {
12732
12561
  parser
@@ -12840,11 +12669,9 @@ function isStyleStr(s) {
12840
12669
  defineFunction({
12841
12670
  type: "styling",
12842
12671
  names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
12843
- props: {
12844
- numArgs: 0,
12845
- allowedInText: true,
12846
- primitive: true
12847
- },
12672
+ numArgs: 0,
12673
+ allowedInText: true,
12674
+ primitive: true,
12848
12675
  handler(_ref, args) {
12849
12676
  var {
12850
12677
  breakOnTokenText,
@@ -13148,7 +12975,7 @@ var defaultVariant = {
13148
12975
  defineFunctionBuilders({
13149
12976
  type: "mathord",
13150
12977
  htmlBuilder(group, options) {
13151
- return makeOrd(group, options, "mathord");
12978
+ return makeOrd(group, options);
13152
12979
  },
13153
12980
  mathmlBuilder(group, options) {
13154
12981
  var node = new MathNode("mi", [makeText(group.text, group.mode, options)]);
@@ -13162,7 +12989,7 @@ defineFunctionBuilders({
13162
12989
  defineFunctionBuilders({
13163
12990
  type: "textord",
13164
12991
  htmlBuilder(group, options) {
13165
- return makeOrd(group, options, "textord");
12992
+ return makeOrd(group, options);
13166
12993
  },
13167
12994
  mathmlBuilder(group, options) {
13168
12995
  var text = makeText(group.text, group.mode, options);
@@ -13216,7 +13043,7 @@ defineFunctionBuilders({
13216
13043
  // things has an entry in the symbols table, so these will be turned
13217
13044
  // into appropriate outputs.
13218
13045
  if (group.mode === "text") {
13219
- var ord = makeOrd(group, options, "textord");
13046
+ var ord = makeOrd(group, options);
13220
13047
  ord.classes.push(className);
13221
13048
  return ord;
13222
13049
  } else {
@@ -13303,12 +13130,10 @@ defineFunction({
13303
13130
  "\\textbf", "\\textmd",
13304
13131
  // Font Shapes
13305
13132
  "\\textit", "\\textup", "\\emph"],
13306
- props: {
13307
- numArgs: 1,
13308
- argTypes: ["text"],
13309
- allowedInArgument: true,
13310
- allowedInText: true
13311
- },
13133
+ numArgs: 1,
13134
+ argTypes: ["text"],
13135
+ allowedInArgument: true,
13136
+ allowedInText: true,
13312
13137
  handler(_ref, args) {
13313
13138
  var {
13314
13139
  parser,
@@ -13336,10 +13161,8 @@ defineFunction({
13336
13161
  defineFunction({
13337
13162
  type: "underline",
13338
13163
  names: ["\\underline"],
13339
- props: {
13340
- numArgs: 1,
13341
- allowedInText: true
13342
- },
13164
+ numArgs: 1,
13165
+ allowedInText: true,
13343
13166
  handler(_ref, args) {
13344
13167
  var {
13345
13168
  parser
@@ -13390,12 +13213,10 @@ defineFunction({
13390
13213
  defineFunction({
13391
13214
  type: "vcenter",
13392
13215
  names: ["\\vcenter"],
13393
- props: {
13394
- numArgs: 1,
13395
- argTypes: ["original"],
13396
- // In LaTeX, \vcenter can act only on a box.
13397
- allowedInText: false
13398
- },
13216
+ numArgs: 1,
13217
+ argTypes: ["original"],
13218
+ // In LaTeX, \vcenter can act only on a box.
13219
+ allowedInText: false,
13399
13220
  handler(_ref, args) {
13400
13221
  var {
13401
13222
  parser
@@ -13432,10 +13253,8 @@ defineFunction({
13432
13253
  defineFunction({
13433
13254
  type: "verb",
13434
13255
  names: ["\\verb"],
13435
- props: {
13436
- numArgs: 0,
13437
- allowedInText: true
13438
- },
13256
+ numArgs: 0,
13257
+ allowedInText: true,
13439
13258
  handler(context, args, optArgs) {
13440
13259
  // \verb and \verb* are dealt with directly in Parser.js.
13441
13260
  // If we end up here, it's because of a failure to match the two delimiters
@@ -15812,7 +15631,7 @@ class Parser {
15812
15631
  // \left(x\right)^2 work correctly.
15813
15632
  var base = this.parseGroup("atom", breakOnTokenText);
15814
15633
  // Internal nodes (e.g. \relax) cannot support super/subscripts.
15815
- // Instead we will pick up super/subscripts with blank base next round.
15634
+ // Instead, we will pick up super/subscripts with blank base next round.
15816
15635
  if ((base == null ? void 0 : base.type) === "internal") {
15817
15636
  return base;
15818
15637
  }
@@ -15820,7 +15639,6 @@ class Parser {
15820
15639
  if (this.mode === "text") {
15821
15640
  return base;
15822
15641
  }
15823
- // Note that base may be empty (i.e. null) at this point.
15824
15642
  var superscript;
15825
15643
  var subscript;
15826
15644
  while (true) {
@@ -15831,8 +15649,7 @@ class Parser {
15831
15649
  if (lex.text === "\\limits" || lex.text === "\\nolimits") {
15832
15650
  // We got a limit control
15833
15651
  if (base && base.type === "op") {
15834
- var limits = lex.text === "\\limits";
15835
- base.limits = limits;
15652
+ base.limits = lex.text === "\\limits";
15836
15653
  base.alwaysHandleSupSub = true;
15837
15654
  } else if (base && base.type === "operatorname") {
15838
15655
  if (base.alwaysHandleSupSub) {
@@ -15927,15 +15744,28 @@ class Parser {
15927
15744
  }
15928
15745
  // Base must be set if superscript or subscript are set per logic above,
15929
15746
  // but need to check here for type check to pass.
15930
- if (superscript || subscript) {
15931
- // If we got either a superscript or subscript, create a supsub
15747
+ if (superscript && subscript) {
15932
15748
  return {
15933
15749
  type: "supsub",
15934
15750
  mode: this.mode,
15935
- base: base,
15751
+ base,
15936
15752
  sup: superscript,
15937
15753
  sub: subscript
15938
15754
  };
15755
+ } else if (superscript) {
15756
+ return {
15757
+ type: "supsub",
15758
+ mode: this.mode,
15759
+ base,
15760
+ sup: superscript
15761
+ };
15762
+ } else if (subscript) {
15763
+ return {
15764
+ type: "supsub",
15765
+ mode: this.mode,
15766
+ base,
15767
+ sub: subscript
15768
+ };
15939
15769
  } else {
15940
15770
  // Otherwise return the original body
15941
15771
  return base;
@@ -15954,8 +15784,10 @@ class Parser {
15954
15784
  this.consume(); // consume command token
15955
15785
  if (name && name !== "atom" && !funcData.allowedInArgument) {
15956
15786
  throw new ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token);
15787
+ // Treat undefined allowedInText as false.
15957
15788
  } else if (this.mode === "text" && !funcData.allowedInText) {
15958
15789
  throw new ParseError("Can't use function '" + func + "' in text mode", token);
15790
+ // Treat undefined allowedInMath as true.
15959
15791
  } else if (this.mode === "math" && funcData.allowedInMath === false) {
15960
15792
  throw new ParseError("Can't use function '" + func + "' in math mode", token);
15961
15793
  }
@@ -15988,7 +15820,9 @@ class Parser {
15988
15820
  parseArguments(func,
15989
15821
  // Should look like "\name" or "\begin{name}".
15990
15822
  funcData) {
15991
- var totalArgs = funcData.numArgs + funcData.numOptionalArgs;
15823
+ var _funcData$numOptional;
15824
+ var numOptionalArgs = (_funcData$numOptional = funcData.numOptionalArgs) != null ? _funcData$numOptional : 0;
15825
+ var totalArgs = funcData.numArgs + numOptionalArgs;
15992
15826
  if (totalArgs === 0) {
15993
15827
  return {
15994
15828
  args: [],
@@ -15998,8 +15832,9 @@ class Parser {
15998
15832
  var args = [];
15999
15833
  var optArgs = [];
16000
15834
  for (var i = 0; i < totalArgs; i++) {
16001
- var argType = funcData.argTypes && funcData.argTypes[i];
16002
- var isOptional = i < funcData.numOptionalArgs;
15835
+ var _funcData$argTypes;
15836
+ var argType = (_funcData$argTypes = funcData.argTypes) == null ? void 0 : _funcData$argTypes[i];
15837
+ var isOptional = i < numOptionalArgs;
16003
15838
  if ("primitive" in funcData && funcData.primitive && argType == null ||
16004
15839
  // \sqrt expands into primitive if optional argument doesn't exist
16005
15840
  funcData.type === "sqrt" && i === 1 && optArgs[0] == null) {
@@ -16051,7 +15886,7 @@ class Parser {
16051
15886
  }
16052
15887
  case "raw":
16053
15888
  {
16054
- var token = this.parseStringGroup("raw", optional);
15889
+ var token = this.parseStringGroup(optional);
16055
15890
  return token != null ? {
16056
15891
  type: "raw",
16057
15892
  mode: "text",
@@ -16070,7 +15905,6 @@ class Parser {
16070
15905
  return _group2;
16071
15906
  }
16072
15907
  case "original":
16073
- case null:
16074
15908
  case undefined:
16075
15909
  return this.parseArgumentGroup(optional);
16076
15910
  default:
@@ -16089,9 +15923,7 @@ class Parser {
16089
15923
  * Parses a group, essentially returning the string formed by the
16090
15924
  * brace-enclosed tokens plus some position information.
16091
15925
  */
16092
- parseStringGroup(modeName,
16093
- // Used to describe the mode in error messages.
16094
- optional) {
15926
+ parseStringGroup(optional) {
16095
15927
  var argToken = this.gullet.scanArgument(optional);
16096
15928
  if (argToken == null) {
16097
15929
  return null;
@@ -16130,7 +15962,7 @@ class Parser {
16130
15962
  * Parses a color description.
16131
15963
  */
16132
15964
  parseColorGroup(optional) {
16133
- var res = this.parseStringGroup("color", optional);
15965
+ var res = this.parseStringGroup(optional);
16134
15966
  if (res == null) {
16135
15967
  return null;
16136
15968
  }
@@ -16162,7 +15994,7 @@ class Parser {
16162
15994
  if (!optional && this.gullet.future().text !== "{") {
16163
15995
  res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size");
16164
15996
  } else {
16165
- res = this.parseStringGroup("size", optional);
15997
+ res = this.parseStringGroup(optional);
16166
15998
  }
16167
15999
  if (!res) {
16168
16000
  return null;
@@ -16200,7 +16032,7 @@ class Parser {
16200
16032
  parseUrlGroup(optional) {
16201
16033
  this.gullet.lexer.setCatcode("%", 13); // active character
16202
16034
  this.gullet.lexer.setCatcode("~", 12); // other character
16203
- var res = this.parseStringGroup("url", optional);
16035
+ var res = this.parseStringGroup(optional);
16204
16036
  this.gullet.lexer.setCatcode("%", 14); // comment character
16205
16037
  this.gullet.lexer.setCatcode("~", 13); // active character
16206
16038
  if (res == null) {
@@ -16470,10 +16302,6 @@ class Parser {
16470
16302
  }
16471
16303
  Parser.endOfExpression = new Set(["}", "\\endgroup", "\\end", "\\right", "&"]);
16472
16304
 
16473
- /**
16474
- * Provides a single function for parsing an expression using a Parser
16475
- * TODO(emily): Remove this
16476
- */
16477
16305
  /**
16478
16306
  * Parses an expression using a Parser, then returns the parsed result.
16479
16307
  */
@@ -16578,7 +16406,7 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
16578
16406
  return renderError(error, expression, settings);
16579
16407
  }
16580
16408
  };
16581
- var version = "0.16.46";
16409
+ var version = "0.17.0";
16582
16410
  var __domTree = {
16583
16411
  Span,
16584
16412
  Anchor,