temml 0.11.10 → 0.12.1

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 (53) hide show
  1. package/README.md +1 -1
  2. package/dist/temml.cjs +229 -268
  3. package/dist/temml.d.ts +2 -2
  4. package/dist/temml.js +229 -268
  5. package/dist/temml.min.js +1 -1
  6. package/dist/temml.mjs +229 -268
  7. package/dist/temmlPostProcess.js +1 -1
  8. package/package.json +1 -1
  9. package/src/Settings.js +3 -3
  10. package/src/buildMathML.js +1 -1
  11. package/src/domTree.js +1 -1
  12. package/src/environments/array.js +2 -3
  13. package/src/environments/cd.js +1 -1
  14. package/src/functions/accent.js +2 -2
  15. package/src/functions/accentunder.js +2 -2
  16. package/src/functions/arrow.js +2 -2
  17. package/src/functions/cancelto.js +1 -1
  18. package/src/functions/color.js +1 -1
  19. package/src/functions/cr.js +1 -1
  20. package/src/functions/delimsizing.js +4 -1
  21. package/src/functions/enclose.js +6 -26
  22. package/src/functions/envTag.js +1 -1
  23. package/src/functions/font.js +1 -1
  24. package/src/functions/genfrac.js +1 -1
  25. package/src/functions/horizBrace.js +2 -2
  26. package/src/functions/includegraphics.js +1 -1
  27. package/src/functions/kern.js +1 -1
  28. package/src/functions/label.js +1 -1
  29. package/src/functions/lap.js +1 -1
  30. package/src/functions/mclass.js +2 -2
  31. package/src/functions/multiscript.js +1 -1
  32. package/src/functions/not.js +1 -1
  33. package/src/functions/operatorname.js +1 -1
  34. package/src/functions/phantom.js +1 -1
  35. package/src/functions/raise.js +1 -1
  36. package/src/functions/rule.js +1 -1
  37. package/src/functions/sfrac.js +1 -1
  38. package/src/functions/smash.js +1 -1
  39. package/src/functions/sqrt.js +1 -1
  40. package/src/functions/supsub.js +1 -1
  41. package/src/functions/symbolsOp.js +1 -1
  42. package/src/functions/symbolsOrd.js +1 -1
  43. package/src/functions/symbolsSpacing.js +1 -1
  44. package/src/functions/tip.js +1 -1
  45. package/src/functions/toggle.js +1 -1
  46. package/src/functions/vcenter.js +1 -1
  47. package/src/functions/verb.js +1 -1
  48. package/src/linebreaking.js +1 -1
  49. package/src/mathMLTree.js +1 -7
  50. package/src/postProcess.js +1 -1
  51. package/src/stretchy.js +3 -8
  52. package/src/units.js +1 -1
  53. package/src/utils.js +6 -16
package/dist/temml.mjs CHANGED
@@ -179,16 +179,6 @@ const round = function(n) {
179
179
  return +n.toFixed(4);
180
180
  };
181
181
 
182
- var utils = {
183
- deflt,
184
- escape,
185
- hyphenate,
186
- getBaseElem,
187
- isCharacterBox,
188
- protocolFromUrl,
189
- round
190
- };
191
-
192
182
  /**
193
183
  * This is a module for storing settings passed into Temml. It correctly handles
194
184
  * default settings.
@@ -202,24 +192,24 @@ class Settings {
202
192
  constructor(options) {
203
193
  // allow null options
204
194
  options = options || {};
205
- this.displayMode = utils.deflt(options.displayMode, false); // boolean
206
- this.annotate = utils.deflt(options.annotate, false); // boolean
207
- this.leqno = utils.deflt(options.leqno, false); // boolean
208
- this.throwOnError = utils.deflt(options.throwOnError, false); // boolean
209
- this.errorColor = utils.deflt(options.errorColor, "#b22222"); // string
195
+ this.displayMode = deflt(options.displayMode, false); // boolean
196
+ this.annotate = deflt(options.annotate, false); // boolean
197
+ this.leqno = deflt(options.leqno, false); // boolean
198
+ this.throwOnError = deflt(options.throwOnError, false); // boolean
199
+ this.errorColor = deflt(options.errorColor, "#b22222"); // string
210
200
  this.macros = options.macros || {};
211
- this.wrap = utils.deflt(options.wrap, "tex"); // "tex" | "="
212
- this.xml = utils.deflt(options.xml, false); // boolean
213
- this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false); // booelean
214
- this.strict = utils.deflt(options.strict, false); // boolean
215
- this.trust = utils.deflt(options.trust, false); // trust context. See html.js.
201
+ this.wrap = deflt(options.wrap, "none"); // "none" | "tex" | "="
202
+ this.xml = deflt(options.xml, false); // boolean
203
+ this.colorIsTextColor = deflt(options.colorIsTextColor, false); // boolean
204
+ this.strict = deflt(options.strict, false); // boolean
205
+ this.trust = deflt(options.trust, false); // trust context. See html.js.
216
206
  this.maxSize = (options.maxSize === undefined
217
207
  ? [Infinity, Infinity]
218
208
  : Array.isArray(options.maxSize)
219
209
  ? options.maxSize
220
210
  : [Infinity, Infinity]
221
211
  );
222
- this.maxExpand = Math.max(0, utils.deflt(options.maxExpand, 1000)); // number
212
+ this.maxExpand = Math.max(0, deflt(options.maxExpand, 1000)); // number
223
213
  }
224
214
 
225
215
  /**
@@ -232,7 +222,7 @@ class Settings {
232
222
  */
233
223
  isTrusted(context) {
234
224
  if (context.url && !context.protocol) {
235
- const protocol = utils.protocolFromUrl(context.url);
225
+ const protocol = protocolFromUrl(context.url);
236
226
  if (protocol == null) {
237
227
  return false
238
228
  }
@@ -428,7 +418,7 @@ const toMarkup = function(tagName) {
428
418
 
429
419
  // Add the class
430
420
  if (this.classes.length) {
431
- markup += ` class="${utils.escape(createClass(this.classes))}"`;
421
+ markup += ` class="${escape(createClass(this.classes))}"`;
432
422
  }
433
423
 
434
424
  let styles = "";
@@ -436,7 +426,7 @@ const toMarkup = function(tagName) {
436
426
  // Add the styles, after hyphenation
437
427
  for (const style in this.style) {
438
428
  if (Object.prototype.hasOwnProperty.call(this.style, style )) {
439
- styles += `${utils.hyphenate(style)}:${this.style[style]};`;
429
+ styles += `${hyphenate(style)}:${this.style[style]};`;
440
430
  }
441
431
  }
442
432
 
@@ -447,7 +437,7 @@ const toMarkup = function(tagName) {
447
437
  // Add the attributes
448
438
  for (const attr in this.attributes) {
449
439
  if (Object.prototype.hasOwnProperty.call(this.attributes, attr )) {
450
- markup += ` ${attr}="${utils.escape(this.attributes[attr])}"`;
440
+ markup += ` ${attr}="${escape(this.attributes[attr])}"`;
451
441
  }
452
442
  }
453
443
 
@@ -495,7 +485,7 @@ let TextNode$1 = class TextNode {
495
485
  return document.createTextNode(this.text);
496
486
  }
497
487
  toMarkup() {
498
- return utils.escape(this.text);
488
+ return escape(this.text);
499
489
  }
500
490
  };
501
491
 
@@ -520,9 +510,9 @@ class AnchorNode {
520
510
  }
521
511
 
522
512
  toMarkup() {
523
- let markup = `<a href='${utils.escape(this.href)}'`;
513
+ let markup = `<a href='${escape(this.href)}'`;
524
514
  if (this.classes.length > 0) {
525
- markup += ` class="${utils.escape(createClass(this.classes))}"`;
515
+ markup += ` class="${escape(createClass(this.classes))}"`;
526
516
  }
527
517
  markup += ">";
528
518
  for (let i = 0; i < this.children.length; i++) {
@@ -571,11 +561,11 @@ class Img {
571
561
  let styles = "";
572
562
  for (const style in this.style) {
573
563
  if (Object.prototype.hasOwnProperty.call(this.style, style )) {
574
- styles += `${utils.hyphenate(style)}:${this.style[style]};`;
564
+ styles += `${hyphenate(style)}:${this.style[style]};`;
575
565
  }
576
566
  }
577
567
  if (styles) {
578
- markup += ` style="${utils.escape(styles)}"`;
568
+ markup += ` style="${escape(styles)}"`;
579
569
  }
580
570
 
581
571
  markup += ">";
@@ -669,13 +659,13 @@ class MathNode {
669
659
  for (const attr in this.attributes) {
670
660
  if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
671
661
  markup += " " + attr + '="';
672
- markup += utils.escape(this.attributes[attr]);
662
+ markup += escape(this.attributes[attr]);
673
663
  markup += '"';
674
664
  }
675
665
  }
676
666
 
677
667
  if (this.classes.length > 0) {
678
- markup += ` class="${utils.escape(createClass(this.classes))}"`;
668
+ markup += ` class="${escape(createClass(this.classes))}"`;
679
669
  }
680
670
 
681
671
  let styles = "";
@@ -683,7 +673,7 @@ class MathNode {
683
673
  // Add the styles, after hyphenation
684
674
  for (const style in this.style) {
685
675
  if (Object.prototype.hasOwnProperty.call(this.style, style )) {
686
- styles += `${utils.hyphenate(style)}:${this.style[style]};`;
676
+ styles += `${hyphenate(style)}:${this.style[style]};`;
687
677
  }
688
678
  }
689
679
 
@@ -730,7 +720,7 @@ class TextNode {
730
720
  * (representing the text itself).
731
721
  */
732
722
  toMarkup() {
733
- return utils.escape(this.toText());
723
+ return escape(this.toText());
734
724
  }
735
725
 
736
726
  /**
@@ -755,12 +745,6 @@ const wrapWithMstyle = expression => {
755
745
  return node
756
746
  };
757
747
 
758
- var mathMLTree = {
759
- MathNode,
760
- TextNode,
761
- newDocumentFragment
762
- };
763
-
764
748
  /**
765
749
  * This file provides support for building horizontal stretchy elements.
766
750
  */
@@ -852,8 +836,8 @@ const stretchyCodePoint = {
852
836
  };
853
837
 
854
838
  const mathMLnode = function(label) {
855
- const child = new mathMLTree.TextNode(stretchyCodePoint[label.slice(1)]);
856
- const node = new mathMLTree.MathNode("mo", [child]);
839
+ const child = new TextNode(stretchyCodePoint[label.slice(1)]);
840
+ const node = new MathNode("mo", [child]);
857
841
  node.setAttribute("stretchy", "true");
858
842
  return node
859
843
  };
@@ -876,11 +860,6 @@ const accentNode = (group) => {
876
860
  return mo
877
861
  };
878
862
 
879
- var stretchy = {
880
- mathMLnode,
881
- accentNode
882
- };
883
-
884
863
  /**
885
864
  * This file holds a list of all no-argument functions and single-character
886
865
  * symbols (like 'a' or ';').
@@ -2034,13 +2013,13 @@ function setLineBreaks(expression, wrapMode, isDisplayMode) {
2034
2013
  node.attributes.linebreak === "newline") {
2035
2014
  // A hard line break. Create a <mtr> for the current block.
2036
2015
  if (block.length > 0) {
2037
- mrows.push(new mathMLTree.MathNode("mrow", block));
2016
+ mrows.push(new MathNode("mrow", block));
2038
2017
  }
2039
2018
  mrows.push(node);
2040
2019
  block = [];
2041
- const mtd = new mathMLTree.MathNode("mtd", mrows);
2020
+ const mtd = new MathNode("mtd", mrows);
2042
2021
  mtd.style.textAlign = "left";
2043
- mtrs.push(new mathMLTree.MathNode("mtr", [mtd]));
2022
+ mtrs.push(new MathNode("mtr", [mtd]));
2044
2023
  mrows = [];
2045
2024
  i += 1;
2046
2025
  continue
@@ -2058,7 +2037,7 @@ function setLineBreaks(expression, wrapMode, isDisplayMode) {
2058
2037
  if (numTopLevelEquals > 1) {
2059
2038
  block.pop();
2060
2039
  // Start a new block. (Insert a soft linebreak.)
2061
- const element = new mathMLTree.MathNode("mrow", block);
2040
+ const element = new MathNode("mrow", block);
2062
2041
  mrows.push(element);
2063
2042
  block = [node];
2064
2043
  }
@@ -2099,7 +2078,7 @@ function setLineBreaks(expression, wrapMode, isDisplayMode) {
2099
2078
  }
2100
2079
  if (glueIsFreeOfNobreak) {
2101
2080
  // Start a new block. (Insert a soft linebreak.)
2102
- const element = new mathMLTree.MathNode("mrow", block);
2081
+ const element = new MathNode("mrow", block);
2103
2082
  mrows.push(element);
2104
2083
  block = [];
2105
2084
  }
@@ -2108,22 +2087,22 @@ function setLineBreaks(expression, wrapMode, isDisplayMode) {
2108
2087
  i += 1;
2109
2088
  }
2110
2089
  if (block.length > 0) {
2111
- const element = new mathMLTree.MathNode("mrow", block);
2090
+ const element = new MathNode("mrow", block);
2112
2091
  mrows.push(element);
2113
2092
  }
2114
2093
  if (mtrs.length > 0) {
2115
- const mtd = new mathMLTree.MathNode("mtd", mrows);
2094
+ const mtd = new MathNode("mtd", mrows);
2116
2095
  mtd.style.textAlign = "left";
2117
- const mtr = new mathMLTree.MathNode("mtr", [mtd]);
2096
+ const mtr = new MathNode("mtr", [mtd]);
2118
2097
  mtrs.push(mtr);
2119
- const mtable = new mathMLTree.MathNode("mtable", mtrs);
2098
+ const mtable = new MathNode("mtable", mtrs);
2120
2099
  if (!isDisplayMode) {
2121
2100
  mtable.setAttribute("columnalign", "left");
2122
2101
  mtable.setAttribute("rowspacing", "0em");
2123
2102
  }
2124
2103
  return mtable
2125
2104
  }
2126
- return mathMLTree.newDocumentFragment(mrows);
2105
+ return newDocumentFragment(mrows);
2127
2106
  }
2128
2107
 
2129
2108
  /**
@@ -2152,15 +2131,15 @@ const makeText = function(text, mode, style) {
2152
2131
  text = symbols[mode][text].replace;
2153
2132
  }
2154
2133
 
2155
- return new mathMLTree.TextNode(text);
2134
+ return new TextNode(text);
2156
2135
  };
2157
2136
 
2158
2137
  const copyChar = (newRow, child) => {
2159
2138
  if (newRow.children.length === 0 ||
2160
2139
  newRow.children[newRow.children.length - 1].type !== "mtext") {
2161
- const mtext = new mathMLTree.MathNode(
2140
+ const mtext = new MathNode(
2162
2141
  "mtext",
2163
- [new mathMLTree.TextNode(child.children[0].text)]
2142
+ [new TextNode(child.children[0].text)]
2164
2143
  );
2165
2144
  newRow.children.push(mtext);
2166
2145
  } else {
@@ -2172,7 +2151,7 @@ const consolidateText = mrow => {
2172
2151
  // If possible, consolidate adjacent <mtext> elements into a single element.
2173
2152
  if (mrow.type !== "mrow" && mrow.type !== "mstyle") { return mrow }
2174
2153
  if (mrow.children.length === 0) { return mrow } // empty group, e.g., \text{}
2175
- const newRow = new mathMLTree.MathNode("mrow");
2154
+ const newRow = new MathNode("mrow");
2176
2155
  for (let i = 0; i < mrow.children.length; i++) {
2177
2156
  const child = mrow.children[i];
2178
2157
  if (child.type === "mtext" && Object.keys(child.attributes).length === 0) {
@@ -2242,7 +2221,7 @@ const makeRow = function(body, semisimple = false) {
2242
2221
  body[end].attributes.rspace = "0em";
2243
2222
  }
2244
2223
  }
2245
- return new mathMLTree.MathNode("mrow", body);
2224
+ return new MathNode("mrow", body);
2246
2225
  };
2247
2226
 
2248
2227
  /**
@@ -2367,7 +2346,7 @@ const buildExpressionRow = function(expression, style, semisimple = false) {
2367
2346
  */
2368
2347
  const buildGroup$1 = function(group, style) {
2369
2348
  if (!group) {
2370
- return new mathMLTree.MathNode("mrow");
2349
+ return new MathNode("mrow");
2371
2350
  }
2372
2351
 
2373
2352
  if (_mathmlGroupBuilders[group.type]) {
@@ -2380,7 +2359,7 @@ const buildGroup$1 = function(group, style) {
2380
2359
  };
2381
2360
 
2382
2361
  const glue$1 = _ => {
2383
- return new mathMLTree.MathNode("mtd", [], [], { padding: "0", width: "50%" })
2362
+ return new MathNode("mtd", [], [], { padding: "0", width: "50%" })
2384
2363
  };
2385
2364
 
2386
2365
  const labelContainers = ["mrow", "mtd", "mtable", "mtr"];
@@ -2407,12 +2386,12 @@ const taggedExpression = (expression, tag, style, leqno) => {
2407
2386
  tag.classes.push("tml-tag"); // to be available for \ref
2408
2387
 
2409
2388
  const label = getLabel(expression); // from a \label{} function.
2410
- expression = new mathMLTree.MathNode("mtd", [expression]);
2389
+ expression = new MathNode("mtd", [expression]);
2411
2390
  const rowArray = [glue$1(), expression, glue$1()];
2412
2391
  rowArray[leqno ? 0 : 2].children.push(tag);
2413
- const mtr = new mathMLTree.MathNode("mtr", rowArray, ["tml-tageqn"]);
2392
+ const mtr = new MathNode("mtr", rowArray, ["tml-tageqn"]);
2414
2393
  if (label) { mtr.setAttribute("id", label); }
2415
- const table = new mathMLTree.MathNode("mtable", [mtr]);
2394
+ const table = new MathNode("mtable", [mtr]);
2416
2395
  table.style.width = "100%";
2417
2396
  table.setAttribute("displaystyle", "true");
2418
2397
  return table
@@ -2449,13 +2428,13 @@ function buildMathML(tree, texExpression, style, settings) {
2449
2428
 
2450
2429
  if (settings.annotate) {
2451
2430
  // Build a TeX annotation of the source
2452
- const annotation = new mathMLTree.MathNode(
2453
- "annotation", [new mathMLTree.TextNode(texExpression)]);
2431
+ const annotation = new MathNode(
2432
+ "annotation", [new TextNode(texExpression)]);
2454
2433
  annotation.setAttribute("encoding", "application/x-tex");
2455
- wrapper = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
2434
+ wrapper = new MathNode("semantics", [wrapper, annotation]);
2456
2435
  }
2457
2436
 
2458
- const math = new mathMLTree.MathNode("math", [wrapper]);
2437
+ const math = new MathNode("math", [wrapper]);
2459
2438
 
2460
2439
  if (settings.xml) {
2461
2440
  math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
@@ -2479,14 +2458,14 @@ const mediumNudge = "BCEGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ";
2479
2458
  const largeNudge = "AFJdfΔΛ";
2480
2459
 
2481
2460
  const mathmlBuilder$a = (group, style) => {
2482
- const accentNode = group.isStretchy
2483
- ? stretchy.accentNode(group)
2484
- : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]);
2461
+ const accentNode$1 = group.isStretchy
2462
+ ? accentNode(group)
2463
+ : new MathNode("mo", [makeText(group.label, group.mode)]);
2485
2464
  if (!group.isStretchy) {
2486
- accentNode.setAttribute("stretchy", "false"); // Keep Firefox from stretching \check
2465
+ accentNode$1.setAttribute("stretchy", "false"); // Keep Firefox from stretching \check
2487
2466
  }
2488
2467
  if (group.label !== "\\vec") {
2489
- accentNode.style.mathDepth = "0"; // not scriptstyle
2468
+ accentNode$1.style.mathDepth = "0"; // not scriptstyle
2490
2469
  // Don't use attribute accent="true" because MathML Core eliminates a needed space.
2491
2470
  }
2492
2471
  const tag = group.label === "\\c" ? "munder" : "mover";
@@ -2497,28 +2476,28 @@ const mathmlBuilder$a = (group, style) => {
2497
2476
  const isVec = group.label === "\\vec";
2498
2477
  const vecPostfix = isVec === "\\vec" ? "-vec" : "";
2499
2478
  if (isVec) {
2500
- accentNode.classes.push("tml-vec"); // Firefox sizing of \vec arrow
2479
+ accentNode$1.classes.push("tml-vec"); // Firefox sizing of \vec arrow
2501
2480
  }
2502
2481
  const wbkPostfix = isVec ? "-vec" : needsWbkVertShift ? "-acc" : "";
2503
2482
  if (smallNudge.indexOf(text) > -1) {
2504
- accentNode.classes.push(`chr-sml${vecPostfix}`);
2505
- accentNode.classes.push(`wbk-sml${wbkPostfix}`);
2483
+ accentNode$1.classes.push(`chr-sml${vecPostfix}`);
2484
+ accentNode$1.classes.push(`wbk-sml${wbkPostfix}`);
2506
2485
  } else if (mediumNudge.indexOf(text) > -1) {
2507
- accentNode.classes.push(`chr-med${vecPostfix}`);
2508
- accentNode.classes.push(`wbk-med${wbkPostfix}`);
2486
+ accentNode$1.classes.push(`chr-med${vecPostfix}`);
2487
+ accentNode$1.classes.push(`wbk-med${wbkPostfix}`);
2509
2488
  } else if (largeNudge.indexOf(text) > -1) {
2510
- accentNode.classes.push(`chr-lrg${vecPostfix}`);
2511
- accentNode.classes.push(`wbk-lrg${wbkPostfix}`);
2489
+ accentNode$1.classes.push(`chr-lrg${vecPostfix}`);
2490
+ accentNode$1.classes.push(`wbk-lrg${wbkPostfix}`);
2512
2491
  } else if (isVec) {
2513
- accentNode.classes.push(`wbk-vec`);
2492
+ accentNode$1.classes.push(`wbk-vec`);
2514
2493
  } else if (needsWbkVertShift) {
2515
- accentNode.classes.push(`wbk-acc`);
2494
+ accentNode$1.classes.push(`wbk-acc`);
2516
2495
  }
2517
2496
  } else if (needsWbkVertShift) {
2518
2497
  // text-mode accents
2519
- accentNode.classes.push("wbk-acc");
2498
+ accentNode$1.classes.push("wbk-acc");
2520
2499
  }
2521
- const node = new mathMLTree.MathNode(tag, [buildGroup$1(group.base, style), accentNode]);
2500
+ const node = new MathNode(tag, [buildGroup$1(group.base, style), accentNode$1]);
2522
2501
  return node;
2523
2502
  };
2524
2503
 
@@ -2685,11 +2664,11 @@ defineFunction({
2685
2664
  };
2686
2665
  },
2687
2666
  mathmlBuilder: (group, style) => {
2688
- const accentNode = stretchy.accentNode(group);
2689
- accentNode.style["math-depth"] = 0;
2690
- const node = new mathMLTree.MathNode("munder", [
2667
+ const accentNode$1 = accentNode(group);
2668
+ accentNode$1.style["math-depth"] = 0;
2669
+ const node = new MathNode("munder", [
2691
2670
  buildGroup$1(group.base, style),
2692
- accentNode
2671
+ accentNode$1
2693
2672
  ]);
2694
2673
  return node;
2695
2674
  }
@@ -2778,7 +2757,7 @@ const calculateSize = function(sizeValue, style) {
2778
2757
  // In TeX, em and ex do not change size in \scriptstyle.
2779
2758
  if (unit === "ex") { number *= 0.431; }
2780
2759
  number = Math.min(number / emScale(style.level), style.maxSize[0]);
2781
- return { number: utils.round(number), unit: "em" };
2760
+ return { number: round(number), unit: "em" };
2782
2761
  }
2783
2762
  case "bp": {
2784
2763
  if (number > style.maxSize[1]) { number = style.maxSize[1]; }
@@ -2792,11 +2771,11 @@ const calculateSize = function(sizeValue, style) {
2792
2771
  case "nc":
2793
2772
  case "sp": {
2794
2773
  number = Math.min(number * ptPerUnit[unit], style.maxSize[1]);
2795
- return { number: utils.round(number), unit: "pt" }
2774
+ return { number: round(number), unit: "pt" }
2796
2775
  }
2797
2776
  case "mu": {
2798
2777
  number = Math.min(number / 18, style.maxSize[0]);
2799
- return { number: utils.round(number), unit: "em" }
2778
+ return { number: round(number), unit: "em" }
2800
2779
  }
2801
2780
  default:
2802
2781
  throw new ParseError("Invalid unit: '" + unit + "'")
@@ -2805,31 +2784,31 @@ const calculateSize = function(sizeValue, style) {
2805
2784
 
2806
2785
  // Helper functions
2807
2786
 
2808
- const padding$1 = width => {
2809
- const node = new mathMLTree.MathNode("mspace");
2787
+ const padding = width => {
2788
+ const node = new MathNode("mspace");
2810
2789
  node.setAttribute("width", width + "em");
2811
2790
  return node
2812
2791
  };
2813
2792
 
2814
2793
  const paddedNode = (group, lspace = 0.3, rspace = 0, mustSmash = false) => {
2815
- if (group == null && rspace === 0) { return padding$1(lspace) }
2794
+ if (group == null && rspace === 0) { return padding(lspace) }
2816
2795
  const row = group ? [group] : [];
2817
- if (lspace !== 0) { row.unshift(padding$1(lspace)); }
2818
- if (rspace > 0) { row.push(padding$1(rspace)); }
2796
+ if (lspace !== 0) { row.unshift(padding(lspace)); }
2797
+ if (rspace > 0) { row.push(padding(rspace)); }
2819
2798
  if (mustSmash) {
2820
2799
  // Used for the bottom arrow in a {CD} environment
2821
- const mpadded = new mathMLTree.MathNode("mpadded", row);
2800
+ const mpadded = new MathNode("mpadded", row);
2822
2801
  mpadded.setAttribute("height", "0.1px"); // Don't use 0. WebKit would hide it.
2823
2802
  return mpadded
2824
2803
  } else {
2825
- return new mathMLTree.MathNode("mrow", row)
2804
+ return new MathNode("mrow", row)
2826
2805
  }
2827
2806
  };
2828
2807
 
2829
2808
  const labelSize = (size, scriptLevel) => Number(size) / emScale(scriptLevel);
2830
2809
 
2831
2810
  const munderoverNode = (fName, body, below, style) => {
2832
- const arrowNode = stretchy.mathMLnode(fName);
2811
+ const arrowNode = mathMLnode(fName);
2833
2812
  // Is this the short part of a mhchem equilibrium arrow?
2834
2813
  const isEq = fName.slice(1, 3) === "eq";
2835
2814
  const minWidth = fName.charAt(1) === "x"
@@ -2868,25 +2847,25 @@ const munderoverNode = (fName, body, below, style) => {
2868
2847
  // Since Firefox does not support minsize, stack a invisible node
2869
2848
  // on top of the label. Its width will serve as a min-width.
2870
2849
  // TODO: Refactor this after Firefox supports minsize.
2871
- upperNode = new mathMLTree.MathNode("mover", [label, dummyNode]);
2850
+ upperNode = new MathNode("mover", [label, dummyNode]);
2872
2851
  }
2873
2852
  const gotLower = (below && below.body &&
2874
2853
  (below.body.body || below.body.length > 0));
2875
2854
  if (gotLower) {
2876
2855
  let label = buildGroup$1(below, labelStyle);
2877
2856
  label = paddedNode(label, space, space);
2878
- lowerNode = new mathMLTree.MathNode("munder", [label, dummyNode]);
2857
+ lowerNode = new MathNode("munder", [label, dummyNode]);
2879
2858
  }
2880
2859
 
2881
2860
  let node;
2882
2861
  if (!gotUpper && !gotLower) {
2883
- node = new mathMLTree.MathNode("mover", [arrowNode, emptyLabel]);
2862
+ node = new MathNode("mover", [arrowNode, emptyLabel]);
2884
2863
  } else if (gotUpper && gotLower) {
2885
- node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]);
2864
+ node = new MathNode("munderover", [arrowNode, lowerNode, upperNode]);
2886
2865
  } else if (gotUpper) {
2887
- node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]);
2866
+ node = new MathNode("mover", [arrowNode, upperNode]);
2888
2867
  } else {
2889
- node = new mathMLTree.MathNode("munder", [arrowNode, lowerNode]);
2868
+ node = new MathNode("munder", [arrowNode, lowerNode]);
2890
2869
  }
2891
2870
  if (minWidth === "3.0") { node.style.height = "1em"; } // CD environment
2892
2871
  node.setAttribute("accent", "false"); // Necessary for MS Word
@@ -2947,9 +2926,9 @@ defineFunction({
2947
2926
  const node = munderoverNode(group.name, group.body, group.below, style);
2948
2927
  // Create operator spacing for a relation.
2949
2928
  const row = [node];
2950
- row.unshift(padding$1(0.2778));
2951
- row.push(padding$1(0.2778));
2952
- return new mathMLTree.MathNode("mrow", row)
2929
+ row.unshift(padding(0.2778));
2930
+ row.push(padding(0.2778));
2931
+ return new MathNode("mrow", row)
2953
2932
  }
2954
2933
  });
2955
2934
 
@@ -3002,23 +2981,23 @@ defineFunction({
3002
2981
  const botArrow = munderoverNode(botLabel, group.lowerArrowBody, group.below, style);
3003
2982
  let wrapper;
3004
2983
 
3005
- const raiseNode = new mathMLTree.MathNode("mpadded", [topArrow]);
2984
+ const raiseNode = new MathNode("mpadded", [topArrow]);
3006
2985
  raiseNode.setAttribute("voffset", "0.3em");
3007
2986
  raiseNode.setAttribute("height", "+0.3em");
3008
2987
  raiseNode.setAttribute("depth", "-0.3em");
3009
2988
  // One of the arrows is given ~zero width. so the other has the same horzontal alignment.
3010
2989
  if (group.name === "\\equilibriumLeft") {
3011
- const botNode = new mathMLTree.MathNode("mpadded", [botArrow]);
2990
+ const botNode = new MathNode("mpadded", [botArrow]);
3012
2991
  botNode.setAttribute("width", "0.5em");
3013
- wrapper = new mathMLTree.MathNode(
2992
+ wrapper = new MathNode(
3014
2993
  "mpadded",
3015
- [padding$1(0.2778), botNode, raiseNode, padding$1(0.2778)]
2994
+ [padding(0.2778), botNode, raiseNode, padding(0.2778)]
3016
2995
  );
3017
2996
  } else {
3018
2997
  raiseNode.setAttribute("width", (group.name === "\\equilibriumRight" ? "0.5em" : "0"));
3019
- wrapper = new mathMLTree.MathNode(
2998
+ wrapper = new MathNode(
3020
2999
  "mpadded",
3021
- [padding$1(0.2778), raiseNode, botArrow, padding$1(0.2778)]
3000
+ [padding(0.2778), raiseNode, botArrow, padding(0.2778)]
3022
3001
  );
3023
3002
  }
3024
3003
 
@@ -3308,18 +3287,18 @@ defineFunction({
3308
3287
  },
3309
3288
  mathmlBuilder(group, style) {
3310
3289
  if (group.label.body.length === 0) {
3311
- return new mathMLTree.MathNode("mrow", style) // empty label
3290
+ return new MathNode("mrow", style) // empty label
3312
3291
  }
3313
3292
  // Abuse an <mtable> to create vertically centered content.
3314
3293
  const mrow = buildGroup$1(group.label, style);
3315
3294
  if (group.side === "left") {
3316
3295
  mrow.classes.push("tml-shift-left");
3317
3296
  }
3318
- const mtd = new mathMLTree.MathNode("mtd", [mrow]);
3297
+ const mtd = new MathNode("mtd", [mrow]);
3319
3298
  mtd.style.padding = "0";
3320
- const mtr = new mathMLTree.MathNode("mtr", [mtd]);
3321
- const mtable = new mathMLTree.MathNode("mtable", [mtr]);
3322
- const label = new mathMLTree.MathNode("mpadded", [mtable]);
3299
+ const mtr = new MathNode("mtr", [mtd]);
3300
+ const mtable = new MathNode("mtable", [mtr]);
3301
+ const label = new MathNode("mpadded", [mtable]);
3323
3302
  // Set the label width to zero so that the arrow will be centered under the corner cell.
3324
3303
  label.setAttribute("width", "0.1px"); // Don't use 0. WebKit would hide it.
3325
3304
  label.setAttribute("displaystyle", "false");
@@ -3342,7 +3321,7 @@ defineFunction({
3342
3321
  };
3343
3322
  },
3344
3323
  mathmlBuilder(group, style) {
3345
- return new mathMLTree.MathNode("mrow", [buildGroup$1(group.fragment, style)]);
3324
+ return new MathNode("mrow", [buildGroup$1(group.fragment, style)]);
3346
3325
  }
3347
3326
  });
3348
3327
 
@@ -6441,7 +6420,7 @@ const alignMap = {
6441
6420
  };
6442
6421
 
6443
6422
  const glue = group => {
6444
- const glueNode = new mathMLTree.MathNode("mtd", []);
6423
+ const glueNode = new MathNode("mtd", []);
6445
6424
  glueNode.style = { padding: "0", width: "50%" };
6446
6425
  if (group.envClasses.includes("multline")) {
6447
6426
  glueNode.style.width = "7.5%";
@@ -6464,7 +6443,7 @@ const mathmlBuilder$9 = function(group, style) {
6464
6443
  : StyleLevel.DISPLAY;
6465
6444
 
6466
6445
  for (let j = 0; j < rw.length; j++) {
6467
- const mtd = new mathMLTree.MathNode(
6446
+ const mtd = new MathNode(
6468
6447
  "mtd",
6469
6448
  [buildGroup$1(rw[j], style.withLevel(cellLevel))]
6470
6449
  );
@@ -6480,16 +6459,16 @@ const mathmlBuilder$9 = function(group, style) {
6480
6459
  const numColumns = group.body[0].length;
6481
6460
  // Fill out a short row with empty <mtd> elements.
6482
6461
  for (let k = 0; k < numColumns - rw.length; k++) {
6483
- row.push(new mathMLTree.MathNode("mtd", [], [], style));
6462
+ row.push(new MathNode("mtd", [], [], style));
6484
6463
  }
6485
6464
  if (group.autoTag) {
6486
6465
  const tag = group.tags[i];
6487
6466
  let tagElement;
6488
6467
  if (tag === true) { // automatic numbering
6489
- tagElement = new mathMLTree.MathNode("mtext", [new Span(["tml-eqn"])]);
6468
+ tagElement = new MathNode("mtext", [new Span(["tml-eqn"])]);
6490
6469
  } else if (tag === false) {
6491
6470
  // \nonumber/\notag or starred environment
6492
- tagElement = new mathMLTree.MathNode("mtext", [], []);
6471
+ tagElement = new MathNode("mtext", [], []);
6493
6472
  } else { // manual \tag
6494
6473
  tagElement = buildExpressionRow(tag[0].body, style.withLevel(cellLevel), true);
6495
6474
  tagElement = consolidateText(tagElement);
@@ -6505,7 +6484,7 @@ const mathmlBuilder$9 = function(group, style) {
6505
6484
  }
6506
6485
  }
6507
6486
  }
6508
- const mtr = new mathMLTree.MathNode("mtr", row, []);
6487
+ const mtr = new MathNode("mtr", row, []);
6509
6488
  const label = group.labels.shift();
6510
6489
  if (label && group.tags && group.tags[i]) {
6511
6490
  mtr.setAttribute("id", label);
@@ -6647,7 +6626,7 @@ const mathmlBuilder$9 = function(group, style) {
6647
6626
  }
6648
6627
  }
6649
6628
 
6650
- let table = new mathMLTree.MathNode("mtable", tbl);
6629
+ let table = new MathNode("mtable", tbl);
6651
6630
  if (group.envClasses.length > 0) {
6652
6631
  // Top & bottom padding
6653
6632
  if (group.envClasses.includes("jot")) {
@@ -6731,7 +6710,7 @@ const mathmlBuilder$9 = function(group, style) {
6731
6710
 
6732
6711
  if (group.envClasses.includes("small")) {
6733
6712
  // A small array. Wrap in scriptstyle.
6734
- table = new mathMLTree.MathNode("mstyle", [table]);
6713
+ table = new MathNode("mstyle", [table]);
6735
6714
  table.setAttribute("scriptlevel", "1");
6736
6715
  }
6737
6716
 
@@ -6978,9 +6957,8 @@ defineEnvironment({
6978
6957
  numArgs: 0
6979
6958
  },
6980
6959
  handler(context) {
6981
- const payload = { type: "small" };
6960
+ const payload = { envClasses: ["small"] };
6982
6961
  const res = parseArray(context.parser, payload, "script");
6983
- res.envClasses = ["small"];
6984
6962
  return res;
6985
6963
  },
6986
6964
  mathmlBuilder: mathmlBuilder$9
@@ -7397,13 +7375,13 @@ const mathmlBuilder$8 = (group, style) => {
7397
7375
  // the color individually to each node and return a document fragment.
7398
7376
  let expr = buildExpression(group.body, style.withColor(group.color));
7399
7377
  if (expr.length === 0) {
7400
- expr.push(new mathMLTree.MathNode("mrow"));
7378
+ expr.push(new MathNode("mrow"));
7401
7379
  }
7402
7380
  expr = expr.map(e => {
7403
7381
  e.style.color = group.color;
7404
7382
  return e
7405
7383
  });
7406
- return mathMLTree.newDocumentFragment(expr)
7384
+ return newDocumentFragment(expr)
7407
7385
  };
7408
7386
 
7409
7387
  defineFunction({
@@ -7524,7 +7502,7 @@ defineFunction({
7524
7502
  mathmlBuilder(group, style) {
7525
7503
  // MathML 3.0 calls for newline to occur in an <mo> or an <mspace>.
7526
7504
  // Ref: https://www.w3.org/TR/MathML3/chapter3.html#presm.linebreaking
7527
- const node = new mathMLTree.MathNode("mo");
7505
+ const node = new MathNode("mo");
7528
7506
  if (group.newLine) {
7529
7507
  node.setAttribute("linebreak", "newline");
7530
7508
  if (group.size) {
@@ -7906,6 +7884,9 @@ const sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0];
7906
7884
 
7907
7885
  // Delimiter functions
7908
7886
  function checkDelimiter(delim, context) {
7887
+ if (delim.type === "ordgroup" && delim.body.length === 1) {
7888
+ delim = delim.body[0]; // Unwrap the braces
7889
+ }
7909
7890
  const symDelim = checkSymbolNodeType(delim);
7910
7891
  if (symDelim && delimiters.includes(symDelim.text)) {
7911
7892
  // If a character is not in the MathML operator dictionary, it will not stretch.
@@ -7976,7 +7957,7 @@ defineFunction({
7976
7957
  if (group.delim === ".") { group.delim = ""; }
7977
7958
  children.push(makeText(group.delim, group.mode));
7978
7959
 
7979
- const node = new mathMLTree.MathNode("mo", children);
7960
+ const node = new MathNode("mo", children);
7980
7961
 
7981
7962
  if (group.mclass === "mopen" || group.mclass === "mclose") {
7982
7963
  // Only some of the delimsizing functions act as fences, and they
@@ -8070,7 +8051,7 @@ defineFunction({
8070
8051
  const inner = buildExpression(group.body, style);
8071
8052
 
8072
8053
  if (group.left === ".") { group.left = ""; }
8073
- const leftNode = new mathMLTree.MathNode("mo", [makeText(group.left, group.mode)]);
8054
+ const leftNode = new MathNode("mo", [makeText(group.left, group.mode)]);
8074
8055
  leftNode.setAttribute("fence", "true");
8075
8056
  leftNode.setAttribute("form", "prefix");
8076
8057
  if (group.left === "/" || group.left === "\u005C" || group.left.indexOf("arrow") > -1) {
@@ -8079,7 +8060,7 @@ defineFunction({
8079
8060
  inner.unshift(leftNode);
8080
8061
 
8081
8062
  if (group.right === ".") { group.right = ""; }
8082
- const rightNode = new mathMLTree.MathNode("mo", [makeText(group.right, group.mode)]);
8063
+ const rightNode = new MathNode("mo", [makeText(group.right, group.mode)]);
8083
8064
  rightNode.setAttribute("fence", "true");
8084
8065
  rightNode.setAttribute("form", "postfix");
8085
8066
  if (group.right === "\u2216" || group.right.indexOf("arrow") > -1) {
@@ -8121,7 +8102,7 @@ defineFunction({
8121
8102
  },
8122
8103
  mathmlBuilder: (group, style) => {
8123
8104
  const textNode = makeText(group.delim, group.mode);
8124
- const middleNode = new mathMLTree.MathNode("mo", [textNode]);
8105
+ const middleNode = new MathNode("mo", [textNode]);
8125
8106
  middleNode.setAttribute("fence", "true");
8126
8107
  if (group.delim.indexOf("arrow") > -1) {
8127
8108
  middleNode.setAttribute("stretchy", "true");
@@ -8137,26 +8118,9 @@ defineFunction({
8137
8118
  }
8138
8119
  });
8139
8120
 
8140
- const padding = _ => {
8141
- const node = new mathMLTree.MathNode("mspace");
8142
- node.setAttribute("width", "3pt");
8143
- return node
8144
- };
8145
-
8146
8121
  const mathmlBuilder$7 = (group, style) => {
8147
- let node;
8148
- if (group.label.indexOf("colorbox") > -1 || group.label === "\\boxed") {
8149
- // MathML core does not support +width attribute in <mpadded>.
8150
- // Firefox does not reliably add side padding.
8151
- // Insert <mspace>
8152
- node = new mathMLTree.MathNode("mrow", [
8153
- padding(),
8154
- buildGroup$1(group.body, style),
8155
- padding()
8156
- ]);
8157
- } else {
8158
- node = new mathMLTree.MathNode("menclose", [buildGroup$1(group.body, style)]);
8159
- }
8122
+ const tag = group.label === "\\boxed" ? "mrow" : "menclose";
8123
+ const node = new MathNode(tag, [buildGroup$1(group.body, style)]);
8160
8124
  switch (group.label) {
8161
8125
  case "\\overline":
8162
8126
  node.setAttribute("notation", "top"); // for Firefox & WebKit
@@ -8168,15 +8132,15 @@ const mathmlBuilder$7 = (group, style) => {
8168
8132
  break
8169
8133
  case "\\cancel":
8170
8134
  node.setAttribute("notation", "updiagonalstrike");
8171
- node.children.push(new mathMLTree.MathNode("mrow", [], ["tml-cancel", "upstrike"]));
8135
+ node.children.push(new MathNode("mrow", [], ["tml-cancel", "upstrike"]));
8172
8136
  break
8173
8137
  case "\\bcancel":
8174
8138
  node.setAttribute("notation", "downdiagonalstrike");
8175
- node.children.push(new mathMLTree.MathNode("mrow", [], ["tml-cancel", "downstrike"]));
8139
+ node.children.push(new MathNode("mrow", [], ["tml-cancel", "downstrike"]));
8176
8140
  break
8177
8141
  case "\\sout":
8178
8142
  node.setAttribute("notation", "horizontalstrike");
8179
- node.children.push(new mathMLTree.MathNode("mrow", [], ["tml-cancel", "sout"]));
8143
+ node.children.push(new MathNode("mrow", [], ["tml-cancel", "sout"]));
8180
8144
  break
8181
8145
  case "\\xcancel":
8182
8146
  node.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
@@ -8185,17 +8149,17 @@ const mathmlBuilder$7 = (group, style) => {
8185
8149
  case "\\longdiv":
8186
8150
  node.setAttribute("notation", "longdiv");
8187
8151
  node.classes.push("longdiv-top");
8188
- node.children.push(new mathMLTree.MathNode("mrow", [], ["longdiv-arc"]));
8152
+ node.children.push(new MathNode("mrow", [], ["longdiv-arc"]));
8189
8153
  break
8190
8154
  case "\\phase":
8191
8155
  node.setAttribute("notation", "phasorangle");
8192
8156
  node.classes.push("phasor-bottom");
8193
- node.children.push(new mathMLTree.MathNode("mrow", [], ["phasor-angle"]));
8157
+ node.children.push(new MathNode("mrow", [], ["phasor-angle"]));
8194
8158
  break
8195
8159
  case "\\textcircled":
8196
8160
  node.setAttribute("notation", "circle");
8197
8161
  node.classes.push("circle-pad");
8198
- node.children.push(new mathMLTree.MathNode("mrow", [], ["textcircle"]));
8162
+ node.children.push(new MathNode("mrow", [], ["textcircle"]));
8199
8163
  break
8200
8164
  case "\\angl":
8201
8165
  node.setAttribute("notation", "actuarial");
@@ -8203,8 +8167,7 @@ const mathmlBuilder$7 = (group, style) => {
8203
8167
  break
8204
8168
  case "\\boxed":
8205
8169
  // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} from amsmath.sty
8206
- node.setAttribute("notation", "box");
8207
- node.style.padding = "padding: 3pt 0 3pt 0";
8170
+ node.style.padding = "3pt";
8208
8171
  node.style.border = "1px solid";
8209
8172
  node.setAttribute("scriptlevel", "0");
8210
8173
  node.setAttribute("displaystyle", "true");
@@ -8221,12 +8184,10 @@ const mathmlBuilder$7 = (group, style) => {
8221
8184
  //const fboxsep = 3; // 3 pt from LaTeX source2e
8222
8185
  //node.setAttribute("height", `+${2 * fboxsep}pt`)
8223
8186
  //node.setAttribute("voffset", `${fboxsep}pt`)
8224
- const style = { padding: "3pt 0 3pt 0" };
8225
-
8187
+ node.style.padding = "3pt";
8226
8188
  if (group.label === "\\fcolorbox") {
8227
- style.border = "0.0667em solid " + String(group.borderColor);
8189
+ node.style.border = "0.0667em solid " + String(group.borderColor);
8228
8190
  }
8229
- node.style = style;
8230
8191
  break
8231
8192
  }
8232
8193
  }
@@ -8449,7 +8410,7 @@ defineFunction({
8449
8410
  };
8450
8411
  },
8451
8412
  mathmlBuilder(group, style) {
8452
- return new mathMLTree.MathNode("mrow");
8413
+ return new MathNode("mrow");
8453
8414
  }
8454
8415
  });
8455
8416
 
@@ -8466,7 +8427,7 @@ defineFunction({
8466
8427
  };
8467
8428
  },
8468
8429
  mathmlBuilder(group, style) {
8469
- return new mathMLTree.MathNode("mrow");
8430
+ return new MathNode("mrow");
8470
8431
  }
8471
8432
  });
8472
8433
 
@@ -8509,7 +8470,7 @@ const mathmlBuilder$6 = (group, style) => {
8509
8470
  : mathGroup.children[i].children[0].text;
8510
8471
  }
8511
8472
  // Wrap in a <mpadded> to prevent the same Firefox bug.
8512
- const mpadded = new mathMLTree.MathNode("mpadded", [mi]);
8473
+ const mpadded = new MathNode("mpadded", [mi]);
8513
8474
  mpadded.setAttribute("lspace", "0");
8514
8475
  return mpadded
8515
8476
  }
@@ -8535,8 +8496,8 @@ const mathmlBuilder$6 = (group, style) => {
8535
8496
  // Ref: https://bugs.webkit.org/show_bug.cgi?id=129097
8536
8497
  // We insert a text node that contains a zero-width space and wrap in an mrow.
8537
8498
  // TODO: Get rid of this <mi> workaround when the Firefox bug is fixed.
8538
- const bogus = new mathMLTree.MathNode("mtext", new mathMLTree.TextNode("\u200b"));
8539
- return new mathMLTree.MathNode("mrow", [bogus, mi])
8499
+ const bogus = new MathNode("mtext", new TextNode("\u200b"));
8500
+ return new MathNode("mrow", [bogus, mi])
8540
8501
  }
8541
8502
  return mi
8542
8503
  };
@@ -8647,7 +8608,7 @@ const mathmlBuilder$5 = (group, style) => {
8647
8608
  denom.setAttribute("scriptlevel", "2");
8648
8609
  }
8649
8610
 
8650
- let node = new mathMLTree.MathNode("mfrac", [numer, denom]);
8611
+ let node = new MathNode("mfrac", [numer, denom]);
8651
8612
 
8652
8613
  if (!group.hasBarLine) {
8653
8614
  node.setAttribute("linethickness", "0px");
@@ -8660,8 +8621,8 @@ const mathmlBuilder$5 = (group, style) => {
8660
8621
  const withDelims = [];
8661
8622
 
8662
8623
  if (group.leftDelim != null) {
8663
- const leftOp = new mathMLTree.MathNode("mo", [
8664
- new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))
8624
+ const leftOp = new MathNode("mo", [
8625
+ new TextNode(group.leftDelim.replace("\\", ""))
8665
8626
  ]);
8666
8627
  leftOp.setAttribute("fence", "true");
8667
8628
  withDelims.push(leftOp);
@@ -8670,8 +8631,8 @@ const mathmlBuilder$5 = (group, style) => {
8670
8631
  withDelims.push(node);
8671
8632
 
8672
8633
  if (group.rightDelim != null) {
8673
- const rightOp = new mathMLTree.MathNode("mo", [
8674
- new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))
8634
+ const rightOp = new MathNode("mo", [
8635
+ new TextNode(group.rightDelim.replace("\\", ""))
8675
8636
  ]);
8676
8637
  rightOp.setAttribute("fence", "true");
8677
8638
  withDelims.push(rightOp);
@@ -8681,7 +8642,7 @@ const mathmlBuilder$5 = (group, style) => {
8681
8642
  }
8682
8643
 
8683
8644
  if (group.scriptLevel !== "auto") {
8684
- node = new mathMLTree.MathNode("mstyle", [node]);
8645
+ node = new MathNode("mstyle", [node]);
8685
8646
  node.setAttribute("displaystyle", String(group.scriptLevel === "display"));
8686
8647
  node.setAttribute("scriptlevel", scriptLevel[group.scriptLevel]);
8687
8648
  }
@@ -8984,9 +8945,9 @@ defineFunction({
8984
8945
  });
8985
8946
 
8986
8947
  const mathmlBuilder$4 = (group, style) => {
8987
- const accentNode = stretchy.mathMLnode(group.label);
8948
+ const accentNode = mathMLnode(group.label);
8988
8949
  accentNode.style["math-depth"] = 0;
8989
- return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [
8950
+ return new MathNode(group.isOver ? "mover" : "munder", [
8990
8951
  buildGroup$1(group.base, style),
8991
8952
  accentNode
8992
8953
  ]);
@@ -9222,7 +9183,7 @@ defineFunction({
9222
9183
  const node = new Img(group.src, group.alt, graphicStyle);
9223
9184
  node.height = height;
9224
9185
  node.depth = depth;
9225
- return new mathMLTree.MathNode("mtext", [node])
9186
+ return new MathNode("mtext", [node])
9226
9187
  }
9227
9188
  });
9228
9189
 
@@ -9272,17 +9233,17 @@ defineFunction({
9272
9233
  ? spaceCharacter(dimension.number)
9273
9234
  : "";
9274
9235
  if (group.mode === "text" && ch.length > 0) {
9275
- const character = new mathMLTree.TextNode(ch);
9276
- return new mathMLTree.MathNode("mtext", [character]);
9236
+ const character = new TextNode(ch);
9237
+ return new MathNode("mtext", [character]);
9277
9238
  } else {
9278
9239
  if (dimension.number >= 0) {
9279
- const node = new mathMLTree.MathNode("mspace");
9240
+ const node = new MathNode("mspace");
9280
9241
  node.setAttribute("width", dimension.number + dimension.unit);
9281
9242
  return node
9282
9243
  } else {
9283
9244
  // Don't use <mspace> or <mpadded> because
9284
9245
  // WebKit recognizes negative left margin only on a <mrow> element
9285
- const node = new mathMLTree.MathNode("mrow");
9246
+ const node = new MathNode("mrow");
9286
9247
  node.style.marginLeft = dimension.number + dimension.unit;
9287
9248
  return node
9288
9249
  }
@@ -9323,7 +9284,7 @@ defineFunction({
9323
9284
  },
9324
9285
  mathmlBuilder(group, style) {
9325
9286
  // Return a no-width, no-ink element with an HTML id.
9326
- const node = new mathMLTree.MathNode("mrow", [], ["tml-label"]);
9287
+ const node = new MathNode("mrow", [], ["tml-label"]);
9327
9288
  if (group.string.length > 0) {
9328
9289
  node.setLabel(group.string);
9329
9290
  }
@@ -9367,8 +9328,8 @@ defineFunction({
9367
9328
  // We need an invisible strut with the same depth as the group.
9368
9329
  // We can't just read the depth, so we use \vphantom methods.
9369
9330
  const phantomInner = buildExpression(ordargument(group.body), style);
9370
- const phantom = new mathMLTree.MathNode("mphantom", phantomInner);
9371
- strut = new mathMLTree.MathNode("mpadded", [phantom]);
9331
+ const phantom = new MathNode("mphantom", phantomInner);
9332
+ strut = new MathNode("mpadded", [phantom]);
9372
9333
  strut.setAttribute("width", "0.1px"); // Don't use 0. WebKit would hide it.
9373
9334
  }
9374
9335
 
@@ -9378,9 +9339,9 @@ defineFunction({
9378
9339
  inner.style.position = "absolute";
9379
9340
  inner.style.right = "0";
9380
9341
  inner.style.bottom = `0`; // If we could have read the ink depth, it would go here.
9381
- node = new mathMLTree.MathNode("mpadded", [strut, inner]);
9342
+ node = new MathNode("mpadded", [strut, inner]);
9382
9343
  } else {
9383
- node = new mathMLTree.MathNode("mpadded", [inner]);
9344
+ node = new MathNode("mpadded", [inner]);
9384
9345
  }
9385
9346
 
9386
9347
  if (group.alignment === "rlap") {
@@ -9486,7 +9447,7 @@ function mathmlBuilder$3(group, style) {
9486
9447
  const inner = buildExpression(group.body, style);
9487
9448
 
9488
9449
  if (group.mclass === "minner") {
9489
- node = new mathMLTree.MathNode("mpadded", inner);
9450
+ node = new MathNode("mpadded", inner);
9490
9451
  } else if (group.mclass === "mord") {
9491
9452
  if (group.isCharacterBox || inner[0].type === "mathord") {
9492
9453
  node = inner[0];
@@ -9495,10 +9456,10 @@ function mathmlBuilder$3(group, style) {
9495
9456
  node.setAttribute("mathvariant", "normal");
9496
9457
  }
9497
9458
  } else {
9498
- node = new mathMLTree.MathNode("mi", inner);
9459
+ node = new MathNode("mi", inner);
9499
9460
  }
9500
9461
  } else {
9501
- node = new mathMLTree.MathNode("mrow", inner);
9462
+ node = new MathNode("mrow", inner);
9502
9463
  if (group.mustPromote) {
9503
9464
  node = inner[0];
9504
9465
  node.type = "mo";
@@ -9506,7 +9467,7 @@ function mathmlBuilder$3(group, style) {
9506
9467
  node.setAttribute("mathvariant", "italic");
9507
9468
  }
9508
9469
  } else {
9509
- node = new mathMLTree.MathNode("mrow", inner);
9470
+ node = new MathNode("mrow", inner);
9510
9471
  }
9511
9472
 
9512
9473
  // Set spacing based on what is the most likely adjacent atom type.
@@ -9516,17 +9477,17 @@ function mathmlBuilder$3(group, style) {
9516
9477
  if (doSpacing ) {
9517
9478
  if (group.mclass === "mbin") {
9518
9479
  // medium space
9519
- node.children.unshift(padding$1(0.2222));
9520
- node.children.push(padding$1(0.2222));
9480
+ node.children.unshift(padding(0.2222));
9481
+ node.children.push(padding(0.2222));
9521
9482
  } else if (group.mclass === "mrel") {
9522
9483
  // thickspace
9523
- node.children.unshift(padding$1(0.2778));
9524
- node.children.push(padding$1(0.2778));
9484
+ node.children.unshift(padding(0.2778));
9485
+ node.children.push(padding(0.2778));
9525
9486
  } else if (group.mclass === "mpunct") {
9526
- node.children.push(padding$1(0.1667));
9487
+ node.children.push(padding(0.1667));
9527
9488
  } else if (group.mclass === "minner") {
9528
- node.children.unshift(padding$1(0.0556)); // 1 mu is the most likely option
9529
- node.children.push(padding$1(0.0556));
9489
+ node.children.unshift(padding(0.0556)); // 1 mu is the most likely option
9490
+ node.children.push(padding(0.0556));
9530
9491
  }
9531
9492
  }
9532
9493
  } else {
@@ -9576,7 +9537,7 @@ defineFunction({
9576
9537
  },
9577
9538
  handler({ parser, funcName }, args) {
9578
9539
  const body = args[0];
9579
- const isCharacterBox = utils.isCharacterBox(body);
9540
+ const isCharacterBox$1 = isCharacterBox(body);
9580
9541
  // We should not wrap a <mo> around a <mi> or <mord>. That would be invalid MathML.
9581
9542
  // In that case, we instead promote the text contents of the body to the parent.
9582
9543
  let mustPromote = true;
@@ -9605,7 +9566,7 @@ defineFunction({
9605
9566
  mode: parser.mode,
9606
9567
  mclass: "m" + funcName.slice(5),
9607
9568
  body: ordargument(mustPromote ? mord : body),
9608
- isCharacterBox,
9569
+ isCharacterBox: isCharacterBox$1,
9609
9570
  mustPromote
9610
9571
  };
9611
9572
  }
@@ -9642,7 +9603,7 @@ defineFunction({
9642
9603
  mode: parser.mode,
9643
9604
  mclass: binrelClass(args[0]),
9644
9605
  body: ordargument(args[1]),
9645
- isCharacterBox: utils.isCharacterBox(args[1])
9606
+ isCharacterBox: isCharacterBox(args[1])
9646
9607
  };
9647
9608
  }
9648
9609
  });
@@ -9756,8 +9717,8 @@ defineFunction({
9756
9717
  mathmlBuilder(group, style) {
9757
9718
  const base = buildGroup$1(group.base, style);
9758
9719
 
9759
- const prescriptsNode = new mathMLTree.MathNode("mprescripts");
9760
- const noneNode = new mathMLTree.MathNode("none");
9720
+ const prescriptsNode = new MathNode("mprescripts");
9721
+ const noneNode = new MathNode("none");
9761
9722
  let children = [];
9762
9723
 
9763
9724
  const preSub = buildGroup(group.prescripts.sub, style, noneNode);
@@ -9776,7 +9737,7 @@ defineFunction({
9776
9737
  children = [base, prescriptsNode, preSub, preSup];
9777
9738
  }
9778
9739
 
9779
- return new mathMLTree.MathNode("mmultiscripts", children);
9740
+ return new MathNode("mmultiscripts", children);
9780
9741
  }
9781
9742
  });
9782
9743
 
@@ -9789,9 +9750,9 @@ defineFunction({
9789
9750
  allowedInText: false
9790
9751
  },
9791
9752
  handler({ parser }, args) {
9792
- const isCharacterBox = utils.isCharacterBox(args[0]);
9753
+ const isCharacterBox$1 = isCharacterBox(args[0]);
9793
9754
  let body;
9794
- if (isCharacterBox) {
9755
+ if (isCharacterBox$1) {
9795
9756
  body = ordargument(args[0]);
9796
9757
  if (body[0].text.charAt(0) === "\\") {
9797
9758
  body[0].text = symbols.math[body[0].text].replace;
@@ -9809,7 +9770,7 @@ defineFunction({
9809
9770
  type: "not",
9810
9771
  mode: parser.mode,
9811
9772
  body,
9812
- isCharacterBox
9773
+ isCharacterBox: isCharacterBox$1
9813
9774
  };
9814
9775
  },
9815
9776
  mathmlBuilder(group, style) {
@@ -10188,9 +10149,9 @@ const mathmlBuilder$1 = (group, style) => {
10188
10149
  let isAllString = true; // default
10189
10150
  for (let i = 0; i < expression.length; i++) {
10190
10151
  let node = expression[i];
10191
- if (node instanceof mathMLTree.MathNode) {
10152
+ if (node instanceof MathNode) {
10192
10153
  if ((node.type === "mrow" || node.type === "mpadded") && node.children.length === 1 &&
10193
- node.children[0] instanceof mathMLTree.MathNode) {
10154
+ node.children[0] instanceof MathNode) {
10194
10155
  node = node.children[0];
10195
10156
  }
10196
10157
  switch (node.type) {
@@ -10207,14 +10168,14 @@ const mathmlBuilder$1 = (group, style) => {
10207
10168
  if (ch === "") {
10208
10169
  isAllString = false;
10209
10170
  } else {
10210
- expression[i] = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode(ch)]);
10171
+ expression[i] = new MathNode("mtext", [new TextNode(ch)]);
10211
10172
  }
10212
10173
  }
10213
10174
  }
10214
10175
  break
10215
10176
  case "mo": {
10216
10177
  const child = node.children[0];
10217
- if (node.children.length === 1 && child instanceof mathMLTree.TextNode) {
10178
+ if (node.children.length === 1 && child instanceof TextNode) {
10218
10179
  child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
10219
10180
  } else {
10220
10181
  isAllString = false;
@@ -10232,7 +10193,7 @@ const mathmlBuilder$1 = (group, style) => {
10232
10193
  if (isAllString) {
10233
10194
  // Write a single TextNode instead of multiple nested tags.
10234
10195
  const word = expression.map((node) => node.toText()).join("");
10235
- expression = [new mathMLTree.TextNode(word)];
10196
+ expression = [new TextNode(word)];
10236
10197
  } else if (
10237
10198
  expression.length === 1
10238
10199
  && ["mover", "munder"].includes(expression[0].type) &&
@@ -10240,41 +10201,41 @@ const mathmlBuilder$1 = (group, style) => {
10240
10201
  ) {
10241
10202
  expression[0].children[0].type = "mi";
10242
10203
  if (group.parentIsSupSub) {
10243
- return new mathMLTree.MathNode("mrow", expression)
10204
+ return new MathNode("mrow", expression)
10244
10205
  } else {
10245
- const operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]);
10246
- return mathMLTree.newDocumentFragment([expression[0], operator])
10206
+ const operator = new MathNode("mo", [makeText("\u2061", "text")]);
10207
+ return newDocumentFragment([expression[0], operator])
10247
10208
  }
10248
10209
  }
10249
10210
 
10250
10211
  let wrapper;
10251
10212
  if (isAllString) {
10252
- wrapper = new mathMLTree.MathNode("mi", expression);
10213
+ wrapper = new MathNode("mi", expression);
10253
10214
  if (expression[0].text.length === 1) {
10254
10215
  wrapper.setAttribute("mathvariant", "normal");
10255
10216
  }
10256
10217
  } else {
10257
- wrapper = new mathMLTree.MathNode("mrow", expression);
10218
+ wrapper = new MathNode("mrow", expression);
10258
10219
  }
10259
10220
 
10260
10221
  if (!group.parentIsSupSub) {
10261
10222
  // Append an <mo>&ApplyFunction;</mo>.
10262
10223
  // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
10263
- const operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]);
10224
+ const operator = new MathNode("mo", [makeText("\u2061", "text")]);
10264
10225
  const fragment = [wrapper, operator];
10265
10226
  if (group.needsLeadingSpace) {
10266
10227
  // LaTeX gives operator spacing, but a <mi> gets ord spacing.
10267
10228
  // So add a leading space.
10268
- const space = new mathMLTree.MathNode("mspace");
10229
+ const space = new MathNode("mspace");
10269
10230
  space.setAttribute("width", "0.1667em"); // thin space.
10270
10231
  fragment.unshift(space);
10271
10232
  }
10272
10233
  if (!group.isFollowedByDelimiter) {
10273
- const trail = new mathMLTree.MathNode("mspace");
10234
+ const trail = new MathNode("mspace");
10274
10235
  trail.setAttribute("width", "0.1667em"); // thin space.
10275
10236
  fragment.push(trail);
10276
10237
  }
10277
- return mathMLTree.newDocumentFragment(fragment)
10238
+ return newDocumentFragment(fragment)
10278
10239
  }
10279
10240
 
10280
10241
  return wrapper
@@ -10334,7 +10295,7 @@ defineFunction({
10334
10295
  },
10335
10296
  mathmlBuilder: (group, style) => {
10336
10297
  const inner = buildExpression(group.body, style);
10337
- return new mathMLTree.MathNode("mphantom", inner);
10298
+ return new MathNode("mphantom", inner);
10338
10299
  }
10339
10300
  });
10340
10301
 
@@ -10355,8 +10316,8 @@ defineFunction({
10355
10316
  },
10356
10317
  mathmlBuilder: (group, style) => {
10357
10318
  const inner = buildExpression(ordargument(group.body), style);
10358
- const phantom = new mathMLTree.MathNode("mphantom", inner);
10359
- const node = new mathMLTree.MathNode("mpadded", [phantom]);
10319
+ const phantom = new MathNode("mphantom", inner);
10320
+ const node = new MathNode("mpadded", [phantom]);
10360
10321
  node.setAttribute("height", "0px");
10361
10322
  node.setAttribute("depth", "0px");
10362
10323
  return node;
@@ -10380,8 +10341,8 @@ defineFunction({
10380
10341
  },
10381
10342
  mathmlBuilder: (group, style) => {
10382
10343
  const inner = buildExpression(ordargument(group.body), style);
10383
- const phantom = new mathMLTree.MathNode("mphantom", inner);
10384
- const node = new mathMLTree.MathNode("mpadded", [phantom]);
10344
+ const phantom = new MathNode("mphantom", inner);
10345
+ const node = new MathNode("mpadded", [phantom]);
10385
10346
  node.setAttribute("width", "0px");
10386
10347
  return node;
10387
10348
  }
@@ -10418,7 +10379,7 @@ defineFunction({
10418
10379
 
10419
10380
  const mathmlBuilder = (group, style) => {
10420
10381
  const newStyle = style.withLevel(StyleLevel.TEXT);
10421
- const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, newStyle)]);
10382
+ const node = new MathNode("mpadded", [buildGroup$1(group.body, newStyle)]);
10422
10383
  const dy = calculateSize(group.dy, style);
10423
10384
  node.setAttribute("voffset", dy.number + dy.unit);
10424
10385
  // Add padding, which acts to increase height in Chromium.
@@ -10566,7 +10527,7 @@ defineFunction({
10566
10527
  : { number: 0, unit: "em" };
10567
10528
  const color = (style.color && style.getColor()) || "black";
10568
10529
 
10569
- const rule = new mathMLTree.MathNode("mspace");
10530
+ const rule = new MathNode("mspace");
10570
10531
  if (width.number > 0 && height.number > 0) {
10571
10532
  rule.setAttribute("mathbackground", color);
10572
10533
  }
@@ -10574,7 +10535,7 @@ defineFunction({
10574
10535
  rule.setAttribute("height", height.number + height.unit);
10575
10536
  if (shift.number === 0) { return rule }
10576
10537
 
10577
- const wrapper = new mathMLTree.MathNode("mpadded", [rule]);
10538
+ const wrapper = new MathNode("mpadded", [rule]);
10578
10539
  if (shift.number >= 0) {
10579
10540
  wrapper.setAttribute("height", "+" + shift.number + shift.unit);
10580
10541
  } else {
@@ -10646,8 +10607,8 @@ defineFunction({
10646
10607
  const numerator = group.numerator.split('').map(c => unicodeNumSups[c]).join('');
10647
10608
  const denominator = group.denominator.split('').map(c => unicodeNumSubs[c]).join('');
10648
10609
  // Use a fraction slash.
10649
- const text = new mathMLTree.TextNode(numerator + "\u2044" + denominator, group.mode, style);
10650
- return new mathMLTree.MathNode("mn", [text], ["special-fraction"])
10610
+ const text = new TextNode(numerator + "\u2044" + denominator, group.mode, style);
10611
+ return new MathNode("mn", [text], ["special-fraction"])
10651
10612
  }
10652
10613
  });
10653
10614
 
@@ -10760,7 +10721,7 @@ defineFunction({
10760
10721
  };
10761
10722
  },
10762
10723
  mathmlBuilder: (group, style) => {
10763
- const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, style)]);
10724
+ const node = new MathNode("mpadded", [buildGroup$1(group.body, style)]);
10764
10725
 
10765
10726
  if (group.smashHeight) {
10766
10727
  node.setAttribute("height", "0px");
@@ -10813,11 +10774,11 @@ defineFunction({
10813
10774
  mathmlBuilder(group, style) {
10814
10775
  const { body, index } = group;
10815
10776
  return index
10816
- ? new mathMLTree.MathNode("mroot", [
10777
+ ? new MathNode("mroot", [
10817
10778
  buildGroup$1(body, style),
10818
10779
  buildGroup$1(index, style.incrementLevel())
10819
10780
  ])
10820
- : new mathMLTree.MathNode("msqrt", [buildGroup$1(body, style)]);
10781
+ : new MathNode("msqrt", [buildGroup$1(body, style)]);
10821
10782
  }
10822
10783
  });
10823
10784
 
@@ -11016,26 +10977,26 @@ defineFunctionBuilders({
11016
10977
  }
11017
10978
  }
11018
10979
 
11019
- let node = new mathMLTree.MathNode(nodeType, children);
10980
+ let node = new MathNode(nodeType, children);
11020
10981
  if (appendApplyFunction) {
11021
10982
  // Append an <mo>&ApplyFunction;</mo>.
11022
10983
  // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
11023
- const operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]);
10984
+ const operator = new MathNode("mo", [makeText("\u2061", "text")]);
11024
10985
  if (needsLeadingSpace) {
11025
- const space = new mathMLTree.MathNode("mspace");
10986
+ const space = new MathNode("mspace");
11026
10987
  space.setAttribute("width", "0.1667em"); // thin space.
11027
- node = mathMLTree.newDocumentFragment([space, node, operator]);
10988
+ node = newDocumentFragment([space, node, operator]);
11028
10989
  } else {
11029
- node = mathMLTree.newDocumentFragment([node, operator]);
10990
+ node = newDocumentFragment([node, operator]);
11030
10991
  }
11031
10992
  if (appendSpace) {
11032
- const space = new mathMLTree.MathNode("mspace");
10993
+ const space = new MathNode("mspace");
11033
10994
  space.setAttribute("width", "0.1667em"); // thin space.
11034
10995
  node.children.push(space);
11035
10996
  }
11036
10997
  } else if (symbolRegEx.test(nodeType)) {
11037
10998
  // Wrap in a <mrow>. Otherwise Firefox stretchy parens will not stretch to include limits.
11038
- node = new mathMLTree.MathNode("mrow", [node]);
10999
+ node = new MathNode("mrow", [node]);
11039
11000
  }
11040
11001
 
11041
11002
  return node
@@ -11060,7 +11021,7 @@ const isArrow = str => {
11060
11021
  defineFunctionBuilders({
11061
11022
  type: "atom",
11062
11023
  mathmlBuilder(group, style) {
11063
- const node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]);
11024
+ const node = new MathNode("mo", [makeText(group.text, group.mode)]);
11064
11025
  if (group.family === "punct") {
11065
11026
  node.setAttribute("separator", "true");
11066
11027
  } else if (group.family === "open" || group.family === "close") {
@@ -11090,10 +11051,10 @@ defineFunctionBuilders({
11090
11051
  } else if (group.needsSpacing) {
11091
11052
  // Fix a MathML bug that occurs when a <mo> is between two <mtext> elements.
11092
11053
  if (group.family === "bin") {
11093
- return new mathMLTree.MathNode("mrow", [padding$1(0.222), node, padding$1(0.222)])
11054
+ return new MathNode("mrow", [padding(0.222), node, padding(0.222)])
11094
11055
  } else {
11095
11056
  // REL spacing
11096
- return new mathMLTree.MathNode("mrow", [padding$1(0.2778), node, padding$1(0.2778)])
11057
+ return new MathNode("mrow", [padding(0.2778), node, padding(0.2778)])
11097
11058
  }
11098
11059
  }
11099
11060
  return node;
@@ -11434,8 +11395,8 @@ const primes = new Set(["\\prime", "\\dprime", "\\trprime", "\\qprime",
11434
11395
  "\\backprime", "\\backdprime", "\\backtrprime"]);
11435
11396
 
11436
11397
  const italicNumber = (text, variant, tag) => {
11437
- const mn = new mathMLTree.MathNode(tag, [text]);
11438
- const wrapper = new mathMLTree.MathNode("mstyle", [mn]);
11398
+ const mn = new MathNode(tag, [text]);
11399
+ const wrapper = new MathNode("mstyle", [mn]);
11439
11400
  wrapper.style["font-style"] = "italic";
11440
11401
  wrapper.style["font-family"] = "Cambria, 'Times New Roman', serif";
11441
11402
  if (variant === "bold-italic") { wrapper.style["font-weight"] = "bold"; }
@@ -11452,17 +11413,17 @@ defineFunctionBuilders({
11452
11413
  const variant = getVariant(group, style) || defaultVariant;
11453
11414
  if (variant === "script") {
11454
11415
  text.text = variantChar(text.text, variant);
11455
- return new mathMLTree.MathNode("mi", [text], [style.font])
11416
+ return new MathNode("mi", [text], [style.font])
11456
11417
  } else if (variant !== "italic") {
11457
11418
  text.text = variantChar(text.text, variant);
11458
11419
  }
11459
- let node = new mathMLTree.MathNode("mi", [text]);
11420
+ let node = new MathNode("mi", [text]);
11460
11421
  // TODO: Handle U+1D49C - U+1D4CF per https://www.unicode.org/charts/PDF/U1D400.pdf
11461
11422
  if (variant === "normal") {
11462
11423
  node.setAttribute("mathvariant", "normal");
11463
11424
  if (text.text.length === 1) {
11464
11425
  // A Firefox bug will apply spacing here, but there should be none. Fix it.
11465
- node = new mathMLTree.MathNode("mpadded", [node]);
11426
+ node = new MathNode("mpadded", [node]);
11466
11427
  node.setAttribute("lspace", "0");
11467
11428
  }
11468
11429
  }
@@ -11493,15 +11454,15 @@ defineFunctionBuilders({
11493
11454
  if (variant !== "normal") {
11494
11455
  text.text = text.text.split("").map(c => variantChar(c, variant)).join("");
11495
11456
  }
11496
- node = new mathMLTree.MathNode(tag, [text]);
11457
+ node = new MathNode(tag, [text]);
11497
11458
  }
11498
11459
  } else if (group.mode === "text") {
11499
11460
  if (variant !== "normal") {
11500
11461
  text.text = variantChar(text.text, variant);
11501
11462
  }
11502
- node = new mathMLTree.MathNode("mtext", [text]);
11463
+ node = new MathNode("mtext", [text]);
11503
11464
  } else if (primes.has(group.text)) {
11504
- node = new mathMLTree.MathNode("mo", [text]);
11465
+ node = new MathNode("mo", [text]);
11505
11466
  // TODO: If/when Chromium uses ssty variant for prime, remove the next line.
11506
11467
  node.classes.push("tml-prime");
11507
11468
  } else {
@@ -11509,7 +11470,7 @@ defineFunctionBuilders({
11509
11470
  if (variant !== "italic") {
11510
11471
  text.text = variantChar(text.text, variant);
11511
11472
  }
11512
- node = new mathMLTree.MathNode("mi", [text]);
11473
+ node = new MathNode("mi", [text]);
11513
11474
  if (text.text === origText && latinRegEx.test(origText)) {
11514
11475
  node.setAttribute("mathvariant", "italic");
11515
11476
  }
@@ -11552,11 +11513,11 @@ defineFunctionBuilders({
11552
11513
  // Firefox does not render a space in a <mtext> </mtext>. So write a no-break space.
11553
11514
  // TODO: If Firefox fixes that bug, uncomment the next line and write ch into the node.
11554
11515
  //const ch = (regularSpace[group.text].className === "nobreak") ? "\u00a0" : " "
11555
- node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\u00a0")]);
11516
+ node = new MathNode("mtext", [new TextNode("\u00a0")]);
11556
11517
  } else if (Object.prototype.hasOwnProperty.call(cssSpace, group.text)) {
11557
11518
  // MathML 3.0 calls for nobreak to occur in an <mo>, not an <mtext>
11558
11519
  // Ref: https://www.w3.org/Math/draft-spec/mathml.html#chapter3_presm.lbattrs
11559
- node = new mathMLTree.MathNode("mo");
11520
+ node = new MathNode("mo");
11560
11521
  if (group.text === "\\nobreak") {
11561
11522
  node.setAttribute("linebreak", "nobreak");
11562
11523
  }
@@ -11671,10 +11632,10 @@ defineFunction({
11671
11632
  },
11672
11633
  mathmlBuilder(group, style) {
11673
11634
  // Use a math table to create vertically centered content.
11674
- const mtd = new mathMLTree.MathNode("mtd", [buildGroup$1(group.body, style)]);
11635
+ const mtd = new MathNode("mtd", [buildGroup$1(group.body, style)]);
11675
11636
  mtd.style.padding = "0";
11676
- const mtr = new mathMLTree.MathNode("mtr", [mtd]);
11677
- return new mathMLTree.MathNode("mtable", [mtr])
11637
+ const mtr = new MathNode("mtr", [mtd]);
11638
+ return new MathNode("mtable", [mtr])
11678
11639
  }
11679
11640
  });
11680
11641
 
@@ -11693,8 +11654,8 @@ defineFunction({
11693
11654
  throw new ParseError("\\verb ended by end of line instead of matching delimiter");
11694
11655
  },
11695
11656
  mathmlBuilder(group, style) {
11696
- const text = new mathMLTree.TextNode(makeVerb(group));
11697
- const node = new mathMLTree.MathNode("mtext", [text]);
11657
+ const text = new TextNode(makeVerb(group));
11658
+ const node = new MathNode("mtext", [text]);
11698
11659
  node.setAttribute("mathvariant", "monospace");
11699
11660
  return node;
11700
11661
  }
@@ -14026,7 +13987,7 @@ class Style {
14026
13987
  * https://mit-license.org/
14027
13988
  */
14028
13989
 
14029
- const version = "0.11.10";
13990
+ const version = "0.12.01";
14030
13991
 
14031
13992
  function postProcess(block) {
14032
13993
  const labelMap = {};