temml 0.10.15 → 0.10.16
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-Asana.css +18 -0
- package/dist/Temml-Latin-Modern.css +20 -1
- package/dist/Temml-Libertinus.css +18 -0
- package/dist/Temml-Local.css +19 -1
- package/dist/Temml-STIX2.css +18 -0
- package/dist/Temml.woff2 +0 -0
- package/dist/temml.cjs +96 -31
- package/dist/temml.js +96 -31
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +96 -31
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/Parser.js +0 -1
- package/src/domTree.js +2 -2
- package/src/environments/array.js +4 -0
- package/src/functions/accent.js +17 -22
- package/src/functions/accentunder.js +1 -1
- package/src/functions/supsub.js +8 -1
- package/src/functions/symbolsOrd.js +3 -1
- package/src/macros.js +3 -0
- package/src/postProcess.js +1 -1
- package/src/stretchy.js +48 -1
- package/src/symbols.js +9 -1
package/dist/Temml-Asana.css
CHANGED
@@ -47,6 +47,24 @@ mo.tml-prime {
|
|
47
47
|
font-feature-settings: 'salt';
|
48
48
|
}
|
49
49
|
|
50
|
+
/* Prevent f' from overlapping in Chromium */
|
51
|
+
mo.prime-pad {
|
52
|
+
padding-left: 0.08em;
|
53
|
+
}
|
54
|
+
|
55
|
+
/* Stretch \widetilde in Chromium */
|
56
|
+
@supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
|
57
|
+
.tml-crooked-2 {
|
58
|
+
transform: scale(2.0, 1.1)
|
59
|
+
}
|
60
|
+
.tml-crooked-3 {
|
61
|
+
transform: scale(3.0, 1.1)
|
62
|
+
}
|
63
|
+
.tml-crooked-4 {
|
64
|
+
transform: scale(4.0, 1.1)
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
50
68
|
/* flex-wrap for line-breaking in Chromium */
|
51
69
|
math {
|
52
70
|
display: inline-flex;
|
@@ -41,7 +41,7 @@ math * {
|
|
41
41
|
}
|
42
42
|
|
43
43
|
math {
|
44
|
-
font-family: "Latin Modern Math",
|
44
|
+
font-family: "Latin Modern Math", math;
|
45
45
|
}
|
46
46
|
|
47
47
|
/* Next line is active in Firefox and Safari.
|
@@ -52,10 +52,29 @@ math.tml-display { display: block; }
|
|
52
52
|
font-family: "Temml";
|
53
53
|
}
|
54
54
|
|
55
|
+
/* Chromium prime alignment */
|
55
56
|
mo.tml-prime {
|
56
57
|
font-family: Temml;
|
57
58
|
}
|
58
59
|
|
60
|
+
/* Prevent f' from overlapping in Chromium */
|
61
|
+
mo.prime-pad {
|
62
|
+
padding-left: 0.08em;
|
63
|
+
}
|
64
|
+
|
65
|
+
/* Stretch \widetilde in Chromium */
|
66
|
+
@supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
|
67
|
+
.tml-crooked-2 {
|
68
|
+
transform: scale(2.0, 1.1)
|
69
|
+
}
|
70
|
+
.tml-crooked-3 {
|
71
|
+
transform: scale(3.0, 1.3)
|
72
|
+
}
|
73
|
+
.tml-crooked-4 {
|
74
|
+
transform: scale(4.0, 1.4)
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
59
78
|
/* flex-wrap for line-breaking in Chromium */
|
60
79
|
math {
|
61
80
|
display: inline-flex;
|
@@ -54,6 +54,24 @@ mo.tml-prime {
|
|
54
54
|
font-feature-settings: 'ssty';
|
55
55
|
}
|
56
56
|
|
57
|
+
/* Prevent f' from overlapping in Chromium */
|
58
|
+
mo.prime-pad {
|
59
|
+
padding-left: 0.08em;
|
60
|
+
}
|
61
|
+
|
62
|
+
/* Stretch \widetilde in Chromium */
|
63
|
+
@supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
|
64
|
+
.tml-crooked-2 {
|
65
|
+
transform: scale(2.0, 1.1)
|
66
|
+
}
|
67
|
+
.tml-crooked-3 {
|
68
|
+
transform: scale(3.0, 1.1)
|
69
|
+
}
|
70
|
+
.tml-crooked-4 {
|
71
|
+
transform: scale(4.0, 1.2)
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
57
75
|
/* flex-wrap for line-breaking in Chromium */
|
58
76
|
math {
|
59
77
|
display: inline-flex;
|
package/dist/Temml-Local.css
CHANGED
@@ -12,7 +12,7 @@ Unicode range 1D49C to 1D4B5.
|
|
12
12
|
}
|
13
13
|
|
14
14
|
math {
|
15
|
-
font-family: "Cambria Math", 'STIXTwoMath-Regular',
|
15
|
+
font-family: "Cambria Math", 'STIXTwoMath-Regular', math;
|
16
16
|
font-style: normal;
|
17
17
|
font-weight: normal;
|
18
18
|
line-height: normal;
|
@@ -40,6 +40,24 @@ mo.tml-prime {
|
|
40
40
|
font-family: Temml;
|
41
41
|
}
|
42
42
|
|
43
|
+
/* Prevent f' from overlapping in Chromium */
|
44
|
+
mo.prime-pad {
|
45
|
+
padding-left: 0.08em;
|
46
|
+
}
|
47
|
+
|
48
|
+
/* Stretch \widetilde in Chromium */
|
49
|
+
@supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
|
50
|
+
.tml-crooked-2 {
|
51
|
+
transform: scale(2.0, 1.1)
|
52
|
+
}
|
53
|
+
.tml-crooked-3 {
|
54
|
+
transform: scale(3.0, 1.1)
|
55
|
+
}
|
56
|
+
.tml-crooked-4 {
|
57
|
+
transform: scale(4.0, 1.1)
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
43
61
|
/* flex-wrap for line-breaking in Chromium */
|
44
62
|
math {
|
45
63
|
display: inline-flex;
|
package/dist/Temml-STIX2.css
CHANGED
@@ -48,6 +48,24 @@ mo.tml-prime {
|
|
48
48
|
font-feature-settings: 'ss04';
|
49
49
|
}
|
50
50
|
|
51
|
+
/* Prevent f' from overlapping in Chromium */
|
52
|
+
mo.prime-pad {
|
53
|
+
padding-left: 0.08em;
|
54
|
+
}
|
55
|
+
|
56
|
+
/* Stretch \widetilde in Chromium */
|
57
|
+
@supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
|
58
|
+
.tml-crooked-2 {
|
59
|
+
transform: scale(2.0, 1.1)
|
60
|
+
}
|
61
|
+
.tml-crooked-3 {
|
62
|
+
transform: scale(3.0, 1.3)
|
63
|
+
}
|
64
|
+
.tml-crooked-4 {
|
65
|
+
transform: scale(4.0, 1.4)
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
51
69
|
/* flex-wrap for line-breaking in Chromium */
|
52
70
|
math {
|
53
71
|
display: inline-flex;
|
package/dist/Temml.woff2
CHANGED
Binary file
|
package/dist/temml.cjs
CHANGED
@@ -478,7 +478,7 @@ class TextNode$1 {
|
|
478
478
|
}
|
479
479
|
}
|
480
480
|
|
481
|
-
|
481
|
+
/*
|
482
482
|
* This node represents an image embed (<img>) element.
|
483
483
|
*/
|
484
484
|
class Img {
|
@@ -523,7 +523,7 @@ class Img {
|
|
523
523
|
markup += ` style="${utils.escape(styles)}"`;
|
524
524
|
}
|
525
525
|
|
526
|
-
markup += "
|
526
|
+
markup += ">";
|
527
527
|
return markup;
|
528
528
|
}
|
529
529
|
}
|
@@ -699,6 +699,34 @@ var mathMLTree = {
|
|
699
699
|
* This file provides support for building horizontal stretchy elements.
|
700
700
|
*/
|
701
701
|
|
702
|
+
// TODO: Remove when Chromium stretches \widetilde & \widehat
|
703
|
+
const estimatedWidth = node => {
|
704
|
+
let width = 0;
|
705
|
+
if (node.body) {
|
706
|
+
for (const item of node.body) {
|
707
|
+
width += estimatedWidth(item);
|
708
|
+
}
|
709
|
+
} else if (node.type === "supsub") {
|
710
|
+
width += estimatedWidth(node.base);
|
711
|
+
if (node.sub) { width += 0.7 * estimatedWidth(node.sub); }
|
712
|
+
if (node.sup) { width += 0.7 * estimatedWidth(node.sup); }
|
713
|
+
} else if (node.type === "mathord" || node.type === "textord") {
|
714
|
+
for (const ch of node.text.split('')) {
|
715
|
+
const codePoint = ch.codePointAt(0);
|
716
|
+
if ((0x60 < codePoint && codePoint < 0x7B) || (0x03B0 < codePoint && codePoint < 0x3CA)) {
|
717
|
+
width += 0.56; // lower case latin or greek. Use advance width of letter n
|
718
|
+
} else if (0x2F < codePoint && codePoint < 0x3A) {
|
719
|
+
width += 0.50; // numerals.
|
720
|
+
} else {
|
721
|
+
width += 0.92; // advance width of letter M
|
722
|
+
}
|
723
|
+
}
|
724
|
+
} else {
|
725
|
+
width += 1.0;
|
726
|
+
}
|
727
|
+
return width
|
728
|
+
};
|
729
|
+
|
702
730
|
const stretchyCodePoint = {
|
703
731
|
widehat: "^",
|
704
732
|
widecheck: "ˇ",
|
@@ -756,8 +784,27 @@ const mathMLnode = function(label) {
|
|
756
784
|
return node
|
757
785
|
};
|
758
786
|
|
787
|
+
const crookedWides = ["\\widetilde", "\\widehat", "\\widecheck", "\\utilde"];
|
788
|
+
|
789
|
+
// TODO: Remove when Chromium stretches \widetilde & \widehat
|
790
|
+
const accentNode = (group) => {
|
791
|
+
const mo = mathMLnode(group.label);
|
792
|
+
if (crookedWides.includes(group.label)) {
|
793
|
+
const width = estimatedWidth(group.base);
|
794
|
+
if (1 < width && width < 1.6) {
|
795
|
+
mo.classes.push("tml-crooked-2");
|
796
|
+
} else if (1.6 <= width && width < 2.5) {
|
797
|
+
mo.classes.push("tml-crooked-3");
|
798
|
+
} else if (2.5 <= width) {
|
799
|
+
mo.classes.push("tml-crooked-4");
|
800
|
+
}
|
801
|
+
}
|
802
|
+
return mo
|
803
|
+
};
|
804
|
+
|
759
805
|
var stretchy = {
|
760
|
-
mathMLnode
|
806
|
+
mathMLnode,
|
807
|
+
accentNode
|
761
808
|
};
|
762
809
|
|
763
810
|
/**
|
@@ -1055,6 +1102,8 @@ defineSymbol(math, textord, "\u2127", "\\mho");
|
|
1055
1102
|
defineSymbol(math, textord, "\u2132", "\\Finv", true);
|
1056
1103
|
defineSymbol(math, textord, "\u2141", "\\Game", true);
|
1057
1104
|
defineSymbol(math, textord, "\u2035", "\\backprime");
|
1105
|
+
defineSymbol(math, textord, "\u2036", "\\backdprime");
|
1106
|
+
defineSymbol(math, textord, "\u2037", "\\backtrprime");
|
1058
1107
|
defineSymbol(math, textord, "\u25b2", "\\blacktriangle");
|
1059
1108
|
defineSymbol(math, textord, "\u25bc", "\\blacktriangledown");
|
1060
1109
|
defineSymbol(math, textord, "\u25a0", "\\blacksquare");
|
@@ -1258,6 +1307,9 @@ defineSymbol(text, textord, "\u2423", "\\textvisiblespace", true);
|
|
1258
1307
|
defineSymbol(math, textord, "\u2220", "\\angle", true);
|
1259
1308
|
defineSymbol(math, textord, "\u221e", "\\infty", true);
|
1260
1309
|
defineSymbol(math, textord, "\u2032", "\\prime");
|
1310
|
+
defineSymbol(math, textord, "\u2033", "\\dprime");
|
1311
|
+
defineSymbol(math, textord, "\u2034", "\\trprime");
|
1312
|
+
defineSymbol(math, textord, "\u2057", "\\qprime");
|
1261
1313
|
defineSymbol(math, textord, "\u25b3", "\\triangle");
|
1262
1314
|
defineSymbol(text, textord, "\u0391", "\\Alpha", true);
|
1263
1315
|
defineSymbol(text, textord, "\u0392", "\\Beta", true);
|
@@ -1437,7 +1489,8 @@ defineSymbol(math, punct, ";", ";");
|
|
1437
1489
|
defineSymbol(math, bin, "\u22bc", "\\barwedge", true);
|
1438
1490
|
defineSymbol(math, bin, "\u22bb", "\\veebar", true);
|
1439
1491
|
defineSymbol(math, bin, "\u2299", "\\odot", true);
|
1440
|
-
|
1492
|
+
// Firefox turns ⊕ into an emoji. So append \uFE0E. Define Unicode character in macros, not here.
|
1493
|
+
defineSymbol(math, bin, "\u2295\uFE0E", "\\oplus");
|
1441
1494
|
defineSymbol(math, bin, "\u2297", "\\otimes", true);
|
1442
1495
|
defineSymbol(math, textord, "\u2202", "\\partial", true);
|
1443
1496
|
defineSymbol(math, bin, "\u2298", "\\oslash", true);
|
@@ -1668,6 +1721,8 @@ for (let i = 0; i < letters.length; i++) {
|
|
1668
1721
|
defineSymbol(math, mathord, ch, ch);
|
1669
1722
|
defineSymbol(text, textord, ch, ch);
|
1670
1723
|
}
|
1724
|
+
// Prevent Firefox from using a dotless i.
|
1725
|
+
defineSymbol(text, textord, "i\uFE0E", "i");
|
1671
1726
|
|
1672
1727
|
// Some more letters in Unicode Basic Multilingual Plane.
|
1673
1728
|
const narrow = "ÇÐÞçþℂℍℕℙℚℝℤℎℏℊℋℌℐℑℒℓ℘ℛℜℬℰℱℳℭℨ";
|
@@ -2145,7 +2200,7 @@ function buildMathML(tree, texExpression, style, settings) {
|
|
2145
2200
|
|
2146
2201
|
const mathmlBuilder$a = (group, style) => {
|
2147
2202
|
const accentNode = group.isStretchy
|
2148
|
-
? stretchy.
|
2203
|
+
? stretchy.accentNode(group)
|
2149
2204
|
: new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]);
|
2150
2205
|
|
2151
2206
|
if (group.label === "\\vec") {
|
@@ -2165,25 +2220,21 @@ const mathmlBuilder$a = (group, style) => {
|
|
2165
2220
|
return node;
|
2166
2221
|
};
|
2167
2222
|
|
2168
|
-
const
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2182
|
-
|
2183
|
-
]
|
2184
|
-
.map((accent) => `\\${accent}`)
|
2185
|
-
.join("|")
|
2186
|
-
);
|
2223
|
+
const nonStretchyAccents = new Set([
|
2224
|
+
"\\acute",
|
2225
|
+
"\\grave",
|
2226
|
+
"\\ddot",
|
2227
|
+
"\\dddot",
|
2228
|
+
"\\ddddot",
|
2229
|
+
"\\tilde",
|
2230
|
+
"\\bar",
|
2231
|
+
"\\breve",
|
2232
|
+
"\\check",
|
2233
|
+
"\\hat",
|
2234
|
+
"\\vec",
|
2235
|
+
"\\dot",
|
2236
|
+
"\\mathring"
|
2237
|
+
]);
|
2187
2238
|
|
2188
2239
|
// Accents
|
2189
2240
|
defineFunction({
|
@@ -2221,7 +2272,7 @@ defineFunction({
|
|
2221
2272
|
handler: (context, args) => {
|
2222
2273
|
const base = normalizeArgument(args[0]);
|
2223
2274
|
|
2224
|
-
const isStretchy = !
|
2275
|
+
const isStretchy = !nonStretchyAccents.has(context.funcName);
|
2225
2276
|
|
2226
2277
|
return {
|
2227
2278
|
type: "accent",
|
@@ -2259,7 +2310,6 @@ defineFunction({
|
|
2259
2310
|
mode: mode,
|
2260
2311
|
label: context.funcName,
|
2261
2312
|
isStretchy: false,
|
2262
|
-
isShifty: true,
|
2263
2313
|
base: base
|
2264
2314
|
};
|
2265
2315
|
},
|
@@ -2289,7 +2339,7 @@ defineFunction({
|
|
2289
2339
|
};
|
2290
2340
|
},
|
2291
2341
|
mathmlBuilder: (group, style) => {
|
2292
|
-
const accentNode = stretchy.
|
2342
|
+
const accentNode = stretchy.accentNode(group);
|
2293
2343
|
accentNode.style["math-depth"] = 0;
|
2294
2344
|
const node = new mathMLTree.MathNode("munder", [
|
2295
2345
|
buildGroup$1(group.base, style),
|
@@ -4391,6 +4441,10 @@ const mathmlBuilder$7 = function(group, style) {
|
|
4391
4441
|
// TODO: Remove -webkit- when Chromium no longer needs it.
|
4392
4442
|
row.children[j].style.textAlign = "-webkit-" + (j % 2 ? "left" : "right");
|
4393
4443
|
}
|
4444
|
+
if (group.addEqnNum) {
|
4445
|
+
const k = group.leqno ? 0 : row.children.length - 1;
|
4446
|
+
row.children[k].style.textAlign = "-webkit-" + (group.leqno ? "left" : "right");
|
4447
|
+
}
|
4394
4448
|
}
|
4395
4449
|
if (row.children.length > 1 && group.envClasses.includes("cases")) {
|
4396
4450
|
row.children[1].style.padding = row.children[1].style.padding.replace(/0em$/, "1em");
|
@@ -7331,7 +7385,14 @@ defineFunctionBuilders({
|
|
7331
7385
|
}
|
7332
7386
|
|
7333
7387
|
if (group.sup) {
|
7334
|
-
|
7388
|
+
const sup = buildGroup$1(group.sup, childStyle);
|
7389
|
+
const testNode = sup.type === "mrow" ? sup.children[0] : sup;
|
7390
|
+
if ((testNode.type === "mo" && testNode.classes.includes("tml-prime"))
|
7391
|
+
&& group.base && group.base.text && group.base.text === "f") {
|
7392
|
+
// Chromium does not address italic correction on prime. Prevent f′ from overlapping.
|
7393
|
+
testNode.classes.push("prime-pad");
|
7394
|
+
}
|
7395
|
+
children.push(sup);
|
7335
7396
|
}
|
7336
7397
|
|
7337
7398
|
let nodeType;
|
@@ -7797,6 +7858,8 @@ const smallCaps = Object.freeze({
|
|
7797
7858
|
|
7798
7859
|
const numberRegEx = /^\d(?:[\d,.]*\d)?$/;
|
7799
7860
|
const latinRegEx = /[A-Ba-z]/;
|
7861
|
+
const primes = new Set(["\\prime", "\\dprime", "\\trprime", "\\qprime",
|
7862
|
+
"\\backprime", "\\backdprime", "\\backtrprime"]);
|
7800
7863
|
|
7801
7864
|
const italicNumber = (text, variant, tag) => {
|
7802
7865
|
const mn = new mathMLTree.MathNode(tag, [text]);
|
@@ -7864,7 +7927,7 @@ defineFunctionBuilders({
|
|
7864
7927
|
text.text = variantChar(text.text, variant);
|
7865
7928
|
}
|
7866
7929
|
node = new mathMLTree.MathNode("mtext", [text]);
|
7867
|
-
} else if (group.text
|
7930
|
+
} else if (primes.has(group.text)) {
|
7868
7931
|
node = new mathMLTree.MathNode("mo", [text]);
|
7869
7932
|
// TODO: If/when Chromium uses ssty variant for prime, remove the next line.
|
7870
7933
|
node.classes.push("tml-prime");
|
@@ -8518,6 +8581,9 @@ defineMacro("\\char", function(context) {
|
|
8518
8581
|
// This macro provides a better rendering.
|
8519
8582
|
defineMacro("\\surd", '\\sqrt{\\vphantom{|}}');
|
8520
8583
|
|
8584
|
+
// See comment for \oplus in symbols.js.
|
8585
|
+
defineMacro("\u2295", "\\oplus");
|
8586
|
+
|
8521
8587
|
defineMacro("\\hbox", "\\text{#1}");
|
8522
8588
|
|
8523
8589
|
// Per TeXbook p.122, "/" gets zero operator spacing.
|
@@ -12798,7 +12864,6 @@ class Parser {
|
|
12798
12864
|
loc: SourceLocation.range(nucleus),
|
12799
12865
|
label: command,
|
12800
12866
|
isStretchy: false,
|
12801
|
-
isShifty: true,
|
12802
12867
|
base: symbol
|
12803
12868
|
};
|
12804
12869
|
}
|
@@ -12996,7 +13061,7 @@ class Style {
|
|
12996
13061
|
* https://mit-license.org/
|
12997
13062
|
*/
|
12998
13063
|
|
12999
|
-
const version = "0.10.
|
13064
|
+
const version = "0.10.16";
|
13000
13065
|
|
13001
13066
|
function postProcess(block) {
|
13002
13067
|
const labelMap = {};
|
package/dist/temml.js
CHANGED
@@ -479,7 +479,7 @@ var temml = (function () {
|
|
479
479
|
}
|
480
480
|
}
|
481
481
|
|
482
|
-
|
482
|
+
/*
|
483
483
|
* This node represents an image embed (<img>) element.
|
484
484
|
*/
|
485
485
|
class Img {
|
@@ -524,7 +524,7 @@ var temml = (function () {
|
|
524
524
|
markup += ` style="${utils.escape(styles)}"`;
|
525
525
|
}
|
526
526
|
|
527
|
-
markup += "
|
527
|
+
markup += ">";
|
528
528
|
return markup;
|
529
529
|
}
|
530
530
|
}
|
@@ -700,6 +700,34 @@ var temml = (function () {
|
|
700
700
|
* This file provides support for building horizontal stretchy elements.
|
701
701
|
*/
|
702
702
|
|
703
|
+
// TODO: Remove when Chromium stretches \widetilde & \widehat
|
704
|
+
const estimatedWidth = node => {
|
705
|
+
let width = 0;
|
706
|
+
if (node.body) {
|
707
|
+
for (const item of node.body) {
|
708
|
+
width += estimatedWidth(item);
|
709
|
+
}
|
710
|
+
} else if (node.type === "supsub") {
|
711
|
+
width += estimatedWidth(node.base);
|
712
|
+
if (node.sub) { width += 0.7 * estimatedWidth(node.sub); }
|
713
|
+
if (node.sup) { width += 0.7 * estimatedWidth(node.sup); }
|
714
|
+
} else if (node.type === "mathord" || node.type === "textord") {
|
715
|
+
for (const ch of node.text.split('')) {
|
716
|
+
const codePoint = ch.codePointAt(0);
|
717
|
+
if ((0x60 < codePoint && codePoint < 0x7B) || (0x03B0 < codePoint && codePoint < 0x3CA)) {
|
718
|
+
width += 0.56; // lower case latin or greek. Use advance width of letter n
|
719
|
+
} else if (0x2F < codePoint && codePoint < 0x3A) {
|
720
|
+
width += 0.50; // numerals.
|
721
|
+
} else {
|
722
|
+
width += 0.92; // advance width of letter M
|
723
|
+
}
|
724
|
+
}
|
725
|
+
} else {
|
726
|
+
width += 1.0;
|
727
|
+
}
|
728
|
+
return width
|
729
|
+
};
|
730
|
+
|
703
731
|
const stretchyCodePoint = {
|
704
732
|
widehat: "^",
|
705
733
|
widecheck: "ˇ",
|
@@ -757,8 +785,27 @@ var temml = (function () {
|
|
757
785
|
return node
|
758
786
|
};
|
759
787
|
|
788
|
+
const crookedWides = ["\\widetilde", "\\widehat", "\\widecheck", "\\utilde"];
|
789
|
+
|
790
|
+
// TODO: Remove when Chromium stretches \widetilde & \widehat
|
791
|
+
const accentNode = (group) => {
|
792
|
+
const mo = mathMLnode(group.label);
|
793
|
+
if (crookedWides.includes(group.label)) {
|
794
|
+
const width = estimatedWidth(group.base);
|
795
|
+
if (1 < width && width < 1.6) {
|
796
|
+
mo.classes.push("tml-crooked-2");
|
797
|
+
} else if (1.6 <= width && width < 2.5) {
|
798
|
+
mo.classes.push("tml-crooked-3");
|
799
|
+
} else if (2.5 <= width) {
|
800
|
+
mo.classes.push("tml-crooked-4");
|
801
|
+
}
|
802
|
+
}
|
803
|
+
return mo
|
804
|
+
};
|
805
|
+
|
760
806
|
var stretchy = {
|
761
|
-
mathMLnode
|
807
|
+
mathMLnode,
|
808
|
+
accentNode
|
762
809
|
};
|
763
810
|
|
764
811
|
/**
|
@@ -1056,6 +1103,8 @@ var temml = (function () {
|
|
1056
1103
|
defineSymbol(math, textord, "\u2132", "\\Finv", true);
|
1057
1104
|
defineSymbol(math, textord, "\u2141", "\\Game", true);
|
1058
1105
|
defineSymbol(math, textord, "\u2035", "\\backprime");
|
1106
|
+
defineSymbol(math, textord, "\u2036", "\\backdprime");
|
1107
|
+
defineSymbol(math, textord, "\u2037", "\\backtrprime");
|
1059
1108
|
defineSymbol(math, textord, "\u25b2", "\\blacktriangle");
|
1060
1109
|
defineSymbol(math, textord, "\u25bc", "\\blacktriangledown");
|
1061
1110
|
defineSymbol(math, textord, "\u25a0", "\\blacksquare");
|
@@ -1259,6 +1308,9 @@ var temml = (function () {
|
|
1259
1308
|
defineSymbol(math, textord, "\u2220", "\\angle", true);
|
1260
1309
|
defineSymbol(math, textord, "\u221e", "\\infty", true);
|
1261
1310
|
defineSymbol(math, textord, "\u2032", "\\prime");
|
1311
|
+
defineSymbol(math, textord, "\u2033", "\\dprime");
|
1312
|
+
defineSymbol(math, textord, "\u2034", "\\trprime");
|
1313
|
+
defineSymbol(math, textord, "\u2057", "\\qprime");
|
1262
1314
|
defineSymbol(math, textord, "\u25b3", "\\triangle");
|
1263
1315
|
defineSymbol(text, textord, "\u0391", "\\Alpha", true);
|
1264
1316
|
defineSymbol(text, textord, "\u0392", "\\Beta", true);
|
@@ -1438,7 +1490,8 @@ var temml = (function () {
|
|
1438
1490
|
defineSymbol(math, bin, "\u22bc", "\\barwedge", true);
|
1439
1491
|
defineSymbol(math, bin, "\u22bb", "\\veebar", true);
|
1440
1492
|
defineSymbol(math, bin, "\u2299", "\\odot", true);
|
1441
|
-
|
1493
|
+
// Firefox turns ⊕ into an emoji. So append \uFE0E. Define Unicode character in macros, not here.
|
1494
|
+
defineSymbol(math, bin, "\u2295\uFE0E", "\\oplus");
|
1442
1495
|
defineSymbol(math, bin, "\u2297", "\\otimes", true);
|
1443
1496
|
defineSymbol(math, textord, "\u2202", "\\partial", true);
|
1444
1497
|
defineSymbol(math, bin, "\u2298", "\\oslash", true);
|
@@ -1669,6 +1722,8 @@ var temml = (function () {
|
|
1669
1722
|
defineSymbol(math, mathord, ch, ch);
|
1670
1723
|
defineSymbol(text, textord, ch, ch);
|
1671
1724
|
}
|
1725
|
+
// Prevent Firefox from using a dotless i.
|
1726
|
+
defineSymbol(text, textord, "i\uFE0E", "i");
|
1672
1727
|
|
1673
1728
|
// Some more letters in Unicode Basic Multilingual Plane.
|
1674
1729
|
const narrow = "ÇÐÞçþℂℍℕℙℚℝℤℎℏℊℋℌℐℑℒℓ℘ℛℜℬℰℱℳℭℨ";
|
@@ -2146,7 +2201,7 @@ var temml = (function () {
|
|
2146
2201
|
|
2147
2202
|
const mathmlBuilder$a = (group, style) => {
|
2148
2203
|
const accentNode = group.isStretchy
|
2149
|
-
? stretchy.
|
2204
|
+
? stretchy.accentNode(group)
|
2150
2205
|
: new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]);
|
2151
2206
|
|
2152
2207
|
if (group.label === "\\vec") {
|
@@ -2166,25 +2221,21 @@ var temml = (function () {
|
|
2166
2221
|
return node;
|
2167
2222
|
};
|
2168
2223
|
|
2169
|
-
const
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2182
|
-
|
2183
|
-
|
2184
|
-
]
|
2185
|
-
.map((accent) => `\\${accent}`)
|
2186
|
-
.join("|")
|
2187
|
-
);
|
2224
|
+
const nonStretchyAccents = new Set([
|
2225
|
+
"\\acute",
|
2226
|
+
"\\grave",
|
2227
|
+
"\\ddot",
|
2228
|
+
"\\dddot",
|
2229
|
+
"\\ddddot",
|
2230
|
+
"\\tilde",
|
2231
|
+
"\\bar",
|
2232
|
+
"\\breve",
|
2233
|
+
"\\check",
|
2234
|
+
"\\hat",
|
2235
|
+
"\\vec",
|
2236
|
+
"\\dot",
|
2237
|
+
"\\mathring"
|
2238
|
+
]);
|
2188
2239
|
|
2189
2240
|
// Accents
|
2190
2241
|
defineFunction({
|
@@ -2222,7 +2273,7 @@ var temml = (function () {
|
|
2222
2273
|
handler: (context, args) => {
|
2223
2274
|
const base = normalizeArgument(args[0]);
|
2224
2275
|
|
2225
|
-
const isStretchy = !
|
2276
|
+
const isStretchy = !nonStretchyAccents.has(context.funcName);
|
2226
2277
|
|
2227
2278
|
return {
|
2228
2279
|
type: "accent",
|
@@ -2260,7 +2311,6 @@ var temml = (function () {
|
|
2260
2311
|
mode: mode,
|
2261
2312
|
label: context.funcName,
|
2262
2313
|
isStretchy: false,
|
2263
|
-
isShifty: true,
|
2264
2314
|
base: base
|
2265
2315
|
};
|
2266
2316
|
},
|
@@ -2290,7 +2340,7 @@ var temml = (function () {
|
|
2290
2340
|
};
|
2291
2341
|
},
|
2292
2342
|
mathmlBuilder: (group, style) => {
|
2293
|
-
const accentNode = stretchy.
|
2343
|
+
const accentNode = stretchy.accentNode(group);
|
2294
2344
|
accentNode.style["math-depth"] = 0;
|
2295
2345
|
const node = new mathMLTree.MathNode("munder", [
|
2296
2346
|
buildGroup$1(group.base, style),
|
@@ -4392,6 +4442,10 @@ rgba(0,0,0,0) 100%);`;
|
|
4392
4442
|
// TODO: Remove -webkit- when Chromium no longer needs it.
|
4393
4443
|
row.children[j].style.textAlign = "-webkit-" + (j % 2 ? "left" : "right");
|
4394
4444
|
}
|
4445
|
+
if (group.addEqnNum) {
|
4446
|
+
const k = group.leqno ? 0 : row.children.length - 1;
|
4447
|
+
row.children[k].style.textAlign = "-webkit-" + (group.leqno ? "left" : "right");
|
4448
|
+
}
|
4395
4449
|
}
|
4396
4450
|
if (row.children.length > 1 && group.envClasses.includes("cases")) {
|
4397
4451
|
row.children[1].style.padding = row.children[1].style.padding.replace(/0em$/, "1em");
|
@@ -7332,7 +7386,14 @@ rgba(0,0,0,0) 100%);`;
|
|
7332
7386
|
}
|
7333
7387
|
|
7334
7388
|
if (group.sup) {
|
7335
|
-
|
7389
|
+
const sup = buildGroup$1(group.sup, childStyle);
|
7390
|
+
const testNode = sup.type === "mrow" ? sup.children[0] : sup;
|
7391
|
+
if ((testNode.type === "mo" && testNode.classes.includes("tml-prime"))
|
7392
|
+
&& group.base && group.base.text && group.base.text === "f") {
|
7393
|
+
// Chromium does not address italic correction on prime. Prevent f′ from overlapping.
|
7394
|
+
testNode.classes.push("prime-pad");
|
7395
|
+
}
|
7396
|
+
children.push(sup);
|
7336
7397
|
}
|
7337
7398
|
|
7338
7399
|
let nodeType;
|
@@ -7798,6 +7859,8 @@ rgba(0,0,0,0) 100%);`;
|
|
7798
7859
|
|
7799
7860
|
const numberRegEx = /^\d(?:[\d,.]*\d)?$/;
|
7800
7861
|
const latinRegEx = /[A-Ba-z]/;
|
7862
|
+
const primes = new Set(["\\prime", "\\dprime", "\\trprime", "\\qprime",
|
7863
|
+
"\\backprime", "\\backdprime", "\\backtrprime"]);
|
7801
7864
|
|
7802
7865
|
const italicNumber = (text, variant, tag) => {
|
7803
7866
|
const mn = new mathMLTree.MathNode(tag, [text]);
|
@@ -7865,7 +7928,7 @@ rgba(0,0,0,0) 100%);`;
|
|
7865
7928
|
text.text = variantChar(text.text, variant);
|
7866
7929
|
}
|
7867
7930
|
node = new mathMLTree.MathNode("mtext", [text]);
|
7868
|
-
} else if (group.text
|
7931
|
+
} else if (primes.has(group.text)) {
|
7869
7932
|
node = new mathMLTree.MathNode("mo", [text]);
|
7870
7933
|
// TODO: If/when Chromium uses ssty variant for prime, remove the next line.
|
7871
7934
|
node.classes.push("tml-prime");
|
@@ -8519,6 +8582,9 @@ rgba(0,0,0,0) 100%);`;
|
|
8519
8582
|
// This macro provides a better rendering.
|
8520
8583
|
defineMacro("\\surd", '\\sqrt{\\vphantom{|}}');
|
8521
8584
|
|
8585
|
+
// See comment for \oplus in symbols.js.
|
8586
|
+
defineMacro("\u2295", "\\oplus");
|
8587
|
+
|
8522
8588
|
defineMacro("\\hbox", "\\text{#1}");
|
8523
8589
|
|
8524
8590
|
// Per TeXbook p.122, "/" gets zero operator spacing.
|
@@ -10899,7 +10965,6 @@ rgba(0,0,0,0) 100%);`;
|
|
10899
10965
|
loc: SourceLocation.range(nucleus),
|
10900
10966
|
label: command,
|
10901
10967
|
isStretchy: false,
|
10902
|
-
isShifty: true,
|
10903
10968
|
base: symbol
|
10904
10969
|
};
|
10905
10970
|
}
|
@@ -11097,7 +11162,7 @@ rgba(0,0,0,0) 100%);`;
|
|
11097
11162
|
* https://mit-license.org/
|
11098
11163
|
*/
|
11099
11164
|
|
11100
|
-
const version = "0.10.
|
11165
|
+
const version = "0.10.16";
|
11101
11166
|
|
11102
11167
|
function postProcess(block) {
|
11103
11168
|
const labelMap = {};
|