katex 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/cli.js +6 -9
- package/contrib/auto-render/index.html +1 -1
- package/contrib/copy-tex/README.md +3 -3
- package/contrib/copy-tex/index.html +1 -1
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/dist/README.md +3 -3
- package/dist/contrib/render-a11y-string.js +15 -40
- package/dist/contrib/render-a11y-string.min.js +1 -1
- package/dist/contrib/render-a11y-string.mjs +13 -33
- package/dist/katex-swap.css +159 -164
- package/dist/katex-swap.min.css +1 -1
- package/dist/katex.css +159 -164
- package/dist/katex.js +259 -420
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +259 -420
- package/package.json +12 -16
- package/src/MacroExpander.ts +10 -7
- package/src/Namespace.ts +16 -20
- package/src/Options.ts +2 -2
- package/src/Parser.ts +2 -2
- package/src/atoms.ts +22 -22
- package/src/buildCommon.ts +2 -2
- package/src/buildHTML.ts +8 -8
- package/src/buildMathML.ts +3 -3
- package/src/environments/array.ts +3 -3
- package/src/fontMetrics.ts +2 -4
- package/src/functions/accent.ts +2 -2
- package/src/functions/cr.ts +1 -1
- package/src/functions/enclose.ts +1 -1
- package/src/functions/environment.ts +1 -1
- package/src/functions/html.ts +3 -3
- package/src/functions/lap.ts +7 -7
- package/src/functions/overline.ts +1 -1
- package/src/functions/phantom.ts +2 -2
- package/src/functions/rule.ts +1 -1
- package/src/functions/sizing.ts +1 -1
- package/src/functions/smash.ts +1 -1
- package/src/functions/sqrt.ts +1 -1
- package/src/functions/symbolsSpacing.ts +20 -21
- package/src/functions/underline.ts +1 -1
- package/src/macros.ts +3 -3
- package/src/mathMLTree.ts +6 -10
- package/src/parseNode.ts +4 -4
- package/src/stretchy.ts +2 -2
- package/src/styles/katex.scss +31 -37
- package/src/wide-character.ts +2 -2
package/dist/katex.js
CHANGED
|
@@ -3905,10 +3905,8 @@ function getGlobalMetrics(size) {
|
|
|
3905
3905
|
const metrics = fontMetricsBySizeIndex[sizeIndex] = {
|
|
3906
3906
|
cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
|
|
3907
3907
|
};
|
|
3908
|
-
for (const key
|
|
3909
|
-
|
|
3910
|
-
metrics[key] = sigmasAndXis[key][sizeIndex];
|
|
3911
|
-
}
|
|
3908
|
+
for (const key of Object.keys(sigmasAndXis)) {
|
|
3909
|
+
metrics[key] = sigmasAndXis[key][sizeIndex];
|
|
3912
3910
|
}
|
|
3913
3911
|
}
|
|
3914
3912
|
return fontMetricsBySizeIndex[sizeIndex];
|
|
@@ -5034,12 +5032,10 @@ const makeOrd = function (group, options) {
|
|
|
5034
5032
|
const mode = group.mode;
|
|
5035
5033
|
const text = group.text;
|
|
5036
5034
|
const classes = ["mord"];
|
|
5037
|
-
const
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
fontShape
|
|
5042
|
-
} = options;
|
|
5035
|
+
const font = options.font,
|
|
5036
|
+
fontFamily = options.fontFamily,
|
|
5037
|
+
fontWeight = options.fontWeight,
|
|
5038
|
+
fontShape = options.fontShape;
|
|
5043
5039
|
|
|
5044
5040
|
// Math mode or Old font (i.e. \rm)
|
|
5045
5041
|
const useFont = mode === "math" || mode === "text" && !!font;
|
|
@@ -5070,7 +5066,7 @@ const makeOrd = function (group, options) {
|
|
|
5070
5066
|
}
|
|
5071
5067
|
if (lookupSymbol(text, fontName, mode).metrics) {
|
|
5072
5068
|
return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses));
|
|
5073
|
-
} else if (
|
|
5069
|
+
} else if (Object.prototype.hasOwnProperty.call(ligatures, text) && fontName.slice(0, 10) === "Typewriter") {
|
|
5074
5070
|
// Deconstruct ligatures in monospace fonts (\texttt, \tt).
|
|
5075
5071
|
const parts = [];
|
|
5076
5072
|
for (let i = 0; i < text.length; i++) {
|
|
@@ -5305,10 +5301,9 @@ const getVListChildrenAndDepth = function (params) {
|
|
|
5305
5301
|
* See VListParam documentation above.
|
|
5306
5302
|
*/
|
|
5307
5303
|
const makeVList = function (params, options) {
|
|
5308
|
-
const
|
|
5309
|
-
children,
|
|
5310
|
-
depth
|
|
5311
|
-
} = getVListChildrenAndDepth(params);
|
|
5304
|
+
const _getVListChildrenAndD = getVListChildrenAndDepth(params),
|
|
5305
|
+
children = _getVListChildrenAndD.children,
|
|
5306
|
+
depth = _getVListChildrenAndD.depth;
|
|
5312
5307
|
|
|
5313
5308
|
// Create a strut that is taller than any list item. The strut is added to
|
|
5314
5309
|
// each item, where it will determine the item's baseline. Since it has
|
|
@@ -5509,7 +5504,10 @@ const svgData = {
|
|
|
5509
5504
|
};
|
|
5510
5505
|
const staticSvg = function (value, options) {
|
|
5511
5506
|
// Create a span with inline SVG for the element.
|
|
5512
|
-
const
|
|
5507
|
+
const _svgData$value = svgData[value],
|
|
5508
|
+
pathName = _svgData$value[0],
|
|
5509
|
+
width = _svgData$value[1],
|
|
5510
|
+
height = _svgData$value[2];
|
|
5513
5511
|
const path = new PathNode(pathName);
|
|
5514
5512
|
const svgNode = new SvgNode([path], {
|
|
5515
5513
|
"width": makeEm(width),
|
|
@@ -5519,7 +5517,7 @@ const staticSvg = function (value, options) {
|
|
|
5519
5517
|
"viewBox": "0 0 " + 1000 * width + " " + 1000 * height,
|
|
5520
5518
|
"preserveAspectRatio": "xMinYMin"
|
|
5521
5519
|
});
|
|
5522
|
-
const span = makeSvgSpan(["overlay"], [svgNode], options);
|
|
5520
|
+
const span = makeSvgSpan(["katex-overlay"], [svgNode], options);
|
|
5523
5521
|
span.height = height;
|
|
5524
5522
|
span.style.height = makeEm(height);
|
|
5525
5523
|
span.style.width = makeEm(width);
|
|
@@ -5674,12 +5672,10 @@ const _htmlGroupBuilders = {};
|
|
|
5674
5672
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5675
5673
|
const _mathmlGroupBuilders = {};
|
|
5676
5674
|
function defineFunction(data) {
|
|
5677
|
-
const
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
mathmlBuilder
|
|
5682
|
-
} = data;
|
|
5675
|
+
const type = data.type,
|
|
5676
|
+
names = data.names,
|
|
5677
|
+
htmlBuilder = data.htmlBuilder,
|
|
5678
|
+
mathmlBuilder = data.mathmlBuilder;
|
|
5683
5679
|
for (let i = 0; i < names.length; ++i) {
|
|
5684
5680
|
// To avoid destructuring and rebuilding an object,
|
|
5685
5681
|
// we store the entire FunctionDefSpec object,
|
|
@@ -5702,11 +5698,9 @@ function defineFunction(data) {
|
|
|
5702
5698
|
* stand-alone handler provided to `defineFunction`).
|
|
5703
5699
|
*/
|
|
5704
5700
|
function defineFunctionBuilders(_ref) {
|
|
5705
|
-
let
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
mathmlBuilder
|
|
5709
|
-
} = _ref;
|
|
5701
|
+
let type = _ref.type,
|
|
5702
|
+
htmlBuilder = _ref.htmlBuilder,
|
|
5703
|
+
mathmlBuilder = _ref.mathmlBuilder;
|
|
5710
5704
|
if (htmlBuilder) {
|
|
5711
5705
|
_htmlGroupBuilders[type] = htmlBuilder;
|
|
5712
5706
|
}
|
|
@@ -5882,7 +5876,7 @@ const traverseNonSpaceNodes = function (nodes, callback, prev, next, isRoot) {
|
|
|
5882
5876
|
}
|
|
5883
5877
|
if (nonspace) {
|
|
5884
5878
|
prev.node = node;
|
|
5885
|
-
} else if (isRoot && node.hasClass("newline")) {
|
|
5879
|
+
} else if (isRoot && node.hasClass("katex-newline")) {
|
|
5886
5880
|
prev.node = makeSpan(["leftmost"]); // treat like beginning of line
|
|
5887
5881
|
}
|
|
5888
5882
|
prev.insertAfter = (index => n => {
|
|
@@ -5968,18 +5962,18 @@ const buildGroup = function (group, options, baseOptions) {
|
|
|
5968
5962
|
|
|
5969
5963
|
/**
|
|
5970
5964
|
* Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`)
|
|
5971
|
-
* into an unbreakable HTML node of class .base, with proper struts to
|
|
5965
|
+
* into an unbreakable HTML node of class .katex-base, with proper struts to
|
|
5972
5966
|
* guarantee correct vertical extent. `buildHTML` calls this repeatedly to
|
|
5973
5967
|
* make up the entire expression as a sequence of unbreakable units.
|
|
5974
5968
|
*/
|
|
5975
5969
|
function buildHTMLUnbreakable(children, options) {
|
|
5976
5970
|
// Compute height and depth of this chunk.
|
|
5977
|
-
const body = makeSpan(["base"], children, options);
|
|
5971
|
+
const body = makeSpan(["katex-base"], children, options);
|
|
5978
5972
|
|
|
5979
5973
|
// Add strut, which ensures that the top of the HTML element falls at
|
|
5980
5974
|
// the height of the expression, and the bottom of the HTML element
|
|
5981
5975
|
// falls at the depth of the expression.
|
|
5982
|
-
const strut = makeSpan(["strut"]);
|
|
5976
|
+
const strut = makeSpan(["katex-strut"]);
|
|
5983
5977
|
strut.style.height = makeEm(body.height + body.depth);
|
|
5984
5978
|
if (body.depth) {
|
|
5985
5979
|
strut.style.verticalAlign = makeEm(-body.depth);
|
|
@@ -6003,7 +5997,7 @@ function buildHTML(tree, options) {
|
|
|
6003
5997
|
// Build the expression contained in the tree
|
|
6004
5998
|
const expression = buildExpression(tree, options, "root");
|
|
6005
5999
|
let eqnNum;
|
|
6006
|
-
if (expression.length === 2 && expression[1].hasClass("tag")) {
|
|
6000
|
+
if (expression.length === 2 && expression[1].hasClass("katex-tag")) {
|
|
6007
6001
|
// An environment with automatic equation numbers, e.g. {gather}.
|
|
6008
6002
|
eqnNum = expression.pop();
|
|
6009
6003
|
}
|
|
@@ -6023,7 +6017,7 @@ function buildHTML(tree, options) {
|
|
|
6023
6017
|
// Put any post-operator glue on same line as operator.
|
|
6024
6018
|
// Watch for \nobreak along the way, and stop at \newline.
|
|
6025
6019
|
let nobreak = false;
|
|
6026
|
-
while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) {
|
|
6020
|
+
while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("katex-newline")) {
|
|
6027
6021
|
i++;
|
|
6028
6022
|
parts.push(expression[i]);
|
|
6029
6023
|
if (expression[i].hasClass("nobreak")) {
|
|
@@ -6035,7 +6029,7 @@ function buildHTML(tree, options) {
|
|
|
6035
6029
|
children.push(buildHTMLUnbreakable(parts, options));
|
|
6036
6030
|
parts = [];
|
|
6037
6031
|
}
|
|
6038
|
-
} else if (expression[i].hasClass("newline")) {
|
|
6032
|
+
} else if (expression[i].hasClass("katex-newline")) {
|
|
6039
6033
|
// Write the line except the newline
|
|
6040
6034
|
parts.pop();
|
|
6041
6035
|
if (parts.length > 0) {
|
|
@@ -6054,7 +6048,7 @@ function buildHTML(tree, options) {
|
|
|
6054
6048
|
let tagChild;
|
|
6055
6049
|
if (tag) {
|
|
6056
6050
|
tagChild = buildHTMLUnbreakable(buildExpression(tag, options, true), options);
|
|
6057
|
-
tagChild.classes = ["tag"];
|
|
6051
|
+
tagChild.classes = ["katex-tag"];
|
|
6058
6052
|
children.push(tagChild);
|
|
6059
6053
|
} else if (eqnNum) {
|
|
6060
6054
|
children.push(eqnNum);
|
|
@@ -6135,10 +6129,10 @@ class MathNode {
|
|
|
6135
6129
|
*/
|
|
6136
6130
|
toNode() {
|
|
6137
6131
|
const node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
|
|
6138
|
-
for (const
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6132
|
+
for (const _ref of Object.entries(this.attributes)) {
|
|
6133
|
+
const attr = _ref[0];
|
|
6134
|
+
const value = _ref[1];
|
|
6135
|
+
node.setAttribute(attr, value);
|
|
6142
6136
|
}
|
|
6143
6137
|
if (this.classes.length > 0) {
|
|
6144
6138
|
node.className = createClass(this.classes);
|
|
@@ -6166,12 +6160,12 @@ class MathNode {
|
|
|
6166
6160
|
let markup = "<" + this.type;
|
|
6167
6161
|
|
|
6168
6162
|
// Add the attributes
|
|
6169
|
-
for (const
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6163
|
+
for (const _ref2 of Object.entries(this.attributes)) {
|
|
6164
|
+
const attr = _ref2[0];
|
|
6165
|
+
const value = _ref2[1];
|
|
6166
|
+
markup += " " + attr + "=\"";
|
|
6167
|
+
markup += utils_escape(value);
|
|
6168
|
+
markup += "\"";
|
|
6175
6169
|
}
|
|
6176
6170
|
if (this.classes.length > 0) {
|
|
6177
6171
|
markup += " class =\"" + utils_escape(createClass(this.classes)) + "\"";
|
|
@@ -6318,7 +6312,8 @@ const rowLikeTypes = new Set(["mrow", "mtable"]);
|
|
|
6318
6312
|
* optional replacement from symbols.js.
|
|
6319
6313
|
*/
|
|
6320
6314
|
const makeText = function (text, mode, options) {
|
|
6321
|
-
|
|
6315
|
+
var _options$fontFamily, _options$font;
|
|
6316
|
+
if (src_symbols[mode][text] && src_symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(Object.prototype.hasOwnProperty.call(ligatures, text) && ((options == null || (_options$fontFamily = options.fontFamily) == null ? void 0 : _options$fontFamily.slice(4, 6)) === "tt" || (options == null || (_options$font = options.font) == null ? void 0 : _options$font.slice(4, 6)) === "tt"))) {
|
|
6322
6317
|
text = src_symbols[mode][text].replace;
|
|
6323
6318
|
}
|
|
6324
6319
|
return new TextNode(text);
|
|
@@ -6807,7 +6802,7 @@ class Options {
|
|
|
6807
6802
|
*/
|
|
6808
6803
|
sizingClasses(oldOptions) {
|
|
6809
6804
|
if (oldOptions.size !== this.size) {
|
|
6810
|
-
return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
|
|
6805
|
+
return ["katex-sizing", "reset-size" + oldOptions.size, "size" + this.size];
|
|
6811
6806
|
} else {
|
|
6812
6807
|
return [];
|
|
6813
6808
|
}
|
|
@@ -6819,7 +6814,7 @@ class Options {
|
|
|
6819
6814
|
*/
|
|
6820
6815
|
baseSizingClasses() {
|
|
6821
6816
|
if (this.size !== Options.BASESIZE) {
|
|
6822
|
-
return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
|
|
6817
|
+
return ["katex-sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
|
|
6823
6818
|
} else {
|
|
6824
6819
|
return [];
|
|
6825
6820
|
}
|
|
@@ -7105,7 +7100,9 @@ const stretchySvg = function (group, options) {
|
|
|
7105
7100
|
if (!data) {
|
|
7106
7101
|
throw new Error("No SVG data for \"" + label + "\".");
|
|
7107
7102
|
}
|
|
7108
|
-
const
|
|
7103
|
+
const paths = data[0],
|
|
7104
|
+
minWidth = data[1],
|
|
7105
|
+
viewBoxHeight = data[2];
|
|
7109
7106
|
const height = viewBoxHeight / 1000;
|
|
7110
7107
|
const numSvgChildren = paths.length;
|
|
7111
7108
|
let widthClasses;
|
|
@@ -7146,17 +7143,16 @@ const stretchySvg = function (group, options) {
|
|
|
7146
7143
|
}
|
|
7147
7144
|
}
|
|
7148
7145
|
return {
|
|
7149
|
-
span: makeSpan(["stretchy"], spans, options),
|
|
7146
|
+
span: makeSpan(["katex-stretchy"], spans, options),
|
|
7150
7147
|
minWidth,
|
|
7151
7148
|
height
|
|
7152
7149
|
};
|
|
7153
7150
|
}
|
|
7154
7151
|
} // buildSvgSpan_()
|
|
7155
|
-
const
|
|
7156
|
-
span,
|
|
7157
|
-
minWidth,
|
|
7158
|
-
height
|
|
7159
|
-
} = buildSvgSpan_();
|
|
7152
|
+
const _buildSvgSpan_ = buildSvgSpan_(),
|
|
7153
|
+
span = _buildSvgSpan_.span,
|
|
7154
|
+
minWidth = _buildSvgSpan_.minWidth,
|
|
7155
|
+
height = _buildSvgSpan_.height;
|
|
7160
7156
|
|
|
7161
7157
|
// Note that we are returning span.depth = 0.
|
|
7162
7158
|
// Any adjustments relative to the baseline must be done in buildHTML.
|
|
@@ -7172,7 +7168,7 @@ const stretchyEnclose = function (inner, label, topPad, bottomPad, options) {
|
|
|
7172
7168
|
let img;
|
|
7173
7169
|
const totalHeight = inner.height + inner.depth + topPad + bottomPad;
|
|
7174
7170
|
if (/fbox|color|angl/.test(label)) {
|
|
7175
|
-
img = makeSpan(["stretchy", label], [], options);
|
|
7171
|
+
img = makeSpan(["katex-stretchy", label], [], options);
|
|
7176
7172
|
if (label === "fbox") {
|
|
7177
7173
|
const color = options.color && options.getColor();
|
|
7178
7174
|
if (color) {
|
|
@@ -7220,27 +7216,12 @@ const stretchyEnclose = function (inner, label, topPad, bottomPad, options) {
|
|
|
7220
7216
|
* pull in `isAtom` without dragging in the ~870-line symbol tables.
|
|
7221
7217
|
*/
|
|
7222
7218
|
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
const ATOMS = {
|
|
7228
|
-
"bin": 1,
|
|
7229
|
-
"close": 1,
|
|
7230
|
-
"inner": 1,
|
|
7231
|
-
"open": 1,
|
|
7232
|
-
"punct": 1,
|
|
7233
|
-
"rel": 1
|
|
7234
|
-
};
|
|
7235
|
-
const NON_ATOMS = {
|
|
7236
|
-
"accent-token": 1,
|
|
7237
|
-
"mathord": 1,
|
|
7238
|
-
"op-token": 1,
|
|
7239
|
-
"spacing": 1,
|
|
7240
|
-
"textord": 1
|
|
7241
|
-
};
|
|
7219
|
+
const atomList = ["bin", "close", "inner", "open", "punct", "rel"];
|
|
7220
|
+
const nonAtomList = ["accent-token", "mathord", "op-token", "spacing", "textord"];
|
|
7221
|
+
const Atoms = new Set(atomList);
|
|
7222
|
+
const NonAtoms = new Set(nonAtomList);
|
|
7242
7223
|
function isAtom(value) {
|
|
7243
|
-
return value
|
|
7224
|
+
return Atoms.has(value);
|
|
7244
7225
|
}
|
|
7245
7226
|
;// ./src/parseNode.ts
|
|
7246
7227
|
|
|
@@ -7272,7 +7253,7 @@ function assertSymbolNodeType(node) {
|
|
|
7272
7253
|
* returns null.
|
|
7273
7254
|
*/
|
|
7274
7255
|
function checkSymbolNodeType(node) {
|
|
7275
|
-
if (node
|
|
7256
|
+
if (node.type === "atom" || NonAtoms.has(node.type)) {
|
|
7276
7257
|
return node;
|
|
7277
7258
|
}
|
|
7278
7259
|
return null;
|
|
@@ -7396,7 +7377,7 @@ const htmlBuilder = (grp, options) => {
|
|
|
7396
7377
|
// Shift the accent over by the skew.
|
|
7397
7378
|
let left = skew;
|
|
7398
7379
|
|
|
7399
|
-
// CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }`
|
|
7380
|
+
// CSS defines `.katex .katex-accent .accent-body:not(.accent-full) { width: 0 }`
|
|
7400
7381
|
// so that the accent doesn't contribute to the bounding box.
|
|
7401
7382
|
// We need to shift the character by its width (effectively half
|
|
7402
7383
|
// its width) to compensate.
|
|
@@ -7441,7 +7422,7 @@ const htmlBuilder = (grp, options) => {
|
|
|
7441
7422
|
}]
|
|
7442
7423
|
}, options);
|
|
7443
7424
|
}
|
|
7444
|
-
const accentWrap = makeSpan(["mord", "accent"], [accentBody], options);
|
|
7425
|
+
const accentWrap = makeSpan(["mord", "katex-accent"], [accentBody], options);
|
|
7445
7426
|
if (supSubGroup) {
|
|
7446
7427
|
// Here, we replace the "base" child of the supsub with our newly
|
|
7447
7428
|
// generated accent.
|
|
@@ -7527,10 +7508,8 @@ defineFunction({
|
|
|
7527
7508
|
names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
|
|
7528
7509
|
numArgs: 1,
|
|
7529
7510
|
handler: (_ref, args) => {
|
|
7530
|
-
let
|
|
7531
|
-
|
|
7532
|
-
funcName
|
|
7533
|
-
} = _ref;
|
|
7511
|
+
let parser = _ref.parser,
|
|
7512
|
+
funcName = _ref.funcName;
|
|
7534
7513
|
const base = args[0];
|
|
7535
7514
|
return {
|
|
7536
7515
|
type: "accentUnder",
|
|
@@ -7597,10 +7576,8 @@ defineFunction({
|
|
|
7597
7576
|
numArgs: 1,
|
|
7598
7577
|
numOptionalArgs: 1,
|
|
7599
7578
|
handler(_ref, args, optArgs) {
|
|
7600
|
-
let
|
|
7601
|
-
|
|
7602
|
-
funcName
|
|
7603
|
-
} = _ref;
|
|
7579
|
+
let parser = _ref.parser,
|
|
7580
|
+
funcName = _ref.funcName;
|
|
7604
7581
|
return {
|
|
7605
7582
|
type: "xArrow",
|
|
7606
7583
|
mode: parser.mode,
|
|
@@ -7757,10 +7734,8 @@ defineFunction({
|
|
|
7757
7734
|
numArgs: 1,
|
|
7758
7735
|
primitive: true,
|
|
7759
7736
|
handler(_ref, args) {
|
|
7760
|
-
let
|
|
7761
|
-
|
|
7762
|
-
funcName
|
|
7763
|
-
} = _ref;
|
|
7737
|
+
let parser = _ref.parser,
|
|
7738
|
+
funcName = _ref.funcName;
|
|
7764
7739
|
const body = args[0];
|
|
7765
7740
|
return {
|
|
7766
7741
|
type: "mclass",
|
|
@@ -7793,9 +7768,7 @@ defineFunction({
|
|
|
7793
7768
|
names: ["\\@binrel"],
|
|
7794
7769
|
numArgs: 2,
|
|
7795
7770
|
handler(_ref2, args) {
|
|
7796
|
-
let
|
|
7797
|
-
parser
|
|
7798
|
-
} = _ref2;
|
|
7771
|
+
let parser = _ref2.parser;
|
|
7799
7772
|
return {
|
|
7800
7773
|
type: "mclass",
|
|
7801
7774
|
mode: parser.mode,
|
|
@@ -7812,10 +7785,8 @@ defineFunction({
|
|
|
7812
7785
|
names: ["\\stackrel", "\\overset", "\\underset"],
|
|
7813
7786
|
numArgs: 2,
|
|
7814
7787
|
handler(_ref3, args) {
|
|
7815
|
-
let
|
|
7816
|
-
|
|
7817
|
-
funcName
|
|
7818
|
-
} = _ref3;
|
|
7788
|
+
let parser = _ref3.parser,
|
|
7789
|
+
funcName = _ref3.funcName;
|
|
7819
7790
|
const baseArg = args[1];
|
|
7820
7791
|
const shiftedArg = args[0];
|
|
7821
7792
|
let mclass;
|
|
@@ -7873,9 +7844,7 @@ defineFunction({
|
|
|
7873
7844
|
numArgs: 1,
|
|
7874
7845
|
allowedInText: true,
|
|
7875
7846
|
handler(_ref, args) {
|
|
7876
|
-
let
|
|
7877
|
-
parser
|
|
7878
|
-
} = _ref;
|
|
7847
|
+
let parser = _ref.parser;
|
|
7879
7848
|
return {
|
|
7880
7849
|
type: "pmb",
|
|
7881
7850
|
mode: parser.mode,
|
|
@@ -8141,10 +8110,8 @@ defineFunction({
|
|
|
8141
8110
|
names: ["\\\\cdleft", "\\\\cdright"],
|
|
8142
8111
|
numArgs: 1,
|
|
8143
8112
|
handler(_ref, args) {
|
|
8144
|
-
let
|
|
8145
|
-
|
|
8146
|
-
funcName
|
|
8147
|
-
} = _ref;
|
|
8113
|
+
let parser = _ref.parser,
|
|
8114
|
+
funcName = _ref.funcName;
|
|
8148
8115
|
return {
|
|
8149
8116
|
type: "cdlabel",
|
|
8150
8117
|
mode: parser.mode,
|
|
@@ -8184,9 +8151,7 @@ defineFunction({
|
|
|
8184
8151
|
names: ["\\\\cdparent"],
|
|
8185
8152
|
numArgs: 1,
|
|
8186
8153
|
handler(_ref2, args) {
|
|
8187
|
-
let
|
|
8188
|
-
parser
|
|
8189
|
-
} = _ref2;
|
|
8154
|
+
let parser = _ref2.parser;
|
|
8190
8155
|
return {
|
|
8191
8156
|
type: "cdlabelparent",
|
|
8192
8157
|
mode: parser.mode,
|
|
@@ -8219,9 +8184,7 @@ defineFunction({
|
|
|
8219
8184
|
numArgs: 1,
|
|
8220
8185
|
allowedInText: true,
|
|
8221
8186
|
handler(_ref, args) {
|
|
8222
|
-
let
|
|
8223
|
-
parser
|
|
8224
|
-
} = _ref;
|
|
8187
|
+
let parser = _ref.parser;
|
|
8225
8188
|
const arg = assertNodeType(args[0], "ordgroup");
|
|
8226
8189
|
const group = arg.body;
|
|
8227
8190
|
let number = "";
|
|
@@ -8280,9 +8243,7 @@ defineFunction({
|
|
|
8280
8243
|
allowedInText: true,
|
|
8281
8244
|
argTypes: ["color", "original"],
|
|
8282
8245
|
handler(_ref, args) {
|
|
8283
|
-
let
|
|
8284
|
-
parser
|
|
8285
|
-
} = _ref;
|
|
8246
|
+
let parser = _ref.parser;
|
|
8286
8247
|
const color = assertNodeType(args[0], "color-token").color;
|
|
8287
8248
|
const body = args[1];
|
|
8288
8249
|
return {
|
|
@@ -8302,10 +8263,8 @@ defineFunction({
|
|
|
8302
8263
|
allowedInText: true,
|
|
8303
8264
|
argTypes: ["color"],
|
|
8304
8265
|
handler(_ref2, args) {
|
|
8305
|
-
let
|
|
8306
|
-
|
|
8307
|
-
breakOnTokenText
|
|
8308
|
-
} = _ref2;
|
|
8266
|
+
let parser = _ref2.parser,
|
|
8267
|
+
breakOnTokenText = _ref2.breakOnTokenText;
|
|
8309
8268
|
const color = assertNodeType(args[0], "color-token").color;
|
|
8310
8269
|
|
|
8311
8270
|
// Set macro \current@color in current namespace to store the current
|
|
@@ -8341,9 +8300,7 @@ defineFunction({
|
|
|
8341
8300
|
numOptionalArgs: 0,
|
|
8342
8301
|
allowedInText: true,
|
|
8343
8302
|
handler(_ref, args, optArgs) {
|
|
8344
|
-
let
|
|
8345
|
-
parser
|
|
8346
|
-
} = _ref;
|
|
8303
|
+
let parser = _ref.parser;
|
|
8347
8304
|
const size = parser.gullet.future().text === "[" ? parser.parseSizeGroup(true) : null;
|
|
8348
8305
|
const newLine = !parser.settings.displayMode || !parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode");
|
|
8349
8306
|
return {
|
|
@@ -8359,7 +8316,7 @@ defineFunction({
|
|
|
8359
8316
|
htmlBuilder(group, options) {
|
|
8360
8317
|
const span = makeSpan(["mspace"], [], options);
|
|
8361
8318
|
if (group.newLine) {
|
|
8362
|
-
span.classes.push("newline");
|
|
8319
|
+
span.classes.push("katex-newline");
|
|
8363
8320
|
if (group.size) {
|
|
8364
8321
|
span.style.marginTop = makeEm(calculateSize(group.size, options));
|
|
8365
8322
|
}
|
|
@@ -8438,10 +8395,8 @@ defineFunction({
|
|
|
8438
8395
|
numArgs: 0,
|
|
8439
8396
|
allowedInText: true,
|
|
8440
8397
|
handler(_ref) {
|
|
8441
|
-
let
|
|
8442
|
-
|
|
8443
|
-
funcName
|
|
8444
|
-
} = _ref;
|
|
8398
|
+
let parser = _ref.parser,
|
|
8399
|
+
funcName = _ref.funcName;
|
|
8445
8400
|
parser.consumeSpaces();
|
|
8446
8401
|
const token = parser.fetch();
|
|
8447
8402
|
if (globalMap[token.text]) {
|
|
@@ -8466,10 +8421,8 @@ defineFunction({
|
|
|
8466
8421
|
allowedInText: true,
|
|
8467
8422
|
primitive: true,
|
|
8468
8423
|
handler(_ref2) {
|
|
8469
|
-
let
|
|
8470
|
-
|
|
8471
|
-
funcName
|
|
8472
|
-
} = _ref2;
|
|
8424
|
+
let parser = _ref2.parser,
|
|
8425
|
+
funcName = _ref2.funcName;
|
|
8473
8426
|
let tok = parser.gullet.popToken();
|
|
8474
8427
|
const name = tok.text;
|
|
8475
8428
|
if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
|
|
@@ -8510,9 +8463,8 @@ defineFunction({
|
|
|
8510
8463
|
}
|
|
8511
8464
|
}
|
|
8512
8465
|
// replacement text, enclosed in '{' and '}' and properly nested
|
|
8513
|
-
let
|
|
8514
|
-
tokens
|
|
8515
|
-
} = parser.gullet.consumeArg();
|
|
8466
|
+
let _parser$gullet$consum = parser.gullet.consumeArg(),
|
|
8467
|
+
tokens = _parser$gullet$consum.tokens;
|
|
8516
8468
|
if (insert) {
|
|
8517
8469
|
tokens.unshift(insert);
|
|
8518
8470
|
}
|
|
@@ -8545,10 +8497,8 @@ defineFunction({
|
|
|
8545
8497
|
allowedInText: true,
|
|
8546
8498
|
primitive: true,
|
|
8547
8499
|
handler(_ref3) {
|
|
8548
|
-
let
|
|
8549
|
-
|
|
8550
|
-
funcName
|
|
8551
|
-
} = _ref3;
|
|
8500
|
+
let parser = _ref3.parser,
|
|
8501
|
+
funcName = _ref3.funcName;
|
|
8552
8502
|
const name = checkControlSequence(parser.gullet.popToken());
|
|
8553
8503
|
parser.gullet.consumeSpaces();
|
|
8554
8504
|
const tok = getRHS(parser);
|
|
@@ -8569,10 +8519,8 @@ defineFunction({
|
|
|
8569
8519
|
allowedInText: true,
|
|
8570
8520
|
primitive: true,
|
|
8571
8521
|
handler(_ref4) {
|
|
8572
|
-
let
|
|
8573
|
-
|
|
8574
|
-
funcName
|
|
8575
|
-
} = _ref4;
|
|
8522
|
+
let parser = _ref4.parser,
|
|
8523
|
+
funcName = _ref4.funcName;
|
|
8576
8524
|
const name = checkControlSequence(parser.gullet.popToken());
|
|
8577
8525
|
const middle = parser.gullet.popToken();
|
|
8578
8526
|
const tok = parser.gullet.popToken();
|
|
@@ -9641,7 +9589,7 @@ const enclose_htmlBuilder = (group, options) => {
|
|
|
9641
9589
|
// subjects that should get the "tall" treatment.
|
|
9642
9590
|
const isSingleChar = isCharacterBox(group.body);
|
|
9643
9591
|
if (label === "sout") {
|
|
9644
|
-
img = makeSpan(["stretchy", "sout"]);
|
|
9592
|
+
img = makeSpan(["katex-stretchy", "katex-sout"]);
|
|
9645
9593
|
img.height = options.fontMetrics().defaultRuleThickness / scale;
|
|
9646
9594
|
imgShift = -0.5 * options.fontMetrics().xHeight;
|
|
9647
9595
|
} else if (label === "phase") {
|
|
@@ -9825,10 +9773,8 @@ defineFunction({
|
|
|
9825
9773
|
allowedInText: true,
|
|
9826
9774
|
argTypes: ["color", "hbox"],
|
|
9827
9775
|
handler(_ref, args, optArgs) {
|
|
9828
|
-
let
|
|
9829
|
-
|
|
9830
|
-
funcName
|
|
9831
|
-
} = _ref;
|
|
9776
|
+
let parser = _ref.parser,
|
|
9777
|
+
funcName = _ref.funcName;
|
|
9832
9778
|
const color = assertNodeType(args[0], "color-token").color;
|
|
9833
9779
|
const body = args[1];
|
|
9834
9780
|
return {
|
|
@@ -9849,10 +9795,8 @@ defineFunction({
|
|
|
9849
9795
|
allowedInText: true,
|
|
9850
9796
|
argTypes: ["color", "color", "hbox"],
|
|
9851
9797
|
handler(_ref2, args, optArgs) {
|
|
9852
|
-
let
|
|
9853
|
-
|
|
9854
|
-
funcName
|
|
9855
|
-
} = _ref2;
|
|
9798
|
+
let parser = _ref2.parser,
|
|
9799
|
+
funcName = _ref2.funcName;
|
|
9856
9800
|
const borderColor = assertNodeType(args[0], "color-token").color;
|
|
9857
9801
|
const backgroundColor = assertNodeType(args[1], "color-token").color;
|
|
9858
9802
|
const body = args[2];
|
|
@@ -9873,9 +9817,7 @@ defineFunction({
|
|
|
9873
9817
|
argTypes: ["hbox"],
|
|
9874
9818
|
allowedInText: true,
|
|
9875
9819
|
handler(_ref3, args) {
|
|
9876
|
-
let
|
|
9877
|
-
parser
|
|
9878
|
-
} = _ref3;
|
|
9820
|
+
let parser = _ref3.parser;
|
|
9879
9821
|
return {
|
|
9880
9822
|
type: "enclose",
|
|
9881
9823
|
mode: parser.mode,
|
|
@@ -9889,10 +9831,8 @@ defineFunction({
|
|
|
9889
9831
|
names: ["\\cancel", "\\bcancel", "\\xcancel", "\\phase"],
|
|
9890
9832
|
numArgs: 1,
|
|
9891
9833
|
handler(_ref4, args) {
|
|
9892
|
-
let
|
|
9893
|
-
|
|
9894
|
-
funcName
|
|
9895
|
-
} = _ref4;
|
|
9834
|
+
let parser = _ref4.parser,
|
|
9835
|
+
funcName = _ref4.funcName;
|
|
9896
9836
|
const body = args[0];
|
|
9897
9837
|
return {
|
|
9898
9838
|
type: "enclose",
|
|
@@ -9908,10 +9848,8 @@ defineFunction({
|
|
|
9908
9848
|
numArgs: 1,
|
|
9909
9849
|
allowedInText: true,
|
|
9910
9850
|
handler(_ref5, args) {
|
|
9911
|
-
let
|
|
9912
|
-
|
|
9913
|
-
funcName
|
|
9914
|
-
} = _ref5;
|
|
9851
|
+
let parser = _ref5.parser,
|
|
9852
|
+
funcName = _ref5.funcName;
|
|
9915
9853
|
if (parser.mode === "math") {
|
|
9916
9854
|
parser.settings.reportNonstrict("mathVsSout", "LaTeX's \\sout works only in text mode");
|
|
9917
9855
|
}
|
|
@@ -9931,9 +9869,7 @@ defineFunction({
|
|
|
9931
9869
|
argTypes: ["hbox"],
|
|
9932
9870
|
allowedInText: false,
|
|
9933
9871
|
handler(_ref6, args) {
|
|
9934
|
-
let
|
|
9935
|
-
parser
|
|
9936
|
-
} = _ref6;
|
|
9872
|
+
let parser = _ref6.parser;
|
|
9937
9873
|
return {
|
|
9938
9874
|
type: "enclose",
|
|
9939
9875
|
mode: parser.mode,
|
|
@@ -9981,14 +9917,12 @@ defineFunction({
|
|
|
9981
9917
|
*/
|
|
9982
9918
|
const _environments = {};
|
|
9983
9919
|
function defineEnvironment(_ref) {
|
|
9984
|
-
let
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
mathmlBuilder
|
|
9991
|
-
} = _ref;
|
|
9920
|
+
let type = _ref.type,
|
|
9921
|
+
names = _ref.names,
|
|
9922
|
+
props = _ref.props,
|
|
9923
|
+
handler = _ref.handler,
|
|
9924
|
+
htmlBuilder = _ref.htmlBuilder,
|
|
9925
|
+
mathmlBuilder = _ref.mathmlBuilder;
|
|
9992
9926
|
// Set default values of environments.
|
|
9993
9927
|
const data = {
|
|
9994
9928
|
type,
|
|
@@ -10182,18 +10116,16 @@ function getAutoTag(name) {
|
|
|
10182
10116
|
* ("text", "display", etc.), then each cell is cast into that style.
|
|
10183
10117
|
*/
|
|
10184
10118
|
function parseArray(parser, _ref, style) {
|
|
10185
|
-
let
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
leqno
|
|
10196
|
-
} = _ref;
|
|
10119
|
+
let hskipBeforeAndAfter = _ref.hskipBeforeAndAfter,
|
|
10120
|
+
addJot = _ref.addJot,
|
|
10121
|
+
cols = _ref.cols,
|
|
10122
|
+
arraystretch = _ref.arraystretch,
|
|
10123
|
+
colSeparationType = _ref.colSeparationType,
|
|
10124
|
+
autoTag = _ref.autoTag,
|
|
10125
|
+
singleRow = _ref.singleRow,
|
|
10126
|
+
emptySingleRow = _ref.emptySingleRow,
|
|
10127
|
+
maxNumCols = _ref.maxNumCols,
|
|
10128
|
+
leqno = _ref.leqno;
|
|
10197
10129
|
parser.gullet.beginGroup();
|
|
10198
10130
|
if (!singleRow) {
|
|
10199
10131
|
// \cr is equivalent to \\ without the optional size argument (see below)
|
|
@@ -10567,8 +10499,8 @@ const array_htmlBuilder = function (group, options) {
|
|
|
10567
10499
|
|
|
10568
10500
|
// Add \hline(s), if any.
|
|
10569
10501
|
if (hlines.length > 0) {
|
|
10570
|
-
const line = makeLineSpan("hline", options, ruleThickness);
|
|
10571
|
-
const dashes = makeLineSpan("hdashline", options, ruleThickness);
|
|
10502
|
+
const line = makeLineSpan("katex-hline", options, ruleThickness);
|
|
10503
|
+
const dashes = makeLineSpan("katex-hdashline", options, ruleThickness);
|
|
10572
10504
|
const vListElems = [{
|
|
10573
10505
|
type: "elem",
|
|
10574
10506
|
elem: tableBody,
|
|
@@ -10603,7 +10535,7 @@ const array_htmlBuilder = function (group, options) {
|
|
|
10603
10535
|
positionType: "individualShift",
|
|
10604
10536
|
children: tagSpans
|
|
10605
10537
|
}, options);
|
|
10606
|
-
const tagCol = makeSpan(["tag"], [eqnNumCol], options);
|
|
10538
|
+
const tagCol = makeSpan(["katex-tag"], [eqnNumCol], options);
|
|
10607
10539
|
return makeFragment([tableBody, tagCol]);
|
|
10608
10540
|
}
|
|
10609
10541
|
};
|
|
@@ -11171,10 +11103,8 @@ defineFunction({
|
|
|
11171
11103
|
numArgs: 1,
|
|
11172
11104
|
argTypes: ["text"],
|
|
11173
11105
|
handler(_ref, args) {
|
|
11174
|
-
let
|
|
11175
|
-
|
|
11176
|
-
funcName
|
|
11177
|
-
} = _ref;
|
|
11106
|
+
let parser = _ref.parser,
|
|
11107
|
+
funcName = _ref.funcName;
|
|
11178
11108
|
const nameGroup = args[0];
|
|
11179
11109
|
if (nameGroup.type !== "ordgroup") {
|
|
11180
11110
|
throw new src_ParseError("Invalid environment name", nameGroup);
|
|
@@ -11185,16 +11115,15 @@ defineFunction({
|
|
|
11185
11115
|
}
|
|
11186
11116
|
if (funcName === "\\begin") {
|
|
11187
11117
|
// begin...end is similar to left...right
|
|
11188
|
-
if (!
|
|
11118
|
+
if (!Object.prototype.hasOwnProperty.call(src_environments, envName)) {
|
|
11189
11119
|
throw new src_ParseError("No such environment: " + envName, nameGroup);
|
|
11190
11120
|
}
|
|
11191
11121
|
// Build the environment object. Arguments and other information will
|
|
11192
11122
|
// be made available to the begin and end methods using properties.
|
|
11193
11123
|
const env = src_environments[envName];
|
|
11194
|
-
const {
|
|
11195
|
-
args,
|
|
11196
|
-
optArgs
|
|
11197
|
-
} = parser.parseArguments("\\begin{" + envName + "}", env);
|
|
11124
|
+
const _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env),
|
|
11125
|
+
args = _parser$parseArgument.args,
|
|
11126
|
+
optArgs = _parser$parseArgument.optArgs;
|
|
11198
11127
|
const context = {
|
|
11199
11128
|
mode: parser.mode,
|
|
11200
11129
|
envName,
|
|
@@ -11256,10 +11185,8 @@ defineFunction({
|
|
|
11256
11185
|
numArgs: 1,
|
|
11257
11186
|
allowedInArgument: true,
|
|
11258
11187
|
handler: (_ref, args) => {
|
|
11259
|
-
let
|
|
11260
|
-
|
|
11261
|
-
funcName
|
|
11262
|
-
} = _ref;
|
|
11188
|
+
let parser = _ref.parser,
|
|
11189
|
+
funcName = _ref.funcName;
|
|
11263
11190
|
const body = normalizeArgument(args[0]);
|
|
11264
11191
|
const func = funcName in fontAliases ? fontAliases[funcName] : funcName;
|
|
11265
11192
|
return {
|
|
@@ -11277,9 +11204,7 @@ defineFunction({
|
|
|
11277
11204
|
names: ["\\boldsymbol", "\\bm"],
|
|
11278
11205
|
numArgs: 1,
|
|
11279
11206
|
handler: (_ref2, args) => {
|
|
11280
|
-
let
|
|
11281
|
-
parser
|
|
11282
|
-
} = _ref2;
|
|
11207
|
+
let parser = _ref2.parser;
|
|
11283
11208
|
const body = args[0];
|
|
11284
11209
|
// amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the
|
|
11285
11210
|
// argument's bin|rel|ord status
|
|
@@ -11305,14 +11230,10 @@ defineFunction({
|
|
|
11305
11230
|
numArgs: 0,
|
|
11306
11231
|
allowedInText: true,
|
|
11307
11232
|
handler: (_ref3, args) => {
|
|
11308
|
-
let
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
} = _ref3;
|
|
11313
|
-
const {
|
|
11314
|
-
mode
|
|
11315
|
-
} = parser;
|
|
11233
|
+
let parser = _ref3.parser,
|
|
11234
|
+
funcName = _ref3.funcName,
|
|
11235
|
+
breakOnTokenText = _ref3.breakOnTokenText;
|
|
11236
|
+
const mode = parser.mode;
|
|
11316
11237
|
const body = parser.parseExpression(true, breakOnTokenText);
|
|
11317
11238
|
return {
|
|
11318
11239
|
type: "font",
|
|
@@ -11521,10 +11442,8 @@ defineFunction({
|
|
|
11521
11442
|
numArgs: 2,
|
|
11522
11443
|
allowedInArgument: true,
|
|
11523
11444
|
handler: (_ref, args) => {
|
|
11524
|
-
let
|
|
11525
|
-
|
|
11526
|
-
funcName
|
|
11527
|
-
} = _ref;
|
|
11445
|
+
let parser = _ref.parser,
|
|
11446
|
+
funcName = _ref.funcName;
|
|
11528
11447
|
const numer = args[0];
|
|
11529
11448
|
const denom = args[1];
|
|
11530
11449
|
let hasBarLine;
|
|
@@ -11591,11 +11510,9 @@ defineFunction({
|
|
|
11591
11510
|
numArgs: 0,
|
|
11592
11511
|
infix: true,
|
|
11593
11512
|
handler(_ref2) {
|
|
11594
|
-
let
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
token
|
|
11598
|
-
} = _ref2;
|
|
11513
|
+
let parser = _ref2.parser,
|
|
11514
|
+
funcName = _ref2.funcName,
|
|
11515
|
+
token = _ref2.token;
|
|
11599
11516
|
let replaceWith;
|
|
11600
11517
|
switch (funcName) {
|
|
11601
11518
|
case "\\over":
|
|
@@ -11640,9 +11557,7 @@ defineFunction({
|
|
|
11640
11557
|
allowedInArgument: true,
|
|
11641
11558
|
argTypes: ["math", "math", "size", "text", "math", "math"],
|
|
11642
11559
|
handler(_ref3, args) {
|
|
11643
|
-
let
|
|
11644
|
-
parser
|
|
11645
|
-
} = _ref3;
|
|
11560
|
+
let parser = _ref3.parser;
|
|
11646
11561
|
const numer = args[4];
|
|
11647
11562
|
const denom = args[5];
|
|
11648
11563
|
|
|
@@ -11698,11 +11613,9 @@ defineFunction({
|
|
|
11698
11613
|
argTypes: ["size"],
|
|
11699
11614
|
infix: true,
|
|
11700
11615
|
handler(_ref4, args) {
|
|
11701
|
-
let
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
token
|
|
11705
|
-
} = _ref4;
|
|
11616
|
+
let parser = _ref4.parser,
|
|
11617
|
+
funcName = _ref4.funcName,
|
|
11618
|
+
token = _ref4.token;
|
|
11706
11619
|
return {
|
|
11707
11620
|
type: "infix",
|
|
11708
11621
|
mode: parser.mode,
|
|
@@ -11718,10 +11631,8 @@ defineFunction({
|
|
|
11718
11631
|
numArgs: 3,
|
|
11719
11632
|
argTypes: ["math", "size", "math"],
|
|
11720
11633
|
handler: (_ref5, args) => {
|
|
11721
|
-
let
|
|
11722
|
-
|
|
11723
|
-
funcName
|
|
11724
|
-
} = _ref5;
|
|
11634
|
+
let parser = _ref5.parser,
|
|
11635
|
+
funcName = _ref5.funcName;
|
|
11725
11636
|
const numer = args[0];
|
|
11726
11637
|
const barSize = assertNodeType(args[1], "infix").size;
|
|
11727
11638
|
if (!barSize) {
|
|
@@ -11865,10 +11776,8 @@ defineFunction({
|
|
|
11865
11776
|
names: ["\\overbrace", "\\underbrace", "\\overbracket", "\\underbracket"],
|
|
11866
11777
|
numArgs: 1,
|
|
11867
11778
|
handler(_ref, args) {
|
|
11868
|
-
let
|
|
11869
|
-
|
|
11870
|
-
funcName
|
|
11871
|
-
} = _ref;
|
|
11779
|
+
let parser = _ref.parser,
|
|
11780
|
+
funcName = _ref.funcName;
|
|
11872
11781
|
return {
|
|
11873
11782
|
type: "horizBrace",
|
|
11874
11783
|
mode: parser.mode,
|
|
@@ -11894,9 +11803,7 @@ defineFunction({
|
|
|
11894
11803
|
argTypes: ["url", "original"],
|
|
11895
11804
|
allowedInText: true,
|
|
11896
11805
|
handler: (_ref, args) => {
|
|
11897
|
-
let
|
|
11898
|
-
parser
|
|
11899
|
-
} = _ref;
|
|
11806
|
+
let parser = _ref.parser;
|
|
11900
11807
|
const body = args[1];
|
|
11901
11808
|
const href = assertNodeType(args[0], "url").url;
|
|
11902
11809
|
if (!parser.settings.isTrusted({
|
|
@@ -11932,9 +11839,7 @@ defineFunction({
|
|
|
11932
11839
|
argTypes: ["url"],
|
|
11933
11840
|
allowedInText: true,
|
|
11934
11841
|
handler: (_ref2, args) => {
|
|
11935
|
-
let
|
|
11936
|
-
parser
|
|
11937
|
-
} = _ref2;
|
|
11842
|
+
let parser = _ref2.parser;
|
|
11938
11843
|
const href = assertNodeType(args[0], "url").url;
|
|
11939
11844
|
if (!parser.settings.isTrusted({
|
|
11940
11845
|
command: "\\url",
|
|
@@ -11988,9 +11893,7 @@ defineFunction({
|
|
|
11988
11893
|
allowedInText: true,
|
|
11989
11894
|
primitive: true,
|
|
11990
11895
|
handler(_ref, args) {
|
|
11991
|
-
let
|
|
11992
|
-
parser
|
|
11993
|
-
} = _ref;
|
|
11896
|
+
let parser = _ref.parser;
|
|
11994
11897
|
return {
|
|
11995
11898
|
type: "hbox",
|
|
11996
11899
|
mode: parser.mode,
|
|
@@ -12019,11 +11922,9 @@ defineFunction({
|
|
|
12019
11922
|
argTypes: ["raw", "original"],
|
|
12020
11923
|
allowedInText: true,
|
|
12021
11924
|
handler: (_ref, args) => {
|
|
12022
|
-
let
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
token
|
|
12026
|
-
} = _ref;
|
|
11925
|
+
let parser = _ref.parser,
|
|
11926
|
+
funcName = _ref.funcName,
|
|
11927
|
+
token = _ref.token;
|
|
12027
11928
|
const value = assertNodeType(args[0], "raw").string;
|
|
12028
11929
|
const body = args[1];
|
|
12029
11930
|
if (parser.settings.strict) {
|
|
@@ -12092,9 +11993,11 @@ defineFunction({
|
|
|
12092
11993
|
classes.push(...group.attributes.class.trim().split(/\s+/));
|
|
12093
11994
|
}
|
|
12094
11995
|
const span = makeSpan(classes, elements, options);
|
|
12095
|
-
for (const
|
|
12096
|
-
|
|
12097
|
-
|
|
11996
|
+
for (const _ref2 of Object.entries(group.attributes)) {
|
|
11997
|
+
const attr = _ref2[0];
|
|
11998
|
+
const value = _ref2[1];
|
|
11999
|
+
if (attr !== "class") {
|
|
12000
|
+
span.setAttribute(attr, value);
|
|
12098
12001
|
}
|
|
12099
12002
|
}
|
|
12100
12003
|
return span;
|
|
@@ -12115,9 +12018,7 @@ defineFunction({
|
|
|
12115
12018
|
allowedInArgument: true,
|
|
12116
12019
|
allowedInText: true,
|
|
12117
12020
|
handler: (_ref, args) => {
|
|
12118
|
-
let
|
|
12119
|
-
parser
|
|
12120
|
-
} = _ref;
|
|
12021
|
+
let parser = _ref.parser;
|
|
12121
12022
|
return {
|
|
12122
12023
|
type: "htmlmathml",
|
|
12123
12024
|
mode: parser.mode,
|
|
@@ -12172,9 +12073,7 @@ defineFunction({
|
|
|
12172
12073
|
argTypes: ["raw", "url"],
|
|
12173
12074
|
allowedInText: false,
|
|
12174
12075
|
handler: (_ref, args, optArgs) => {
|
|
12175
|
-
let
|
|
12176
|
-
parser
|
|
12177
|
-
} = _ref;
|
|
12076
|
+
let parser = _ref.parser;
|
|
12178
12077
|
let width = {
|
|
12179
12078
|
number: 0,
|
|
12180
12079
|
unit: "em"
|
|
@@ -12300,10 +12199,8 @@ defineFunction({
|
|
|
12300
12199
|
primitive: true,
|
|
12301
12200
|
allowedInText: true,
|
|
12302
12201
|
handler(_ref, args) {
|
|
12303
|
-
let
|
|
12304
|
-
|
|
12305
|
-
funcName
|
|
12306
|
-
} = _ref;
|
|
12202
|
+
let parser = _ref.parser,
|
|
12203
|
+
funcName = _ref.funcName;
|
|
12307
12204
|
const size = assertNodeType(args[0], "size");
|
|
12308
12205
|
if (parser.settings.strict) {
|
|
12309
12206
|
const mathFunction = funcName[1] === 'm'; // \mkern, \mskip
|
|
@@ -12350,10 +12247,8 @@ defineFunction({
|
|
|
12350
12247
|
numArgs: 1,
|
|
12351
12248
|
allowedInText: true,
|
|
12352
12249
|
handler: (_ref, args) => {
|
|
12353
|
-
let
|
|
12354
|
-
|
|
12355
|
-
funcName
|
|
12356
|
-
} = _ref;
|
|
12250
|
+
let parser = _ref.parser,
|
|
12251
|
+
funcName = _ref.funcName;
|
|
12357
12252
|
const body = args[0];
|
|
12358
12253
|
return {
|
|
12359
12254
|
type: "lap",
|
|
@@ -12368,12 +12263,12 @@ defineFunction({
|
|
|
12368
12263
|
if (group.alignment === "clap") {
|
|
12369
12264
|
// ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/
|
|
12370
12265
|
inner = makeSpan([], [buildGroup(group.body, options)]);
|
|
12371
|
-
// wrap, since CSS will center a .clap > .inner > span
|
|
12372
|
-
inner = makeSpan(["inner"], [inner], options);
|
|
12266
|
+
// wrap, since CSS will center a .clap > .katex-inner > span
|
|
12267
|
+
inner = makeSpan(["katex-inner"], [inner], options);
|
|
12373
12268
|
} else {
|
|
12374
|
-
inner = makeSpan(["inner"], [buildGroup(group.body, options)]);
|
|
12269
|
+
inner = makeSpan(["katex-inner"], [buildGroup(group.body, options)]);
|
|
12375
12270
|
}
|
|
12376
|
-
const fix = makeSpan(["fix"], []);
|
|
12271
|
+
const fix = makeSpan(["katex-fix"], []);
|
|
12377
12272
|
let node = makeSpan([group.alignment], [inner, fix], options);
|
|
12378
12273
|
|
|
12379
12274
|
// At this point, we have correctly set horizontal alignment of the
|
|
@@ -12381,7 +12276,7 @@ defineFunction({
|
|
|
12381
12276
|
// Next, use a strut to set the height of the HTML bounding box.
|
|
12382
12277
|
// Otherwise, a tall argument may be misplaced.
|
|
12383
12278
|
// This code resolved issue #1153
|
|
12384
|
-
const strut = makeSpan(["strut"]);
|
|
12279
|
+
const strut = makeSpan(["katex-strut"]);
|
|
12385
12280
|
strut.style.height = makeEm(node.height + node.depth);
|
|
12386
12281
|
if (node.depth) {
|
|
12387
12282
|
strut.style.verticalAlign = makeEm(-node.depth);
|
|
@@ -12390,8 +12285,8 @@ defineFunction({
|
|
|
12390
12285
|
|
|
12391
12286
|
// Next, prevent vertical misplacement when next to something tall.
|
|
12392
12287
|
// This code resolves issue #1234
|
|
12393
|
-
node = makeSpan(["thinbox"], [node], options);
|
|
12394
|
-
return makeSpan(["mord", "vbox"], [node], options);
|
|
12288
|
+
node = makeSpan(["katex-thinbox"], [node], options);
|
|
12289
|
+
return makeSpan(["mord", "katex-vbox"], [node], options);
|
|
12395
12290
|
},
|
|
12396
12291
|
mathmlBuilder: (group, options) => {
|
|
12397
12292
|
// mathllap, mathrlap, mathclap
|
|
@@ -12416,10 +12311,8 @@ defineFunction({
|
|
|
12416
12311
|
allowedInText: true,
|
|
12417
12312
|
allowedInMath: false,
|
|
12418
12313
|
handler(_ref, args) {
|
|
12419
|
-
let
|
|
12420
|
-
|
|
12421
|
-
parser
|
|
12422
|
-
} = _ref;
|
|
12314
|
+
let funcName = _ref.funcName,
|
|
12315
|
+
parser = _ref.parser;
|
|
12423
12316
|
const outerMode = parser.mode;
|
|
12424
12317
|
parser.switchMode("math");
|
|
12425
12318
|
const close = funcName === "\\(" ? "\\)" : "$";
|
|
@@ -12474,9 +12367,7 @@ defineFunction({
|
|
|
12474
12367
|
numArgs: 4,
|
|
12475
12368
|
primitive: true,
|
|
12476
12369
|
handler: (_ref, args) => {
|
|
12477
|
-
let
|
|
12478
|
-
parser
|
|
12479
|
-
} = _ref;
|
|
12370
|
+
let parser = _ref.parser;
|
|
12480
12371
|
return {
|
|
12481
12372
|
type: "mathchoice",
|
|
12482
12373
|
mode: parser.mode,
|
|
@@ -12790,10 +12681,8 @@ defineFunction({
|
|
|
12790
12681
|
names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22c0", "\u22c1", "\u22c2", "\u22c3", "\u2a00", "\u2a01", "\u2a02", "\u2a04", "\u2a06"],
|
|
12791
12682
|
numArgs: 0,
|
|
12792
12683
|
handler: (_ref, args) => {
|
|
12793
|
-
let
|
|
12794
|
-
|
|
12795
|
-
funcName
|
|
12796
|
-
} = _ref;
|
|
12684
|
+
let parser = _ref.parser,
|
|
12685
|
+
funcName = _ref.funcName;
|
|
12797
12686
|
let fName = funcName;
|
|
12798
12687
|
if (fName.length === 1) {
|
|
12799
12688
|
fName = singleCharBigOps[fName];
|
|
@@ -12816,9 +12705,7 @@ defineFunction({
|
|
|
12816
12705
|
numArgs: 1,
|
|
12817
12706
|
primitive: true,
|
|
12818
12707
|
handler: (_ref2, args) => {
|
|
12819
|
-
let
|
|
12820
|
-
parser
|
|
12821
|
-
} = _ref2;
|
|
12708
|
+
let parser = _ref2.parser;
|
|
12822
12709
|
const body = args[0];
|
|
12823
12710
|
return {
|
|
12824
12711
|
type: "op",
|
|
@@ -12849,10 +12736,8 @@ defineFunction({
|
|
|
12849
12736
|
names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"],
|
|
12850
12737
|
numArgs: 0,
|
|
12851
12738
|
handler(_ref3) {
|
|
12852
|
-
let
|
|
12853
|
-
|
|
12854
|
-
funcName
|
|
12855
|
-
} = _ref3;
|
|
12739
|
+
let parser = _ref3.parser,
|
|
12740
|
+
funcName = _ref3.funcName;
|
|
12856
12741
|
return {
|
|
12857
12742
|
type: "op",
|
|
12858
12743
|
mode: parser.mode,
|
|
@@ -12870,10 +12755,8 @@ defineFunction({
|
|
|
12870
12755
|
names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
|
|
12871
12756
|
numArgs: 0,
|
|
12872
12757
|
handler(_ref4) {
|
|
12873
|
-
let
|
|
12874
|
-
|
|
12875
|
-
funcName
|
|
12876
|
-
} = _ref4;
|
|
12758
|
+
let parser = _ref4.parser,
|
|
12759
|
+
funcName = _ref4.funcName;
|
|
12877
12760
|
return {
|
|
12878
12761
|
type: "op",
|
|
12879
12762
|
mode: parser.mode,
|
|
@@ -12892,10 +12775,8 @@ defineFunction({
|
|
|
12892
12775
|
numArgs: 0,
|
|
12893
12776
|
allowedInArgument: true,
|
|
12894
12777
|
handler(_ref5) {
|
|
12895
|
-
let
|
|
12896
|
-
|
|
12897
|
-
funcName
|
|
12898
|
-
} = _ref5;
|
|
12778
|
+
let parser = _ref5.parser,
|
|
12779
|
+
funcName = _ref5.funcName;
|
|
12899
12780
|
let fName = funcName;
|
|
12900
12781
|
if (fName.length === 1) {
|
|
12901
12782
|
fName = singleCharIntegrals[fName];
|
|
@@ -13035,10 +12916,8 @@ defineFunction({
|
|
|
13035
12916
|
names: ["\\operatorname@", "\\operatornamewithlimits"],
|
|
13036
12917
|
numArgs: 1,
|
|
13037
12918
|
handler: (_ref, args) => {
|
|
13038
|
-
let
|
|
13039
|
-
|
|
13040
|
-
funcName
|
|
13041
|
-
} = _ref;
|
|
12919
|
+
let parser = _ref.parser,
|
|
12920
|
+
funcName = _ref.funcName;
|
|
13042
12921
|
const body = args[0];
|
|
13043
12922
|
return {
|
|
13044
12923
|
type: "operatorname",
|
|
@@ -13081,9 +12960,7 @@ defineFunction({
|
|
|
13081
12960
|
names: ["\\overline"],
|
|
13082
12961
|
numArgs: 1,
|
|
13083
12962
|
handler(_ref, args) {
|
|
13084
|
-
let
|
|
13085
|
-
parser
|
|
13086
|
-
} = _ref;
|
|
12963
|
+
let parser = _ref.parser;
|
|
13087
12964
|
const body = args[0];
|
|
13088
12965
|
return {
|
|
13089
12966
|
type: "overline",
|
|
@@ -13118,7 +12995,7 @@ defineFunction({
|
|
|
13118
12995
|
size: defaultRuleThickness
|
|
13119
12996
|
}]
|
|
13120
12997
|
}, options);
|
|
13121
|
-
return makeSpan(["mord", "overline"], [vlist], options);
|
|
12998
|
+
return makeSpan(["mord", "katex-overline"], [vlist], options);
|
|
13122
12999
|
},
|
|
13123
13000
|
mathmlBuilder(group, options) {
|
|
13124
13001
|
const operator = new MathNode("mo", [new TextNode("\u203e")]);
|
|
@@ -13141,9 +13018,7 @@ defineFunction({
|
|
|
13141
13018
|
numArgs: 1,
|
|
13142
13019
|
allowedInText: true,
|
|
13143
13020
|
handler: (_ref, args) => {
|
|
13144
|
-
let
|
|
13145
|
-
parser
|
|
13146
|
-
} = _ref;
|
|
13021
|
+
let parser = _ref.parser;
|
|
13147
13022
|
const body = args[0];
|
|
13148
13023
|
return {
|
|
13149
13024
|
type: "phantom",
|
|
@@ -13170,9 +13045,7 @@ defineFunction({
|
|
|
13170
13045
|
numArgs: 1,
|
|
13171
13046
|
allowedInText: true,
|
|
13172
13047
|
handler: (_ref2, args) => {
|
|
13173
|
-
let
|
|
13174
|
-
parser
|
|
13175
|
-
} = _ref2;
|
|
13048
|
+
let parser = _ref2.parser;
|
|
13176
13049
|
const body = args[0];
|
|
13177
13050
|
return {
|
|
13178
13051
|
type: "vphantom",
|
|
@@ -13181,8 +13054,8 @@ defineFunction({
|
|
|
13181
13054
|
};
|
|
13182
13055
|
},
|
|
13183
13056
|
htmlBuilder: (group, options) => {
|
|
13184
|
-
const inner = makeSpan(["inner"], [buildGroup(group.body, options.withPhantom())]);
|
|
13185
|
-
const fix = makeSpan(["fix"], []);
|
|
13057
|
+
const inner = makeSpan(["katex-inner"], [buildGroup(group.body, options.withPhantom())]);
|
|
13058
|
+
const fix = makeSpan(["katex-fix"], []);
|
|
13186
13059
|
return makeSpan(["mord", "rlap"], [inner, fix], options);
|
|
13187
13060
|
},
|
|
13188
13061
|
mathmlBuilder: (group, options) => {
|
|
@@ -13210,9 +13083,7 @@ defineFunction({
|
|
|
13210
13083
|
argTypes: ["size", "hbox"],
|
|
13211
13084
|
allowedInText: true,
|
|
13212
13085
|
handler(_ref, args) {
|
|
13213
|
-
let
|
|
13214
|
-
parser
|
|
13215
|
-
} = _ref;
|
|
13086
|
+
let parser = _ref.parser;
|
|
13216
13087
|
const amount = assertNodeType(args[0], "size").value;
|
|
13217
13088
|
const body = args[1];
|
|
13218
13089
|
return {
|
|
@@ -13250,9 +13121,7 @@ defineFunction({
|
|
|
13250
13121
|
allowedInText: true,
|
|
13251
13122
|
allowedInArgument: true,
|
|
13252
13123
|
handler(_ref) {
|
|
13253
|
-
let
|
|
13254
|
-
parser
|
|
13255
|
-
} = _ref;
|
|
13124
|
+
let parser = _ref.parser;
|
|
13256
13125
|
return {
|
|
13257
13126
|
type: "internal",
|
|
13258
13127
|
mode: parser.mode
|
|
@@ -13274,9 +13143,7 @@ defineFunction({
|
|
|
13274
13143
|
allowedInMath: true,
|
|
13275
13144
|
argTypes: ["size", "size", "size"],
|
|
13276
13145
|
handler(_ref, args, optArgs) {
|
|
13277
|
-
let
|
|
13278
|
-
parser
|
|
13279
|
-
} = _ref;
|
|
13146
|
+
let parser = _ref.parser;
|
|
13280
13147
|
const shift = optArgs[0];
|
|
13281
13148
|
const width = assertNodeType(args[0], "size");
|
|
13282
13149
|
const height = assertNodeType(args[1], "size");
|
|
@@ -13290,7 +13157,7 @@ defineFunction({
|
|
|
13290
13157
|
},
|
|
13291
13158
|
htmlBuilder(group, options) {
|
|
13292
13159
|
// Make an empty span for the rule
|
|
13293
|
-
const rule = makeSpan(["mord", "rule"], [], options);
|
|
13160
|
+
const rule = makeSpan(["mord", "katex-rule"], [], options);
|
|
13294
13161
|
|
|
13295
13162
|
// Calculate the shift, width, and height of the rule, and account for units
|
|
13296
13163
|
const width = calculateSize(group.width, options);
|
|
@@ -13346,7 +13213,7 @@ function sizingGroup(value, options, baseOptions) {
|
|
|
13346
13213
|
// Add size-resetting classes to the inner list and set maxFontSize
|
|
13347
13214
|
// manually. Handle nested size changes.
|
|
13348
13215
|
for (let i = 0; i < inner.length; i++) {
|
|
13349
|
-
const pos = inner[i].classes.indexOf("sizing");
|
|
13216
|
+
const pos = inner[i].classes.indexOf("katex-sizing");
|
|
13350
13217
|
if (pos < 0) {
|
|
13351
13218
|
Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions));
|
|
13352
13219
|
} else if (inner[i].classes[pos + 1] === "reset-size" + options.size) {
|
|
@@ -13374,11 +13241,9 @@ defineFunction({
|
|
|
13374
13241
|
numArgs: 0,
|
|
13375
13242
|
allowedInText: true,
|
|
13376
13243
|
handler: (_ref, args) => {
|
|
13377
|
-
let
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
parser
|
|
13381
|
-
} = _ref;
|
|
13244
|
+
let breakOnTokenText = _ref.breakOnTokenText,
|
|
13245
|
+
funcName = _ref.funcName,
|
|
13246
|
+
parser = _ref.parser;
|
|
13382
13247
|
const body = parser.parseExpression(false, breakOnTokenText);
|
|
13383
13248
|
return {
|
|
13384
13249
|
type: "sizing",
|
|
@@ -13418,9 +13283,7 @@ defineFunction({
|
|
|
13418
13283
|
numOptionalArgs: 1,
|
|
13419
13284
|
allowedInText: true,
|
|
13420
13285
|
handler: (_ref, args, optArgs) => {
|
|
13421
|
-
let
|
|
13422
|
-
parser
|
|
13423
|
-
} = _ref;
|
|
13286
|
+
let parser = _ref.parser;
|
|
13424
13287
|
let smashHeight = false;
|
|
13425
13288
|
let smashDepth = false;
|
|
13426
13289
|
const tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
|
|
@@ -13468,7 +13331,7 @@ defineFunction({
|
|
|
13468
13331
|
}
|
|
13469
13332
|
if (group.smashHeight && group.smashDepth) {
|
|
13470
13333
|
// Symmetric \smash can stay in inline layout.
|
|
13471
|
-
return makeSpan(["mord", "smash"], [node], options);
|
|
13334
|
+
return makeSpan(["mord", "katex-smash"], [node], options);
|
|
13472
13335
|
}
|
|
13473
13336
|
|
|
13474
13337
|
// In order to influence makeVList for asymmetric smashing, we have to
|
|
@@ -13526,9 +13389,7 @@ defineFunction({
|
|
|
13526
13389
|
numArgs: 1,
|
|
13527
13390
|
numOptionalArgs: 1,
|
|
13528
13391
|
handler(_ref, args, optArgs) {
|
|
13529
|
-
let
|
|
13530
|
-
parser
|
|
13531
|
-
} = _ref;
|
|
13392
|
+
let parser = _ref.parser;
|
|
13532
13393
|
const index = optArgs[0];
|
|
13533
13394
|
const body = args[0];
|
|
13534
13395
|
return {
|
|
@@ -13566,11 +13427,10 @@ defineFunction({
|
|
|
13566
13427
|
const minDelimiterHeight = inner.height + inner.depth + lineClearance + theta;
|
|
13567
13428
|
|
|
13568
13429
|
// Create a sqrt SVG of the required minimum size
|
|
13569
|
-
const
|
|
13570
|
-
span
|
|
13571
|
-
ruleWidth,
|
|
13572
|
-
advanceWidth
|
|
13573
|
-
} = makeSqrtImage(minDelimiterHeight, options);
|
|
13430
|
+
const _makeSqrtImage = makeSqrtImage(minDelimiterHeight, options),
|
|
13431
|
+
img = _makeSqrtImage.span,
|
|
13432
|
+
ruleWidth = _makeSqrtImage.ruleWidth,
|
|
13433
|
+
advanceWidth = _makeSqrtImage.advanceWidth;
|
|
13574
13434
|
const delimDepth = img.height - ruleWidth;
|
|
13575
13435
|
|
|
13576
13436
|
// Adjust the clearance based on the delimiter size
|
|
@@ -13624,15 +13484,13 @@ defineFunction({
|
|
|
13624
13484
|
}, options);
|
|
13625
13485
|
// Add a class surrounding it so we can add on the appropriate
|
|
13626
13486
|
// kerning
|
|
13627
|
-
const rootVListWrap = makeSpan(["root"], [rootVList]);
|
|
13487
|
+
const rootVListWrap = makeSpan(["katex-root"], [rootVList]);
|
|
13628
13488
|
return makeSpan(["mord", "sqrt"], [rootVListWrap, body], options);
|
|
13629
13489
|
}
|
|
13630
13490
|
},
|
|
13631
13491
|
mathmlBuilder(group, options) {
|
|
13632
|
-
const
|
|
13633
|
-
|
|
13634
|
-
index
|
|
13635
|
-
} = group;
|
|
13492
|
+
const body = group.body,
|
|
13493
|
+
index = group.index;
|
|
13636
13494
|
return index ? new MathNode("mroot", [buildMathML_buildGroup(body, options), buildMathML_buildGroup(index, options)]) : new MathNode("msqrt", [buildMathML_buildGroup(body, options)]);
|
|
13637
13495
|
}
|
|
13638
13496
|
});
|
|
@@ -13658,11 +13516,9 @@ defineFunction({
|
|
|
13658
13516
|
allowedInText: true,
|
|
13659
13517
|
primitive: true,
|
|
13660
13518
|
handler(_ref, args) {
|
|
13661
|
-
let
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
parser
|
|
13665
|
-
} = _ref;
|
|
13519
|
+
let breakOnTokenText = _ref.breakOnTokenText,
|
|
13520
|
+
funcName = _ref.funcName,
|
|
13521
|
+
parser = _ref.parser;
|
|
13666
13522
|
// parse out the implicit body
|
|
13667
13523
|
const body = parser.parseExpression(true, breakOnTokenText);
|
|
13668
13524
|
|
|
@@ -13770,11 +13626,9 @@ defineFunctionBuilders({
|
|
|
13770
13626
|
if (builderDelegate) {
|
|
13771
13627
|
return builderDelegate(group, options);
|
|
13772
13628
|
}
|
|
13773
|
-
const
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
sub: valueSub
|
|
13777
|
-
} = group;
|
|
13629
|
+
const valueBase = group.base,
|
|
13630
|
+
valueSup = group.sup,
|
|
13631
|
+
valueSub = group.sub;
|
|
13778
13632
|
const base = buildGroup(valueBase, options);
|
|
13779
13633
|
let supm;
|
|
13780
13634
|
let subm;
|
|
@@ -14036,35 +13890,28 @@ defineFunctionBuilders({
|
|
|
14036
13890
|
|
|
14037
13891
|
|
|
14038
13892
|
// A map of CSS-based spacing functions to their CSS class.
|
|
14039
|
-
const cssSpace =
|
|
14040
|
-
"\\nobreak": "nobreak",
|
|
14041
|
-
"\\allowbreak": "allowbreak"
|
|
14042
|
-
};
|
|
13893
|
+
const cssSpace = new Map([["\\nobreak", "nobreak"], ["\\allowbreak", "allowbreak"]]);
|
|
14043
13894
|
|
|
14044
13895
|
// A lookup table to determine whether a spacing function/symbol should be
|
|
14045
13896
|
// treated like a regular space character. If a symbol or command is a key
|
|
14046
13897
|
// in this table, then it should be a regular space character. Furthermore,
|
|
14047
13898
|
// the associated value may have a `className` specifying an extra CSS class
|
|
14048
13899
|
// to add to the created `span`.
|
|
14049
|
-
const regularSpace = {
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
"
|
|
14053
|
-
|
|
14054
|
-
},
|
|
14055
|
-
"\\space": {},
|
|
14056
|
-
"\\nobreakspace": {
|
|
14057
|
-
className: "nobreak"
|
|
14058
|
-
}
|
|
14059
|
-
};
|
|
13900
|
+
const regularSpace = new Map([[" ", {}], ["\\ ", {}], ["~", {
|
|
13901
|
+
className: "nobreak"
|
|
13902
|
+
}], ["\\space", {}], ["\\nobreakspace", {
|
|
13903
|
+
className: "nobreak"
|
|
13904
|
+
}]]);
|
|
14060
13905
|
|
|
14061
13906
|
// ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in
|
|
14062
13907
|
// src/symbols.js.
|
|
14063
13908
|
defineFunctionBuilders({
|
|
14064
13909
|
type: "spacing",
|
|
14065
13910
|
htmlBuilder(group, options) {
|
|
14066
|
-
|
|
14067
|
-
|
|
13911
|
+
const regularSpaceItem = regularSpace.get(group.text);
|
|
13912
|
+
const cssSpaceClass = cssSpace.get(group.text);
|
|
13913
|
+
if (regularSpaceItem) {
|
|
13914
|
+
const className = regularSpaceItem.className || "";
|
|
14068
13915
|
// Spaces are generated by adding an actual space. Each of these
|
|
14069
13916
|
// things has an entry in the symbols table, so these will be turned
|
|
14070
13917
|
// into appropriate outputs.
|
|
@@ -14075,18 +13922,18 @@ defineFunctionBuilders({
|
|
|
14075
13922
|
} else {
|
|
14076
13923
|
return makeSpan(["mspace", className], [mathsym(group.text, group.mode, options)], options);
|
|
14077
13924
|
}
|
|
14078
|
-
} else if (
|
|
13925
|
+
} else if (cssSpaceClass) {
|
|
14079
13926
|
// Spaces based on just a CSS class.
|
|
14080
|
-
return makeSpan(["mspace",
|
|
13927
|
+
return makeSpan(["mspace", cssSpaceClass], [], options);
|
|
14081
13928
|
} else {
|
|
14082
13929
|
throw new src_ParseError("Unknown type of space \"" + group.text + "\"");
|
|
14083
13930
|
}
|
|
14084
13931
|
},
|
|
14085
13932
|
mathmlBuilder(group, options) {
|
|
14086
13933
|
let node;
|
|
14087
|
-
if (regularSpace.
|
|
13934
|
+
if (regularSpace.has(group.text)) {
|
|
14088
13935
|
node = new MathNode("mtext", [new TextNode("\u00a0")]);
|
|
14089
|
-
} else if (cssSpace.
|
|
13936
|
+
} else if (cssSpace.has(group.text)) {
|
|
14090
13937
|
// CSS-based MathML spaces (\nobreak, \allowbreak) are ignored
|
|
14091
13938
|
return new MathNode("mspace");
|
|
14092
13939
|
} else {
|
|
@@ -14169,10 +14016,8 @@ defineFunction({
|
|
|
14169
14016
|
allowedInArgument: true,
|
|
14170
14017
|
allowedInText: true,
|
|
14171
14018
|
handler(_ref, args) {
|
|
14172
|
-
let
|
|
14173
|
-
|
|
14174
|
-
funcName
|
|
14175
|
-
} = _ref;
|
|
14019
|
+
let parser = _ref.parser,
|
|
14020
|
+
funcName = _ref.funcName;
|
|
14176
14021
|
const body = args[0];
|
|
14177
14022
|
return {
|
|
14178
14023
|
type: "text",
|
|
@@ -14203,9 +14048,7 @@ defineFunction({
|
|
|
14203
14048
|
numArgs: 1,
|
|
14204
14049
|
allowedInText: true,
|
|
14205
14050
|
handler(_ref, args) {
|
|
14206
|
-
let
|
|
14207
|
-
parser
|
|
14208
|
-
} = _ref;
|
|
14051
|
+
let parser = _ref.parser;
|
|
14209
14052
|
return {
|
|
14210
14053
|
type: "underline",
|
|
14211
14054
|
mode: parser.mode,
|
|
@@ -14239,7 +14082,7 @@ defineFunction({
|
|
|
14239
14082
|
elem: innerGroup
|
|
14240
14083
|
}]
|
|
14241
14084
|
}, options);
|
|
14242
|
-
return makeSpan(["mord", "underline"], [vlist], options);
|
|
14085
|
+
return makeSpan(["mord", "katex-underline"], [vlist], options);
|
|
14243
14086
|
},
|
|
14244
14087
|
mathmlBuilder(group, options) {
|
|
14245
14088
|
const operator = new MathNode("mo", [new TextNode("\u203e")]);
|
|
@@ -14266,9 +14109,7 @@ defineFunction({
|
|
|
14266
14109
|
// In LaTeX, \vcenter can act only on a box.
|
|
14267
14110
|
allowedInText: false,
|
|
14268
14111
|
handler(_ref, args) {
|
|
14269
|
-
let
|
|
14270
|
-
parser
|
|
14271
|
-
} = _ref;
|
|
14112
|
+
let parser = _ref.parser;
|
|
14272
14113
|
return {
|
|
14273
14114
|
type: "vcenter",
|
|
14274
14115
|
mode: parser.mode,
|
|
@@ -14557,13 +14398,11 @@ class Namespace {
|
|
|
14557
14398
|
throw new src_ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug");
|
|
14558
14399
|
}
|
|
14559
14400
|
const undefs = this.undefStack.pop();
|
|
14560
|
-
for (const
|
|
14561
|
-
if (undefs
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
this.current[undef] = undefs[undef];
|
|
14566
|
-
}
|
|
14401
|
+
for (const key of Object.keys(undefs)) {
|
|
14402
|
+
if (undefs[key] === undefined) {
|
|
14403
|
+
delete this.current[key];
|
|
14404
|
+
} else {
|
|
14405
|
+
this.current[key] = undefs[key];
|
|
14567
14406
|
}
|
|
14568
14407
|
}
|
|
14569
14408
|
}
|
|
@@ -14583,7 +14422,7 @@ class Namespace {
|
|
|
14583
14422
|
* `get(name) != null`.
|
|
14584
14423
|
*/
|
|
14585
14424
|
has(name) {
|
|
14586
|
-
return
|
|
14425
|
+
return Object.prototype.hasOwnProperty.call(this.current, name) || Object.prototype.hasOwnProperty.call(this.builtins, name);
|
|
14587
14426
|
}
|
|
14588
14427
|
|
|
14589
14428
|
/**
|
|
@@ -14595,7 +14434,7 @@ class Namespace {
|
|
|
14595
14434
|
* `if (namespace.has(...))`.
|
|
14596
14435
|
*/
|
|
14597
14436
|
get(name) {
|
|
14598
|
-
if (
|
|
14437
|
+
if (Object.prototype.hasOwnProperty.call(this.current, name)) {
|
|
14599
14438
|
return this.current[name];
|
|
14600
14439
|
} else {
|
|
14601
14440
|
return this.builtins[name];
|
|
@@ -14629,7 +14468,7 @@ class Namespace {
|
|
|
14629
14468
|
// unless an undo is already in place, in which case that older
|
|
14630
14469
|
// value is the correct one.
|
|
14631
14470
|
const top = this.undefStack[this.undefStack.length - 1];
|
|
14632
|
-
if (top && !
|
|
14471
|
+
if (top && !Object.prototype.hasOwnProperty.call(top, name)) {
|
|
14633
14472
|
top[name] = this.current[name];
|
|
14634
14473
|
}
|
|
14635
14474
|
}
|
|
@@ -15740,16 +15579,14 @@ class MacroExpander {
|
|
|
15740
15579
|
return null;
|
|
15741
15580
|
}
|
|
15742
15581
|
start = this.popToken(); // don't include [ in tokens
|
|
15743
|
-
(
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
} = this.consumeArg(["]"]));
|
|
15582
|
+
var _this$consumeArg = this.consumeArg(["]"]);
|
|
15583
|
+
tokens = _this$consumeArg.tokens;
|
|
15584
|
+
end = _this$consumeArg.end;
|
|
15747
15585
|
} else {
|
|
15748
|
-
(
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
} = this.consumeArg());
|
|
15586
|
+
var _this$consumeArg2 = this.consumeArg();
|
|
15587
|
+
tokens = _this$consumeArg2.tokens;
|
|
15588
|
+
start = _this$consumeArg2.start;
|
|
15589
|
+
end = _this$consumeArg2.end;
|
|
15753
15590
|
}
|
|
15754
15591
|
|
|
15755
15592
|
// indicate the end of an argument
|
|
@@ -16060,7 +15897,7 @@ class MacroExpander {
|
|
|
16060
15897
|
* `implicitCommands`.
|
|
16061
15898
|
*/
|
|
16062
15899
|
isDefined(name) {
|
|
16063
|
-
return this.macros.has(name) ||
|
|
15900
|
+
return this.macros.has(name) || Object.prototype.hasOwnProperty.call(src_functions, name) || Object.prototype.hasOwnProperty.call(src_symbols.math, name) || Object.prototype.hasOwnProperty.call(src_symbols.text, name) || Object.prototype.hasOwnProperty.call(implicitCommands, name);
|
|
16064
15901
|
}
|
|
16065
15902
|
|
|
16066
15903
|
/**
|
|
@@ -16068,7 +15905,10 @@ class MacroExpander {
|
|
|
16068
15905
|
*/
|
|
16069
15906
|
isExpandable(name) {
|
|
16070
15907
|
const macro = this.macros.get(name);
|
|
16071
|
-
|
|
15908
|
+
if (macro != null) {
|
|
15909
|
+
return typeof macro === "string" || typeof macro === "function" || !macro.unexpandable;
|
|
15910
|
+
}
|
|
15911
|
+
return Object.prototype.hasOwnProperty.call(src_functions, name) && !src_functions[name].primitive;
|
|
16072
15912
|
}
|
|
16073
15913
|
}
|
|
16074
15914
|
;// ./src/unicodeSupOrSub.ts
|
|
@@ -17059,10 +16899,9 @@ class Parser {
|
|
|
17059
16899
|
} else if (this.mode === "math" && funcData.allowedInMath === false) {
|
|
17060
16900
|
throw new src_ParseError("Can't use function '" + func + "' in math mode", token);
|
|
17061
16901
|
}
|
|
17062
|
-
const
|
|
17063
|
-
args,
|
|
17064
|
-
optArgs
|
|
17065
|
-
} = this.parseArguments(func, funcData);
|
|
16902
|
+
const _this$parseArguments = this.parseArguments(func, funcData),
|
|
16903
|
+
args = _this$parseArguments.args,
|
|
16904
|
+
optArgs = _this$parseArguments.optArgs;
|
|
17066
16905
|
return this.callFunction(func, args, optArgs, token, breakOnTokenText);
|
|
17067
16906
|
}
|
|
17068
16907
|
|
|
@@ -17396,7 +17235,7 @@ class Parser {
|
|
|
17396
17235
|
// If there exists a function with this name, parse the function.
|
|
17397
17236
|
// Otherwise, just return a nucleus
|
|
17398
17237
|
result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol();
|
|
17399
|
-
if (result == null && text[0] === "\\" && !
|
|
17238
|
+
if (result == null && text[0] === "\\" && !Object.prototype.hasOwnProperty.call(implicitCommands, text)) {
|
|
17400
17239
|
if (this.settings.throwOnError) {
|
|
17401
17240
|
throw new src_ParseError("Undefined control sequence: " + text, firstToken);
|
|
17402
17241
|
}
|
|
@@ -17489,7 +17328,7 @@ class Parser {
|
|
|
17489
17328
|
}
|
|
17490
17329
|
// At this point, we should have a symbol, possibly with accents.
|
|
17491
17330
|
// First expand any accented base symbol according to unicodeSymbols.
|
|
17492
|
-
if (
|
|
17331
|
+
if (Object.prototype.hasOwnProperty.call(unicodeSymbols, text[0]) && !src_symbols[this.mode][text[0]]) {
|
|
17493
17332
|
// This behavior is not strict (XeTeX-compatible) in math mode.
|
|
17494
17333
|
if (this.settings.strict && this.mode === "math") {
|
|
17495
17334
|
this.settings.reportNonstrict("unicodeTextInMathMode", "Accented Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
|
|
@@ -17720,7 +17559,7 @@ const renderToHTMLTree = function (expression, options) {
|
|
|
17720
17559
|
return renderError(error, expression, settings);
|
|
17721
17560
|
}
|
|
17722
17561
|
};
|
|
17723
|
-
const version = "0.
|
|
17562
|
+
const version = "0.18.0";
|
|
17724
17563
|
const __domTree = {
|
|
17725
17564
|
Span: Span,
|
|
17726
17565
|
Anchor: Anchor,
|