temml 0.12.1 → 0.13.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.
- package/README.md +1 -1
- package/dist/Temml-Asana.css +28 -0
- package/dist/Temml-Latin-Modern.css +29 -1
- package/dist/Temml-Libertinus.css +28 -0
- package/dist/Temml-Local.css +28 -0
- package/dist/Temml-NotoSans.css +28 -0
- package/dist/Temml-STIX2.css +28 -0
- package/dist/temml.cjs +107 -28
- package/dist/temml.js +107 -28
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +107 -28
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/Parser.js +6 -0
- package/src/canceltoArrow.svg +15 -0
- package/src/environments/array.js +5 -4
- package/src/functions/accent.js +1 -2
- package/src/functions/cancelto.js +55 -15
- package/src/functions/enclose.js +6 -8
- package/src/functions/{horizBrace.js → horizBracket.js} +4 -4
- package/src/functions/op.js +2 -1
- package/src/functions/supsub.js +5 -5
- package/src/functions.js +2 -2
- package/src/macros.js +1 -2
- package/src/postProcess.js +1 -1
- package/src/stretchy.js +2 -0
- package/src/utils.js +3 -0
package/README.md
CHANGED
package/dist/Temml-Asana.css
CHANGED
|
@@ -43,11 +43,39 @@ math.tml-display {
|
|
|
43
43
|
width: 100%;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/* Cramped superscripts in WebKit */
|
|
47
|
+
mfrac > :nth-child(2),
|
|
48
|
+
msqrt,
|
|
49
|
+
mover > :first-child {
|
|
50
|
+
math-shift: compact
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.menclose {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
position: relative;
|
|
56
|
+
padding: 0.5ex 0ex;
|
|
57
|
+
}
|
|
58
|
+
.tml-cancelto {
|
|
59
|
+
display: inline-block;
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 0;
|
|
62
|
+
left: 0;
|
|
63
|
+
padding: 0.5ex 0ex;
|
|
64
|
+
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><defs><marker id='a' markerHeight='5' markerUnits='strokeWidth' markerWidth='7' orient='auto' refX='7' refY='2.5'><path fill='currentColor' d='m0 0 7 2.5L0 5z'/></marker></defs><line x2='100%' y1='100%' stroke='currentColor' stroke-width='.06em' marker-end='url(%23a)' vector-effect='non-scaling-stroke'/></svg>");
|
|
65
|
+
}
|
|
66
|
+
|
|
46
67
|
@supports (-moz-appearance: none) {
|
|
47
68
|
/* \vec w/o italic correction for Firefox */
|
|
48
69
|
.tml-vec {
|
|
49
70
|
transform: scale(0.75)
|
|
50
71
|
}
|
|
72
|
+
/* Fix \cancelto in Firefox */
|
|
73
|
+
.ff-narrow {
|
|
74
|
+
width: 0em;
|
|
75
|
+
}
|
|
76
|
+
.ff-nudge-left {
|
|
77
|
+
margin-left: -0.2em;
|
|
78
|
+
}
|
|
51
79
|
}
|
|
52
80
|
|
|
53
81
|
@supports (not (-moz-appearance: none)) {
|
|
@@ -57,11 +57,39 @@ math {
|
|
|
57
57
|
font-family: "Temml";
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/* Cramped superscripts in WebKit */
|
|
61
|
+
mfrac > :nth-child(2),
|
|
62
|
+
msqrt,
|
|
63
|
+
mover > :first-child {
|
|
64
|
+
math-shift: compact
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.menclose {
|
|
68
|
+
display: inline-block;
|
|
69
|
+
position: relative;
|
|
70
|
+
padding: 0.5ex 0ex;
|
|
71
|
+
}
|
|
72
|
+
.tml-cancelto {
|
|
73
|
+
display: inline-block;
|
|
74
|
+
position: absolute;
|
|
75
|
+
top: 0;
|
|
76
|
+
left: 0;
|
|
77
|
+
padding: 0.5ex 0ex;
|
|
78
|
+
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><defs><marker id='a' markerHeight='5' markerUnits='strokeWidth' markerWidth='7' orient='auto' refX='7' refY='2.5'><path fill='currentColor' d='m0 0 7 2.5L0 5z'/></marker></defs><line x2='100%' y1='100%' stroke='currentColor' stroke-width='.06em' marker-end='url(%23a)' vector-effect='non-scaling-stroke'/></svg>");
|
|
79
|
+
}
|
|
80
|
+
|
|
60
81
|
@supports (-moz-appearance: none) {
|
|
61
82
|
/* \vec w/o italic correction for Firefox */
|
|
62
83
|
.tml-vec {
|
|
63
84
|
transform: scale(0.75)
|
|
64
85
|
}
|
|
86
|
+
/* Fix \cancelto in Firefox */
|
|
87
|
+
.ff-narrow {
|
|
88
|
+
width: 0em;
|
|
89
|
+
}
|
|
90
|
+
.ff-nudge-left {
|
|
91
|
+
margin-left: -0.2em;
|
|
92
|
+
}
|
|
65
93
|
}
|
|
66
94
|
|
|
67
95
|
@supports (not (-moz-appearance: none)) {
|
|
@@ -166,7 +194,7 @@ menclose {
|
|
|
166
194
|
padding: 0.5ex 0ex;
|
|
167
195
|
}
|
|
168
196
|
|
|
169
|
-
|
|
197
|
+
.tml-overline {
|
|
170
198
|
padding: 0.1em 0 0 0;
|
|
171
199
|
border-top: 0.065em solid;
|
|
172
200
|
}
|
|
@@ -59,11 +59,39 @@ mo.tml-prime {
|
|
|
59
59
|
font-feature-settings: 'ssty';
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/* Cramped superscripts in WebKit */
|
|
63
|
+
mfrac > :nth-child(2),
|
|
64
|
+
msqrt,
|
|
65
|
+
mover > :first-child {
|
|
66
|
+
math-shift: compact
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.menclose {
|
|
70
|
+
display: inline-block;
|
|
71
|
+
position: relative;
|
|
72
|
+
padding: 0.5ex 0ex;
|
|
73
|
+
}
|
|
74
|
+
.tml-cancelto {
|
|
75
|
+
display: inline-block;
|
|
76
|
+
position: absolute;
|
|
77
|
+
top: 0;
|
|
78
|
+
left: 0;
|
|
79
|
+
padding: 0.5ex 0ex;
|
|
80
|
+
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><defs><marker id='a' markerHeight='5' markerUnits='strokeWidth' markerWidth='7' orient='auto' refX='7' refY='2.5'><path fill='currentColor' d='m0 0 7 2.5L0 5z'/></marker></defs><line x2='100%' y1='100%' stroke='currentColor' stroke-width='.06em' marker-end='url(%23a)' vector-effect='non-scaling-stroke'/></svg>");
|
|
81
|
+
}
|
|
82
|
+
|
|
62
83
|
@supports (-moz-appearance: none) {
|
|
63
84
|
/* \vec w/o italic correction for Firefox */
|
|
64
85
|
.tml-vec {
|
|
65
86
|
transform: scale(0.75)
|
|
66
87
|
}
|
|
88
|
+
/* Fix \cancelto in Firefox */
|
|
89
|
+
.ff-narrow {
|
|
90
|
+
width: 0em;
|
|
91
|
+
}
|
|
92
|
+
.ff-nudge-left {
|
|
93
|
+
margin-left: -0.2em;
|
|
94
|
+
}
|
|
67
95
|
}
|
|
68
96
|
|
|
69
97
|
@supports (not (-moz-appearance: none)) {
|
package/dist/Temml-Local.css
CHANGED
|
@@ -50,11 +50,39 @@ mo.tml-prime {
|
|
|
50
50
|
font-family: Temml;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/* Cramped superscripts in WebKit */
|
|
54
|
+
mfrac > :nth-child(2),
|
|
55
|
+
msqrt,
|
|
56
|
+
mover > :first-child {
|
|
57
|
+
math-shift: compact
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.menclose {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
position: relative;
|
|
63
|
+
padding: 0.5ex 0ex;
|
|
64
|
+
}
|
|
65
|
+
.tml-cancelto {
|
|
66
|
+
display: inline-block;
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
padding: 0.5ex 0ex;
|
|
71
|
+
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><defs><marker id='a' markerHeight='5' markerUnits='strokeWidth' markerWidth='7' orient='auto' refX='7' refY='2.5'><path fill='currentColor' d='m0 0 7 2.5L0 5z'/></marker></defs><line x2='100%' y1='100%' stroke='currentColor' stroke-width='.06em' marker-end='url(%23a)' vector-effect='non-scaling-stroke'/></svg>");
|
|
72
|
+
}
|
|
73
|
+
|
|
53
74
|
@supports (-moz-appearance: none) {
|
|
54
75
|
/* \vec w/o italic correction for Firefox */
|
|
55
76
|
.tml-vec {
|
|
56
77
|
transform: scale(0.75)
|
|
57
78
|
}
|
|
79
|
+
/* Fix \cancelto in Firefox */
|
|
80
|
+
.ff-narrow {
|
|
81
|
+
width: 0em;
|
|
82
|
+
}
|
|
83
|
+
.ff-nudge-left {
|
|
84
|
+
margin-left: -0.2em;
|
|
85
|
+
}
|
|
58
86
|
}
|
|
59
87
|
|
|
60
88
|
@supports (not (-moz-appearance: none)) {
|
package/dist/Temml-NotoSans.css
CHANGED
|
@@ -52,11 +52,39 @@ mo.tml-prime {
|
|
|
52
52
|
font-feature-settings: 'ssty';
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/* Cramped superscripts in WebKit */
|
|
56
|
+
mfrac > :nth-child(2),
|
|
57
|
+
msqrt,
|
|
58
|
+
mover > :first-child {
|
|
59
|
+
math-shift: compact
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.menclose {
|
|
63
|
+
display: inline-block;
|
|
64
|
+
position: relative;
|
|
65
|
+
padding: 0.5ex 0ex;
|
|
66
|
+
}
|
|
67
|
+
.tml-cancelto {
|
|
68
|
+
display: inline-block;
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 0;
|
|
71
|
+
left: 0;
|
|
72
|
+
padding: 0.5ex 0ex;
|
|
73
|
+
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><defs><marker id='a' markerHeight='5' markerUnits='strokeWidth' markerWidth='7' orient='auto' refX='7' refY='2.5'><path fill='currentColor' d='m0 0 7 2.5L0 5z'/></marker></defs><line x2='100%' y1='100%' stroke='currentColor' stroke-width='.06em' marker-end='url(%23a)' vector-effect='non-scaling-stroke'/></svg>");
|
|
74
|
+
}
|
|
75
|
+
|
|
55
76
|
@supports (-moz-appearance: none) {
|
|
56
77
|
/* \vec w/o italic correction for Firefox */
|
|
57
78
|
.tml-vec {
|
|
58
79
|
transform: scale(0.75)
|
|
59
80
|
}
|
|
81
|
+
/* Fix \cancelto in Firefox */
|
|
82
|
+
.ff-narrow {
|
|
83
|
+
width: 0em;
|
|
84
|
+
}
|
|
85
|
+
.ff-nudge-left {
|
|
86
|
+
margin-left: -0.2em;
|
|
87
|
+
}
|
|
60
88
|
}
|
|
61
89
|
|
|
62
90
|
@supports (not (-moz-appearance: none)) {
|
package/dist/Temml-STIX2.css
CHANGED
|
@@ -49,11 +49,39 @@ mo.tml-prime {
|
|
|
49
49
|
font-feature-settings: 'ss04';
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
/* Cramped superscripts in WebKit */
|
|
53
|
+
mfrac > :nth-child(2),
|
|
54
|
+
msqrt,
|
|
55
|
+
mover > :first-child {
|
|
56
|
+
math-shift: compact
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.menclose {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
position: relative;
|
|
62
|
+
padding: 0.5ex 0ex;
|
|
63
|
+
}
|
|
64
|
+
.tml-cancelto {
|
|
65
|
+
display: inline-block;
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 0;
|
|
68
|
+
left: 0;
|
|
69
|
+
padding: 0.5ex 0ex;
|
|
70
|
+
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><defs><marker id='a' markerHeight='5' markerUnits='strokeWidth' markerWidth='7' orient='auto' refX='7' refY='2.5'><path fill='currentColor' d='m0 0 7 2.5L0 5z'/></marker></defs><line x2='100%' y1='100%' stroke='currentColor' stroke-width='.06em' marker-end='url(%23a)' vector-effect='non-scaling-stroke'/></svg>");
|
|
71
|
+
}
|
|
72
|
+
|
|
52
73
|
@supports (-moz-appearance: none) {
|
|
53
74
|
/* \vec w/o italic correction for Firefox */
|
|
54
75
|
.tml-vec {
|
|
55
76
|
transform: scale(0.75)
|
|
56
77
|
}
|
|
78
|
+
/* Fix \cancelto in Firefox */
|
|
79
|
+
.ff-narrow {
|
|
80
|
+
width: 0em;
|
|
81
|
+
}
|
|
82
|
+
.ff-nudge-left {
|
|
83
|
+
margin-left: -0.2em;
|
|
84
|
+
}
|
|
57
85
|
}
|
|
58
86
|
|
|
59
87
|
@supports (not (-moz-appearance: none)) {
|
package/dist/temml.cjs
CHANGED
|
@@ -181,6 +181,9 @@ const round = function(n) {
|
|
|
181
181
|
return +n.toFixed(4);
|
|
182
182
|
};
|
|
183
183
|
|
|
184
|
+
// Identify short letters. Used for accents and \cancelto.
|
|
185
|
+
const smalls = "acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳";
|
|
186
|
+
|
|
184
187
|
/**
|
|
185
188
|
* This is a module for storing settings passed into Temml. It correctly handles
|
|
186
189
|
* default settings.
|
|
@@ -796,6 +799,8 @@ const stretchyCodePoint = {
|
|
|
796
799
|
xrightarrow: "\u2192",
|
|
797
800
|
underbrace: "\u23df",
|
|
798
801
|
overbrace: "\u23de",
|
|
802
|
+
overbracket: "\u23b4",
|
|
803
|
+
underbracket: "\u23b5",
|
|
799
804
|
overgroup: "\u23e0",
|
|
800
805
|
overparen: "⏜",
|
|
801
806
|
undergroup: "\u23e1",
|
|
@@ -2451,9 +2456,6 @@ function buildMathML(tree, texExpression, style, settings) {
|
|
|
2451
2456
|
return math;
|
|
2452
2457
|
}
|
|
2453
2458
|
|
|
2454
|
-
// Identify letters to which we'll attach a combining accent character
|
|
2455
|
-
const smalls = "acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳";
|
|
2456
|
-
|
|
2457
2459
|
// From the KaTeX font metrics, identify letters whose accents need a italic correction.
|
|
2458
2460
|
const smallNudge = "DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ";
|
|
2459
2461
|
const mediumNudge = "BCEGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ";
|
|
@@ -3874,7 +3876,6 @@ const dotsByToken = {
|
|
|
3874
3876
|
"\\iint": "\\dotsi",
|
|
3875
3877
|
"\\iiint": "\\dotsi",
|
|
3876
3878
|
"\\iiiint": "\\dotsi",
|
|
3877
|
-
"\\idotsint": "\\dotsi",
|
|
3878
3879
|
// Symbols whose definition starts with \DOTSX:
|
|
3879
3880
|
"\\DOTSX": "\\dotsx"
|
|
3880
3881
|
};
|
|
@@ -3956,7 +3957,7 @@ defineMacro("\\cdots", function(context) {
|
|
|
3956
3957
|
defineMacro("\\dotsb", "\\cdots");
|
|
3957
3958
|
defineMacro("\\dotsm", "\\cdots");
|
|
3958
3959
|
defineMacro("\\dotsi", "\\!\\cdots");
|
|
3959
|
-
defineMacro("\\idotsint", "\\
|
|
3960
|
+
defineMacro("\\idotsint", "\\int\\!\\cdots\\!\\int");
|
|
3960
3961
|
// amsmath doesn't actually define \dotsx, but \dots followed by a macro
|
|
3961
3962
|
// starting with \DOTSX implies \dotso, and then \extra@ detects this case
|
|
3962
3963
|
// and forces the added `\,`.
|
|
@@ -6434,6 +6435,7 @@ const mathmlBuilder$9 = function(group, style) {
|
|
|
6434
6435
|
const tbl = [];
|
|
6435
6436
|
const numRows = group.body.length;
|
|
6436
6437
|
const hlines = group.hLinesBeforeRow;
|
|
6438
|
+
const tagIsPresent = (group.tags && group.tags.some((tag) => tag));
|
|
6437
6439
|
|
|
6438
6440
|
for (let i = 0; i < numRows; i++) {
|
|
6439
6441
|
const rw = group.body[i];
|
|
@@ -6463,7 +6465,7 @@ const mathmlBuilder$9 = function(group, style) {
|
|
|
6463
6465
|
for (let k = 0; k < numColumns - rw.length; k++) {
|
|
6464
6466
|
row.push(new MathNode("mtd", [], [], style));
|
|
6465
6467
|
}
|
|
6466
|
-
if (
|
|
6468
|
+
if (tagIsPresent) {
|
|
6467
6469
|
const tag = group.tags[i];
|
|
6468
6470
|
let tagElement;
|
|
6469
6471
|
if (tag === true) { // automatic numbering
|
|
@@ -6575,7 +6577,7 @@ const mathmlBuilder$9 = function(group, style) {
|
|
|
6575
6577
|
if (j === numCols - 1 && hand === 1) { return "0" }
|
|
6576
6578
|
if (group.envClasses[0] !== "align") { return sidePadding }
|
|
6577
6579
|
if (hand === 1) { return "0" }
|
|
6578
|
-
if (
|
|
6580
|
+
if (tagIsPresent) {
|
|
6579
6581
|
return (j % 2) ? "1" : "0"
|
|
6580
6582
|
} else {
|
|
6581
6583
|
return (j % 2) ? "0" : "1"
|
|
@@ -6611,7 +6613,7 @@ const mathmlBuilder$9 = function(group, style) {
|
|
|
6611
6613
|
// TODO: Remove -webkit- when Chromium no longer needs it.
|
|
6612
6614
|
row.children[j].classes = ["tml-" + (j % 2 ? "left" : "right")];
|
|
6613
6615
|
}
|
|
6614
|
-
if (
|
|
6616
|
+
if (tagIsPresent) {
|
|
6615
6617
|
const k = group.leqno ? 0 : row.children.length - 1;
|
|
6616
6618
|
row.children[k].classes = []; // Default is center.
|
|
6617
6619
|
}
|
|
@@ -6668,7 +6670,7 @@ const mathmlBuilder$9 = function(group, style) {
|
|
|
6668
6670
|
row.children[0].style.borderLeft = sep;
|
|
6669
6671
|
}
|
|
6670
6672
|
}
|
|
6671
|
-
let iCol =
|
|
6673
|
+
let iCol = tagIsPresent ? 0 : -1;
|
|
6672
6674
|
for (let i = iStart; i < iEnd; i++) {
|
|
6673
6675
|
if (cols[i].type === "align") {
|
|
6674
6676
|
const colAlign = alignMap[cols[i].align];
|
|
@@ -7194,6 +7196,78 @@ defineFunction({
|
|
|
7194
7196
|
}
|
|
7195
7197
|
});
|
|
7196
7198
|
|
|
7199
|
+
defineFunction({
|
|
7200
|
+
type: "cancelto",
|
|
7201
|
+
names: ["\\cancelto"],
|
|
7202
|
+
props: {
|
|
7203
|
+
numArgs: 2
|
|
7204
|
+
},
|
|
7205
|
+
handler({ parser }, args) {
|
|
7206
|
+
const to = args[0];
|
|
7207
|
+
const body = args[1];
|
|
7208
|
+
return {
|
|
7209
|
+
type: "cancelto",
|
|
7210
|
+
mode: parser.mode,
|
|
7211
|
+
body,
|
|
7212
|
+
to,
|
|
7213
|
+
isCharacterBox: isCharacterBox(body)
|
|
7214
|
+
};
|
|
7215
|
+
},
|
|
7216
|
+
mathmlBuilder(group, style) {
|
|
7217
|
+
const fromNode = new MathNode(
|
|
7218
|
+
"mrow",
|
|
7219
|
+
[buildGroup$1(group.body, style)],
|
|
7220
|
+
["ff-narrow"] // A zero-width mrow.
|
|
7221
|
+
);
|
|
7222
|
+
// Write the arrow in a node written after the content.
|
|
7223
|
+
// That way, the arrow will be an overlay on the content.
|
|
7224
|
+
const phantom = new MathNode("mphantom", [buildGroup$1(group.body, style)]);
|
|
7225
|
+
const arrow = new MathNode("mrow", [phantom], ["tml-cancelto"]);
|
|
7226
|
+
if (group.isCharacterBox && smalls.indexOf(group.body.body[0].text) > -1) {
|
|
7227
|
+
arrow.style.left = "0.1em";
|
|
7228
|
+
arrow.style.width = "90%";
|
|
7229
|
+
}
|
|
7230
|
+
const node = new MathNode("mrow", [fromNode, arrow], ["menclose"]);
|
|
7231
|
+
if (!group.isCharacterBox || /[f∫∑]/.test(group.body.body[0].text)) {
|
|
7232
|
+
// Add 0.2em space to right of content to make room for the arrowhead.
|
|
7233
|
+
phantom.style.paddingRight = "0.2em";
|
|
7234
|
+
} else {
|
|
7235
|
+
phantom.style.padding = "0.5ex 0.1em 0 0";
|
|
7236
|
+
const strut = new MathNode('mspace', []);
|
|
7237
|
+
strut.setAttribute('height', "0.85em");
|
|
7238
|
+
fromNode.children.push(strut);
|
|
7239
|
+
}
|
|
7240
|
+
|
|
7241
|
+
// Create the "to" value above and to the right of the arrow.
|
|
7242
|
+
// First, we want a dummy node with the same height as the `from` content.
|
|
7243
|
+
// We'll place the `to` node above the dummy to get the correct vertical alignment.
|
|
7244
|
+
let dummyNode;
|
|
7245
|
+
if (group.isCharacterBox) {
|
|
7246
|
+
dummyNode = new MathNode('mspace', []);
|
|
7247
|
+
dummyNode.setAttribute('height', "1em");
|
|
7248
|
+
} else {
|
|
7249
|
+
// Create a phantom node with the same content as the body.
|
|
7250
|
+
const inner = buildGroup$1(group.body, style);
|
|
7251
|
+
// The phantom node will be zero-width, so it won't affect horizontal spacing.
|
|
7252
|
+
const zeroWidthNode = new MathNode("mpadded", [inner]);
|
|
7253
|
+
zeroWidthNode.setAttribute("width", "0.1px"); // Don't use 0. WebKit would omit it.
|
|
7254
|
+
dummyNode = new MathNode("mphantom", [zeroWidthNode]); // Hide it.
|
|
7255
|
+
}
|
|
7256
|
+
const toNode = buildGroup$1(group.to, style);
|
|
7257
|
+
const zeroWidthToNode = new MathNode("mpadded", [toNode]);
|
|
7258
|
+
if (!group.isCharacterBox || /[f∫∑]/.test(group.body.body[0].text)) {
|
|
7259
|
+
const w = new MathNode("mspace", []);
|
|
7260
|
+
w.setAttribute('width', "0.2em");
|
|
7261
|
+
zeroWidthToNode.children.unshift(w);
|
|
7262
|
+
}
|
|
7263
|
+
zeroWidthToNode.setAttribute("width", "0.1px"); // Don't use 0. WebKit would hide it.
|
|
7264
|
+
const mover = new MathNode("mover", [dummyNode, zeroWidthToNode]);
|
|
7265
|
+
// Fix Firefox positioning.
|
|
7266
|
+
const nudgeLeft = new MathNode('mrow', [], ["ff-nudge-left"]);
|
|
7267
|
+
return newDocumentFragment([makeRow([node, mover]), nudgeLeft])
|
|
7268
|
+
}
|
|
7269
|
+
});
|
|
7270
|
+
|
|
7197
7271
|
// \@char is an internal function that takes a grouped decimal argument like
|
|
7198
7272
|
// {123} and converts into symbol with code 123. It is used by the *macro*
|
|
7199
7273
|
// \char defined in macros.js.
|
|
@@ -8120,8 +8194,10 @@ defineFunction({
|
|
|
8120
8194
|
}
|
|
8121
8195
|
});
|
|
8122
8196
|
|
|
8197
|
+
const boxTags = ["\\boxed", "\\fcolorbox", "\\colorbox"];
|
|
8198
|
+
|
|
8123
8199
|
const mathmlBuilder$7 = (group, style) => {
|
|
8124
|
-
const tag = group.label
|
|
8200
|
+
const tag = boxTags.includes(group.label) ? "mrow" : "menclose";
|
|
8125
8201
|
const node = new MathNode(tag, [buildGroup$1(group.body, style)]);
|
|
8126
8202
|
switch (group.label) {
|
|
8127
8203
|
case "\\overline":
|
|
@@ -8148,6 +8224,7 @@ const mathmlBuilder$7 = (group, style) => {
|
|
|
8148
8224
|
node.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
|
|
8149
8225
|
node.classes.push("tml-xcancel");
|
|
8150
8226
|
break
|
|
8227
|
+
// cancelto is handled in cancelto.js
|
|
8151
8228
|
case "\\longdiv":
|
|
8152
8229
|
node.setAttribute("notation", "longdiv");
|
|
8153
8230
|
node.classes.push("longdiv-top");
|
|
@@ -8180,13 +8257,8 @@ const mathmlBuilder$7 = (group, style) => {
|
|
|
8180
8257
|
break
|
|
8181
8258
|
case "\\fcolorbox":
|
|
8182
8259
|
case "\\colorbox": {
|
|
8183
|
-
//
|
|
8184
|
-
//
|
|
8185
|
-
// included with <menclose>.
|
|
8186
|
-
//const fboxsep = 3; // 3 pt from LaTeX source2e
|
|
8187
|
-
//node.setAttribute("height", `+${2 * fboxsep}pt`)
|
|
8188
|
-
//node.setAttribute("voffset", `${fboxsep}pt`)
|
|
8189
|
-
node.style.padding = "3pt";
|
|
8260
|
+
// Don't use <menclose>. WebKit would show a radical.
|
|
8261
|
+
node.style.padding = "0.3em"; // 3 pt from LaTeX source2e for a 10pt font
|
|
8190
8262
|
if (group.label === "\\fcolorbox") {
|
|
8191
8263
|
node.style.border = "0.0667em solid " + String(group.borderColor);
|
|
8192
8264
|
}
|
|
@@ -8955,16 +9027,16 @@ const mathmlBuilder$4 = (group, style) => {
|
|
|
8955
9027
|
]);
|
|
8956
9028
|
};
|
|
8957
9029
|
|
|
8958
|
-
// Horizontal stretchy
|
|
9030
|
+
// Horizontal stretchy brackets
|
|
8959
9031
|
defineFunction({
|
|
8960
|
-
type: "
|
|
8961
|
-
names: ["\\overbrace", "\\underbrace"],
|
|
9032
|
+
type: "horizBracket",
|
|
9033
|
+
names: ["\\overbrace", "\\underbrace", "\\overbracket", "\\underbracket"],
|
|
8962
9034
|
props: {
|
|
8963
9035
|
numArgs: 1
|
|
8964
9036
|
},
|
|
8965
9037
|
handler({ parser, funcName }, args) {
|
|
8966
9038
|
return {
|
|
8967
|
-
type: "
|
|
9039
|
+
type: "horizBracket",
|
|
8968
9040
|
mode: parser.mode,
|
|
8969
9041
|
label: funcName,
|
|
8970
9042
|
isOver: /^\\over/.test(funcName),
|
|
@@ -10120,7 +10192,8 @@ defineFunction({
|
|
|
10120
10192
|
"\u2a1a"
|
|
10121
10193
|
],
|
|
10122
10194
|
props: {
|
|
10123
|
-
numArgs: 0
|
|
10195
|
+
numArgs: 0,
|
|
10196
|
+
allowedInArgument: true
|
|
10124
10197
|
},
|
|
10125
10198
|
handler({ parser, funcName }) {
|
|
10126
10199
|
let fName = funcName;
|
|
@@ -10860,18 +10933,18 @@ const largePad = "AJdfΔΛ";
|
|
|
10860
10933
|
defineFunctionBuilders({
|
|
10861
10934
|
type: "supsub",
|
|
10862
10935
|
mathmlBuilder(group, style) {
|
|
10863
|
-
// Is the inner group a relevant horizontal brace?
|
|
10864
|
-
let
|
|
10936
|
+
// Is the inner group a relevant horizontal brace or bracket?
|
|
10937
|
+
let isBracket = false;
|
|
10865
10938
|
let isOver;
|
|
10866
10939
|
let isSup;
|
|
10867
10940
|
let appendApplyFunction = false;
|
|
10868
10941
|
let appendSpace = false;
|
|
10869
10942
|
let needsLeadingSpace = false;
|
|
10870
10943
|
|
|
10871
|
-
if (group.base && group.base.type === "
|
|
10944
|
+
if (group.base && group.base.type === "horizBracket") {
|
|
10872
10945
|
isSup = !!group.sup;
|
|
10873
10946
|
if (isSup === group.base.isOver) {
|
|
10874
|
-
|
|
10947
|
+
isBracket = true;
|
|
10875
10948
|
isOver = group.base.isOver;
|
|
10876
10949
|
}
|
|
10877
10950
|
}
|
|
@@ -10919,7 +10992,7 @@ defineFunctionBuilders({
|
|
|
10919
10992
|
}
|
|
10920
10993
|
|
|
10921
10994
|
let nodeType;
|
|
10922
|
-
if (
|
|
10995
|
+
if (isBracket) {
|
|
10923
10996
|
nodeType = isOver ? "mover" : "munder";
|
|
10924
10997
|
} else if (!group.sub) {
|
|
10925
10998
|
const base = group.base;
|
|
@@ -13604,6 +13677,12 @@ class Parser {
|
|
|
13604
13677
|
result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol();
|
|
13605
13678
|
if (result == null && text[0] === "\\" &&
|
|
13606
13679
|
!Object.prototype.hasOwnProperty.call(implicitCommands, text )) {
|
|
13680
|
+
if (this.settings.throwOnError) {
|
|
13681
|
+
throw new ParseError("Unsupported function name: " + text, firstToken);
|
|
13682
|
+
}
|
|
13683
|
+
// For people getting dyanamically rendered math, it's better to
|
|
13684
|
+
// show the unsupported command in red rather than panicking for every
|
|
13685
|
+
// partially written expression.
|
|
13607
13686
|
result = this.formatUnsupportedCmd(text);
|
|
13608
13687
|
this.consume();
|
|
13609
13688
|
}
|
|
@@ -13989,7 +14068,7 @@ class Style {
|
|
|
13989
14068
|
* https://mit-license.org/
|
|
13990
14069
|
*/
|
|
13991
14070
|
|
|
13992
|
-
const version = "0.
|
|
14071
|
+
const version = "0.13.01";
|
|
13993
14072
|
|
|
13994
14073
|
function postProcess(block) {
|
|
13995
14074
|
const labelMap = {};
|