temml 0.9.1 → 0.10.0
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 +3 -4
- package/dist/Temml-Latin-Modern.css +3 -5
- package/dist/Temml-Libertinus.css +3 -5
- package/dist/Temml-Local.css +3 -4
- package/dist/Temml-STIX2.css +3 -5
- package/dist/temml.cjs +87 -35
- package/dist/temml.js +87 -35
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +87 -35
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/Parser.js +17 -0
- package/src/asciiFromScript.js +29 -0
- package/src/buildMathML.js +1 -3
- package/src/functions/cr.js +2 -3
- package/src/functions/enclose.js +20 -1
- package/src/functions/font.js +0 -1
- package/src/functions/pmb.js +3 -4
- package/src/functions/symbolsOrd.js +10 -17
- package/src/macros.js +1 -1
- package/src/postProcess.js +1 -1
- package/src/symbols.js +2 -0
- package/src/variant.js +1 -4
package/dist/Temml-Asana.css
CHANGED
@@ -43,10 +43,6 @@ mo.tml-prime {
|
|
43
43
|
font-feature-settings: 'salt';
|
44
44
|
}
|
45
45
|
|
46
|
-
.oldstylenums {
|
47
|
-
font-feature-settings: 'onum';
|
48
|
-
}
|
49
|
-
|
50
46
|
/* AMS environment auto-numbering via CSS counter. */
|
51
47
|
.tml-eqn::before {
|
52
48
|
counter-increment: tmlEqnNo;
|
@@ -87,18 +83,21 @@ mtable.tml-align > mtr > mtd:nth-child(odd),
|
|
87
83
|
mtable.tml-alignat > mtr > mtd:nth-child(odd),
|
88
84
|
mtable.tml-aligned > mtr > mtd:nth-child(even) {
|
89
85
|
text-align: -webkit-left;
|
86
|
+
text-align: -moz-left;
|
90
87
|
}
|
91
88
|
|
92
89
|
mtable.tml-align > mtr > mtd:nth-child(even),
|
93
90
|
mtable.tml-alignat > mtr > mtd:nth-child(even),
|
94
91
|
mtable.tml-aligned > mtr > mtd:nth-child(odd) {
|
95
92
|
text-align: -webkit-right;
|
93
|
+
text-align: -moz-right;
|
96
94
|
}
|
97
95
|
|
98
96
|
mtable.tml-cases > mtr > mtd {
|
99
97
|
padding-left: 0em;
|
100
98
|
padding-right: 0em;
|
101
99
|
text-align: -webkit-left;
|
100
|
+
text-align: -moz-left;
|
102
101
|
}
|
103
102
|
|
104
103
|
mtable.tml-cases > mtr > mtd:nth-child(2) {
|
@@ -52,11 +52,6 @@ math {
|
|
52
52
|
font-family: "Temml";
|
53
53
|
}
|
54
54
|
|
55
|
-
.oldstylenums {
|
56
|
-
font-family: "Cambria Math", math;
|
57
|
-
font-feature-settings: 'onum';
|
58
|
-
}
|
59
|
-
|
60
55
|
mo.tml-prime {
|
61
56
|
font-family: Temml;
|
62
57
|
}
|
@@ -101,6 +96,7 @@ mtable.tml-align > mtr > mtd:nth-child(odd),
|
|
101
96
|
mtable.tml-alignat > mtr > mtd:nth-child(odd),
|
102
97
|
mtable.tml-aligned > mtr > mtd:nth-child(even) {
|
103
98
|
text-align: -webkit-left;
|
99
|
+
text-align: -moz-left;
|
104
100
|
}
|
105
101
|
|
106
102
|
mtable.tml-align > mtr > mtd:nth-child(even),
|
@@ -108,12 +104,14 @@ mtable.tml-alignat > mtr > mtd:nth-child(even),
|
|
108
104
|
mtable.tml-aligned > mtr > mtd:nth-child(odd),
|
109
105
|
mtable.tml-align-star > mtr > mtd:nth-child(odd) {
|
110
106
|
text-align: -webkit-right;
|
107
|
+
text-align: -moz-right;
|
111
108
|
}
|
112
109
|
|
113
110
|
mtable.tml-cases > mtr > mtd {
|
114
111
|
padding-left: 0em;
|
115
112
|
padding-right: 0em;
|
116
113
|
text-align: -webkit-left;
|
114
|
+
text-align: -moz-left;
|
117
115
|
}
|
118
116
|
|
119
117
|
mtable.tml-cases > mtr > mtd:nth-child(2) {
|
@@ -50,11 +50,6 @@ math {
|
|
50
50
|
font-family: "Cambria Math", 'STIXTwoMath-Regular', "Times New Roman", math;
|
51
51
|
}
|
52
52
|
|
53
|
-
.oldstylenums {
|
54
|
-
font-family: "Cambria Math", math;
|
55
|
-
font-feature-settings: 'onum';
|
56
|
-
}
|
57
|
-
|
58
53
|
mo.tml-prime {
|
59
54
|
font-feature-settings: 'ssty';
|
60
55
|
}
|
@@ -99,6 +94,7 @@ mtable.tml-align > mtr > mtd:nth-child(odd),
|
|
99
94
|
mtable.tml-alignat > mtr > mtd:nth-child(odd),
|
100
95
|
mtable.tml-aligned > mtr > mtd:nth-child(even) {
|
101
96
|
text-align: -webkit-left;
|
97
|
+
text-align: -moz-left;
|
102
98
|
}
|
103
99
|
|
104
100
|
mtable.tml-align > mtr > mtd:nth-child(even),
|
@@ -106,12 +102,14 @@ mtable.tml-alignat > mtr > mtd:nth-child(even),
|
|
106
102
|
mtable.tml-aligned > mtr > mtd:nth-child(odd),
|
107
103
|
mtable.tml-align-star > mtr > mtd:nth-child(odd) {
|
108
104
|
text-align: -webkit-right;
|
105
|
+
text-align: -moz-right;
|
109
106
|
}
|
110
107
|
|
111
108
|
mtable.tml-cases > mtr > mtd {
|
112
109
|
padding-left: 0em;
|
113
110
|
padding-right: 0em;
|
114
111
|
text-align: -webkit-left;
|
112
|
+
text-align: -moz-left;
|
115
113
|
}
|
116
114
|
|
117
115
|
mtable.tml-cases > mtr > mtd:nth-child(2) {
|
package/dist/Temml-Local.css
CHANGED
@@ -32,10 +32,6 @@ math .mathscr {
|
|
32
32
|
font-family: "Temml";
|
33
33
|
}
|
34
34
|
|
35
|
-
math .oldstylenums {
|
36
|
-
font-feature-settings: 'onum';
|
37
|
-
}
|
38
|
-
|
39
35
|
mo.tml-prime {
|
40
36
|
font-family: Temml;
|
41
37
|
}
|
@@ -80,18 +76,21 @@ mtable.tml-align > mtr > mtd:nth-child(odd),
|
|
80
76
|
mtable.tml-alignat > mtr > mtd:nth-child(odd),
|
81
77
|
mtable.tml-aligned > mtr > mtd:nth-child(even) {
|
82
78
|
text-align: -webkit-left;
|
79
|
+
text-align: -moz-left;
|
83
80
|
}
|
84
81
|
|
85
82
|
mtable.tml-align > mtr > mtd:nth-child(even),
|
86
83
|
mtable.tml-alignat > mtr > mtd:nth-child(even),
|
87
84
|
mtable.tml-aligned > mtr > mtd:nth-child(odd) {
|
88
85
|
text-align: -webkit-right;
|
86
|
+
text-align: -moz-right;
|
89
87
|
}
|
90
88
|
|
91
89
|
mtable.tml-cases > mtr > mtd {
|
92
90
|
padding-left: 0em;
|
93
91
|
padding-right: 0em;
|
94
92
|
text-align: -webkit-left;
|
93
|
+
text-align: -moz-left;
|
95
94
|
}
|
96
95
|
|
97
96
|
mtable.tml-cases > mtr > mtd:nth-child(2) {
|
package/dist/Temml-STIX2.css
CHANGED
@@ -40,11 +40,6 @@ math {
|
|
40
40
|
font-feature-settings: 'ss01';
|
41
41
|
}
|
42
42
|
|
43
|
-
.oldstylenums {
|
44
|
-
font-family: "Cambria Math", math;
|
45
|
-
font-feature-settings: 'onum';
|
46
|
-
}
|
47
|
-
|
48
43
|
mo.tml-prime {
|
49
44
|
font-feature-settings: 'ss04';
|
50
45
|
}
|
@@ -89,18 +84,21 @@ mtable.tml-align > mtr > mtd:nth-child(odd),
|
|
89
84
|
mtable.tml-alignat > mtr > mtd:nth-child(odd),
|
90
85
|
mtable.tml-aligned > mtr > mtd:nth-child(even) {
|
91
86
|
text-align: -webkit-left;
|
87
|
+
text-align: -moz-left;
|
92
88
|
}
|
93
89
|
|
94
90
|
mtable.tml-align > mtr > mtd:nth-child(even),
|
95
91
|
mtable.tml-alignat > mtr > mtd:nth-child(even),
|
96
92
|
mtable.tml-aligned > mtr > mtd:nth-child(odd) {
|
97
93
|
text-align: -webkit-right;
|
94
|
+
text-align: -moz-right;
|
98
95
|
}
|
99
96
|
|
100
97
|
mtable.tml-cases > mtr > mtd {
|
101
98
|
padding-left: 0em;
|
102
99
|
padding-right: 0em;
|
103
100
|
text-align: -webkit-left;
|
101
|
+
text-align: -moz-left;
|
104
102
|
}
|
105
103
|
|
106
104
|
mtable.tml-cases > mtr > mtd:nth-child(2) {
|
package/dist/temml.cjs
CHANGED
@@ -1234,6 +1234,8 @@ defineSymbol(math, textord, "\u2018", "`");
|
|
1234
1234
|
defineSymbol(math, textord, "$", "\\$");
|
1235
1235
|
defineSymbol(text, textord, "$", "\\$");
|
1236
1236
|
defineSymbol(text, textord, "$", "\\textdollar");
|
1237
|
+
defineSymbol(math, textord, "¢", "\\cent");
|
1238
|
+
defineSymbol(text, textord, "¢", "\\cent");
|
1237
1239
|
defineSymbol(math, textord, "%", "\\%");
|
1238
1240
|
defineSymbol(text, textord, "%", "\\%");
|
1239
1241
|
defineSymbol(math, textord, "_", "\\_");
|
@@ -2079,8 +2081,6 @@ function buildMathML(tree, texExpression, style, settings) {
|
|
2079
2081
|
let wrapper = expression.length === 1 && tag === null && (n1 instanceof MathNode)
|
2080
2082
|
&& !(n1.type === "mstyle" && n1.attributes.mathcolor)
|
2081
2083
|
? expression[0]
|
2082
|
-
: expression.length > 1 && wrap === "none"
|
2083
|
-
? new mathMLTree.MathNode("mrow", expression)
|
2084
2084
|
: setLineBreaks(expression, wrap, settings.displayMode);
|
2085
2085
|
|
2086
2086
|
if (tag) {
|
@@ -2095,7 +2095,7 @@ function buildMathML(tree, texExpression, style, settings) {
|
|
2095
2095
|
wrapper = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
|
2096
2096
|
}
|
2097
2097
|
|
2098
|
-
if (wrap !== "none") {
|
2098
|
+
if (wrap !== "none" && wrapper.children.length > 1) {
|
2099
2099
|
const maths = [];
|
2100
2100
|
for (let i = 0; i < wrapper.children.length; i++) {
|
2101
2101
|
const math = new mathMLTree.MathNode("math", [wrapper.children[i]]);
|
@@ -3150,13 +3150,12 @@ defineFunction({
|
|
3150
3150
|
names: ["\\\\"],
|
3151
3151
|
props: {
|
3152
3152
|
numArgs: 0,
|
3153
|
-
numOptionalArgs:
|
3154
|
-
argTypes: ["size"],
|
3153
|
+
numOptionalArgs: 0,
|
3155
3154
|
allowedInText: true
|
3156
3155
|
},
|
3157
3156
|
|
3158
3157
|
handler({ parser }, args, optArgs) {
|
3159
|
-
const size =
|
3158
|
+
const size = parser.gullet.future().text === "[" ? parser.parseSizeGroup(true) : null;
|
3160
3159
|
const newLine = !parser.settings.displayMode;
|
3161
3160
|
return {
|
3162
3161
|
type: "cr",
|
@@ -3909,7 +3908,7 @@ defineFunction({
|
|
3909
3908
|
|
3910
3909
|
defineFunction({
|
3911
3910
|
type: "enclose",
|
3912
|
-
names: ["\\angl", "\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\overline"
|
3911
|
+
names: ["\\angl", "\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\overline"],
|
3913
3912
|
// , "\\phase", "\\longdiv"
|
3914
3913
|
props: {
|
3915
3914
|
numArgs: 1
|
@@ -3926,6 +3925,25 @@ defineFunction({
|
|
3926
3925
|
mathmlBuilder: mathmlBuilder$8
|
3927
3926
|
});
|
3928
3927
|
|
3928
|
+
defineFunction({
|
3929
|
+
type: "enclose",
|
3930
|
+
names: ["\\underline"],
|
3931
|
+
props: {
|
3932
|
+
numArgs: 1,
|
3933
|
+
allowedInText: true
|
3934
|
+
},
|
3935
|
+
handler({ parser, funcName }, args) {
|
3936
|
+
const body = args[0];
|
3937
|
+
return {
|
3938
|
+
type: "enclose",
|
3939
|
+
mode: parser.mode,
|
3940
|
+
label: funcName,
|
3941
|
+
body
|
3942
|
+
};
|
3943
|
+
},
|
3944
|
+
mathmlBuilder: mathmlBuilder$8
|
3945
|
+
});
|
3946
|
+
|
3929
3947
|
/**
|
3930
3948
|
* All registered environments.
|
3931
3949
|
* `environments.js` exports this same dictionary again and makes it public.
|
@@ -4897,7 +4915,6 @@ defineFunction({
|
|
4897
4915
|
"\\mathscr",
|
4898
4916
|
"\\mathsf",
|
4899
4917
|
"\\mathtt",
|
4900
|
-
"\\oldstylenums",
|
4901
4918
|
|
4902
4919
|
// aliases
|
4903
4920
|
"\\Bbb",
|
@@ -6731,10 +6748,9 @@ defineFunction({
|
|
6731
6748
|
}
|
6732
6749
|
});
|
6733
6750
|
|
6734
|
-
// \pmb is a simulation of bold font.
|
6751
|
+
// In LaTeX, \pmb is a simulation of bold font.
|
6735
6752
|
// The version of \pmb in ambsy.sty works by typesetting three copies of the argument
|
6736
|
-
// with small offsets. We use CSS
|
6737
|
-
// It's a hack. Not as good as a real bold font. Better than nothing.
|
6753
|
+
// with small offsets. We use CSS font-weight:bold.
|
6738
6754
|
|
6739
6755
|
defineFunction({
|
6740
6756
|
type: "pmb",
|
@@ -6754,7 +6770,7 @@ defineFunction({
|
|
6754
6770
|
const inner = buildExpression(group.body, style);
|
6755
6771
|
// Wrap with an <mstyle> element.
|
6756
6772
|
const node = wrapWithMstyle(inner);
|
6757
|
-
node.setAttribute("style", "
|
6773
|
+
node.setAttribute("style", "font-weight:bold");
|
6758
6774
|
return node
|
6759
6775
|
}
|
6760
6776
|
});
|
@@ -7312,8 +7328,7 @@ const fontMap = {
|
|
7312
7328
|
mathfrak: "fraktur",
|
7313
7329
|
mathscr: "script",
|
7314
7330
|
mathsf: "sans-serif",
|
7315
|
-
mathtt: "monospace"
|
7316
|
-
oldstylenums: "oldstylenums"
|
7331
|
+
mathtt: "monospace"
|
7317
7332
|
};
|
7318
7333
|
|
7319
7334
|
/**
|
@@ -7383,8 +7398,6 @@ const getVariant = function(group, style) {
|
|
7383
7398
|
return "sans-serif"
|
7384
7399
|
case "mathtt":
|
7385
7400
|
return "monospace"
|
7386
|
-
case "oldstylenums":
|
7387
|
-
return "oldstylenums"
|
7388
7401
|
}
|
7389
7402
|
|
7390
7403
|
let text = group.text;
|
@@ -7627,8 +7640,8 @@ const smallCaps = Object.freeze({
|
|
7627
7640
|
const numberRegEx$1 = /^\d(?:[\d,.]*\d)?$/; // Keep in sync with numberRegEx in Parser.js
|
7628
7641
|
const latinRegEx = /[A-Ba-z]/;
|
7629
7642
|
|
7630
|
-
const italicNumber = (text, variant) => {
|
7631
|
-
const mn = new mathMLTree.MathNode(
|
7643
|
+
const italicNumber = (text, variant, tag) => {
|
7644
|
+
const mn = new mathMLTree.MathNode(tag, [text]);
|
7632
7645
|
const wrapper = new mathMLTree.MathNode("mstyle", [mn]);
|
7633
7646
|
wrapper.style["font-style"] = "italic";
|
7634
7647
|
wrapper.style["font-family"] = "Cambria, 'Times New Roman', serif";
|
@@ -7678,28 +7691,21 @@ defineFunctionBuilders({
|
|
7678
7691
|
const variant = getVariant(group, style) || "normal";
|
7679
7692
|
|
7680
7693
|
let node;
|
7681
|
-
if (group.
|
7694
|
+
if (numberRegEx$1.test(group.text)) {
|
7695
|
+
const tag = group.mode === "text" ? "mtext" : "mn";
|
7682
7696
|
if (variant === "italic" || variant === "bold-italic") {
|
7683
|
-
|
7684
|
-
|
7697
|
+
return italicNumber(text, variant, tag)
|
7698
|
+
} else {
|
7699
|
+
if (variant !== "normal") {
|
7700
|
+
text.text = text.text.split("").map(c => variantChar(c, variant)).join("");
|
7685
7701
|
}
|
7702
|
+
node = new mathMLTree.MathNode(tag, [text]);
|
7686
7703
|
}
|
7704
|
+
} else if (group.mode === "text") {
|
7687
7705
|
if (variant !== "normal") {
|
7688
7706
|
text.text = variantChar(text.text, variant);
|
7689
7707
|
}
|
7690
7708
|
node = new mathMLTree.MathNode("mtext", [text]);
|
7691
|
-
} else if (numberRegEx$1.test(group.text)) {
|
7692
|
-
if (variant === "oldstylenums") {
|
7693
|
-
const ms = new mathMLTree.MathNode("mstyle", [text], ["oldstylenums"]);
|
7694
|
-
node = new mathMLTree.MathNode("mn", [ms]);
|
7695
|
-
} else if (variant === "italic" || variant === "bold-italic") {
|
7696
|
-
return italicNumber(text, variant)
|
7697
|
-
} else {
|
7698
|
-
if (variant !== "normal") {
|
7699
|
-
text.text = text.text.split("").map(c => variantChar(c, variant)).join("");
|
7700
|
-
}
|
7701
|
-
node = new mathMLTree.MathNode("mn", [text]);
|
7702
|
-
}
|
7703
7709
|
} else if (group.text === "\\prime") {
|
7704
7710
|
node = new mathMLTree.MathNode("mo", [text]);
|
7705
7711
|
// TODO: If/when Chromium uses ssty variant for prime, remove the next line.
|
@@ -8398,7 +8404,7 @@ defineMacro("\\underbar", "\\underline{\\text{#1}}");
|
|
8398
8404
|
// \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
|
8399
8405
|
// We'll call \varvdots, which gets a glyph from symbols.js.
|
8400
8406
|
// The zero-width rule gets us an equivalent to the vertical 6pt kern.
|
8401
|
-
defineMacro("\\vdots", "
|
8407
|
+
defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}");
|
8402
8408
|
defineMacro("\u22ee", "\\vdots");
|
8403
8409
|
|
8404
8410
|
//////////////////////////////////////////////////////////////////////
|
@@ -11418,6 +11424,36 @@ const uSubsAndSups = Object.freeze({
|
|
11418
11424
|
'\u1DBF': 'θ'
|
11419
11425
|
});
|
11420
11426
|
|
11427
|
+
// Used for Unicode input of calligraphic and script letters
|
11428
|
+
const asciiFromScript = Object.freeze({
|
11429
|
+
"\ud835\udc9c": "A",
|
11430
|
+
"\u212c": "B",
|
11431
|
+
"\ud835\udc9e": "C",
|
11432
|
+
"\ud835\udc9f": "D",
|
11433
|
+
"\u2130": "E",
|
11434
|
+
"\u2131": "F",
|
11435
|
+
"\ud835\udca2": "G",
|
11436
|
+
"\u210B": "H",
|
11437
|
+
"\u2110": "I",
|
11438
|
+
"\ud835\udca5": "J",
|
11439
|
+
"\ud835\udca6": "K",
|
11440
|
+
"\u2112": "L",
|
11441
|
+
"\u2113": "M",
|
11442
|
+
"\ud835\udca9": "N",
|
11443
|
+
"\ud835\udcaa": "O",
|
11444
|
+
"\ud835\udcab": "P",
|
11445
|
+
"\ud835\udcac": "Q",
|
11446
|
+
"\u211B": "R",
|
11447
|
+
"\ud835\udcae": "S",
|
11448
|
+
"\ud835\udcaf": "T",
|
11449
|
+
"\ud835\udcb0": "U",
|
11450
|
+
"\ud835\udcb1": "V",
|
11451
|
+
"\ud835\udcb2": "W",
|
11452
|
+
"\ud835\udcb3": "X",
|
11453
|
+
"\ud835\udcb4": "Y",
|
11454
|
+
"\ud835\udcb5": "Z"
|
11455
|
+
});
|
11456
|
+
|
11421
11457
|
// Mapping of Unicode accent characters to their LaTeX equivalent in text and
|
11422
11458
|
// math mode (when they exist).
|
11423
11459
|
var unicodeAccents = {
|
@@ -12653,6 +12689,22 @@ class Parser {
|
|
12653
12689
|
text
|
12654
12690
|
};
|
12655
12691
|
} else {
|
12692
|
+
if (asciiFromScript[text]) {
|
12693
|
+
// Unicode 14 disambiguates chancery from roundhand.
|
12694
|
+
// See https://www.unicode.org/charts/PDF/U1D400.pdf
|
12695
|
+
this.consume();
|
12696
|
+
const nextCode = this.fetch().text.charCodeAt(0);
|
12697
|
+
// mathcal is Temml default. Use mathscript if called for.
|
12698
|
+
const font = nextCode === 0xfe01 ? "mathscr" : "mathcal";
|
12699
|
+
if (nextCode === 0xfe00 || nextCode === 0xfe01) { this.consume(); }
|
12700
|
+
return {
|
12701
|
+
type: "font",
|
12702
|
+
mode: "math",
|
12703
|
+
font,
|
12704
|
+
body: { type: "mathord", mode: "math", loc, text: asciiFromScript[text] }
|
12705
|
+
}
|
12706
|
+
}
|
12707
|
+
// Default ord character. No disambiguation necessary.
|
12656
12708
|
s = {
|
12657
12709
|
type: group,
|
12658
12710
|
mode: this.mode,
|
@@ -12909,7 +12961,7 @@ class Style {
|
|
12909
12961
|
* https://mit-license.org/
|
12910
12962
|
*/
|
12911
12963
|
|
12912
|
-
const version = "0.
|
12964
|
+
const version = "0.10.0";
|
12913
12965
|
|
12914
12966
|
function postProcess(block) {
|
12915
12967
|
const labelMap = {};
|
package/dist/temml.js
CHANGED
@@ -1235,6 +1235,8 @@ var temml = (function () {
|
|
1235
1235
|
defineSymbol(math, textord, "$", "\\$");
|
1236
1236
|
defineSymbol(text, textord, "$", "\\$");
|
1237
1237
|
defineSymbol(text, textord, "$", "\\textdollar");
|
1238
|
+
defineSymbol(math, textord, "¢", "\\cent");
|
1239
|
+
defineSymbol(text, textord, "¢", "\\cent");
|
1238
1240
|
defineSymbol(math, textord, "%", "\\%");
|
1239
1241
|
defineSymbol(text, textord, "%", "\\%");
|
1240
1242
|
defineSymbol(math, textord, "_", "\\_");
|
@@ -2080,8 +2082,6 @@ var temml = (function () {
|
|
2080
2082
|
let wrapper = expression.length === 1 && tag === null && (n1 instanceof MathNode)
|
2081
2083
|
&& !(n1.type === "mstyle" && n1.attributes.mathcolor)
|
2082
2084
|
? expression[0]
|
2083
|
-
: expression.length > 1 && wrap === "none"
|
2084
|
-
? new mathMLTree.MathNode("mrow", expression)
|
2085
2085
|
: setLineBreaks(expression, wrap, settings.displayMode);
|
2086
2086
|
|
2087
2087
|
if (tag) {
|
@@ -2096,7 +2096,7 @@ var temml = (function () {
|
|
2096
2096
|
wrapper = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
|
2097
2097
|
}
|
2098
2098
|
|
2099
|
-
if (wrap !== "none") {
|
2099
|
+
if (wrap !== "none" && wrapper.children.length > 1) {
|
2100
2100
|
const maths = [];
|
2101
2101
|
for (let i = 0; i < wrapper.children.length; i++) {
|
2102
2102
|
const math = new mathMLTree.MathNode("math", [wrapper.children[i]]);
|
@@ -3151,13 +3151,12 @@ var temml = (function () {
|
|
3151
3151
|
names: ["\\\\"],
|
3152
3152
|
props: {
|
3153
3153
|
numArgs: 0,
|
3154
|
-
numOptionalArgs:
|
3155
|
-
argTypes: ["size"],
|
3154
|
+
numOptionalArgs: 0,
|
3156
3155
|
allowedInText: true
|
3157
3156
|
},
|
3158
3157
|
|
3159
3158
|
handler({ parser }, args, optArgs) {
|
3160
|
-
const size =
|
3159
|
+
const size = parser.gullet.future().text === "[" ? parser.parseSizeGroup(true) : null;
|
3161
3160
|
const newLine = !parser.settings.displayMode;
|
3162
3161
|
return {
|
3163
3162
|
type: "cr",
|
@@ -3910,7 +3909,7 @@ var temml = (function () {
|
|
3910
3909
|
|
3911
3910
|
defineFunction({
|
3912
3911
|
type: "enclose",
|
3913
|
-
names: ["\\angl", "\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\overline"
|
3912
|
+
names: ["\\angl", "\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\overline"],
|
3914
3913
|
// , "\\phase", "\\longdiv"
|
3915
3914
|
props: {
|
3916
3915
|
numArgs: 1
|
@@ -3927,6 +3926,25 @@ var temml = (function () {
|
|
3927
3926
|
mathmlBuilder: mathmlBuilder$8
|
3928
3927
|
});
|
3929
3928
|
|
3929
|
+
defineFunction({
|
3930
|
+
type: "enclose",
|
3931
|
+
names: ["\\underline"],
|
3932
|
+
props: {
|
3933
|
+
numArgs: 1,
|
3934
|
+
allowedInText: true
|
3935
|
+
},
|
3936
|
+
handler({ parser, funcName }, args) {
|
3937
|
+
const body = args[0];
|
3938
|
+
return {
|
3939
|
+
type: "enclose",
|
3940
|
+
mode: parser.mode,
|
3941
|
+
label: funcName,
|
3942
|
+
body
|
3943
|
+
};
|
3944
|
+
},
|
3945
|
+
mathmlBuilder: mathmlBuilder$8
|
3946
|
+
});
|
3947
|
+
|
3930
3948
|
/**
|
3931
3949
|
* All registered environments.
|
3932
3950
|
* `environments.js` exports this same dictionary again and makes it public.
|
@@ -4898,7 +4916,6 @@ var temml = (function () {
|
|
4898
4916
|
"\\mathscr",
|
4899
4917
|
"\\mathsf",
|
4900
4918
|
"\\mathtt",
|
4901
|
-
"\\oldstylenums",
|
4902
4919
|
|
4903
4920
|
// aliases
|
4904
4921
|
"\\Bbb",
|
@@ -6732,10 +6749,9 @@ var temml = (function () {
|
|
6732
6749
|
}
|
6733
6750
|
});
|
6734
6751
|
|
6735
|
-
// \pmb is a simulation of bold font.
|
6752
|
+
// In LaTeX, \pmb is a simulation of bold font.
|
6736
6753
|
// The version of \pmb in ambsy.sty works by typesetting three copies of the argument
|
6737
|
-
// with small offsets. We use CSS
|
6738
|
-
// It's a hack. Not as good as a real bold font. Better than nothing.
|
6754
|
+
// with small offsets. We use CSS font-weight:bold.
|
6739
6755
|
|
6740
6756
|
defineFunction({
|
6741
6757
|
type: "pmb",
|
@@ -6755,7 +6771,7 @@ var temml = (function () {
|
|
6755
6771
|
const inner = buildExpression(group.body, style);
|
6756
6772
|
// Wrap with an <mstyle> element.
|
6757
6773
|
const node = wrapWithMstyle(inner);
|
6758
|
-
node.setAttribute("style", "
|
6774
|
+
node.setAttribute("style", "font-weight:bold");
|
6759
6775
|
return node
|
6760
6776
|
}
|
6761
6777
|
});
|
@@ -7313,8 +7329,7 @@ var temml = (function () {
|
|
7313
7329
|
mathfrak: "fraktur",
|
7314
7330
|
mathscr: "script",
|
7315
7331
|
mathsf: "sans-serif",
|
7316
|
-
mathtt: "monospace"
|
7317
|
-
oldstylenums: "oldstylenums"
|
7332
|
+
mathtt: "monospace"
|
7318
7333
|
};
|
7319
7334
|
|
7320
7335
|
/**
|
@@ -7384,8 +7399,6 @@ var temml = (function () {
|
|
7384
7399
|
return "sans-serif"
|
7385
7400
|
case "mathtt":
|
7386
7401
|
return "monospace"
|
7387
|
-
case "oldstylenums":
|
7388
|
-
return "oldstylenums"
|
7389
7402
|
}
|
7390
7403
|
|
7391
7404
|
let text = group.text;
|
@@ -7628,8 +7641,8 @@ var temml = (function () {
|
|
7628
7641
|
const numberRegEx$1 = /^\d(?:[\d,.]*\d)?$/; // Keep in sync with numberRegEx in Parser.js
|
7629
7642
|
const latinRegEx = /[A-Ba-z]/;
|
7630
7643
|
|
7631
|
-
const italicNumber = (text, variant) => {
|
7632
|
-
const mn = new mathMLTree.MathNode(
|
7644
|
+
const italicNumber = (text, variant, tag) => {
|
7645
|
+
const mn = new mathMLTree.MathNode(tag, [text]);
|
7633
7646
|
const wrapper = new mathMLTree.MathNode("mstyle", [mn]);
|
7634
7647
|
wrapper.style["font-style"] = "italic";
|
7635
7648
|
wrapper.style["font-family"] = "Cambria, 'Times New Roman', serif";
|
@@ -7679,28 +7692,21 @@ var temml = (function () {
|
|
7679
7692
|
const variant = getVariant(group, style) || "normal";
|
7680
7693
|
|
7681
7694
|
let node;
|
7682
|
-
if (group.
|
7695
|
+
if (numberRegEx$1.test(group.text)) {
|
7696
|
+
const tag = group.mode === "text" ? "mtext" : "mn";
|
7683
7697
|
if (variant === "italic" || variant === "bold-italic") {
|
7684
|
-
|
7685
|
-
|
7698
|
+
return italicNumber(text, variant, tag)
|
7699
|
+
} else {
|
7700
|
+
if (variant !== "normal") {
|
7701
|
+
text.text = text.text.split("").map(c => variantChar(c, variant)).join("");
|
7686
7702
|
}
|
7703
|
+
node = new mathMLTree.MathNode(tag, [text]);
|
7687
7704
|
}
|
7705
|
+
} else if (group.mode === "text") {
|
7688
7706
|
if (variant !== "normal") {
|
7689
7707
|
text.text = variantChar(text.text, variant);
|
7690
7708
|
}
|
7691
7709
|
node = new mathMLTree.MathNode("mtext", [text]);
|
7692
|
-
} else if (numberRegEx$1.test(group.text)) {
|
7693
|
-
if (variant === "oldstylenums") {
|
7694
|
-
const ms = new mathMLTree.MathNode("mstyle", [text], ["oldstylenums"]);
|
7695
|
-
node = new mathMLTree.MathNode("mn", [ms]);
|
7696
|
-
} else if (variant === "italic" || variant === "bold-italic") {
|
7697
|
-
return italicNumber(text, variant)
|
7698
|
-
} else {
|
7699
|
-
if (variant !== "normal") {
|
7700
|
-
text.text = text.text.split("").map(c => variantChar(c, variant)).join("");
|
7701
|
-
}
|
7702
|
-
node = new mathMLTree.MathNode("mn", [text]);
|
7703
|
-
}
|
7704
7710
|
} else if (group.text === "\\prime") {
|
7705
7711
|
node = new mathMLTree.MathNode("mo", [text]);
|
7706
7712
|
// TODO: If/when Chromium uses ssty variant for prime, remove the next line.
|
@@ -8399,7 +8405,7 @@ var temml = (function () {
|
|
8399
8405
|
// \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
|
8400
8406
|
// We'll call \varvdots, which gets a glyph from symbols.js.
|
8401
8407
|
// The zero-width rule gets us an equivalent to the vertical 6pt kern.
|
8402
|
-
defineMacro("\\vdots", "
|
8408
|
+
defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}");
|
8403
8409
|
defineMacro("\u22ee", "\\vdots");
|
8404
8410
|
|
8405
8411
|
//////////////////////////////////////////////////////////////////////
|
@@ -9519,6 +9525,36 @@ var temml = (function () {
|
|
9519
9525
|
'\u1DBF': 'θ'
|
9520
9526
|
});
|
9521
9527
|
|
9528
|
+
// Used for Unicode input of calligraphic and script letters
|
9529
|
+
const asciiFromScript = Object.freeze({
|
9530
|
+
"\ud835\udc9c": "A",
|
9531
|
+
"\u212c": "B",
|
9532
|
+
"\ud835\udc9e": "C",
|
9533
|
+
"\ud835\udc9f": "D",
|
9534
|
+
"\u2130": "E",
|
9535
|
+
"\u2131": "F",
|
9536
|
+
"\ud835\udca2": "G",
|
9537
|
+
"\u210B": "H",
|
9538
|
+
"\u2110": "I",
|
9539
|
+
"\ud835\udca5": "J",
|
9540
|
+
"\ud835\udca6": "K",
|
9541
|
+
"\u2112": "L",
|
9542
|
+
"\u2113": "M",
|
9543
|
+
"\ud835\udca9": "N",
|
9544
|
+
"\ud835\udcaa": "O",
|
9545
|
+
"\ud835\udcab": "P",
|
9546
|
+
"\ud835\udcac": "Q",
|
9547
|
+
"\u211B": "R",
|
9548
|
+
"\ud835\udcae": "S",
|
9549
|
+
"\ud835\udcaf": "T",
|
9550
|
+
"\ud835\udcb0": "U",
|
9551
|
+
"\ud835\udcb1": "V",
|
9552
|
+
"\ud835\udcb2": "W",
|
9553
|
+
"\ud835\udcb3": "X",
|
9554
|
+
"\ud835\udcb4": "Y",
|
9555
|
+
"\ud835\udcb5": "Z"
|
9556
|
+
});
|
9557
|
+
|
9522
9558
|
// Mapping of Unicode accent characters to their LaTeX equivalent in text and
|
9523
9559
|
// math mode (when they exist).
|
9524
9560
|
var unicodeAccents = {
|
@@ -10754,6 +10790,22 @@ var temml = (function () {
|
|
10754
10790
|
text
|
10755
10791
|
};
|
10756
10792
|
} else {
|
10793
|
+
if (asciiFromScript[text]) {
|
10794
|
+
// Unicode 14 disambiguates chancery from roundhand.
|
10795
|
+
// See https://www.unicode.org/charts/PDF/U1D400.pdf
|
10796
|
+
this.consume();
|
10797
|
+
const nextCode = this.fetch().text.charCodeAt(0);
|
10798
|
+
// mathcal is Temml default. Use mathscript if called for.
|
10799
|
+
const font = nextCode === 0xfe01 ? "mathscr" : "mathcal";
|
10800
|
+
if (nextCode === 0xfe00 || nextCode === 0xfe01) { this.consume(); }
|
10801
|
+
return {
|
10802
|
+
type: "font",
|
10803
|
+
mode: "math",
|
10804
|
+
font,
|
10805
|
+
body: { type: "mathord", mode: "math", loc, text: asciiFromScript[text] }
|
10806
|
+
}
|
10807
|
+
}
|
10808
|
+
// Default ord character. No disambiguation necessary.
|
10757
10809
|
s = {
|
10758
10810
|
type: group,
|
10759
10811
|
mode: this.mode,
|
@@ -11010,7 +11062,7 @@ var temml = (function () {
|
|
11010
11062
|
* https://mit-license.org/
|
11011
11063
|
*/
|
11012
11064
|
|
11013
|
-
const version = "0.
|
11065
|
+
const version = "0.10.0";
|
11014
11066
|
|
11015
11067
|
function postProcess(block) {
|
11016
11068
|
const labelMap = {};
|