katex 0.15.0 → 0.15.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/copy-tex/README.md +3 -3
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/dist/README.md +3 -3
- package/dist/contrib/copy-tex.css +0 -1
- package/dist/contrib/copy-tex.min.css +1 -1
- package/dist/katex.css +1 -1
- package/dist/katex.js +220 -135
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +123 -43
- package/package.json +5 -5
- package/src/Namespace.js +9 -4
- package/src/Parser.js +21 -0
- package/src/environments/array.js +72 -18
- package/src/functions/mclass.js +4 -1
- package/src/parseNode.js +2 -1
- package/src/parseTree.js +2 -2
- package/src/symbols.js +3 -3
package/dist/katex.js
CHANGED
|
@@ -4506,7 +4506,7 @@ defineSymbol(math, main, bin, "\u2293", "\\sqcap", true);
|
|
|
4506
4506
|
defineSymbol(math, main, bin, "\u2217", "\\ast");
|
|
4507
4507
|
defineSymbol(math, main, bin, "\u2294", "\\sqcup", true);
|
|
4508
4508
|
defineSymbol(math, main, bin, "\u25EF", "\\bigcirc", true);
|
|
4509
|
-
defineSymbol(math, main, bin, "\u2219", "\\bullet");
|
|
4509
|
+
defineSymbol(math, main, bin, "\u2219", "\\bullet", true);
|
|
4510
4510
|
defineSymbol(math, main, bin, "\u2021", "\\ddagger");
|
|
4511
4511
|
defineSymbol(math, main, bin, "\u2240", "\\wr", true);
|
|
4512
4512
|
defineSymbol(math, main, bin, "\u2A3F", "\\amalg");
|
|
@@ -4865,13 +4865,13 @@ defineSymbol(math, main, bin, "\u2217", "*", true);
|
|
|
4865
4865
|
defineSymbol(math, main, bin, "+", "+");
|
|
4866
4866
|
defineSymbol(math, main, bin, "\u2212", "-", true);
|
|
4867
4867
|
defineSymbol(math, main, bin, "\u22C5", "\\cdot", true);
|
|
4868
|
-
defineSymbol(math, main, bin, "\u2218", "\\circ");
|
|
4868
|
+
defineSymbol(math, main, bin, "\u2218", "\\circ", true);
|
|
4869
4869
|
defineSymbol(math, main, bin, "\xF7", "\\div", true);
|
|
4870
4870
|
defineSymbol(math, main, bin, "\xB1", "\\pm", true);
|
|
4871
4871
|
defineSymbol(math, main, bin, "\xD7", "\\times", true);
|
|
4872
4872
|
defineSymbol(math, main, bin, "\u2229", "\\cap", true);
|
|
4873
4873
|
defineSymbol(math, main, bin, "\u222A", "\\cup", true);
|
|
4874
|
-
defineSymbol(math, main, bin, "\u2216", "\\setminus");
|
|
4874
|
+
defineSymbol(math, main, bin, "\u2216", "\\setminus", true);
|
|
4875
4875
|
defineSymbol(math, main, bin, "\u2227", "\\land");
|
|
4876
4876
|
defineSymbol(math, main, bin, "\u2228", "\\lor");
|
|
4877
4877
|
defineSymbol(math, main, bin, "\u2227", "\\wedge", true);
|
|
@@ -10107,6 +10107,109 @@ function defineEnvironment(_ref) {
|
|
|
10107
10107
|
_mathmlGroupBuilders[type] = mathmlBuilder;
|
|
10108
10108
|
}
|
|
10109
10109
|
}
|
|
10110
|
+
;// CONCATENATED MODULE: ./src/defineMacro.js
|
|
10111
|
+
|
|
10112
|
+
|
|
10113
|
+
/**
|
|
10114
|
+
* All registered global/built-in macros.
|
|
10115
|
+
* `macros.js` exports this same dictionary again and makes it public.
|
|
10116
|
+
* `Parser.js` requires this dictionary via `macros.js`.
|
|
10117
|
+
*/
|
|
10118
|
+
var _macros = {}; // This function might one day accept an additional argument and do more things.
|
|
10119
|
+
|
|
10120
|
+
function defineMacro(name, body) {
|
|
10121
|
+
_macros[name] = body;
|
|
10122
|
+
}
|
|
10123
|
+
;// CONCATENATED MODULE: ./src/SourceLocation.js
|
|
10124
|
+
/**
|
|
10125
|
+
* Lexing or parsing positional information for error reporting.
|
|
10126
|
+
* This object is immutable.
|
|
10127
|
+
*/
|
|
10128
|
+
var SourceLocation = /*#__PURE__*/function () {
|
|
10129
|
+
// The + prefix indicates that these fields aren't writeable
|
|
10130
|
+
// Lexer holding the input string.
|
|
10131
|
+
// Start offset, zero-based inclusive.
|
|
10132
|
+
// End offset, zero-based exclusive.
|
|
10133
|
+
function SourceLocation(lexer, start, end) {
|
|
10134
|
+
this.lexer = void 0;
|
|
10135
|
+
this.start = void 0;
|
|
10136
|
+
this.end = void 0;
|
|
10137
|
+
this.lexer = lexer;
|
|
10138
|
+
this.start = start;
|
|
10139
|
+
this.end = end;
|
|
10140
|
+
}
|
|
10141
|
+
/**
|
|
10142
|
+
* Merges two `SourceLocation`s from location providers, given they are
|
|
10143
|
+
* provided in order of appearance.
|
|
10144
|
+
* - Returns the first one's location if only the first is provided.
|
|
10145
|
+
* - Returns a merged range of the first and the last if both are provided
|
|
10146
|
+
* and their lexers match.
|
|
10147
|
+
* - Otherwise, returns null.
|
|
10148
|
+
*/
|
|
10149
|
+
|
|
10150
|
+
|
|
10151
|
+
SourceLocation.range = function range(first, second) {
|
|
10152
|
+
if (!second) {
|
|
10153
|
+
return first && first.loc;
|
|
10154
|
+
} else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) {
|
|
10155
|
+
return null;
|
|
10156
|
+
} else {
|
|
10157
|
+
return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end);
|
|
10158
|
+
}
|
|
10159
|
+
};
|
|
10160
|
+
|
|
10161
|
+
return SourceLocation;
|
|
10162
|
+
}();
|
|
10163
|
+
|
|
10164
|
+
|
|
10165
|
+
;// CONCATENATED MODULE: ./src/Token.js
|
|
10166
|
+
|
|
10167
|
+
/**
|
|
10168
|
+
* Interface required to break circular dependency between Token, Lexer, and
|
|
10169
|
+
* ParseError.
|
|
10170
|
+
*/
|
|
10171
|
+
|
|
10172
|
+
/**
|
|
10173
|
+
* The resulting token returned from `lex`.
|
|
10174
|
+
*
|
|
10175
|
+
* It consists of the token text plus some position information.
|
|
10176
|
+
* The position information is essentially a range in an input string,
|
|
10177
|
+
* but instead of referencing the bare input string, we refer to the lexer.
|
|
10178
|
+
* That way it is possible to attach extra metadata to the input string,
|
|
10179
|
+
* like for example a file name or similar.
|
|
10180
|
+
*
|
|
10181
|
+
* The position information is optional, so it is OK to construct synthetic
|
|
10182
|
+
* tokens if appropriate. Not providing available position information may
|
|
10183
|
+
* lead to degraded error reporting, though.
|
|
10184
|
+
*/
|
|
10185
|
+
var Token = /*#__PURE__*/function () {
|
|
10186
|
+
// don't expand the token
|
|
10187
|
+
// used in \noexpand
|
|
10188
|
+
function Token(text, // the text of this token
|
|
10189
|
+
loc) {
|
|
10190
|
+
this.text = void 0;
|
|
10191
|
+
this.loc = void 0;
|
|
10192
|
+
this.noexpand = void 0;
|
|
10193
|
+
this.treatAsRelax = void 0;
|
|
10194
|
+
this.text = text;
|
|
10195
|
+
this.loc = loc;
|
|
10196
|
+
}
|
|
10197
|
+
/**
|
|
10198
|
+
* Given a pair of tokens (this and endToken), compute a `Token` encompassing
|
|
10199
|
+
* the whole input range enclosed by these two.
|
|
10200
|
+
*/
|
|
10201
|
+
|
|
10202
|
+
|
|
10203
|
+
var _proto = Token.prototype;
|
|
10204
|
+
|
|
10205
|
+
_proto.range = function range(endToken, // last token of the range, inclusive
|
|
10206
|
+
text // the text of the newly constructed token
|
|
10207
|
+
) {
|
|
10208
|
+
return new Token(text, SourceLocation.range(this, endToken));
|
|
10209
|
+
};
|
|
10210
|
+
|
|
10211
|
+
return Token;
|
|
10212
|
+
}();
|
|
10110
10213
|
;// CONCATENATED MODULE: ./src/environments/array.js
|
|
10111
10214
|
|
|
10112
10215
|
|
|
@@ -10122,6 +10225,8 @@ function defineEnvironment(_ref) {
|
|
|
10122
10225
|
|
|
10123
10226
|
|
|
10124
10227
|
|
|
10228
|
+
|
|
10229
|
+
|
|
10125
10230
|
// Helper functions
|
|
10126
10231
|
function getHLines(parser) {
|
|
10127
10232
|
// Return an array. The array length = number of hlines.
|
|
@@ -10146,7 +10251,19 @@ var validateAmsEnvironmentContext = function validateAmsEnvironmentContext(conte
|
|
|
10146
10251
|
if (!settings.displayMode) {
|
|
10147
10252
|
throw new src_ParseError("{" + context.envName + "} can be used only in" + " display mode.");
|
|
10148
10253
|
}
|
|
10149
|
-
};
|
|
10254
|
+
}; // autoTag (an argument to parseArray) can be one of three values:
|
|
10255
|
+
// * undefined: Regular (not-top-level) array; no tags on each row
|
|
10256
|
+
// * true: Automatic equation numbering, overridable by \tag
|
|
10257
|
+
// * false: Tags allowed on each row, but no automatic numbering
|
|
10258
|
+
// This function *doesn't* work with the "split" environment name.
|
|
10259
|
+
|
|
10260
|
+
|
|
10261
|
+
function getAutoTag(name) {
|
|
10262
|
+
if (name.indexOf("ed") === -1) {
|
|
10263
|
+
return name.indexOf("*") === -1;
|
|
10264
|
+
} // return undefined;
|
|
10265
|
+
|
|
10266
|
+
}
|
|
10150
10267
|
/**
|
|
10151
10268
|
* Parse the body of the environment, with rows delimited by \\ and
|
|
10152
10269
|
* columns delimited by &, and create a nested list in row-major order
|
|
@@ -10161,7 +10278,7 @@ function parseArray(parser, _ref, style) {
|
|
|
10161
10278
|
cols = _ref.cols,
|
|
10162
10279
|
arraystretch = _ref.arraystretch,
|
|
10163
10280
|
colSeparationType = _ref.colSeparationType,
|
|
10164
|
-
|
|
10281
|
+
autoTag = _ref.autoTag,
|
|
10165
10282
|
singleRow = _ref.singleRow,
|
|
10166
10283
|
emptySingleRow = _ref.emptySingleRow,
|
|
10167
10284
|
maxNumCols = _ref.maxNumCols,
|
|
@@ -10195,7 +10312,29 @@ function parseArray(parser, _ref, style) {
|
|
|
10195
10312
|
var row = [];
|
|
10196
10313
|
var body = [row];
|
|
10197
10314
|
var rowGaps = [];
|
|
10198
|
-
var hLinesBeforeRow = [];
|
|
10315
|
+
var hLinesBeforeRow = [];
|
|
10316
|
+
var tags = autoTag != null ? [] : undefined; // amsmath uses \global\@eqnswtrue and \global\@eqnswfalse to represent
|
|
10317
|
+
// whether this row should have an equation number. Simulate this with
|
|
10318
|
+
// a \@eqnsw macro set to 1 or 0.
|
|
10319
|
+
|
|
10320
|
+
function beginRow() {
|
|
10321
|
+
if (autoTag) {
|
|
10322
|
+
parser.gullet.macros.set("\\@eqnsw", "1", true);
|
|
10323
|
+
}
|
|
10324
|
+
}
|
|
10325
|
+
|
|
10326
|
+
function endRow() {
|
|
10327
|
+
if (tags) {
|
|
10328
|
+
if (parser.gullet.macros.get("\\df@tag")) {
|
|
10329
|
+
tags.push(parser.subparse([new Token("\\df@tag")]));
|
|
10330
|
+
parser.gullet.macros.set("\\df@tag", undefined, true);
|
|
10331
|
+
} else {
|
|
10332
|
+
tags.push(Boolean(autoTag) && parser.gullet.macros.get("\\@eqnsw") === "1");
|
|
10333
|
+
}
|
|
10334
|
+
}
|
|
10335
|
+
}
|
|
10336
|
+
|
|
10337
|
+
beginRow(); // Test for \hline at the top of the array.
|
|
10199
10338
|
|
|
10200
10339
|
hLinesBeforeRow.push(getHLines(parser));
|
|
10201
10340
|
|
|
@@ -10236,10 +10375,11 @@ function parseArray(parser, _ref, style) {
|
|
|
10236
10375
|
|
|
10237
10376
|
parser.consume();
|
|
10238
10377
|
} else if (next === "\\end") {
|
|
10239
|
-
// Arrays terminate newlines with `\crcr` which consumes a `\cr` if
|
|
10378
|
+
endRow(); // Arrays terminate newlines with `\crcr` which consumes a `\cr` if
|
|
10240
10379
|
// the last line is empty. However, AMS environments keep the
|
|
10241
10380
|
// empty row if it's the only one.
|
|
10242
10381
|
// NOTE: Currently, `cell` is the last item added into `row`.
|
|
10382
|
+
|
|
10243
10383
|
if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow)) {
|
|
10244
10384
|
body.pop();
|
|
10245
10385
|
}
|
|
@@ -10261,11 +10401,13 @@ function parseArray(parser, _ref, style) {
|
|
|
10261
10401
|
size = parser.parseSizeGroup(true);
|
|
10262
10402
|
}
|
|
10263
10403
|
|
|
10264
|
-
rowGaps.push(size ? size.value : null);
|
|
10404
|
+
rowGaps.push(size ? size.value : null);
|
|
10405
|
+
endRow(); // check for \hline(s) following the row separator
|
|
10265
10406
|
|
|
10266
10407
|
hLinesBeforeRow.push(getHLines(parser));
|
|
10267
10408
|
row = [];
|
|
10268
10409
|
body.push(row);
|
|
10410
|
+
beginRow();
|
|
10269
10411
|
} else {
|
|
10270
10412
|
throw new src_ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken);
|
|
10271
10413
|
}
|
|
@@ -10286,7 +10428,7 @@ function parseArray(parser, _ref, style) {
|
|
|
10286
10428
|
hskipBeforeAndAfter: hskipBeforeAndAfter,
|
|
10287
10429
|
hLinesBeforeRow: hLinesBeforeRow,
|
|
10288
10430
|
colSeparationType: colSeparationType,
|
|
10289
|
-
|
|
10431
|
+
tags: tags,
|
|
10290
10432
|
leqno: leqno
|
|
10291
10433
|
};
|
|
10292
10434
|
} // Decides on a style for cells in an array according to whether the given
|
|
@@ -10424,20 +10566,35 @@ var array_htmlBuilder = function htmlBuilder(group, options) {
|
|
|
10424
10566
|
var cols = [];
|
|
10425
10567
|
var colSep;
|
|
10426
10568
|
var colDescrNum;
|
|
10427
|
-
var
|
|
10569
|
+
var tagSpans = [];
|
|
10428
10570
|
|
|
10429
|
-
if (group.
|
|
10430
|
-
|
|
10431
|
-
|
|
10571
|
+
if (group.tags && group.tags.some(function (tag) {
|
|
10572
|
+
return tag;
|
|
10573
|
+
})) {
|
|
10574
|
+
// An environment with manual tags and/or automatic equation numbers.
|
|
10575
|
+
// Create node(s), the latter of which trigger CSS counter increment.
|
|
10432
10576
|
for (r = 0; r < nr; ++r) {
|
|
10433
10577
|
var rw = body[r];
|
|
10434
10578
|
var shift = rw.pos - offset;
|
|
10435
|
-
var
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10579
|
+
var tag = group.tags[r];
|
|
10580
|
+
var tagSpan = void 0;
|
|
10581
|
+
|
|
10582
|
+
if (tag === true) {
|
|
10583
|
+
// automatic numbering
|
|
10584
|
+
tagSpan = buildCommon.makeSpan(["eqn-num"], [], options);
|
|
10585
|
+
} else if (tag === false) {
|
|
10586
|
+
// \nonumber/\notag or starred environment
|
|
10587
|
+
tagSpan = buildCommon.makeSpan([], [], options);
|
|
10588
|
+
} else {
|
|
10589
|
+
// manual \tag
|
|
10590
|
+
tagSpan = buildCommon.makeSpan([], buildExpression(tag, options, true), options);
|
|
10591
|
+
}
|
|
10592
|
+
|
|
10593
|
+
tagSpan.depth = rw.depth;
|
|
10594
|
+
tagSpan.height = rw.height;
|
|
10595
|
+
tagSpans.push({
|
|
10439
10596
|
type: "elem",
|
|
10440
|
-
elem:
|
|
10597
|
+
elem: tagSpan,
|
|
10441
10598
|
shift: shift
|
|
10442
10599
|
});
|
|
10443
10600
|
}
|
|
@@ -10573,12 +10730,12 @@ var array_htmlBuilder = function htmlBuilder(group, options) {
|
|
|
10573
10730
|
}, options);
|
|
10574
10731
|
}
|
|
10575
10732
|
|
|
10576
|
-
if (
|
|
10733
|
+
if (tagSpans.length === 0) {
|
|
10577
10734
|
return buildCommon.makeSpan(["mord"], [body], options);
|
|
10578
10735
|
} else {
|
|
10579
10736
|
var eqnNumCol = buildCommon.makeVList({
|
|
10580
10737
|
positionType: "individualShift",
|
|
10581
|
-
children:
|
|
10738
|
+
children: tagSpans
|
|
10582
10739
|
}, options);
|
|
10583
10740
|
eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options);
|
|
10584
10741
|
return buildCommon.makeFragment([body, eqnNumCol]);
|
|
@@ -10604,7 +10761,7 @@ var array_mathmlBuilder = function mathmlBuilder(group, options) {
|
|
|
10604
10761
|
row.push(new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(rw[j], options)]));
|
|
10605
10762
|
}
|
|
10606
10763
|
|
|
10607
|
-
if (group.
|
|
10764
|
+
if (group.tags && group.tags[i]) {
|
|
10608
10765
|
row.unshift(glue);
|
|
10609
10766
|
row.push(glue);
|
|
10610
10767
|
|
|
@@ -10739,13 +10896,14 @@ var alignedHandler = function alignedHandler(context, args) {
|
|
|
10739
10896
|
|
|
10740
10897
|
var cols = [];
|
|
10741
10898
|
var separationType = context.envName.indexOf("at") > -1 ? "alignat" : "align";
|
|
10899
|
+
var isSplit = context.envName === "split";
|
|
10742
10900
|
var res = parseArray(context.parser, {
|
|
10743
10901
|
cols: cols,
|
|
10744
10902
|
addJot: true,
|
|
10745
|
-
|
|
10903
|
+
autoTag: isSplit ? undefined : getAutoTag(context.envName),
|
|
10746
10904
|
emptySingleRow: true,
|
|
10747
10905
|
colSeparationType: separationType,
|
|
10748
|
-
maxNumCols:
|
|
10906
|
+
maxNumCols: isSplit ? 2 : undefined,
|
|
10749
10907
|
leqno: context.parser.settings.leqno
|
|
10750
10908
|
}, "display"); // Determining number of columns.
|
|
10751
10909
|
// 1. If the first argument is given, we use it as a number of columns,
|
|
@@ -11096,7 +11254,7 @@ defineEnvironment({
|
|
|
11096
11254
|
}],
|
|
11097
11255
|
addJot: true,
|
|
11098
11256
|
colSeparationType: "gather",
|
|
11099
|
-
|
|
11257
|
+
autoTag: getAutoTag(context.envName),
|
|
11100
11258
|
emptySingleRow: true,
|
|
11101
11259
|
leqno: context.parser.settings.leqno
|
|
11102
11260
|
};
|
|
@@ -11127,7 +11285,7 @@ defineEnvironment({
|
|
|
11127
11285
|
handler: function handler(context) {
|
|
11128
11286
|
validateAmsEnvironmentContext(context);
|
|
11129
11287
|
var res = {
|
|
11130
|
-
|
|
11288
|
+
autoTag: getAutoTag(context.envName),
|
|
11131
11289
|
emptySingleRow: true,
|
|
11132
11290
|
singleRow: true,
|
|
11133
11291
|
maxNumCols: 1,
|
|
@@ -11150,7 +11308,9 @@ defineEnvironment({
|
|
|
11150
11308
|
},
|
|
11151
11309
|
htmlBuilder: array_htmlBuilder,
|
|
11152
11310
|
mathmlBuilder: array_mathmlBuilder
|
|
11153
|
-
});
|
|
11311
|
+
});
|
|
11312
|
+
defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}");
|
|
11313
|
+
defineMacro("\\notag", "\\nonumber"); // Catch \hline outside array environment
|
|
11154
11314
|
|
|
11155
11315
|
defineFunction({
|
|
11156
11316
|
type: "text",
|
|
@@ -11259,7 +11419,7 @@ function mclass_mathmlBuilder(group, options) {
|
|
|
11259
11419
|
var inner = buildMathML_buildExpression(group.body, options);
|
|
11260
11420
|
|
|
11261
11421
|
if (group.mclass === "minner") {
|
|
11262
|
-
|
|
11422
|
+
node = new mathMLTree.MathNode("mpadded", inner);
|
|
11263
11423
|
} else if (group.mclass === "mord") {
|
|
11264
11424
|
if (group.isCharacterBox) {
|
|
11265
11425
|
node = inner[0];
|
|
@@ -11287,6 +11447,10 @@ function mclass_mathmlBuilder(group, options) {
|
|
|
11287
11447
|
} else if (group.mclass === "mopen" || group.mclass === "mclose") {
|
|
11288
11448
|
node.attributes.lspace = "0em";
|
|
11289
11449
|
node.attributes.rspace = "0em";
|
|
11450
|
+
} else if (group.mclass === "minner") {
|
|
11451
|
+
node.attributes.lspace = "0.0556em"; // 1 mu is the most likely option
|
|
11452
|
+
|
|
11453
|
+
node.attributes.width = "+0.1111em";
|
|
11290
11454
|
} // MathML <mo> default space is 5/18 em, so <mrel> needs no action.
|
|
11291
11455
|
// Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo
|
|
11292
11456
|
|
|
@@ -13282,19 +13446,6 @@ defineFunction({
|
|
|
13282
13446
|
htmlBuilder: op_htmlBuilder,
|
|
13283
13447
|
mathmlBuilder: op_mathmlBuilder
|
|
13284
13448
|
});
|
|
13285
|
-
;// CONCATENATED MODULE: ./src/defineMacro.js
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
/**
|
|
13289
|
-
* All registered global/built-in macros.
|
|
13290
|
-
* `macros.js` exports this same dictionary again and makes it public.
|
|
13291
|
-
* `Parser.js` requires this dictionary via `macros.js`.
|
|
13292
|
-
*/
|
|
13293
|
-
var _macros = {}; // This function might one day accept an additional argument and do more things.
|
|
13294
|
-
|
|
13295
|
-
function defineMacro(name, body) {
|
|
13296
|
-
_macros[name] = body;
|
|
13297
|
-
}
|
|
13298
13449
|
;// CONCATENATED MODULE: ./src/functions/operatorname.js
|
|
13299
13450
|
|
|
13300
13451
|
|
|
@@ -14847,96 +14998,6 @@ var functions = _functions;
|
|
|
14847
14998
|
|
|
14848
14999
|
|
|
14849
15000
|
|
|
14850
|
-
;// CONCATENATED MODULE: ./src/SourceLocation.js
|
|
14851
|
-
/**
|
|
14852
|
-
* Lexing or parsing positional information for error reporting.
|
|
14853
|
-
* This object is immutable.
|
|
14854
|
-
*/
|
|
14855
|
-
var SourceLocation = /*#__PURE__*/function () {
|
|
14856
|
-
// The + prefix indicates that these fields aren't writeable
|
|
14857
|
-
// Lexer holding the input string.
|
|
14858
|
-
// Start offset, zero-based inclusive.
|
|
14859
|
-
// End offset, zero-based exclusive.
|
|
14860
|
-
function SourceLocation(lexer, start, end) {
|
|
14861
|
-
this.lexer = void 0;
|
|
14862
|
-
this.start = void 0;
|
|
14863
|
-
this.end = void 0;
|
|
14864
|
-
this.lexer = lexer;
|
|
14865
|
-
this.start = start;
|
|
14866
|
-
this.end = end;
|
|
14867
|
-
}
|
|
14868
|
-
/**
|
|
14869
|
-
* Merges two `SourceLocation`s from location providers, given they are
|
|
14870
|
-
* provided in order of appearance.
|
|
14871
|
-
* - Returns the first one's location if only the first is provided.
|
|
14872
|
-
* - Returns a merged range of the first and the last if both are provided
|
|
14873
|
-
* and their lexers match.
|
|
14874
|
-
* - Otherwise, returns null.
|
|
14875
|
-
*/
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
SourceLocation.range = function range(first, second) {
|
|
14879
|
-
if (!second) {
|
|
14880
|
-
return first && first.loc;
|
|
14881
|
-
} else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) {
|
|
14882
|
-
return null;
|
|
14883
|
-
} else {
|
|
14884
|
-
return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end);
|
|
14885
|
-
}
|
|
14886
|
-
};
|
|
14887
|
-
|
|
14888
|
-
return SourceLocation;
|
|
14889
|
-
}();
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
;// CONCATENATED MODULE: ./src/Token.js
|
|
14893
|
-
|
|
14894
|
-
/**
|
|
14895
|
-
* Interface required to break circular dependency between Token, Lexer, and
|
|
14896
|
-
* ParseError.
|
|
14897
|
-
*/
|
|
14898
|
-
|
|
14899
|
-
/**
|
|
14900
|
-
* The resulting token returned from `lex`.
|
|
14901
|
-
*
|
|
14902
|
-
* It consists of the token text plus some position information.
|
|
14903
|
-
* The position information is essentially a range in an input string,
|
|
14904
|
-
* but instead of referencing the bare input string, we refer to the lexer.
|
|
14905
|
-
* That way it is possible to attach extra metadata to the input string,
|
|
14906
|
-
* like for example a file name or similar.
|
|
14907
|
-
*
|
|
14908
|
-
* The position information is optional, so it is OK to construct synthetic
|
|
14909
|
-
* tokens if appropriate. Not providing available position information may
|
|
14910
|
-
* lead to degraded error reporting, though.
|
|
14911
|
-
*/
|
|
14912
|
-
var Token = /*#__PURE__*/function () {
|
|
14913
|
-
// don't expand the token
|
|
14914
|
-
// used in \noexpand
|
|
14915
|
-
function Token(text, // the text of this token
|
|
14916
|
-
loc) {
|
|
14917
|
-
this.text = void 0;
|
|
14918
|
-
this.loc = void 0;
|
|
14919
|
-
this.noexpand = void 0;
|
|
14920
|
-
this.treatAsRelax = void 0;
|
|
14921
|
-
this.text = text;
|
|
14922
|
-
this.loc = loc;
|
|
14923
|
-
}
|
|
14924
|
-
/**
|
|
14925
|
-
* Given a pair of tokens (this and endToken), compute a `Token` encompassing
|
|
14926
|
-
* the whole input range enclosed by these two.
|
|
14927
|
-
*/
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
var _proto = Token.prototype;
|
|
14931
|
-
|
|
14932
|
-
_proto.range = function range(endToken, // last token of the range, inclusive
|
|
14933
|
-
text // the text of the newly constructed token
|
|
14934
|
-
) {
|
|
14935
|
-
return new Token(text, SourceLocation.range(this, endToken));
|
|
14936
|
-
};
|
|
14937
|
-
|
|
14938
|
-
return Token;
|
|
14939
|
-
}();
|
|
14940
15001
|
;// CONCATENATED MODULE: ./src/Lexer.js
|
|
14941
15002
|
/**
|
|
14942
15003
|
* The Lexer class handles tokenizing the input in various ways. Since our
|
|
@@ -15122,7 +15183,7 @@ var Namespace = /*#__PURE__*/function () {
|
|
|
15122
15183
|
|
|
15123
15184
|
for (var undef in undefs) {
|
|
15124
15185
|
if (undefs.hasOwnProperty(undef)) {
|
|
15125
|
-
if (undefs[undef]
|
|
15186
|
+
if (undefs[undef] == null) {
|
|
15126
15187
|
delete this.current[undef];
|
|
15127
15188
|
} else {
|
|
15128
15189
|
this.current[undef] = undefs[undef];
|
|
@@ -15172,6 +15233,7 @@ var Namespace = /*#__PURE__*/function () {
|
|
|
15172
15233
|
* Local set() sets the current value and (when appropriate) adds an undo
|
|
15173
15234
|
* operation to the undo stack. Global set() may change the undo
|
|
15174
15235
|
* operation at every level, so takes time linear in their number.
|
|
15236
|
+
* A value of undefined means to delete existing definitions.
|
|
15175
15237
|
*/
|
|
15176
15238
|
;
|
|
15177
15239
|
|
|
@@ -15203,7 +15265,11 @@ var Namespace = /*#__PURE__*/function () {
|
|
|
15203
15265
|
}
|
|
15204
15266
|
}
|
|
15205
15267
|
|
|
15206
|
-
|
|
15268
|
+
if (value == null) {
|
|
15269
|
+
delete this.current[name];
|
|
15270
|
+
} else {
|
|
15271
|
+
this.current[name] = value;
|
|
15272
|
+
}
|
|
15207
15273
|
};
|
|
15208
15274
|
|
|
15209
15275
|
return Namespace;
|
|
@@ -17193,6 +17259,25 @@ var Parser = /*#__PURE__*/function () {
|
|
|
17193
17259
|
} finally {
|
|
17194
17260
|
this.gullet.endGroups();
|
|
17195
17261
|
}
|
|
17262
|
+
}
|
|
17263
|
+
/**
|
|
17264
|
+
* Fully parse a separate sequence of tokens as a separate job.
|
|
17265
|
+
* Tokens should be specified in reverse order, as in a MacroDefinition.
|
|
17266
|
+
*/
|
|
17267
|
+
;
|
|
17268
|
+
|
|
17269
|
+
_proto.subparse = function subparse(tokens) {
|
|
17270
|
+
// Save the next token from the current job.
|
|
17271
|
+
var oldToken = this.nextToken;
|
|
17272
|
+
this.consume(); // Run the new job, terminating it with an excess '}'
|
|
17273
|
+
|
|
17274
|
+
this.gullet.pushToken(new Token("}"));
|
|
17275
|
+
this.gullet.pushTokens(tokens);
|
|
17276
|
+
var parse = this.parseExpression(false);
|
|
17277
|
+
this.expect("}"); // Restore the next token from the current job.
|
|
17278
|
+
|
|
17279
|
+
this.nextToken = oldToken;
|
|
17280
|
+
return parse;
|
|
17196
17281
|
};
|
|
17197
17282
|
|
|
17198
17283
|
/**
|
|
@@ -18118,6 +18203,7 @@ Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
|
|
|
18118
18203
|
|
|
18119
18204
|
|
|
18120
18205
|
|
|
18206
|
+
|
|
18121
18207
|
/**
|
|
18122
18208
|
* Parses an expression using a Parser, then returns the parsed result.
|
|
18123
18209
|
*/
|
|
@@ -18140,12 +18226,11 @@ var parseTree = function parseTree(toParse, settings) {
|
|
|
18140
18226
|
throw new src_ParseError("\\tag works only in display equations");
|
|
18141
18227
|
}
|
|
18142
18228
|
|
|
18143
|
-
parser.gullet.feed("\\df@tag");
|
|
18144
18229
|
tree = [{
|
|
18145
18230
|
type: "tag",
|
|
18146
18231
|
mode: "text",
|
|
18147
18232
|
body: tree,
|
|
18148
|
-
tag: parser.
|
|
18233
|
+
tag: parser.subparse([new Token("\\df@tag")])
|
|
18149
18234
|
}];
|
|
18150
18235
|
}
|
|
18151
18236
|
|
|
@@ -18266,7 +18351,7 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
|
|
|
18266
18351
|
/**
|
|
18267
18352
|
* Current KaTeX version
|
|
18268
18353
|
*/
|
|
18269
|
-
version: "0.15.
|
|
18354
|
+
version: "0.15.3",
|
|
18270
18355
|
|
|
18271
18356
|
/**
|
|
18272
18357
|
* Renders the given LaTeX into an HTML+MathML combination, and adds
|