katex 0.16.1 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/contrib/auto-render/auto-render.js +20 -1
- package/contrib/auto-render/test/auto-render-spec.js +88 -17
- package/contrib/copy-tex/README.md +2 -2
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/contrib/render-a11y-string/render-a11y-string.js +5 -0
- package/dist/README.md +3 -3
- package/dist/contrib/auto-render.js +23 -1
- package/dist/contrib/auto-render.min.js +1 -1
- package/dist/contrib/auto-render.mjs +23 -1
- package/dist/contrib/render-a11y-string.js +6 -0
- package/dist/contrib/render-a11y-string.min.js +1 -1
- package/dist/contrib/render-a11y-string.mjs +6 -0
- package/dist/katex.css +1 -1
- package/dist/katex.js +223 -179
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +264 -221
- package/package.json +1 -1
- package/src/Parser.js +1 -1
- package/src/buildCommon.js +1 -1
- package/src/buildMathML.js +2 -2
- package/src/domTree.js +1 -0
- package/src/environments/array.js +6 -1
- package/src/functions/enclose.js +1 -1
- package/src/functions/mclass.js +1 -1
- package/src/functions/op.js +1 -1
- package/src/functions/pmb.js +44 -0
- package/src/functions.js +1 -0
- package/src/macros.js +1 -9
- package/src/parseNode.js +7 -0
- package/src/stretchy.js +1 -1
package/dist/katex.mjs
CHANGED
|
@@ -5465,7 +5465,7 @@ var makeOrd = function makeOrd(group, options, type) {
|
|
|
5465
5465
|
|
|
5466
5466
|
if (lookupSymbol(text, fontName, mode).metrics) {
|
|
5467
5467
|
return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses));
|
|
5468
|
-
} else if (ligatures.hasOwnProperty(text) && fontName.
|
|
5468
|
+
} else if (ligatures.hasOwnProperty(text) && fontName.slice(0, 10) === "Typewriter") {
|
|
5469
5469
|
// Deconstruct ligatures in monospace fonts (\texttt, \tt).
|
|
5470
5470
|
var parts = [];
|
|
5471
5471
|
|
|
@@ -6799,7 +6799,7 @@ var mathMLTree = {
|
|
|
6799
6799
|
* optional replacement from symbols.js.
|
|
6800
6800
|
*/
|
|
6801
6801
|
var makeText = function makeText(text, mode, options) {
|
|
6802
|
-
if (symbols[mode][text] && symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.
|
|
6802
|
+
if (symbols[mode][text] && symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.slice(4, 6) === "tt" || options.font && options.font.slice(4, 6) === "tt"))) {
|
|
6803
6803
|
text = symbols[mode][text].replace;
|
|
6804
6804
|
}
|
|
6805
6805
|
|
|
@@ -7233,7 +7233,7 @@ var svgSpan = function svgSpan(group, options) {
|
|
|
7233
7233
|
function buildSvgSpan_() {
|
|
7234
7234
|
var viewBoxWidth = 400000; // default
|
|
7235
7235
|
|
|
7236
|
-
var label = group.label.
|
|
7236
|
+
var label = group.label.slice(1);
|
|
7237
7237
|
|
|
7238
7238
|
if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) {
|
|
7239
7239
|
// Each type in the `if` statement corresponds to one of the ParseNode
|
|
@@ -7882,6 +7882,217 @@ defineFunction({
|
|
|
7882
7882
|
|
|
7883
7883
|
});
|
|
7884
7884
|
|
|
7885
|
+
var makeSpan = buildCommon.makeSpan;
|
|
7886
|
+
|
|
7887
|
+
function htmlBuilder$9(group, options) {
|
|
7888
|
+
var elements = buildExpression$1(group.body, options, true);
|
|
7889
|
+
return makeSpan([group.mclass], elements, options);
|
|
7890
|
+
}
|
|
7891
|
+
|
|
7892
|
+
function mathmlBuilder$8(group, options) {
|
|
7893
|
+
var node;
|
|
7894
|
+
var inner = buildExpression(group.body, options);
|
|
7895
|
+
|
|
7896
|
+
if (group.mclass === "minner") {
|
|
7897
|
+
node = new mathMLTree.MathNode("mpadded", inner);
|
|
7898
|
+
} else if (group.mclass === "mord") {
|
|
7899
|
+
if (group.isCharacterBox) {
|
|
7900
|
+
node = inner[0];
|
|
7901
|
+
node.type = "mi";
|
|
7902
|
+
} else {
|
|
7903
|
+
node = new mathMLTree.MathNode("mi", inner);
|
|
7904
|
+
}
|
|
7905
|
+
} else {
|
|
7906
|
+
if (group.isCharacterBox) {
|
|
7907
|
+
node = inner[0];
|
|
7908
|
+
node.type = "mo";
|
|
7909
|
+
} else {
|
|
7910
|
+
node = new mathMLTree.MathNode("mo", inner);
|
|
7911
|
+
} // Set spacing based on what is the most likely adjacent atom type.
|
|
7912
|
+
// See TeXbook p170.
|
|
7913
|
+
|
|
7914
|
+
|
|
7915
|
+
if (group.mclass === "mbin") {
|
|
7916
|
+
node.attributes.lspace = "0.22em"; // medium space
|
|
7917
|
+
|
|
7918
|
+
node.attributes.rspace = "0.22em";
|
|
7919
|
+
} else if (group.mclass === "mpunct") {
|
|
7920
|
+
node.attributes.lspace = "0em";
|
|
7921
|
+
node.attributes.rspace = "0.17em"; // thinspace
|
|
7922
|
+
} else if (group.mclass === "mopen" || group.mclass === "mclose") {
|
|
7923
|
+
node.attributes.lspace = "0em";
|
|
7924
|
+
node.attributes.rspace = "0em";
|
|
7925
|
+
} else if (group.mclass === "minner") {
|
|
7926
|
+
node.attributes.lspace = "0.0556em"; // 1 mu is the most likely option
|
|
7927
|
+
|
|
7928
|
+
node.attributes.width = "+0.1111em";
|
|
7929
|
+
} // MathML <mo> default space is 5/18 em, so <mrel> needs no action.
|
|
7930
|
+
// Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo
|
|
7931
|
+
|
|
7932
|
+
}
|
|
7933
|
+
|
|
7934
|
+
return node;
|
|
7935
|
+
} // Math class commands except \mathop
|
|
7936
|
+
|
|
7937
|
+
|
|
7938
|
+
defineFunction({
|
|
7939
|
+
type: "mclass",
|
|
7940
|
+
names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
|
|
7941
|
+
props: {
|
|
7942
|
+
numArgs: 1,
|
|
7943
|
+
primitive: true
|
|
7944
|
+
},
|
|
7945
|
+
|
|
7946
|
+
handler(_ref, args) {
|
|
7947
|
+
var {
|
|
7948
|
+
parser,
|
|
7949
|
+
funcName
|
|
7950
|
+
} = _ref;
|
|
7951
|
+
var body = args[0];
|
|
7952
|
+
return {
|
|
7953
|
+
type: "mclass",
|
|
7954
|
+
mode: parser.mode,
|
|
7955
|
+
mclass: "m" + funcName.slice(5),
|
|
7956
|
+
// TODO(kevinb): don't prefix with 'm'
|
|
7957
|
+
body: ordargument(body),
|
|
7958
|
+
isCharacterBox: utils.isCharacterBox(body)
|
|
7959
|
+
};
|
|
7960
|
+
},
|
|
7961
|
+
|
|
7962
|
+
htmlBuilder: htmlBuilder$9,
|
|
7963
|
+
mathmlBuilder: mathmlBuilder$8
|
|
7964
|
+
});
|
|
7965
|
+
var binrelClass = arg => {
|
|
7966
|
+
// \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument.
|
|
7967
|
+
// (by rendering separately and with {}s before and after, and measuring
|
|
7968
|
+
// the change in spacing). We'll do roughly the same by detecting the
|
|
7969
|
+
// atom type directly.
|
|
7970
|
+
var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg;
|
|
7971
|
+
|
|
7972
|
+
if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) {
|
|
7973
|
+
return "m" + atom.family;
|
|
7974
|
+
} else {
|
|
7975
|
+
return "mord";
|
|
7976
|
+
}
|
|
7977
|
+
}; // \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord.
|
|
7978
|
+
// This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX.
|
|
7979
|
+
|
|
7980
|
+
defineFunction({
|
|
7981
|
+
type: "mclass",
|
|
7982
|
+
names: ["\\@binrel"],
|
|
7983
|
+
props: {
|
|
7984
|
+
numArgs: 2
|
|
7985
|
+
},
|
|
7986
|
+
|
|
7987
|
+
handler(_ref2, args) {
|
|
7988
|
+
var {
|
|
7989
|
+
parser
|
|
7990
|
+
} = _ref2;
|
|
7991
|
+
return {
|
|
7992
|
+
type: "mclass",
|
|
7993
|
+
mode: parser.mode,
|
|
7994
|
+
mclass: binrelClass(args[0]),
|
|
7995
|
+
body: ordargument(args[1]),
|
|
7996
|
+
isCharacterBox: utils.isCharacterBox(args[1])
|
|
7997
|
+
};
|
|
7998
|
+
}
|
|
7999
|
+
|
|
8000
|
+
}); // Build a relation or stacked op by placing one symbol on top of another
|
|
8001
|
+
|
|
8002
|
+
defineFunction({
|
|
8003
|
+
type: "mclass",
|
|
8004
|
+
names: ["\\stackrel", "\\overset", "\\underset"],
|
|
8005
|
+
props: {
|
|
8006
|
+
numArgs: 2
|
|
8007
|
+
},
|
|
8008
|
+
|
|
8009
|
+
handler(_ref3, args) {
|
|
8010
|
+
var {
|
|
8011
|
+
parser,
|
|
8012
|
+
funcName
|
|
8013
|
+
} = _ref3;
|
|
8014
|
+
var baseArg = args[1];
|
|
8015
|
+
var shiftedArg = args[0];
|
|
8016
|
+
var mclass;
|
|
8017
|
+
|
|
8018
|
+
if (funcName !== "\\stackrel") {
|
|
8019
|
+
// LaTeX applies \binrel spacing to \overset and \underset.
|
|
8020
|
+
mclass = binrelClass(baseArg);
|
|
8021
|
+
} else {
|
|
8022
|
+
mclass = "mrel"; // for \stackrel
|
|
8023
|
+
}
|
|
8024
|
+
|
|
8025
|
+
var baseOp = {
|
|
8026
|
+
type: "op",
|
|
8027
|
+
mode: baseArg.mode,
|
|
8028
|
+
limits: true,
|
|
8029
|
+
alwaysHandleSupSub: true,
|
|
8030
|
+
parentIsSupSub: false,
|
|
8031
|
+
symbol: false,
|
|
8032
|
+
suppressBaseShift: funcName !== "\\stackrel",
|
|
8033
|
+
body: ordargument(baseArg)
|
|
8034
|
+
};
|
|
8035
|
+
var supsub = {
|
|
8036
|
+
type: "supsub",
|
|
8037
|
+
mode: shiftedArg.mode,
|
|
8038
|
+
base: baseOp,
|
|
8039
|
+
sup: funcName === "\\underset" ? null : shiftedArg,
|
|
8040
|
+
sub: funcName === "\\underset" ? shiftedArg : null
|
|
8041
|
+
};
|
|
8042
|
+
return {
|
|
8043
|
+
type: "mclass",
|
|
8044
|
+
mode: parser.mode,
|
|
8045
|
+
mclass,
|
|
8046
|
+
body: [supsub],
|
|
8047
|
+
isCharacterBox: utils.isCharacterBox(supsub)
|
|
8048
|
+
};
|
|
8049
|
+
},
|
|
8050
|
+
|
|
8051
|
+
htmlBuilder: htmlBuilder$9,
|
|
8052
|
+
mathmlBuilder: mathmlBuilder$8
|
|
8053
|
+
});
|
|
8054
|
+
|
|
8055
|
+
// \pmb is a simulation of bold font.
|
|
8056
|
+
// The version of \pmb in ambsy.sty works by typesetting three copies
|
|
8057
|
+
// with small offsets. We use CSS text-shadow.
|
|
8058
|
+
// It's a hack. Not as good as a real bold font. Better than nothing.
|
|
8059
|
+
defineFunction({
|
|
8060
|
+
type: "pmb",
|
|
8061
|
+
names: ["\\pmb"],
|
|
8062
|
+
props: {
|
|
8063
|
+
numArgs: 1,
|
|
8064
|
+
allowedInText: true
|
|
8065
|
+
},
|
|
8066
|
+
|
|
8067
|
+
handler(_ref, args) {
|
|
8068
|
+
var {
|
|
8069
|
+
parser
|
|
8070
|
+
} = _ref;
|
|
8071
|
+
return {
|
|
8072
|
+
type: "pmb",
|
|
8073
|
+
mode: parser.mode,
|
|
8074
|
+
mclass: binrelClass(args[0]),
|
|
8075
|
+
body: ordargument(args[0])
|
|
8076
|
+
};
|
|
8077
|
+
},
|
|
8078
|
+
|
|
8079
|
+
htmlBuilder(group, options) {
|
|
8080
|
+
var elements = buildExpression$1(group.body, options, true);
|
|
8081
|
+
var node = buildCommon.makeSpan([group.mclass], elements, options);
|
|
8082
|
+
node.style.textShadow = "0.02em 0.01em 0.04px";
|
|
8083
|
+
return node;
|
|
8084
|
+
},
|
|
8085
|
+
|
|
8086
|
+
mathmlBuilder(group, style) {
|
|
8087
|
+
var inner = buildExpression(group.body, style); // Wrap with an <mstyle> element.
|
|
8088
|
+
|
|
8089
|
+
var node = new mathMLTree.MathNode("mstyle", inner);
|
|
8090
|
+
node.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px");
|
|
8091
|
+
return node;
|
|
8092
|
+
}
|
|
8093
|
+
|
|
8094
|
+
});
|
|
8095
|
+
|
|
7885
8096
|
var cdArrowFunctionName = {
|
|
7886
8097
|
">": "\\\\cdrightarrow",
|
|
7887
8098
|
"<": "\\\\cdleftarrow",
|
|
@@ -8255,7 +8466,7 @@ defineFunction({
|
|
|
8255
8466
|
|
|
8256
8467
|
});
|
|
8257
8468
|
|
|
8258
|
-
var htmlBuilder$
|
|
8469
|
+
var htmlBuilder$8 = (group, options) => {
|
|
8259
8470
|
var elements = buildExpression$1(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains.
|
|
8260
8471
|
// To accomplish this, we wrap the results in a fragment, so the inner
|
|
8261
8472
|
// elements will be able to directly interact with their neighbors. For
|
|
@@ -8264,7 +8475,7 @@ var htmlBuilder$9 = (group, options) => {
|
|
|
8264
8475
|
return buildCommon.makeFragment(elements);
|
|
8265
8476
|
};
|
|
8266
8477
|
|
|
8267
|
-
var mathmlBuilder$
|
|
8478
|
+
var mathmlBuilder$7 = (group, options) => {
|
|
8268
8479
|
var inner = buildExpression(group.body, options.withColor(group.color));
|
|
8269
8480
|
var node = new mathMLTree.MathNode("mstyle", inner);
|
|
8270
8481
|
node.setAttribute("mathcolor", group.color);
|
|
@@ -8294,8 +8505,8 @@ defineFunction({
|
|
|
8294
8505
|
};
|
|
8295
8506
|
},
|
|
8296
8507
|
|
|
8297
|
-
htmlBuilder: htmlBuilder$
|
|
8298
|
-
mathmlBuilder: mathmlBuilder$
|
|
8508
|
+
htmlBuilder: htmlBuilder$8,
|
|
8509
|
+
mathmlBuilder: mathmlBuilder$7
|
|
8299
8510
|
});
|
|
8300
8511
|
defineFunction({
|
|
8301
8512
|
type: "color",
|
|
@@ -8327,8 +8538,8 @@ defineFunction({
|
|
|
8327
8538
|
};
|
|
8328
8539
|
},
|
|
8329
8540
|
|
|
8330
|
-
htmlBuilder: htmlBuilder$
|
|
8331
|
-
mathmlBuilder: mathmlBuilder$
|
|
8541
|
+
htmlBuilder: htmlBuilder$8,
|
|
8542
|
+
mathmlBuilder: mathmlBuilder$7
|
|
8332
8543
|
});
|
|
8333
8544
|
|
|
8334
8545
|
// Row breaks within tabular environments, and line breaks at top level
|
|
@@ -9689,12 +9900,12 @@ defineFunction({
|
|
|
9689
9900
|
}
|
|
9690
9901
|
});
|
|
9691
9902
|
|
|
9692
|
-
var htmlBuilder$
|
|
9903
|
+
var htmlBuilder$7 = (group, options) => {
|
|
9693
9904
|
// \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox, \phase
|
|
9694
9905
|
// Some groups can return document fragments. Handle those by wrapping
|
|
9695
9906
|
// them in a span.
|
|
9696
9907
|
var inner = buildCommon.wrapFragment(buildGroup$1(group.body, options), options);
|
|
9697
|
-
var label = group.label.
|
|
9908
|
+
var label = group.label.slice(1);
|
|
9698
9909
|
var scale = options.sizeMultiplier;
|
|
9699
9910
|
var img;
|
|
9700
9911
|
var imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different
|
|
@@ -9841,7 +10052,7 @@ var htmlBuilder$8 = (group, options) => {
|
|
|
9841
10052
|
}
|
|
9842
10053
|
};
|
|
9843
10054
|
|
|
9844
|
-
var mathmlBuilder$
|
|
10055
|
+
var mathmlBuilder$6 = (group, options) => {
|
|
9845
10056
|
var fboxsep = 0;
|
|
9846
10057
|
var node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup(group.body, options)]);
|
|
9847
10058
|
|
|
@@ -9927,8 +10138,8 @@ defineFunction({
|
|
|
9927
10138
|
};
|
|
9928
10139
|
},
|
|
9929
10140
|
|
|
9930
|
-
htmlBuilder: htmlBuilder$
|
|
9931
|
-
mathmlBuilder: mathmlBuilder$
|
|
10141
|
+
htmlBuilder: htmlBuilder$7,
|
|
10142
|
+
mathmlBuilder: mathmlBuilder$6
|
|
9932
10143
|
});
|
|
9933
10144
|
defineFunction({
|
|
9934
10145
|
type: "enclose",
|
|
@@ -9957,8 +10168,8 @@ defineFunction({
|
|
|
9957
10168
|
};
|
|
9958
10169
|
},
|
|
9959
10170
|
|
|
9960
|
-
htmlBuilder: htmlBuilder$
|
|
9961
|
-
mathmlBuilder: mathmlBuilder$
|
|
10171
|
+
htmlBuilder: htmlBuilder$7,
|
|
10172
|
+
mathmlBuilder: mathmlBuilder$6
|
|
9962
10173
|
});
|
|
9963
10174
|
defineFunction({
|
|
9964
10175
|
type: "enclose",
|
|
@@ -10003,8 +10214,8 @@ defineFunction({
|
|
|
10003
10214
|
};
|
|
10004
10215
|
},
|
|
10005
10216
|
|
|
10006
|
-
htmlBuilder: htmlBuilder$
|
|
10007
|
-
mathmlBuilder: mathmlBuilder$
|
|
10217
|
+
htmlBuilder: htmlBuilder$7,
|
|
10218
|
+
mathmlBuilder: mathmlBuilder$6
|
|
10008
10219
|
});
|
|
10009
10220
|
defineFunction({
|
|
10010
10221
|
type: "enclose",
|
|
@@ -10088,6 +10299,13 @@ function getHLines(parser) {
|
|
|
10088
10299
|
parser.consumeSpaces();
|
|
10089
10300
|
var nxt = parser.fetch().text;
|
|
10090
10301
|
|
|
10302
|
+
if (nxt === "\\relax") {
|
|
10303
|
+
// \relax is an artifact of the \cr macro below
|
|
10304
|
+
parser.consume();
|
|
10305
|
+
parser.consumeSpaces();
|
|
10306
|
+
nxt = parser.fetch().text;
|
|
10307
|
+
}
|
|
10308
|
+
|
|
10091
10309
|
while (nxt === "\\hline" || nxt === "\\hdashline") {
|
|
10092
10310
|
parser.consume();
|
|
10093
10311
|
hlineInfo.push(nxt === "\\hdashline");
|
|
@@ -10291,14 +10509,14 @@ function parseArray(parser, _ref, style) {
|
|
|
10291
10509
|
|
|
10292
10510
|
|
|
10293
10511
|
function dCellStyle(envName) {
|
|
10294
|
-
if (envName.
|
|
10512
|
+
if (envName.slice(0, 1) === "d") {
|
|
10295
10513
|
return "display";
|
|
10296
10514
|
} else {
|
|
10297
10515
|
return "text";
|
|
10298
10516
|
}
|
|
10299
10517
|
}
|
|
10300
10518
|
|
|
10301
|
-
var htmlBuilder$
|
|
10519
|
+
var htmlBuilder$6 = function htmlBuilder(group, options) {
|
|
10302
10520
|
var r;
|
|
10303
10521
|
var c;
|
|
10304
10522
|
var nr = group.body.length;
|
|
@@ -10601,7 +10819,7 @@ var alignMap = {
|
|
|
10601
10819
|
r: "right "
|
|
10602
10820
|
};
|
|
10603
10821
|
|
|
10604
|
-
var mathmlBuilder$
|
|
10822
|
+
var mathmlBuilder$5 = function mathmlBuilder(group, options) {
|
|
10605
10823
|
var tbl = [];
|
|
10606
10824
|
var glue = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]);
|
|
10607
10825
|
var tag = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]);
|
|
@@ -10885,8 +11103,8 @@ defineEnvironment({
|
|
|
10885
11103
|
return parseArray(context.parser, res, dCellStyle(context.envName));
|
|
10886
11104
|
},
|
|
10887
11105
|
|
|
10888
|
-
htmlBuilder: htmlBuilder$
|
|
10889
|
-
mathmlBuilder: mathmlBuilder$
|
|
11106
|
+
htmlBuilder: htmlBuilder$6,
|
|
11107
|
+
mathmlBuilder: mathmlBuilder$5
|
|
10890
11108
|
}); // The matrix environments of amsmath builds on the array environment
|
|
10891
11109
|
// of LaTeX, which is discussed above.
|
|
10892
11110
|
// The mathtools package adds starred versions of the same environments.
|
|
@@ -10962,8 +11180,8 @@ defineEnvironment({
|
|
|
10962
11180
|
} : res;
|
|
10963
11181
|
},
|
|
10964
11182
|
|
|
10965
|
-
htmlBuilder: htmlBuilder$
|
|
10966
|
-
mathmlBuilder: mathmlBuilder$
|
|
11183
|
+
htmlBuilder: htmlBuilder$6,
|
|
11184
|
+
mathmlBuilder: mathmlBuilder$5
|
|
10967
11185
|
});
|
|
10968
11186
|
defineEnvironment({
|
|
10969
11187
|
type: "array",
|
|
@@ -10981,8 +11199,8 @@ defineEnvironment({
|
|
|
10981
11199
|
return res;
|
|
10982
11200
|
},
|
|
10983
11201
|
|
|
10984
|
-
htmlBuilder: htmlBuilder$
|
|
10985
|
-
mathmlBuilder: mathmlBuilder$
|
|
11202
|
+
htmlBuilder: htmlBuilder$6,
|
|
11203
|
+
mathmlBuilder: mathmlBuilder$5
|
|
10986
11204
|
});
|
|
10987
11205
|
defineEnvironment({
|
|
10988
11206
|
type: "array",
|
|
@@ -11027,8 +11245,8 @@ defineEnvironment({
|
|
|
11027
11245
|
return res;
|
|
11028
11246
|
},
|
|
11029
11247
|
|
|
11030
|
-
htmlBuilder: htmlBuilder$
|
|
11031
|
-
mathmlBuilder: mathmlBuilder$
|
|
11248
|
+
htmlBuilder: htmlBuilder$6,
|
|
11249
|
+
mathmlBuilder: mathmlBuilder$5
|
|
11032
11250
|
}); // A cases environment (in amsmath.sty) is almost equivalent to
|
|
11033
11251
|
// \def\arraystretch{1.2}%
|
|
11034
11252
|
// \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right.
|
|
@@ -11075,8 +11293,8 @@ defineEnvironment({
|
|
|
11075
11293
|
};
|
|
11076
11294
|
},
|
|
11077
11295
|
|
|
11078
|
-
htmlBuilder: htmlBuilder$
|
|
11079
|
-
mathmlBuilder: mathmlBuilder$
|
|
11296
|
+
htmlBuilder: htmlBuilder$6,
|
|
11297
|
+
mathmlBuilder: mathmlBuilder$5
|
|
11080
11298
|
}); // In the align environment, one uses ampersands, &, to specify number of
|
|
11081
11299
|
// columns in each row, and to locate spacing between each column.
|
|
11082
11300
|
// align gets automatic numbering. align* and aligned do not.
|
|
@@ -11091,8 +11309,8 @@ defineEnvironment({
|
|
|
11091
11309
|
numArgs: 0
|
|
11092
11310
|
},
|
|
11093
11311
|
handler: alignedHandler,
|
|
11094
|
-
htmlBuilder: htmlBuilder$
|
|
11095
|
-
mathmlBuilder: mathmlBuilder$
|
|
11312
|
+
htmlBuilder: htmlBuilder$6,
|
|
11313
|
+
mathmlBuilder: mathmlBuilder$5
|
|
11096
11314
|
}); // A gathered environment is like an array environment with one centered
|
|
11097
11315
|
// column, but where rows are considered lines so get \jot line spacing
|
|
11098
11316
|
// and contents are set in \displaystyle.
|
|
@@ -11123,8 +11341,8 @@ defineEnvironment({
|
|
|
11123
11341
|
return parseArray(context.parser, res, "display");
|
|
11124
11342
|
},
|
|
11125
11343
|
|
|
11126
|
-
htmlBuilder: htmlBuilder$
|
|
11127
|
-
mathmlBuilder: mathmlBuilder$
|
|
11344
|
+
htmlBuilder: htmlBuilder$6,
|
|
11345
|
+
mathmlBuilder: mathmlBuilder$5
|
|
11128
11346
|
}); // alignat environment is like an align environment, but one must explicitly
|
|
11129
11347
|
// specify maximum number of columns in each row, and can adjust spacing between
|
|
11130
11348
|
// each columns.
|
|
@@ -11136,8 +11354,8 @@ defineEnvironment({
|
|
|
11136
11354
|
numArgs: 1
|
|
11137
11355
|
},
|
|
11138
11356
|
handler: alignedHandler,
|
|
11139
|
-
htmlBuilder: htmlBuilder$
|
|
11140
|
-
mathmlBuilder: mathmlBuilder$
|
|
11357
|
+
htmlBuilder: htmlBuilder$6,
|
|
11358
|
+
mathmlBuilder: mathmlBuilder$5
|
|
11141
11359
|
});
|
|
11142
11360
|
defineEnvironment({
|
|
11143
11361
|
type: "array",
|
|
@@ -11158,8 +11376,8 @@ defineEnvironment({
|
|
|
11158
11376
|
return parseArray(context.parser, res, "display");
|
|
11159
11377
|
},
|
|
11160
11378
|
|
|
11161
|
-
htmlBuilder: htmlBuilder$
|
|
11162
|
-
mathmlBuilder: mathmlBuilder$
|
|
11379
|
+
htmlBuilder: htmlBuilder$6,
|
|
11380
|
+
mathmlBuilder: mathmlBuilder$5
|
|
11163
11381
|
});
|
|
11164
11382
|
defineEnvironment({
|
|
11165
11383
|
type: "array",
|
|
@@ -11173,8 +11391,8 @@ defineEnvironment({
|
|
|
11173
11391
|
return parseCD(context.parser);
|
|
11174
11392
|
},
|
|
11175
11393
|
|
|
11176
|
-
htmlBuilder: htmlBuilder$
|
|
11177
|
-
mathmlBuilder: mathmlBuilder$
|
|
11394
|
+
htmlBuilder: htmlBuilder$6,
|
|
11395
|
+
mathmlBuilder: mathmlBuilder$5
|
|
11178
11396
|
});
|
|
11179
11397
|
defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}");
|
|
11180
11398
|
defineMacro("\\notag", "\\nonumber"); // Catch \hline outside array environment
|
|
@@ -11265,176 +11483,6 @@ defineFunction({
|
|
|
11265
11483
|
|
|
11266
11484
|
});
|
|
11267
11485
|
|
|
11268
|
-
var makeSpan = buildCommon.makeSpan;
|
|
11269
|
-
|
|
11270
|
-
function htmlBuilder$6(group, options) {
|
|
11271
|
-
var elements = buildExpression$1(group.body, options, true);
|
|
11272
|
-
return makeSpan([group.mclass], elements, options);
|
|
11273
|
-
}
|
|
11274
|
-
|
|
11275
|
-
function mathmlBuilder$5(group, options) {
|
|
11276
|
-
var node;
|
|
11277
|
-
var inner = buildExpression(group.body, options);
|
|
11278
|
-
|
|
11279
|
-
if (group.mclass === "minner") {
|
|
11280
|
-
node = new mathMLTree.MathNode("mpadded", inner);
|
|
11281
|
-
} else if (group.mclass === "mord") {
|
|
11282
|
-
if (group.isCharacterBox) {
|
|
11283
|
-
node = inner[0];
|
|
11284
|
-
node.type = "mi";
|
|
11285
|
-
} else {
|
|
11286
|
-
node = new mathMLTree.MathNode("mi", inner);
|
|
11287
|
-
}
|
|
11288
|
-
} else {
|
|
11289
|
-
if (group.isCharacterBox) {
|
|
11290
|
-
node = inner[0];
|
|
11291
|
-
node.type = "mo";
|
|
11292
|
-
} else {
|
|
11293
|
-
node = new mathMLTree.MathNode("mo", inner);
|
|
11294
|
-
} // Set spacing based on what is the most likely adjacent atom type.
|
|
11295
|
-
// See TeXbook p170.
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
if (group.mclass === "mbin") {
|
|
11299
|
-
node.attributes.lspace = "0.22em"; // medium space
|
|
11300
|
-
|
|
11301
|
-
node.attributes.rspace = "0.22em";
|
|
11302
|
-
} else if (group.mclass === "mpunct") {
|
|
11303
|
-
node.attributes.lspace = "0em";
|
|
11304
|
-
node.attributes.rspace = "0.17em"; // thinspace
|
|
11305
|
-
} else if (group.mclass === "mopen" || group.mclass === "mclose") {
|
|
11306
|
-
node.attributes.lspace = "0em";
|
|
11307
|
-
node.attributes.rspace = "0em";
|
|
11308
|
-
} else if (group.mclass === "minner") {
|
|
11309
|
-
node.attributes.lspace = "0.0556em"; // 1 mu is the most likely option
|
|
11310
|
-
|
|
11311
|
-
node.attributes.width = "+0.1111em";
|
|
11312
|
-
} // MathML <mo> default space is 5/18 em, so <mrel> needs no action.
|
|
11313
|
-
// Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo
|
|
11314
|
-
|
|
11315
|
-
}
|
|
11316
|
-
|
|
11317
|
-
return node;
|
|
11318
|
-
} // Math class commands except \mathop
|
|
11319
|
-
|
|
11320
|
-
|
|
11321
|
-
defineFunction({
|
|
11322
|
-
type: "mclass",
|
|
11323
|
-
names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
|
|
11324
|
-
props: {
|
|
11325
|
-
numArgs: 1,
|
|
11326
|
-
primitive: true
|
|
11327
|
-
},
|
|
11328
|
-
|
|
11329
|
-
handler(_ref, args) {
|
|
11330
|
-
var {
|
|
11331
|
-
parser,
|
|
11332
|
-
funcName
|
|
11333
|
-
} = _ref;
|
|
11334
|
-
var body = args[0];
|
|
11335
|
-
return {
|
|
11336
|
-
type: "mclass",
|
|
11337
|
-
mode: parser.mode,
|
|
11338
|
-
mclass: "m" + funcName.substr(5),
|
|
11339
|
-
// TODO(kevinb): don't prefix with 'm'
|
|
11340
|
-
body: ordargument(body),
|
|
11341
|
-
isCharacterBox: utils.isCharacterBox(body)
|
|
11342
|
-
};
|
|
11343
|
-
},
|
|
11344
|
-
|
|
11345
|
-
htmlBuilder: htmlBuilder$6,
|
|
11346
|
-
mathmlBuilder: mathmlBuilder$5
|
|
11347
|
-
});
|
|
11348
|
-
var binrelClass = arg => {
|
|
11349
|
-
// \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument.
|
|
11350
|
-
// (by rendering separately and with {}s before and after, and measuring
|
|
11351
|
-
// the change in spacing). We'll do roughly the same by detecting the
|
|
11352
|
-
// atom type directly.
|
|
11353
|
-
var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg;
|
|
11354
|
-
|
|
11355
|
-
if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) {
|
|
11356
|
-
return "m" + atom.family;
|
|
11357
|
-
} else {
|
|
11358
|
-
return "mord";
|
|
11359
|
-
}
|
|
11360
|
-
}; // \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord.
|
|
11361
|
-
// This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX.
|
|
11362
|
-
|
|
11363
|
-
defineFunction({
|
|
11364
|
-
type: "mclass",
|
|
11365
|
-
names: ["\\@binrel"],
|
|
11366
|
-
props: {
|
|
11367
|
-
numArgs: 2
|
|
11368
|
-
},
|
|
11369
|
-
|
|
11370
|
-
handler(_ref2, args) {
|
|
11371
|
-
var {
|
|
11372
|
-
parser
|
|
11373
|
-
} = _ref2;
|
|
11374
|
-
return {
|
|
11375
|
-
type: "mclass",
|
|
11376
|
-
mode: parser.mode,
|
|
11377
|
-
mclass: binrelClass(args[0]),
|
|
11378
|
-
body: ordargument(args[1]),
|
|
11379
|
-
isCharacterBox: utils.isCharacterBox(args[1])
|
|
11380
|
-
};
|
|
11381
|
-
}
|
|
11382
|
-
|
|
11383
|
-
}); // Build a relation or stacked op by placing one symbol on top of another
|
|
11384
|
-
|
|
11385
|
-
defineFunction({
|
|
11386
|
-
type: "mclass",
|
|
11387
|
-
names: ["\\stackrel", "\\overset", "\\underset"],
|
|
11388
|
-
props: {
|
|
11389
|
-
numArgs: 2
|
|
11390
|
-
},
|
|
11391
|
-
|
|
11392
|
-
handler(_ref3, args) {
|
|
11393
|
-
var {
|
|
11394
|
-
parser,
|
|
11395
|
-
funcName
|
|
11396
|
-
} = _ref3;
|
|
11397
|
-
var baseArg = args[1];
|
|
11398
|
-
var shiftedArg = args[0];
|
|
11399
|
-
var mclass;
|
|
11400
|
-
|
|
11401
|
-
if (funcName !== "\\stackrel") {
|
|
11402
|
-
// LaTeX applies \binrel spacing to \overset and \underset.
|
|
11403
|
-
mclass = binrelClass(baseArg);
|
|
11404
|
-
} else {
|
|
11405
|
-
mclass = "mrel"; // for \stackrel
|
|
11406
|
-
}
|
|
11407
|
-
|
|
11408
|
-
var baseOp = {
|
|
11409
|
-
type: "op",
|
|
11410
|
-
mode: baseArg.mode,
|
|
11411
|
-
limits: true,
|
|
11412
|
-
alwaysHandleSupSub: true,
|
|
11413
|
-
parentIsSupSub: false,
|
|
11414
|
-
symbol: false,
|
|
11415
|
-
suppressBaseShift: funcName !== "\\stackrel",
|
|
11416
|
-
body: ordargument(baseArg)
|
|
11417
|
-
};
|
|
11418
|
-
var supsub = {
|
|
11419
|
-
type: "supsub",
|
|
11420
|
-
mode: shiftedArg.mode,
|
|
11421
|
-
base: baseOp,
|
|
11422
|
-
sup: funcName === "\\underset" ? null : shiftedArg,
|
|
11423
|
-
sub: funcName === "\\underset" ? shiftedArg : null
|
|
11424
|
-
};
|
|
11425
|
-
return {
|
|
11426
|
-
type: "mclass",
|
|
11427
|
-
mode: parser.mode,
|
|
11428
|
-
mclass,
|
|
11429
|
-
body: [supsub],
|
|
11430
|
-
isCharacterBox: utils.isCharacterBox(supsub)
|
|
11431
|
-
};
|
|
11432
|
-
},
|
|
11433
|
-
|
|
11434
|
-
htmlBuilder: htmlBuilder$6,
|
|
11435
|
-
mathmlBuilder: mathmlBuilder$5
|
|
11436
|
-
});
|
|
11437
|
-
|
|
11438
11486
|
// TODO(kevinb): implement \\sl and \\sc
|
|
11439
11487
|
|
|
11440
11488
|
var htmlBuilder$5 = (group, options) => {
|
|
@@ -13032,7 +13080,7 @@ var htmlBuilder$2 = (grp, options) => {
|
|
|
13032
13080
|
if (group.name === "\\oiint" || group.name === "\\oiiint") {
|
|
13033
13081
|
// No font glyphs yet, so use a glyph w/o the oval.
|
|
13034
13082
|
// TODO: When font glyphs are available, delete this code.
|
|
13035
|
-
stash = group.name.
|
|
13083
|
+
stash = group.name.slice(1);
|
|
13036
13084
|
group.name = stash === "oiint" ? "\\iint" : "\\iiint";
|
|
13037
13085
|
}
|
|
13038
13086
|
|
|
@@ -15493,7 +15541,7 @@ defineMacro("\\dots", function (context) {
|
|
|
15493
15541
|
|
|
15494
15542
|
if (next in dotsByToken) {
|
|
15495
15543
|
thedots = dotsByToken[next];
|
|
15496
|
-
} else if (next.
|
|
15544
|
+
} else if (next.slice(0, 4) === '\\not') {
|
|
15497
15545
|
thedots = '\\dotsb';
|
|
15498
15546
|
} else if (next in symbols.math) {
|
|
15499
15547
|
if (utils.contains(['bin', 'rel'], symbols.math[next].group)) {
|
|
@@ -15630,12 +15678,7 @@ defineMacro("\\tag@literal", context => {
|
|
|
15630
15678
|
defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + "\\mathbin{\\rm mod}" + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");
|
|
15631
15679
|
defineMacro("\\pod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");
|
|
15632
15680
|
defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}");
|
|
15633
|
-
defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\rm mod}\\,\\,#1");
|
|
15634
|
-
// The version in ambsy.sty works by typesetting three copies of the argument
|
|
15635
|
-
// with small offsets. We use two copies. We omit the vertical offset because
|
|
15636
|
-
// of rendering problems that makeVList encounters in Safari.
|
|
15637
|
-
|
|
15638
|
-
defineMacro("\\pmb", "\\html@mathml{" + "\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}" + "{\\mathbf{#1}}"); //////////////////////////////////////////////////////////////////////
|
|
15681
|
+
defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\rm mod}\\,\\,#1"); //////////////////////////////////////////////////////////////////////
|
|
15639
15682
|
// LaTeX source2e
|
|
15640
15683
|
// \expandafter\let\expandafter\@normalcr
|
|
15641
15684
|
// \csname\expandafter\@gobble\string\\ \endcsname
|
|
@@ -18008,7 +18051,7 @@ class Parser {
|
|
|
18008
18051
|
this.settings.reportNonstrict("unicodeTextInMathMode", "Accented Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
|
|
18009
18052
|
}
|
|
18010
18053
|
|
|
18011
|
-
text = unicodeSymbols[text[0]] + text.
|
|
18054
|
+
text = unicodeSymbols[text[0]] + text.slice(1);
|
|
18012
18055
|
} // Strip off any combining characters
|
|
18013
18056
|
|
|
18014
18057
|
|
|
@@ -18254,7 +18297,7 @@ var katex = {
|
|
|
18254
18297
|
/**
|
|
18255
18298
|
* Current KaTeX version
|
|
18256
18299
|
*/
|
|
18257
|
-
version: "0.16.
|
|
18300
|
+
version: "0.16.3",
|
|
18258
18301
|
|
|
18259
18302
|
/**
|
|
18260
18303
|
* Renders the given LaTeX into an HTML+MathML combination, and adds
|