katex 0.10.1 → 0.10.2
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/CHANGELOG.md +51 -0
- package/README.md +4 -4
- package/cli.js +0 -0
- package/contrib/copy-tex/README.md +3 -3
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/dist/README.md +4 -4
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/katex.css +10 -0
- package/dist/katex.js +541 -249
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +418 -198
- package/package.json +1 -1
- package/src/Options.js +11 -75
- package/src/buildMathML.js +13 -3
- package/src/domTree.js +63 -0
- package/src/environments/array.js +118 -2
- package/src/fontMetrics.js +3 -2
- package/src/functions/arrow.js +15 -5
- package/src/functions/color.js +2 -37
- package/src/functions/delimsizing.js +12 -2
- package/src/functions/enclose.js +15 -3
- package/src/functions/genfrac.js +31 -12
- package/src/functions/includegraphics.js +146 -0
- package/src/functions/mclass.js +1 -0
- package/src/functions/op.js +18 -10
- package/src/functions/phantom.js +5 -2
- package/src/functions/rule.js +20 -9
- package/src/functions/supsub.js +6 -2
- package/src/functions/symbolsOp.js +4 -0
- package/src/functions/tag.js +20 -4
- package/src/functions/text.js +4 -2
- package/src/functions.js +2 -0
- package/src/katex.less +15 -0
- package/src/macros.js +144 -27
- package/src/mathMLTree.js +1 -1
- package/src/parseNode.js +20 -1
- package/src/stretchy.js +3 -1
- package/src/symbols.js +15 -15
package/dist/katex.mjs
CHANGED
|
@@ -3746,13 +3746,13 @@ function getCharacterMetrics(character, font, mode) {
|
|
|
3746
3746
|
}
|
|
3747
3747
|
|
|
3748
3748
|
let ch = character.charCodeAt(0);
|
|
3749
|
+
let metrics = metricMap[font][ch];
|
|
3749
3750
|
|
|
3750
|
-
if (character[0] in extraCharacterMap) {
|
|
3751
|
+
if (!metrics && character[0] in extraCharacterMap) {
|
|
3751
3752
|
ch = extraCharacterMap[character[0]].charCodeAt(0);
|
|
3753
|
+
metrics = metricMap[font][ch];
|
|
3752
3754
|
}
|
|
3753
3755
|
|
|
3754
|
-
let metrics = metricMap[font][ch];
|
|
3755
|
-
|
|
3756
3756
|
if (!metrics && mode === 'text') {
|
|
3757
3757
|
// We don't typically have font metrics for Asian scripts.
|
|
3758
3758
|
// But since we support them in text mode, we need to return
|
|
@@ -3984,12 +3984,13 @@ defineSymbol(math, main, rel, "\u21c1", "\\rightharpoondown", true);
|
|
|
3984
3984
|
defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true);
|
|
3985
3985
|
defineSymbol(math, main, rel, "\u21cc", "\\rightleftharpoons", true); // AMS Negated Binary Relations
|
|
3986
3986
|
|
|
3987
|
-
defineSymbol(math, ams, rel, "\u226e", "\\nless", true);
|
|
3988
|
-
|
|
3989
|
-
defineSymbol(math, ams, rel, "\
|
|
3987
|
+
defineSymbol(math, ams, rel, "\u226e", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro.
|
|
3988
|
+
|
|
3989
|
+
defineSymbol(math, ams, rel, "\ue010", "\\@nleqslant");
|
|
3990
|
+
defineSymbol(math, ams, rel, "\ue011", "\\@nleqq");
|
|
3990
3991
|
defineSymbol(math, ams, rel, "\u2a87", "\\lneq", true);
|
|
3991
3992
|
defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true);
|
|
3992
|
-
defineSymbol(math, ams, rel, "\ue00c", "
|
|
3993
|
+
defineSymbol(math, ams, rel, "\ue00c", "\\@lvertneqq");
|
|
3993
3994
|
defineSymbol(math, ams, rel, "\u22e6", "\\lnsim", true);
|
|
3994
3995
|
defineSymbol(math, ams, rel, "\u2a89", "\\lnapprox", true);
|
|
3995
3996
|
defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym.
|
|
@@ -3998,22 +3999,22 @@ defineSymbol(math, ams, rel, "\u22e0", "\\npreceq", true);
|
|
|
3998
3999
|
defineSymbol(math, ams, rel, "\u22e8", "\\precnsim", true);
|
|
3999
4000
|
defineSymbol(math, ams, rel, "\u2ab9", "\\precnapprox", true);
|
|
4000
4001
|
defineSymbol(math, ams, rel, "\u2241", "\\nsim", true);
|
|
4001
|
-
defineSymbol(math, ams, rel, "\ue006", "
|
|
4002
|
+
defineSymbol(math, ams, rel, "\ue006", "\\@nshortmid");
|
|
4002
4003
|
defineSymbol(math, ams, rel, "\u2224", "\\nmid", true);
|
|
4003
4004
|
defineSymbol(math, ams, rel, "\u22ac", "\\nvdash", true);
|
|
4004
4005
|
defineSymbol(math, ams, rel, "\u22ad", "\\nvDash", true);
|
|
4005
4006
|
defineSymbol(math, ams, rel, "\u22ea", "\\ntriangleleft");
|
|
4006
4007
|
defineSymbol(math, ams, rel, "\u22ec", "\\ntrianglelefteq", true);
|
|
4007
4008
|
defineSymbol(math, ams, rel, "\u228a", "\\subsetneq", true);
|
|
4008
|
-
defineSymbol(math, ams, rel, "\ue01a", "
|
|
4009
|
+
defineSymbol(math, ams, rel, "\ue01a", "\\@varsubsetneq");
|
|
4009
4010
|
defineSymbol(math, ams, rel, "\u2acb", "\\subsetneqq", true);
|
|
4010
|
-
defineSymbol(math, ams, rel, "\ue017", "
|
|
4011
|
+
defineSymbol(math, ams, rel, "\ue017", "\\@varsubsetneqq");
|
|
4011
4012
|
defineSymbol(math, ams, rel, "\u226f", "\\ngtr", true);
|
|
4012
|
-
defineSymbol(math, ams, rel, "\ue00f", "
|
|
4013
|
-
defineSymbol(math, ams, rel, "\ue00e", "
|
|
4013
|
+
defineSymbol(math, ams, rel, "\ue00f", "\\@ngeqslant");
|
|
4014
|
+
defineSymbol(math, ams, rel, "\ue00e", "\\@ngeqq");
|
|
4014
4015
|
defineSymbol(math, ams, rel, "\u2a88", "\\gneq", true);
|
|
4015
4016
|
defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true);
|
|
4016
|
-
defineSymbol(math, ams, rel, "\ue00d", "
|
|
4017
|
+
defineSymbol(math, ams, rel, "\ue00d", "\\@gvertneqq");
|
|
4017
4018
|
defineSymbol(math, ams, rel, "\u22e7", "\\gnsim", true);
|
|
4018
4019
|
defineSymbol(math, ams, rel, "\u2a8a", "\\gnapprox", true);
|
|
4019
4020
|
defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym.
|
|
@@ -4023,20 +4024,20 @@ defineSymbol(math, ams, rel, "\u22e9", "\\succnsim", true);
|
|
|
4023
4024
|
defineSymbol(math, ams, rel, "\u2aba", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym.
|
|
4024
4025
|
|
|
4025
4026
|
defineSymbol(math, ams, rel, "\u2246", "\\ncong", true);
|
|
4026
|
-
defineSymbol(math, ams, rel, "\ue007", "
|
|
4027
|
+
defineSymbol(math, ams, rel, "\ue007", "\\@nshortparallel");
|
|
4027
4028
|
defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true);
|
|
4028
4029
|
defineSymbol(math, ams, rel, "\u22af", "\\nVDash", true);
|
|
4029
4030
|
defineSymbol(math, ams, rel, "\u22eb", "\\ntriangleright");
|
|
4030
4031
|
defineSymbol(math, ams, rel, "\u22ed", "\\ntrianglerighteq", true);
|
|
4031
|
-
defineSymbol(math, ams, rel, "\ue018", "
|
|
4032
|
+
defineSymbol(math, ams, rel, "\ue018", "\\@nsupseteqq");
|
|
4032
4033
|
defineSymbol(math, ams, rel, "\u228b", "\\supsetneq", true);
|
|
4033
|
-
defineSymbol(math, ams, rel, "\ue01b", "
|
|
4034
|
+
defineSymbol(math, ams, rel, "\ue01b", "\\@varsupsetneq");
|
|
4034
4035
|
defineSymbol(math, ams, rel, "\u2acc", "\\supsetneqq", true);
|
|
4035
|
-
defineSymbol(math, ams, rel, "\ue019", "
|
|
4036
|
+
defineSymbol(math, ams, rel, "\ue019", "\\@varsupsetneqq");
|
|
4036
4037
|
defineSymbol(math, ams, rel, "\u22ae", "\\nVdash", true);
|
|
4037
4038
|
defineSymbol(math, ams, rel, "\u2ab5", "\\precneqq", true);
|
|
4038
4039
|
defineSymbol(math, ams, rel, "\u2ab6", "\\succneqq", true);
|
|
4039
|
-
defineSymbol(math, ams, rel, "\ue016", "
|
|
4040
|
+
defineSymbol(math, ams, rel, "\ue016", "\\@nsubseteqq");
|
|
4040
4041
|
defineSymbol(math, ams, bin, "\u22b4", "\\unlhd");
|
|
4041
4042
|
defineSymbol(math, ams, bin, "\u22b5", "\\unrhd"); // AMS Negated Arrows
|
|
4042
4043
|
|
|
@@ -4059,7 +4060,6 @@ defineSymbol(math, ams, textord, "\u2204", "\\nexists");
|
|
|
4059
4060
|
defineSymbol(math, ams, textord, "\u2127", "\\mho");
|
|
4060
4061
|
defineSymbol(math, ams, textord, "\u2132", "\\Finv", true);
|
|
4061
4062
|
defineSymbol(math, ams, textord, "\u2141", "\\Game", true);
|
|
4062
|
-
defineSymbol(math, ams, textord, "\u006b", "\\Bbbk");
|
|
4063
4063
|
defineSymbol(math, ams, textord, "\u2035", "\\backprime");
|
|
4064
4064
|
defineSymbol(math, ams, textord, "\u25b2", "\\blacktriangle");
|
|
4065
4065
|
defineSymbol(math, ams, textord, "\u25bc", "\\blacktriangledown");
|
|
@@ -4793,7 +4793,8 @@ const sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size index
|
|
|
4793
4793
|
|
|
4794
4794
|
const sizeAtStyle = function sizeAtStyle(size, style) {
|
|
4795
4795
|
return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];
|
|
4796
|
-
};
|
|
4796
|
+
}; // In these types, "" (empty string) means "no change".
|
|
4797
|
+
|
|
4797
4798
|
|
|
4798
4799
|
/**
|
|
4799
4800
|
* This is the main options class. It contains the current style, size, color,
|
|
@@ -5061,20 +5062,13 @@ class Options {
|
|
|
5061
5062
|
return this._fontMetrics;
|
|
5062
5063
|
}
|
|
5063
5064
|
/**
|
|
5064
|
-
*
|
|
5065
|
-
* TODO(emily): Remove this when we have real macros
|
|
5065
|
+
* Gets the CSS color of the current options object
|
|
5066
5066
|
*/
|
|
5067
5067
|
|
|
5068
5068
|
|
|
5069
|
-
/**
|
|
5070
|
-
* Gets the CSS color of the current options object, accounting for the
|
|
5071
|
-
* `colorMap`.
|
|
5072
|
-
*/
|
|
5073
5069
|
getColor() {
|
|
5074
5070
|
if (this.phantom) {
|
|
5075
5071
|
return "transparent";
|
|
5076
|
-
} else if (this.color != null && Options.colorMap.hasOwnProperty(this.color)) {
|
|
5077
|
-
return Options.colorMap[this.color];
|
|
5078
5072
|
} else {
|
|
5079
5073
|
return this.color;
|
|
5080
5074
|
}
|
|
@@ -5083,64 +5077,6 @@ class Options {
|
|
|
5083
5077
|
}
|
|
5084
5078
|
|
|
5085
5079
|
Options.BASESIZE = 6;
|
|
5086
|
-
Options.colorMap = {
|
|
5087
|
-
"katex-blue": "#6495ed",
|
|
5088
|
-
"katex-orange": "#ffa500",
|
|
5089
|
-
"katex-pink": "#ff00af",
|
|
5090
|
-
"katex-red": "#df0030",
|
|
5091
|
-
"katex-green": "#28ae7b",
|
|
5092
|
-
"katex-gray": "gray",
|
|
5093
|
-
"katex-purple": "#9d38bd",
|
|
5094
|
-
"katex-blueA": "#ccfaff",
|
|
5095
|
-
"katex-blueB": "#80f6ff",
|
|
5096
|
-
"katex-blueC": "#63d9ea",
|
|
5097
|
-
"katex-blueD": "#11accd",
|
|
5098
|
-
"katex-blueE": "#0c7f99",
|
|
5099
|
-
"katex-tealA": "#94fff5",
|
|
5100
|
-
"katex-tealB": "#26edd5",
|
|
5101
|
-
"katex-tealC": "#01d1c1",
|
|
5102
|
-
"katex-tealD": "#01a995",
|
|
5103
|
-
"katex-tealE": "#208170",
|
|
5104
|
-
"katex-greenA": "#b6ffb0",
|
|
5105
|
-
"katex-greenB": "#8af281",
|
|
5106
|
-
"katex-greenC": "#74cf70",
|
|
5107
|
-
"katex-greenD": "#1fab54",
|
|
5108
|
-
"katex-greenE": "#0d923f",
|
|
5109
|
-
"katex-goldA": "#ffd0a9",
|
|
5110
|
-
"katex-goldB": "#ffbb71",
|
|
5111
|
-
"katex-goldC": "#ff9c39",
|
|
5112
|
-
"katex-goldD": "#e07d10",
|
|
5113
|
-
"katex-goldE": "#a75a05",
|
|
5114
|
-
"katex-redA": "#fca9a9",
|
|
5115
|
-
"katex-redB": "#ff8482",
|
|
5116
|
-
"katex-redC": "#f9685d",
|
|
5117
|
-
"katex-redD": "#e84d39",
|
|
5118
|
-
"katex-redE": "#bc2612",
|
|
5119
|
-
"katex-maroonA": "#ffbde0",
|
|
5120
|
-
"katex-maroonB": "#ff92c6",
|
|
5121
|
-
"katex-maroonC": "#ed5fa6",
|
|
5122
|
-
"katex-maroonD": "#ca337c",
|
|
5123
|
-
"katex-maroonE": "#9e034e",
|
|
5124
|
-
"katex-purpleA": "#ddd7ff",
|
|
5125
|
-
"katex-purpleB": "#c6b9fc",
|
|
5126
|
-
"katex-purpleC": "#aa87ff",
|
|
5127
|
-
"katex-purpleD": "#7854ab",
|
|
5128
|
-
"katex-purpleE": "#543b78",
|
|
5129
|
-
"katex-mintA": "#f5f9e8",
|
|
5130
|
-
"katex-mintB": "#edf2df",
|
|
5131
|
-
"katex-mintC": "#e0e5cc",
|
|
5132
|
-
"katex-grayA": "#f6f7f7",
|
|
5133
|
-
"katex-grayB": "#f0f1f2",
|
|
5134
|
-
"katex-grayC": "#e3e5e6",
|
|
5135
|
-
"katex-grayD": "#d6d8da",
|
|
5136
|
-
"katex-grayE": "#babec2",
|
|
5137
|
-
"katex-grayF": "#888d93",
|
|
5138
|
-
"katex-grayG": "#626569",
|
|
5139
|
-
"katex-grayH": "#3b3e40",
|
|
5140
|
-
"katex-grayI": "#21242c",
|
|
5141
|
-
"katex-kaBlue": "#314453",
|
|
5142
|
-
"katex-kaGreen": "#71B307"
|
|
5143
|
-
};
|
|
5144
5080
|
|
|
5145
5081
|
/**
|
|
5146
5082
|
* This file does conversion between units. In particular, it provides
|
|
@@ -6921,13 +6857,24 @@ const buildExpression$1 = function buildExpression(expression, options) {
|
|
|
6921
6857
|
lastGroup.children.push(...group.children);
|
|
6922
6858
|
continue;
|
|
6923
6859
|
}
|
|
6860
|
+
} else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) {
|
|
6861
|
+
const lastChild = lastGroup.children[0];
|
|
6862
|
+
|
|
6863
|
+
if (lastChild instanceof TextNode && lastChild.text === '\u0338' && (group.type === 'mo' || group.type === 'mi' || group.type === 'mn')) {
|
|
6864
|
+
const child = group.children[0];
|
|
6865
|
+
|
|
6866
|
+
if (child instanceof TextNode && child.text.length > 0) {
|
|
6867
|
+
// Overlay with combining character long solidus
|
|
6868
|
+
child.text = child.text.slice(0, 1) + "\u0338" + child.text.slice(1);
|
|
6869
|
+
groups.pop();
|
|
6870
|
+
}
|
|
6871
|
+
}
|
|
6924
6872
|
}
|
|
6925
6873
|
}
|
|
6926
6874
|
|
|
6927
6875
|
groups.push(group);
|
|
6928
6876
|
lastGroup = group;
|
|
6929
|
-
}
|
|
6930
|
-
|
|
6877
|
+
}
|
|
6931
6878
|
|
|
6932
6879
|
return groups;
|
|
6933
6880
|
};
|
|
@@ -7046,8 +6993,10 @@ const stretchyCodePoint = {
|
|
|
7046
6993
|
overrightarrow: "\u2192",
|
|
7047
6994
|
underrightarrow: "\u2192",
|
|
7048
6995
|
xrightarrow: "\u2192",
|
|
7049
|
-
underbrace: "\
|
|
6996
|
+
underbrace: "\u23df",
|
|
7050
6997
|
overbrace: "\u23de",
|
|
6998
|
+
overgroup: "\u23e0",
|
|
6999
|
+
undergroup: "\u23e1",
|
|
7051
7000
|
overleftrightarrow: "\u2194",
|
|
7052
7001
|
underleftrightarrow: "\u2194",
|
|
7053
7002
|
xleftrightarrow: "\u2194",
|
|
@@ -7626,7 +7575,15 @@ defineFunction({
|
|
|
7626
7575
|
}
|
|
7627
7576
|
});
|
|
7628
7577
|
|
|
7629
|
-
//
|
|
7578
|
+
// Helper function
|
|
7579
|
+
const paddedNode = group => {
|
|
7580
|
+
const node = new mathMLTree.MathNode("mpadded", group ? [group] : []);
|
|
7581
|
+
node.setAttribute("width", "+0.6em");
|
|
7582
|
+
node.setAttribute("lspace", "0.3em");
|
|
7583
|
+
return node;
|
|
7584
|
+
}; // Stretchy arrows with an optional argument
|
|
7585
|
+
|
|
7586
|
+
|
|
7630
7587
|
defineFunction({
|
|
7631
7588
|
type: "xArrow",
|
|
7632
7589
|
names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension.
|
|
@@ -7724,22 +7681,24 @@ defineFunction({
|
|
|
7724
7681
|
mathmlBuilder(group, options) {
|
|
7725
7682
|
const arrowNode = stretchy.mathMLnode(group.label);
|
|
7726
7683
|
let node;
|
|
7727
|
-
let lowerNode;
|
|
7728
7684
|
|
|
7729
7685
|
if (group.body) {
|
|
7730
|
-
const upperNode = buildGroup$1(group.body, options);
|
|
7686
|
+
const upperNode = paddedNode(buildGroup$1(group.body, options));
|
|
7731
7687
|
|
|
7732
7688
|
if (group.below) {
|
|
7733
|
-
lowerNode = buildGroup$1(group.below, options);
|
|
7689
|
+
const lowerNode = paddedNode(buildGroup$1(group.below, options));
|
|
7734
7690
|
node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]);
|
|
7735
7691
|
} else {
|
|
7736
7692
|
node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]);
|
|
7737
7693
|
}
|
|
7738
7694
|
} else if (group.below) {
|
|
7739
|
-
lowerNode = buildGroup$1(group.below, options);
|
|
7695
|
+
const lowerNode = paddedNode(buildGroup$1(group.below, options));
|
|
7740
7696
|
node = new mathMLTree.MathNode("munder", [arrowNode, lowerNode]);
|
|
7741
7697
|
} else {
|
|
7742
|
-
|
|
7698
|
+
// This should never happen.
|
|
7699
|
+
// Parser.js throws an error if there is no argument.
|
|
7700
|
+
node = paddedNode();
|
|
7701
|
+
node = new mathMLTree.MathNode("mover", [arrowNode, node]);
|
|
7743
7702
|
}
|
|
7744
7703
|
|
|
7745
7704
|
return node;
|
|
@@ -7794,7 +7753,7 @@ const htmlBuilder$1 = (group, options) => {
|
|
|
7794
7753
|
};
|
|
7795
7754
|
|
|
7796
7755
|
const mathmlBuilder$1 = (group, options) => {
|
|
7797
|
-
const inner = buildExpression$1(group.body, options);
|
|
7756
|
+
const inner = buildExpression$1(group.body, options.withColor(group.color));
|
|
7798
7757
|
const node = new mathMLTree.MathNode("mstyle", inner);
|
|
7799
7758
|
node.setAttribute("mathcolor", group.color);
|
|
7800
7759
|
return node;
|
|
@@ -7822,31 +7781,6 @@ defineFunction({
|
|
|
7822
7781
|
};
|
|
7823
7782
|
},
|
|
7824
7783
|
|
|
7825
|
-
htmlBuilder: htmlBuilder$1,
|
|
7826
|
-
mathmlBuilder: mathmlBuilder$1
|
|
7827
|
-
}); // TODO(kevinb): define these using macros
|
|
7828
|
-
|
|
7829
|
-
defineFunction({
|
|
7830
|
-
type: "color",
|
|
7831
|
-
names: ["\\blue", "\\orange", "\\pink", "\\red", "\\green", "\\gray", "\\purple", "\\blueA", "\\blueB", "\\blueC", "\\blueD", "\\blueE", "\\tealA", "\\tealB", "\\tealC", "\\tealD", "\\tealE", "\\greenA", "\\greenB", "\\greenC", "\\greenD", "\\greenE", "\\goldA", "\\goldB", "\\goldC", "\\goldD", "\\goldE", "\\redA", "\\redB", "\\redC", "\\redD", "\\redE", "\\maroonA", "\\maroonB", "\\maroonC", "\\maroonD", "\\maroonE", "\\purpleA", "\\purpleB", "\\purpleC", "\\purpleD", "\\purpleE", "\\mintA", "\\mintB", "\\mintC", "\\grayA", "\\grayB", "\\grayC", "\\grayD", "\\grayE", "\\grayF", "\\grayG", "\\grayH", "\\grayI", "\\kaBlue", "\\kaGreen"],
|
|
7832
|
-
props: {
|
|
7833
|
-
numArgs: 1,
|
|
7834
|
-
allowedInText: true,
|
|
7835
|
-
greediness: 3
|
|
7836
|
-
},
|
|
7837
|
-
|
|
7838
|
-
handler(_ref2, args) {
|
|
7839
|
-
let parser = _ref2.parser,
|
|
7840
|
-
funcName = _ref2.funcName;
|
|
7841
|
-
const body = args[0];
|
|
7842
|
-
return {
|
|
7843
|
-
type: "color",
|
|
7844
|
-
mode: parser.mode,
|
|
7845
|
-
color: "katex-" + funcName.slice(1),
|
|
7846
|
-
body: ordargument(body)
|
|
7847
|
-
};
|
|
7848
|
-
},
|
|
7849
|
-
|
|
7850
7784
|
htmlBuilder: htmlBuilder$1,
|
|
7851
7785
|
mathmlBuilder: mathmlBuilder$1
|
|
7852
7786
|
});
|
|
@@ -7860,9 +7794,9 @@ defineFunction({
|
|
|
7860
7794
|
argTypes: ["color"]
|
|
7861
7795
|
},
|
|
7862
7796
|
|
|
7863
|
-
handler(
|
|
7864
|
-
let parser =
|
|
7865
|
-
breakOnTokenText =
|
|
7797
|
+
handler(_ref2, args) {
|
|
7798
|
+
let parser = _ref2.parser,
|
|
7799
|
+
breakOnTokenText = _ref2.breakOnTokenText;
|
|
7866
7800
|
const color = assertNodeType(args[0], "color-token").color; // If we see a styling function, parse out the implicit body
|
|
7867
7801
|
|
|
7868
7802
|
const body = parser.parseExpression(true, breakOnTokenText);
|
|
@@ -8896,8 +8830,17 @@ defineFunction({
|
|
|
8896
8830
|
return middleDelim;
|
|
8897
8831
|
},
|
|
8898
8832
|
mathmlBuilder: (group, options) => {
|
|
8899
|
-
|
|
8900
|
-
|
|
8833
|
+
// A Firefox \middle will strech a character vertically only if it
|
|
8834
|
+
// is in the fence part of the operator dictionary at:
|
|
8835
|
+
// https://www.w3.org/TR/MathML3/appendixc.html.
|
|
8836
|
+
// So we need to avoid U+2223 and use plain "|" instead.
|
|
8837
|
+
const textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode);
|
|
8838
|
+
const middleNode = new mathMLTree.MathNode("mo", [textNode]);
|
|
8839
|
+
middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each <mo> element.
|
|
8840
|
+
// \middle should get delimiter spacing instead.
|
|
8841
|
+
|
|
8842
|
+
middleNode.setAttribute("lspace", "0.05em");
|
|
8843
|
+
middleNode.setAttribute("rspace", "0.05em");
|
|
8901
8844
|
return middleNode;
|
|
8902
8845
|
}
|
|
8903
8846
|
});
|
|
@@ -9003,7 +8946,7 @@ const htmlBuilder$2 = (group, options) => {
|
|
|
9003
8946
|
};
|
|
9004
8947
|
|
|
9005
8948
|
const mathmlBuilder$2 = (group, options) => {
|
|
9006
|
-
const node = new mathMLTree.MathNode("menclose", [buildGroup$1(group.body, options)]);
|
|
8949
|
+
const node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup$1(group.body, options)]);
|
|
9007
8950
|
|
|
9008
8951
|
switch (group.label) {
|
|
9009
8952
|
case "\\cancel":
|
|
@@ -9023,8 +8966,20 @@ const mathmlBuilder$2 = (group, options) => {
|
|
|
9023
8966
|
break;
|
|
9024
8967
|
|
|
9025
8968
|
case "\\fcolorbox":
|
|
9026
|
-
|
|
9027
|
-
|
|
8969
|
+
case "\\colorbox":
|
|
8970
|
+
// <menclose> doesn't have a good notation option. So use <mpadded>
|
|
8971
|
+
// instead. Set some attributes that come included with <menclose>.
|
|
8972
|
+
node.setAttribute("width", "+6pt");
|
|
8973
|
+
node.setAttribute("height", "+6pt");
|
|
8974
|
+
node.setAttribute("lspace", "3pt"); // LaTeX source2e: \fboxsep = 3pt
|
|
8975
|
+
|
|
8976
|
+
node.setAttribute("voffset", "3pt");
|
|
8977
|
+
|
|
8978
|
+
if (group.label === "\\fcolorbox") {
|
|
8979
|
+
const thk = options.fontMetrics().defaultRuleThickness;
|
|
8980
|
+
node.setAttribute("style", "border: " + thk + "em solid " + String(group.borderColor));
|
|
8981
|
+
}
|
|
8982
|
+
|
|
9028
8983
|
break;
|
|
9029
8984
|
|
|
9030
8985
|
case "\\xcancel":
|
|
@@ -9206,7 +9161,8 @@ function parseArray(parser, _ref, style) {
|
|
|
9206
9161
|
let hskipBeforeAndAfter = _ref.hskipBeforeAndAfter,
|
|
9207
9162
|
addJot = _ref.addJot,
|
|
9208
9163
|
cols = _ref.cols,
|
|
9209
|
-
arraystretch = _ref.arraystretch
|
|
9164
|
+
arraystretch = _ref.arraystretch,
|
|
9165
|
+
colSeparationType = _ref.colSeparationType;
|
|
9210
9166
|
// Parse body of array with \\ temporarily mapped to \cr
|
|
9211
9167
|
parser.gullet.beginGroup();
|
|
9212
9168
|
parser.gullet.macros.set("\\\\", "\\cr"); // Get current arraystretch if it's not set by the environment
|
|
@@ -9291,7 +9247,8 @@ function parseArray(parser, _ref, style) {
|
|
|
9291
9247
|
cols,
|
|
9292
9248
|
rowGaps,
|
|
9293
9249
|
hskipBeforeAndAfter,
|
|
9294
|
-
hLinesBeforeRow
|
|
9250
|
+
hLinesBeforeRow,
|
|
9251
|
+
colSeparationType
|
|
9295
9252
|
};
|
|
9296
9253
|
} // Decides on a style for cells in an array according to whether the given
|
|
9297
9254
|
// environment name starts with the letter 'd'.
|
|
@@ -9540,12 +9497,117 @@ const htmlBuilder$3 = function htmlBuilder(group, options) {
|
|
|
9540
9497
|
return buildCommon.makeSpan(["mord"], [body], options);
|
|
9541
9498
|
};
|
|
9542
9499
|
|
|
9500
|
+
const alignMap = {
|
|
9501
|
+
c: "center ",
|
|
9502
|
+
l: "left ",
|
|
9503
|
+
r: "right "
|
|
9504
|
+
};
|
|
9505
|
+
|
|
9543
9506
|
const mathmlBuilder$3 = function mathmlBuilder(group, options) {
|
|
9544
|
-
|
|
9507
|
+
const table = new mathMLTree.MathNode("mtable", group.body.map(function (row) {
|
|
9545
9508
|
return new mathMLTree.MathNode("mtr", row.map(function (cell) {
|
|
9546
9509
|
return new mathMLTree.MathNode("mtd", [buildGroup$1(cell, options)]);
|
|
9547
9510
|
}));
|
|
9548
|
-
}));
|
|
9511
|
+
})); // Set column alignment, row spacing, column spacing, and
|
|
9512
|
+
// array lines by setting attributes on the table element.
|
|
9513
|
+
// Set the row spacing. In MathML, we specify a gap distance.
|
|
9514
|
+
// We do not use rowGap[] because MathML automatically increases
|
|
9515
|
+
// cell height with the height/depth of the element content.
|
|
9516
|
+
// LaTeX \arraystretch multiplies the row baseline-to-baseline distance.
|
|
9517
|
+
// We simulate this by adding (arraystretch - 1)em to the gap. This
|
|
9518
|
+
// does a reasonable job of adjusting arrays containing 1 em tall content.
|
|
9519
|
+
// The 0.16 and 0.09 values are found emprically. They produce an array
|
|
9520
|
+
// similar to LaTeX and in which content does not interfere with \hines.
|
|
9521
|
+
|
|
9522
|
+
const gap = 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
|
|
9523
|
+
table.setAttribute("rowspacing", gap + "em"); // MathML table lines go only between cells.
|
|
9524
|
+
// To place a line on an edge we'll use <menclose>, if necessary.
|
|
9525
|
+
|
|
9526
|
+
let menclose = "";
|
|
9527
|
+
let align = "";
|
|
9528
|
+
|
|
9529
|
+
if (group.cols) {
|
|
9530
|
+
// Find column alignment, column spacing, and vertical lines.
|
|
9531
|
+
const cols = group.cols;
|
|
9532
|
+
let columnLines = "";
|
|
9533
|
+
let prevTypeWasAlign = false;
|
|
9534
|
+
let iStart = 0;
|
|
9535
|
+
let iEnd = cols.length;
|
|
9536
|
+
|
|
9537
|
+
if (cols[0].type === "separator") {
|
|
9538
|
+
menclose += "top ";
|
|
9539
|
+
iStart = 1;
|
|
9540
|
+
}
|
|
9541
|
+
|
|
9542
|
+
if (cols[cols.length - 1].type === "separator") {
|
|
9543
|
+
menclose += "bottom ";
|
|
9544
|
+
iEnd -= 1;
|
|
9545
|
+
}
|
|
9546
|
+
|
|
9547
|
+
for (let i = iStart; i < iEnd; i++) {
|
|
9548
|
+
if (cols[i].type === "align") {
|
|
9549
|
+
align += alignMap[cols[i].align];
|
|
9550
|
+
|
|
9551
|
+
if (prevTypeWasAlign) {
|
|
9552
|
+
columnLines += "none ";
|
|
9553
|
+
}
|
|
9554
|
+
|
|
9555
|
+
prevTypeWasAlign = true;
|
|
9556
|
+
} else if (cols[i].type === "separator") {
|
|
9557
|
+
// MathML accepts only single lines between cells.
|
|
9558
|
+
// So we read only the first of consecutive separators.
|
|
9559
|
+
if (prevTypeWasAlign) {
|
|
9560
|
+
columnLines += cols[i].separator === "|" ? "solid " : "dashed ";
|
|
9561
|
+
prevTypeWasAlign = false;
|
|
9562
|
+
}
|
|
9563
|
+
}
|
|
9564
|
+
}
|
|
9565
|
+
|
|
9566
|
+
table.setAttribute("columnalign", align.trim());
|
|
9567
|
+
|
|
9568
|
+
if (/[sd]/.test(columnLines)) {
|
|
9569
|
+
table.setAttribute("columnlines", columnLines.trim());
|
|
9570
|
+
}
|
|
9571
|
+
} // Set column spacing.
|
|
9572
|
+
|
|
9573
|
+
|
|
9574
|
+
if (group.colSeparationType === "align") {
|
|
9575
|
+
const cols = group.cols || [];
|
|
9576
|
+
let spacing = "";
|
|
9577
|
+
|
|
9578
|
+
for (let i = 1; i < cols.length; i++) {
|
|
9579
|
+
spacing += i % 2 ? "0em " : "1em ";
|
|
9580
|
+
}
|
|
9581
|
+
|
|
9582
|
+
table.setAttribute("columnspacing", spacing.trim());
|
|
9583
|
+
} else if (group.colSeparationType === "alignat") {
|
|
9584
|
+
table.setAttribute("columnspacing", "0em");
|
|
9585
|
+
} else {
|
|
9586
|
+
table.setAttribute("columnspacing", "1em");
|
|
9587
|
+
} // Address \hline and \hdashline
|
|
9588
|
+
|
|
9589
|
+
|
|
9590
|
+
let rowLines = "";
|
|
9591
|
+
const hlines = group.hLinesBeforeRow;
|
|
9592
|
+
menclose += hlines[0].length > 0 ? "left " : "";
|
|
9593
|
+
menclose += hlines[hlines.length - 1].length > 0 ? "right " : "";
|
|
9594
|
+
|
|
9595
|
+
for (let i = 1; i < hlines.length - 1; i++) {
|
|
9596
|
+
rowLines += hlines[i].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element.
|
|
9597
|
+
: hlines[i][0] ? "dashed " : "solid ";
|
|
9598
|
+
}
|
|
9599
|
+
|
|
9600
|
+
if (/[sd]/.test(rowLines)) {
|
|
9601
|
+
table.setAttribute("rowlines", rowLines.trim());
|
|
9602
|
+
}
|
|
9603
|
+
|
|
9604
|
+
if (menclose === "") {
|
|
9605
|
+
return table;
|
|
9606
|
+
} else {
|
|
9607
|
+
const wrapper = new mathMLTree.MathNode("menclose", [table]);
|
|
9608
|
+
wrapper.setAttribute("notation", menclose.trim());
|
|
9609
|
+
return wrapper;
|
|
9610
|
+
}
|
|
9549
9611
|
}; // Convenience function for aligned and alignedat environments.
|
|
9550
9612
|
|
|
9551
9613
|
|
|
@@ -9628,6 +9690,7 @@ const alignedHandler = function alignedHandler(context, args) {
|
|
|
9628
9690
|
};
|
|
9629
9691
|
}
|
|
9630
9692
|
|
|
9693
|
+
res.colSeparationType = isAligned ? "align" : "alignat";
|
|
9631
9694
|
return res;
|
|
9632
9695
|
}; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation
|
|
9633
9696
|
// is part of the source2e.pdf file of LaTeX2e source documentation.
|
|
@@ -9999,6 +10062,7 @@ defineFunction({
|
|
|
9999
10062
|
mode: baseArg.mode,
|
|
10000
10063
|
limits: true,
|
|
10001
10064
|
alwaysHandleSupSub: true,
|
|
10065
|
+
parentIsSupSub: false,
|
|
10002
10066
|
symbol: false,
|
|
10003
10067
|
suppressBaseShift: funcName !== "\\stackrel",
|
|
10004
10068
|
body: ordargument(baseArg)
|
|
@@ -10127,23 +10191,30 @@ defineFunction({
|
|
|
10127
10191
|
mathmlBuilder: mathmlBuilder$5
|
|
10128
10192
|
});
|
|
10129
10193
|
|
|
10130
|
-
const
|
|
10131
|
-
// Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).
|
|
10194
|
+
const adjustStyle = (size, originalStyle) => {
|
|
10132
10195
|
// Figure out what style this fraction should be in based on the
|
|
10133
10196
|
// function used
|
|
10134
|
-
let style =
|
|
10197
|
+
let style = originalStyle;
|
|
10135
10198
|
|
|
10136
|
-
if (
|
|
10137
|
-
style
|
|
10138
|
-
|
|
10199
|
+
if (size === "display") {
|
|
10200
|
+
// Get display style as a default.
|
|
10201
|
+
// If incoming style is sub/sup, use style.text() to get correct size.
|
|
10202
|
+
style = style.id >= Style$1.SCRIPT.id ? style.text() : Style$1.DISPLAY;
|
|
10203
|
+
} else if (size === "text" && style.size === Style$1.DISPLAY.size) {
|
|
10139
10204
|
// We're in a \tfrac but incoming style is displaystyle, so:
|
|
10140
10205
|
style = Style$1.TEXT;
|
|
10141
|
-
} else if (
|
|
10206
|
+
} else if (size === "script") {
|
|
10142
10207
|
style = Style$1.SCRIPT;
|
|
10143
|
-
} else if (
|
|
10208
|
+
} else if (size === "scriptscript") {
|
|
10144
10209
|
style = Style$1.SCRIPTSCRIPT;
|
|
10145
10210
|
}
|
|
10146
10211
|
|
|
10212
|
+
return style;
|
|
10213
|
+
};
|
|
10214
|
+
|
|
10215
|
+
const htmlBuilder$6 = (group, options) => {
|
|
10216
|
+
// Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).
|
|
10217
|
+
const style = adjustStyle(group.size, options.style);
|
|
10147
10218
|
const nstyle = style.fracNum();
|
|
10148
10219
|
const dstyle = style.fracDen();
|
|
10149
10220
|
let newOptions;
|
|
@@ -10186,7 +10257,7 @@ const htmlBuilder$6 = (group, options) => {
|
|
|
10186
10257
|
let clearance;
|
|
10187
10258
|
let denomShift;
|
|
10188
10259
|
|
|
10189
|
-
if (style.size === Style$1.DISPLAY.size) {
|
|
10260
|
+
if (style.size === Style$1.DISPLAY.size || group.size === "display") {
|
|
10190
10261
|
numShift = options.fontMetrics().num1;
|
|
10191
10262
|
|
|
10192
10263
|
if (ruleWidth > 0) {
|
|
@@ -10297,7 +10368,7 @@ const htmlBuilder$6 = (group, options) => {
|
|
|
10297
10368
|
};
|
|
10298
10369
|
|
|
10299
10370
|
const mathmlBuilder$6 = (group, options) => {
|
|
10300
|
-
|
|
10371
|
+
let node = new mathMLTree.MathNode("mfrac", [buildGroup$1(group.numer, options), buildGroup$1(group.denom, options)]);
|
|
10301
10372
|
|
|
10302
10373
|
if (!group.hasBarLine) {
|
|
10303
10374
|
node.setAttribute("linethickness", "0px");
|
|
@@ -10306,11 +10377,20 @@ const mathmlBuilder$6 = (group, options) => {
|
|
|
10306
10377
|
node.setAttribute("linethickness", ruleWidth + "em");
|
|
10307
10378
|
}
|
|
10308
10379
|
|
|
10380
|
+
const style = adjustStyle(group.size, options.style);
|
|
10381
|
+
|
|
10382
|
+
if (style.size !== options.style.size) {
|
|
10383
|
+
node = new mathMLTree.MathNode("mstyle", [node]);
|
|
10384
|
+
const isDisplay = style.size === Style$1.DISPLAY.size ? "true" : "false";
|
|
10385
|
+
node.setAttribute("displaystyle", isDisplay);
|
|
10386
|
+
node.setAttribute("scriptlevel", "0");
|
|
10387
|
+
}
|
|
10388
|
+
|
|
10309
10389
|
if (group.leftDelim != null || group.rightDelim != null) {
|
|
10310
10390
|
const withDelims = [];
|
|
10311
10391
|
|
|
10312
10392
|
if (group.leftDelim != null) {
|
|
10313
|
-
const leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim)]);
|
|
10393
|
+
const leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]);
|
|
10314
10394
|
leftOp.setAttribute("fence", "true");
|
|
10315
10395
|
withDelims.push(leftOp);
|
|
10316
10396
|
}
|
|
@@ -10318,7 +10398,7 @@ const mathmlBuilder$6 = (group, options) => {
|
|
|
10318
10398
|
withDelims.push(node);
|
|
10319
10399
|
|
|
10320
10400
|
if (group.rightDelim != null) {
|
|
10321
|
-
const rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim)]);
|
|
10401
|
+
const rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]);
|
|
10322
10402
|
rightOp.setAttribute("fence", "true");
|
|
10323
10403
|
withDelims.push(rightOp);
|
|
10324
10404
|
}
|
|
@@ -11057,7 +11137,10 @@ defineFunction({
|
|
|
11057
11137
|
});
|
|
11058
11138
|
|
|
11059
11139
|
// Limits, symbols
|
|
11060
|
-
//
|
|
11140
|
+
// Most operators have a large successor symbol, but these don't.
|
|
11141
|
+
const noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
|
|
11142
|
+
// "supsub" since some of them (like \int) can affect super/subscripting.
|
|
11143
|
+
|
|
11061
11144
|
const htmlBuilder$8 = (grp, options) => {
|
|
11062
11145
|
// Operators are handled in the TeXbook pg. 443-444, rule 13(a).
|
|
11063
11146
|
let supGroup;
|
|
@@ -11078,9 +11161,7 @@ const htmlBuilder$8 = (grp, options) => {
|
|
|
11078
11161
|
group = assertNodeType(grp, "op");
|
|
11079
11162
|
}
|
|
11080
11163
|
|
|
11081
|
-
const style = options.style;
|
|
11082
|
-
|
|
11083
|
-
const noSuccessor = ["\\smallint"];
|
|
11164
|
+
const style = options.style;
|
|
11084
11165
|
let large = false;
|
|
11085
11166
|
|
|
11086
11167
|
if (style.size === Style$1.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) {
|
|
@@ -11290,11 +11371,15 @@ const htmlBuilder$8 = (grp, options) => {
|
|
|
11290
11371
|
};
|
|
11291
11372
|
|
|
11292
11373
|
const mathmlBuilder$8 = (group, options) => {
|
|
11293
|
-
let node;
|
|
11374
|
+
let node;
|
|
11294
11375
|
|
|
11295
11376
|
if (group.symbol) {
|
|
11296
11377
|
// This is a symbol. Just add the symbol.
|
|
11297
11378
|
node = new MathNode("mo", [makeText(group.name, group.mode)]);
|
|
11379
|
+
|
|
11380
|
+
if (utils.contains(noSuccessor, group.name)) {
|
|
11381
|
+
node.setAttribute("largeop", "false");
|
|
11382
|
+
}
|
|
11298
11383
|
} else if (group.body) {
|
|
11299
11384
|
// This is an operator with children. Add them.
|
|
11300
11385
|
node = new MathNode("mo", buildExpression$1(group.body, options));
|
|
@@ -11307,7 +11392,12 @@ const mathmlBuilder$8 = (group, options) => {
|
|
|
11307
11392
|
// ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
|
|
11308
11393
|
|
|
11309
11394
|
const operator = new MathNode("mo", [makeText("\u2061", "text")]);
|
|
11310
|
-
|
|
11395
|
+
|
|
11396
|
+
if (group.parentIsSupSub) {
|
|
11397
|
+
node = new MathNode("mo", [node, operator]);
|
|
11398
|
+
} else {
|
|
11399
|
+
node = newDocumentFragment([node, operator]);
|
|
11400
|
+
}
|
|
11311
11401
|
}
|
|
11312
11402
|
|
|
11313
11403
|
return node;
|
|
@@ -11346,6 +11436,7 @@ defineFunction({
|
|
|
11346
11436
|
type: "op",
|
|
11347
11437
|
mode: parser.mode,
|
|
11348
11438
|
limits: true,
|
|
11439
|
+
parentIsSupSub: false,
|
|
11349
11440
|
symbol: true,
|
|
11350
11441
|
name: fName
|
|
11351
11442
|
};
|
|
@@ -11368,6 +11459,7 @@ defineFunction({
|
|
|
11368
11459
|
type: "op",
|
|
11369
11460
|
mode: parser.mode,
|
|
11370
11461
|
limits: false,
|
|
11462
|
+
parentIsSupSub: false,
|
|
11371
11463
|
symbol: false,
|
|
11372
11464
|
body: ordargument(body)
|
|
11373
11465
|
};
|
|
@@ -11401,6 +11493,7 @@ defineFunction({
|
|
|
11401
11493
|
type: "op",
|
|
11402
11494
|
mode: parser.mode,
|
|
11403
11495
|
limits: false,
|
|
11496
|
+
parentIsSupSub: false,
|
|
11404
11497
|
symbol: false,
|
|
11405
11498
|
name: funcName
|
|
11406
11499
|
};
|
|
@@ -11424,6 +11517,7 @@ defineFunction({
|
|
|
11424
11517
|
type: "op",
|
|
11425
11518
|
mode: parser.mode,
|
|
11426
11519
|
limits: true,
|
|
11520
|
+
parentIsSupSub: false,
|
|
11427
11521
|
symbol: false,
|
|
11428
11522
|
name: funcName
|
|
11429
11523
|
};
|
|
@@ -11453,6 +11547,7 @@ defineFunction({
|
|
|
11453
11547
|
type: "op",
|
|
11454
11548
|
mode: parser.mode,
|
|
11455
11549
|
limits: false,
|
|
11550
|
+
parentIsSupSub: false,
|
|
11456
11551
|
symbol: true,
|
|
11457
11552
|
name: fName
|
|
11458
11553
|
};
|
|
@@ -11706,8 +11801,10 @@ defineFunction({
|
|
|
11706
11801
|
},
|
|
11707
11802
|
mathmlBuilder: (group, options) => {
|
|
11708
11803
|
const inner = buildExpression$1(ordargument(group.body), options);
|
|
11709
|
-
const
|
|
11804
|
+
const phantom = new mathMLTree.MathNode("mphantom", inner);
|
|
11805
|
+
const node = new mathMLTree.MathNode("mpadded", [phantom]);
|
|
11710
11806
|
node.setAttribute("height", "0px");
|
|
11807
|
+
node.setAttribute("depth", "0px");
|
|
11711
11808
|
return node;
|
|
11712
11809
|
}
|
|
11713
11810
|
});
|
|
@@ -11734,7 +11831,8 @@ defineFunction({
|
|
|
11734
11831
|
},
|
|
11735
11832
|
mathmlBuilder: (group, options) => {
|
|
11736
11833
|
const inner = buildExpression$1(ordargument(group.body), options);
|
|
11737
|
-
const
|
|
11834
|
+
const phantom = new mathMLTree.MathNode("mphantom", inner);
|
|
11835
|
+
const node = new mathMLTree.MathNode("mpadded", [phantom]);
|
|
11738
11836
|
node.setAttribute("width", "0px");
|
|
11739
11837
|
return node;
|
|
11740
11838
|
}
|
|
@@ -11890,14 +11988,9 @@ defineFunction({
|
|
|
11890
11988
|
// Make an empty span for the rule
|
|
11891
11989
|
const rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units
|
|
11892
11990
|
|
|
11893
|
-
let shift = 0;
|
|
11894
|
-
|
|
11895
|
-
if (group.shift) {
|
|
11896
|
-
shift = calculateSize(group.shift, options);
|
|
11897
|
-
}
|
|
11898
|
-
|
|
11899
11991
|
const width = calculateSize(group.width, options);
|
|
11900
|
-
const height = calculateSize(group.height, options);
|
|
11992
|
+
const height = calculateSize(group.height, options);
|
|
11993
|
+
const shift = group.shift ? calculateSize(group.shift, options) : 0; // Style the rule to the right size
|
|
11901
11994
|
|
|
11902
11995
|
rule.style.borderRightWidth = width + "em";
|
|
11903
11996
|
rule.style.borderTopWidth = height + "em";
|
|
@@ -11914,10 +12007,25 @@ defineFunction({
|
|
|
11914
12007
|
},
|
|
11915
12008
|
|
|
11916
12009
|
mathmlBuilder(group, options) {
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
const
|
|
11920
|
-
|
|
12010
|
+
const width = calculateSize(group.width, options);
|
|
12011
|
+
const height = calculateSize(group.height, options);
|
|
12012
|
+
const shift = group.shift ? calculateSize(group.shift, options) : 0;
|
|
12013
|
+
const color = options.color && options.getColor() || "black";
|
|
12014
|
+
const rule = new mathMLTree.MathNode("mspace");
|
|
12015
|
+
rule.setAttribute("mathbackground", color);
|
|
12016
|
+
rule.setAttribute("width", width + "em");
|
|
12017
|
+
rule.setAttribute("height", height + "em");
|
|
12018
|
+
const wrapper = new mathMLTree.MathNode("mpadded", [rule]);
|
|
12019
|
+
|
|
12020
|
+
if (shift >= 0) {
|
|
12021
|
+
wrapper.setAttribute("height", "+" + shift + "em");
|
|
12022
|
+
} else {
|
|
12023
|
+
wrapper.setAttribute("height", shift + "em");
|
|
12024
|
+
wrapper.setAttribute("depth", "+" + -shift + "em");
|
|
12025
|
+
}
|
|
12026
|
+
|
|
12027
|
+
wrapper.setAttribute("voffset", shift + "em");
|
|
12028
|
+
return wrapper;
|
|
11921
12029
|
}
|
|
11922
12030
|
|
|
11923
12031
|
});
|
|
@@ -12399,6 +12507,10 @@ defineFunctionBuilders({
|
|
|
12399
12507
|
}
|
|
12400
12508
|
}
|
|
12401
12509
|
|
|
12510
|
+
if (group.base && group.base.type === "op") {
|
|
12511
|
+
group.base.parentIsSupSub = true;
|
|
12512
|
+
}
|
|
12513
|
+
|
|
12402
12514
|
const children = [buildGroup$1(group.base, options)];
|
|
12403
12515
|
|
|
12404
12516
|
if (group.sub) {
|
|
@@ -12416,7 +12528,7 @@ defineFunctionBuilders({
|
|
|
12416
12528
|
} else if (!group.sub) {
|
|
12417
12529
|
const base = group.base;
|
|
12418
12530
|
|
|
12419
|
-
if (base && base.type === "op" && base.limits && options.style === Style$1.DISPLAY) {
|
|
12531
|
+
if (base && base.type === "op" && base.limits && (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) {
|
|
12420
12532
|
nodeType = "mover";
|
|
12421
12533
|
} else {
|
|
12422
12534
|
nodeType = "msup";
|
|
@@ -12424,7 +12536,7 @@ defineFunctionBuilders({
|
|
|
12424
12536
|
} else if (!group.sup) {
|
|
12425
12537
|
const base = group.base;
|
|
12426
12538
|
|
|
12427
|
-
if (base && base.type === "op" && base.limits && options.style === Style$1.DISPLAY) {
|
|
12539
|
+
if (base && base.type === "op" && base.limits && (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) {
|
|
12428
12540
|
nodeType = "munder";
|
|
12429
12541
|
} else {
|
|
12430
12542
|
nodeType = "msub";
|
|
@@ -12463,6 +12575,10 @@ defineFunctionBuilders({
|
|
|
12463
12575
|
}
|
|
12464
12576
|
} else if (group.family === "punct") {
|
|
12465
12577
|
node.setAttribute("separator", "true");
|
|
12578
|
+
} else if (group.family === "open" || group.family === "close") {
|
|
12579
|
+
// Delims built here should not stretch vertically.
|
|
12580
|
+
// See delimsizing.js for stretchy delims.
|
|
12581
|
+
node.setAttribute("stretchy", "false");
|
|
12466
12582
|
}
|
|
12467
12583
|
|
|
12468
12584
|
return node;
|
|
@@ -12591,13 +12707,25 @@ defineFunctionBuilders({
|
|
|
12591
12707
|
|
|
12592
12708
|
});
|
|
12593
12709
|
|
|
12710
|
+
const pad = () => {
|
|
12711
|
+
const padNode = new mathMLTree.MathNode("mtd", []);
|
|
12712
|
+
padNode.setAttribute("width", "50%");
|
|
12713
|
+
return padNode;
|
|
12714
|
+
};
|
|
12715
|
+
|
|
12594
12716
|
defineFunctionBuilders({
|
|
12595
12717
|
type: "tag",
|
|
12596
12718
|
|
|
12597
12719
|
mathmlBuilder(group, options) {
|
|
12598
|
-
const table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("
|
|
12599
|
-
table.setAttribute("
|
|
12600
|
-
return table;
|
|
12720
|
+
const table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]);
|
|
12721
|
+
table.setAttribute("width", "100%");
|
|
12722
|
+
return table; // TODO: Left-aligned tags.
|
|
12723
|
+
// Currently, the group and options passed here do not contain
|
|
12724
|
+
// enough info to set tag alignment. `leqno` is in Settings but it is
|
|
12725
|
+
// not passed to Options. On the HTML side, leqno is
|
|
12726
|
+
// set by a CSS class applied in buildTree.js. That would have worked
|
|
12727
|
+
// in MathML if browsers supported <mlabeledtr>. Since they don't, we
|
|
12728
|
+
// need to rewrite the way this function is called.
|
|
12601
12729
|
}
|
|
12602
12730
|
|
|
12603
12731
|
});
|
|
@@ -12610,10 +12738,12 @@ const textFontFamilies = {
|
|
|
12610
12738
|
"\\textnormal": "textrm"
|
|
12611
12739
|
};
|
|
12612
12740
|
const textFontWeights = {
|
|
12613
|
-
"\\textbf": "textbf"
|
|
12741
|
+
"\\textbf": "textbf",
|
|
12742
|
+
"\\textmd": "textmd"
|
|
12614
12743
|
};
|
|
12615
12744
|
const textFontShapes = {
|
|
12616
|
-
"\\textit": "textit"
|
|
12745
|
+
"\\textit": "textit",
|
|
12746
|
+
"\\textup": "textup"
|
|
12617
12747
|
};
|
|
12618
12748
|
|
|
12619
12749
|
const optionsWithFont = (group, options) => {
|
|
@@ -12634,8 +12764,8 @@ defineFunction({
|
|
|
12634
12764
|
type: "text",
|
|
12635
12765
|
names: [// Font families
|
|
12636
12766
|
"\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights
|
|
12637
|
-
"\\textbf", // Font Shapes
|
|
12638
|
-
"\\textit"],
|
|
12767
|
+
"\\textbf", "\\textmd", // Font Shapes
|
|
12768
|
+
"\\textit", "\\textup"],
|
|
12639
12769
|
props: {
|
|
12640
12770
|
numArgs: 1,
|
|
12641
12771
|
argTypes: ["text"],
|
|
@@ -13321,7 +13451,9 @@ defineMacro("\u211B", "\\mathscr{R}");
|
|
|
13321
13451
|
defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur
|
|
13322
13452
|
|
|
13323
13453
|
defineMacro("\u210C", "\\mathfrak{H}");
|
|
13324
|
-
defineMacro("\u2128", "\\mathfrak{Z}"); //
|
|
13454
|
+
defineMacro("\u2128", "\\mathfrak{Z}"); // Define \Bbbk with a macro that works in both HTML and MathML.
|
|
13455
|
+
|
|
13456
|
+
defineMacro("\\Bbbk", "\\Bbb{k}"); // Unicode middle dot
|
|
13325
13457
|
// The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays
|
|
13326
13458
|
// the dot at U+22C5 and gives it punct spacing.
|
|
13327
13459
|
|
|
@@ -13333,8 +13465,9 @@ defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \not is defined by base/fo
|
|
|
13333
13465
|
// \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36}
|
|
13334
13466
|
// It's thus treated like a \mathrel, but defined by a symbol that has zero
|
|
13335
13467
|
// width but extends to the right. We use \rlap to get that spacing.
|
|
13468
|
+
// For MathML we write U+0338 here. buildMathML.js will then do the overlay.
|
|
13336
13469
|
|
|
13337
|
-
defineMacro("\\not", '\\mathrel{\\mathrlap\\@not}'); // Negated symbols from base/fontmath.ltx:
|
|
13470
|
+
defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); // Negated symbols from base/fontmath.ltx:
|
|
13338
13471
|
// \def\neq{\not=} \let\ne=\neq
|
|
13339
13472
|
// \DeclareRobustCommand
|
|
13340
13473
|
// \notin{\mathrel{\m@th\mathpalette\c@ncel\in}}
|
|
@@ -13650,31 +13783,37 @@ defineMacro("\\ordinarycolon", ":"); //\def\vcentcolon{\mathrel{\mathop\ordinary
|
|
|
13650
13783
|
|
|
13651
13784
|
defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon}
|
|
13652
13785
|
|
|
13653
|
-
defineMacro("\\dblcolon", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
|
|
13786
|
+
defineMacro("\\dblcolon", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" + "{\\mathop{\\char\"2237}}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
|
|
13787
|
+
|
|
13788
|
+
defineMacro("\\coloneqq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2254}}"); // ≔
|
|
13789
|
+
// \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=}
|
|
13654
13790
|
|
|
13655
|
-
defineMacro("\\
|
|
13791
|
+
defineMacro("\\Coloneqq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2237\\char\"3d}}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
|
|
13656
13792
|
|
|
13657
|
-
defineMacro("\\
|
|
13793
|
+
defineMacro("\\coloneq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"3a\\char\"2212}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
|
|
13658
13794
|
|
|
13659
|
-
defineMacro("\\
|
|
13795
|
+
defineMacro("\\Coloneq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"2237\\char\"2212}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
|
|
13660
13796
|
|
|
13661
|
-
defineMacro("\\
|
|
13797
|
+
defineMacro("\\eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2255}}"); // ≕
|
|
13798
|
+
// \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
|
|
13662
13799
|
|
|
13663
|
-
defineMacro("\\
|
|
13800
|
+
defineMacro("\\Eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"3d\\char\"2237}}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
|
|
13664
13801
|
|
|
13665
|
-
defineMacro("\\
|
|
13802
|
+
defineMacro("\\eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2239}}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
|
|
13666
13803
|
|
|
13667
|
-
defineMacro("\\
|
|
13804
|
+
defineMacro("\\Eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"2212\\char\"2237}}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
|
|
13668
13805
|
|
|
13669
|
-
defineMacro("\\
|
|
13806
|
+
defineMacro("\\colonapprox", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"3a\\char\"2248}}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
|
|
13670
13807
|
|
|
13671
|
-
defineMacro("\\
|
|
13808
|
+
defineMacro("\\Colonapprox", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"2237\\char\"2248}}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
|
|
13672
13809
|
|
|
13673
|
-
defineMacro("\\
|
|
13810
|
+
defineMacro("\\colonsim", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"3a\\char\"223c}}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}
|
|
13674
13811
|
|
|
13675
|
-
defineMacro("\\
|
|
13812
|
+
defineMacro("\\Colonsim", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"2237\\char\"223c}}"); // Some Unicode characters are implemented with macros to mathtools functions.
|
|
13676
13813
|
|
|
13677
|
-
defineMacro("
|
|
13814
|
+
defineMacro("\u2237", "\\dblcolon"); // ::
|
|
13815
|
+
|
|
13816
|
+
defineMacro("\u2239", "\\eqcolon"); // -:
|
|
13678
13817
|
|
|
13679
13818
|
defineMacro("\u2254", "\\coloneqq"); // :=
|
|
13680
13819
|
|
|
@@ -13708,13 +13847,37 @@ defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\d
|
|
|
13708
13847
|
defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");
|
|
13709
13848
|
defineMacro("\\limsup", "\\DOTSB\\mathop{\\operatorname{lim\\,sup}}\\limits");
|
|
13710
13849
|
defineMacro("\\liminf", "\\DOTSB\\mathop{\\operatorname{lim\\,inf}}\\limits"); //////////////////////////////////////////////////////////////////////
|
|
13711
|
-
//
|
|
13712
|
-
|
|
13713
|
-
|
|
13714
|
-
|
|
13715
|
-
defineMacro("
|
|
13716
|
-
|
|
13717
|
-
defineMacro("
|
|
13850
|
+
// MathML alternates for KaTeX glyphs in the Unicode private area
|
|
13851
|
+
|
|
13852
|
+
defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}");
|
|
13853
|
+
defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}");
|
|
13854
|
+
defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}");
|
|
13855
|
+
defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}");
|
|
13856
|
+
defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}");
|
|
13857
|
+
defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}");
|
|
13858
|
+
defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
|
|
13859
|
+
defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
|
|
13860
|
+
defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}");
|
|
13861
|
+
defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}");
|
|
13862
|
+
defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
|
|
13863
|
+
defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
|
|
13864
|
+
defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
|
|
13865
|
+
defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}"); //////////////////////////////////////////////////////////////////////
|
|
13866
|
+
// stmaryrd and semantic
|
|
13867
|
+
// The stmaryrd and semantic packages render the next four items by calling a
|
|
13868
|
+
// glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros.
|
|
13869
|
+
|
|
13870
|
+
defineMacro("\\llbracket", "\\html@mathml{" + "\\mathopen{[\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u27e6}}");
|
|
13871
|
+
defineMacro("\\rrbracket", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu]}}" + "{\\mathclose{\\char`\u27e7}}");
|
|
13872
|
+
defineMacro("\u27e6", "\\llbracket"); // blackboard bold [
|
|
13873
|
+
|
|
13874
|
+
defineMacro("\u27e7", "\\rrbracket"); // blackboard bold ]
|
|
13875
|
+
|
|
13876
|
+
defineMacro("\\lBrace", "\\html@mathml{" + "\\mathopen{\\{\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u2983}}");
|
|
13877
|
+
defineMacro("\\rBrace", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu\\}}}" + "{\\mathclose{\\char`\u2984}}");
|
|
13878
|
+
defineMacro("\u2983", "\\lBrace"); // blackboard bold {
|
|
13879
|
+
|
|
13880
|
+
defineMacro("\u2984", "\\rBrace"); // blackboard bold }
|
|
13718
13881
|
// TODO: Create variable sized versions of the last two items. I believe that
|
|
13719
13882
|
// will require new font glyphs.
|
|
13720
13883
|
//////////////////////////////////////////////////////////////////////
|
|
@@ -13776,7 +13939,7 @@ defineMacro("\\Rarr", "\\Rightarrow");
|
|
|
13776
13939
|
defineMacro("\\real", "\\Re");
|
|
13777
13940
|
defineMacro("\\reals", "\\mathbb{R}");
|
|
13778
13941
|
defineMacro("\\Reals", "\\mathbb{R}");
|
|
13779
|
-
defineMacro("\\Rho", "\\mathrm{
|
|
13942
|
+
defineMacro("\\Rho", "\\mathrm{P}");
|
|
13780
13943
|
defineMacro("\\sdot", "\\cdot");
|
|
13781
13944
|
defineMacro("\\sect", "\\S");
|
|
13782
13945
|
defineMacro("\\spades", "\\spadesuit");
|
|
@@ -13792,7 +13955,64 @@ defineMacro("\\Zeta", "\\mathrm{Z}"); //////////////////////////////////////////
|
|
|
13792
13955
|
// https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf
|
|
13793
13956
|
|
|
13794
13957
|
defineMacro("\\argmin", "\\DOTSB\\mathop{\\operatorname{arg\\,min}}\\limits");
|
|
13795
|
-
defineMacro("\\argmax", "\\DOTSB\\mathop{\\operatorname{arg\\,max}}\\limits");
|
|
13958
|
+
defineMacro("\\argmax", "\\DOTSB\\mathop{\\operatorname{arg\\,max}}\\limits"); // Custom Khan Academy colors, should be moved to an optional package
|
|
13959
|
+
|
|
13960
|
+
defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
|
|
13961
|
+
defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
|
|
13962
|
+
defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
|
|
13963
|
+
defineMacro("\\red", "\\textcolor{##df0030}{#1}");
|
|
13964
|
+
defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
|
|
13965
|
+
defineMacro("\\gray", "\\textcolor{gray}{##1}");
|
|
13966
|
+
defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
|
|
13967
|
+
defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
|
|
13968
|
+
defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
|
|
13969
|
+
defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
|
|
13970
|
+
defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
|
|
13971
|
+
defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
|
|
13972
|
+
defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
|
|
13973
|
+
defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
|
|
13974
|
+
defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
|
|
13975
|
+
defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
|
|
13976
|
+
defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
|
|
13977
|
+
defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
|
|
13978
|
+
defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
|
|
13979
|
+
defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
|
|
13980
|
+
defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
|
|
13981
|
+
defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
|
|
13982
|
+
defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
|
|
13983
|
+
defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
|
|
13984
|
+
defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
|
|
13985
|
+
defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
|
|
13986
|
+
defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
|
|
13987
|
+
defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
|
|
13988
|
+
defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
|
|
13989
|
+
defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
|
|
13990
|
+
defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
|
|
13991
|
+
defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
|
|
13992
|
+
defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
|
|
13993
|
+
defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
|
|
13994
|
+
defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
|
|
13995
|
+
defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
|
|
13996
|
+
defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
|
|
13997
|
+
defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
|
|
13998
|
+
defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
|
|
13999
|
+
defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
|
|
14000
|
+
defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
|
|
14001
|
+
defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
|
|
14002
|
+
defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
|
|
14003
|
+
defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
|
|
14004
|
+
defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
|
|
14005
|
+
defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
|
|
14006
|
+
defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
|
|
14007
|
+
defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
|
|
14008
|
+
defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
|
|
14009
|
+
defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
|
|
14010
|
+
defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
|
|
14011
|
+
defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
|
|
14012
|
+
defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
|
|
14013
|
+
defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
|
|
14014
|
+
defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
|
|
14015
|
+
defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
|
|
13796
14016
|
|
|
13797
14017
|
/**
|
|
13798
14018
|
* This file contains the “gullet” where macros are expanded
|
|
@@ -16037,7 +16257,7 @@ var katex = {
|
|
|
16037
16257
|
/**
|
|
16038
16258
|
* Current KaTeX version
|
|
16039
16259
|
*/
|
|
16040
|
-
version: "0.10.
|
|
16260
|
+
version: "0.10.2",
|
|
16041
16261
|
|
|
16042
16262
|
/**
|
|
16043
16263
|
* Renders the given LaTeX into an HTML+MathML combination, and adds
|