temml 0.11.10 → 0.11.11
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.cjs +25 -42
- package/dist/temml.js +25 -42
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +25 -42
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/functions/delimsizing.js +3 -0
- package/src/functions/enclose.js +4 -24
- package/src/postProcess.js +1 -1
package/dist/temml.cjs
CHANGED
|
@@ -2807,17 +2807,17 @@ const calculateSize = function(sizeValue, style) {
|
|
|
2807
2807
|
|
|
2808
2808
|
// Helper functions
|
|
2809
2809
|
|
|
2810
|
-
const padding
|
|
2810
|
+
const padding = width => {
|
|
2811
2811
|
const node = new mathMLTree.MathNode("mspace");
|
|
2812
2812
|
node.setAttribute("width", width + "em");
|
|
2813
2813
|
return node
|
|
2814
2814
|
};
|
|
2815
2815
|
|
|
2816
2816
|
const paddedNode = (group, lspace = 0.3, rspace = 0, mustSmash = false) => {
|
|
2817
|
-
if (group == null && rspace === 0) { return padding
|
|
2817
|
+
if (group == null && rspace === 0) { return padding(lspace) }
|
|
2818
2818
|
const row = group ? [group] : [];
|
|
2819
|
-
if (lspace !== 0) { row.unshift(padding
|
|
2820
|
-
if (rspace > 0) { row.push(padding
|
|
2819
|
+
if (lspace !== 0) { row.unshift(padding(lspace)); }
|
|
2820
|
+
if (rspace > 0) { row.push(padding(rspace)); }
|
|
2821
2821
|
if (mustSmash) {
|
|
2822
2822
|
// Used for the bottom arrow in a {CD} environment
|
|
2823
2823
|
const mpadded = new mathMLTree.MathNode("mpadded", row);
|
|
@@ -2949,8 +2949,8 @@ defineFunction({
|
|
|
2949
2949
|
const node = munderoverNode(group.name, group.body, group.below, style);
|
|
2950
2950
|
// Create operator spacing for a relation.
|
|
2951
2951
|
const row = [node];
|
|
2952
|
-
row.unshift(padding
|
|
2953
|
-
row.push(padding
|
|
2952
|
+
row.unshift(padding(0.2778));
|
|
2953
|
+
row.push(padding(0.2778));
|
|
2954
2954
|
return new mathMLTree.MathNode("mrow", row)
|
|
2955
2955
|
}
|
|
2956
2956
|
});
|
|
@@ -3014,13 +3014,13 @@ defineFunction({
|
|
|
3014
3014
|
botNode.setAttribute("width", "0.5em");
|
|
3015
3015
|
wrapper = new mathMLTree.MathNode(
|
|
3016
3016
|
"mpadded",
|
|
3017
|
-
[padding
|
|
3017
|
+
[padding(0.2778), botNode, raiseNode, padding(0.2778)]
|
|
3018
3018
|
);
|
|
3019
3019
|
} else {
|
|
3020
3020
|
raiseNode.setAttribute("width", (group.name === "\\equilibriumRight" ? "0.5em" : "0"));
|
|
3021
3021
|
wrapper = new mathMLTree.MathNode(
|
|
3022
3022
|
"mpadded",
|
|
3023
|
-
[padding
|
|
3023
|
+
[padding(0.2778), raiseNode, botArrow, padding(0.2778)]
|
|
3024
3024
|
);
|
|
3025
3025
|
}
|
|
3026
3026
|
|
|
@@ -7908,6 +7908,9 @@ const sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0];
|
|
|
7908
7908
|
|
|
7909
7909
|
// Delimiter functions
|
|
7910
7910
|
function checkDelimiter(delim, context) {
|
|
7911
|
+
if (delim.type === "ordgroup" && delim.body.length === 1) {
|
|
7912
|
+
delim = delim.body[0]; // Unwrap the braces
|
|
7913
|
+
}
|
|
7911
7914
|
const symDelim = checkSymbolNodeType(delim);
|
|
7912
7915
|
if (symDelim && delimiters.includes(symDelim.text)) {
|
|
7913
7916
|
// If a character is not in the MathML operator dictionary, it will not stretch.
|
|
@@ -8139,26 +8142,8 @@ defineFunction({
|
|
|
8139
8142
|
}
|
|
8140
8143
|
});
|
|
8141
8144
|
|
|
8142
|
-
const padding = _ => {
|
|
8143
|
-
const node = new mathMLTree.MathNode("mspace");
|
|
8144
|
-
node.setAttribute("width", "3pt");
|
|
8145
|
-
return node
|
|
8146
|
-
};
|
|
8147
|
-
|
|
8148
8145
|
const mathmlBuilder$7 = (group, style) => {
|
|
8149
|
-
|
|
8150
|
-
if (group.label.indexOf("colorbox") > -1 || group.label === "\\boxed") {
|
|
8151
|
-
// MathML core does not support +width attribute in <mpadded>.
|
|
8152
|
-
// Firefox does not reliably add side padding.
|
|
8153
|
-
// Insert <mspace>
|
|
8154
|
-
node = new mathMLTree.MathNode("mrow", [
|
|
8155
|
-
padding(),
|
|
8156
|
-
buildGroup$1(group.body, style),
|
|
8157
|
-
padding()
|
|
8158
|
-
]);
|
|
8159
|
-
} else {
|
|
8160
|
-
node = new mathMLTree.MathNode("menclose", [buildGroup$1(group.body, style)]);
|
|
8161
|
-
}
|
|
8146
|
+
const node = new mathMLTree.MathNode("menclose", [buildGroup$1(group.body, style)]);
|
|
8162
8147
|
switch (group.label) {
|
|
8163
8148
|
case "\\overline":
|
|
8164
8149
|
node.setAttribute("notation", "top"); // for Firefox & WebKit
|
|
@@ -8206,7 +8191,7 @@ const mathmlBuilder$7 = (group, style) => {
|
|
|
8206
8191
|
case "\\boxed":
|
|
8207
8192
|
// \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} from amsmath.sty
|
|
8208
8193
|
node.setAttribute("notation", "box");
|
|
8209
|
-
node.style.padding = "
|
|
8194
|
+
node.style.padding = "3pt";
|
|
8210
8195
|
node.style.border = "1px solid";
|
|
8211
8196
|
node.setAttribute("scriptlevel", "0");
|
|
8212
8197
|
node.setAttribute("displaystyle", "true");
|
|
@@ -8223,12 +8208,10 @@ const mathmlBuilder$7 = (group, style) => {
|
|
|
8223
8208
|
//const fboxsep = 3; // 3 pt from LaTeX source2e
|
|
8224
8209
|
//node.setAttribute("height", `+${2 * fboxsep}pt`)
|
|
8225
8210
|
//node.setAttribute("voffset", `${fboxsep}pt`)
|
|
8226
|
-
|
|
8227
|
-
|
|
8211
|
+
node.style.padding = "3pt";
|
|
8228
8212
|
if (group.label === "\\fcolorbox") {
|
|
8229
|
-
style.border = "0.0667em solid " + String(group.borderColor);
|
|
8213
|
+
node.style.border = "0.0667em solid " + String(group.borderColor);
|
|
8230
8214
|
}
|
|
8231
|
-
node.style = style;
|
|
8232
8215
|
break
|
|
8233
8216
|
}
|
|
8234
8217
|
}
|
|
@@ -9518,17 +9501,17 @@ function mathmlBuilder$3(group, style) {
|
|
|
9518
9501
|
if (doSpacing ) {
|
|
9519
9502
|
if (group.mclass === "mbin") {
|
|
9520
9503
|
// medium space
|
|
9521
|
-
node.children.unshift(padding
|
|
9522
|
-
node.children.push(padding
|
|
9504
|
+
node.children.unshift(padding(0.2222));
|
|
9505
|
+
node.children.push(padding(0.2222));
|
|
9523
9506
|
} else if (group.mclass === "mrel") {
|
|
9524
9507
|
// thickspace
|
|
9525
|
-
node.children.unshift(padding
|
|
9526
|
-
node.children.push(padding
|
|
9508
|
+
node.children.unshift(padding(0.2778));
|
|
9509
|
+
node.children.push(padding(0.2778));
|
|
9527
9510
|
} else if (group.mclass === "mpunct") {
|
|
9528
|
-
node.children.push(padding
|
|
9511
|
+
node.children.push(padding(0.1667));
|
|
9529
9512
|
} else if (group.mclass === "minner") {
|
|
9530
|
-
node.children.unshift(padding
|
|
9531
|
-
node.children.push(padding
|
|
9513
|
+
node.children.unshift(padding(0.0556)); // 1 mu is the most likely option
|
|
9514
|
+
node.children.push(padding(0.0556));
|
|
9532
9515
|
}
|
|
9533
9516
|
}
|
|
9534
9517
|
} else {
|
|
@@ -11092,10 +11075,10 @@ defineFunctionBuilders({
|
|
|
11092
11075
|
} else if (group.needsSpacing) {
|
|
11093
11076
|
// Fix a MathML bug that occurs when a <mo> is between two <mtext> elements.
|
|
11094
11077
|
if (group.family === "bin") {
|
|
11095
|
-
return new mathMLTree.MathNode("mrow", [padding
|
|
11078
|
+
return new mathMLTree.MathNode("mrow", [padding(0.222), node, padding(0.222)])
|
|
11096
11079
|
} else {
|
|
11097
11080
|
// REL spacing
|
|
11098
|
-
return new mathMLTree.MathNode("mrow", [padding
|
|
11081
|
+
return new mathMLTree.MathNode("mrow", [padding(0.2778), node, padding(0.2778)])
|
|
11099
11082
|
}
|
|
11100
11083
|
}
|
|
11101
11084
|
return node;
|
|
@@ -14028,7 +14011,7 @@ class Style {
|
|
|
14028
14011
|
* https://mit-license.org/
|
|
14029
14012
|
*/
|
|
14030
14013
|
|
|
14031
|
-
const version = "0.11.
|
|
14014
|
+
const version = "0.11.11";
|
|
14032
14015
|
|
|
14033
14016
|
function postProcess(block) {
|
|
14034
14017
|
const labelMap = {};
|
package/dist/temml.js
CHANGED
|
@@ -2808,17 +2808,17 @@ var temml = (function () {
|
|
|
2808
2808
|
|
|
2809
2809
|
// Helper functions
|
|
2810
2810
|
|
|
2811
|
-
const padding
|
|
2811
|
+
const padding = width => {
|
|
2812
2812
|
const node = new mathMLTree.MathNode("mspace");
|
|
2813
2813
|
node.setAttribute("width", width + "em");
|
|
2814
2814
|
return node
|
|
2815
2815
|
};
|
|
2816
2816
|
|
|
2817
2817
|
const paddedNode = (group, lspace = 0.3, rspace = 0, mustSmash = false) => {
|
|
2818
|
-
if (group == null && rspace === 0) { return padding
|
|
2818
|
+
if (group == null && rspace === 0) { return padding(lspace) }
|
|
2819
2819
|
const row = group ? [group] : [];
|
|
2820
|
-
if (lspace !== 0) { row.unshift(padding
|
|
2821
|
-
if (rspace > 0) { row.push(padding
|
|
2820
|
+
if (lspace !== 0) { row.unshift(padding(lspace)); }
|
|
2821
|
+
if (rspace > 0) { row.push(padding(rspace)); }
|
|
2822
2822
|
if (mustSmash) {
|
|
2823
2823
|
// Used for the bottom arrow in a {CD} environment
|
|
2824
2824
|
const mpadded = new mathMLTree.MathNode("mpadded", row);
|
|
@@ -2950,8 +2950,8 @@ var temml = (function () {
|
|
|
2950
2950
|
const node = munderoverNode(group.name, group.body, group.below, style);
|
|
2951
2951
|
// Create operator spacing for a relation.
|
|
2952
2952
|
const row = [node];
|
|
2953
|
-
row.unshift(padding
|
|
2954
|
-
row.push(padding
|
|
2953
|
+
row.unshift(padding(0.2778));
|
|
2954
|
+
row.push(padding(0.2778));
|
|
2955
2955
|
return new mathMLTree.MathNode("mrow", row)
|
|
2956
2956
|
}
|
|
2957
2957
|
});
|
|
@@ -3015,13 +3015,13 @@ var temml = (function () {
|
|
|
3015
3015
|
botNode.setAttribute("width", "0.5em");
|
|
3016
3016
|
wrapper = new mathMLTree.MathNode(
|
|
3017
3017
|
"mpadded",
|
|
3018
|
-
[padding
|
|
3018
|
+
[padding(0.2778), botNode, raiseNode, padding(0.2778)]
|
|
3019
3019
|
);
|
|
3020
3020
|
} else {
|
|
3021
3021
|
raiseNode.setAttribute("width", (group.name === "\\equilibriumRight" ? "0.5em" : "0"));
|
|
3022
3022
|
wrapper = new mathMLTree.MathNode(
|
|
3023
3023
|
"mpadded",
|
|
3024
|
-
[padding
|
|
3024
|
+
[padding(0.2778), raiseNode, botArrow, padding(0.2778)]
|
|
3025
3025
|
);
|
|
3026
3026
|
}
|
|
3027
3027
|
|
|
@@ -5995,6 +5995,9 @@ var temml = (function () {
|
|
|
5995
5995
|
|
|
5996
5996
|
// Delimiter functions
|
|
5997
5997
|
function checkDelimiter(delim, context) {
|
|
5998
|
+
if (delim.type === "ordgroup" && delim.body.length === 1) {
|
|
5999
|
+
delim = delim.body[0]; // Unwrap the braces
|
|
6000
|
+
}
|
|
5998
6001
|
const symDelim = checkSymbolNodeType(delim);
|
|
5999
6002
|
if (symDelim && delimiters.includes(symDelim.text)) {
|
|
6000
6003
|
// If a character is not in the MathML operator dictionary, it will not stretch.
|
|
@@ -6226,26 +6229,8 @@ var temml = (function () {
|
|
|
6226
6229
|
}
|
|
6227
6230
|
});
|
|
6228
6231
|
|
|
6229
|
-
const padding = _ => {
|
|
6230
|
-
const node = new mathMLTree.MathNode("mspace");
|
|
6231
|
-
node.setAttribute("width", "3pt");
|
|
6232
|
-
return node
|
|
6233
|
-
};
|
|
6234
|
-
|
|
6235
6232
|
const mathmlBuilder$7 = (group, style) => {
|
|
6236
|
-
|
|
6237
|
-
if (group.label.indexOf("colorbox") > -1 || group.label === "\\boxed") {
|
|
6238
|
-
// MathML core does not support +width attribute in <mpadded>.
|
|
6239
|
-
// Firefox does not reliably add side padding.
|
|
6240
|
-
// Insert <mspace>
|
|
6241
|
-
node = new mathMLTree.MathNode("mrow", [
|
|
6242
|
-
padding(),
|
|
6243
|
-
buildGroup$1(group.body, style),
|
|
6244
|
-
padding()
|
|
6245
|
-
]);
|
|
6246
|
-
} else {
|
|
6247
|
-
node = new mathMLTree.MathNode("menclose", [buildGroup$1(group.body, style)]);
|
|
6248
|
-
}
|
|
6233
|
+
const node = new mathMLTree.MathNode("menclose", [buildGroup$1(group.body, style)]);
|
|
6249
6234
|
switch (group.label) {
|
|
6250
6235
|
case "\\overline":
|
|
6251
6236
|
node.setAttribute("notation", "top"); // for Firefox & WebKit
|
|
@@ -6293,7 +6278,7 @@ var temml = (function () {
|
|
|
6293
6278
|
case "\\boxed":
|
|
6294
6279
|
// \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} from amsmath.sty
|
|
6295
6280
|
node.setAttribute("notation", "box");
|
|
6296
|
-
node.style.padding = "
|
|
6281
|
+
node.style.padding = "3pt";
|
|
6297
6282
|
node.style.border = "1px solid";
|
|
6298
6283
|
node.setAttribute("scriptlevel", "0");
|
|
6299
6284
|
node.setAttribute("displaystyle", "true");
|
|
@@ -6310,12 +6295,10 @@ var temml = (function () {
|
|
|
6310
6295
|
//const fboxsep = 3; // 3 pt from LaTeX source2e
|
|
6311
6296
|
//node.setAttribute("height", `+${2 * fboxsep}pt`)
|
|
6312
6297
|
//node.setAttribute("voffset", `${fboxsep}pt`)
|
|
6313
|
-
|
|
6314
|
-
|
|
6298
|
+
node.style.padding = "3pt";
|
|
6315
6299
|
if (group.label === "\\fcolorbox") {
|
|
6316
|
-
style.border = "0.0667em solid " + String(group.borderColor);
|
|
6300
|
+
node.style.border = "0.0667em solid " + String(group.borderColor);
|
|
6317
6301
|
}
|
|
6318
|
-
node.style = style;
|
|
6319
6302
|
break
|
|
6320
6303
|
}
|
|
6321
6304
|
}
|
|
@@ -7605,17 +7588,17 @@ var temml = (function () {
|
|
|
7605
7588
|
if (doSpacing ) {
|
|
7606
7589
|
if (group.mclass === "mbin") {
|
|
7607
7590
|
// medium space
|
|
7608
|
-
node.children.unshift(padding
|
|
7609
|
-
node.children.push(padding
|
|
7591
|
+
node.children.unshift(padding(0.2222));
|
|
7592
|
+
node.children.push(padding(0.2222));
|
|
7610
7593
|
} else if (group.mclass === "mrel") {
|
|
7611
7594
|
// thickspace
|
|
7612
|
-
node.children.unshift(padding
|
|
7613
|
-
node.children.push(padding
|
|
7595
|
+
node.children.unshift(padding(0.2778));
|
|
7596
|
+
node.children.push(padding(0.2778));
|
|
7614
7597
|
} else if (group.mclass === "mpunct") {
|
|
7615
|
-
node.children.push(padding
|
|
7598
|
+
node.children.push(padding(0.1667));
|
|
7616
7599
|
} else if (group.mclass === "minner") {
|
|
7617
|
-
node.children.unshift(padding
|
|
7618
|
-
node.children.push(padding
|
|
7600
|
+
node.children.unshift(padding(0.0556)); // 1 mu is the most likely option
|
|
7601
|
+
node.children.push(padding(0.0556));
|
|
7619
7602
|
}
|
|
7620
7603
|
}
|
|
7621
7604
|
} else {
|
|
@@ -9179,10 +9162,10 @@ var temml = (function () {
|
|
|
9179
9162
|
} else if (group.needsSpacing) {
|
|
9180
9163
|
// Fix a MathML bug that occurs when a <mo> is between two <mtext> elements.
|
|
9181
9164
|
if (group.family === "bin") {
|
|
9182
|
-
return new mathMLTree.MathNode("mrow", [padding
|
|
9165
|
+
return new mathMLTree.MathNode("mrow", [padding(0.222), node, padding(0.222)])
|
|
9183
9166
|
} else {
|
|
9184
9167
|
// REL spacing
|
|
9185
|
-
return new mathMLTree.MathNode("mrow", [padding
|
|
9168
|
+
return new mathMLTree.MathNode("mrow", [padding(0.2778), node, padding(0.2778)])
|
|
9186
9169
|
}
|
|
9187
9170
|
}
|
|
9188
9171
|
return node;
|
|
@@ -12115,7 +12098,7 @@ var temml = (function () {
|
|
|
12115
12098
|
* https://mit-license.org/
|
|
12116
12099
|
*/
|
|
12117
12100
|
|
|
12118
|
-
const version = "0.11.
|
|
12101
|
+
const version = "0.11.11";
|
|
12119
12102
|
|
|
12120
12103
|
function postProcess(block) {
|
|
12121
12104
|
const labelMap = {};
|