temml 0.11.11 → 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 +208 -230
  3. package/dist/temml.d.ts +2 -2
  4. package/dist/temml.js +208 -230
  5. package/dist/temml.min.js +1 -1
  6. package/dist/temml.mjs +208 -230
  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 +1 -1
  21. package/src/functions/enclose.js +3 -3
  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 + "'")
@@ -2806,7 +2785,7 @@ const calculateSize = function(sizeValue, style) {
2806
2785
  // Helper functions
2807
2786
 
2808
2787
  const padding = width => {
2809
- const node = new mathMLTree.MathNode("mspace");
2788
+ const node = new MathNode("mspace");
2810
2789
  node.setAttribute("width", width + "em");
2811
2790
  return node
2812
2791
  };
@@ -2818,18 +2797,18 @@ const paddedNode = (group, lspace = 0.3, rspace = 0, mustSmash = false) => {
2818
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
@@ -2949,7 +2928,7 @@ defineFunction({
2949
2928
  const row = [node];
2950
2929
  row.unshift(padding(0.2778));
2951
2930
  row.push(padding(0.2778));
2952
- return new mathMLTree.MathNode("mrow", row)
2931
+ return new MathNode("mrow", row)
2953
2932
  }
2954
2933
  });
2955
2934
 
@@ -3002,21 +2981,21 @@ 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
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
3000
  [padding(0.2778), raiseNode, botArrow, padding(0.2778)]
3022
3001
  );
@@ -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) {
@@ -7979,7 +7957,7 @@ defineFunction({
7979
7957
  if (group.delim === ".") { group.delim = ""; }
7980
7958
  children.push(makeText(group.delim, group.mode));
7981
7959
 
7982
- const node = new mathMLTree.MathNode("mo", children);
7960
+ const node = new MathNode("mo", children);
7983
7961
 
7984
7962
  if (group.mclass === "mopen" || group.mclass === "mclose") {
7985
7963
  // Only some of the delimsizing functions act as fences, and they
@@ -8073,7 +8051,7 @@ defineFunction({
8073
8051
  const inner = buildExpression(group.body, style);
8074
8052
 
8075
8053
  if (group.left === ".") { group.left = ""; }
8076
- const leftNode = new mathMLTree.MathNode("mo", [makeText(group.left, group.mode)]);
8054
+ const leftNode = new MathNode("mo", [makeText(group.left, group.mode)]);
8077
8055
  leftNode.setAttribute("fence", "true");
8078
8056
  leftNode.setAttribute("form", "prefix");
8079
8057
  if (group.left === "/" || group.left === "\u005C" || group.left.indexOf("arrow") > -1) {
@@ -8082,7 +8060,7 @@ defineFunction({
8082
8060
  inner.unshift(leftNode);
8083
8061
 
8084
8062
  if (group.right === ".") { group.right = ""; }
8085
- const rightNode = new mathMLTree.MathNode("mo", [makeText(group.right, group.mode)]);
8063
+ const rightNode = new MathNode("mo", [makeText(group.right, group.mode)]);
8086
8064
  rightNode.setAttribute("fence", "true");
8087
8065
  rightNode.setAttribute("form", "postfix");
8088
8066
  if (group.right === "\u2216" || group.right.indexOf("arrow") > -1) {
@@ -8124,7 +8102,7 @@ defineFunction({
8124
8102
  },
8125
8103
  mathmlBuilder: (group, style) => {
8126
8104
  const textNode = makeText(group.delim, group.mode);
8127
- const middleNode = new mathMLTree.MathNode("mo", [textNode]);
8105
+ const middleNode = new MathNode("mo", [textNode]);
8128
8106
  middleNode.setAttribute("fence", "true");
8129
8107
  if (group.delim.indexOf("arrow") > -1) {
8130
8108
  middleNode.setAttribute("stretchy", "true");
@@ -8141,7 +8119,8 @@ defineFunction({
8141
8119
  });
8142
8120
 
8143
8121
  const mathmlBuilder$7 = (group, style) => {
8144
- const node = new mathMLTree.MathNode("menclose", [buildGroup$1(group.body, style)]);
8122
+ const tag = group.label === "\\boxed" ? "mrow" : "menclose";
8123
+ const node = new MathNode(tag, [buildGroup$1(group.body, style)]);
8145
8124
  switch (group.label) {
8146
8125
  case "\\overline":
8147
8126
  node.setAttribute("notation", "top"); // for Firefox & WebKit
@@ -8153,15 +8132,15 @@ const mathmlBuilder$7 = (group, style) => {
8153
8132
  break
8154
8133
  case "\\cancel":
8155
8134
  node.setAttribute("notation", "updiagonalstrike");
8156
- node.children.push(new mathMLTree.MathNode("mrow", [], ["tml-cancel", "upstrike"]));
8135
+ node.children.push(new MathNode("mrow", [], ["tml-cancel", "upstrike"]));
8157
8136
  break
8158
8137
  case "\\bcancel":
8159
8138
  node.setAttribute("notation", "downdiagonalstrike");
8160
- node.children.push(new mathMLTree.MathNode("mrow", [], ["tml-cancel", "downstrike"]));
8139
+ node.children.push(new MathNode("mrow", [], ["tml-cancel", "downstrike"]));
8161
8140
  break
8162
8141
  case "\\sout":
8163
8142
  node.setAttribute("notation", "horizontalstrike");
8164
- node.children.push(new mathMLTree.MathNode("mrow", [], ["tml-cancel", "sout"]));
8143
+ node.children.push(new MathNode("mrow", [], ["tml-cancel", "sout"]));
8165
8144
  break
8166
8145
  case "\\xcancel":
8167
8146
  node.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
@@ -8170,17 +8149,17 @@ const mathmlBuilder$7 = (group, style) => {
8170
8149
  case "\\longdiv":
8171
8150
  node.setAttribute("notation", "longdiv");
8172
8151
  node.classes.push("longdiv-top");
8173
- node.children.push(new mathMLTree.MathNode("mrow", [], ["longdiv-arc"]));
8152
+ node.children.push(new MathNode("mrow", [], ["longdiv-arc"]));
8174
8153
  break
8175
8154
  case "\\phase":
8176
8155
  node.setAttribute("notation", "phasorangle");
8177
8156
  node.classes.push("phasor-bottom");
8178
- node.children.push(new mathMLTree.MathNode("mrow", [], ["phasor-angle"]));
8157
+ node.children.push(new MathNode("mrow", [], ["phasor-angle"]));
8179
8158
  break
8180
8159
  case "\\textcircled":
8181
8160
  node.setAttribute("notation", "circle");
8182
8161
  node.classes.push("circle-pad");
8183
- node.children.push(new mathMLTree.MathNode("mrow", [], ["textcircle"]));
8162
+ node.children.push(new MathNode("mrow", [], ["textcircle"]));
8184
8163
  break
8185
8164
  case "\\angl":
8186
8165
  node.setAttribute("notation", "actuarial");
@@ -8188,7 +8167,6 @@ const mathmlBuilder$7 = (group, style) => {
8188
8167
  break
8189
8168
  case "\\boxed":
8190
8169
  // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} from amsmath.sty
8191
- node.setAttribute("notation", "box");
8192
8170
  node.style.padding = "3pt";
8193
8171
  node.style.border = "1px solid";
8194
8172
  node.setAttribute("scriptlevel", "0");
@@ -8432,7 +8410,7 @@ defineFunction({
8432
8410
  };
8433
8411
  },
8434
8412
  mathmlBuilder(group, style) {
8435
- return new mathMLTree.MathNode("mrow");
8413
+ return new MathNode("mrow");
8436
8414
  }
8437
8415
  });
8438
8416
 
@@ -8449,7 +8427,7 @@ defineFunction({
8449
8427
  };
8450
8428
  },
8451
8429
  mathmlBuilder(group, style) {
8452
- return new mathMLTree.MathNode("mrow");
8430
+ return new MathNode("mrow");
8453
8431
  }
8454
8432
  });
8455
8433
 
@@ -8492,7 +8470,7 @@ const mathmlBuilder$6 = (group, style) => {
8492
8470
  : mathGroup.children[i].children[0].text;
8493
8471
  }
8494
8472
  // Wrap in a <mpadded> to prevent the same Firefox bug.
8495
- const mpadded = new mathMLTree.MathNode("mpadded", [mi]);
8473
+ const mpadded = new MathNode("mpadded", [mi]);
8496
8474
  mpadded.setAttribute("lspace", "0");
8497
8475
  return mpadded
8498
8476
  }
@@ -8518,8 +8496,8 @@ const mathmlBuilder$6 = (group, style) => {
8518
8496
  // Ref: https://bugs.webkit.org/show_bug.cgi?id=129097
8519
8497
  // We insert a text node that contains a zero-width space and wrap in an mrow.
8520
8498
  // TODO: Get rid of this <mi> workaround when the Firefox bug is fixed.
8521
- const bogus = new mathMLTree.MathNode("mtext", new mathMLTree.TextNode("\u200b"));
8522
- return new mathMLTree.MathNode("mrow", [bogus, mi])
8499
+ const bogus = new MathNode("mtext", new TextNode("\u200b"));
8500
+ return new MathNode("mrow", [bogus, mi])
8523
8501
  }
8524
8502
  return mi
8525
8503
  };
@@ -8630,7 +8608,7 @@ const mathmlBuilder$5 = (group, style) => {
8630
8608
  denom.setAttribute("scriptlevel", "2");
8631
8609
  }
8632
8610
 
8633
- let node = new mathMLTree.MathNode("mfrac", [numer, denom]);
8611
+ let node = new MathNode("mfrac", [numer, denom]);
8634
8612
 
8635
8613
  if (!group.hasBarLine) {
8636
8614
  node.setAttribute("linethickness", "0px");
@@ -8643,8 +8621,8 @@ const mathmlBuilder$5 = (group, style) => {
8643
8621
  const withDelims = [];
8644
8622
 
8645
8623
  if (group.leftDelim != null) {
8646
- const leftOp = new mathMLTree.MathNode("mo", [
8647
- new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))
8624
+ const leftOp = new MathNode("mo", [
8625
+ new TextNode(group.leftDelim.replace("\\", ""))
8648
8626
  ]);
8649
8627
  leftOp.setAttribute("fence", "true");
8650
8628
  withDelims.push(leftOp);
@@ -8653,8 +8631,8 @@ const mathmlBuilder$5 = (group, style) => {
8653
8631
  withDelims.push(node);
8654
8632
 
8655
8633
  if (group.rightDelim != null) {
8656
- const rightOp = new mathMLTree.MathNode("mo", [
8657
- new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))
8634
+ const rightOp = new MathNode("mo", [
8635
+ new TextNode(group.rightDelim.replace("\\", ""))
8658
8636
  ]);
8659
8637
  rightOp.setAttribute("fence", "true");
8660
8638
  withDelims.push(rightOp);
@@ -8664,7 +8642,7 @@ const mathmlBuilder$5 = (group, style) => {
8664
8642
  }
8665
8643
 
8666
8644
  if (group.scriptLevel !== "auto") {
8667
- node = new mathMLTree.MathNode("mstyle", [node]);
8645
+ node = new MathNode("mstyle", [node]);
8668
8646
  node.setAttribute("displaystyle", String(group.scriptLevel === "display"));
8669
8647
  node.setAttribute("scriptlevel", scriptLevel[group.scriptLevel]);
8670
8648
  }
@@ -8967,9 +8945,9 @@ defineFunction({
8967
8945
  });
8968
8946
 
8969
8947
  const mathmlBuilder$4 = (group, style) => {
8970
- const accentNode = stretchy.mathMLnode(group.label);
8948
+ const accentNode = mathMLnode(group.label);
8971
8949
  accentNode.style["math-depth"] = 0;
8972
- return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [
8950
+ return new MathNode(group.isOver ? "mover" : "munder", [
8973
8951
  buildGroup$1(group.base, style),
8974
8952
  accentNode
8975
8953
  ]);
@@ -9205,7 +9183,7 @@ defineFunction({
9205
9183
  const node = new Img(group.src, group.alt, graphicStyle);
9206
9184
  node.height = height;
9207
9185
  node.depth = depth;
9208
- return new mathMLTree.MathNode("mtext", [node])
9186
+ return new MathNode("mtext", [node])
9209
9187
  }
9210
9188
  });
9211
9189
 
@@ -9255,17 +9233,17 @@ defineFunction({
9255
9233
  ? spaceCharacter(dimension.number)
9256
9234
  : "";
9257
9235
  if (group.mode === "text" && ch.length > 0) {
9258
- const character = new mathMLTree.TextNode(ch);
9259
- return new mathMLTree.MathNode("mtext", [character]);
9236
+ const character = new TextNode(ch);
9237
+ return new MathNode("mtext", [character]);
9260
9238
  } else {
9261
9239
  if (dimension.number >= 0) {
9262
- const node = new mathMLTree.MathNode("mspace");
9240
+ const node = new MathNode("mspace");
9263
9241
  node.setAttribute("width", dimension.number + dimension.unit);
9264
9242
  return node
9265
9243
  } else {
9266
9244
  // Don't use <mspace> or <mpadded> because
9267
9245
  // WebKit recognizes negative left margin only on a <mrow> element
9268
- const node = new mathMLTree.MathNode("mrow");
9246
+ const node = new MathNode("mrow");
9269
9247
  node.style.marginLeft = dimension.number + dimension.unit;
9270
9248
  return node
9271
9249
  }
@@ -9306,7 +9284,7 @@ defineFunction({
9306
9284
  },
9307
9285
  mathmlBuilder(group, style) {
9308
9286
  // Return a no-width, no-ink element with an HTML id.
9309
- const node = new mathMLTree.MathNode("mrow", [], ["tml-label"]);
9287
+ const node = new MathNode("mrow", [], ["tml-label"]);
9310
9288
  if (group.string.length > 0) {
9311
9289
  node.setLabel(group.string);
9312
9290
  }
@@ -9350,8 +9328,8 @@ defineFunction({
9350
9328
  // We need an invisible strut with the same depth as the group.
9351
9329
  // We can't just read the depth, so we use \vphantom methods.
9352
9330
  const phantomInner = buildExpression(ordargument(group.body), style);
9353
- const phantom = new mathMLTree.MathNode("mphantom", phantomInner);
9354
- strut = new mathMLTree.MathNode("mpadded", [phantom]);
9331
+ const phantom = new MathNode("mphantom", phantomInner);
9332
+ strut = new MathNode("mpadded", [phantom]);
9355
9333
  strut.setAttribute("width", "0.1px"); // Don't use 0. WebKit would hide it.
9356
9334
  }
9357
9335
 
@@ -9361,9 +9339,9 @@ defineFunction({
9361
9339
  inner.style.position = "absolute";
9362
9340
  inner.style.right = "0";
9363
9341
  inner.style.bottom = `0`; // If we could have read the ink depth, it would go here.
9364
- node = new mathMLTree.MathNode("mpadded", [strut, inner]);
9342
+ node = new MathNode("mpadded", [strut, inner]);
9365
9343
  } else {
9366
- node = new mathMLTree.MathNode("mpadded", [inner]);
9344
+ node = new MathNode("mpadded", [inner]);
9367
9345
  }
9368
9346
 
9369
9347
  if (group.alignment === "rlap") {
@@ -9469,7 +9447,7 @@ function mathmlBuilder$3(group, style) {
9469
9447
  const inner = buildExpression(group.body, style);
9470
9448
 
9471
9449
  if (group.mclass === "minner") {
9472
- node = new mathMLTree.MathNode("mpadded", inner);
9450
+ node = new MathNode("mpadded", inner);
9473
9451
  } else if (group.mclass === "mord") {
9474
9452
  if (group.isCharacterBox || inner[0].type === "mathord") {
9475
9453
  node = inner[0];
@@ -9478,10 +9456,10 @@ function mathmlBuilder$3(group, style) {
9478
9456
  node.setAttribute("mathvariant", "normal");
9479
9457
  }
9480
9458
  } else {
9481
- node = new mathMLTree.MathNode("mi", inner);
9459
+ node = new MathNode("mi", inner);
9482
9460
  }
9483
9461
  } else {
9484
- node = new mathMLTree.MathNode("mrow", inner);
9462
+ node = new MathNode("mrow", inner);
9485
9463
  if (group.mustPromote) {
9486
9464
  node = inner[0];
9487
9465
  node.type = "mo";
@@ -9489,7 +9467,7 @@ function mathmlBuilder$3(group, style) {
9489
9467
  node.setAttribute("mathvariant", "italic");
9490
9468
  }
9491
9469
  } else {
9492
- node = new mathMLTree.MathNode("mrow", inner);
9470
+ node = new MathNode("mrow", inner);
9493
9471
  }
9494
9472
 
9495
9473
  // Set spacing based on what is the most likely adjacent atom type.
@@ -9559,7 +9537,7 @@ defineFunction({
9559
9537
  },
9560
9538
  handler({ parser, funcName }, args) {
9561
9539
  const body = args[0];
9562
- const isCharacterBox = utils.isCharacterBox(body);
9540
+ const isCharacterBox$1 = isCharacterBox(body);
9563
9541
  // We should not wrap a <mo> around a <mi> or <mord>. That would be invalid MathML.
9564
9542
  // In that case, we instead promote the text contents of the body to the parent.
9565
9543
  let mustPromote = true;
@@ -9588,7 +9566,7 @@ defineFunction({
9588
9566
  mode: parser.mode,
9589
9567
  mclass: "m" + funcName.slice(5),
9590
9568
  body: ordargument(mustPromote ? mord : body),
9591
- isCharacterBox,
9569
+ isCharacterBox: isCharacterBox$1,
9592
9570
  mustPromote
9593
9571
  };
9594
9572
  }
@@ -9625,7 +9603,7 @@ defineFunction({
9625
9603
  mode: parser.mode,
9626
9604
  mclass: binrelClass(args[0]),
9627
9605
  body: ordargument(args[1]),
9628
- isCharacterBox: utils.isCharacterBox(args[1])
9606
+ isCharacterBox: isCharacterBox(args[1])
9629
9607
  };
9630
9608
  }
9631
9609
  });
@@ -9739,8 +9717,8 @@ defineFunction({
9739
9717
  mathmlBuilder(group, style) {
9740
9718
  const base = buildGroup$1(group.base, style);
9741
9719
 
9742
- const prescriptsNode = new mathMLTree.MathNode("mprescripts");
9743
- const noneNode = new mathMLTree.MathNode("none");
9720
+ const prescriptsNode = new MathNode("mprescripts");
9721
+ const noneNode = new MathNode("none");
9744
9722
  let children = [];
9745
9723
 
9746
9724
  const preSub = buildGroup(group.prescripts.sub, style, noneNode);
@@ -9759,7 +9737,7 @@ defineFunction({
9759
9737
  children = [base, prescriptsNode, preSub, preSup];
9760
9738
  }
9761
9739
 
9762
- return new mathMLTree.MathNode("mmultiscripts", children);
9740
+ return new MathNode("mmultiscripts", children);
9763
9741
  }
9764
9742
  });
9765
9743
 
@@ -9772,9 +9750,9 @@ defineFunction({
9772
9750
  allowedInText: false
9773
9751
  },
9774
9752
  handler({ parser }, args) {
9775
- const isCharacterBox = utils.isCharacterBox(args[0]);
9753
+ const isCharacterBox$1 = isCharacterBox(args[0]);
9776
9754
  let body;
9777
- if (isCharacterBox) {
9755
+ if (isCharacterBox$1) {
9778
9756
  body = ordargument(args[0]);
9779
9757
  if (body[0].text.charAt(0) === "\\") {
9780
9758
  body[0].text = symbols.math[body[0].text].replace;
@@ -9792,7 +9770,7 @@ defineFunction({
9792
9770
  type: "not",
9793
9771
  mode: parser.mode,
9794
9772
  body,
9795
- isCharacterBox
9773
+ isCharacterBox: isCharacterBox$1
9796
9774
  };
9797
9775
  },
9798
9776
  mathmlBuilder(group, style) {
@@ -10171,9 +10149,9 @@ const mathmlBuilder$1 = (group, style) => {
10171
10149
  let isAllString = true; // default
10172
10150
  for (let i = 0; i < expression.length; i++) {
10173
10151
  let node = expression[i];
10174
- if (node instanceof mathMLTree.MathNode) {
10152
+ if (node instanceof MathNode) {
10175
10153
  if ((node.type === "mrow" || node.type === "mpadded") && node.children.length === 1 &&
10176
- node.children[0] instanceof mathMLTree.MathNode) {
10154
+ node.children[0] instanceof MathNode) {
10177
10155
  node = node.children[0];
10178
10156
  }
10179
10157
  switch (node.type) {
@@ -10190,14 +10168,14 @@ const mathmlBuilder$1 = (group, style) => {
10190
10168
  if (ch === "") {
10191
10169
  isAllString = false;
10192
10170
  } else {
10193
- expression[i] = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode(ch)]);
10171
+ expression[i] = new MathNode("mtext", [new TextNode(ch)]);
10194
10172
  }
10195
10173
  }
10196
10174
  }
10197
10175
  break
10198
10176
  case "mo": {
10199
10177
  const child = node.children[0];
10200
- if (node.children.length === 1 && child instanceof mathMLTree.TextNode) {
10178
+ if (node.children.length === 1 && child instanceof TextNode) {
10201
10179
  child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
10202
10180
  } else {
10203
10181
  isAllString = false;
@@ -10215,7 +10193,7 @@ const mathmlBuilder$1 = (group, style) => {
10215
10193
  if (isAllString) {
10216
10194
  // Write a single TextNode instead of multiple nested tags.
10217
10195
  const word = expression.map((node) => node.toText()).join("");
10218
- expression = [new mathMLTree.TextNode(word)];
10196
+ expression = [new TextNode(word)];
10219
10197
  } else if (
10220
10198
  expression.length === 1
10221
10199
  && ["mover", "munder"].includes(expression[0].type) &&
@@ -10223,41 +10201,41 @@ const mathmlBuilder$1 = (group, style) => {
10223
10201
  ) {
10224
10202
  expression[0].children[0].type = "mi";
10225
10203
  if (group.parentIsSupSub) {
10226
- return new mathMLTree.MathNode("mrow", expression)
10204
+ return new MathNode("mrow", expression)
10227
10205
  } else {
10228
- const operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]);
10229
- return mathMLTree.newDocumentFragment([expression[0], operator])
10206
+ const operator = new MathNode("mo", [makeText("\u2061", "text")]);
10207
+ return newDocumentFragment([expression[0], operator])
10230
10208
  }
10231
10209
  }
10232
10210
 
10233
10211
  let wrapper;
10234
10212
  if (isAllString) {
10235
- wrapper = new mathMLTree.MathNode("mi", expression);
10213
+ wrapper = new MathNode("mi", expression);
10236
10214
  if (expression[0].text.length === 1) {
10237
10215
  wrapper.setAttribute("mathvariant", "normal");
10238
10216
  }
10239
10217
  } else {
10240
- wrapper = new mathMLTree.MathNode("mrow", expression);
10218
+ wrapper = new MathNode("mrow", expression);
10241
10219
  }
10242
10220
 
10243
10221
  if (!group.parentIsSupSub) {
10244
10222
  // Append an <mo>&ApplyFunction;</mo>.
10245
10223
  // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
10246
- const operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]);
10224
+ const operator = new MathNode("mo", [makeText("\u2061", "text")]);
10247
10225
  const fragment = [wrapper, operator];
10248
10226
  if (group.needsLeadingSpace) {
10249
10227
  // LaTeX gives operator spacing, but a <mi> gets ord spacing.
10250
10228
  // So add a leading space.
10251
- const space = new mathMLTree.MathNode("mspace");
10229
+ const space = new MathNode("mspace");
10252
10230
  space.setAttribute("width", "0.1667em"); // thin space.
10253
10231
  fragment.unshift(space);
10254
10232
  }
10255
10233
  if (!group.isFollowedByDelimiter) {
10256
- const trail = new mathMLTree.MathNode("mspace");
10234
+ const trail = new MathNode("mspace");
10257
10235
  trail.setAttribute("width", "0.1667em"); // thin space.
10258
10236
  fragment.push(trail);
10259
10237
  }
10260
- return mathMLTree.newDocumentFragment(fragment)
10238
+ return newDocumentFragment(fragment)
10261
10239
  }
10262
10240
 
10263
10241
  return wrapper
@@ -10317,7 +10295,7 @@ defineFunction({
10317
10295
  },
10318
10296
  mathmlBuilder: (group, style) => {
10319
10297
  const inner = buildExpression(group.body, style);
10320
- return new mathMLTree.MathNode("mphantom", inner);
10298
+ return new MathNode("mphantom", inner);
10321
10299
  }
10322
10300
  });
10323
10301
 
@@ -10338,8 +10316,8 @@ defineFunction({
10338
10316
  },
10339
10317
  mathmlBuilder: (group, style) => {
10340
10318
  const inner = buildExpression(ordargument(group.body), style);
10341
- const phantom = new mathMLTree.MathNode("mphantom", inner);
10342
- const node = new mathMLTree.MathNode("mpadded", [phantom]);
10319
+ const phantom = new MathNode("mphantom", inner);
10320
+ const node = new MathNode("mpadded", [phantom]);
10343
10321
  node.setAttribute("height", "0px");
10344
10322
  node.setAttribute("depth", "0px");
10345
10323
  return node;
@@ -10363,8 +10341,8 @@ defineFunction({
10363
10341
  },
10364
10342
  mathmlBuilder: (group, style) => {
10365
10343
  const inner = buildExpression(ordargument(group.body), style);
10366
- const phantom = new mathMLTree.MathNode("mphantom", inner);
10367
- const node = new mathMLTree.MathNode("mpadded", [phantom]);
10344
+ const phantom = new MathNode("mphantom", inner);
10345
+ const node = new MathNode("mpadded", [phantom]);
10368
10346
  node.setAttribute("width", "0px");
10369
10347
  return node;
10370
10348
  }
@@ -10401,7 +10379,7 @@ defineFunction({
10401
10379
 
10402
10380
  const mathmlBuilder = (group, style) => {
10403
10381
  const newStyle = style.withLevel(StyleLevel.TEXT);
10404
- const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, newStyle)]);
10382
+ const node = new MathNode("mpadded", [buildGroup$1(group.body, newStyle)]);
10405
10383
  const dy = calculateSize(group.dy, style);
10406
10384
  node.setAttribute("voffset", dy.number + dy.unit);
10407
10385
  // Add padding, which acts to increase height in Chromium.
@@ -10549,7 +10527,7 @@ defineFunction({
10549
10527
  : { number: 0, unit: "em" };
10550
10528
  const color = (style.color && style.getColor()) || "black";
10551
10529
 
10552
- const rule = new mathMLTree.MathNode("mspace");
10530
+ const rule = new MathNode("mspace");
10553
10531
  if (width.number > 0 && height.number > 0) {
10554
10532
  rule.setAttribute("mathbackground", color);
10555
10533
  }
@@ -10557,7 +10535,7 @@ defineFunction({
10557
10535
  rule.setAttribute("height", height.number + height.unit);
10558
10536
  if (shift.number === 0) { return rule }
10559
10537
 
10560
- const wrapper = new mathMLTree.MathNode("mpadded", [rule]);
10538
+ const wrapper = new MathNode("mpadded", [rule]);
10561
10539
  if (shift.number >= 0) {
10562
10540
  wrapper.setAttribute("height", "+" + shift.number + shift.unit);
10563
10541
  } else {
@@ -10629,8 +10607,8 @@ defineFunction({
10629
10607
  const numerator = group.numerator.split('').map(c => unicodeNumSups[c]).join('');
10630
10608
  const denominator = group.denominator.split('').map(c => unicodeNumSubs[c]).join('');
10631
10609
  // Use a fraction slash.
10632
- const text = new mathMLTree.TextNode(numerator + "\u2044" + denominator, group.mode, style);
10633
- 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"])
10634
10612
  }
10635
10613
  });
10636
10614
 
@@ -10743,7 +10721,7 @@ defineFunction({
10743
10721
  };
10744
10722
  },
10745
10723
  mathmlBuilder: (group, style) => {
10746
- const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, style)]);
10724
+ const node = new MathNode("mpadded", [buildGroup$1(group.body, style)]);
10747
10725
 
10748
10726
  if (group.smashHeight) {
10749
10727
  node.setAttribute("height", "0px");
@@ -10796,11 +10774,11 @@ defineFunction({
10796
10774
  mathmlBuilder(group, style) {
10797
10775
  const { body, index } = group;
10798
10776
  return index
10799
- ? new mathMLTree.MathNode("mroot", [
10777
+ ? new MathNode("mroot", [
10800
10778
  buildGroup$1(body, style),
10801
10779
  buildGroup$1(index, style.incrementLevel())
10802
10780
  ])
10803
- : new mathMLTree.MathNode("msqrt", [buildGroup$1(body, style)]);
10781
+ : new MathNode("msqrt", [buildGroup$1(body, style)]);
10804
10782
  }
10805
10783
  });
10806
10784
 
@@ -10999,26 +10977,26 @@ defineFunctionBuilders({
10999
10977
  }
11000
10978
  }
11001
10979
 
11002
- let node = new mathMLTree.MathNode(nodeType, children);
10980
+ let node = new MathNode(nodeType, children);
11003
10981
  if (appendApplyFunction) {
11004
10982
  // Append an <mo>&ApplyFunction;</mo>.
11005
10983
  // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
11006
- const operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]);
10984
+ const operator = new MathNode("mo", [makeText("\u2061", "text")]);
11007
10985
  if (needsLeadingSpace) {
11008
- const space = new mathMLTree.MathNode("mspace");
10986
+ const space = new MathNode("mspace");
11009
10987
  space.setAttribute("width", "0.1667em"); // thin space.
11010
- node = mathMLTree.newDocumentFragment([space, node, operator]);
10988
+ node = newDocumentFragment([space, node, operator]);
11011
10989
  } else {
11012
- node = mathMLTree.newDocumentFragment([node, operator]);
10990
+ node = newDocumentFragment([node, operator]);
11013
10991
  }
11014
10992
  if (appendSpace) {
11015
- const space = new mathMLTree.MathNode("mspace");
10993
+ const space = new MathNode("mspace");
11016
10994
  space.setAttribute("width", "0.1667em"); // thin space.
11017
10995
  node.children.push(space);
11018
10996
  }
11019
10997
  } else if (symbolRegEx.test(nodeType)) {
11020
10998
  // Wrap in a <mrow>. Otherwise Firefox stretchy parens will not stretch to include limits.
11021
- node = new mathMLTree.MathNode("mrow", [node]);
10999
+ node = new MathNode("mrow", [node]);
11022
11000
  }
11023
11001
 
11024
11002
  return node
@@ -11043,7 +11021,7 @@ const isArrow = str => {
11043
11021
  defineFunctionBuilders({
11044
11022
  type: "atom",
11045
11023
  mathmlBuilder(group, style) {
11046
- const node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]);
11024
+ const node = new MathNode("mo", [makeText(group.text, group.mode)]);
11047
11025
  if (group.family === "punct") {
11048
11026
  node.setAttribute("separator", "true");
11049
11027
  } else if (group.family === "open" || group.family === "close") {
@@ -11073,10 +11051,10 @@ defineFunctionBuilders({
11073
11051
  } else if (group.needsSpacing) {
11074
11052
  // Fix a MathML bug that occurs when a <mo> is between two <mtext> elements.
11075
11053
  if (group.family === "bin") {
11076
- return new mathMLTree.MathNode("mrow", [padding(0.222), node, padding(0.222)])
11054
+ return new MathNode("mrow", [padding(0.222), node, padding(0.222)])
11077
11055
  } else {
11078
11056
  // REL spacing
11079
- return new mathMLTree.MathNode("mrow", [padding(0.2778), node, padding(0.2778)])
11057
+ return new MathNode("mrow", [padding(0.2778), node, padding(0.2778)])
11080
11058
  }
11081
11059
  }
11082
11060
  return node;
@@ -11417,8 +11395,8 @@ const primes = new Set(["\\prime", "\\dprime", "\\trprime", "\\qprime",
11417
11395
  "\\backprime", "\\backdprime", "\\backtrprime"]);
11418
11396
 
11419
11397
  const italicNumber = (text, variant, tag) => {
11420
- const mn = new mathMLTree.MathNode(tag, [text]);
11421
- const wrapper = new mathMLTree.MathNode("mstyle", [mn]);
11398
+ const mn = new MathNode(tag, [text]);
11399
+ const wrapper = new MathNode("mstyle", [mn]);
11422
11400
  wrapper.style["font-style"] = "italic";
11423
11401
  wrapper.style["font-family"] = "Cambria, 'Times New Roman', serif";
11424
11402
  if (variant === "bold-italic") { wrapper.style["font-weight"] = "bold"; }
@@ -11435,17 +11413,17 @@ defineFunctionBuilders({
11435
11413
  const variant = getVariant(group, style) || defaultVariant;
11436
11414
  if (variant === "script") {
11437
11415
  text.text = variantChar(text.text, variant);
11438
- return new mathMLTree.MathNode("mi", [text], [style.font])
11416
+ return new MathNode("mi", [text], [style.font])
11439
11417
  } else if (variant !== "italic") {
11440
11418
  text.text = variantChar(text.text, variant);
11441
11419
  }
11442
- let node = new mathMLTree.MathNode("mi", [text]);
11420
+ let node = new MathNode("mi", [text]);
11443
11421
  // TODO: Handle U+1D49C - U+1D4CF per https://www.unicode.org/charts/PDF/U1D400.pdf
11444
11422
  if (variant === "normal") {
11445
11423
  node.setAttribute("mathvariant", "normal");
11446
11424
  if (text.text.length === 1) {
11447
11425
  // A Firefox bug will apply spacing here, but there should be none. Fix it.
11448
- node = new mathMLTree.MathNode("mpadded", [node]);
11426
+ node = new MathNode("mpadded", [node]);
11449
11427
  node.setAttribute("lspace", "0");
11450
11428
  }
11451
11429
  }
@@ -11476,15 +11454,15 @@ defineFunctionBuilders({
11476
11454
  if (variant !== "normal") {
11477
11455
  text.text = text.text.split("").map(c => variantChar(c, variant)).join("");
11478
11456
  }
11479
- node = new mathMLTree.MathNode(tag, [text]);
11457
+ node = new MathNode(tag, [text]);
11480
11458
  }
11481
11459
  } else if (group.mode === "text") {
11482
11460
  if (variant !== "normal") {
11483
11461
  text.text = variantChar(text.text, variant);
11484
11462
  }
11485
- node = new mathMLTree.MathNode("mtext", [text]);
11463
+ node = new MathNode("mtext", [text]);
11486
11464
  } else if (primes.has(group.text)) {
11487
- node = new mathMLTree.MathNode("mo", [text]);
11465
+ node = new MathNode("mo", [text]);
11488
11466
  // TODO: If/when Chromium uses ssty variant for prime, remove the next line.
11489
11467
  node.classes.push("tml-prime");
11490
11468
  } else {
@@ -11492,7 +11470,7 @@ defineFunctionBuilders({
11492
11470
  if (variant !== "italic") {
11493
11471
  text.text = variantChar(text.text, variant);
11494
11472
  }
11495
- node = new mathMLTree.MathNode("mi", [text]);
11473
+ node = new MathNode("mi", [text]);
11496
11474
  if (text.text === origText && latinRegEx.test(origText)) {
11497
11475
  node.setAttribute("mathvariant", "italic");
11498
11476
  }
@@ -11535,11 +11513,11 @@ defineFunctionBuilders({
11535
11513
  // Firefox does not render a space in a <mtext> </mtext>. So write a no-break space.
11536
11514
  // TODO: If Firefox fixes that bug, uncomment the next line and write ch into the node.
11537
11515
  //const ch = (regularSpace[group.text].className === "nobreak") ? "\u00a0" : " "
11538
- node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\u00a0")]);
11516
+ node = new MathNode("mtext", [new TextNode("\u00a0")]);
11539
11517
  } else if (Object.prototype.hasOwnProperty.call(cssSpace, group.text)) {
11540
11518
  // MathML 3.0 calls for nobreak to occur in an <mo>, not an <mtext>
11541
11519
  // Ref: https://www.w3.org/Math/draft-spec/mathml.html#chapter3_presm.lbattrs
11542
- node = new mathMLTree.MathNode("mo");
11520
+ node = new MathNode("mo");
11543
11521
  if (group.text === "\\nobreak") {
11544
11522
  node.setAttribute("linebreak", "nobreak");
11545
11523
  }
@@ -11654,10 +11632,10 @@ defineFunction({
11654
11632
  },
11655
11633
  mathmlBuilder(group, style) {
11656
11634
  // Use a math table to create vertically centered content.
11657
- const mtd = new mathMLTree.MathNode("mtd", [buildGroup$1(group.body, style)]);
11635
+ const mtd = new MathNode("mtd", [buildGroup$1(group.body, style)]);
11658
11636
  mtd.style.padding = "0";
11659
- const mtr = new mathMLTree.MathNode("mtr", [mtd]);
11660
- return new mathMLTree.MathNode("mtable", [mtr])
11637
+ const mtr = new MathNode("mtr", [mtd]);
11638
+ return new MathNode("mtable", [mtr])
11661
11639
  }
11662
11640
  });
11663
11641
 
@@ -11676,8 +11654,8 @@ defineFunction({
11676
11654
  throw new ParseError("\\verb ended by end of line instead of matching delimiter");
11677
11655
  },
11678
11656
  mathmlBuilder(group, style) {
11679
- const text = new mathMLTree.TextNode(makeVerb(group));
11680
- const node = new mathMLTree.MathNode("mtext", [text]);
11657
+ const text = new TextNode(makeVerb(group));
11658
+ const node = new MathNode("mtext", [text]);
11681
11659
  node.setAttribute("mathvariant", "monospace");
11682
11660
  return node;
11683
11661
  }
@@ -14009,7 +13987,7 @@ class Style {
14009
13987
  * https://mit-license.org/
14010
13988
  */
14011
13989
 
14012
- const version = "0.11.11";
13990
+ const version = "0.12.01";
14013
13991
 
14014
13992
  function postProcess(block) {
14015
13993
  const labelMap = {};