katex 0.16.44 → 0.16.45

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/dist/katex.mjs CHANGED
@@ -549,6 +549,17 @@ function supportedCodepoint(codepoint) {
549
549
  * It's a storehouse of path geometry for SVG images.
550
550
  */
551
551
  // In all paths below, the viewBox-to-em scale is 1000:1.
552
+ // Second Brush Stroke
553
+ // Low resolution monitors struggle to display images in fine detail.
554
+ // So browsers apply anti-aliasing. A long straight arrow shaft therefore
555
+ // will sometimes appear as if it has a blurred edge.
556
+ // To mitigate this, these SVG files contain a second "brush-stroke" on the
557
+ // arrow shafts. That is, a second long thin rectangular SVG path has been
558
+ // written directly on top of each arrow shaft. This reinforcement causes
559
+ // some of the screen pixels to display as black instead of the anti-aliased
560
+ // gray pixel that a single path would generate. So we get arrow shafts
561
+ // whose edges appear to be sharper.
562
+ var doubleBrushStroke = svgPath => svgPath + " " + svgPath;
552
563
  var hLinePad = 80; // padding above a sqrt vinculum. Prevents image cropping.
553
564
  // The vinculum of a \sqrt can be made thicker by a KaTeX rendering option.
554
565
  // Think of variable extraVinculum as two detours in the SVG path.
@@ -627,23 +638,23 @@ var innerPath = function innerPath(name, height) {
627
638
  // The inner part of stretchy tall delimiters
628
639
  switch (name) {
629
640
  case "\u239c":
630
- return "M291 0 H417 V" + height + " H291z M291 0 H417 V" + height + " H291z";
641
+ return doubleBrushStroke("M291 0 H417 V" + height + " H291z");
631
642
  case "\u2223":
632
- return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z";
643
+ return doubleBrushStroke("M145 0 H188 V" + height + " H145z");
633
644
  case "\u2225":
634
- return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z" + ("M367 0 H410 V" + height + " H367z M367 0 H410 V" + height + " H367z");
645
+ return doubleBrushStroke("M145 0 H188 V" + height + " H145z") + doubleBrushStroke("M367 0 H410 V" + height + " H367z");
635
646
  case "\u239f":
636
- return "M457 0 H583 V" + height + " H457z M457 0 H583 V" + height + " H457z";
647
+ return doubleBrushStroke("M457 0 H583 V" + height + " H457z");
637
648
  case "\u23a2":
638
- return "M319 0 H403 V" + height + " H319z M319 0 H403 V" + height + " H319z";
649
+ return doubleBrushStroke("M319 0 H403 V" + height + " H319z");
639
650
  case "\u23a5":
640
- return "M263 0 H347 V" + height + " H263z M263 0 H347 V" + height + " H263z";
651
+ return doubleBrushStroke("M263 0 H347 V" + height + " H263z");
641
652
  case "\u23aa":
642
- return "M384 0 H504 V" + height + " H384z M384 0 H504 V" + height + " H384z";
653
+ return doubleBrushStroke("M384 0 H504 V" + height + " H384z");
643
654
  case "\u23d0":
644
- return "M312 0 H355 V" + height + " H312z M312 0 H355 V" + height + " H312z";
655
+ return doubleBrushStroke("M312 0 H355 V" + height + " H312z");
645
656
  case "\u2016":
646
- return "M257 0 H300 V" + height + " H257z M257 0 H300 V" + height + " H257z" + ("M478 0 H521 V" + height + " H478z M478 0 H521 V" + height + " H478z");
657
+ return doubleBrushStroke("M257 0 H300 V" + height + " H257z") + doubleBrushStroke("M478 0 H521 V" + height + " H478z");
647
658
  default:
648
659
  return "";
649
660
  }
@@ -668,13 +679,13 @@ var path = {
668
679
  leftharpoondownplus: "M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",
669
680
  // hook is from glyph U+21A9 in font KaTeX Main
670
681
  lefthook: "M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",
671
- leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",
672
- leftbracketunder: "M0 0 h120 V290 H399995 v120 H0z\nM0 0 h120 V290 H399995 v120 H0z",
673
- leftbracketover: "M0 440 h120 V150 H399995 v-120 H0z\nM0 440 h120 V150 H399995 v-120 H0z",
674
- leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",
682
+ leftlinesegment: doubleBrushStroke("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),
683
+ leftbracketunder: doubleBrushStroke("M0 0 h120 V290 H399995 v120 H0z"),
684
+ leftbracketover: doubleBrushStroke("M0 440 h120 V150 H399995 v-120 H0z"),
685
+ leftmapsto: doubleBrushStroke("M40 281 V448H0V74H40V241H400000v40z"),
675
686
  // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
676
687
  leftToFrom: "M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",
677
- longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",
688
+ longequal: doubleBrushStroke("M0 50 h400000 v40H0z m0 194h40000v40H0z"),
678
689
  midbrace: "M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",
679
690
  midbraceunder: "M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",
680
691
  oiintSize1: "M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",
@@ -691,9 +702,9 @@ var path = {
691
702
  rightharpoondown: "M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",
692
703
  rightharpoondownplus: "M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",
693
704
  righthook: "M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",
694
- rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",
695
- rightbracketunder: "M399995 0 h-120 V290 H0 v120 H400000z\nM399995 0 h-120 V290 H0 v120 H400000z",
696
- rightbracketover: "M399995 440 h-120 V150 H0 v-120 H399995z\nM399995 440 h-120 V150 H0 v-120 H399995z",
705
+ rightlinesegment: doubleBrushStroke("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),
706
+ rightbracketunder: doubleBrushStroke("M399995 0 h-120 V290 H0 v120 H400000z"),
707
+ rightbracketover: doubleBrushStroke("M399995 440 h-120 V150 H0 v-120 H399995z"),
697
708
  rightToFrom: "M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",
698
709
  // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
699
710
  twoheadleftarrow: "M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",
@@ -6459,16 +6470,6 @@ var stretchyMathML = function stretchyMathML(label) {
6459
6470
  // without distortion.
6460
6471
  // Some functions, such as \cancel, need to vary their aspect ratio. These
6461
6472
  // functions do not get the overflow SVG treatment.
6462
- // Second Brush Stroke
6463
- // Low resolution monitors struggle to display images in fine detail.
6464
- // So browsers apply anti-aliasing. A long straight arrow shaft therefore
6465
- // will sometimes appear as if it has a blurred edge.
6466
- // To mitigate this, these SVG files contain a second "brush-stroke" on the
6467
- // arrow shafts. That is, a second long thin rectangular SVG path has been
6468
- // written directly on top of each arrow shaft. This reinforcement causes
6469
- // some of the screen pixels to display as black instead of the anti-aliased
6470
- // gray pixel that a single path would generate. So we get arrow shafts
6471
- // whose edges appear to be sharper.
6472
6473
  // In the katexImagesData object just below, the dimensions all
6473
6474
  // correspond to path geometry inside the relevant SVG.
6474
6475
  // For example, \overrightarrow uses the same arrowhead as glyph U+2192
@@ -13265,7 +13266,9 @@ defineFunction({
13265
13266
  // There is no way to do this in MathML.
13266
13267
  // Write a class as a breadcrumb in case some post-processor wants
13267
13268
  // to perform a vcenter adjustment.
13268
- return new MathNode("mpadded", [buildGroup(group.body, options)], ["vcenter"]);
13269
+ // Wrap in mrow to ensure valid MathML when placed inside mo (e.g., \mathrel)
13270
+ var mpadded = new MathNode("mpadded", [buildGroup(group.body, options)], ["vcenter"]);
13271
+ return new MathNode("mrow", [mpadded]);
13269
13272
  }
13270
13273
  });
13271
13274
 
@@ -16404,7 +16407,7 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
16404
16407
  return renderError(error, expression, settings);
16405
16408
  }
16406
16409
  };
16407
- var version = "0.16.44";
16410
+ var version = "0.16.45";
16408
16411
  var __domTree = {
16409
16412
  Span,
16410
16413
  Anchor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "katex",
3
- "version": "0.16.44",
3
+ "version": "0.16.45",
4
4
  "description": "Fast math typesetting for the web.",
5
5
  "main": "dist/katex.js",
6
6
  "types": "types/katex.d.ts",
@@ -36,7 +36,9 @@ defineFunction({
36
36
  // There is no way to do this in MathML.
37
37
  // Write a class as a breadcrumb in case some post-processor wants
38
38
  // to perform a vcenter adjustment.
39
- return new MathNode(
39
+ // Wrap in mrow to ensure valid MathML when placed inside mo (e.g., \mathrel)
40
+ const mpadded = new MathNode(
40
41
  "mpadded", [mml.buildGroup(group.body, options)], ["vcenter"]);
42
+ return new MathNode("mrow", [mpadded]);
41
43
  },
42
44
  });
package/src/stretchy.ts CHANGED
@@ -96,18 +96,6 @@ export const stretchyMathML = function(label: string): MathNode {
96
96
  // Some functions, such as \cancel, need to vary their aspect ratio. These
97
97
  // functions do not get the overflow SVG treatment.
98
98
 
99
- // Second Brush Stroke
100
- // Low resolution monitors struggle to display images in fine detail.
101
- // So browsers apply anti-aliasing. A long straight arrow shaft therefore
102
- // will sometimes appear as if it has a blurred edge.
103
-
104
- // To mitigate this, these SVG files contain a second "brush-stroke" on the
105
- // arrow shafts. That is, a second long thin rectangular SVG path has been
106
- // written directly on top of each arrow shaft. This reinforcement causes
107
- // some of the screen pixels to display as black instead of the anti-aliased
108
- // gray pixel that a single path would generate. So we get arrow shafts
109
- // whose edges appear to be sharper.
110
-
111
99
  // In the katexImagesData object just below, the dimensions all
112
100
  // correspond to path geometry inside the relevant SVG.
113
101
  // For example, \overrightarrow uses the same arrowhead as glyph U+2192
@@ -5,6 +5,19 @@
5
5
 
6
6
  // In all paths below, the viewBox-to-em scale is 1000:1.
7
7
 
8
+ // Second Brush Stroke
9
+ // Low resolution monitors struggle to display images in fine detail.
10
+ // So browsers apply anti-aliasing. A long straight arrow shaft therefore
11
+ // will sometimes appear as if it has a blurred edge.
12
+
13
+ // To mitigate this, these SVG files contain a second "brush-stroke" on the
14
+ // arrow shafts. That is, a second long thin rectangular SVG path has been
15
+ // written directly on top of each arrow shaft. This reinforcement causes
16
+ // some of the screen pixels to display as black instead of the anti-aliased
17
+ // gray pixel that a single path would generate. So we get arrow shafts
18
+ // whose edges appear to be sharper.
19
+ const doubleBrushStroke = (svgPath: string): string => `${svgPath} ${svgPath}`;
20
+
8
21
  const hLinePad = 80; // padding above a sqrt vinculum. Prevents image cropping.
9
22
 
10
23
  // The vinculum of a \sqrt can be made thicker by a KaTeX rendering option.
@@ -154,25 +167,25 @@ export const innerPath = function(name: string, height: number): string {
154
167
  // The inner part of stretchy tall delimiters
155
168
  switch (name) {
156
169
  case "\u239c":
157
- return `M291 0 H417 V${height} H291z M291 0 H417 V${height} H291z`;
170
+ return doubleBrushStroke(`M291 0 H417 V${height} H291z`);
158
171
  case "\u2223":
159
- return `M145 0 H188 V${height} H145z M145 0 H188 V${height} H145z`;
172
+ return doubleBrushStroke(`M145 0 H188 V${height} H145z`);
160
173
  case "\u2225":
161
- return `M145 0 H188 V${height} H145z M145 0 H188 V${height} H145z` +
162
- `M367 0 H410 V${height} H367z M367 0 H410 V${height} H367z`;
174
+ return doubleBrushStroke(`M145 0 H188 V${height} H145z`) +
175
+ doubleBrushStroke(`M367 0 H410 V${height} H367z`);
163
176
  case "\u239f":
164
- return `M457 0 H583 V${height} H457z M457 0 H583 V${height} H457z`;
177
+ return doubleBrushStroke(`M457 0 H583 V${height} H457z`);
165
178
  case "\u23a2":
166
- return `M319 0 H403 V${height} H319z M319 0 H403 V${height} H319z`;
179
+ return doubleBrushStroke(`M319 0 H403 V${height} H319z`);
167
180
  case "\u23a5":
168
- return `M263 0 H347 V${height} H263z M263 0 H347 V${height} H263z`;
181
+ return doubleBrushStroke(`M263 0 H347 V${height} H263z`);
169
182
  case "\u23aa":
170
- return `M384 0 H504 V${height} H384z M384 0 H504 V${height} H384z`;
183
+ return doubleBrushStroke(`M384 0 H504 V${height} H384z`);
171
184
  case "\u23d0":
172
- return `M312 0 H355 V${height} H312z M312 0 H355 V${height} H312z`;
185
+ return doubleBrushStroke(`M312 0 H355 V${height} H312z`);
173
186
  case "\u2016":
174
- return `M257 0 H300 V${height} H257z M257 0 H300 V${height} H257z` +
175
- `M478 0 H521 V${height} H478z M478 0 H521 V${height} H478z`;
187
+ return doubleBrushStroke(`M257 0 H300 V${height} H257z`) +
188
+ doubleBrushStroke(`M478 0 H521 V${height} H478z`);
176
189
  default:
177
190
  return "";
178
191
  }
@@ -256,17 +269,13 @@ v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,
256
269
  -68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
257
270
  71.5 23h399859zM103 281v-40h399897v40z`,
258
271
 
259
- leftlinesegment: `M40 281 V428 H0 V94 H40 V241 H400000 v40z
260
- M40 281 V428 H0 V94 H40 V241 H400000 v40z`,
272
+ leftlinesegment: doubleBrushStroke(`M40 281 V428 H0 V94 H40 V241 H400000 v40z`),
261
273
 
262
- leftbracketunder: `M0 0 h120 V290 H399995 v120 H0z
263
- M0 0 h120 V290 H399995 v120 H0z`,
274
+ leftbracketunder: doubleBrushStroke(`M0 0 h120 V290 H399995 v120 H0z`),
264
275
 
265
- leftbracketover: `M0 440 h120 V150 H399995 v-120 H0z
266
- M0 440 h120 V150 H399995 v-120 H0z`,
276
+ leftbracketover: doubleBrushStroke(`M0 440 h120 V150 H399995 v-120 H0z`),
267
277
 
268
- leftmapsto: `M40 281 V448H0V74H40V241H400000v40z
269
- M40 281 V448H0V74H40V241H400000v40z`,
278
+ leftmapsto: doubleBrushStroke(`M40 281 V448H0V74H40V241H400000v40z`),
270
279
 
271
280
  // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
272
281
  leftToFrom: `M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
@@ -274,8 +283,7 @@ M40 281 V448H0V74H40V241H400000v40z`,
274
283
  c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
275
284
  68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,
276
285
 
277
- longequal: `M0 50 h400000 v40H0z m0 194h40000v40H0z
278
- M0 50 h400000 v40H0z m0 194h40000v40H0z`,
286
+ longequal: doubleBrushStroke(`M0 50 h400000 v40H0z m0 194h40000v40H0z`),
279
287
 
280
288
  midbrace: `M200428 334
281
289
  c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
@@ -358,14 +366,11 @@ m0-194v40h400000v-40zm0 0v40h400000v-40z`,
358
366
  -13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
359
367
  66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,
360
368
 
361
- rightlinesegment: `M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
362
- M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,
369
+ rightlinesegment: doubleBrushStroke(`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`),
363
370
 
364
- rightbracketunder: `M399995 0 h-120 V290 H0 v120 H400000z
365
- M399995 0 h-120 V290 H0 v120 H400000z`,
371
+ rightbracketunder: doubleBrushStroke(`M399995 0 h-120 V290 H0 v120 H400000z`),
366
372
 
367
- rightbracketover: `M399995 440 h-120 V150 H0 v-120 H399995z
368
- M399995 440 h-120 V150 H0 v-120 H399995z`,
373
+ rightbracketover: doubleBrushStroke(`M399995 440 h-120 V150 H0 v-120 H399995z`),
369
374
 
370
375
  rightToFrom: `M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
371
376
  1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32