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/README.md +1 -1
- package/contrib/mhchem/mhchem.js +2 -2
- package/contrib/mhchem/mhchem.min.js +1 -1
- package/dist/Temml-Asana.css +75 -16
- package/dist/Temml-Latin-Modern.css +77 -14
- package/dist/Temml-Libertinus.css +77 -13
- package/dist/Temml-Local.css +79 -11
- package/dist/Temml-NotoSans.css +78 -8
- package/dist/Temml-STIX2.css +77 -13
- package/dist/temml.cjs +194 -71
- package/dist/temml.js +192 -69
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +194 -71
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/environments/borderTree.js +1 -1
- package/src/functions/accent.js +55 -36
- package/src/functions/arrow.js +8 -14
- package/src/functions/delimsizing.js +14 -2
- package/src/functions/enclose.js +2 -1
- package/src/functions/mclass.js +17 -3
- package/src/functions/sfrac.js +68 -0
- package/src/functions/supsub.js +20 -8
- package/src/functions.js +1 -0
- package/src/postProcess.js +1 -1
- package/src/stretchy.js +6 -1
- package/src/symbols.js +3 -3
package/dist/temml.js
CHANGED
@@ -837,6 +837,9 @@ var temml = (function () {
|
|
837
837
|
xtwoheadrightarrow: "\u21a0",
|
838
838
|
xlongequal: "=",
|
839
839
|
xrightleftarrows: "\u21c4",
|
840
|
+
xtofrom: "\u21c4",
|
841
|
+
xleftrightharpoons: "\u21cb",
|
842
|
+
xrightleftharpoons: "\u21cc",
|
840
843
|
yields: "\u2192",
|
841
844
|
yieldsLeft: "\u2190",
|
842
845
|
mesomerism: "\u2194",
|
@@ -846,7 +849,9 @@ var temml = (function () {
|
|
846
849
|
eqleftharpoondown: "\u21bd",
|
847
850
|
"\\cdrightarrow": "\u2192",
|
848
851
|
"\\cdleftarrow": "\u2190",
|
849
|
-
"\\cdlongequal": "="
|
852
|
+
"\\cdlongequal": "=",
|
853
|
+
yieldsLeftRight: "\u21c4",
|
854
|
+
chemequilibrium: "\u21cc"
|
850
855
|
};
|
851
856
|
|
852
857
|
const mathMLnode = function(label) {
|
@@ -1774,7 +1779,7 @@ var temml = (function () {
|
|
1774
1779
|
defineSymbol(math, inner, "\u22f1", "\\ddots", true);
|
1775
1780
|
defineSymbol(math, textord, "\u22ee", "\\varvdots"); // \vdots is a macro
|
1776
1781
|
defineSymbol(text, textord, "\u22ee", "\\varvdots");
|
1777
|
-
defineSymbol(math, accent, "\
|
1782
|
+
defineSymbol(math, accent, "\u00b4", "\\acute");
|
1778
1783
|
defineSymbol(math, accent, "\u0060", "\\grave");
|
1779
1784
|
defineSymbol(math, accent, "\u00a8", "\\ddot");
|
1780
1785
|
defineSymbol(math, accent, "\u2026", "\\dddot");
|
@@ -1800,7 +1805,7 @@ var temml = (function () {
|
|
1800
1805
|
defineSymbol(text, accent, "\u02ca", "\\'"); // acute
|
1801
1806
|
defineSymbol(text, accent, "\u02cb", "\\`"); // grave
|
1802
1807
|
defineSymbol(text, accent, "\u02c6", "\\^"); // circumflex
|
1803
|
-
defineSymbol(text, accent, "\
|
1808
|
+
defineSymbol(text, accent, "\u007e", "\\~"); // tilde
|
1804
1809
|
defineSymbol(text, accent, "\u02c9", "\\="); // macron
|
1805
1810
|
defineSymbol(text, accent, "\u02d8", "\\u"); // breve
|
1806
1811
|
defineSymbol(text, accent, "\u02d9", "\\."); // dot above
|
@@ -1812,7 +1817,7 @@ var temml = (function () {
|
|
1812
1817
|
defineSymbol(math, accent, "\u02ca", "\\'"); // acute
|
1813
1818
|
defineSymbol(math, accent, "\u02cb", "\\`"); // grave
|
1814
1819
|
defineSymbol(math, accent, "\u02c6", "\\^"); // circumflex
|
1815
|
-
defineSymbol(math, accent, "\
|
1820
|
+
defineSymbol(math, accent, "\u007e", "\\~"); // tilde
|
1816
1821
|
defineSymbol(math, accent, "\u02c9", "\\="); // macron
|
1817
1822
|
defineSymbol(math, accent, "\u02d8", "\\u"); // breve
|
1818
1823
|
defineSymbol(math, accent, "\u02d9", "\\."); // dot above
|
@@ -2469,46 +2474,61 @@ var temml = (function () {
|
|
2469
2474
|
return math;
|
2470
2475
|
}
|
2471
2476
|
|
2477
|
+
// Identify letters to which we'll attach a combining accent character
|
2472
2478
|
const smalls = "acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳";
|
2473
|
-
|
2474
|
-
|
2475
|
-
const
|
2476
|
-
|
2477
|
-
|
2478
|
-
const longTalls = new Set(["\\Gamma", "\\Delta", "\\Sigma", "\\Omega", "\\beta", "\\delta",
|
2479
|
-
"\\lambda", "\\theta", "\\psi"]);
|
2479
|
+
|
2480
|
+
// From the KaTeX font metrics, identify letters whose accents need a italic correction.
|
2481
|
+
const smallNudge = "DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ";
|
2482
|
+
const mediumNudge = "BCEGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ";
|
2483
|
+
const largeNudge = "AFJdfΔΛ";
|
2480
2484
|
|
2481
2485
|
const mathmlBuilder$a = (group, style) => {
|
2482
2486
|
const accentNode = group.isStretchy
|
2483
2487
|
? stretchy.accentNode(group)
|
2484
2488
|
: new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]);
|
2485
|
-
|
2486
|
-
if (group.label === "\\vec") {
|
2487
|
-
accentNode.style.transform = "scale(0.75) translate(10%, 30%)";
|
2488
|
-
} else {
|
2489
|
-
accentNode.style.mathStyle = "normal";
|
2490
|
-
accentNode.style.mathDepth = "0";
|
2491
|
-
if (needWebkitShift.has(group.label) && utils.isCharacterBox(group.base)) {
|
2492
|
-
let shift = "";
|
2493
|
-
const ch = group.base.text;
|
2494
|
-
if (smalls.indexOf(ch) > -1 || longSmalls.has(ch)) { shift = "tml-xshift"; }
|
2495
|
-
if (talls.indexOf(ch) > -1 || longTalls.has(ch)) { shift = "tml-capshift"; }
|
2496
|
-
if (shift) { accentNode.classes.push(shift); }
|
2497
|
-
}
|
2498
|
-
}
|
2499
2489
|
if (!group.isStretchy) {
|
2500
|
-
accentNode.setAttribute("stretchy", "false");
|
2501
|
-
}
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2490
|
+
accentNode.setAttribute("stretchy", "false"); // Keep Firefox from stretching \check
|
2491
|
+
}
|
2492
|
+
if (group.label !== "\\vec") {
|
2493
|
+
accentNode.style.mathDepth = "0"; // not scriptstyle
|
2494
|
+
// Don't use attribute accent="true" because MathML Core eliminates a needed space.
|
2495
|
+
}
|
2496
|
+
const tag = group.label === "\\c" ? "munder" : "mover";
|
2497
|
+
const needsWbkVertShift = needsWebkitVerticalShift.has(group.label);
|
2498
|
+
if (tag === "mover" && group.mode === "math" && (!group.isStretchy) && group.base.text
|
2499
|
+
&& group.base.text.length === 1) {
|
2500
|
+
const text = group.base.text;
|
2501
|
+
const isVec = group.label === "\\vec";
|
2502
|
+
const vecPostfix = isVec === "\\vec" ? "-vec" : "";
|
2503
|
+
if (isVec) {
|
2504
|
+
accentNode.classes.push("tml-vec"); // Firefox sizing of \vec arrow
|
2505
|
+
}
|
2506
|
+
const wbkPostfix = isVec ? "-vec" : needsWbkVertShift ? "-acc" : "";
|
2507
|
+
if (smallNudge.indexOf(text) > -1) {
|
2508
|
+
accentNode.classes.push(`chr-sml${vecPostfix}`);
|
2509
|
+
accentNode.classes.push(`wbk-sml${wbkPostfix}`);
|
2510
|
+
} else if (mediumNudge.indexOf(text) > -1) {
|
2511
|
+
accentNode.classes.push(`chr-med${vecPostfix}`);
|
2512
|
+
accentNode.classes.push(`wbk-med${wbkPostfix}`);
|
2513
|
+
} else if (largeNudge.indexOf(text) > -1) {
|
2514
|
+
accentNode.classes.push(`chr-lrg${vecPostfix}`);
|
2515
|
+
accentNode.classes.push(`wbk-lrg${wbkPostfix}`);
|
2516
|
+
} else if (isVec) {
|
2517
|
+
accentNode.classes.push(`wbk-vec`);
|
2518
|
+
} else if (needsWbkVertShift) {
|
2519
|
+
accentNode.classes.push(`wbk-acc`);
|
2520
|
+
}
|
2521
|
+
} else if (needsWbkVertShift) {
|
2522
|
+
// text-mode accents
|
2523
|
+
accentNode.classes.push("wbk-acc");
|
2524
|
+
}
|
2525
|
+
const node = new mathMLTree.MathNode(tag, [buildGroup$1(group.base, style), accentNode]);
|
2507
2526
|
return node;
|
2508
2527
|
};
|
2509
2528
|
|
2510
2529
|
const nonStretchyAccents = new Set([
|
2511
2530
|
"\\acute",
|
2531
|
+
"\\check",
|
2512
2532
|
"\\grave",
|
2513
2533
|
"\\ddot",
|
2514
2534
|
"\\dddot",
|
@@ -2523,7 +2543,7 @@ var temml = (function () {
|
|
2523
2543
|
"\\mathring"
|
2524
2544
|
]);
|
2525
2545
|
|
2526
|
-
const
|
2546
|
+
const needsWebkitVerticalShift = new Set([
|
2527
2547
|
"\\acute",
|
2528
2548
|
"\\bar",
|
2529
2549
|
"\\breve",
|
@@ -2533,7 +2553,7 @@ var temml = (function () {
|
|
2533
2553
|
"\\grave",
|
2534
2554
|
"\\hat",
|
2535
2555
|
"\\mathring",
|
2536
|
-
"
|
2556
|
+
"\\`", "\\'", "\\^", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v"
|
2537
2557
|
]);
|
2538
2558
|
|
2539
2559
|
const combiningChar = {
|
@@ -2547,7 +2567,8 @@ var temml = (function () {
|
|
2547
2567
|
'\\"': "\u0308",
|
2548
2568
|
"\\r": "\u030A",
|
2549
2569
|
"\\H": "\u030B",
|
2550
|
-
"\\v": "\u030C"
|
2570
|
+
"\\v": "\u030C",
|
2571
|
+
"\\c": "\u0327"
|
2551
2572
|
};
|
2552
2573
|
|
2553
2574
|
// Accents
|
@@ -2592,8 +2613,8 @@ var temml = (function () {
|
|
2592
2613
|
type: "accent",
|
2593
2614
|
mode: context.parser.mode,
|
2594
2615
|
label: context.funcName,
|
2595
|
-
isStretchy
|
2596
|
-
base
|
2616
|
+
isStretchy,
|
2617
|
+
base
|
2597
2618
|
};
|
2598
2619
|
},
|
2599
2620
|
mathmlBuilder: mathmlBuilder$a
|
@@ -2620,21 +2641,25 @@ var temml = (function () {
|
|
2620
2641
|
}
|
2621
2642
|
|
2622
2643
|
if (mode === "text" && base.text && base.text.length === 1
|
2623
|
-
&& context.funcName in combiningChar
|
2644
|
+
&& context.funcName in combiningChar && smalls.indexOf(base.text) > -1) {
|
2624
2645
|
// Return a combining accent character
|
2625
2646
|
return {
|
2626
2647
|
type: "textord",
|
2627
2648
|
mode: "text",
|
2628
2649
|
text: base.text + combiningChar[context.funcName]
|
2629
2650
|
}
|
2651
|
+
} else if (context.funcName === "\\c" && mode === "text" && base.text
|
2652
|
+
&& base.text.length === 1) {
|
2653
|
+
// combining cedilla
|
2654
|
+
return { type: "textord", mode: "text", text: base.text + "\u0327" }
|
2630
2655
|
} else {
|
2631
2656
|
// Build up the accent
|
2632
2657
|
return {
|
2633
2658
|
type: "accent",
|
2634
|
-
mode
|
2659
|
+
mode,
|
2635
2660
|
label: context.funcName,
|
2636
2661
|
isStretchy: false,
|
2637
|
-
base
|
2662
|
+
base
|
2638
2663
|
}
|
2639
2664
|
}
|
2640
2665
|
},
|
@@ -2892,12 +2917,17 @@ var temml = (function () {
|
|
2892
2917
|
"\\xlongequal",
|
2893
2918
|
"\\xtwoheadrightarrow",
|
2894
2919
|
"\\xtwoheadleftarrow",
|
2895
|
-
//
|
2920
|
+
"\\xtofrom", // expfeil
|
2921
|
+
"\\xleftrightharpoons", // mathtools
|
2922
|
+
"\\xrightleftharpoons", // mathtools
|
2923
|
+
// The next 7 functions are here only to support mhchem
|
2896
2924
|
"\\yields",
|
2897
2925
|
"\\yieldsLeft",
|
2898
2926
|
"\\mesomerism",
|
2899
2927
|
"\\longrightharpoonup",
|
2900
2928
|
"\\longleftharpoondown",
|
2929
|
+
"\\yieldsLeftRight",
|
2930
|
+
"\\chemequilibrium",
|
2901
2931
|
// The next 3 functions are here only to support the {CD} environment.
|
2902
2932
|
"\\\\cdrightarrow",
|
2903
2933
|
"\\\\cdleftarrow",
|
@@ -2928,26 +2958,15 @@ var temml = (function () {
|
|
2928
2958
|
});
|
2929
2959
|
|
2930
2960
|
const arrowComponent = {
|
2931
|
-
"\\xtofrom": ["\\xrightarrow", "\\xleftarrow"],
|
2932
|
-
"\\xleftrightharpoons": ["\\xleftharpoonup", "\\xrightharpoondown"],
|
2933
|
-
"\\xrightleftharpoons": ["\\xrightharpoonup", "\\xleftharpoondown"],
|
2934
|
-
"\\yieldsLeftRight": ["\\yields", "\\yieldsLeft"],
|
2935
|
-
// The next three all get the same harpoon glyphs. Only the lengths and paddings differ.
|
2936
|
-
"\\equilibrium": ["\\longrightharpoonup", "\\longleftharpoondown"],
|
2937
2961
|
"\\equilibriumRight": ["\\longrightharpoonup", "\\eqleftharpoondown"],
|
2938
2962
|
"\\equilibriumLeft": ["\\eqrightharpoonup", "\\longleftharpoondown"]
|
2939
2963
|
};
|
2940
2964
|
|
2941
|
-
//
|
2942
|
-
// So we stack a pair of single
|
2965
|
+
// Math fonts do not have a single glyph for these two mhchem functions.
|
2966
|
+
// So we stack a pair of single harpoons.
|
2943
2967
|
defineFunction({
|
2944
2968
|
type: "stackedArrow",
|
2945
2969
|
names: [
|
2946
|
-
"\\xtofrom", // expfeil
|
2947
|
-
"\\xleftrightharpoons", // mathtools
|
2948
|
-
"\\xrightleftharpoons", // mathtools
|
2949
|
-
"\\yieldsLeftRight", // mhchem
|
2950
|
-
"\\equilibrium", // mhchem
|
2951
2970
|
"\\equilibriumRight",
|
2952
2971
|
"\\equilibriumLeft"
|
2953
2972
|
],
|
@@ -3454,7 +3473,6 @@ var temml = (function () {
|
|
3454
3473
|
alwaysHandleSupSub: true,
|
3455
3474
|
parentIsSupSub: true,
|
3456
3475
|
symbol: false,
|
3457
|
-
stack: true,
|
3458
3476
|
suppressBaseShift: true,
|
3459
3477
|
body: [container]
|
3460
3478
|
};
|
@@ -3462,6 +3480,7 @@ var temml = (function () {
|
|
3462
3480
|
const mover = {
|
3463
3481
|
type: "supsub", // We're using the MathML equivalent
|
3464
3482
|
mode: "math", // of TeX \overset.
|
3483
|
+
stack: true,
|
3465
3484
|
base: base, // That keeps the {pmatrix} aligned with
|
3466
3485
|
sup: topWrapper, // the math centerline.
|
3467
3486
|
sub: null
|
@@ -6033,13 +6052,25 @@ var temml = (function () {
|
|
6033
6052
|
handler: (context, args) => {
|
6034
6053
|
const delim = checkDelimiter(args[0], context);
|
6035
6054
|
|
6036
|
-
|
6055
|
+
const delimNode = {
|
6037
6056
|
type: "delimsizing",
|
6038
6057
|
mode: context.parser.mode,
|
6039
6058
|
size: delimiterSizes[context.funcName].size,
|
6040
6059
|
mclass: delimiterSizes[context.funcName].mclass,
|
6041
6060
|
delim: delim.text
|
6042
6061
|
};
|
6062
|
+
const nextToken = context.parser.fetch().text;
|
6063
|
+
if (nextToken !== "^" && nextToken !== "_") {
|
6064
|
+
return delimNode
|
6065
|
+
} else {
|
6066
|
+
// Chromium mis-renders a sized delim if it is the base of a supsub.
|
6067
|
+
// So wrap it in a ordgroup.
|
6068
|
+
return {
|
6069
|
+
type: "ordgroup",
|
6070
|
+
mode: "math",
|
6071
|
+
body: [delimNode, { type: "ordgroup", mode: "math", body: [] }]
|
6072
|
+
}
|
6073
|
+
}
|
6043
6074
|
},
|
6044
6075
|
mathmlBuilder: (group) => {
|
6045
6076
|
const children = [];
|
@@ -6275,7 +6306,8 @@ var temml = (function () {
|
|
6275
6306
|
case "\\boxed":
|
6276
6307
|
// \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} from amsmath.sty
|
6277
6308
|
node.setAttribute("notation", "box");
|
6278
|
-
node.
|
6309
|
+
node.style.padding = "padding: 3pt 0 3pt 0";
|
6310
|
+
node.style.border = "1px solid";
|
6279
6311
|
node.setAttribute("scriptlevel", "0");
|
6280
6312
|
node.setAttribute("displaystyle", "true");
|
6281
6313
|
break
|
@@ -7688,7 +7720,9 @@ var temml = (function () {
|
|
7688
7720
|
// (by rendering separately and with {}s before and after, and measuring
|
7689
7721
|
// the change in spacing). We'll do roughly the same by detecting the
|
7690
7722
|
// atom type directly.
|
7691
|
-
const atom = arg.type === "ordgroup" && arg.body.length
|
7723
|
+
const atom = arg.type === "ordgroup" && arg.body.length && arg.body.length === 1
|
7724
|
+
? arg.body[0]
|
7725
|
+
: arg;
|
7692
7726
|
if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) {
|
7693
7727
|
return "m" + atom.family;
|
7694
7728
|
} else {
|
@@ -7726,14 +7760,25 @@ var temml = (function () {
|
|
7726
7760
|
const baseArg = args[1];
|
7727
7761
|
const shiftedArg = args[0];
|
7728
7762
|
|
7763
|
+
let mclass;
|
7764
|
+
if (funcName !== "\\stackrel") {
|
7765
|
+
// LaTeX applies \binrel spacing to \overset and \underset.
|
7766
|
+
mclass = binrelClass(baseArg);
|
7767
|
+
} else {
|
7768
|
+
mclass = "mrel"; // for \stackrel
|
7769
|
+
}
|
7770
|
+
|
7771
|
+
const baseType = mclass === "mrel" || mclass === "mbin"
|
7772
|
+
? "op"
|
7773
|
+
: "ordgroup";
|
7774
|
+
|
7729
7775
|
const baseOp = {
|
7730
|
-
type:
|
7776
|
+
type: baseType,
|
7731
7777
|
mode: baseArg.mode,
|
7732
7778
|
limits: true,
|
7733
7779
|
alwaysHandleSupSub: true,
|
7734
7780
|
parentIsSupSub: false,
|
7735
7781
|
symbol: false,
|
7736
|
-
stack: true,
|
7737
7782
|
suppressBaseShift: funcName !== "\\stackrel",
|
7738
7783
|
body: ordargument(baseArg)
|
7739
7784
|
};
|
@@ -7741,6 +7786,7 @@ var temml = (function () {
|
|
7741
7786
|
return {
|
7742
7787
|
type: "supsub",
|
7743
7788
|
mode: shiftedArg.mode,
|
7789
|
+
stack: true,
|
7744
7790
|
base: baseOp,
|
7745
7791
|
sup: funcName === "\\underset" ? null : shiftedArg,
|
7746
7792
|
sub: funcName === "\\underset" ? shiftedArg : null
|
@@ -8642,6 +8688,71 @@ var temml = (function () {
|
|
8642
8688
|
}
|
8643
8689
|
});
|
8644
8690
|
|
8691
|
+
const numRegEx = /^[0-9]$/;
|
8692
|
+
const unicodeNumSubs = {
|
8693
|
+
'0': '₀',
|
8694
|
+
'1': '₁',
|
8695
|
+
'2': '₂',
|
8696
|
+
'3': '₃',
|
8697
|
+
'4': '₄',
|
8698
|
+
'5': '₅',
|
8699
|
+
'6': '₆',
|
8700
|
+
'7': '₇',
|
8701
|
+
'8': '₈',
|
8702
|
+
'9': '₉'
|
8703
|
+
};
|
8704
|
+
const unicodeNumSups = {
|
8705
|
+
'0': '⁰',
|
8706
|
+
'1': '¹',
|
8707
|
+
'2': '²',
|
8708
|
+
'3': '³',
|
8709
|
+
'4': '⁴',
|
8710
|
+
'5': '⁵',
|
8711
|
+
'6': '⁶',
|
8712
|
+
'7': '⁷',
|
8713
|
+
'8': '⁸',
|
8714
|
+
'9': '⁹'
|
8715
|
+
};
|
8716
|
+
|
8717
|
+
defineFunction({
|
8718
|
+
type: "sfrac",
|
8719
|
+
names: ["\\sfrac"],
|
8720
|
+
props: {
|
8721
|
+
numArgs: 2,
|
8722
|
+
allowedInText: true,
|
8723
|
+
allowedInMath: true
|
8724
|
+
},
|
8725
|
+
handler({ parser }, args) {
|
8726
|
+
let numerator = "";
|
8727
|
+
for (const node of args[0].body) {
|
8728
|
+
if (node.type !== "textord" || !numRegEx.test(node.text)) {
|
8729
|
+
throw new ParseError("Numerator must be an integer.", node)
|
8730
|
+
}
|
8731
|
+
numerator += node.text;
|
8732
|
+
}
|
8733
|
+
let denominator = "";
|
8734
|
+
for (const node of args[1].body) {
|
8735
|
+
if (node.type !== "textord" || !numRegEx.test(node.text)) {
|
8736
|
+
throw new ParseError("Denominator must be an integer.", node)
|
8737
|
+
}
|
8738
|
+
denominator += node.text;
|
8739
|
+
}
|
8740
|
+
return {
|
8741
|
+
type: "sfrac",
|
8742
|
+
mode: parser.mode,
|
8743
|
+
numerator,
|
8744
|
+
denominator
|
8745
|
+
};
|
8746
|
+
},
|
8747
|
+
mathmlBuilder(group, style) {
|
8748
|
+
const numerator = group.numerator.split('').map(c => unicodeNumSups[c]).join('');
|
8749
|
+
const denominator = group.denominator.split('').map(c => unicodeNumSubs[c]).join('');
|
8750
|
+
// Use a fraction slash.
|
8751
|
+
const text = new mathMLTree.TextNode(numerator + "\u2044" + denominator, group.mode, style);
|
8752
|
+
return new mathMLTree.MathNode("mn", [text], ["special-fraction"])
|
8753
|
+
}
|
8754
|
+
});
|
8755
|
+
|
8645
8756
|
// The size mappings are taken from TeX with \normalsize=10pt.
|
8646
8757
|
// We don't have to track script level. MathML does that.
|
8647
8758
|
const sizeMap = {
|
@@ -8859,6 +8970,11 @@ var temml = (function () {
|
|
8859
8970
|
// Helpers
|
8860
8971
|
const symbolRegEx = /^m(over|under|underover)$/;
|
8861
8972
|
|
8973
|
+
// From the KaTeX font metrics, identify letters that encroach on a superscript.
|
8974
|
+
const smallPad = "DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ";
|
8975
|
+
const mediumPad = "BCEFGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ";
|
8976
|
+
const largePad = "AJdfΔΛ";
|
8977
|
+
|
8862
8978
|
// Super scripts and subscripts, whose precise placement can depend on other
|
8863
8979
|
// functions that precede them.
|
8864
8980
|
defineFunctionBuilders({
|
@@ -8880,7 +8996,7 @@ var temml = (function () {
|
|
8880
8996
|
}
|
8881
8997
|
}
|
8882
8998
|
|
8883
|
-
if (group.base && !group.
|
8999
|
+
if (group.base && !group.stack &&
|
8884
9000
|
(group.base.type === "op" || group.base.type === "operatorname")) {
|
8885
9001
|
group.base.parentIsSupSub = true;
|
8886
9002
|
appendApplyFunction = !group.base.symbol;
|
@@ -8888,7 +9004,7 @@ var temml = (function () {
|
|
8888
9004
|
needsLeadingSpace = group.base.needsLeadingSpace;
|
8889
9005
|
}
|
8890
9006
|
|
8891
|
-
const children = group.
|
9007
|
+
const children = group.stack && group.base.body.length === 1
|
8892
9008
|
? [buildGroup$1(group.base.body[0], style)]
|
8893
9009
|
: [buildGroup$1(group.base, style)];
|
8894
9010
|
|
@@ -8908,11 +9024,16 @@ var temml = (function () {
|
|
8908
9024
|
if (group.sup) {
|
8909
9025
|
const sup = buildGroup$1(group.sup, childStyle);
|
8910
9026
|
if (style.level === 3) { sup.setAttribute("scriptlevel", "2"); }
|
8911
|
-
|
8912
|
-
|
8913
|
-
|
8914
|
-
|
8915
|
-
|
9027
|
+
if (group.base && group.base.text && group.base.text.length === 1) {
|
9028
|
+
// Make an italic correction on the superscript.
|
9029
|
+
const text = group.base.text;
|
9030
|
+
if (smallPad.indexOf(text) > -1) {
|
9031
|
+
sup.classes.push("tml-sml-pad");
|
9032
|
+
} else if (mediumPad.indexOf(text) > -1) {
|
9033
|
+
sup.classes.push("tml-med-pad");
|
9034
|
+
} else if (largePad.indexOf(text) > -1) {
|
9035
|
+
sup.classes.push("tml-lrg-pad");
|
9036
|
+
}
|
8916
9037
|
}
|
8917
9038
|
children.push(sup);
|
8918
9039
|
}
|
@@ -8941,7 +9062,9 @@ var temml = (function () {
|
|
8941
9062
|
}
|
8942
9063
|
} else if (!group.sup) {
|
8943
9064
|
const base = group.base;
|
8944
|
-
if (
|
9065
|
+
if (group.stack) {
|
9066
|
+
nodeType = "munder";
|
9067
|
+
} else if (
|
8945
9068
|
base &&
|
8946
9069
|
base.type === "op" &&
|
8947
9070
|
base.limits &&
|
@@ -11986,7 +12109,7 @@ var temml = (function () {
|
|
11986
12109
|
* https://mit-license.org/
|
11987
12110
|
*/
|
11988
12111
|
|
11989
|
-
const version = "0.11.
|
12112
|
+
const version = "0.11.09";
|
11990
12113
|
|
11991
12114
|
function postProcess(block) {
|
11992
12115
|
const labelMap = {};
|