katex 0.15.0 → 0.15.1

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 CHANGED
@@ -31,13 +31,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
31
31
  <!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
32
32
  <html>
33
33
  <head>
34
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/katex.min.css" integrity="sha384-SfHjyzed8eCsTSa4t2GoMc4WnsCLa6cQpFqPRCaizz0FlQUOyafw/AyIUCQU/KuM" crossorigin="anonymous">
34
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
35
35
 
36
36
  <!-- The loading of KaTeX is deferred to speed up page rendering -->
37
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/katex.min.js" integrity="sha384-JRVVAdBKoQa7uhd8heKqlQyzByQCC57fpvrCw9iSahjP5bLB5b+hX0klEdjZmsH6" crossorigin="anonymous"></script>
37
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" crossorigin="anonymous"></script>
38
38
 
39
39
  <!-- To automatically render math in text elements, include the auto-render extension: -->
40
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
40
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
41
41
  onload="renderMathInElement(document.body);"></script>
42
42
  </head>
43
43
  ...
@@ -21,8 +21,8 @@ provided by this extension). Without this CSS, partially selected equations
21
21
  will just get the usual HTML copy/paste behavior.
22
22
 
23
23
  ```html
24
- <link href="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css">
25
- <script src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/copy-tex.min.js" integrity="sha384-Ep9Es0VCjVn9dFeaN2uQxgGcGmG+pfZ4eBaHxUpxXDORrrVACZVOpywyzvFRGbmv" crossorigin="anonymous"></script>
24
+ <link href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css">
25
+ <script src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/copy-tex.min.js" integrity="sha384-Ep9Es0VCjVn9dFeaN2uQxgGcGmG+pfZ4eBaHxUpxXDORrrVACZVOpywyzvFRGbmv" crossorigin="anonymous"></script>
26
26
  ```
27
27
 
28
28
  See [index.html](index.html) for an example.
@@ -37,7 +37,7 @@ statement with `require('katex/contrib/copy-tex/katex2tex.js')`.
37
37
 
38
38
  ECMAScript module is also available:
39
39
  ```html
40
- <script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/copy-tex.mjs" integrity="sha384-+gSYJ3yzY30+a6FGYJXOx9swmWs5oPKEi1AeCsAxsLexABlUXgHXkOkEZCj0Lz8U" crossorigin="anonymous"></script>
40
+ <script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/copy-tex.mjs" integrity="sha384-+gSYJ3yzY30+a6FGYJXOx9swmWs5oPKEi1AeCsAxsLexABlUXgHXkOkEZCj0Lz8U" crossorigin="anonymous"></script>
41
41
  ```
42
42
 
43
43
  ### Known Issues
@@ -11,7 +11,7 @@ included in the page, in addition to KaTeX.
11
11
  Load the extension by adding the following line to your HTML file.
12
12
 
13
13
  ```html
14
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script>
14
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script>
15
15
  ```
16
16
  You can download the script and use it locally, or from a local KaTeX installation instead.
17
17
 
@@ -23,9 +23,9 @@ Then, in the body, we use a `math/tex` script to typeset the equation `x+\sqrt{1
23
23
  <!DOCTYPE html>
24
24
  <html>
25
25
  <head>
26
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/katex.min.css" integrity="sha384-SfHjyzed8eCsTSa4t2GoMc4WnsCLa6cQpFqPRCaizz0FlQUOyafw/AyIUCQU/KuM" crossorigin="anonymous">
27
- <script src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/katex.min.js" integrity="sha384-JRVVAdBKoQa7uhd8heKqlQyzByQCC57fpvrCw9iSahjP5bLB5b+hX0klEdjZmsH6" crossorigin="anonymous"></script>
28
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script>
26
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
27
+ <script src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" crossorigin="anonymous"></script>
28
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script>
29
29
  </head>
30
30
  <body>
31
31
  <script type="math/tex">x+\sqrt{1-x^2}</script>
@@ -35,4 +35,4 @@ Then, in the body, we use a `math/tex` script to typeset the equation `x+\sqrt{1
35
35
 
36
36
  ECMAScript module is also available:
37
37
  ```html
38
- <script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/mathtex-script-type.mjs" integrity="sha384-4EJvC5tvqq9XJxXvdD4JutBokuFw/dCe2AB4gZ9sRpwFFXECpL3qT43tmE0PkpVg" crossorigin="anonymous"></script>
38
+ <script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/mathtex-script-type.mjs" integrity="sha384-4EJvC5tvqq9XJxXvdD4JutBokuFw/dCe2AB4gZ9sRpwFFXECpL3qT43tmE0PkpVg" crossorigin="anonymous"></script>
@@ -7,7 +7,7 @@ This extension adds to KaTeX the `\ce` and `\pu` functions from the [mhchem](htt
7
7
  This extension isn't part of core KaTeX, so the script should be separately included. Write the following line into the HTML page's `<head>`. Place it *after* the line that calls `katex.js`, and if you make use of the [auto-render](https://katex.org/docs/autorender.html) extension, place it *before* the line that calls `auto-render.js`.
8
8
 
9
9
  ```html
10
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/mhchem.min.js" integrity="sha384-UEY9IRPkV+TTTY7nK1wSrfhWPDJy9wr4PmYg3DLPcN5F4NDlIwGZkWtWveKR/45c" crossorigin="anonymous"></script>
10
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/mhchem.min.js" integrity="sha384-UEY9IRPkV+TTTY7nK1wSrfhWPDJy9wr4PmYg3DLPcN5F4NDlIwGZkWtWveKR/45c" crossorigin="anonymous"></script>
11
11
  ```
12
12
 
13
13
  If you remove the `defer` attribute from this tag, then you must also remove the `defer` attribute from the `<script src="https://../katex.min.js">` tag.
package/dist/README.md CHANGED
@@ -31,13 +31,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
31
31
  <!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
32
32
  <html>
33
33
  <head>
34
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/katex.min.css" integrity="sha384-SfHjyzed8eCsTSa4t2GoMc4WnsCLa6cQpFqPRCaizz0FlQUOyafw/AyIUCQU/KuM" crossorigin="anonymous">
34
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
35
35
 
36
36
  <!-- The loading of KaTeX is deferred to speed up page rendering -->
37
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/katex.min.js" integrity="sha384-JRVVAdBKoQa7uhd8heKqlQyzByQCC57fpvrCw9iSahjP5bLB5b+hX0klEdjZmsH6" crossorigin="anonymous"></script>
37
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" crossorigin="anonymous"></script>
38
38
 
39
39
  <!-- To automatically render math in text elements, include the auto-render extension: -->
40
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
40
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
41
41
  onload="renderMathInElement(document.body);"></script>
42
42
  </head>
43
43
  ...
package/dist/katex.css CHANGED
@@ -130,7 +130,7 @@
130
130
  border-color: currentColor;
131
131
  }
132
132
  .katex .katex-version::after {
133
- content: "0.15.0";
133
+ content: "0.15.1";
134
134
  }
135
135
  .katex .katex-mathml {
136
136
  /* Accessibility hack to only show to screen readers
package/dist/katex.js CHANGED
@@ -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
- addEqnNum = _ref.addEqnNum,
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 = []; // Test for \hline at the top of the array.
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); // check for \hline(s) following the row separator
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
- addEqnNum: addEqnNum,
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 eqnNumSpans = [];
10569
+ var tagSpans = [];
10428
10570
 
10429
- if (group.addEqnNum) {
10430
- // An environment with automatic equation numbers.
10431
- // Create node(s) that will trigger CSS counter increment.
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 eqnTag = buildCommon.makeSpan(["eqn-num"], [], options);
10436
- eqnTag.depth = rw.depth;
10437
- eqnTag.height = rw.height;
10438
- eqnNumSpans.push({
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: eqnTag,
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 (!group.addEqnNum) {
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: eqnNumSpans
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.addEqnNum) {
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
- addEqnNum: context.envName === "align" || context.envName === "alignat",
10903
+ autoTag: isSplit ? undefined : getAutoTag(context.envName),
10746
10904
  emptySingleRow: true,
10747
10905
  colSeparationType: separationType,
10748
- maxNumCols: context.envName === "split" ? 2 : undefined,
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
- addEqnNum: context.envName === "gather",
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
- addEqnNum: context.envName === "equation",
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
- }); // Catch \hline outside array environment
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",
@@ -13282,19 +13442,6 @@ defineFunction({
13282
13442
  htmlBuilder: op_htmlBuilder,
13283
13443
  mathmlBuilder: op_mathmlBuilder
13284
13444
  });
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
13445
  ;// CONCATENATED MODULE: ./src/functions/operatorname.js
13299
13446
 
13300
13447
 
@@ -14847,96 +14994,6 @@ var functions = _functions;
14847
14994
 
14848
14995
 
14849
14996
 
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
14997
  ;// CONCATENATED MODULE: ./src/Lexer.js
14941
14998
  /**
14942
14999
  * The Lexer class handles tokenizing the input in various ways. Since our
@@ -15122,7 +15179,7 @@ var Namespace = /*#__PURE__*/function () {
15122
15179
 
15123
15180
  for (var undef in undefs) {
15124
15181
  if (undefs.hasOwnProperty(undef)) {
15125
- if (undefs[undef] === undefined) {
15182
+ if (undefs[undef] == null) {
15126
15183
  delete this.current[undef];
15127
15184
  } else {
15128
15185
  this.current[undef] = undefs[undef];
@@ -15172,6 +15229,7 @@ var Namespace = /*#__PURE__*/function () {
15172
15229
  * Local set() sets the current value and (when appropriate) adds an undo
15173
15230
  * operation to the undo stack. Global set() may change the undo
15174
15231
  * operation at every level, so takes time linear in their number.
15232
+ * A value of undefined means to delete existing definitions.
15175
15233
  */
15176
15234
  ;
15177
15235
 
@@ -15203,7 +15261,11 @@ var Namespace = /*#__PURE__*/function () {
15203
15261
  }
15204
15262
  }
15205
15263
 
15206
- this.current[name] = value;
15264
+ if (value == null) {
15265
+ delete this.current[name];
15266
+ } else {
15267
+ this.current[name] = value;
15268
+ }
15207
15269
  };
15208
15270
 
15209
15271
  return Namespace;
@@ -17193,6 +17255,25 @@ var Parser = /*#__PURE__*/function () {
17193
17255
  } finally {
17194
17256
  this.gullet.endGroups();
17195
17257
  }
17258
+ }
17259
+ /**
17260
+ * Fully parse a separate sequence of tokens as a separate job.
17261
+ * Tokens should be specified in reverse order, as in a MacroDefinition.
17262
+ */
17263
+ ;
17264
+
17265
+ _proto.subparse = function subparse(tokens) {
17266
+ // Save the next token from the current job.
17267
+ var oldToken = this.nextToken;
17268
+ this.consume(); // Run the new job, terminating it with an excess '}'
17269
+
17270
+ this.gullet.pushToken(new Token("}"));
17271
+ this.gullet.pushTokens(tokens);
17272
+ var parse = this.parseExpression(false);
17273
+ this.expect("}"); // Restore the next token from the current job.
17274
+
17275
+ this.nextToken = oldToken;
17276
+ return parse;
17196
17277
  };
17197
17278
 
17198
17279
  /**
@@ -18118,6 +18199,7 @@ Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
18118
18199
 
18119
18200
 
18120
18201
 
18202
+
18121
18203
  /**
18122
18204
  * Parses an expression using a Parser, then returns the parsed result.
18123
18205
  */
@@ -18140,12 +18222,11 @@ var parseTree = function parseTree(toParse, settings) {
18140
18222
  throw new src_ParseError("\\tag works only in display equations");
18141
18223
  }
18142
18224
 
18143
- parser.gullet.feed("\\df@tag");
18144
18225
  tree = [{
18145
18226
  type: "tag",
18146
18227
  mode: "text",
18147
18228
  body: tree,
18148
- tag: parser.parse()
18229
+ tag: parser.subparse([new Token("\\df@tag")])
18149
18230
  }];
18150
18231
  }
18151
18232
 
@@ -18266,7 +18347,7 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
18266
18347
  /**
18267
18348
  * Current KaTeX version
18268
18349
  */
18269
- version: "0.15.0",
18350
+ version: "0.15.1",
18270
18351
 
18271
18352
  /**
18272
18353
  * Renders the given LaTeX into an HTML+MathML combination, and adds