katex 0.16.5 → 0.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/contrib/auto-render/test/auto-render-spec.js +1 -1
- package/contrib/copy-tex/README.md +2 -2
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/contrib/mhchem/mhchem.js +2 -2
- package/contrib/render-a11y-string/render-a11y-string.js +1 -1
- package/dist/README.md +3 -3
- package/dist/contrib/mhchem.js +2 -2
- package/dist/contrib/mhchem.mjs +1 -1
- package/dist/contrib/render-a11y-string.js +1 -1
- package/dist/contrib/render-a11y-string.mjs +1 -1
- package/dist/katex.css +1 -1
- package/dist/katex.js +91 -90
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +91 -90
- package/package.json +1 -1
- package/src/MacroExpander.js +21 -22
- package/src/Parser.js +1 -1
- package/src/buildMathML.js +2 -2
- package/src/defineEnvironment.js +1 -1
- package/src/defineMacro.js +1 -1
- package/src/delimiter.js +20 -20
- package/src/environments/array.js +2 -2
- package/src/fontMetrics.js +4 -4
- package/src/functions/arrow.js +1 -1
- package/src/functions/delimsizing.js +1 -1
- package/src/katex.less +1 -1
- package/src/mathMLTree.js +2 -2
- package/src/parseNode.js +1 -1
- package/src/svgGeometry.js +51 -51
package/src/delimiter.js
CHANGED
|
@@ -364,7 +364,7 @@ const makeStackedDelim = function(
|
|
|
364
364
|
middleFactor = 2; // repeat symmetrically above and below middle
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
//
|
|
367
|
+
// Calculate the minimal height that the delimiter can have.
|
|
368
368
|
// It is at least the size of the top, bottom, and optional middle combined.
|
|
369
369
|
const minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal;
|
|
370
370
|
|
|
@@ -453,7 +453,7 @@ const makeStackedDelim = function(
|
|
|
453
453
|
Style.TEXT, options, classes);
|
|
454
454
|
};
|
|
455
455
|
|
|
456
|
-
// All surds have 0.08em padding above the
|
|
456
|
+
// All surds have 0.08em padding above the vinculum inside the SVG.
|
|
457
457
|
// That keeps browser span height rounding error from pinching the line.
|
|
458
458
|
const vbPad = 80; // padding above the surd, measured inside the viewBox.
|
|
459
459
|
const emPad = 0.08; // padding, in ems, measured in the document.
|
|
@@ -462,10 +462,10 @@ const sqrtSvg = function(
|
|
|
462
462
|
sqrtName: string,
|
|
463
463
|
height: number,
|
|
464
464
|
viewBoxHeight: number,
|
|
465
|
-
|
|
465
|
+
extraVinculum: number,
|
|
466
466
|
options: Options,
|
|
467
467
|
): SvgSpan {
|
|
468
|
-
const path = sqrtPath(sqrtName,
|
|
468
|
+
const path = sqrtPath(sqrtName, extraVinculum, viewBoxHeight);
|
|
469
469
|
const pathNode = new PathNode(sqrtName, path);
|
|
470
470
|
|
|
471
471
|
const svg = new SvgNode([pathNode], {
|
|
@@ -500,9 +500,9 @@ const makeSqrtImage = function(
|
|
|
500
500
|
|
|
501
501
|
let sizeMultiplier = newOptions.sizeMultiplier; // default
|
|
502
502
|
|
|
503
|
-
// The standard sqrt SVGs each have a 0.04em thick
|
|
504
|
-
// If Settings.minRuleThickness is larger than that, we add
|
|
505
|
-
const
|
|
503
|
+
// The standard sqrt SVGs each have a 0.04em thick vinculum.
|
|
504
|
+
// If Settings.minRuleThickness is larger than that, we add extraVinculum.
|
|
505
|
+
const extraVinculum = Math.max(0,
|
|
506
506
|
options.minRuleThickness - options.fontMetrics().sqrtRuleThickness);
|
|
507
507
|
|
|
508
508
|
// Create a span containing an SVG image of a sqrt symbol.
|
|
@@ -514,22 +514,22 @@ const makeSqrtImage = function(
|
|
|
514
514
|
|
|
515
515
|
// We create viewBoxes with 80 units of "padding" above each surd.
|
|
516
516
|
// Then browser rounding error on the parent span height will not
|
|
517
|
-
// encroach on the ink of the
|
|
517
|
+
// encroach on the ink of the vinculum. But that padding is not
|
|
518
518
|
// included in the TeX-like `height` used for calculation of
|
|
519
519
|
// vertical alignment. So texHeight = span.height < span.style.height.
|
|
520
520
|
|
|
521
521
|
if (delim.type === "small") {
|
|
522
522
|
// Get an SVG that is derived from glyph U+221A in font KaTeX-Main.
|
|
523
523
|
// 1000 unit normal glyph height.
|
|
524
|
-
viewBoxHeight = 1000 + 1000 *
|
|
524
|
+
viewBoxHeight = 1000 + 1000 * extraVinculum + vbPad;
|
|
525
525
|
if (height < 1.0) {
|
|
526
526
|
sizeMultiplier = 1.0; // mimic a \textfont radical
|
|
527
527
|
} else if (height < 1.4) {
|
|
528
528
|
sizeMultiplier = 0.7; // mimic a \scriptfont radical
|
|
529
529
|
}
|
|
530
|
-
spanHeight = (1.0 +
|
|
531
|
-
texHeight = (1.00 +
|
|
532
|
-
span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight,
|
|
530
|
+
spanHeight = (1.0 + extraVinculum + emPad) / sizeMultiplier;
|
|
531
|
+
texHeight = (1.00 + extraVinculum) / sizeMultiplier;
|
|
532
|
+
span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraVinculum,
|
|
533
533
|
options);
|
|
534
534
|
span.style.minWidth = "0.853em";
|
|
535
535
|
advanceWidth = 0.833 / sizeMultiplier; // from the font.
|
|
@@ -537,21 +537,21 @@ const makeSqrtImage = function(
|
|
|
537
537
|
} else if (delim.type === "large") {
|
|
538
538
|
// These SVGs come from fonts: KaTeX_Size1, _Size2, etc.
|
|
539
539
|
viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size];
|
|
540
|
-
texHeight = (sizeToMaxHeight[delim.size] +
|
|
541
|
-
spanHeight = (sizeToMaxHeight[delim.size] +
|
|
540
|
+
texHeight = (sizeToMaxHeight[delim.size] + extraVinculum) / sizeMultiplier;
|
|
541
|
+
spanHeight = (sizeToMaxHeight[delim.size] + extraVinculum + emPad)
|
|
542
542
|
/ sizeMultiplier;
|
|
543
543
|
span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight,
|
|
544
|
-
|
|
544
|
+
extraVinculum, options);
|
|
545
545
|
span.style.minWidth = "1.02em";
|
|
546
546
|
advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font.
|
|
547
547
|
|
|
548
548
|
} else {
|
|
549
549
|
// Tall sqrt. In TeX, this would be stacked using multiple glyphs.
|
|
550
550
|
// We'll use a single SVG to accomplish the same thing.
|
|
551
|
-
spanHeight = height +
|
|
552
|
-
texHeight = height +
|
|
553
|
-
viewBoxHeight = Math.floor(1000 * height +
|
|
554
|
-
span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight,
|
|
551
|
+
spanHeight = height + extraVinculum + emPad;
|
|
552
|
+
texHeight = height + extraVinculum;
|
|
553
|
+
viewBoxHeight = Math.floor(1000 * height + extraVinculum) + vbPad;
|
|
554
|
+
span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraVinculum,
|
|
555
555
|
options);
|
|
556
556
|
span.style.minWidth = "0.742em";
|
|
557
557
|
advanceWidth = 1.056;
|
|
@@ -567,7 +567,7 @@ const makeSqrtImage = function(
|
|
|
567
567
|
// This actually should depend on the chosen font -- e.g. \boldmath
|
|
568
568
|
// should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
|
|
569
569
|
// have thicker rules.
|
|
570
|
-
ruleWidth: (options.fontMetrics().sqrtRuleThickness +
|
|
570
|
+
ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraVinculum)
|
|
571
571
|
* sizeMultiplier,
|
|
572
572
|
};
|
|
573
573
|
};
|
|
@@ -573,8 +573,8 @@ const mathmlBuilder: MathMLBuilder<"array"> = function(group, options) {
|
|
|
573
573
|
// We simulate this by adding (arraystretch - 1)em to the gap. This
|
|
574
574
|
// does a reasonable job of adjusting arrays containing 1 em tall content.
|
|
575
575
|
|
|
576
|
-
// The 0.16 and 0.09 values are found
|
|
577
|
-
// similar to LaTeX and in which content does not interfere with \
|
|
576
|
+
// The 0.16 and 0.09 values are found empirically. They produce an array
|
|
577
|
+
// similar to LaTeX and in which content does not interfere with \hlines.
|
|
578
578
|
const gap = (group.arraystretch === 0.5)
|
|
579
579
|
? 0.1 // {smallmatrix}, {subarray}
|
|
580
580
|
: 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
|
package/src/fontMetrics.js
CHANGED
|
@@ -13,9 +13,9 @@ import type {Mode} from "./types";
|
|
|
13
13
|
// In TeX, there are actually three sets of dimensions, one for each of
|
|
14
14
|
// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:
|
|
15
15
|
// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are
|
|
16
|
-
// provided in the
|
|
16
|
+
// provided in the arrays below, in that order.
|
|
17
17
|
//
|
|
18
|
-
// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5
|
|
18
|
+
// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respectively.
|
|
19
19
|
// This was determined by running the following script:
|
|
20
20
|
//
|
|
21
21
|
// latex -interaction=nonstopmode \
|
|
@@ -25,7 +25,7 @@ import type {Mode} from "./types";
|
|
|
25
25
|
// '\expandafter\show\the\scriptscriptfont2' \
|
|
26
26
|
// '\stop'
|
|
27
27
|
//
|
|
28
|
-
// The metrics themselves were
|
|
28
|
+
// The metrics themselves were retrieved using the following commands:
|
|
29
29
|
//
|
|
30
30
|
// tftopl cmsy10
|
|
31
31
|
// tftopl cmsy7
|
|
@@ -230,7 +230,7 @@ export function getCharacterMetrics(
|
|
|
230
230
|
// So if the character is in a script we support but we
|
|
231
231
|
// don't have metrics for it, just use the metrics for
|
|
232
232
|
// the Latin capital letter M. This is close enough because
|
|
233
|
-
// we (currently) only care about the height of the
|
|
233
|
+
// we (currently) only care about the height of the glyph
|
|
234
234
|
// not its width.
|
|
235
235
|
if (supportedCodepoint(ch)) {
|
|
236
236
|
metrics = metricMap[font][77]; // 77 is the charcode for 'M'
|
package/src/functions/arrow.js
CHANGED
|
@@ -47,7 +47,7 @@ defineFunction({
|
|
|
47
47
|
};
|
|
48
48
|
},
|
|
49
49
|
// Flow is unable to correctly infer the type of `group`, even though it's
|
|
50
|
-
//
|
|
50
|
+
// unambiguously determined from the passed-in `type` above.
|
|
51
51
|
htmlBuilder(group: ParseNode<"xArrow">, options) {
|
|
52
52
|
const style = options.style;
|
|
53
53
|
|
|
@@ -342,7 +342,7 @@ defineFunction({
|
|
|
342
342
|
return middleDelim;
|
|
343
343
|
},
|
|
344
344
|
mathmlBuilder: (group, options) => {
|
|
345
|
-
// A Firefox \middle will
|
|
345
|
+
// A Firefox \middle will stretch a character vertically only if it
|
|
346
346
|
// is in the fence part of the operator dictionary at:
|
|
347
347
|
// https://www.w3.org/TR/MathML3/appendixc.html.
|
|
348
348
|
// So we need to avoid U+2223 and use plain "|" instead.
|
package/src/katex.less
CHANGED
package/src/mathMLTree.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* since we're mainly using MathML to improve accessibility, we don't manage
|
|
6
6
|
* any of the styling state that the plain DOM nodes do.
|
|
7
7
|
*
|
|
8
|
-
* The `toNode` and `toMarkup` functions work
|
|
8
|
+
* The `toNode` and `toMarkup` functions work similarly to how they do in
|
|
9
9
|
* domTree.js, creating namespaced DOM nodes and HTML text markup respectively.
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -166,7 +166,7 @@ export class TextNode implements MathDomNode {
|
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* Converts the text node into a string
|
|
169
|
-
* (representing the text
|
|
169
|
+
* (representing the text itself).
|
|
170
170
|
*/
|
|
171
171
|
toText(): string {
|
|
172
172
|
return this.text;
|
package/src/parseNode.js
CHANGED
|
@@ -72,7 +72,7 @@ type ParseNodeTypes = {
|
|
|
72
72
|
|},
|
|
73
73
|
// To avoid requiring run-time type assertions, this more carefully captures
|
|
74
74
|
// the requirements on the fields per the op.js htmlBuilder logic:
|
|
75
|
-
// - `body` and `value` are NEVER set
|
|
75
|
+
// - `body` and `value` are NEVER set simultaneously.
|
|
76
76
|
// - When `symbol` is true, `body` is set.
|
|
77
77
|
"op": {|
|
|
78
78
|
type: "op",
|
package/src/svgGeometry.js
CHANGED
|
@@ -6,96 +6,96 @@
|
|
|
6
6
|
|
|
7
7
|
// In all paths below, the viewBox-to-em scale is 1000:1.
|
|
8
8
|
|
|
9
|
-
const hLinePad = 80; // padding above a sqrt
|
|
9
|
+
const hLinePad = 80; // padding above a sqrt vinculum. Prevents image cropping.
|
|
10
10
|
|
|
11
|
-
// The
|
|
12
|
-
// Think of variable
|
|
13
|
-
// The detour begins at the lower left of the area labeled
|
|
14
|
-
// The detour proceeds one
|
|
15
|
-
// displacing the radiused corner between surd and
|
|
11
|
+
// The vinculum of a \sqrt can be made thicker by a KaTeX rendering option.
|
|
12
|
+
// Think of variable extraVinculum as two detours in the SVG path.
|
|
13
|
+
// The detour begins at the lower left of the area labeled extraVinculum below.
|
|
14
|
+
// The detour proceeds one extraVinculum distance up and slightly to the right,
|
|
15
|
+
// displacing the radiused corner between surd and vinculum. The radius is
|
|
16
16
|
// traversed as usual, then the detour resumes. It goes right, to the end of
|
|
17
|
-
// the very long
|
|
17
|
+
// the very long vinculum, then down one extraVinculum distance,
|
|
18
18
|
// after which it resumes regular path geometry for the radical.
|
|
19
|
-
/*
|
|
19
|
+
/* vinculum
|
|
20
20
|
/
|
|
21
|
-
/▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←
|
|
22
|
-
/ █████████████████████←0.04em (40 unit) std
|
|
21
|
+
/▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraVinculum
|
|
22
|
+
/ █████████████████████←0.04em (40 unit) std vinculum thickness
|
|
23
23
|
/ /
|
|
24
24
|
/ /
|
|
25
25
|
/ /\
|
|
26
26
|
/ / surd
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
const sqrtMain = function(
|
|
29
|
+
const sqrtMain = function(extraVinculum: number, hLinePad: number): string {
|
|
30
30
|
// sqrtMain path geometry is from glyph U221A in the font KaTeX Main
|
|
31
|
-
return `M95,${622 +
|
|
31
|
+
return `M95,${622 + extraVinculum + hLinePad}
|
|
32
32
|
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
33
33
|
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
34
34
|
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
|
35
35
|
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
|
36
36
|
c69,-144,104.5,-217.7,106.5,-221
|
|
37
|
-
l${
|
|
37
|
+
l${extraVinculum / 2.075} -${extraVinculum}
|
|
38
38
|
c5.3,-9.3,12,-14,20,-14
|
|
39
|
-
H400000v${40 +
|
|
39
|
+
H400000v${40 + extraVinculum}H845.2724
|
|
40
40
|
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
|
41
41
|
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
|
42
|
-
M${834 +
|
|
42
|
+
M${834 + extraVinculum} ${hLinePad}h400000v${40 + extraVinculum}h-400000z`;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
const sqrtSize1 = function(
|
|
45
|
+
const sqrtSize1 = function(extraVinculum: number, hLinePad: number): string {
|
|
46
46
|
// size1 is from glyph U221A in the font KaTeX_Size1-Regular
|
|
47
|
-
return `M263,${601 +
|
|
47
|
+
return `M263,${601 + extraVinculum + hLinePad}c0.7,0,18,39.7,52,119
|
|
48
48
|
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
|
|
49
49
|
c340,-704.7,510.7,-1060.3,512,-1067
|
|
50
|
-
l${
|
|
50
|
+
l${extraVinculum / 2.084} -${extraVinculum}
|
|
51
51
|
c4.7,-7.3,11,-11,19,-11
|
|
52
|
-
H40000v${40 +
|
|
52
|
+
H40000v${40 + extraVinculum}H1012.3
|
|
53
53
|
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
|
|
54
54
|
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
|
|
55
55
|
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
|
|
56
56
|
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
|
|
57
|
-
M${1001 +
|
|
57
|
+
M${1001 + extraVinculum} ${hLinePad}h400000v${40 + extraVinculum}h-400000z`;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
const sqrtSize2 = function(
|
|
60
|
+
const sqrtSize2 = function(extraVinculum: number, hLinePad: number): string {
|
|
61
61
|
// size2 is from glyph U221A in the font KaTeX_Size2-Regular
|
|
62
|
-
return `M983 ${10 +
|
|
63
|
-
l${
|
|
64
|
-
c4,-6.7,10,-10,18,-10 H400000v${40 +
|
|
62
|
+
return `M983 ${10 + extraVinculum + hLinePad}
|
|
63
|
+
l${extraVinculum / 3.13} -${extraVinculum}
|
|
64
|
+
c4,-6.7,10,-10,18,-10 H400000v${40 + extraVinculum}
|
|
65
65
|
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
|
|
66
66
|
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
|
|
67
67
|
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
|
|
68
68
|
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
|
|
69
69
|
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
|
|
70
70
|
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
|
|
71
|
-
M${1001 +
|
|
71
|
+
M${1001 + extraVinculum} ${hLinePad}h400000v${40 + extraVinculum}h-400000z`;
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const sqrtSize3 = function(
|
|
74
|
+
const sqrtSize3 = function(extraVinculum: number, hLinePad: number): string {
|
|
75
75
|
// size3 is from glyph U221A in the font KaTeX_Size3-Regular
|
|
76
|
-
return `M424,${2398 +
|
|
76
|
+
return `M424,${2398 + extraVinculum + hLinePad}
|
|
77
77
|
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
|
|
78
78
|
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
|
|
79
79
|
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
|
|
80
80
|
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
|
|
81
|
-
l${
|
|
82
|
-
v${40 +
|
|
81
|
+
l${extraVinculum / 4.223} -${extraVinculum}c4,-6.7,10,-10,18,-10 H400000
|
|
82
|
+
v${40 + extraVinculum}H1014.6
|
|
83
83
|
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
|
|
84
84
|
c-2,6,-10,9,-24,9
|
|
85
|
-
c-8,0,-12,-0.7,-12,-2z M${1001 +
|
|
86
|
-
h400000v${40 +
|
|
85
|
+
c-8,0,-12,-0.7,-12,-2z M${1001 + extraVinculum} ${hLinePad}
|
|
86
|
+
h400000v${40 + extraVinculum}h-400000z`;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
const sqrtSize4 = function(
|
|
89
|
+
const sqrtSize4 = function(extraVinculum: number, hLinePad: number): string {
|
|
90
90
|
// size4 is from glyph U221A in the font KaTeX_Size4-Regular
|
|
91
|
-
return `M473,${2713 +
|
|
92
|
-
c339.3,-1799.3,509.3,-2700,510,-2702 l${
|
|
93
|
-
c3.3,-7.3,9.3,-11,18,-11 H400000v${40 +
|
|
91
|
+
return `M473,${2713 + extraVinculum + hLinePad}
|
|
92
|
+
c339.3,-1799.3,509.3,-2700,510,-2702 l${extraVinculum / 5.298} -${extraVinculum}
|
|
93
|
+
c3.3,-7.3,9.3,-11,18,-11 H400000v${40 + extraVinculum}H1017.7
|
|
94
94
|
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
|
|
95
95
|
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
|
|
96
96
|
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
|
|
97
97
|
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
|
|
98
|
-
606zM${1001 +
|
|
98
|
+
606zM${1001 + extraVinculum} ${hLinePad}h400000v${40 + extraVinculum}H1017.7z`;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
export const phasePath = function(y: number): string {
|
|
@@ -104,49 +104,49 @@ export const phasePath = function(y: number): string {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
const sqrtTall = function(
|
|
107
|
-
|
|
107
|
+
extraVinculum: number,
|
|
108
108
|
hLinePad: number,
|
|
109
109
|
viewBoxHeight: number
|
|
110
110
|
): string {
|
|
111
111
|
// sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular
|
|
112
|
-
// One path edge has a variable length. It runs vertically from the
|
|
113
|
-
// to a point near (14 units) the bottom of the surd. The
|
|
112
|
+
// One path edge has a variable length. It runs vertically from the vinculum
|
|
113
|
+
// to a point near (14 units) the bottom of the surd. The vinculum
|
|
114
114
|
// is normally 40 units thick. So the length of the line in question is:
|
|
115
|
-
const vertSegment = viewBoxHeight - 54 - hLinePad -
|
|
115
|
+
const vertSegment = viewBoxHeight - 54 - hLinePad - extraVinculum;
|
|
116
116
|
|
|
117
|
-
return `M702 ${
|
|
117
|
+
return `M702 ${extraVinculum + hLinePad}H400000${40 + extraVinculum}
|
|
118
118
|
H742v${vertSegment}l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
|
|
119
119
|
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
|
|
120
120
|
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
|
|
121
|
-
219 661 l218 661zM702 ${hLinePad}H400000v${40 +
|
|
121
|
+
219 661 l218 661zM702 ${hLinePad}H400000v${40 + extraVinculum}H742z`;
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
export const sqrtPath = function(
|
|
125
125
|
size: string,
|
|
126
|
-
|
|
126
|
+
extraVinculum: number,
|
|
127
127
|
viewBoxHeight: number
|
|
128
128
|
): string {
|
|
129
|
-
|
|
129
|
+
extraVinculum = 1000 * extraVinculum; // Convert from document ems to viewBox.
|
|
130
130
|
let path = "";
|
|
131
131
|
|
|
132
132
|
switch (size) {
|
|
133
133
|
case "sqrtMain":
|
|
134
|
-
path = sqrtMain(
|
|
134
|
+
path = sqrtMain(extraVinculum, hLinePad);
|
|
135
135
|
break;
|
|
136
136
|
case "sqrtSize1":
|
|
137
|
-
path = sqrtSize1(
|
|
137
|
+
path = sqrtSize1(extraVinculum, hLinePad);
|
|
138
138
|
break;
|
|
139
139
|
case "sqrtSize2":
|
|
140
|
-
path = sqrtSize2(
|
|
140
|
+
path = sqrtSize2(extraVinculum, hLinePad);
|
|
141
141
|
break;
|
|
142
142
|
case "sqrtSize3":
|
|
143
|
-
path = sqrtSize3(
|
|
143
|
+
path = sqrtSize3(extraVinculum, hLinePad);
|
|
144
144
|
break;
|
|
145
145
|
case "sqrtSize4":
|
|
146
|
-
path = sqrtSize4(
|
|
146
|
+
path = sqrtSize4(extraVinculum, hLinePad);
|
|
147
147
|
break;
|
|
148
148
|
case "sqrtTall":
|
|
149
|
-
path = sqrtTall(
|
|
149
|
+
path = sqrtTall(extraVinculum, hLinePad, viewBoxHeight);
|
|
150
150
|
}
|
|
151
151
|
return path;
|
|
152
152
|
};
|
|
@@ -441,7 +441,7 @@ c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,
|
|
|
441
441
|
// The next ten paths support reaction arrows from the mhchem package.
|
|
442
442
|
|
|
443
443
|
// Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
|
|
444
|
-
// baraboveleftarrow is mostly from
|
|
444
|
+
// baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main
|
|
445
445
|
baraboveleftarrow: `M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
|
|
446
446
|
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
|
|
447
447
|
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
|