katex 0.15.6 → 0.16.2
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/auto-render.js +20 -1
- package/contrib/auto-render/test/auto-render-spec.js +88 -17
- package/contrib/copy-tex/README.md +9 -19
- package/contrib/copy-tex/copy-tex.js +39 -12
- package/contrib/copy-tex/katex2tex.js +16 -7
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/contrib/render-a11y-string/render-a11y-string.js +5 -0
- package/dist/README.md +3 -3
- package/dist/contrib/auto-render.js +23 -1
- package/dist/contrib/auto-render.min.js +1 -1
- package/dist/contrib/auto-render.mjs +23 -1
- package/dist/contrib/copy-tex.js +38 -24
- package/dist/contrib/copy-tex.min.js +1 -1
- package/dist/contrib/copy-tex.mjs +35 -16
- package/dist/contrib/render-a11y-string.js +6 -0
- package/dist/contrib/render-a11y-string.min.js +1 -1
- package/dist/contrib/render-a11y-string.mjs +6 -0
- package/dist/katex.css +1 -1
- package/dist/katex.js +322 -199
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +363 -241
- package/package.json +3 -3
- package/src/Parser.js +1 -1
- package/src/buildCommon.js +1 -1
- package/src/buildMathML.js +2 -2
- package/src/delimiter.js +68 -25
- package/src/domTree.js +1 -0
- package/src/environments/array.js +1 -1
- package/src/functions/enclose.js +1 -1
- package/src/functions/mclass.js +1 -1
- package/src/functions/op.js +1 -1
- package/src/functions/pmb.js +44 -0
- package/src/functions.js +1 -0
- package/src/macros.js +1 -9
- package/src/parseNode.js +7 -0
- package/src/stretchy.js +1 -1
- package/src/svgGeometry.js +56 -0
- package/contrib/copy-tex/copy-tex.css +0 -10
- package/contrib/copy-tex/copy-tex.webpack.js +0 -6
- package/dist/contrib/copy-tex.css +0 -13
- package/dist/contrib/copy-tex.min.css +0 -1
package/dist/contrib/copy-tex.js
CHANGED
|
@@ -23,7 +23,7 @@ var defaultCopyDelimiters = {
|
|
|
23
23
|
// Modifies fragment in-place. Useful for writing your own 'copy' handler,
|
|
24
24
|
// as in copy-tex.js.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
function katexReplaceWithTex(fragment, copyDelimiters) {
|
|
27
27
|
if (copyDelimiters === void 0) {
|
|
28
28
|
copyDelimiters = defaultCopyDelimiters;
|
|
29
29
|
}
|
|
@@ -36,8 +36,8 @@ var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters)
|
|
|
36
36
|
var element = katexHtml[i];
|
|
37
37
|
|
|
38
38
|
if (element.remove) {
|
|
39
|
-
element.remove(
|
|
40
|
-
} else {
|
|
39
|
+
element.remove();
|
|
40
|
+
} else if (element.parentNode) {
|
|
41
41
|
element.parentNode.removeChild(element);
|
|
42
42
|
}
|
|
43
43
|
} // Replace .katex-mathml elements with their annotation (TeX source)
|
|
@@ -54,7 +54,7 @@ var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters)
|
|
|
54
54
|
if (texSource) {
|
|
55
55
|
if (_element.replaceWith) {
|
|
56
56
|
_element.replaceWith(texSource);
|
|
57
|
-
} else {
|
|
57
|
+
} else if (_element.parentNode) {
|
|
58
58
|
_element.parentNode.replaceChild(texSource, _element);
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -71,44 +71,58 @@ var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters)
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
return fragment;
|
|
74
|
-
}
|
|
74
|
+
}
|
|
75
75
|
/* harmony default export */ var katex2tex = (katexReplaceWithTex);
|
|
76
76
|
;// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js
|
|
77
|
-
//
|
|
77
|
+
// Return <div class="katex"> element containing node, or null if not found.
|
|
78
|
+
|
|
79
|
+
function closestKatex(node) {
|
|
80
|
+
// If node is a Text Node, for example, go up to containing Element,
|
|
81
|
+
// where we can apply the `closest` method.
|
|
82
|
+
var element = node instanceof Element ? node : node.parentElement;
|
|
83
|
+
return element && element.closest('.katex');
|
|
84
|
+
} // Global copy handler to modify behavior on/within .katex elements.
|
|
85
|
+
|
|
78
86
|
|
|
79
87
|
document.addEventListener('copy', function (event) {
|
|
80
88
|
var selection = window.getSelection();
|
|
81
89
|
|
|
82
|
-
if (selection.isCollapsed) {
|
|
83
|
-
return; // default action OK if selection is empty
|
|
90
|
+
if (selection.isCollapsed || !event.clipboardData) {
|
|
91
|
+
return; // default action OK if selection is empty or unchangeable
|
|
84
92
|
}
|
|
85
93
|
|
|
86
|
-
var
|
|
94
|
+
var clipboardData = event.clipboardData;
|
|
95
|
+
var range = selection.getRangeAt(0); // When start point is within a formula, expand to entire formula.
|
|
87
96
|
|
|
88
|
-
|
|
89
|
-
return; // default action OK if no .katex-mathml elements
|
|
90
|
-
} // Preserve usual HTML copy/paste behavior.
|
|
97
|
+
var startKatex = closestKatex(range.startContainer);
|
|
91
98
|
|
|
99
|
+
if (startKatex) {
|
|
100
|
+
range.setStartBefore(startKatex);
|
|
101
|
+
} // Similarly, when end point is within a formula, expand to entire formula.
|
|
92
102
|
|
|
93
|
-
var html = [];
|
|
94
103
|
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
var endKatex = closestKatex(range.endContainer);
|
|
105
|
+
|
|
106
|
+
if (endKatex) {
|
|
107
|
+
range.setEndAfter(endKatex);
|
|
97
108
|
}
|
|
98
109
|
|
|
99
|
-
|
|
110
|
+
var fragment = range.cloneContents();
|
|
100
111
|
|
|
101
|
-
|
|
112
|
+
if (!fragment.querySelector('.katex-mathml')) {
|
|
113
|
+
return; // default action OK if no .katex-mathml elements
|
|
114
|
+
}
|
|
102
115
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* This is the webpack entry point for KaTeX. As ECMAScript doesn't support
|
|
108
|
-
* CSS modules natively, a separate entry point is used.
|
|
109
|
-
*/
|
|
116
|
+
var htmlContents = Array.prototype.map.call(fragment.childNodes, function (el) {
|
|
117
|
+
return el instanceof Text ? el.textContent : el.outerHTML;
|
|
118
|
+
}).join(''); // Preserve usual HTML copy/paste behavior.
|
|
110
119
|
|
|
120
|
+
clipboardData.setData('text/html', htmlContents); // Rewrite plain-text version.
|
|
111
121
|
|
|
122
|
+
clipboardData.setData('text/plain', katex2tex(fragment).textContent); // Prevent normal copy handling.
|
|
123
|
+
|
|
124
|
+
event.preventDefault();
|
|
125
|
+
});
|
|
112
126
|
__webpack_exports__ = __webpack_exports__["default"];
|
|
113
127
|
/******/ return __webpack_exports__;
|
|
114
128
|
/******/ })()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={},t={inline:["$","$"],display:["$$","$$"]};var n=function(e,n){void 0===n&&(n=t);for(var r=e.querySelectorAll(".katex-mathml + .katex-html"),a=0;a<r.length;a++){var o=r[a];o.remove?o.remove():o.parentNode&&o.parentNode.removeChild(o)}for(var i=e.querySelectorAll(".katex-mathml"),l=0;l<i.length;l++){var f=i[l],c=f.querySelector("annotation");c&&(f.replaceWith?f.replaceWith(c):f.parentNode&&f.parentNode.replaceChild(c,f),c.innerHTML=n.inline[0]+c.innerHTML+n.inline[1])}for(var d=e.querySelectorAll(".katex-display annotation"),s=0;s<d.length;s++){var p=d[s];p.innerHTML=n.display[0]+p.innerHTML.substr(n.inline[0].length,p.innerHTML.length-n.inline[0].length-n.inline[1].length)+n.display[1]}return e};function r(e){var t=e instanceof Element?e:e.parentElement;return t&&t.closest(".katex")}return document.addEventListener("copy",(function(e){var t=window.getSelection();if(!t.isCollapsed&&e.clipboardData){var a=e.clipboardData,o=t.getRangeAt(0),i=r(o.startContainer);i&&o.setStartBefore(i);var l=r(o.endContainer);l&&o.setEndAfter(l);var f=o.cloneContents();if(f.querySelector(".katex-mathml")){var c=Array.prototype.map.call(f.childNodes,(function(e){return e instanceof Text?e.textContent:e.outerHTML})).join("");a.setData("text/html",c),a.setData("text/plain",n(f).textContent),e.preventDefault()}}})),e=e.default}()}));
|
|
@@ -8,7 +8,7 @@ var defaultCopyDelimiters = {
|
|
|
8
8
|
// Modifies fragment in-place. Useful for writing your own 'copy' handler,
|
|
9
9
|
// as in copy-tex.js.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
function katexReplaceWithTex(fragment, copyDelimiters) {
|
|
12
12
|
if (copyDelimiters === void 0) {
|
|
13
13
|
copyDelimiters = defaultCopyDelimiters;
|
|
14
14
|
}
|
|
@@ -21,8 +21,8 @@ var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters)
|
|
|
21
21
|
var element = katexHtml[i];
|
|
22
22
|
|
|
23
23
|
if (element.remove) {
|
|
24
|
-
element.remove(
|
|
25
|
-
} else {
|
|
24
|
+
element.remove();
|
|
25
|
+
} else if (element.parentNode) {
|
|
26
26
|
element.parentNode.removeChild(element);
|
|
27
27
|
}
|
|
28
28
|
} // Replace .katex-mathml elements with their annotation (TeX source)
|
|
@@ -39,7 +39,7 @@ var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters)
|
|
|
39
39
|
if (texSource) {
|
|
40
40
|
if (_element.replaceWith) {
|
|
41
41
|
_element.replaceWith(texSource);
|
|
42
|
-
} else {
|
|
42
|
+
} else if (_element.parentNode) {
|
|
43
43
|
_element.parentNode.replaceChild(texSource, _element);
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -56,31 +56,50 @@ var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters)
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
return fragment;
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function closestKatex(node) {
|
|
62
|
+
// If node is a Text Node, for example, go up to containing Element,
|
|
63
|
+
// where we can apply the `closest` method.
|
|
64
|
+
var element = node instanceof Element ? node : node.parentElement;
|
|
65
|
+
return element && element.closest('.katex');
|
|
66
|
+
} // Global copy handler to modify behavior on/within .katex elements.
|
|
67
|
+
|
|
60
68
|
|
|
61
69
|
document.addEventListener('copy', function (event) {
|
|
62
70
|
var selection = window.getSelection();
|
|
63
71
|
|
|
64
|
-
if (selection.isCollapsed) {
|
|
65
|
-
return; // default action OK if selection is empty
|
|
72
|
+
if (selection.isCollapsed || !event.clipboardData) {
|
|
73
|
+
return; // default action OK if selection is empty or unchangeable
|
|
66
74
|
}
|
|
67
75
|
|
|
68
|
-
var
|
|
76
|
+
var clipboardData = event.clipboardData;
|
|
77
|
+
var range = selection.getRangeAt(0); // When start point is within a formula, expand to entire formula.
|
|
69
78
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
var startKatex = closestKatex(range.startContainer);
|
|
80
|
+
|
|
81
|
+
if (startKatex) {
|
|
82
|
+
range.setStartBefore(startKatex);
|
|
83
|
+
} // Similarly, when end point is within a formula, expand to entire formula.
|
|
73
84
|
|
|
74
85
|
|
|
75
|
-
var
|
|
86
|
+
var endKatex = closestKatex(range.endContainer);
|
|
76
87
|
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
if (endKatex) {
|
|
89
|
+
range.setEndAfter(endKatex);
|
|
79
90
|
}
|
|
80
91
|
|
|
81
|
-
|
|
92
|
+
var fragment = range.cloneContents();
|
|
93
|
+
|
|
94
|
+
if (!fragment.querySelector('.katex-mathml')) {
|
|
95
|
+
return; // default action OK if no .katex-mathml elements
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
var htmlContents = Array.prototype.map.call(fragment.childNodes, el => el instanceof Text ? el.textContent : el.outerHTML).join(''); // Preserve usual HTML copy/paste behavior.
|
|
99
|
+
|
|
100
|
+
clipboardData.setData('text/html', htmlContents); // Rewrite plain-text version.
|
|
82
101
|
|
|
83
|
-
|
|
102
|
+
clipboardData.setData('text/plain', katexReplaceWithTex(fragment).textContent); // Prevent normal copy handling.
|
|
84
103
|
|
|
85
104
|
event.preventDefault();
|
|
86
105
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],r);else{var a="object"==typeof exports?r(require("katex")):r(e.katex);for(var t in a)("object"==typeof exports?exports:e)[t]=a[t]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var r={771:function(r){r.exports=e}},a={};function t(e){var o=a[e];if(void 0!==o)return o.exports;var n=a[e]={exports:{}};return r[e](n,n.exports,t),n.exports}t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},t.d=function(e,r){for(var a in r)t.o(r,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:r[a]})},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};var o,n,s,i,l,c,u,p,d,b,h,m,f,y,w={};return o=t(771),n=t.n(o),s={"(":"left parenthesis",")":"right parenthesis","[":"open bracket","]":"close bracket","\\{":"left brace","\\}":"right brace","\\lvert":"open vertical bar","\\rvert":"close vertical bar","|":"vertical bar","\\uparrow":"up arrow","\\Uparrow":"up arrow","\\downarrow":"down arrow","\\Downarrow":"down arrow","\\updownarrow":"up down arrow","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow","\\langle":"open angle","\\rangle":"close angle","\\lfloor":"open floor","\\rfloor":"close floor","\\int":"integral","\\intop":"integral","\\lim":"limit","\\ln":"natural log","\\log":"log","\\sin":"sine","\\cos":"cosine","\\tan":"tangent","\\cot":"cotangent","\\sum":"sum","/":"slash",",":"comma",".":"point","-":"negative","+":"plus","~":"tilde",":":"colon","?":"question mark","'":"apostrophe","\\%":"percent"," ":"space","\\ ":"space","\\$":"dollar sign","\\angle":"angle","\\degree":"degree","\\circ":"circle","\\vec":"vector","\\triangle":"triangle","\\pi":"pi","\\prime":"prime","\\infty":"infinity","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\omega":"omega","\\theta":"theta","\\sigma":"sigma","\\lambda":"lambda","\\tau":"tau","\\Delta":"delta","\\delta":"delta","\\mu":"mu","\\rho":"rho","\\nabla":"del","\\ell":"ell","\\ldots":"dots","\\hat":"hat","\\acute":"acute"},i={prime:"prime",degree:"degrees",circle:"degrees",2:"squared",3:"cubed"},l={"|":"open vertical bar",".":""},c={"|":"close vertical bar",".":""},u={"+":"plus","-":"minus","\\pm":"plus minus","\\cdot":"dot","*":"times","/":"divided by","\\times":"times","\\div":"divided by","\\circ":"circle","\\bullet":"bullet"},p={"=":"equals","\\approx":"approximately equals","\u2260":"does not equal","\\geq":"is greater than or equal to","\\ge":"is greater than or equal to","\\leq":"is less than or equal to","\\le":"is less than or equal to",">":"is greater than","<":"is less than","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow",":":"colon"},d={"\\underleftarrow":"left arrow","\\underrightarrow":"right arrow","\\underleftrightarrow":"left-right arrow","\\undergroup":"group","\\underlinesegment":"line segment","\\utilde":"tilde"},b=function(e,r,a){var t;e&&(/^\d+$/.test(t="open"===r?e in l?l[e]:s[e]||e:"close"===r?e in c?c[e]:s[e]||e:"bin"===r?u[e]||e:"rel"===r?p[e]||e:s[e]||e)&&a.length>0&&/^\d+$/.test(a[a.length-1])?a[a.length-1]+=t:t&&a.push(t))},h=function(e,r){var a=[];e.push(a),r(a)},m=function(e,r,a){switch(e.type){case"accent":h(r,(function(r){f(e.base,r,a),r.push("with"),b(e.label,"normal",r),r.push("on top")}));break;case"accentUnder":h(r,(function(r){f(e.base,r,a),r.push("with"),b(d[e.label],"normal",r),r.push("underneath")}));break;case"accent-token":break;case"atom":var t=e.text;switch(e.family){case"bin":b(t,"bin",r);break;case"close":b(t,"close",r);break;case"inner":b(e.text,"inner",r);break;case"open":b(t,"open",r);break;case"punct":b(t,"punct",r);break;case"rel":b(t,"rel",r);break;default:throw e.family,new Error('"'+e.family+'" is not a valid atom type')}break;case"color":var o=e.color.replace(/katex-/,"");h(r,(function(r){r.push("start color "+o),f(e.body,r,a),r.push("end color "+o)}));break;case"color-token":break;case"delimsizing":e.delim&&"."!==e.delim&&b(e.delim,"normal",r);break;case"genfrac":h(r,(function(r){var t=e.leftDelim,o=e.rightDelim;e.hasBarLine?(r.push("start fraction"),t&&b(t,"open",r),f(e.numer,r,a),r.push("divided by"),f(e.denom,r,a),o&&b(o,"close",r),r.push("end fraction")):(r.push("start binomial"),t&&b(t,"open",r),f(e.numer,r,a),r.push("over"),f(e.denom,r,a),o&&b(o,"close",r),r.push("end binomial"))}));break;case"hbox":f(e.body,r,a);break;case"kern":break;case"leftright":h(r,(function(r){b(e.left,"open",r),f(e.body,r,a),b(e.right,"close",r)}));break;case"leftright-right":break;case"lap":f(e.body,r,a);break;case"mathord":b(e.text,"normal",r);break;case"op":var n=e.body,s=e.name;n?f(n,r,a):s&&b(s,"normal",r);break;case"op-token":b(e.text,a,r);break;case"ordgroup":f(e.body,r,a);break;case"overline":h(r,(function(r){r.push("start overline"),f(e.body,r,a),r.push("end overline")}));break;case"phantom":r.push("empty space");break;case"raisebox":f(e.body,r,a);break;case"rule":r.push("rectangle");break;case"sizing":f(e.body,r,a);break;case"spacing":r.push("space");break;case"styling":f(e.body,r,a);break;case"sqrt":h(r,(function(r){var t=e.body,o=e.index;if(o)return"3"===y(f(o,[],a)).join(",")?(r.push("cube root of"),f(t,r,a),void r.push("end cube root")):(r.push("root"),r.push("start index"),f(o,r,a),void r.push("end index"));r.push("square root of"),f(t,r,a),r.push("end square root")}));break;case"supsub":var l=e.base,c=e.sub,u=e.sup,p=!1;if(l&&(f(l,r,a),p="op"===l.type&&"\\log"===l.name),c){var m=p?"base":"subscript";h(r,(function(e){e.push("start "+m),f(c,e,a),e.push("end "+m)}))}u&&h(r,(function(e){var r=y(f(u,[],a)).join(",");r in i?e.push(i[r]):(e.push("start superscript"),f(u,e,a),e.push("end superscript"))}));break;case"text":if("\\textbf"===e.font){h(r,(function(r){r.push("start bold text"),f(e.body,r,a),r.push("end bold text")}));break}h(r,(function(r){r.push("start text"),f(e.body,r,a),r.push("end text")}));break;case"textord":b(e.text,a,r);break;case"smash":f(e.body,r,a);break;case"enclose":if(/cancel/.test(e.label)){h(r,(function(r){r.push("start cancel"),f(e.body,r,a),r.push("end cancel")}));break}if(/box/.test(e.label)){h(r,(function(r){r.push("start box"),f(e.body,r,a),r.push("end box")}));break}if(/sout/.test(e.label)){h(r,(function(r){r.push("start strikeout"),f(e.body,r,a),r.push("end strikeout")}));break}if(/phase/.test(e.label)){h(r,(function(r){r.push("start phase angle"),f(e.body,r,a),r.push("end phase angle")}));break}throw new Error("KaTeX-a11y: enclose node with "+e.label+" not supported yet");case"vcenter":f(e.body,r,a);break;case"vphantom":throw new Error("KaTeX-a11y: vphantom not implemented yet");case"hphantom":throw new Error("KaTeX-a11y: hphantom not implemented yet");case"operatorname":f(e.body,r,a);break;case"array":throw new Error("KaTeX-a11y: array not implemented yet");case"raw":throw new Error("KaTeX-a11y: raw not implemented yet");case"size":break;case"url":throw new Error("KaTeX-a11y: url not implemented yet");case"tag":throw new Error("KaTeX-a11y: tag not implemented yet");case"verb":b("start verbatim","normal",r),b(e.body,"normal",r),b("end verbatim","normal",r);break;case"environment":throw new Error("KaTeX-a11y: environment not implemented yet");case"horizBrace":b("start "+e.label.slice(1),"normal",r),f(e.base,r,a),b("end "+e.label.slice(1),"normal",r);break;case"infix":break;case"includegraphics":throw new Error("KaTeX-a11y: includegraphics not implemented yet");case"font":f(e.body,r,a);break;case"href":throw new Error("KaTeX-a11y: href not implemented yet");case"cr":throw new Error("KaTeX-a11y: cr not implemented yet");case"underline":h(r,(function(r){r.push("start underline"),f(e.body,r,a),r.push("end underline")}));break;case"xArrow":throw new Error("KaTeX-a11y: xArrow not implemented yet");case"cdlabel":throw new Error("KaTeX-a11y: cdlabel not implemented yet");case"cdlabelparent":throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");case"mclass":var w=e.mclass.slice(1);f(e.body,r,w);break;case"mathchoice":f(e.text,r,a);break;case"htmlmathml":f(e.mathml,r,a);break;case"middle":b(e.delim,a,r);break;case"internal":break;case"html":f(e.body,r,a);break;default:throw e.type,new Error("KaTeX a11y un-recognized type: "+e.type)}},f=function e(r,a,t){if(void 0===a&&(a=[]),r instanceof Array)for(var o=0;o<r.length;o++)e(r[o],a,t);else m(r,a,t);return a},y=function e(r){var a=[];return r.forEach((function(r){r instanceof Array?a=a.concat(e(r)):a.push(r)})),a},w.default=function(e,r){var a=n().__parse(e,r),t=f(a,[],"normal");return y(t).join(", ")},w=w.default}()}));
|
|
1
|
+
!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],r);else{var a="object"==typeof exports?r(require("katex")):r(e.katex);for(var t in a)("object"==typeof exports?exports:e)[t]=a[t]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var r={771:function(r){r.exports=e}},a={};function t(e){var o=a[e];if(void 0!==o)return o.exports;var n=a[e]={exports:{}};return r[e](n,n.exports,t),n.exports}t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},t.d=function(e,r){for(var a in r)t.o(r,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:r[a]})},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};var o,n,s,i,l,c,u,p,d,b,h,m,f,y,w={};return o=t(771),n=t.n(o),s={"(":"left parenthesis",")":"right parenthesis","[":"open bracket","]":"close bracket","\\{":"left brace","\\}":"right brace","\\lvert":"open vertical bar","\\rvert":"close vertical bar","|":"vertical bar","\\uparrow":"up arrow","\\Uparrow":"up arrow","\\downarrow":"down arrow","\\Downarrow":"down arrow","\\updownarrow":"up down arrow","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow","\\langle":"open angle","\\rangle":"close angle","\\lfloor":"open floor","\\rfloor":"close floor","\\int":"integral","\\intop":"integral","\\lim":"limit","\\ln":"natural log","\\log":"log","\\sin":"sine","\\cos":"cosine","\\tan":"tangent","\\cot":"cotangent","\\sum":"sum","/":"slash",",":"comma",".":"point","-":"negative","+":"plus","~":"tilde",":":"colon","?":"question mark","'":"apostrophe","\\%":"percent"," ":"space","\\ ":"space","\\$":"dollar sign","\\angle":"angle","\\degree":"degree","\\circ":"circle","\\vec":"vector","\\triangle":"triangle","\\pi":"pi","\\prime":"prime","\\infty":"infinity","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\omega":"omega","\\theta":"theta","\\sigma":"sigma","\\lambda":"lambda","\\tau":"tau","\\Delta":"delta","\\delta":"delta","\\mu":"mu","\\rho":"rho","\\nabla":"del","\\ell":"ell","\\ldots":"dots","\\hat":"hat","\\acute":"acute"},i={prime:"prime",degree:"degrees",circle:"degrees",2:"squared",3:"cubed"},l={"|":"open vertical bar",".":""},c={"|":"close vertical bar",".":""},u={"+":"plus","-":"minus","\\pm":"plus minus","\\cdot":"dot","*":"times","/":"divided by","\\times":"times","\\div":"divided by","\\circ":"circle","\\bullet":"bullet"},p={"=":"equals","\\approx":"approximately equals","\u2260":"does not equal","\\geq":"is greater than or equal to","\\ge":"is greater than or equal to","\\leq":"is less than or equal to","\\le":"is less than or equal to",">":"is greater than","<":"is less than","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow",":":"colon"},d={"\\underleftarrow":"left arrow","\\underrightarrow":"right arrow","\\underleftrightarrow":"left-right arrow","\\undergroup":"group","\\underlinesegment":"line segment","\\utilde":"tilde"},b=function(e,r,a){var t;e&&(/^\d+$/.test(t="open"===r?e in l?l[e]:s[e]||e:"close"===r?e in c?c[e]:s[e]||e:"bin"===r?u[e]||e:"rel"===r?p[e]||e:s[e]||e)&&a.length>0&&/^\d+$/.test(a[a.length-1])?a[a.length-1]+=t:t&&a.push(t))},h=function(e,r){var a=[];e.push(a),r(a)},m=function(e,r,a){switch(e.type){case"accent":h(r,(function(r){f(e.base,r,a),r.push("with"),b(e.label,"normal",r),r.push("on top")}));break;case"accentUnder":h(r,(function(r){f(e.base,r,a),r.push("with"),b(d[e.label],"normal",r),r.push("underneath")}));break;case"accent-token":break;case"atom":var t=e.text;switch(e.family){case"bin":b(t,"bin",r);break;case"close":b(t,"close",r);break;case"inner":b(e.text,"inner",r);break;case"open":b(t,"open",r);break;case"punct":b(t,"punct",r);break;case"rel":b(t,"rel",r);break;default:throw e.family,new Error('"'+e.family+'" is not a valid atom type')}break;case"color":var o=e.color.replace(/katex-/,"");h(r,(function(r){r.push("start color "+o),f(e.body,r,a),r.push("end color "+o)}));break;case"color-token":break;case"delimsizing":e.delim&&"."!==e.delim&&b(e.delim,"normal",r);break;case"genfrac":h(r,(function(r){var t=e.leftDelim,o=e.rightDelim;e.hasBarLine?(r.push("start fraction"),t&&b(t,"open",r),f(e.numer,r,a),r.push("divided by"),f(e.denom,r,a),o&&b(o,"close",r),r.push("end fraction")):(r.push("start binomial"),t&&b(t,"open",r),f(e.numer,r,a),r.push("over"),f(e.denom,r,a),o&&b(o,"close",r),r.push("end binomial"))}));break;case"hbox":f(e.body,r,a);break;case"kern":break;case"leftright":h(r,(function(r){b(e.left,"open",r),f(e.body,r,a),b(e.right,"close",r)}));break;case"leftright-right":break;case"lap":f(e.body,r,a);break;case"mathord":b(e.text,"normal",r);break;case"op":var n=e.body,s=e.name;n?f(n,r,a):s&&b(s,"normal",r);break;case"op-token":b(e.text,a,r);break;case"ordgroup":f(e.body,r,a);break;case"overline":h(r,(function(r){r.push("start overline"),f(e.body,r,a),r.push("end overline")}));break;case"pmb":r.push("bold");break;case"phantom":r.push("empty space");break;case"raisebox":f(e.body,r,a);break;case"rule":r.push("rectangle");break;case"sizing":f(e.body,r,a);break;case"spacing":r.push("space");break;case"styling":f(e.body,r,a);break;case"sqrt":h(r,(function(r){var t=e.body,o=e.index;if(o)return"3"===y(f(o,[],a)).join(",")?(r.push("cube root of"),f(t,r,a),void r.push("end cube root")):(r.push("root"),r.push("start index"),f(o,r,a),void r.push("end index"));r.push("square root of"),f(t,r,a),r.push("end square root")}));break;case"supsub":var l=e.base,c=e.sub,u=e.sup,p=!1;if(l&&(f(l,r,a),p="op"===l.type&&"\\log"===l.name),c){var m=p?"base":"subscript";h(r,(function(e){e.push("start "+m),f(c,e,a),e.push("end "+m)}))}u&&h(r,(function(e){var r=y(f(u,[],a)).join(",");r in i?e.push(i[r]):(e.push("start superscript"),f(u,e,a),e.push("end superscript"))}));break;case"text":if("\\textbf"===e.font){h(r,(function(r){r.push("start bold text"),f(e.body,r,a),r.push("end bold text")}));break}h(r,(function(r){r.push("start text"),f(e.body,r,a),r.push("end text")}));break;case"textord":b(e.text,a,r);break;case"smash":f(e.body,r,a);break;case"enclose":if(/cancel/.test(e.label)){h(r,(function(r){r.push("start cancel"),f(e.body,r,a),r.push("end cancel")}));break}if(/box/.test(e.label)){h(r,(function(r){r.push("start box"),f(e.body,r,a),r.push("end box")}));break}if(/sout/.test(e.label)){h(r,(function(r){r.push("start strikeout"),f(e.body,r,a),r.push("end strikeout")}));break}if(/phase/.test(e.label)){h(r,(function(r){r.push("start phase angle"),f(e.body,r,a),r.push("end phase angle")}));break}throw new Error("KaTeX-a11y: enclose node with "+e.label+" not supported yet");case"vcenter":f(e.body,r,a);break;case"vphantom":throw new Error("KaTeX-a11y: vphantom not implemented yet");case"hphantom":throw new Error("KaTeX-a11y: hphantom not implemented yet");case"operatorname":f(e.body,r,a);break;case"array":throw new Error("KaTeX-a11y: array not implemented yet");case"raw":throw new Error("KaTeX-a11y: raw not implemented yet");case"size":break;case"url":throw new Error("KaTeX-a11y: url not implemented yet");case"tag":throw new Error("KaTeX-a11y: tag not implemented yet");case"verb":b("start verbatim","normal",r),b(e.body,"normal",r),b("end verbatim","normal",r);break;case"environment":throw new Error("KaTeX-a11y: environment not implemented yet");case"horizBrace":b("start "+e.label.slice(1),"normal",r),f(e.base,r,a),b("end "+e.label.slice(1),"normal",r);break;case"infix":break;case"includegraphics":throw new Error("KaTeX-a11y: includegraphics not implemented yet");case"font":f(e.body,r,a);break;case"href":throw new Error("KaTeX-a11y: href not implemented yet");case"cr":throw new Error("KaTeX-a11y: cr not implemented yet");case"underline":h(r,(function(r){r.push("start underline"),f(e.body,r,a),r.push("end underline")}));break;case"xArrow":throw new Error("KaTeX-a11y: xArrow not implemented yet");case"cdlabel":throw new Error("KaTeX-a11y: cdlabel not implemented yet");case"cdlabelparent":throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");case"mclass":var w=e.mclass.slice(1);f(e.body,r,w);break;case"mathchoice":f(e.text,r,a);break;case"htmlmathml":f(e.mathml,r,a);break;case"middle":b(e.delim,a,r);break;case"internal":break;case"html":f(e.body,r,a);break;default:throw e.type,new Error("KaTeX a11y un-recognized type: "+e.type)}},f=function e(r,a,t){if(void 0===a&&(a=[]),r instanceof Array)for(var o=0;o<r.length;o++)e(r[o],a,t);else m(r,a,t);return a},y=function e(r){var a=[];return r.forEach((function(r){r instanceof Array?a=a.concat(e(r)):a.push(r)})),a},w.default=function(e,r){var a=n().__parse(e,r),t=f(a,[],"normal");return y(t).join(", ")},w=w.default}()}));
|