temml 0.11.7 → 0.11.9

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.
package/dist/temml.mjs CHANGED
@@ -834,6 +834,9 @@ const stretchyCodePoint = {
834
834
  xtwoheadrightarrow: "\u21a0",
835
835
  xlongequal: "=",
836
836
  xrightleftarrows: "\u21c4",
837
+ xtofrom: "\u21c4",
838
+ xleftrightharpoons: "\u21cb",
839
+ xrightleftharpoons: "\u21cc",
837
840
  yields: "\u2192",
838
841
  yieldsLeft: "\u2190",
839
842
  mesomerism: "\u2194",
@@ -843,7 +846,9 @@ const stretchyCodePoint = {
843
846
  eqleftharpoondown: "\u21bd",
844
847
  "\\cdrightarrow": "\u2192",
845
848
  "\\cdleftarrow": "\u2190",
846
- "\\cdlongequal": "="
849
+ "\\cdlongequal": "=",
850
+ yieldsLeftRight: "\u21c4",
851
+ chemequilibrium: "\u21cc"
847
852
  };
848
853
 
849
854
  const mathMLnode = function(label) {
@@ -1771,7 +1776,7 @@ defineSymbol(math, inner, "\u22ef", "\\@cdots", true);
1771
1776
  defineSymbol(math, inner, "\u22f1", "\\ddots", true);
1772
1777
  defineSymbol(math, textord, "\u22ee", "\\varvdots"); // \vdots is a macro
1773
1778
  defineSymbol(text, textord, "\u22ee", "\\varvdots");
1774
- defineSymbol(math, accent, "\u02ca", "\\acute");
1779
+ defineSymbol(math, accent, "\u00b4", "\\acute");
1775
1780
  defineSymbol(math, accent, "\u0060", "\\grave");
1776
1781
  defineSymbol(math, accent, "\u00a8", "\\ddot");
1777
1782
  defineSymbol(math, accent, "\u2026", "\\dddot");
@@ -1797,7 +1802,7 @@ defineSymbol(math, mathord, "\u00d8", "\\O", true);
1797
1802
  defineSymbol(text, accent, "\u02ca", "\\'"); // acute
1798
1803
  defineSymbol(text, accent, "\u02cb", "\\`"); // grave
1799
1804
  defineSymbol(text, accent, "\u02c6", "\\^"); // circumflex
1800
- defineSymbol(text, accent, "\u02dc", "\\~"); // tilde
1805
+ defineSymbol(text, accent, "\u007e", "\\~"); // tilde
1801
1806
  defineSymbol(text, accent, "\u02c9", "\\="); // macron
1802
1807
  defineSymbol(text, accent, "\u02d8", "\\u"); // breve
1803
1808
  defineSymbol(text, accent, "\u02d9", "\\."); // dot above
@@ -1809,7 +1814,7 @@ defineSymbol(text, accent, "\u02dd", "\\H"); // double acute
1809
1814
  defineSymbol(math, accent, "\u02ca", "\\'"); // acute
1810
1815
  defineSymbol(math, accent, "\u02cb", "\\`"); // grave
1811
1816
  defineSymbol(math, accent, "\u02c6", "\\^"); // circumflex
1812
- defineSymbol(math, accent, "\u02dc", "\\~"); // tilde
1817
+ defineSymbol(math, accent, "\u007e", "\\~"); // tilde
1813
1818
  defineSymbol(math, accent, "\u02c9", "\\="); // macron
1814
1819
  defineSymbol(math, accent, "\u02d8", "\\u"); // breve
1815
1820
  defineSymbol(math, accent, "\u02d9", "\\."); // dot above
@@ -2466,46 +2471,61 @@ function buildMathML(tree, texExpression, style, settings) {
2466
2471
  return math;
2467
2472
  }
2468
2473
 
2474
+ // Identify letters to which we'll attach a combining accent character
2469
2475
  const smalls = "acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳";
2470
- const talls = "ABCDEFGHIJKLMNOPQRSTUVWXYZbdfhkltΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩβδλζφθψ"
2471
- + "𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐛𝐝𝐟𝐡𝐤𝐥𝐭";
2472
- const longSmalls = new Set(["\\alpha", "\\gamma", "\\delta", "\\epsilon", "\\eta", "\\iota",
2473
- "\\kappa", "\\mu", "\\nu", "\\pi", "\\rho", "\\sigma", "\\tau", "\\upsilon", "\\chi", "\\psi",
2474
- "\\omega", "\\imath", "\\jmath"]);
2475
- const longTalls = new Set(["\\Gamma", "\\Delta", "\\Sigma", "\\Omega", "\\beta", "\\delta",
2476
- "\\lambda", "\\theta", "\\psi"]);
2476
+
2477
+ // From the KaTeX font metrics, identify letters whose accents need a italic correction.
2478
+ const smallNudge = "DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ";
2479
+ const mediumNudge = "BCEGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ";
2480
+ const largeNudge = "AFJdfΔΛ";
2477
2481
 
2478
2482
  const mathmlBuilder$a = (group, style) => {
2479
2483
  const accentNode = group.isStretchy
2480
2484
  ? stretchy.accentNode(group)
2481
2485
  : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]);
2482
-
2483
- if (group.label === "\\vec") {
2484
- accentNode.style.transform = "scale(0.75) translate(10%, 30%)";
2485
- } else {
2486
- accentNode.style.mathStyle = "normal";
2487
- accentNode.style.mathDepth = "0";
2488
- if (needWebkitShift.has(group.label) && utils.isCharacterBox(group.base)) {
2489
- let shift = "";
2490
- const ch = group.base.text;
2491
- if (smalls.indexOf(ch) > -1 || longSmalls.has(ch)) { shift = "tml-xshift"; }
2492
- if (talls.indexOf(ch) > -1 || longTalls.has(ch)) { shift = "tml-capshift"; }
2493
- if (shift) { accentNode.classes.push(shift); }
2494
- }
2495
- }
2496
2486
  if (!group.isStretchy) {
2497
- accentNode.setAttribute("stretchy", "false");
2498
- }
2499
-
2500
- const node = new mathMLTree.MathNode((group.label === "\\c" ? "munder" : "mover"),
2501
- [buildGroup$1(group.base, style), accentNode]
2502
- );
2503
-
2487
+ accentNode.setAttribute("stretchy", "false"); // Keep Firefox from stretching \check
2488
+ }
2489
+ if (group.label !== "\\vec") {
2490
+ accentNode.style.mathDepth = "0"; // not scriptstyle
2491
+ // Don't use attribute accent="true" because MathML Core eliminates a needed space.
2492
+ }
2493
+ const tag = group.label === "\\c" ? "munder" : "mover";
2494
+ const needsWbkVertShift = needsWebkitVerticalShift.has(group.label);
2495
+ if (tag === "mover" && group.mode === "math" && (!group.isStretchy) && group.base.text
2496
+ && group.base.text.length === 1) {
2497
+ const text = group.base.text;
2498
+ const isVec = group.label === "\\vec";
2499
+ const vecPostfix = isVec === "\\vec" ? "-vec" : "";
2500
+ if (isVec) {
2501
+ accentNode.classes.push("tml-vec"); // Firefox sizing of \vec arrow
2502
+ }
2503
+ const wbkPostfix = isVec ? "-vec" : needsWbkVertShift ? "-acc" : "";
2504
+ if (smallNudge.indexOf(text) > -1) {
2505
+ accentNode.classes.push(`chr-sml${vecPostfix}`);
2506
+ accentNode.classes.push(`wbk-sml${wbkPostfix}`);
2507
+ } else if (mediumNudge.indexOf(text) > -1) {
2508
+ accentNode.classes.push(`chr-med${vecPostfix}`);
2509
+ accentNode.classes.push(`wbk-med${wbkPostfix}`);
2510
+ } else if (largeNudge.indexOf(text) > -1) {
2511
+ accentNode.classes.push(`chr-lrg${vecPostfix}`);
2512
+ accentNode.classes.push(`wbk-lrg${wbkPostfix}`);
2513
+ } else if (isVec) {
2514
+ accentNode.classes.push(`wbk-vec`);
2515
+ } else if (needsWbkVertShift) {
2516
+ accentNode.classes.push(`wbk-acc`);
2517
+ }
2518
+ } else if (needsWbkVertShift) {
2519
+ // text-mode accents
2520
+ accentNode.classes.push("wbk-acc");
2521
+ }
2522
+ const node = new mathMLTree.MathNode(tag, [buildGroup$1(group.base, style), accentNode]);
2504
2523
  return node;
2505
2524
  };
2506
2525
 
2507
2526
  const nonStretchyAccents = new Set([
2508
2527
  "\\acute",
2528
+ "\\check",
2509
2529
  "\\grave",
2510
2530
  "\\ddot",
2511
2531
  "\\dddot",
@@ -2520,7 +2540,7 @@ const nonStretchyAccents = new Set([
2520
2540
  "\\mathring"
2521
2541
  ]);
2522
2542
 
2523
- const needWebkitShift = new Set([
2543
+ const needsWebkitVerticalShift = new Set([
2524
2544
  "\\acute",
2525
2545
  "\\bar",
2526
2546
  "\\breve",
@@ -2530,7 +2550,7 @@ const needWebkitShift = new Set([
2530
2550
  "\\grave",
2531
2551
  "\\hat",
2532
2552
  "\\mathring",
2533
- "\\'", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v"
2553
+ "\\`", "\\'", "\\^", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v"
2534
2554
  ]);
2535
2555
 
2536
2556
  const combiningChar = {
@@ -2544,7 +2564,8 @@ const combiningChar = {
2544
2564
  '\\"': "\u0308",
2545
2565
  "\\r": "\u030A",
2546
2566
  "\\H": "\u030B",
2547
- "\\v": "\u030C"
2567
+ "\\v": "\u030C",
2568
+ "\\c": "\u0327"
2548
2569
  };
2549
2570
 
2550
2571
  // Accents
@@ -2589,8 +2610,8 @@ defineFunction({
2589
2610
  type: "accent",
2590
2611
  mode: context.parser.mode,
2591
2612
  label: context.funcName,
2592
- isStretchy: isStretchy,
2593
- base: base
2613
+ isStretchy,
2614
+ base
2594
2615
  };
2595
2616
  },
2596
2617
  mathmlBuilder: mathmlBuilder$a
@@ -2617,21 +2638,25 @@ defineFunction({
2617
2638
  }
2618
2639
 
2619
2640
  if (mode === "text" && base.text && base.text.length === 1
2620
- && context.funcName in combiningChar && smalls.indexOf(base.text) > -1) {
2641
+ && context.funcName in combiningChar && smalls.indexOf(base.text) > -1) {
2621
2642
  // Return a combining accent character
2622
2643
  return {
2623
2644
  type: "textord",
2624
2645
  mode: "text",
2625
2646
  text: base.text + combiningChar[context.funcName]
2626
2647
  }
2648
+ } else if (context.funcName === "\\c" && mode === "text" && base.text
2649
+ && base.text.length === 1) {
2650
+ // combining cedilla
2651
+ return { type: "textord", mode: "text", text: base.text + "\u0327" }
2627
2652
  } else {
2628
2653
  // Build up the accent
2629
2654
  return {
2630
2655
  type: "accent",
2631
- mode: mode,
2656
+ mode,
2632
2657
  label: context.funcName,
2633
2658
  isStretchy: false,
2634
- base: base
2659
+ base
2635
2660
  }
2636
2661
  }
2637
2662
  },
@@ -2889,12 +2914,17 @@ defineFunction({
2889
2914
  "\\xlongequal",
2890
2915
  "\\xtwoheadrightarrow",
2891
2916
  "\\xtwoheadleftarrow",
2892
- // The next 5 functions are here only to support mhchem
2917
+ "\\xtofrom", // expfeil
2918
+ "\\xleftrightharpoons", // mathtools
2919
+ "\\xrightleftharpoons", // mathtools
2920
+ // The next 7 functions are here only to support mhchem
2893
2921
  "\\yields",
2894
2922
  "\\yieldsLeft",
2895
2923
  "\\mesomerism",
2896
2924
  "\\longrightharpoonup",
2897
2925
  "\\longleftharpoondown",
2926
+ "\\yieldsLeftRight",
2927
+ "\\chemequilibrium",
2898
2928
  // The next 3 functions are here only to support the {CD} environment.
2899
2929
  "\\\\cdrightarrow",
2900
2930
  "\\\\cdleftarrow",
@@ -2925,26 +2955,15 @@ defineFunction({
2925
2955
  });
2926
2956
 
2927
2957
  const arrowComponent = {
2928
- "\\xtofrom": ["\\xrightarrow", "\\xleftarrow"],
2929
- "\\xleftrightharpoons": ["\\xleftharpoonup", "\\xrightharpoondown"],
2930
- "\\xrightleftharpoons": ["\\xrightharpoonup", "\\xleftharpoondown"],
2931
- "\\yieldsLeftRight": ["\\yields", "\\yieldsLeft"],
2932
- // The next three all get the same harpoon glyphs. Only the lengths and paddings differ.
2933
- "\\equilibrium": ["\\longrightharpoonup", "\\longleftharpoondown"],
2934
2958
  "\\equilibriumRight": ["\\longrightharpoonup", "\\eqleftharpoondown"],
2935
2959
  "\\equilibriumLeft": ["\\eqrightharpoonup", "\\longleftharpoondown"]
2936
2960
  };
2937
2961
 
2938
- // Browsers are not good at stretching a glyph that contains a pair of stacked arrows such as ⇄.
2939
- // So we stack a pair of single arrows.
2962
+ // Math fonts do not have a single glyph for these two mhchem functions.
2963
+ // So we stack a pair of single harpoons.
2940
2964
  defineFunction({
2941
2965
  type: "stackedArrow",
2942
2966
  names: [
2943
- "\\xtofrom", // expfeil
2944
- "\\xleftrightharpoons", // mathtools
2945
- "\\xrightleftharpoons", // mathtools
2946
- "\\yieldsLeftRight", // mhchem
2947
- "\\equilibrium", // mhchem
2948
2967
  "\\equilibriumRight",
2949
2968
  "\\equilibriumLeft"
2950
2969
  ],
@@ -3451,7 +3470,6 @@ const bordermatrixParseTree = (matrix, delimiters) => {
3451
3470
  alwaysHandleSupSub: true,
3452
3471
  parentIsSupSub: true,
3453
3472
  symbol: false,
3454
- stack: true,
3455
3473
  suppressBaseShift: true,
3456
3474
  body: [container]
3457
3475
  };
@@ -3459,6 +3477,7 @@ const bordermatrixParseTree = (matrix, delimiters) => {
3459
3477
  const mover = {
3460
3478
  type: "supsub", // We're using the MathML equivalent
3461
3479
  mode: "math", // of TeX \overset.
3480
+ stack: true,
3462
3481
  base: base, // That keeps the {pmatrix} aligned with
3463
3482
  sup: topWrapper, // the math centerline.
3464
3483
  sub: null
@@ -5922,8 +5941,8 @@ defineMacro("\\tripleDashBetweenDoubleLine", `\\kern0.075em\\mathrlap{\\mathrlap
5922
5941
  case "<-": return "\\yieldsLeft";
5923
5942
  case "<->": return "\\mesomerism";
5924
5943
  case "<-->": return "\\yieldsLeftRight";
5925
- case "<=>": return "\\equilibrium";
5926
- case "\u21CC": return "\\equilibrium";
5944
+ case "<=>": return "\\chemequilibrium";
5945
+ case "\u21CC": return "\\chemequilibrium";
5927
5946
  case "<=>>": return "\\equilibriumRight";
5928
5947
  case "<<=>": return "\\equilibriumLeft";
5929
5948
  default:
@@ -7944,13 +7963,25 @@ defineFunction({
7944
7963
  handler: (context, args) => {
7945
7964
  const delim = checkDelimiter(args[0], context);
7946
7965
 
7947
- return {
7966
+ const delimNode = {
7948
7967
  type: "delimsizing",
7949
7968
  mode: context.parser.mode,
7950
7969
  size: delimiterSizes[context.funcName].size,
7951
7970
  mclass: delimiterSizes[context.funcName].mclass,
7952
7971
  delim: delim.text
7953
7972
  };
7973
+ const nextToken = context.parser.fetch().text;
7974
+ if (nextToken !== "^" && nextToken !== "_") {
7975
+ return delimNode
7976
+ } else {
7977
+ // Chromium mis-renders a sized delim if it is the base of a supsub.
7978
+ // So wrap it in a ordgroup.
7979
+ return {
7980
+ type: "ordgroup",
7981
+ mode: "math",
7982
+ body: [delimNode, { type: "ordgroup", mode: "math", body: [] }]
7983
+ }
7984
+ }
7954
7985
  },
7955
7986
  mathmlBuilder: (group) => {
7956
7987
  const children = [];
@@ -8186,7 +8217,8 @@ const mathmlBuilder$7 = (group, style) => {
8186
8217
  case "\\boxed":
8187
8218
  // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} from amsmath.sty
8188
8219
  node.setAttribute("notation", "box");
8189
- node.classes.push("tml-box");
8220
+ node.style.padding = "padding: 3pt 0 3pt 0";
8221
+ node.style.border = "1px solid";
8190
8222
  node.setAttribute("scriptlevel", "0");
8191
8223
  node.setAttribute("displaystyle", "true");
8192
8224
  break
@@ -9599,7 +9631,9 @@ const binrelClass = (arg) => {
9599
9631
  // (by rendering separately and with {}s before and after, and measuring
9600
9632
  // the change in spacing). We'll do roughly the same by detecting the
9601
9633
  // atom type directly.
9602
- const atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg;
9634
+ const atom = arg.type === "ordgroup" && arg.body.length && arg.body.length === 1
9635
+ ? arg.body[0]
9636
+ : arg;
9603
9637
  if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) {
9604
9638
  return "m" + atom.family;
9605
9639
  } else {
@@ -9637,14 +9671,25 @@ defineFunction({
9637
9671
  const baseArg = args[1];
9638
9672
  const shiftedArg = args[0];
9639
9673
 
9674
+ let mclass;
9675
+ if (funcName !== "\\stackrel") {
9676
+ // LaTeX applies \binrel spacing to \overset and \underset.
9677
+ mclass = binrelClass(baseArg);
9678
+ } else {
9679
+ mclass = "mrel"; // for \stackrel
9680
+ }
9681
+
9682
+ const baseType = mclass === "mrel" || mclass === "mbin"
9683
+ ? "op"
9684
+ : "ordgroup";
9685
+
9640
9686
  const baseOp = {
9641
- type: "op",
9687
+ type: baseType,
9642
9688
  mode: baseArg.mode,
9643
9689
  limits: true,
9644
9690
  alwaysHandleSupSub: true,
9645
9691
  parentIsSupSub: false,
9646
9692
  symbol: false,
9647
- stack: true,
9648
9693
  suppressBaseShift: funcName !== "\\stackrel",
9649
9694
  body: ordargument(baseArg)
9650
9695
  };
@@ -9652,6 +9697,7 @@ defineFunction({
9652
9697
  return {
9653
9698
  type: "supsub",
9654
9699
  mode: shiftedArg.mode,
9700
+ stack: true,
9655
9701
  base: baseOp,
9656
9702
  sup: funcName === "\\underset" ? null : shiftedArg,
9657
9703
  sub: funcName === "\\underset" ? shiftedArg : null
@@ -10553,6 +10599,71 @@ defineFunction({
10553
10599
  }
10554
10600
  });
10555
10601
 
10602
+ const numRegEx = /^[0-9]$/;
10603
+ const unicodeNumSubs = {
10604
+ '0': '₀',
10605
+ '1': '₁',
10606
+ '2': '₂',
10607
+ '3': '₃',
10608
+ '4': '₄',
10609
+ '5': '₅',
10610
+ '6': '₆',
10611
+ '7': '₇',
10612
+ '8': '₈',
10613
+ '9': '₉'
10614
+ };
10615
+ const unicodeNumSups = {
10616
+ '0': '⁰',
10617
+ '1': '¹',
10618
+ '2': '²',
10619
+ '3': '³',
10620
+ '4': '⁴',
10621
+ '5': '⁵',
10622
+ '6': '⁶',
10623
+ '7': '⁷',
10624
+ '8': '⁸',
10625
+ '9': '⁹'
10626
+ };
10627
+
10628
+ defineFunction({
10629
+ type: "sfrac",
10630
+ names: ["\\sfrac"],
10631
+ props: {
10632
+ numArgs: 2,
10633
+ allowedInText: true,
10634
+ allowedInMath: true
10635
+ },
10636
+ handler({ parser }, args) {
10637
+ let numerator = "";
10638
+ for (const node of args[0].body) {
10639
+ if (node.type !== "textord" || !numRegEx.test(node.text)) {
10640
+ throw new ParseError("Numerator must be an integer.", node)
10641
+ }
10642
+ numerator += node.text;
10643
+ }
10644
+ let denominator = "";
10645
+ for (const node of args[1].body) {
10646
+ if (node.type !== "textord" || !numRegEx.test(node.text)) {
10647
+ throw new ParseError("Denominator must be an integer.", node)
10648
+ }
10649
+ denominator += node.text;
10650
+ }
10651
+ return {
10652
+ type: "sfrac",
10653
+ mode: parser.mode,
10654
+ numerator,
10655
+ denominator
10656
+ };
10657
+ },
10658
+ mathmlBuilder(group, style) {
10659
+ const numerator = group.numerator.split('').map(c => unicodeNumSups[c]).join('');
10660
+ const denominator = group.denominator.split('').map(c => unicodeNumSubs[c]).join('');
10661
+ // Use a fraction slash.
10662
+ const text = new mathMLTree.TextNode(numerator + "\u2044" + denominator, group.mode, style);
10663
+ return new mathMLTree.MathNode("mn", [text], ["special-fraction"])
10664
+ }
10665
+ });
10666
+
10556
10667
  // The size mappings are taken from TeX with \normalsize=10pt.
10557
10668
  // We don't have to track script level. MathML does that.
10558
10669
  const sizeMap = {
@@ -10770,6 +10881,11 @@ defineFunction({
10770
10881
  // Helpers
10771
10882
  const symbolRegEx = /^m(over|under|underover)$/;
10772
10883
 
10884
+ // From the KaTeX font metrics, identify letters that encroach on a superscript.
10885
+ const smallPad = "DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ";
10886
+ const mediumPad = "BCEFGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ";
10887
+ const largePad = "AJdfΔΛ";
10888
+
10773
10889
  // Super scripts and subscripts, whose precise placement can depend on other
10774
10890
  // functions that precede them.
10775
10891
  defineFunctionBuilders({
@@ -10791,7 +10907,7 @@ defineFunctionBuilders({
10791
10907
  }
10792
10908
  }
10793
10909
 
10794
- if (group.base && !group.base.stack &&
10910
+ if (group.base && !group.stack &&
10795
10911
  (group.base.type === "op" || group.base.type === "operatorname")) {
10796
10912
  group.base.parentIsSupSub = true;
10797
10913
  appendApplyFunction = !group.base.symbol;
@@ -10799,7 +10915,7 @@ defineFunctionBuilders({
10799
10915
  needsLeadingSpace = group.base.needsLeadingSpace;
10800
10916
  }
10801
10917
 
10802
- const children = group.base && group.base.stack
10918
+ const children = group.stack && group.base.body.length === 1
10803
10919
  ? [buildGroup$1(group.base.body[0], style)]
10804
10920
  : [buildGroup$1(group.base, style)];
10805
10921
 
@@ -10819,11 +10935,16 @@ defineFunctionBuilders({
10819
10935
  if (group.sup) {
10820
10936
  const sup = buildGroup$1(group.sup, childStyle);
10821
10937
  if (style.level === 3) { sup.setAttribute("scriptlevel", "2"); }
10822
- const testNode = sup.type === "mrow" ? sup.children[0] : sup;
10823
- if ((testNode && testNode.type === "mo" && testNode.classes.includes("tml-prime"))
10824
- && group.base && group.base.text && "fF".indexOf(group.base.text) > -1) {
10825
- // Chromium does not address italic correction on prime. Prevent f′ from overlapping.
10826
- testNode.classes.push("prime-pad");
10938
+ if (group.base && group.base.text && group.base.text.length === 1) {
10939
+ // Make an italic correction on the superscript.
10940
+ const text = group.base.text;
10941
+ if (smallPad.indexOf(text) > -1) {
10942
+ sup.classes.push("tml-sml-pad");
10943
+ } else if (mediumPad.indexOf(text) > -1) {
10944
+ sup.classes.push("tml-med-pad");
10945
+ } else if (largePad.indexOf(text) > -1) {
10946
+ sup.classes.push("tml-lrg-pad");
10947
+ }
10827
10948
  }
10828
10949
  children.push(sup);
10829
10950
  }
@@ -10852,7 +10973,9 @@ defineFunctionBuilders({
10852
10973
  }
10853
10974
  } else if (!group.sup) {
10854
10975
  const base = group.base;
10855
- if (
10976
+ if (group.stack) {
10977
+ nodeType = "munder";
10978
+ } else if (
10856
10979
  base &&
10857
10980
  base.type === "op" &&
10858
10981
  base.limits &&
@@ -13897,7 +14020,7 @@ class Style {
13897
14020
  * https://mit-license.org/
13898
14021
  */
13899
14022
 
13900
- const version = "0.11.07";
14023
+ const version = "0.11.09";
13901
14024
 
13902
14025
  function postProcess(block) {
13903
14026
  const labelMap = {};
@@ -11,7 +11,7 @@
11
11
  * https://mit-license.org/
12
12
  */
13
13
 
14
- const version = "0.11.07";
14
+ const version = "0.11.09";
15
15
 
16
16
  function postProcess(block) {
17
17
  const labelMap = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "temml",
3
- "version": "0.11.07",
3
+ "version": "0.11.09",
4
4
  "description": "TeX to MathML conversion in JavaScript.",
5
5
  "main": "dist/temml.js",
6
6
  "engines": {
@@ -122,7 +122,6 @@ export const bordermatrixParseTree = (matrix, delimiters) => {
122
122
  alwaysHandleSupSub: true,
123
123
  parentIsSupSub: true,
124
124
  symbol: false,
125
- stack: true,
126
125
  suppressBaseShift: true,
127
126
  body: [container]
128
127
  }
@@ -130,6 +129,7 @@ export const bordermatrixParseTree = (matrix, delimiters) => {
130
129
  const mover = {
131
130
  type: "supsub", // We're using the MathML equivalent
132
131
  mode: "math", // of TeX \overset.
132
+ stack: true,
133
133
  base: base, // That keeps the {pmatrix} aligned with
134
134
  sup: topWrapper, // the math centerline.
135
135
  sub: null