486 kBJavaScriptView Raw
1class SourceLocation {
2 // The + prefix indicates that these fields aren't writeable
3 // Lexer holding the input string.
4 // Start offset, zero-based inclusive.
5 // End offset, zero-based exclusive.
6 constructor(lexer, start, end) {
7 this.lexer = void 0;
8 this.start = void 0;
9 this.end = void 0;
10 this.lexer = lexer;
11 this.start = start;
12 this.end = end;
13 }
14 /**
15 * Merges two `SourceLocation`s from location providers, given they are
16 * provided in order of appearance.
17 * - Returns the first one's location if only the first is provided.
18 * - Returns a merged range of the first and the last if both are provided
19 * and their lexers match.
20 * - Otherwise, returns null.
21 */
22 static range(first, second) {
23 if (!second) {
24 return first && first.loc;
25 } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) {
26 return null;
27 } else {
28 return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end);
29 }
30 }
31}
32class Token {
33 // don't expand the token
34 // used in \noexpand
35 constructor(text2, loc) {
36 this.text = void 0;
37 this.loc = void 0;
38 this.noexpand = void 0;
39 this.treatAsRelax = void 0;
40 this.text = text2;
41 this.loc = loc;
42 }
43 /**
44 * Given a pair of tokens (this and endToken), compute a `Token` encompassing
45 * the whole input range enclosed by these two.
46 */
47 range(endToken, text2) {
48 return new Token(text2, SourceLocation.range(this, endToken));
49 }
50}
51class ParseError {
52 // Error start position based on passed-in Token or ParseNode.
53 // Length of affected text based on passed-in Token or ParseNode.
54 // The underlying error message without any context added.
55 constructor(message, token) {
56 this.name = void 0;
57 this.position = void 0;
58 this.length = void 0;
59 this.rawMessage = void 0;
60 var error = "KaTeX parse error: " + message;
61 var start;
62 var end;
63 var loc = token && token.loc;
64 if (loc && loc.start <= loc.end) {
65 var input = loc.lexer.input;
66 start = loc.start;
67 end = loc.end;
68 if (start === input.length) {
69 error += " at end of input: ";
70 } else {
71 error += " at position " + (start + 1) + ": ";
72 }
73 var underlined = input.slice(start, end).replace(/[^]/g, "$&̲");
74 var left;
75 if (start > 15) {
76 left = "…" + input.slice(start - 15, start);
77 } else {
78 left = input.slice(0, start);
79 }
80 var right;
81 if (end + 15 < input.length) {
82 right = input.slice(end, end + 15) + "…";
83 } else {
84 right = input.slice(end);
85 }
86 error += left + underlined + right;
87 }
88 var self = new Error(error);
89 self.name = "ParseError";
90 self.__proto__ = ParseError.prototype;
91 self.position = start;
92 if (start != null && end != null) {
93 self.length = end - start;
94 }
95 self.rawMessage = message;
96 return self;
97 }
98}
99ParseError.prototype.__proto__ = Error.prototype;
100var contains = function contains2(list, elem) {
101 return list.indexOf(elem) !== -1;
102};
103var deflt = function deflt2(setting, defaultIfUndefined) {
104 return setting === void 0 ? defaultIfUndefined : setting;
105};
106var uppercase = /([A-Z])/g;
107var hyphenate = function hyphenate2(str) {
108 return str.replace(uppercase, "-$1").toLowerCase();
109};
110var ESCAPE_LOOKUP = {
111 "&": "&amp;",
112 ">": "&gt;",
113 "<": "&lt;",
114 '"': "&quot;",
115 "'": "&#x27;"
116};
117var ESCAPE_REGEX = /[&><"']/g;
118function escape(text2) {
119 return String(text2).replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
120}
121var getBaseElem = function getBaseElem2(group) {
122 if (group.type === "ordgroup") {
123 if (group.body.length === 1) {
124 return getBaseElem2(group.body[0]);
125 } else {
126 return group;
127 }
128 } else if (group.type === "color") {
129 if (group.body.length === 1) {
130 return getBaseElem2(group.body[0]);
131 } else {
132 return group;
133 }
134 } else if (group.type === "font") {
135 return getBaseElem2(group.body);
136 } else {
137 return group;
138 }
139};
140var isCharacterBox = function isCharacterBox2(group) {
141 var baseElem = getBaseElem(group);
142 return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom";
143};
144var assert = function assert2(value) {
145 if (!value) {
146 throw new Error("Expected non-null, but got " + String(value));
147 }
148 return value;
149};
150var protocolFromUrl = function protocolFromUrl2(url) {
151 var protocol = /^\s*([^\\/#]*?)(?::|&#0*58|&#x0*3a)/i.exec(url);
152 return protocol != null ? protocol[1] : "_relative";
153};
154var utils = {
155 contains,
156 deflt,
157 escape,
158 hyphenate,
159 getBaseElem,
160 isCharacterBox,
161 protocolFromUrl
162};
163var SETTINGS_SCHEMA = {
164 displayMode: {
165 type: "boolean",
166 description: "Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",
167 cli: "-d, --display-mode"
168 },
169 output: {
170 type: {
171 enum: ["htmlAndMathml", "html", "mathml"]
172 },
173 description: "Determines the markup language of the output.",
174 cli: "-F, --format <type>"
175 },
176 leqno: {
177 type: "boolean",
178 description: "Render display math in leqno style (left-justified tags)."
179 },
180 fleqn: {
181 type: "boolean",
182 description: "Render display math flush left."
183 },
184 throwOnError: {
185 type: "boolean",
186 default: true,
187 cli: "-t, --no-throw-on-error",
188 cliDescription: "Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."
189 },
190 errorColor: {
191 type: "string",
192 default: "#cc0000",
193 cli: "-c, --error-color <color>",
194 cliDescription: "A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",
195 cliProcessor: (color) => "#" + color
196 },
197 macros: {
198 type: "object",
199 cli: "-m, --macro <def>",
200 cliDescription: "Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",
201 cliDefault: [],
202 cliProcessor: (def, defs) => {
203 defs.push(def);
204 return defs;
205 }
206 },
207 minRuleThickness: {
208 type: "number",
209 description: "Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",
210 processor: (t) => Math.max(0, t),
211 cli: "--min-rule-thickness <size>",
212 cliProcessor: parseFloat
213 },
214 colorIsTextColor: {
215 type: "boolean",
216 description: "Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",
217 cli: "-b, --color-is-text-color"
218 },
219 strict: {
220 type: [{
221 enum: ["warn", "ignore", "error"]
222 }, "boolean", "function"],
223 description: "Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",
224 cli: "-S, --strict",
225 cliDefault: false
226 },
227 trust: {
228 type: ["boolean", "function"],
229 description: "Trust the input, enabling all HTML features such as \\url.",
230 cli: "-T, --trust"
231 },
232 maxSize: {
233 type: "number",
234 default: Infinity,
235 description: "If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",
236 processor: (s) => Math.max(0, s),
237 cli: "-s, --max-size <n>",
238 cliProcessor: parseInt
239 },
240 maxExpand: {
241 type: "number",
242 default: 1e3,
243 description: "Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",
244 processor: (n) => Math.max(0, n),
245 cli: "-e, --max-expand <n>",
246 cliProcessor: (n) => n === "Infinity" ? Infinity : parseInt(n)
247 },
248 globalGroup: {
249 type: "boolean",
250 cli: false
251 }
252};
253function getDefaultValue(schema) {
254 if (schema.default) {
255 return schema.default;
256 }
257 var type = schema.type;
258 var defaultType = Array.isArray(type) ? type[0] : type;
259 if (typeof defaultType !== "string") {
260 return defaultType.enum[0];
261 }
262 switch (defaultType) {
263 case "boolean":
264 return false;
265 case "string":
266 return "";
267 case "number":
268 return 0;
269 case "object":
270 return {};
271 }
272}
273class Settings {
274 constructor(options) {
275 this.displayMode = void 0;
276 this.output = void 0;
277 this.leqno = void 0;
278 this.fleqn = void 0;
279 this.throwOnError = void 0;
280 this.errorColor = void 0;
281 this.macros = void 0;
282 this.minRuleThickness = void 0;
283 this.colorIsTextColor = void 0;
284 this.strict = void 0;
285 this.trust = void 0;
286 this.maxSize = void 0;
287 this.maxExpand = void 0;
288 this.globalGroup = void 0;
289 options = options || {};
290 for (var prop in SETTINGS_SCHEMA) {
291 if (SETTINGS_SCHEMA.hasOwnProperty(prop)) {
292 var schema = SETTINGS_SCHEMA[prop];
293 this[prop] = options[prop] !== void 0 ? schema.processor ? schema.processor(options[prop]) : options[prop] : getDefaultValue(schema);
294 }
295 }
296 }
297 /**
298 * Report nonstrict (non-LaTeX-compatible) input.
299 * Can safely not be called if `this.strict` is false in JavaScript.
300 */
301 reportNonstrict(errorCode, errorMsg, token) {
302 var strict = this.strict;
303 if (typeof strict === "function") {
304 strict = strict(errorCode, errorMsg, token);
305 }
306 if (!strict || strict === "ignore") {
307 return;
308 } else if (strict === true || strict === "error") {
309 throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token);
310 } else if (strict === "warn") {
311 typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
312 } else {
313 typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
314 }
315 }
316 /**
317 * Check whether to apply strict (LaTeX-adhering) behavior for unusual
318 * input (like `\\`). Unlike `nonstrict`, will not throw an error;
319 * instead, "error" translates to a return value of `true`, while "ignore"
320 * translates to a return value of `false`. May still print a warning:
321 * "warn" prints a warning and returns `false`.
322 * This is for the second category of `errorCode`s listed in the README.
323 */
324 useStrictBehavior(errorCode, errorMsg, token) {
325 var strict = this.strict;
326 if (typeof strict === "function") {
327 try {
328 strict = strict(errorCode, errorMsg, token);
329 } catch (error) {
330 strict = "error";
331 }
332 }
333 if (!strict || strict === "ignore") {
334 return false;
335 } else if (strict === true || strict === "error") {
336 return true;
337 } else if (strict === "warn") {
338 typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
339 return false;
340 } else {
341 typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
342 return false;
343 }
344 }
345 /**
346 * Check whether to test potentially dangerous input, and return
347 * `true` (trusted) or `false` (untrusted). The sole argument `context`
348 * should be an object with `command` field specifying the relevant LaTeX
349 * command (as a string starting with `\`), and any other arguments, etc.
350 * If `context` has a `url` field, a `protocol` field will automatically
351 * get added by this function (changing the specified object).
352 */
353 isTrusted(context) {
354 if (context.url && !context.protocol) {
355 context.protocol = utils.protocolFromUrl(context.url);
356 }
357 var trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
358 return Boolean(trust);
359 }
360}
361class Style {
362 constructor(id, size, cramped) {
363 this.id = void 0;
364 this.size = void 0;
365 this.cramped = void 0;
366 this.id = id;
367 this.size = size;
368 this.cramped = cramped;
369 }
370 /**
371 * Get the style of a superscript given a base in the current style.
372 */
373 sup() {
374 return styles[sup[this.id]];
375 }
376 /**
377 * Get the style of a subscript given a base in the current style.
378 */
379 sub() {
380 return styles[sub[this.id]];
381 }
382 /**
383 * Get the style of a fraction numerator given the fraction in the current
384 * style.
385 */
386 fracNum() {
387 return styles[fracNum[this.id]];
388 }
389 /**
390 * Get the style of a fraction denominator given the fraction in the current
391 * style.
392 */
393 fracDen() {
394 return styles[fracDen[this.id]];
395 }
396 /**
397 * Get the cramped version of a style (in particular, cramping a cramped style
398 * doesn't change the style).
399 */
400 cramp() {
401 return styles[cramp[this.id]];
402 }
403 /**
404 * Get a text or display version of this style.
405 */
406 text() {
407 return styles[text$1[this.id]];
408 }
409 /**
410 * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
411 */
412 isTight() {
413 return this.size >= 2;
414 }
415}
416var D = 0;
417var Dc = 1;
418var T = 2;
419var Tc = 3;
420var S = 4;
421var Sc = 5;
422var SS = 6;
423var SSc = 7;
424var styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)];
425var sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];
426var sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];
427var fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];
428var fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];
429var cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];
430var text$1 = [D, Dc, T, Tc, T, Tc, T, Tc];
431var Style$1 = {
432 DISPLAY: styles[D],
433 TEXT: styles[T],
434 SCRIPT: styles[S],
435 SCRIPTSCRIPT: styles[SS]
436};
437var scriptData = [{
438 // Latin characters beyond the Latin-1 characters we have metrics for.
439 // Needed for Czech, Hungarian and Turkish text, for example.
440 name: "latin",
441 blocks: [
442 [256, 591],
443 // Latin Extended-A and Latin Extended-B
444 [768, 879]
445 // Combining Diacritical marks
446 ]
447}, {
448 // The Cyrillic script used by Russian and related languages.
449 // A Cyrillic subset used to be supported as explicitly defined
450 // symbols in symbols.js
451 name: "cyrillic",
452 blocks: [[1024, 1279]]
453}, {
454 // Armenian
455 name: "armenian",
456 blocks: [[1328, 1423]]
457}, {
458 // The Brahmic scripts of South and Southeast Asia
459 // Devanagari (0900–097F)
460 // Bengali (0980–09FF)
461 // Gurmukhi (0A00–0A7F)
462 // Gujarati (0A80–0AFF)
463 // Oriya (0B00–0B7F)
464 // Tamil (0B80–0BFF)
465 // Telugu (0C00–0C7F)
466 // Kannada (0C80–0CFF)
467 // Malayalam (0D00–0D7F)
468 // Sinhala (0D80–0DFF)
469 // Thai (0E00–0E7F)
470 // Lao (0E80–0EFF)
471 // Tibetan (0F00–0FFF)
472 // Myanmar (1000–109F)
473 name: "brahmic",
474 blocks: [[2304, 4255]]
475}, {
476 name: "georgian",
477 blocks: [[4256, 4351]]
478}, {
479 // Chinese and Japanese.
480 // The "k" in cjk is for Korean, but we've separated Korean out
481 name: "cjk",
482 blocks: [
483 [12288, 12543],
484 // CJK symbols and punctuation, Hiragana, Katakana
485 [19968, 40879],
486 // CJK ideograms
487 [65280, 65376]
488 // Fullwidth punctuation
489 // TODO: add halfwidth Katakana and Romanji glyphs
490 ]
491}, {
492 // Korean
493 name: "hangul",
494 blocks: [[44032, 55215]]
495}];
496function scriptFromCodepoint(codepoint) {
497 for (var i = 0; i < scriptData.length; i++) {
498 var script = scriptData[i];
499 for (var _i = 0; _i < script.blocks.length; _i++) {
500 var block = script.blocks[_i];
501 if (codepoint >= block[0] && codepoint <= block[1]) {
502 return script.name;
503 }
504 }
505 }
506 return null;
507}
508var allBlocks = [];
509scriptData.forEach((s) => s.blocks.forEach((b) => allBlocks.push(...b)));
510function supportedCodepoint(codepoint) {
511 for (var i = 0; i < allBlocks.length; i += 2) {
512 if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) {
513 return true;
514 }
515 }
516 return false;
517}
518var hLinePad = 80;
519var sqrtMain = function sqrtMain2(extraVinculum, hLinePad2) {
520 return "M95," + (622 + extraVinculum + hLinePad2) + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.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\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + extraVinculum / 2.075 + " -" + extraVinculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraVinculum) + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + (834 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z";
521};
522var sqrtSize1 = function sqrtSize12(extraVinculum, hLinePad2) {
523 return "M263," + (601 + extraVinculum + hLinePad2) + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + extraVinculum / 2.084 + " -" + extraVinculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraVinculum) + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z";
524};
525var sqrtSize2 = function sqrtSize22(extraVinculum, hLinePad2) {
526 return "M983 " + (10 + extraVinculum + hLinePad2) + "\nl" + extraVinculum / 3.13 + " -" + extraVinculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraVinculum) + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z";
527};
528var sqrtSize3 = function sqrtSize32(extraVinculum, hLinePad2) {
529 return "M424," + (2398 + extraVinculum + hLinePad2) + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-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\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + extraVinculum / 4.223 + " -" + extraVinculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraVinculum) + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + (1001 + extraVinculum) + " " + hLinePad2 + "\nh400000v" + (40 + extraVinculum) + "h-400000z";
530};
531var sqrtSize4 = function sqrtSize42(extraVinculum, hLinePad2) {
532 return "M473," + (2713 + extraVinculum + hLinePad2) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraVinculum / 5.298 + " -" + extraVinculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraVinculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-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\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "H1017.7z";
533};
534var phasePath = function phasePath2(y) {
535 var x = y / 2;
536 return "M400000 " + y + " H0 L" + x + " 0 l65 45 L145 " + (y - 80) + " H400000z";
537};
538var sqrtTall = function sqrtTall2(extraVinculum, hLinePad2, viewBoxHeight) {
539 var vertSegment = viewBoxHeight - 54 - hLinePad2 - extraVinculum;
540 return "M702 " + (extraVinculum + hLinePad2) + "H400000" + (40 + extraVinculum) + "\nH742v" + 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\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + hLinePad2 + "H400000v" + (40 + extraVinculum) + "H742z";
541};
542var sqrtPath = function sqrtPath2(size, extraVinculum, viewBoxHeight) {
543 extraVinculum = 1e3 * extraVinculum;
544 var path2 = "";
545 switch (size) {
546 case "sqrtMain":
547 path2 = sqrtMain(extraVinculum, hLinePad);
548 break;
549 case "sqrtSize1":
550 path2 = sqrtSize1(extraVinculum, hLinePad);
551 break;
552 case "sqrtSize2":
553 path2 = sqrtSize2(extraVinculum, hLinePad);
554 break;
555 case "sqrtSize3":
556 path2 = sqrtSize3(extraVinculum, hLinePad);
557 break;
558 case "sqrtSize4":
559 path2 = sqrtSize4(extraVinculum, hLinePad);
560 break;
561 case "sqrtTall":
562 path2 = sqrtTall(extraVinculum, hLinePad, viewBoxHeight);
563 }
564 return path2;
565};
566var innerPath = function innerPath2(name, height) {
567 switch (name) {
568 case "⎜":
569 return "M291 0 H417 V" + height + " H291z M291 0 H417 V" + height + " H291z";
570 case "∣":
571 return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z";
572 case "∥":
573 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");
574 case "⎟":
575 return "M457 0 H583 V" + height + " H457z M457 0 H583 V" + height + " H457z";
576 case "⎢":
577 return "M319 0 H403 V" + height + " H319z M319 0 H403 V" + height + " H319z";
578 case "⎥":
579 return "M263 0 H347 V" + height + " H263z M263 0 H347 V" + height + " H263z";
580 case "⎪":
581 return "M384 0 H504 V" + height + " H384z M384 0 H504 V" + height + " H384z";
582 case "⏐":
583 return "M312 0 H355 V" + height + " H312z M312 0 H355 V" + height + " H312z";
584 case "‖":
585 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");
586 default:
587 return "";
588 }
589};
590var path = {
591 // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
592 doubleleftarrow: "M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",
593 // doublerightarrow is from glyph U+21D2 in font KaTeX Main
594 doublerightarrow: "M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",
595 // leftarrow is from glyph U+2190 in font KaTeX Main
596 leftarrow: "M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",
597 // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular
598 leftbrace: "M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",
599 leftbraceunder: "M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",
600 // overgroup is from the MnSymbol package (public domain)
601 leftgroup: "M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",
602 leftgroupunder: "M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",
603 // Harpoons are from glyph U+21BD in font KaTeX Main
604 leftharpoon: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",
605 leftharpoonplus: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",
606 leftharpoondown: "M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",
607 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",
608 // hook is from glyph U+21A9 in font KaTeX Main
609 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",
610 leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",
611 leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",
612 // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
613 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",
614 longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",
615 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",
616 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",
617 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",
618 oiintSize2: "M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",
619 oiiintSize1: "M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",
620 oiiintSize2: "M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",
621 rightarrow: "M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",
622 rightbrace: "M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",
623 rightbraceunder: "M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",
624 rightgroup: "M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",
625 rightgroupunder: "M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",
626 rightharpoon: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",
627 rightharpoonplus: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",
628 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",
629 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",
630 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",
631 rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",
632 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",
633 // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
634 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",
635 twoheadrightarrow: "M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",
636 // tilde1 is a modified version of a glyph from the MnSymbol package
637 tilde1: "M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",
638 // ditto tilde2, tilde3, & tilde4
639 tilde2: "M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",
640 tilde3: "M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",
641 tilde4: "M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",
642 // vec is from glyph U+20D7 in font KaTeX Main
643 vec: "M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",
644 // widehat1 is a modified version of a glyph from the MnSymbol package
645 widehat1: "M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-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",
646 // ditto widehat2, widehat3, & widehat4
647 widehat2: "M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
648 widehat3: "M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
649 widehat4: "M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
650 // widecheck paths are all inverted versions of widehat
651 widecheck1: "M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",
652 widecheck2: "M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
653 widecheck3: "M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
654 widecheck4: "M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
655 // The next ten paths support reaction arrows from the mhchem package.
656 // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
657 // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main
658 baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-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\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",
659 // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
660 rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",
661 // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.
662 // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em
663 baraboveshortleftharpoon: "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",
664 rightharpoonaboveshortbar: "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",
665 shortbaraboveleftharpoon: "M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",
666 shortrightharpoonabovebar: "M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"
667};
668var tallDelim = function tallDelim2(label, midHeight) {
669 switch (label) {
670 case "lbrack":
671 return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v" + midHeight + " v1759 h84z";
672 case "rbrack":
673 return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v" + midHeight + " v1759 h84z";
674 case "vert":
675 return "M145 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + midHeight + " v585 h43z";
676 case "doublevert":
677 return "M145 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + midHeight + " v585 h43z\nM367 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v" + midHeight + " v585 h43z";
678 case "lfloor":
679 return "M319 602 V0 H403 V602 v" + midHeight + " v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v" + midHeight + " v1715 H319z";
680 case "rfloor":
681 return "M319 602 V0 H403 V602 v" + midHeight + " v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v" + midHeight + " v1715 H319z";
682 case "lceil":
683 return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v602 h84z\nM403 1759 V0 H319 V1759 v" + midHeight + " v602 h84z";
684 case "rceil":
685 return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v602 h84z\nM347 1759 V0 h-84 V1759 v" + midHeight + " v602 h84z";
686 case "lparen":
687 return "M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0," + (midHeight + 84) + "c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-" + (midHeight + 92) + "c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";
688 case "rparen":
689 return "M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0," + (midHeight + 9) + "\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-" + (midHeight + 144) + "c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";
690 default:
691 throw new Error("Unknown stretchy delimiter.");
692 }
693};
694class DocumentFragment {
695 // HtmlDomNode
696 // Never used; needed for satisfying interface.
697 constructor(children) {
698 this.children = void 0;
699 this.classes = void 0;
700 this.height = void 0;
701 this.depth = void 0;
702 this.maxFontSize = void 0;
703 this.style = void 0;
704 this.children = children;
705 this.classes = [];
706 this.height = 0;
707 this.depth = 0;
708 this.maxFontSize = 0;
709 this.style = {};
710 }
711 hasClass(className) {
712 return utils.contains(this.classes, className);
713 }
714 /** Convert the fragment into a node. */
715 toNode() {
716 var frag = document.createDocumentFragment();
717 for (var i = 0; i < this.children.length; i++) {
718 frag.appendChild(this.children[i].toNode());
719 }
720 return frag;
721 }
722 /** Convert the fragment into HTML markup. */
723 toMarkup() {
724 var markup = "";
725 for (var i = 0; i < this.children.length; i++) {
726 markup += this.children[i].toMarkup();
727 }
728 return markup;
729 }
730 /**
731 * Converts the math node into a string, similar to innerText. Applies to
732 * MathDomNode's only.
733 */
734 toText() {
735 var toText = (child) => child.toText();
736 return this.children.map(toText).join("");
737 }
738}
739var fontMetricsData = {
740 "AMS-Regular": {
741 "32": [0, 0, 0, 0, 0.25],
742 "65": [0, 0.68889, 0, 0, 0.72222],
743 "66": [0, 0.68889, 0, 0, 0.66667],
744 "67": [0, 0.68889, 0, 0, 0.72222],
745 "68": [0, 0.68889, 0, 0, 0.72222],
746 "69": [0, 0.68889, 0, 0, 0.66667],
747 "70": [0, 0.68889, 0, 0, 0.61111],
748 "71": [0, 0.68889, 0, 0, 0.77778],
749 "72": [0, 0.68889, 0, 0, 0.77778],
750 "73": [0, 0.68889, 0, 0, 0.38889],
751 "74": [0.16667, 0.68889, 0, 0, 0.5],
752 "75": [0, 0.68889, 0, 0, 0.77778],
753 "76": [0, 0.68889, 0, 0, 0.66667],
754 "77": [0, 0.68889, 0, 0, 0.94445],
755 "78": [0, 0.68889, 0, 0, 0.72222],
756 "79": [0.16667, 0.68889, 0, 0, 0.77778],
757 "80": [0, 0.68889, 0, 0, 0.61111],
758 "81": [0.16667, 0.68889, 0, 0, 0.77778],
759 "82": [0, 0.68889, 0, 0, 0.72222],
760 "83": [0, 0.68889, 0, 0, 0.55556],
761 "84": [0, 0.68889, 0, 0, 0.66667],
762 "85": [0, 0.68889, 0, 0, 0.72222],
763 "86": [0, 0.68889, 0, 0, 0.72222],
764 "87": [0, 0.68889, 0, 0, 1],
765 "88": [0, 0.68889, 0, 0, 0.72222],
766 "89": [0, 0.68889, 0, 0, 0.72222],
767 "90": [0, 0.68889, 0, 0, 0.66667],
768 "107": [0, 0.68889, 0, 0, 0.55556],
769 "160": [0, 0, 0, 0, 0.25],
770 "165": [0, 0.675, 0.025, 0, 0.75],
771 "174": [0.15559, 0.69224, 0, 0, 0.94666],
772 "240": [0, 0.68889, 0, 0, 0.55556],
773 "295": [0, 0.68889, 0, 0, 0.54028],
774 "710": [0, 0.825, 0, 0, 2.33334],
775 "732": [0, 0.9, 0, 0, 2.33334],
776 "770": [0, 0.825, 0, 0, 2.33334],
777 "771": [0, 0.9, 0, 0, 2.33334],
778 "989": [0.08167, 0.58167, 0, 0, 0.77778],
779 "1008": [0, 0.43056, 0.04028, 0, 0.66667],
780 "8245": [0, 0.54986, 0, 0, 0.275],
781 "8463": [0, 0.68889, 0, 0, 0.54028],
782 "8487": [0, 0.68889, 0, 0, 0.72222],
783 "8498": [0, 0.68889, 0, 0, 0.55556],
784 "8502": [0, 0.68889, 0, 0, 0.66667],
785 "8503": [0, 0.68889, 0, 0, 0.44445],
786 "8504": [0, 0.68889, 0, 0, 0.66667],
787 "8513": [0, 0.68889, 0, 0, 0.63889],
788 "8592": [-0.03598, 0.46402, 0, 0, 0.5],
789 "8594": [-0.03598, 0.46402, 0, 0, 0.5],
790 "8602": [-0.13313, 0.36687, 0, 0, 1],
791 "8603": [-0.13313, 0.36687, 0, 0, 1],
792 "8606": [0.01354, 0.52239, 0, 0, 1],
793 "8608": [0.01354, 0.52239, 0, 0, 1],
794 "8610": [0.01354, 0.52239, 0, 0, 1.11111],
795 "8611": [0.01354, 0.52239, 0, 0, 1.11111],
796 "8619": [0, 0.54986, 0, 0, 1],
797 "8620": [0, 0.54986, 0, 0, 1],
798 "8621": [-0.13313, 0.37788, 0, 0, 1.38889],
799 "8622": [-0.13313, 0.36687, 0, 0, 1],
800 "8624": [0, 0.69224, 0, 0, 0.5],
801 "8625": [0, 0.69224, 0, 0, 0.5],
802 "8630": [0, 0.43056, 0, 0, 1],
803 "8631": [0, 0.43056, 0, 0, 1],
804 "8634": [0.08198, 0.58198, 0, 0, 0.77778],
805 "8635": [0.08198, 0.58198, 0, 0, 0.77778],
806 "8638": [0.19444, 0.69224, 0, 0, 0.41667],
807 "8639": [0.19444, 0.69224, 0, 0, 0.41667],
808 "8642": [0.19444, 0.69224, 0, 0, 0.41667],
809 "8643": [0.19444, 0.69224, 0, 0, 0.41667],
810 "8644": [0.1808, 0.675, 0, 0, 1],
811 "8646": [0.1808, 0.675, 0, 0, 1],
812 "8647": [0.1808, 0.675, 0, 0, 1],
813 "8648": [0.19444, 0.69224, 0, 0, 0.83334],
814 "8649": [0.1808, 0.675, 0, 0, 1],
815 "8650": [0.19444, 0.69224, 0, 0, 0.83334],
816 "8651": [0.01354, 0.52239, 0, 0, 1],
817 "8652": [0.01354, 0.52239, 0, 0, 1],
818 "8653": [-0.13313, 0.36687, 0, 0, 1],
819 "8654": [-0.13313, 0.36687, 0, 0, 1],
820 "8655": [-0.13313, 0.36687, 0, 0, 1],
821 "8666": [0.13667, 0.63667, 0, 0, 1],
822 "8667": [0.13667, 0.63667, 0, 0, 1],
823 "8669": [-0.13313, 0.37788, 0, 0, 1],
824 "8672": [-0.064, 0.437, 0, 0, 1.334],
825 "8674": [-0.064, 0.437, 0, 0, 1.334],
826 "8705": [0, 0.825, 0, 0, 0.5],
827 "8708": [0, 0.68889, 0, 0, 0.55556],
828 "8709": [0.08167, 0.58167, 0, 0, 0.77778],
829 "8717": [0, 0.43056, 0, 0, 0.42917],
830 "8722": [-0.03598, 0.46402, 0, 0, 0.5],
831 "8724": [0.08198, 0.69224, 0, 0, 0.77778],
832 "8726": [0.08167, 0.58167, 0, 0, 0.77778],
833 "8733": [0, 0.69224, 0, 0, 0.77778],
834 "8736": [0, 0.69224, 0, 0, 0.72222],
835 "8737": [0, 0.69224, 0, 0, 0.72222],
836 "8738": [0.03517, 0.52239, 0, 0, 0.72222],
837 "8739": [0.08167, 0.58167, 0, 0, 0.22222],
838 "8740": [0.25142, 0.74111, 0, 0, 0.27778],
839 "8741": [0.08167, 0.58167, 0, 0, 0.38889],
840 "8742": [0.25142, 0.74111, 0, 0, 0.5],
841 "8756": [0, 0.69224, 0, 0, 0.66667],
842 "8757": [0, 0.69224, 0, 0, 0.66667],
843 "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
844 "8765": [-0.13313, 0.37788, 0, 0, 0.77778],
845 "8769": [-0.13313, 0.36687, 0, 0, 0.77778],
846 "8770": [-0.03625, 0.46375, 0, 0, 0.77778],
847 "8774": [0.30274, 0.79383, 0, 0, 0.77778],
848 "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
849 "8778": [0.08167, 0.58167, 0, 0, 0.77778],
850 "8782": [0.06062, 0.54986, 0, 0, 0.77778],
851 "8783": [0.06062, 0.54986, 0, 0, 0.77778],
852 "8785": [0.08198, 0.58198, 0, 0, 0.77778],
853 "8786": [0.08198, 0.58198, 0, 0, 0.77778],
854 "8787": [0.08198, 0.58198, 0, 0, 0.77778],
855 "8790": [0, 0.69224, 0, 0, 0.77778],
856 "8791": [0.22958, 0.72958, 0, 0, 0.77778],
857 "8796": [0.08198, 0.91667, 0, 0, 0.77778],
858 "8806": [0.25583, 0.75583, 0, 0, 0.77778],
859 "8807": [0.25583, 0.75583, 0, 0, 0.77778],
860 "8808": [0.25142, 0.75726, 0, 0, 0.77778],
861 "8809": [0.25142, 0.75726, 0, 0, 0.77778],
862 "8812": [0.25583, 0.75583, 0, 0, 0.5],
863 "8814": [0.20576, 0.70576, 0, 0, 0.77778],
864 "8815": [0.20576, 0.70576, 0, 0, 0.77778],
865 "8816": [0.30274, 0.79383, 0, 0, 0.77778],
866 "8817": [0.30274, 0.79383, 0, 0, 0.77778],
867 "8818": [0.22958, 0.72958, 0, 0, 0.77778],
868 "8819": [0.22958, 0.72958, 0, 0, 0.77778],
869 "8822": [0.1808, 0.675, 0, 0, 0.77778],
870 "8823": [0.1808, 0.675, 0, 0, 0.77778],
871 "8828": [0.13667, 0.63667, 0, 0, 0.77778],
872 "8829": [0.13667, 0.63667, 0, 0, 0.77778],
873 "8830": [0.22958, 0.72958, 0, 0, 0.77778],
874 "8831": [0.22958, 0.72958, 0, 0, 0.77778],
875 "8832": [0.20576, 0.70576, 0, 0, 0.77778],
876 "8833": [0.20576, 0.70576, 0, 0, 0.77778],
877 "8840": [0.30274, 0.79383, 0, 0, 0.77778],
878 "8841": [0.30274, 0.79383, 0, 0, 0.77778],
879 "8842": [0.13597, 0.63597, 0, 0, 0.77778],
880 "8843": [0.13597, 0.63597, 0, 0, 0.77778],
881 "8847": [0.03517, 0.54986, 0, 0, 0.77778],
882 "8848": [0.03517, 0.54986, 0, 0, 0.77778],
883 "8858": [0.08198, 0.58198, 0, 0, 0.77778],
884 "8859": [0.08198, 0.58198, 0, 0, 0.77778],
885 "8861": [0.08198, 0.58198, 0, 0, 0.77778],
886 "8862": [0, 0.675, 0, 0, 0.77778],
887 "8863": [0, 0.675, 0, 0, 0.77778],
888 "8864": [0, 0.675, 0, 0, 0.77778],
889 "8865": [0, 0.675, 0, 0, 0.77778],
890 "8872": [0, 0.69224, 0, 0, 0.61111],
891 "8873": [0, 0.69224, 0, 0, 0.72222],
892 "8874": [0, 0.69224, 0, 0, 0.88889],
893 "8876": [0, 0.68889, 0, 0, 0.61111],
894 "8877": [0, 0.68889, 0, 0, 0.61111],
895 "8878": [0, 0.68889, 0, 0, 0.72222],
896 "8879": [0, 0.68889, 0, 0, 0.72222],
897 "8882": [0.03517, 0.54986, 0, 0, 0.77778],
898 "8883": [0.03517, 0.54986, 0, 0, 0.77778],
899 "8884": [0.13667, 0.63667, 0, 0, 0.77778],
900 "8885": [0.13667, 0.63667, 0, 0, 0.77778],
901 "8888": [0, 0.54986, 0, 0, 1.11111],
902 "8890": [0.19444, 0.43056, 0, 0, 0.55556],
903 "8891": [0.19444, 0.69224, 0, 0, 0.61111],
904 "8892": [0.19444, 0.69224, 0, 0, 0.61111],
905 "8901": [0, 0.54986, 0, 0, 0.27778],
906 "8903": [0.08167, 0.58167, 0, 0, 0.77778],
907 "8905": [0.08167, 0.58167, 0, 0, 0.77778],
908 "8906": [0.08167, 0.58167, 0, 0, 0.77778],
909 "8907": [0, 0.69224, 0, 0, 0.77778],
910 "8908": [0, 0.69224, 0, 0, 0.77778],
911 "8909": [-0.03598, 0.46402, 0, 0, 0.77778],
912 "8910": [0, 0.54986, 0, 0, 0.76042],
913 "8911": [0, 0.54986, 0, 0, 0.76042],
914 "8912": [0.03517, 0.54986, 0, 0, 0.77778],
915 "8913": [0.03517, 0.54986, 0, 0, 0.77778],
916 "8914": [0, 0.54986, 0, 0, 0.66667],
917 "8915": [0, 0.54986, 0, 0, 0.66667],
918 "8916": [0, 0.69224, 0, 0, 0.66667],
919 "8918": [0.0391, 0.5391, 0, 0, 0.77778],
920 "8919": [0.0391, 0.5391, 0, 0, 0.77778],
921 "8920": [0.03517, 0.54986, 0, 0, 1.33334],
922 "8921": [0.03517, 0.54986, 0, 0, 1.33334],
923 "8922": [0.38569, 0.88569, 0, 0, 0.77778],
924 "8923": [0.38569, 0.88569, 0, 0, 0.77778],
925 "8926": [0.13667, 0.63667, 0, 0, 0.77778],
926 "8927": [0.13667, 0.63667, 0, 0, 0.77778],
927 "8928": [0.30274, 0.79383, 0, 0, 0.77778],
928 "8929": [0.30274, 0.79383, 0, 0, 0.77778],
929 "8934": [0.23222, 0.74111, 0, 0, 0.77778],
930 "8935": [0.23222, 0.74111, 0, 0, 0.77778],
931 "8936": [0.23222, 0.74111, 0, 0, 0.77778],
932 "8937": [0.23222, 0.74111, 0, 0, 0.77778],
933 "8938": [0.20576, 0.70576, 0, 0, 0.77778],
934 "8939": [0.20576, 0.70576, 0, 0, 0.77778],
935 "8940": [0.30274, 0.79383, 0, 0, 0.77778],
936 "8941": [0.30274, 0.79383, 0, 0, 0.77778],
937 "8994": [0.19444, 0.69224, 0, 0, 0.77778],
938 "8995": [0.19444, 0.69224, 0, 0, 0.77778],
939 "9416": [0.15559, 0.69224, 0, 0, 0.90222],
940 "9484": [0, 0.69224, 0, 0, 0.5],
941 "9488": [0, 0.69224, 0, 0, 0.5],
942 "9492": [0, 0.37788, 0, 0, 0.5],
943 "9496": [0, 0.37788, 0, 0, 0.5],
944 "9585": [0.19444, 0.68889, 0, 0, 0.88889],
945 "9586": [0.19444, 0.74111, 0, 0, 0.88889],
946 "9632": [0, 0.675, 0, 0, 0.77778],
947 "9633": [0, 0.675, 0, 0, 0.77778],
948 "9650": [0, 0.54986, 0, 0, 0.72222],
949 "9651": [0, 0.54986, 0, 0, 0.72222],
950 "9654": [0.03517, 0.54986, 0, 0, 0.77778],
951 "9660": [0, 0.54986, 0, 0, 0.72222],
952 "9661": [0, 0.54986, 0, 0, 0.72222],
953 "9664": [0.03517, 0.54986, 0, 0, 0.77778],
954 "9674": [0.11111, 0.69224, 0, 0, 0.66667],
955 "9733": [0.19444, 0.69224, 0, 0, 0.94445],
956 "10003": [0, 0.69224, 0, 0, 0.83334],
957 "10016": [0, 0.69224, 0, 0, 0.83334],
958 "10731": [0.11111, 0.69224, 0, 0, 0.66667],
959 "10846": [0.19444, 0.75583, 0, 0, 0.61111],
960 "10877": [0.13667, 0.63667, 0, 0, 0.77778],
961 "10878": [0.13667, 0.63667, 0, 0, 0.77778],
962 "10885": [0.25583, 0.75583, 0, 0, 0.77778],
963 "10886": [0.25583, 0.75583, 0, 0, 0.77778],
964 "10887": [0.13597, 0.63597, 0, 0, 0.77778],
965 "10888": [0.13597, 0.63597, 0, 0, 0.77778],
966 "10889": [0.26167, 0.75726, 0, 0, 0.77778],
967 "10890": [0.26167, 0.75726, 0, 0, 0.77778],
968 "10891": [0.48256, 0.98256, 0, 0, 0.77778],
969 "10892": [0.48256, 0.98256, 0, 0, 0.77778],
970 "10901": [0.13667, 0.63667, 0, 0, 0.77778],
971 "10902": [0.13667, 0.63667, 0, 0, 0.77778],
972 "10933": [0.25142, 0.75726, 0, 0, 0.77778],
973 "10934": [0.25142, 0.75726, 0, 0, 0.77778],
974 "10935": [0.26167, 0.75726, 0, 0, 0.77778],
975 "10936": [0.26167, 0.75726, 0, 0, 0.77778],
976 "10937": [0.26167, 0.75726, 0, 0, 0.77778],
977 "10938": [0.26167, 0.75726, 0, 0, 0.77778],
978 "10949": [0.25583, 0.75583, 0, 0, 0.77778],
979 "10950": [0.25583, 0.75583, 0, 0, 0.77778],
980 "10955": [0.28481, 0.79383, 0, 0, 0.77778],
981 "10956": [0.28481, 0.79383, 0, 0, 0.77778],
982 "57350": [0.08167, 0.58167, 0, 0, 0.22222],
983 "57351": [0.08167, 0.58167, 0, 0, 0.38889],
984 "57352": [0.08167, 0.58167, 0, 0, 0.77778],
985 "57353": [0, 0.43056, 0.04028, 0, 0.66667],
986 "57356": [0.25142, 0.75726, 0, 0, 0.77778],
987 "57357": [0.25142, 0.75726, 0, 0, 0.77778],
988 "57358": [0.41951, 0.91951, 0, 0, 0.77778],
989 "57359": [0.30274, 0.79383, 0, 0, 0.77778],
990 "57360": [0.30274, 0.79383, 0, 0, 0.77778],
991 "57361": [0.41951, 0.91951, 0, 0, 0.77778],
992 "57366": [0.25142, 0.75726, 0, 0, 0.77778],
993 "57367": [0.25142, 0.75726, 0, 0, 0.77778],
994 "57368": [0.25142, 0.75726, 0, 0, 0.77778],
995 "57369": [0.25142, 0.75726, 0, 0, 0.77778],
996 "57370": [0.13597, 0.63597, 0, 0, 0.77778],
997 "57371": [0.13597, 0.63597, 0, 0, 0.77778]
998 },
999 "Caligraphic-Regular": {
1000 "32": [0, 0, 0, 0, 0.25],
1001 "65": [0, 0.68333, 0, 0.19445, 0.79847],
1002 "66": [0, 0.68333, 0.03041, 0.13889, 0.65681],
1003 "67": [0, 0.68333, 0.05834, 0.13889, 0.52653],
1004 "68": [0, 0.68333, 0.02778, 0.08334, 0.77139],
1005 "69": [0, 0.68333, 0.08944, 0.11111, 0.52778],
1006 "70": [0, 0.68333, 0.09931, 0.11111, 0.71875],
1007 "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487],
1008 "72": [0, 0.68333, 965e-5, 0.11111, 0.84452],
1009 "73": [0, 0.68333, 0.07382, 0, 0.54452],
1010 "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778],
1011 "75": [0, 0.68333, 0.01445, 0.05556, 0.76195],
1012 "76": [0, 0.68333, 0, 0.13889, 0.68972],
1013 "77": [0, 0.68333, 0, 0.13889, 1.2009],
1014 "78": [0, 0.68333, 0.14736, 0.08334, 0.82049],
1015 "79": [0, 0.68333, 0.02778, 0.11111, 0.79611],
1016 "80": [0, 0.68333, 0.08222, 0.08334, 0.69556],
1017 "81": [0.09722, 0.68333, 0, 0.11111, 0.81667],
1018 "82": [0, 0.68333, 0, 0.08334, 0.8475],
1019 "83": [0, 0.68333, 0.075, 0.13889, 0.60556],
1020 "84": [0, 0.68333, 0.25417, 0, 0.54464],
1021 "85": [0, 0.68333, 0.09931, 0.08334, 0.62583],
1022 "86": [0, 0.68333, 0.08222, 0, 0.61278],
1023 "87": [0, 0.68333, 0.08222, 0.08334, 0.98778],
1024 "88": [0, 0.68333, 0.14643, 0.13889, 0.7133],
1025 "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834],
1026 "90": [0, 0.68333, 0.07944, 0.13889, 0.72473],
1027 "160": [0, 0, 0, 0, 0.25]
1028 },
1029 "Fraktur-Regular": {
1030 "32": [0, 0, 0, 0, 0.25],
1031 "33": [0, 0.69141, 0, 0, 0.29574],
1032 "34": [0, 0.69141, 0, 0, 0.21471],
1033 "38": [0, 0.69141, 0, 0, 0.73786],
1034 "39": [0, 0.69141, 0, 0, 0.21201],
1035 "40": [0.24982, 0.74947, 0, 0, 0.38865],
1036 "41": [0.24982, 0.74947, 0, 0, 0.38865],
1037 "42": [0, 0.62119, 0, 0, 0.27764],
1038 "43": [0.08319, 0.58283, 0, 0, 0.75623],
1039 "44": [0, 0.10803, 0, 0, 0.27764],
1040 "45": [0.08319, 0.58283, 0, 0, 0.75623],
1041 "46": [0, 0.10803, 0, 0, 0.27764],
1042 "47": [0.24982, 0.74947, 0, 0, 0.50181],
1043 "48": [0, 0.47534, 0, 0, 0.50181],
1044 "49": [0, 0.47534, 0, 0, 0.50181],
1045 "50": [0, 0.47534, 0, 0, 0.50181],
1046 "51": [0.18906, 0.47534, 0, 0, 0.50181],
1047 "52": [0.18906, 0.47534, 0, 0, 0.50181],
1048 "53": [0.18906, 0.47534, 0, 0, 0.50181],
1049 "54": [0, 0.69141, 0, 0, 0.50181],
1050 "55": [0.18906, 0.47534, 0, 0, 0.50181],
1051 "56": [0, 0.69141, 0, 0, 0.50181],
1052 "57": [0.18906, 0.47534, 0, 0, 0.50181],
1053 "58": [0, 0.47534, 0, 0, 0.21606],
1054 "59": [0.12604, 0.47534, 0, 0, 0.21606],
1055 "61": [-0.13099, 0.36866, 0, 0, 0.75623],
1056 "63": [0, 0.69141, 0, 0, 0.36245],
1057 "65": [0, 0.69141, 0, 0, 0.7176],
1058 "66": [0, 0.69141, 0, 0, 0.88397],
1059 "67": [0, 0.69141, 0, 0, 0.61254],
1060 "68": [0, 0.69141, 0, 0, 0.83158],
1061 "69": [0, 0.69141, 0, 0, 0.66278],
1062 "70": [0.12604, 0.69141, 0, 0, 0.61119],
1063 "71": [0, 0.69141, 0, 0, 0.78539],
1064 "72": [0.06302, 0.69141, 0, 0, 0.7203],
1065 "73": [0, 0.69141, 0, 0, 0.55448],
1066 "74": [0.12604, 0.69141, 0, 0, 0.55231],
1067 "75": [0, 0.69141, 0, 0, 0.66845],
1068 "76": [0, 0.69141, 0, 0, 0.66602],
1069 "77": [0, 0.69141, 0, 0, 1.04953],
1070 "78": [0, 0.69141, 0, 0, 0.83212],
1071 "79": [0, 0.69141, 0, 0, 0.82699],
1072 "80": [0.18906, 0.69141, 0, 0, 0.82753],
1073 "81": [0.03781, 0.69141, 0, 0, 0.82699],
1074 "82": [0, 0.69141, 0, 0, 0.82807],
1075 "83": [0, 0.69141, 0, 0, 0.82861],
1076 "84": [0, 0.69141, 0, 0, 0.66899],
1077 "85": [0, 0.69141, 0, 0, 0.64576],
1078 "86": [0, 0.69141, 0, 0, 0.83131],
1079 "87": [0, 0.69141, 0, 0, 1.04602],
1080 "88": [0, 0.69141, 0, 0, 0.71922],
1081 "89": [0.18906, 0.69141, 0, 0, 0.83293],
1082 "90": [0.12604, 0.69141, 0, 0, 0.60201],
1083 "91": [0.24982, 0.74947, 0, 0, 0.27764],
1084 "93": [0.24982, 0.74947, 0, 0, 0.27764],
1085 "94": [0, 0.69141, 0, 0, 0.49965],
1086 "97": [0, 0.47534, 0, 0, 0.50046],
1087 "98": [0, 0.69141, 0, 0, 0.51315],
1088 "99": [0, 0.47534, 0, 0, 0.38946],
1089 "100": [0, 0.62119, 0, 0, 0.49857],
1090 "101": [0, 0.47534, 0, 0, 0.40053],
1091 "102": [0.18906, 0.69141, 0, 0, 0.32626],
1092 "103": [0.18906, 0.47534, 0, 0, 0.5037],
1093 "104": [0.18906, 0.69141, 0, 0, 0.52126],
1094 "105": [0, 0.69141, 0, 0, 0.27899],
1095 "106": [0, 0.69141, 0, 0, 0.28088],
1096 "107": [0, 0.69141, 0, 0, 0.38946],
1097 "108": [0, 0.69141, 0, 0, 0.27953],
1098 "109": [0, 0.47534, 0, 0, 0.76676],
1099 "110": [0, 0.47534, 0, 0, 0.52666],
1100 "111": [0, 0.47534, 0, 0, 0.48885],
1101 "112": [0.18906, 0.52396, 0, 0, 0.50046],
1102 "113": [0.18906, 0.47534, 0, 0, 0.48912],
1103 "114": [0, 0.47534, 0, 0, 0.38919],
1104 "115": [0, 0.47534, 0, 0, 0.44266],
1105 "116": [0, 0.62119, 0, 0, 0.33301],
1106 "117": [0, 0.47534, 0, 0, 0.5172],
1107 "118": [0, 0.52396, 0, 0, 0.5118],
1108 "119": [0, 0.52396, 0, 0, 0.77351],
1109 "120": [0.18906, 0.47534, 0, 0, 0.38865],
1110 "121": [0.18906, 0.47534, 0, 0, 0.49884],
1111 "122": [0.18906, 0.47534, 0, 0, 0.39054],
1112 "160": [0, 0, 0, 0, 0.25],
1113 "8216": [0, 0.69141, 0, 0, 0.21471],
1114 "8217": [0, 0.69141, 0, 0, 0.21471],
1115 "58112": [0, 0.62119, 0, 0, 0.49749],
1116 "58113": [0, 0.62119, 0, 0, 0.4983],
1117 "58114": [0.18906, 0.69141, 0, 0, 0.33328],
1118 "58115": [0.18906, 0.69141, 0, 0, 0.32923],
1119 "58116": [0.18906, 0.47534, 0, 0, 0.50343],
1120 "58117": [0, 0.69141, 0, 0, 0.33301],
1121 "58118": [0, 0.62119, 0, 0, 0.33409],
1122 "58119": [0, 0.47534, 0, 0, 0.50073]
1123 },
1124 "Main-Bold": {
1125 "32": [0, 0, 0, 0, 0.25],
1126 "33": [0, 0.69444, 0, 0, 0.35],
1127 "34": [0, 0.69444, 0, 0, 0.60278],
1128 "35": [0.19444, 0.69444, 0, 0, 0.95833],
1129 "36": [0.05556, 0.75, 0, 0, 0.575],
1130 "37": [0.05556, 0.75, 0, 0, 0.95833],
1131 "38": [0, 0.69444, 0, 0, 0.89444],
1132 "39": [0, 0.69444, 0, 0, 0.31944],
1133 "40": [0.25, 0.75, 0, 0, 0.44722],
1134 "41": [0.25, 0.75, 0, 0, 0.44722],
1135 "42": [0, 0.75, 0, 0, 0.575],
1136 "43": [0.13333, 0.63333, 0, 0, 0.89444],
1137 "44": [0.19444, 0.15556, 0, 0, 0.31944],
1138 "45": [0, 0.44444, 0, 0, 0.38333],
1139 "46": [0, 0.15556, 0, 0, 0.31944],
1140 "47": [0.25, 0.75, 0, 0, 0.575],
1141 "48": [0, 0.64444, 0, 0, 0.575],
1142 "49": [0, 0.64444, 0, 0, 0.575],
1143 "50": [0, 0.64444, 0, 0, 0.575],
1144 "51": [0, 0.64444, 0, 0, 0.575],
1145 "52": [0, 0.64444, 0, 0, 0.575],
1146 "53": [0, 0.64444, 0, 0, 0.575],
1147 "54": [0, 0.64444, 0, 0, 0.575],
1148 "55": [0, 0.64444, 0, 0, 0.575],
1149 "56": [0, 0.64444, 0, 0, 0.575],
1150 "57": [0, 0.64444, 0, 0, 0.575],
1151 "58": [0, 0.44444, 0, 0, 0.31944],
1152 "59": [0.19444, 0.44444, 0, 0, 0.31944],
1153 "60": [0.08556, 0.58556, 0, 0, 0.89444],
1154 "61": [-0.10889, 0.39111, 0, 0, 0.89444],
1155 "62": [0.08556, 0.58556, 0, 0, 0.89444],
1156 "63": [0, 0.69444, 0, 0, 0.54305],
1157 "64": [0, 0.69444, 0, 0, 0.89444],
1158 "65": [0, 0.68611, 0, 0, 0.86944],
1159 "66": [0, 0.68611, 0, 0, 0.81805],
1160 "67": [0, 0.68611, 0, 0, 0.83055],
1161 "68": [0, 0.68611, 0, 0, 0.88194],
1162 "69": [0, 0.68611, 0, 0, 0.75555],
1163 "70": [0, 0.68611, 0, 0, 0.72361],
1164 "71": [0, 0.68611, 0, 0, 0.90416],
1165 "72": [0, 0.68611, 0, 0, 0.9],
1166 "73": [0, 0.68611, 0, 0, 0.43611],
1167 "74": [0, 0.68611, 0, 0, 0.59444],
1168 "75": [0, 0.68611, 0, 0, 0.90138],
1169 "76": [0, 0.68611, 0, 0, 0.69166],
1170 "77": [0, 0.68611, 0, 0, 1.09166],
1171 "78": [0, 0.68611, 0, 0, 0.9],
1172 "79": [0, 0.68611, 0, 0, 0.86388],
1173 "80": [0, 0.68611, 0, 0, 0.78611],
1174 "81": [0.19444, 0.68611, 0, 0, 0.86388],
1175 "82": [0, 0.68611, 0, 0, 0.8625],
1176 "83": [0, 0.68611, 0, 0, 0.63889],
1177 "84": [0, 0.68611, 0, 0, 0.8],
1178 "85": [0, 0.68611, 0, 0, 0.88472],
1179 "86": [0, 0.68611, 0.01597, 0, 0.86944],
1180 "87": [0, 0.68611, 0.01597, 0, 1.18888],
1181 "88": [0, 0.68611, 0, 0, 0.86944],
1182 "89": [0, 0.68611, 0.02875, 0, 0.86944],
1183 "90": [0, 0.68611, 0, 0, 0.70277],
1184 "91": [0.25, 0.75, 0, 0, 0.31944],
1185 "92": [0.25, 0.75, 0, 0, 0.575],
1186 "93": [0.25, 0.75, 0, 0, 0.31944],
1187 "94": [0, 0.69444, 0, 0, 0.575],
1188 "95": [0.31, 0.13444, 0.03194, 0, 0.575],
1189 "97": [0, 0.44444, 0, 0, 0.55902],
1190 "98": [0, 0.69444, 0, 0, 0.63889],
1191 "99": [0, 0.44444, 0, 0, 0.51111],
1192 "100": [0, 0.69444, 0, 0, 0.63889],
1193 "101": [0, 0.44444, 0, 0, 0.52708],
1194 "102": [0, 0.69444, 0.10903, 0, 0.35139],
1195 "103": [0.19444, 0.44444, 0.01597, 0, 0.575],
1196 "104": [0, 0.69444, 0, 0, 0.63889],
1197 "105": [0, 0.69444, 0, 0, 0.31944],
1198 "106": [0.19444, 0.69444, 0, 0, 0.35139],
1199 "107": [0, 0.69444, 0, 0, 0.60694],
1200 "108": [0, 0.69444, 0, 0, 0.31944],
1201 "109": [0, 0.44444, 0, 0, 0.95833],
1202 "110": [0, 0.44444, 0, 0, 0.63889],
1203 "111": [0, 0.44444, 0, 0, 0.575],
1204 "112": [0.19444, 0.44444, 0, 0, 0.63889],
1205 "113": [0.19444, 0.44444, 0, 0, 0.60694],
1206 "114": [0, 0.44444, 0, 0, 0.47361],
1207 "115": [0, 0.44444, 0, 0, 0.45361],
1208 "116": [0, 0.63492, 0, 0, 0.44722],
1209 "117": [0, 0.44444, 0, 0, 0.63889],
1210 "118": [0, 0.44444, 0.01597, 0, 0.60694],
1211 "119": [0, 0.44444, 0.01597, 0, 0.83055],
1212 "120": [0, 0.44444, 0, 0, 0.60694],
1213 "121": [0.19444, 0.44444, 0.01597, 0, 0.60694],
1214 "122": [0, 0.44444, 0, 0, 0.51111],
1215 "123": [0.25, 0.75, 0, 0, 0.575],
1216 "124": [0.25, 0.75, 0, 0, 0.31944],
1217 "125": [0.25, 0.75, 0, 0, 0.575],
1218 "126": [0.35, 0.34444, 0, 0, 0.575],
1219 "160": [0, 0, 0, 0, 0.25],
1220 "163": [0, 0.69444, 0, 0, 0.86853],
1221 "168": [0, 0.69444, 0, 0, 0.575],
1222 "172": [0, 0.44444, 0, 0, 0.76666],
1223 "176": [0, 0.69444, 0, 0, 0.86944],
1224 "177": [0.13333, 0.63333, 0, 0, 0.89444],
1225 "184": [0.17014, 0, 0, 0, 0.51111],
1226 "198": [0, 0.68611, 0, 0, 1.04166],
1227 "215": [0.13333, 0.63333, 0, 0, 0.89444],
1228 "216": [0.04861, 0.73472, 0, 0, 0.89444],
1229 "223": [0, 0.69444, 0, 0, 0.59722],
1230 "230": [0, 0.44444, 0, 0, 0.83055],
1231 "247": [0.13333, 0.63333, 0, 0, 0.89444],
1232 "248": [0.09722, 0.54167, 0, 0, 0.575],
1233 "305": [0, 0.44444, 0, 0, 0.31944],
1234 "338": [0, 0.68611, 0, 0, 1.16944],
1235 "339": [0, 0.44444, 0, 0, 0.89444],
1236 "567": [0.19444, 0.44444, 0, 0, 0.35139],
1237 "710": [0, 0.69444, 0, 0, 0.575],
1238 "711": [0, 0.63194, 0, 0, 0.575],
1239 "713": [0, 0.59611, 0, 0, 0.575],
1240 "714": [0, 0.69444, 0, 0, 0.575],
1241 "715": [0, 0.69444, 0, 0, 0.575],
1242 "728": [0, 0.69444, 0, 0, 0.575],
1243 "729": [0, 0.69444, 0, 0, 0.31944],
1244 "730": [0, 0.69444, 0, 0, 0.86944],
1245 "732": [0, 0.69444, 0, 0, 0.575],
1246 "733": [0, 0.69444, 0, 0, 0.575],
1247 "915": [0, 0.68611, 0, 0, 0.69166],
1248 "916": [0, 0.68611, 0, 0, 0.95833],
1249 "920": [0, 0.68611, 0, 0, 0.89444],
1250 "923": [0, 0.68611, 0, 0, 0.80555],
1251 "926": [0, 0.68611, 0, 0, 0.76666],
1252 "928": [0, 0.68611, 0, 0, 0.9],
1253 "931": [0, 0.68611, 0, 0, 0.83055],
1254 "933": [0, 0.68611, 0, 0, 0.89444],
1255 "934": [0, 0.68611, 0, 0, 0.83055],
1256 "936": [0, 0.68611, 0, 0, 0.89444],
1257 "937": [0, 0.68611, 0, 0, 0.83055],
1258 "8211": [0, 0.44444, 0.03194, 0, 0.575],
1259 "8212": [0, 0.44444, 0.03194, 0, 1.14999],
1260 "8216": [0, 0.69444, 0, 0, 0.31944],
1261 "8217": [0, 0.69444, 0, 0, 0.31944],
1262 "8220": [0, 0.69444, 0, 0, 0.60278],
1263 "8221": [0, 0.69444, 0, 0, 0.60278],
1264 "8224": [0.19444, 0.69444, 0, 0, 0.51111],
1265 "8225": [0.19444, 0.69444, 0, 0, 0.51111],
1266 "8242": [0, 0.55556, 0, 0, 0.34444],
1267 "8407": [0, 0.72444, 0.15486, 0, 0.575],
1268 "8463": [0, 0.69444, 0, 0, 0.66759],
1269 "8465": [0, 0.69444, 0, 0, 0.83055],
1270 "8467": [0, 0.69444, 0, 0, 0.47361],
1271 "8472": [0.19444, 0.44444, 0, 0, 0.74027],
1272 "8476": [0, 0.69444, 0, 0, 0.83055],
1273 "8501": [0, 0.69444, 0, 0, 0.70277],
1274 "8592": [-0.10889, 0.39111, 0, 0, 1.14999],
1275 "8593": [0.19444, 0.69444, 0, 0, 0.575],
1276 "8594": [-0.10889, 0.39111, 0, 0, 1.14999],
1277 "8595": [0.19444, 0.69444, 0, 0, 0.575],
1278 "8596": [-0.10889, 0.39111, 0, 0, 1.14999],
1279 "8597": [0.25, 0.75, 0, 0, 0.575],
1280 "8598": [0.19444, 0.69444, 0, 0, 1.14999],
1281 "8599": [0.19444, 0.69444, 0, 0, 1.14999],
1282 "8600": [0.19444, 0.69444, 0, 0, 1.14999],
1283 "8601": [0.19444, 0.69444, 0, 0, 1.14999],
1284 "8636": [-0.10889, 0.39111, 0, 0, 1.14999],
1285 "8637": [-0.10889, 0.39111, 0, 0, 1.14999],
1286 "8640": [-0.10889, 0.39111, 0, 0, 1.14999],
1287 "8641": [-0.10889, 0.39111, 0, 0, 1.14999],
1288 "8656": [-0.10889, 0.39111, 0, 0, 1.14999],
1289 "8657": [0.19444, 0.69444, 0, 0, 0.70277],
1290 "8658": [-0.10889, 0.39111, 0, 0, 1.14999],
1291 "8659": [0.19444, 0.69444, 0, 0, 0.70277],
1292 "8660": [-0.10889, 0.39111, 0, 0, 1.14999],
1293 "8661": [0.25, 0.75, 0, 0, 0.70277],
1294 "8704": [0, 0.69444, 0, 0, 0.63889],
1295 "8706": [0, 0.69444, 0.06389, 0, 0.62847],
1296 "8707": [0, 0.69444, 0, 0, 0.63889],
1297 "8709": [0.05556, 0.75, 0, 0, 0.575],
1298 "8711": [0, 0.68611, 0, 0, 0.95833],
1299 "8712": [0.08556, 0.58556, 0, 0, 0.76666],
1300 "8715": [0.08556, 0.58556, 0, 0, 0.76666],
1301 "8722": [0.13333, 0.63333, 0, 0, 0.89444],
1302 "8723": [0.13333, 0.63333, 0, 0, 0.89444],
1303 "8725": [0.25, 0.75, 0, 0, 0.575],
1304 "8726": [0.25, 0.75, 0, 0, 0.575],
1305 "8727": [-0.02778, 0.47222, 0, 0, 0.575],
1306 "8728": [-0.02639, 0.47361, 0, 0, 0.575],
1307 "8729": [-0.02639, 0.47361, 0, 0, 0.575],
1308 "8730": [0.18, 0.82, 0, 0, 0.95833],
1309 "8733": [0, 0.44444, 0, 0, 0.89444],
1310 "8734": [0, 0.44444, 0, 0, 1.14999],
1311 "8736": [0, 0.69224, 0, 0, 0.72222],
1312 "8739": [0.25, 0.75, 0, 0, 0.31944],
1313 "8741": [0.25, 0.75, 0, 0, 0.575],
1314 "8743": [0, 0.55556, 0, 0, 0.76666],
1315 "8744": [0, 0.55556, 0, 0, 0.76666],
1316 "8745": [0, 0.55556, 0, 0, 0.76666],
1317 "8746": [0, 0.55556, 0, 0, 0.76666],
1318 "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875],
1319 "8764": [-0.10889, 0.39111, 0, 0, 0.89444],
1320 "8768": [0.19444, 0.69444, 0, 0, 0.31944],
1321 "8771": [222e-5, 0.50222, 0, 0, 0.89444],
1322 "8773": [0.027, 0.638, 0, 0, 0.894],
1323 "8776": [0.02444, 0.52444, 0, 0, 0.89444],
1324 "8781": [222e-5, 0.50222, 0, 0, 0.89444],
1325 "8801": [222e-5, 0.50222, 0, 0, 0.89444],
1326 "8804": [0.19667, 0.69667, 0, 0, 0.89444],
1327 "8805": [0.19667, 0.69667, 0, 0, 0.89444],
1328 "8810": [0.08556, 0.58556, 0, 0, 1.14999],
1329 "8811": [0.08556, 0.58556, 0, 0, 1.14999],
1330 "8826": [0.08556, 0.58556, 0, 0, 0.89444],
1331 "8827": [0.08556, 0.58556, 0, 0, 0.89444],
1332 "8834": [0.08556, 0.58556, 0, 0, 0.89444],
1333 "8835": [0.08556, 0.58556, 0, 0, 0.89444],
1334 "8838": [0.19667, 0.69667, 0, 0, 0.89444],
1335 "8839": [0.19667, 0.69667, 0, 0, 0.89444],
1336 "8846": [0, 0.55556, 0, 0, 0.76666],
1337 "8849": [0.19667, 0.69667, 0, 0, 0.89444],
1338 "8850": [0.19667, 0.69667, 0, 0, 0.89444],
1339 "8851": [0, 0.55556, 0, 0, 0.76666],
1340 "8852": [0, 0.55556, 0, 0, 0.76666],
1341 "8853": [0.13333, 0.63333, 0, 0, 0.89444],
1342 "8854": [0.13333, 0.63333, 0, 0, 0.89444],
1343 "8855": [0.13333, 0.63333, 0, 0, 0.89444],
1344 "8856": [0.13333, 0.63333, 0, 0, 0.89444],
1345 "8857": [0.13333, 0.63333, 0, 0, 0.89444],
1346 "8866": [0, 0.69444, 0, 0, 0.70277],
1347 "8867": [0, 0.69444, 0, 0, 0.70277],
1348 "8868": [0, 0.69444, 0, 0, 0.89444],
1349 "8869": [0, 0.69444, 0, 0, 0.89444],
1350 "8900": [-0.02639, 0.47361, 0, 0, 0.575],
1351 "8901": [-0.02639, 0.47361, 0, 0, 0.31944],
1352 "8902": [-0.02778, 0.47222, 0, 0, 0.575],
1353 "8968": [0.25, 0.75, 0, 0, 0.51111],
1354 "8969": [0.25, 0.75, 0, 0, 0.51111],
1355 "8970": [0.25, 0.75, 0, 0, 0.51111],
1356 "8971": [0.25, 0.75, 0, 0, 0.51111],
1357 "8994": [-0.13889, 0.36111, 0, 0, 1.14999],
1358 "8995": [-0.13889, 0.36111, 0, 0, 1.14999],
1359 "9651": [0.19444, 0.69444, 0, 0, 1.02222],
1360 "9657": [-0.02778, 0.47222, 0, 0, 0.575],
1361 "9661": [0.19444, 0.69444, 0, 0, 1.02222],
1362 "9667": [-0.02778, 0.47222, 0, 0, 0.575],
1363 "9711": [0.19444, 0.69444, 0, 0, 1.14999],
1364 "9824": [0.12963, 0.69444, 0, 0, 0.89444],
1365 "9825": [0.12963, 0.69444, 0, 0, 0.89444],
1366 "9826": [0.12963, 0.69444, 0, 0, 0.89444],
1367 "9827": [0.12963, 0.69444, 0, 0, 0.89444],
1368 "9837": [0, 0.75, 0, 0, 0.44722],
1369 "9838": [0.19444, 0.69444, 0, 0, 0.44722],
1370 "9839": [0.19444, 0.69444, 0, 0, 0.44722],
1371 "10216": [0.25, 0.75, 0, 0, 0.44722],
1372 "10217": [0.25, 0.75, 0, 0, 0.44722],
1373 "10815": [0, 0.68611, 0, 0, 0.9],
1374 "10927": [0.19667, 0.69667, 0, 0, 0.89444],
1375 "10928": [0.19667, 0.69667, 0, 0, 0.89444],
1376 "57376": [0.19444, 0.69444, 0, 0, 0]
1377 },
1378 "Main-BoldItalic": {
1379 "32": [0, 0, 0, 0, 0.25],
1380 "33": [0, 0.69444, 0.11417, 0, 0.38611],
1381 "34": [0, 0.69444, 0.07939, 0, 0.62055],
1382 "35": [0.19444, 0.69444, 0.06833, 0, 0.94444],
1383 "37": [0.05556, 0.75, 0.12861, 0, 0.94444],
1384 "38": [0, 0.69444, 0.08528, 0, 0.88555],
1385 "39": [0, 0.69444, 0.12945, 0, 0.35555],
1386 "40": [0.25, 0.75, 0.15806, 0, 0.47333],
1387 "41": [0.25, 0.75, 0.03306, 0, 0.47333],
1388 "42": [0, 0.75, 0.14333, 0, 0.59111],
1389 "43": [0.10333, 0.60333, 0.03306, 0, 0.88555],
1390 "44": [0.19444, 0.14722, 0, 0, 0.35555],
1391 "45": [0, 0.44444, 0.02611, 0, 0.41444],
1392 "46": [0, 0.14722, 0, 0, 0.35555],
1393 "47": [0.25, 0.75, 0.15806, 0, 0.59111],
1394 "48": [0, 0.64444, 0.13167, 0, 0.59111],
1395 "49": [0, 0.64444, 0.13167, 0, 0.59111],
1396 "50": [0, 0.64444, 0.13167, 0, 0.59111],
1397 "51": [0, 0.64444, 0.13167, 0, 0.59111],
1398 "52": [0.19444, 0.64444, 0.13167, 0, 0.59111],
1399 "53": [0, 0.64444, 0.13167, 0, 0.59111],
1400 "54": [0, 0.64444, 0.13167, 0, 0.59111],
1401 "55": [0.19444, 0.64444, 0.13167, 0, 0.59111],
1402 "56": [0, 0.64444, 0.13167, 0, 0.59111],
1403 "57": [0, 0.64444, 0.13167, 0, 0.59111],
1404 "58": [0, 0.44444, 0.06695, 0, 0.35555],
1405 "59": [0.19444, 0.44444, 0.06695, 0, 0.35555],
1406 "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555],
1407 "63": [0, 0.69444, 0.11472, 0, 0.59111],
1408 "64": [0, 0.69444, 0.09208, 0, 0.88555],
1409 "65": [0, 0.68611, 0, 0, 0.86555],
1410 "66": [0, 0.68611, 0.0992, 0, 0.81666],
1411 "67": [0, 0.68611, 0.14208, 0, 0.82666],
1412 "68": [0, 0.68611, 0.09062, 0, 0.87555],
1413 "69": [0, 0.68611, 0.11431, 0, 0.75666],
1414 "70": [0, 0.68611, 0.12903, 0, 0.72722],
1415 "71": [0, 0.68611, 0.07347, 0, 0.89527],
1416 "72": [0, 0.68611, 0.17208, 0, 0.8961],
1417 "73": [0, 0.68611, 0.15681, 0, 0.47166],
1418 "74": [0, 0.68611, 0.145, 0, 0.61055],
1419 "75": [0, 0.68611, 0.14208, 0, 0.89499],
1420 "76": [0, 0.68611, 0, 0, 0.69777],
1421 "77": [0, 0.68611, 0.17208, 0, 1.07277],
1422 "78": [0, 0.68611, 0.17208, 0, 0.8961],
1423 "79": [0, 0.68611, 0.09062, 0, 0.85499],
1424 "80": [0, 0.68611, 0.0992, 0, 0.78721],
1425 "81": [0.19444, 0.68611, 0.09062, 0, 0.85499],
1426 "82": [0, 0.68611, 0.02559, 0, 0.85944],
1427 "83": [0, 0.68611, 0.11264, 0, 0.64999],
1428 "84": [0, 0.68611, 0.12903, 0, 0.7961],
1429 "85": [0, 0.68611, 0.17208, 0, 0.88083],
1430 "86": [0, 0.68611, 0.18625, 0, 0.86555],
1431 "87": [0, 0.68611, 0.18625, 0, 1.15999],
1432 "88": [0, 0.68611, 0.15681, 0, 0.86555],
1433 "89": [0, 0.68611, 0.19803, 0, 0.86555],
1434 "90": [0, 0.68611, 0.14208, 0, 0.70888],
1435 "91": [0.25, 0.75, 0.1875, 0, 0.35611],
1436 "93": [0.25, 0.75, 0.09972, 0, 0.35611],
1437 "94": [0, 0.69444, 0.06709, 0, 0.59111],
1438 "95": [0.31, 0.13444, 0.09811, 0, 0.59111],
1439 "97": [0, 0.44444, 0.09426, 0, 0.59111],
1440 "98": [0, 0.69444, 0.07861, 0, 0.53222],
1441 "99": [0, 0.44444, 0.05222, 0, 0.53222],
1442 "100": [0, 0.69444, 0.10861, 0, 0.59111],
1443 "101": [0, 0.44444, 0.085, 0, 0.53222],
1444 "102": [0.19444, 0.69444, 0.21778, 0, 0.4],
1445 "103": [0.19444, 0.44444, 0.105, 0, 0.53222],
1446 "104": [0, 0.69444, 0.09426, 0, 0.59111],
1447 "105": [0, 0.69326, 0.11387, 0, 0.35555],
1448 "106": [0.19444, 0.69326, 0.1672, 0, 0.35555],
1449 "107": [0, 0.69444, 0.11111, 0, 0.53222],
1450 "108": [0, 0.69444, 0.10861, 0, 0.29666],
1451 "109": [0, 0.44444, 0.09426, 0, 0.94444],
1452 "110": [0, 0.44444, 0.09426, 0, 0.64999],
1453 "111": [0, 0.44444, 0.07861, 0, 0.59111],
1454 "112": [0.19444, 0.44444, 0.07861, 0, 0.59111],
1455 "113": [0.19444, 0.44444, 0.105, 0, 0.53222],
1456 "114": [0, 0.44444, 0.11111, 0, 0.50167],
1457 "115": [0, 0.44444, 0.08167, 0, 0.48694],
1458 "116": [0, 0.63492, 0.09639, 0, 0.385],
1459 "117": [0, 0.44444, 0.09426, 0, 0.62055],
1460 "118": [0, 0.44444, 0.11111, 0, 0.53222],
1461 "119": [0, 0.44444, 0.11111, 0, 0.76777],
1462 "120": [0, 0.44444, 0.12583, 0, 0.56055],
1463 "121": [0.19444, 0.44444, 0.105, 0, 0.56166],
1464 "122": [0, 0.44444, 0.13889, 0, 0.49055],
1465 "126": [0.35, 0.34444, 0.11472, 0, 0.59111],
1466 "160": [0, 0, 0, 0, 0.25],
1467 "168": [0, 0.69444, 0.11473, 0, 0.59111],
1468 "176": [0, 0.69444, 0, 0, 0.94888],
1469 "184": [0.17014, 0, 0, 0, 0.53222],
1470 "198": [0, 0.68611, 0.11431, 0, 1.02277],
1471 "216": [0.04861, 0.73472, 0.09062, 0, 0.88555],
1472 "223": [0.19444, 0.69444, 0.09736, 0, 0.665],
1473 "230": [0, 0.44444, 0.085, 0, 0.82666],
1474 "248": [0.09722, 0.54167, 0.09458, 0, 0.59111],
1475 "305": [0, 0.44444, 0.09426, 0, 0.35555],
1476 "338": [0, 0.68611, 0.11431, 0, 1.14054],
1477 "339": [0, 0.44444, 0.085, 0, 0.82666],
1478 "567": [0.19444, 0.44444, 0.04611, 0, 0.385],
1479 "710": [0, 0.69444, 0.06709, 0, 0.59111],
1480 "711": [0, 0.63194, 0.08271, 0, 0.59111],
1481 "713": [0, 0.59444, 0.10444, 0, 0.59111],
1482 "714": [0, 0.69444, 0.08528, 0, 0.59111],
1483 "715": [0, 0.69444, 0, 0, 0.59111],
1484 "728": [0, 0.69444, 0.10333, 0, 0.59111],
1485 "729": [0, 0.69444, 0.12945, 0, 0.35555],
1486 "730": [0, 0.69444, 0, 0, 0.94888],
1487 "732": [0, 0.69444, 0.11472, 0, 0.59111],
1488 "733": [0, 0.69444, 0.11472, 0, 0.59111],
1489 "915": [0, 0.68611, 0.12903, 0, 0.69777],
1490 "916": [0, 0.68611, 0, 0, 0.94444],
1491 "920": [0, 0.68611, 0.09062, 0, 0.88555],
1492 "923": [0, 0.68611, 0, 0, 0.80666],
1493 "926": [0, 0.68611, 0.15092, 0, 0.76777],
1494 "928": [0, 0.68611, 0.17208, 0, 0.8961],
1495 "931": [0, 0.68611, 0.11431, 0, 0.82666],
1496 "933": [0, 0.68611, 0.10778, 0, 0.88555],
1497 "934": [0, 0.68611, 0.05632, 0, 0.82666],
1498 "936": [0, 0.68611, 0.10778, 0, 0.88555],
1499 "937": [0, 0.68611, 0.0992, 0, 0.82666],
1500 "8211": [0, 0.44444, 0.09811, 0, 0.59111],
1501 "8212": [0, 0.44444, 0.09811, 0, 1.18221],
1502 "8216": [0, 0.69444, 0.12945, 0, 0.35555],
1503 "8217": [0, 0.69444, 0.12945, 0, 0.35555],
1504 "8220": [0, 0.69444, 0.16772, 0, 0.62055],
1505 "8221": [0, 0.69444, 0.07939, 0, 0.62055]
1506 },
1507 "Main-Italic": {
1508 "32": [0, 0, 0, 0, 0.25],
1509 "33": [0, 0.69444, 0.12417, 0, 0.30667],
1510 "34": [0, 0.69444, 0.06961, 0, 0.51444],
1511 "35": [0.19444, 0.69444, 0.06616, 0, 0.81777],
1512 "37": [0.05556, 0.75, 0.13639, 0, 0.81777],
1513 "38": [0, 0.69444, 0.09694, 0, 0.76666],
1514 "39": [0, 0.69444, 0.12417, 0, 0.30667],
1515 "40": [0.25, 0.75, 0.16194, 0, 0.40889],
1516 "41": [0.25, 0.75, 0.03694, 0, 0.40889],
1517 "42": [0, 0.75, 0.14917, 0, 0.51111],
1518 "43": [0.05667, 0.56167, 0.03694, 0, 0.76666],
1519 "44": [0.19444, 0.10556, 0, 0, 0.30667],
1520 "45": [0, 0.43056, 0.02826, 0, 0.35778],
1521 "46": [0, 0.10556, 0, 0, 0.30667],
1522 "47": [0.25, 0.75, 0.16194, 0, 0.51111],
1523 "48": [0, 0.64444, 0.13556, 0, 0.51111],
1524 "49": [0, 0.64444, 0.13556, 0, 0.51111],
1525 "50": [0, 0.64444, 0.13556, 0, 0.51111],
1526 "51": [0, 0.64444, 0.13556, 0, 0.51111],
1527 "52": [0.19444, 0.64444, 0.13556, 0, 0.51111],
1528 "53": [0, 0.64444, 0.13556, 0, 0.51111],
1529 "54": [0, 0.64444, 0.13556, 0, 0.51111],
1530 "55": [0.19444, 0.64444, 0.13556, 0, 0.51111],
1531 "56": [0, 0.64444, 0.13556, 0, 0.51111],
1532 "57": [0, 0.64444, 0.13556, 0, 0.51111],
1533 "58": [0, 0.43056, 0.0582, 0, 0.30667],
1534 "59": [0.19444, 0.43056, 0.0582, 0, 0.30667],
1535 "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666],
1536 "63": [0, 0.69444, 0.1225, 0, 0.51111],
1537 "64": [0, 0.69444, 0.09597, 0, 0.76666],
1538 "65": [0, 0.68333, 0, 0, 0.74333],
1539 "66": [0, 0.68333, 0.10257, 0, 0.70389],
1540 "67": [0, 0.68333, 0.14528, 0, 0.71555],
1541 "68": [0, 0.68333, 0.09403, 0, 0.755],
1542 "69": [0, 0.68333, 0.12028, 0, 0.67833],
1543 "70": [0, 0.68333, 0.13305, 0, 0.65277],
1544 "71": [0, 0.68333, 0.08722, 0, 0.77361],
1545 "72": [0, 0.68333, 0.16389, 0, 0.74333],
1546 "73": [0, 0.68333, 0.15806, 0, 0.38555],
1547 "74": [0, 0.68333, 0.14028, 0, 0.525],
1548 "75": [0, 0.68333, 0.14528, 0, 0.76888],
1549 "76": [0, 0.68333, 0, 0, 0.62722],
1550 "77": [0, 0.68333, 0.16389, 0, 0.89666],
1551 "78": [0, 0.68333, 0.16389, 0, 0.74333],
1552 "79": [0, 0.68333, 0.09403, 0, 0.76666],
1553 "80": [0, 0.68333, 0.10257, 0, 0.67833],
1554 "81": [0.19444, 0.68333, 0.09403, 0, 0.76666],
1555 "82": [0, 0.68333, 0.03868, 0, 0.72944],
1556 "83": [0, 0.68333, 0.11972, 0, 0.56222],
1557 "84": [0, 0.68333, 0.13305, 0, 0.71555],
1558 "85": [0, 0.68333, 0.16389, 0, 0.74333],
1559 "86": [0, 0.68333, 0.18361, 0, 0.74333],
1560 "87": [0, 0.68333, 0.18361, 0, 0.99888],
1561 "88": [0, 0.68333, 0.15806, 0, 0.74333],
1562 "89": [0, 0.68333, 0.19383, 0, 0.74333],
1563 "90": [0, 0.68333, 0.14528, 0, 0.61333],
1564 "91": [0.25, 0.75, 0.1875, 0, 0.30667],
1565 "93": [0.25, 0.75, 0.10528, 0, 0.30667],
1566 "94": [0, 0.69444, 0.06646, 0, 0.51111],
1567 "95": [0.31, 0.12056, 0.09208, 0, 0.51111],
1568 "97": [0, 0.43056, 0.07671, 0, 0.51111],
1569 "98": [0, 0.69444, 0.06312, 0, 0.46],
1570 "99": [0, 0.43056, 0.05653, 0, 0.46],
1571 "100": [0, 0.69444, 0.10333, 0, 0.51111],
1572 "101": [0, 0.43056, 0.07514, 0, 0.46],
1573 "102": [0.19444, 0.69444, 0.21194, 0, 0.30667],
1574 "103": [0.19444, 0.43056, 0.08847, 0, 0.46],
1575 "104": [0, 0.69444, 0.07671, 0, 0.51111],
1576 "105": [0, 0.65536, 0.1019, 0, 0.30667],
1577 "106": [0.19444, 0.65536, 0.14467, 0, 0.30667],
1578 "107": [0, 0.69444, 0.10764, 0, 0.46],
1579 "108": [0, 0.69444, 0.10333, 0, 0.25555],
1580 "109": [0, 0.43056, 0.07671, 0, 0.81777],
1581 "110": [0, 0.43056, 0.07671, 0, 0.56222],
1582 "111": [0, 0.43056, 0.06312, 0, 0.51111],
1583 "112": [0.19444, 0.43056, 0.06312, 0, 0.51111],
1584 "113": [0.19444, 0.43056, 0.08847, 0, 0.46],
1585 "114": [0, 0.43056, 0.10764, 0, 0.42166],
1586 "115": [0, 0.43056, 0.08208, 0, 0.40889],
1587 "116": [0, 0.61508, 0.09486, 0, 0.33222],
1588 "117": [0, 0.43056, 0.07671, 0, 0.53666],
1589 "118": [0, 0.43056, 0.10764, 0, 0.46],
1590 "119": [0, 0.43056, 0.10764, 0, 0.66444],
1591 "120": [0, 0.43056, 0.12042, 0, 0.46389],
1592 "121": [0.19444, 0.43056, 0.08847, 0, 0.48555],
1593 "122": [0, 0.43056, 0.12292, 0, 0.40889],
1594 "126": [0.35, 0.31786, 0.11585, 0, 0.51111],
1595 "160": [0, 0, 0, 0, 0.25],
1596 "168": [0, 0.66786, 0.10474, 0, 0.51111],
1597 "176": [0, 0.69444, 0, 0, 0.83129],
1598 "184": [0.17014, 0, 0, 0, 0.46],
1599 "198": [0, 0.68333, 0.12028, 0, 0.88277],
1600 "216": [0.04861, 0.73194, 0.09403, 0, 0.76666],
1601 "223": [0.19444, 0.69444, 0.10514, 0, 0.53666],
1602 "230": [0, 0.43056, 0.07514, 0, 0.71555],
1603 "248": [0.09722, 0.52778, 0.09194, 0, 0.51111],
1604 "338": [0, 0.68333, 0.12028, 0, 0.98499],
1605 "339": [0, 0.43056, 0.07514, 0, 0.71555],
1606 "710": [0, 0.69444, 0.06646, 0, 0.51111],
1607 "711": [0, 0.62847, 0.08295, 0, 0.51111],
1608 "713": [0, 0.56167, 0.10333, 0, 0.51111],
1609 "714": [0, 0.69444, 0.09694, 0, 0.51111],
1610 "715": [0, 0.69444, 0, 0, 0.51111],
1611 "728": [0, 0.69444, 0.10806, 0, 0.51111],
1612 "729": [0, 0.66786, 0.11752, 0, 0.30667],
1613 "730": [0, 0.69444, 0, 0, 0.83129],
1614 "732": [0, 0.66786, 0.11585, 0, 0.51111],
1615 "733": [0, 0.69444, 0.1225, 0, 0.51111],
1616 "915": [0, 0.68333, 0.13305, 0, 0.62722],
1617 "916": [0, 0.68333, 0, 0, 0.81777],
1618 "920": [0, 0.68333, 0.09403, 0, 0.76666],
1619 "923": [0, 0.68333, 0, 0, 0.69222],
1620 "926": [0, 0.68333, 0.15294, 0, 0.66444],
1621 "928": [0, 0.68333, 0.16389, 0, 0.74333],
1622 "931": [0, 0.68333, 0.12028, 0, 0.71555],
1623 "933": [0, 0.68333, 0.11111, 0, 0.76666],
1624 "934": [0, 0.68333, 0.05986, 0, 0.71555],
1625 "936": [0, 0.68333, 0.11111, 0, 0.76666],
1626 "937": [0, 0.68333, 0.10257, 0, 0.71555],
1627 "8211": [0, 0.43056, 0.09208, 0, 0.51111],
1628 "8212": [0, 0.43056, 0.09208, 0, 1.02222],
1629 "8216": [0, 0.69444, 0.12417, 0, 0.30667],
1630 "8217": [0, 0.69444, 0.12417, 0, 0.30667],
1631 "8220": [0, 0.69444, 0.1685, 0, 0.51444],
1632 "8221": [0, 0.69444, 0.06961, 0, 0.51444],
1633 "8463": [0, 0.68889, 0, 0, 0.54028]
1634 },
1635 "Main-Regular": {
1636 "32": [0, 0, 0, 0, 0.25],
1637 "33": [0, 0.69444, 0, 0, 0.27778],
1638 "34": [0, 0.69444, 0, 0, 0.5],
1639 "35": [0.19444, 0.69444, 0, 0, 0.83334],
1640 "36": [0.05556, 0.75, 0, 0, 0.5],
1641 "37": [0.05556, 0.75, 0, 0, 0.83334],
1642 "38": [0, 0.69444, 0, 0, 0.77778],
1643 "39": [0, 0.69444, 0, 0, 0.27778],
1644 "40": [0.25, 0.75, 0, 0, 0.38889],
1645 "41": [0.25, 0.75, 0, 0, 0.38889],
1646 "42": [0, 0.75, 0, 0, 0.5],
1647 "43": [0.08333, 0.58333, 0, 0, 0.77778],
1648 "44": [0.19444, 0.10556, 0, 0, 0.27778],
1649 "45": [0, 0.43056, 0, 0, 0.33333],
1650 "46": [0, 0.10556, 0, 0, 0.27778],
1651 "47": [0.25, 0.75, 0, 0, 0.5],
1652 "48": [0, 0.64444, 0, 0, 0.5],
1653 "49": [0, 0.64444, 0, 0, 0.5],
1654 "50": [0, 0.64444, 0, 0, 0.5],
1655 "51": [0, 0.64444, 0, 0, 0.5],
1656 "52": [0, 0.64444, 0, 0, 0.5],
1657 "53": [0, 0.64444, 0, 0, 0.5],
1658 "54": [0, 0.64444, 0, 0, 0.5],
1659 "55": [0, 0.64444, 0, 0, 0.5],
1660 "56": [0, 0.64444, 0, 0, 0.5],
1661 "57": [0, 0.64444, 0, 0, 0.5],
1662 "58": [0, 0.43056, 0, 0, 0.27778],
1663 "59": [0.19444, 0.43056, 0, 0, 0.27778],
1664 "60": [0.0391, 0.5391, 0, 0, 0.77778],
1665 "61": [-0.13313, 0.36687, 0, 0, 0.77778],
1666 "62": [0.0391, 0.5391, 0, 0, 0.77778],
1667 "63": [0, 0.69444, 0, 0, 0.47222],
1668 "64": [0, 0.69444, 0, 0, 0.77778],
1669 "65": [0, 0.68333, 0, 0, 0.75],
1670 "66": [0, 0.68333, 0, 0, 0.70834],
1671 "67": [0, 0.68333, 0, 0, 0.72222],
1672 "68": [0, 0.68333, 0, 0, 0.76389],
1673 "69": [0, 0.68333, 0, 0, 0.68056],
1674 "70": [0, 0.68333, 0, 0, 0.65278],
1675 "71": [0, 0.68333, 0, 0, 0.78472],
1676 "72": [0, 0.68333, 0, 0, 0.75],
1677 "73": [0, 0.68333, 0, 0, 0.36111],
1678 "74": [0, 0.68333, 0, 0, 0.51389],
1679 "75": [0, 0.68333, 0, 0, 0.77778],
1680 "76": [0, 0.68333, 0, 0, 0.625],
1681 "77": [0, 0.68333, 0, 0, 0.91667],
1682 "78": [0, 0.68333, 0, 0, 0.75],
1683 "79": [0, 0.68333, 0, 0, 0.77778],
1684 "80": [0, 0.68333, 0, 0, 0.68056],
1685 "81": [0.19444, 0.68333, 0, 0, 0.77778],
1686 "82": [0, 0.68333, 0, 0, 0.73611],
1687 "83": [0, 0.68333, 0, 0, 0.55556],
1688 "84": [0, 0.68333, 0, 0, 0.72222],
1689 "85": [0, 0.68333, 0, 0, 0.75],
1690 "86": [0, 0.68333, 0.01389, 0, 0.75],
1691 "87": [0, 0.68333, 0.01389, 0, 1.02778],
1692 "88": [0, 0.68333, 0, 0, 0.75],
1693 "89": [0, 0.68333, 0.025, 0, 0.75],
1694 "90": [0, 0.68333, 0, 0, 0.61111],
1695 "91": [0.25, 0.75, 0, 0, 0.27778],
1696 "92": [0.25, 0.75, 0, 0, 0.5],
1697 "93": [0.25, 0.75, 0, 0, 0.27778],
1698 "94": [0, 0.69444, 0, 0, 0.5],
1699 "95": [0.31, 0.12056, 0.02778, 0, 0.5],
1700 "97": [0, 0.43056, 0, 0, 0.5],
1701 "98": [0, 0.69444, 0, 0, 0.55556],
1702 "99": [0, 0.43056, 0, 0, 0.44445],
1703 "100": [0, 0.69444, 0, 0, 0.55556],
1704 "101": [0, 0.43056, 0, 0, 0.44445],
1705 "102": [0, 0.69444, 0.07778, 0, 0.30556],
1706 "103": [0.19444, 0.43056, 0.01389, 0, 0.5],
1707 "104": [0, 0.69444, 0, 0, 0.55556],
1708 "105": [0, 0.66786, 0, 0, 0.27778],
1709 "106": [0.19444, 0.66786, 0, 0, 0.30556],
1710 "107": [0, 0.69444, 0, 0, 0.52778],
1711 "108": [0, 0.69444, 0, 0, 0.27778],
1712 "109": [0, 0.43056, 0, 0, 0.83334],
1713 "110": [0, 0.43056, 0, 0, 0.55556],
1714 "111": [0, 0.43056, 0, 0, 0.5],
1715 "112": [0.19444, 0.43056, 0, 0, 0.55556],
1716 "113": [0.19444, 0.43056, 0, 0, 0.52778],
1717 "114": [0, 0.43056, 0, 0, 0.39167],
1718 "115": [0, 0.43056, 0, 0, 0.39445],
1719 "116": [0, 0.61508, 0, 0, 0.38889],
1720 "117": [0, 0.43056, 0, 0, 0.55556],
1721 "118": [0, 0.43056, 0.01389, 0, 0.52778],
1722 "119": [0, 0.43056, 0.01389, 0, 0.72222],
1723 "120": [0, 0.43056, 0, 0, 0.52778],
1724 "121": [0.19444, 0.43056, 0.01389, 0, 0.52778],
1725 "122": [0, 0.43056, 0, 0, 0.44445],
1726 "123": [0.25, 0.75, 0, 0, 0.5],
1727 "124": [0.25, 0.75, 0, 0, 0.27778],
1728 "125": [0.25, 0.75, 0, 0, 0.5],
1729 "126": [0.35, 0.31786, 0, 0, 0.5],
1730 "160": [0, 0, 0, 0, 0.25],
1731 "163": [0, 0.69444, 0, 0, 0.76909],
1732 "167": [0.19444, 0.69444, 0, 0, 0.44445],
1733 "168": [0, 0.66786, 0, 0, 0.5],
1734 "172": [0, 0.43056, 0, 0, 0.66667],
1735 "176": [0, 0.69444, 0, 0, 0.75],
1736 "177": [0.08333, 0.58333, 0, 0, 0.77778],
1737 "182": [0.19444, 0.69444, 0, 0, 0.61111],
1738 "184": [0.17014, 0, 0, 0, 0.44445],
1739 "198": [0, 0.68333, 0, 0, 0.90278],
1740 "215": [0.08333, 0.58333, 0, 0, 0.77778],
1741 "216": [0.04861, 0.73194, 0, 0, 0.77778],
1742 "223": [0, 0.69444, 0, 0, 0.5],
1743 "230": [0, 0.43056, 0, 0, 0.72222],
1744 "247": [0.08333, 0.58333, 0, 0, 0.77778],
1745 "248": [0.09722, 0.52778, 0, 0, 0.5],
1746 "305": [0, 0.43056, 0, 0, 0.27778],
1747 "338": [0, 0.68333, 0, 0, 1.01389],
1748 "339": [0, 0.43056, 0, 0, 0.77778],
1749 "567": [0.19444, 0.43056, 0, 0, 0.30556],
1750 "710": [0, 0.69444, 0, 0, 0.5],
1751 "711": [0, 0.62847, 0, 0, 0.5],
1752 "713": [0, 0.56778, 0, 0, 0.5],
1753 "714": [0, 0.69444, 0, 0, 0.5],
1754 "715": [0, 0.69444, 0, 0, 0.5],
1755 "728": [0, 0.69444, 0, 0, 0.5],
1756 "729": [0, 0.66786, 0, 0, 0.27778],
1757 "730": [0, 0.69444, 0, 0, 0.75],
1758 "732": [0, 0.66786, 0, 0, 0.5],
1759 "733": [0, 0.69444, 0, 0, 0.5],
1760 "915": [0, 0.68333, 0, 0, 0.625],
1761 "916": [0, 0.68333, 0, 0, 0.83334],
1762 "920": [0, 0.68333, 0, 0, 0.77778],
1763 "923": [0, 0.68333, 0, 0, 0.69445],
1764 "926": [0, 0.68333, 0, 0, 0.66667],
1765 "928": [0, 0.68333, 0, 0, 0.75],
1766 "931": [0, 0.68333, 0, 0, 0.72222],
1767 "933": [0, 0.68333, 0, 0, 0.77778],
1768 "934": [0, 0.68333, 0, 0, 0.72222],
1769 "936": [0, 0.68333, 0, 0, 0.77778],
1770 "937": [0, 0.68333, 0, 0, 0.72222],
1771 "8211": [0, 0.43056, 0.02778, 0, 0.5],
1772 "8212": [0, 0.43056, 0.02778, 0, 1],
1773 "8216": [0, 0.69444, 0, 0, 0.27778],
1774 "8217": [0, 0.69444, 0, 0, 0.27778],
1775 "8220": [0, 0.69444, 0, 0, 0.5],
1776 "8221": [0, 0.69444, 0, 0, 0.5],
1777 "8224": [0.19444, 0.69444, 0, 0, 0.44445],
1778 "8225": [0.19444, 0.69444, 0, 0, 0.44445],
1779 "8230": [0, 0.123, 0, 0, 1.172],
1780 "8242": [0, 0.55556, 0, 0, 0.275],
1781 "8407": [0, 0.71444, 0.15382, 0, 0.5],
1782 "8463": [0, 0.68889, 0, 0, 0.54028],
1783 "8465": [0, 0.69444, 0, 0, 0.72222],
1784 "8467": [0, 0.69444, 0, 0.11111, 0.41667],
1785 "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646],
1786 "8476": [0, 0.69444, 0, 0, 0.72222],
1787 "8501": [0, 0.69444, 0, 0, 0.61111],
1788 "8592": [-0.13313, 0.36687, 0, 0, 1],
1789 "8593": [0.19444, 0.69444, 0, 0, 0.5],
1790 "8594": [-0.13313, 0.36687, 0, 0, 1],
1791 "8595": [0.19444, 0.69444, 0, 0, 0.5],
1792 "8596": [-0.13313, 0.36687, 0, 0, 1],
1793 "8597": [0.25, 0.75, 0, 0, 0.5],
1794 "8598": [0.19444, 0.69444, 0, 0, 1],
1795 "8599": [0.19444, 0.69444, 0, 0, 1],
1796 "8600": [0.19444, 0.69444, 0, 0, 1],
1797 "8601": [0.19444, 0.69444, 0, 0, 1],
1798 "8614": [0.011, 0.511, 0, 0, 1],
1799 "8617": [0.011, 0.511, 0, 0, 1.126],
1800 "8618": [0.011, 0.511, 0, 0, 1.126],
1801 "8636": [-0.13313, 0.36687, 0, 0, 1],
1802 "8637": [-0.13313, 0.36687, 0, 0, 1],
1803 "8640": [-0.13313, 0.36687, 0, 0, 1],
1804 "8641": [-0.13313, 0.36687, 0, 0, 1],
1805 "8652": [0.011, 0.671, 0, 0, 1],
1806 "8656": [-0.13313, 0.36687, 0, 0, 1],
1807 "8657": [0.19444, 0.69444, 0, 0, 0.61111],
1808 "8658": [-0.13313, 0.36687, 0, 0, 1],
1809 "8659": [0.19444, 0.69444, 0, 0, 0.61111],
1810 "8660": [-0.13313, 0.36687, 0, 0, 1],
1811 "8661": [0.25, 0.75, 0, 0, 0.61111],
1812 "8704": [0, 0.69444, 0, 0, 0.55556],
1813 "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309],
1814 "8707": [0, 0.69444, 0, 0, 0.55556],
1815 "8709": [0.05556, 0.75, 0, 0, 0.5],
1816 "8711": [0, 0.68333, 0, 0, 0.83334],
1817 "8712": [0.0391, 0.5391, 0, 0, 0.66667],
1818 "8715": [0.0391, 0.5391, 0, 0, 0.66667],
1819 "8722": [0.08333, 0.58333, 0, 0, 0.77778],
1820 "8723": [0.08333, 0.58333, 0, 0, 0.77778],
1821 "8725": [0.25, 0.75, 0, 0, 0.5],
1822 "8726": [0.25, 0.75, 0, 0, 0.5],
1823 "8727": [-0.03472, 0.46528, 0, 0, 0.5],
1824 "8728": [-0.05555, 0.44445, 0, 0, 0.5],
1825 "8729": [-0.05555, 0.44445, 0, 0, 0.5],
1826 "8730": [0.2, 0.8, 0, 0, 0.83334],
1827 "8733": [0, 0.43056, 0, 0, 0.77778],
1828 "8734": [0, 0.43056, 0, 0, 1],
1829 "8736": [0, 0.69224, 0, 0, 0.72222],
1830 "8739": [0.25, 0.75, 0, 0, 0.27778],
1831 "8741": [0.25, 0.75, 0, 0, 0.5],
1832 "8743": [0, 0.55556, 0, 0, 0.66667],
1833 "8744": [0, 0.55556, 0, 0, 0.66667],
1834 "8745": [0, 0.55556, 0, 0, 0.66667],
1835 "8746": [0, 0.55556, 0, 0, 0.66667],
1836 "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667],
1837 "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
1838 "8768": [0.19444, 0.69444, 0, 0, 0.27778],
1839 "8771": [-0.03625, 0.46375, 0, 0, 0.77778],
1840 "8773": [-0.022, 0.589, 0, 0, 0.778],
1841 "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
1842 "8781": [-0.03625, 0.46375, 0, 0, 0.77778],
1843 "8784": [-0.133, 0.673, 0, 0, 0.778],
1844 "8801": [-0.03625, 0.46375, 0, 0, 0.77778],
1845 "8804": [0.13597, 0.63597, 0, 0, 0.77778],
1846 "8805": [0.13597, 0.63597, 0, 0, 0.77778],
1847 "8810": [0.0391, 0.5391, 0, 0, 1],
1848 "8811": [0.0391, 0.5391, 0, 0, 1],
1849 "8826": [0.0391, 0.5391, 0, 0, 0.77778],
1850 "8827": [0.0391, 0.5391, 0, 0, 0.77778],
1851 "8834": [0.0391, 0.5391, 0, 0, 0.77778],
1852 "8835": [0.0391, 0.5391, 0, 0, 0.77778],
1853 "8838": [0.13597, 0.63597, 0, 0, 0.77778],
1854 "8839": [0.13597, 0.63597, 0, 0, 0.77778],
1855 "8846": [0, 0.55556, 0, 0, 0.66667],
1856 "8849": [0.13597, 0.63597, 0, 0, 0.77778],
1857 "8850": [0.13597, 0.63597, 0, 0, 0.77778],
1858 "8851": [0, 0.55556, 0, 0, 0.66667],
1859 "8852": [0, 0.55556, 0, 0, 0.66667],
1860 "8853": [0.08333, 0.58333, 0, 0, 0.77778],
1861 "8854": [0.08333, 0.58333, 0, 0, 0.77778],
1862 "8855": [0.08333, 0.58333, 0, 0, 0.77778],
1863 "8856": [0.08333, 0.58333, 0, 0, 0.77778],
1864 "8857": [0.08333, 0.58333, 0, 0, 0.77778],
1865 "8866": [0, 0.69444, 0, 0, 0.61111],
1866 "8867": [0, 0.69444, 0, 0, 0.61111],
1867 "8868": [0, 0.69444, 0, 0, 0.77778],
1868 "8869": [0, 0.69444, 0, 0, 0.77778],
1869 "8872": [0.249, 0.75, 0, 0, 0.867],
1870 "8900": [-0.05555, 0.44445, 0, 0, 0.5],
1871 "8901": [-0.05555, 0.44445, 0, 0, 0.27778],
1872 "8902": [-0.03472, 0.46528, 0, 0, 0.5],
1873 "8904": [5e-3, 0.505, 0, 0, 0.9],
1874 "8942": [0.03, 0.903, 0, 0, 0.278],
1875 "8943": [-0.19, 0.313, 0, 0, 1.172],
1876 "8945": [-0.1, 0.823, 0, 0, 1.282],
1877 "8968": [0.25, 0.75, 0, 0, 0.44445],
1878 "8969": [0.25, 0.75, 0, 0, 0.44445],
1879 "8970": [0.25, 0.75, 0, 0, 0.44445],
1880 "8971": [0.25, 0.75, 0, 0, 0.44445],
1881 "8994": [-0.14236, 0.35764, 0, 0, 1],
1882 "8995": [-0.14236, 0.35764, 0, 0, 1],
1883 "9136": [0.244, 0.744, 0, 0, 0.412],
1884 "9137": [0.244, 0.745, 0, 0, 0.412],
1885 "9651": [0.19444, 0.69444, 0, 0, 0.88889],
1886 "9657": [-0.03472, 0.46528, 0, 0, 0.5],
1887 "9661": [0.19444, 0.69444, 0, 0, 0.88889],
1888 "9667": [-0.03472, 0.46528, 0, 0, 0.5],
1889 "9711": [0.19444, 0.69444, 0, 0, 1],
1890 "9824": [0.12963, 0.69444, 0, 0, 0.77778],
1891 "9825": [0.12963, 0.69444, 0, 0, 0.77778],
1892 "9826": [0.12963, 0.69444, 0, 0, 0.77778],
1893 "9827": [0.12963, 0.69444, 0, 0, 0.77778],
1894 "9837": [0, 0.75, 0, 0, 0.38889],
1895 "9838": [0.19444, 0.69444, 0, 0, 0.38889],
1896 "9839": [0.19444, 0.69444, 0, 0, 0.38889],
1897 "10216": [0.25, 0.75, 0, 0, 0.38889],
1898 "10217": [0.25, 0.75, 0, 0, 0.38889],
1899 "10222": [0.244, 0.744, 0, 0, 0.412],
1900 "10223": [0.244, 0.745, 0, 0, 0.412],
1901 "10229": [0.011, 0.511, 0, 0, 1.609],
1902 "10230": [0.011, 0.511, 0, 0, 1.638],
1903 "10231": [0.011, 0.511, 0, 0, 1.859],
1904 "10232": [0.024, 0.525, 0, 0, 1.609],
1905 "10233": [0.024, 0.525, 0, 0, 1.638],
1906 "10234": [0.024, 0.525, 0, 0, 1.858],
1907 "10236": [0.011, 0.511, 0, 0, 1.638],
1908 "10815": [0, 0.68333, 0, 0, 0.75],
1909 "10927": [0.13597, 0.63597, 0, 0, 0.77778],
1910 "10928": [0.13597, 0.63597, 0, 0, 0.77778],
1911 "57376": [0.19444, 0.69444, 0, 0, 0]
1912 },
1913 "Math-BoldItalic": {
1914 "32": [0, 0, 0, 0, 0.25],
1915 "48": [0, 0.44444, 0, 0, 0.575],
1916 "49": [0, 0.44444, 0, 0, 0.575],
1917 "50": [0, 0.44444, 0, 0, 0.575],
1918 "51": [0.19444, 0.44444, 0, 0, 0.575],
1919 "52": [0.19444, 0.44444, 0, 0, 0.575],
1920 "53": [0.19444, 0.44444, 0, 0, 0.575],
1921 "54": [0, 0.64444, 0, 0, 0.575],
1922 "55": [0.19444, 0.44444, 0, 0, 0.575],
1923 "56": [0, 0.64444, 0, 0, 0.575],
1924 "57": [0.19444, 0.44444, 0, 0, 0.575],
1925 "65": [0, 0.68611, 0, 0, 0.86944],
1926 "66": [0, 0.68611, 0.04835, 0, 0.8664],
1927 "67": [0, 0.68611, 0.06979, 0, 0.81694],
1928 "68": [0, 0.68611, 0.03194, 0, 0.93812],
1929 "69": [0, 0.68611, 0.05451, 0, 0.81007],
1930 "70": [0, 0.68611, 0.15972, 0, 0.68889],
1931 "71": [0, 0.68611, 0, 0, 0.88673],
1932 "72": [0, 0.68611, 0.08229, 0, 0.98229],
1933 "73": [0, 0.68611, 0.07778, 0, 0.51111],
1934 "74": [0, 0.68611, 0.10069, 0, 0.63125],
1935 "75": [0, 0.68611, 0.06979, 0, 0.97118],
1936 "76": [0, 0.68611, 0, 0, 0.75555],
1937 "77": [0, 0.68611, 0.11424, 0, 1.14201],
1938 "78": [0, 0.68611, 0.11424, 0, 0.95034],
1939 "79": [0, 0.68611, 0.03194, 0, 0.83666],
1940 "80": [0, 0.68611, 0.15972, 0, 0.72309],
1941 "81": [0.19444, 0.68611, 0, 0, 0.86861],
1942 "82": [0, 0.68611, 421e-5, 0, 0.87235],
1943 "83": [0, 0.68611, 0.05382, 0, 0.69271],
1944 "84": [0, 0.68611, 0.15972, 0, 0.63663],
1945 "85": [0, 0.68611, 0.11424, 0, 0.80027],
1946 "86": [0, 0.68611, 0.25555, 0, 0.67778],
1947 "87": [0, 0.68611, 0.15972, 0, 1.09305],
1948 "88": [0, 0.68611, 0.07778, 0, 0.94722],
1949 "89": [0, 0.68611, 0.25555, 0, 0.67458],
1950 "90": [0, 0.68611, 0.06979, 0, 0.77257],
1951 "97": [0, 0.44444, 0, 0, 0.63287],
1952 "98": [0, 0.69444, 0, 0, 0.52083],
1953 "99": [0, 0.44444, 0, 0, 0.51342],
1954 "100": [0, 0.69444, 0, 0, 0.60972],
1955 "101": [0, 0.44444, 0, 0, 0.55361],
1956 "102": [0.19444, 0.69444, 0.11042, 0, 0.56806],
1957 "103": [0.19444, 0.44444, 0.03704, 0, 0.5449],
1958 "104": [0, 0.69444, 0, 0, 0.66759],
1959 "105": [0, 0.69326, 0, 0, 0.4048],
1960 "106": [0.19444, 0.69326, 0.0622, 0, 0.47083],
1961 "107": [0, 0.69444, 0.01852, 0, 0.6037],
1962 "108": [0, 0.69444, 88e-4, 0, 0.34815],
1963 "109": [0, 0.44444, 0, 0, 1.0324],
1964 "110": [0, 0.44444, 0, 0, 0.71296],
1965 "111": [0, 0.44444, 0, 0, 0.58472],
1966 "112": [0.19444, 0.44444, 0, 0, 0.60092],
1967 "113": [0.19444, 0.44444, 0.03704, 0, 0.54213],
1968 "114": [0, 0.44444, 0.03194, 0, 0.5287],
1969 "115": [0, 0.44444, 0, 0, 0.53125],
1970 "116": [0, 0.63492, 0, 0, 0.41528],
1971 "117": [0, 0.44444, 0, 0, 0.68102],
1972 "118": [0, 0.44444, 0.03704, 0, 0.56666],
1973 "119": [0, 0.44444, 0.02778, 0, 0.83148],
1974 "120": [0, 0.44444, 0, 0, 0.65903],
1975 "121": [0.19444, 0.44444, 0.03704, 0, 0.59028],
1976 "122": [0, 0.44444, 0.04213, 0, 0.55509],
1977 "160": [0, 0, 0, 0, 0.25],
1978 "915": [0, 0.68611, 0.15972, 0, 0.65694],
1979 "916": [0, 0.68611, 0, 0, 0.95833],
1980 "920": [0, 0.68611, 0.03194, 0, 0.86722],
1981 "923": [0, 0.68611, 0, 0, 0.80555],
1982 "926": [0, 0.68611, 0.07458, 0, 0.84125],
1983 "928": [0, 0.68611, 0.08229, 0, 0.98229],
1984 "931": [0, 0.68611, 0.05451, 0, 0.88507],
1985 "933": [0, 0.68611, 0.15972, 0, 0.67083],
1986 "934": [0, 0.68611, 0, 0, 0.76666],
1987 "936": [0, 0.68611, 0.11653, 0, 0.71402],
1988 "937": [0, 0.68611, 0.04835, 0, 0.8789],
1989 "945": [0, 0.44444, 0, 0, 0.76064],
1990 "946": [0.19444, 0.69444, 0.03403, 0, 0.65972],
1991 "947": [0.19444, 0.44444, 0.06389, 0, 0.59003],
1992 "948": [0, 0.69444, 0.03819, 0, 0.52222],
1993 "949": [0, 0.44444, 0, 0, 0.52882],
1994 "950": [0.19444, 0.69444, 0.06215, 0, 0.50833],
1995 "951": [0.19444, 0.44444, 0.03704, 0, 0.6],
1996 "952": [0, 0.69444, 0.03194, 0, 0.5618],
1997 "953": [0, 0.44444, 0, 0, 0.41204],
1998 "954": [0, 0.44444, 0, 0, 0.66759],
1999 "955": [0, 0.69444, 0, 0, 0.67083],
2000 "956": [0.19444, 0.44444, 0, 0, 0.70787],
2001 "957": [0, 0.44444, 0.06898, 0, 0.57685],
2002 "958": [0.19444, 0.69444, 0.03021, 0, 0.50833],
2003 "959": [0, 0.44444, 0, 0, 0.58472],
2004 "960": [0, 0.44444, 0.03704, 0, 0.68241],
2005 "961": [0.19444, 0.44444, 0, 0, 0.6118],
2006 "962": [0.09722, 0.44444, 0.07917, 0, 0.42361],
2007 "963": [0, 0.44444, 0.03704, 0, 0.68588],
2008 "964": [0, 0.44444, 0.13472, 0, 0.52083],
2009 "965": [0, 0.44444, 0.03704, 0, 0.63055],
2010 "966": [0.19444, 0.44444, 0, 0, 0.74722],
2011 "967": [0.19444, 0.44444, 0, 0, 0.71805],
2012 "968": [0.19444, 0.69444, 0.03704, 0, 0.75833],
2013 "969": [0, 0.44444, 0.03704, 0, 0.71782],
2014 "977": [0, 0.69444, 0, 0, 0.69155],
2015 "981": [0.19444, 0.69444, 0, 0, 0.7125],
2016 "982": [0, 0.44444, 0.03194, 0, 0.975],
2017 "1009": [0.19444, 0.44444, 0, 0, 0.6118],
2018 "1013": [0, 0.44444, 0, 0, 0.48333],
2019 "57649": [0, 0.44444, 0, 0, 0.39352],
2020 "57911": [0.19444, 0.44444, 0, 0, 0.43889]
2021 },
2022 "Math-Italic": {
2023 "32": [0, 0, 0, 0, 0.25],
2024 "48": [0, 0.43056, 0, 0, 0.5],
2025 "49": [0, 0.43056, 0, 0, 0.5],
2026 "50": [0, 0.43056, 0, 0, 0.5],
2027 "51": [0.19444, 0.43056, 0, 0, 0.5],
2028 "52": [0.19444, 0.43056, 0, 0, 0.5],
2029 "53": [0.19444, 0.43056, 0, 0, 0.5],
2030 "54": [0, 0.64444, 0, 0, 0.5],
2031 "55": [0.19444, 0.43056, 0, 0, 0.5],
2032 "56": [0, 0.64444, 0, 0, 0.5],
2033 "57": [0.19444, 0.43056, 0, 0, 0.5],
2034 "65": [0, 0.68333, 0, 0.13889, 0.75],
2035 "66": [0, 0.68333, 0.05017, 0.08334, 0.75851],
2036 "67": [0, 0.68333, 0.07153, 0.08334, 0.71472],
2037 "68": [0, 0.68333, 0.02778, 0.05556, 0.82792],
2038 "69": [0, 0.68333, 0.05764, 0.08334, 0.7382],
2039 "70": [0, 0.68333, 0.13889, 0.08334, 0.64306],
2040 "71": [0, 0.68333, 0, 0.08334, 0.78625],
2041 "72": [0, 0.68333, 0.08125, 0.05556, 0.83125],
2042 "73": [0, 0.68333, 0.07847, 0.11111, 0.43958],
2043 "74": [0, 0.68333, 0.09618, 0.16667, 0.55451],
2044 "75": [0, 0.68333, 0.07153, 0.05556, 0.84931],
2045 "76": [0, 0.68333, 0, 0.02778, 0.68056],
2046 "77": [0, 0.68333, 0.10903, 0.08334, 0.97014],
2047 "78": [0, 0.68333, 0.10903, 0.08334, 0.80347],
2048 "79": [0, 0.68333, 0.02778, 0.08334, 0.76278],
2049 "80": [0, 0.68333, 0.13889, 0.08334, 0.64201],
2050 "81": [0.19444, 0.68333, 0, 0.08334, 0.79056],
2051 "82": [0, 0.68333, 773e-5, 0.08334, 0.75929],
2052 "83": [0, 0.68333, 0.05764, 0.08334, 0.6132],
2053 "84": [0, 0.68333, 0.13889, 0.08334, 0.58438],
2054 "85": [0, 0.68333, 0.10903, 0.02778, 0.68278],
2055 "86": [0, 0.68333, 0.22222, 0, 0.58333],
2056 "87": [0, 0.68333, 0.13889, 0, 0.94445],
2057 "88": [0, 0.68333, 0.07847, 0.08334, 0.82847],
2058 "89": [0, 0.68333, 0.22222, 0, 0.58056],
2059 "90": [0, 0.68333, 0.07153, 0.08334, 0.68264],
2060 "97": [0, 0.43056, 0, 0, 0.52859],
2061 "98": [0, 0.69444, 0, 0, 0.42917],
2062 "99": [0, 0.43056, 0, 0.05556, 0.43276],
2063 "100": [0, 0.69444, 0, 0.16667, 0.52049],
2064 "101": [0, 0.43056, 0, 0.05556, 0.46563],
2065 "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],
2066 "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],
2067 "104": [0, 0.69444, 0, 0, 0.57616],
2068 "105": [0, 0.65952, 0, 0, 0.34451],
2069 "106": [0.19444, 0.65952, 0.05724, 0, 0.41181],
2070 "107": [0, 0.69444, 0.03148, 0, 0.5206],
2071 "108": [0, 0.69444, 0.01968, 0.08334, 0.29838],
2072 "109": [0, 0.43056, 0, 0, 0.87801],
2073 "110": [0, 0.43056, 0, 0, 0.60023],
2074 "111": [0, 0.43056, 0, 0.05556, 0.48472],
2075 "112": [0.19444, 0.43056, 0, 0.08334, 0.50313],
2076 "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],
2077 "114": [0, 0.43056, 0.02778, 0.05556, 0.45116],
2078 "115": [0, 0.43056, 0, 0.05556, 0.46875],
2079 "116": [0, 0.61508, 0, 0.08334, 0.36111],
2080 "117": [0, 0.43056, 0, 0.02778, 0.57246],
2081 "118": [0, 0.43056, 0.03588, 0.02778, 0.48472],
2082 "119": [0, 0.43056, 0.02691, 0.08334, 0.71592],
2083 "120": [0, 0.43056, 0, 0.02778, 0.57153],
2084 "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],
2085 "122": [0, 0.43056, 0.04398, 0.05556, 0.46505],
2086 "160": [0, 0, 0, 0, 0.25],
2087 "915": [0, 0.68333, 0.13889, 0.08334, 0.61528],
2088 "916": [0, 0.68333, 0, 0.16667, 0.83334],
2089 "920": [0, 0.68333, 0.02778, 0.08334, 0.76278],
2090 "923": [0, 0.68333, 0, 0.16667, 0.69445],
2091 "926": [0, 0.68333, 0.07569, 0.08334, 0.74236],
2092 "928": [0, 0.68333, 0.08125, 0.05556, 0.83125],
2093 "931": [0, 0.68333, 0.05764, 0.08334, 0.77986],
2094 "933": [0, 0.68333, 0.13889, 0.05556, 0.58333],
2095 "934": [0, 0.68333, 0, 0.08334, 0.66667],
2096 "936": [0, 0.68333, 0.11, 0.05556, 0.61222],
2097 "937": [0, 0.68333, 0.05017, 0.08334, 0.7724],
2098 "945": [0, 0.43056, 37e-4, 0.02778, 0.6397],
2099 "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],
2100 "947": [0.19444, 0.43056, 0.05556, 0, 0.51773],
2101 "948": [0, 0.69444, 0.03785, 0.05556, 0.44444],
2102 "949": [0, 0.43056, 0, 0.08334, 0.46632],
2103 "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],
2104 "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],
2105 "952": [0, 0.69444, 0.02778, 0.08334, 0.46944],
2106 "953": [0, 0.43056, 0, 0.05556, 0.35394],
2107 "954": [0, 0.43056, 0, 0, 0.57616],
2108 "955": [0, 0.69444, 0, 0, 0.58334],
2109 "956": [0.19444, 0.43056, 0, 0.02778, 0.60255],
2110 "957": [0, 0.43056, 0.06366, 0.02778, 0.49398],
2111 "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],
2112 "959": [0, 0.43056, 0, 0.05556, 0.48472],
2113 "960": [0, 0.43056, 0.03588, 0, 0.57003],
2114 "961": [0.19444, 0.43056, 0, 0.08334, 0.51702],
2115 "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],
2116 "963": [0, 0.43056, 0.03588, 0, 0.57141],
2117 "964": [0, 0.43056, 0.1132, 0.02778, 0.43715],
2118 "965": [0, 0.43056, 0.03588, 0.02778, 0.54028],
2119 "966": [0.19444, 0.43056, 0, 0.08334, 0.65417],
2120 "967": [0.19444, 0.43056, 0, 0.05556, 0.62569],
2121 "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],
2122 "969": [0, 0.43056, 0.03588, 0, 0.62245],
2123 "977": [0, 0.69444, 0, 0.08334, 0.59144],
2124 "981": [0.19444, 0.69444, 0, 0.08334, 0.59583],
2125 "982": [0, 0.43056, 0.02778, 0, 0.82813],
2126 "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702],
2127 "1013": [0, 0.43056, 0, 0.05556, 0.4059],
2128 "57649": [0, 0.43056, 0, 0.02778, 0.32246],
2129 "57911": [0.19444, 0.43056, 0, 0.08334, 0.38403]
2130 },
2131 "SansSerif-Bold": {
2132 "32": [0, 0, 0, 0, 0.25],
2133 "33": [0, 0.69444, 0, 0, 0.36667],
2134 "34": [0, 0.69444, 0, 0, 0.55834],
2135 "35": [0.19444, 0.69444, 0, 0, 0.91667],
2136 "36": [0.05556, 0.75, 0, 0, 0.55],
2137 "37": [0.05556, 0.75, 0, 0, 1.02912],
2138 "38": [0, 0.69444, 0, 0, 0.83056],
2139 "39": [0, 0.69444, 0, 0, 0.30556],
2140 "40": [0.25, 0.75, 0, 0, 0.42778],
2141 "41": [0.25, 0.75, 0, 0, 0.42778],
2142 "42": [0, 0.75, 0, 0, 0.55],
2143 "43": [0.11667, 0.61667, 0, 0, 0.85556],
2144 "44": [0.10556, 0.13056, 0, 0, 0.30556],
2145 "45": [0, 0.45833, 0, 0, 0.36667],
2146 "46": [0, 0.13056, 0, 0, 0.30556],
2147 "47": [0.25, 0.75, 0, 0, 0.55],
2148 "48": [0, 0.69444, 0, 0, 0.55],
2149 "49": [0, 0.69444, 0, 0, 0.55],
2150 "50": [0, 0.69444, 0, 0, 0.55],
2151 "51": [0, 0.69444, 0, 0, 0.55],
2152 "52": [0, 0.69444, 0, 0, 0.55],
2153 "53": [0, 0.69444, 0, 0, 0.55],
2154 "54": [0, 0.69444, 0, 0, 0.55],
2155 "55": [0, 0.69444, 0, 0, 0.55],
2156 "56": [0, 0.69444, 0, 0, 0.55],
2157 "57": [0, 0.69444, 0, 0, 0.55],
2158 "58": [0, 0.45833, 0, 0, 0.30556],
2159 "59": [0.10556, 0.45833, 0, 0, 0.30556],
2160 "61": [-0.09375, 0.40625, 0, 0, 0.85556],
2161 "63": [0, 0.69444, 0, 0, 0.51945],
2162 "64": [0, 0.69444, 0, 0, 0.73334],
2163 "65": [0, 0.69444, 0, 0, 0.73334],
2164 "66": [0, 0.69444, 0, 0, 0.73334],
2165 "67": [0, 0.69444, 0, 0, 0.70278],
2166 "68": [0, 0.69444, 0, 0, 0.79445],
2167 "69": [0, 0.69444, 0, 0, 0.64167],
2168 "70": [0, 0.69444, 0, 0, 0.61111],
2169 "71": [0, 0.69444, 0, 0, 0.73334],
2170 "72": [0, 0.69444, 0, 0, 0.79445],
2171 "73": [0, 0.69444, 0, 0, 0.33056],
2172 "74": [0, 0.69444, 0, 0, 0.51945],
2173 "75": [0, 0.69444, 0, 0, 0.76389],
2174 "76": [0, 0.69444, 0, 0, 0.58056],
2175 "77": [0, 0.69444, 0, 0, 0.97778],
2176 "78": [0, 0.69444, 0, 0, 0.79445],
2177 "79": [0, 0.69444, 0, 0, 0.79445],
2178 "80": [0, 0.69444, 0, 0, 0.70278],
2179 "81": [0.10556, 0.69444, 0, 0, 0.79445],
2180 "82": [0, 0.69444, 0, 0, 0.70278],
2181 "83": [0, 0.69444, 0, 0, 0.61111],
2182 "84": [0, 0.69444, 0, 0, 0.73334],
2183 "85": [0, 0.69444, 0, 0, 0.76389],
2184 "86": [0, 0.69444, 0.01528, 0, 0.73334],
2185 "87": [0, 0.69444, 0.01528, 0, 1.03889],
2186 "88": [0, 0.69444, 0, 0, 0.73334],
2187 "89": [0, 0.69444, 0.0275, 0, 0.73334],
2188 "90": [0, 0.69444, 0, 0, 0.67223],
2189 "91": [0.25, 0.75, 0, 0, 0.34306],
2190 "93": [0.25, 0.75, 0, 0, 0.34306],
2191 "94": [0, 0.69444, 0, 0, 0.55],
2192 "95": [0.35, 0.10833, 0.03056, 0, 0.55],
2193 "97": [0, 0.45833, 0, 0, 0.525],
2194 "98": [0, 0.69444, 0, 0, 0.56111],
2195 "99": [0, 0.45833, 0, 0, 0.48889],
2196 "100": [0, 0.69444, 0, 0, 0.56111],
2197 "101": [0, 0.45833, 0, 0, 0.51111],
2198 "102": [0, 0.69444, 0.07639, 0, 0.33611],
2199 "103": [0.19444, 0.45833, 0.01528, 0, 0.55],
2200 "104": [0, 0.69444, 0, 0, 0.56111],
2201 "105": [0, 0.69444, 0, 0, 0.25556],
2202 "106": [0.19444, 0.69444, 0, 0, 0.28611],
2203 "107": [0, 0.69444, 0, 0, 0.53056],
2204 "108": [0, 0.69444, 0, 0, 0.25556],
2205 "109": [0, 0.45833, 0, 0, 0.86667],
2206 "110": [0, 0.45833, 0, 0, 0.56111],
2207 "111": [0, 0.45833, 0, 0, 0.55],
2208 "112": [0.19444, 0.45833, 0, 0, 0.56111],
2209 "113": [0.19444, 0.45833, 0, 0, 0.56111],
2210 "114": [0, 0.45833, 0.01528, 0, 0.37222],
2211 "115": [0, 0.45833, 0, 0, 0.42167],
2212 "116": [0, 0.58929, 0, 0, 0.40417],
2213 "117": [0, 0.45833, 0, 0, 0.56111],
2214 "118": [0, 0.45833, 0.01528, 0, 0.5],
2215 "119": [0, 0.45833, 0.01528, 0, 0.74445],
2216 "120": [0, 0.45833, 0, 0, 0.5],
2217 "121": [0.19444, 0.45833, 0.01528, 0, 0.5],
2218 "122": [0, 0.45833, 0, 0, 0.47639],
2219 "126": [0.35, 0.34444, 0, 0, 0.55],
2220 "160": [0, 0, 0, 0, 0.25],
2221 "168": [0, 0.69444, 0, 0, 0.55],
2222 "176": [0, 0.69444, 0, 0, 0.73334],
2223 "180": [0, 0.69444, 0, 0, 0.55],
2224 "184": [0.17014, 0, 0, 0, 0.48889],
2225 "305": [0, 0.45833, 0, 0, 0.25556],
2226 "567": [0.19444, 0.45833, 0, 0, 0.28611],
2227 "710": [0, 0.69444, 0, 0, 0.55],
2228 "711": [0, 0.63542, 0, 0, 0.55],
2229 "713": [0, 0.63778, 0, 0, 0.55],
2230 "728": [0, 0.69444, 0, 0, 0.55],
2231 "729": [0, 0.69444, 0, 0, 0.30556],
2232 "730": [0, 0.69444, 0, 0, 0.73334],
2233 "732": [0, 0.69444, 0, 0, 0.55],
2234 "733": [0, 0.69444, 0, 0, 0.55],
2235 "915": [0, 0.69444, 0, 0, 0.58056],
2236 "916": [0, 0.69444, 0, 0, 0.91667],
2237 "920": [0, 0.69444, 0, 0, 0.85556],
2238 "923": [0, 0.69444, 0, 0, 0.67223],
2239 "926": [0, 0.69444, 0, 0, 0.73334],
2240 "928": [0, 0.69444, 0, 0, 0.79445],
2241 "931": [0, 0.69444, 0, 0, 0.79445],
2242 "933": [0, 0.69444, 0, 0, 0.85556],
2243 "934": [0, 0.69444, 0, 0, 0.79445],
2244 "936": [0, 0.69444, 0, 0, 0.85556],
2245 "937": [0, 0.69444, 0, 0, 0.79445],
2246 "8211": [0, 0.45833, 0.03056, 0, 0.55],
2247 "8212": [0, 0.45833, 0.03056, 0, 1.10001],
2248 "8216": [0, 0.69444, 0, 0, 0.30556],
2249 "8217": [0, 0.69444, 0, 0, 0.30556],
2250 "8220": [0, 0.69444, 0, 0, 0.55834],
2251 "8221": [0, 0.69444, 0, 0, 0.55834]
2252 },
2253 "SansSerif-Italic": {
2254 "32": [0, 0, 0, 0, 0.25],
2255 "33": [0, 0.69444, 0.05733, 0, 0.31945],
2256 "34": [0, 0.69444, 316e-5, 0, 0.5],
2257 "35": [0.19444, 0.69444, 0.05087, 0, 0.83334],
2258 "36": [0.05556, 0.75, 0.11156, 0, 0.5],
2259 "37": [0.05556, 0.75, 0.03126, 0, 0.83334],
2260 "38": [0, 0.69444, 0.03058, 0, 0.75834],
2261 "39": [0, 0.69444, 0.07816, 0, 0.27778],
2262 "40": [0.25, 0.75, 0.13164, 0, 0.38889],
2263 "41": [0.25, 0.75, 0.02536, 0, 0.38889],
2264 "42": [0, 0.75, 0.11775, 0, 0.5],
2265 "43": [0.08333, 0.58333, 0.02536, 0, 0.77778],
2266 "44": [0.125, 0.08333, 0, 0, 0.27778],
2267 "45": [0, 0.44444, 0.01946, 0, 0.33333],
2268 "46": [0, 0.08333, 0, 0, 0.27778],
2269 "47": [0.25, 0.75, 0.13164, 0, 0.5],
2270 "48": [0, 0.65556, 0.11156, 0, 0.5],
2271 "49": [0, 0.65556, 0.11156, 0, 0.5],
2272 "50": [0, 0.65556, 0.11156, 0, 0.5],
2273 "51": [0, 0.65556, 0.11156, 0, 0.5],
2274 "52": [0, 0.65556, 0.11156, 0, 0.5],
2275 "53": [0, 0.65556, 0.11156, 0, 0.5],
2276 "54": [0, 0.65556, 0.11156, 0, 0.5],
2277 "55": [0, 0.65556, 0.11156, 0, 0.5],
2278 "56": [0, 0.65556, 0.11156, 0, 0.5],
2279 "57": [0, 0.65556, 0.11156, 0, 0.5],
2280 "58": [0, 0.44444, 0.02502, 0, 0.27778],
2281 "59": [0.125, 0.44444, 0.02502, 0, 0.27778],
2282 "61": [-0.13, 0.37, 0.05087, 0, 0.77778],
2283 "63": [0, 0.69444, 0.11809, 0, 0.47222],
2284 "64": [0, 0.69444, 0.07555, 0, 0.66667],
2285 "65": [0, 0.69444, 0, 0, 0.66667],
2286 "66": [0, 0.69444, 0.08293, 0, 0.66667],
2287 "67": [0, 0.69444, 0.11983, 0, 0.63889],
2288 "68": [0, 0.69444, 0.07555, 0, 0.72223],
2289 "69": [0, 0.69444, 0.11983, 0, 0.59722],
2290 "70": [0, 0.69444, 0.13372, 0, 0.56945],
2291 "71": [0, 0.69444, 0.11983, 0, 0.66667],
2292 "72": [0, 0.69444, 0.08094, 0, 0.70834],
2293 "73": [0, 0.69444, 0.13372, 0, 0.27778],
2294 "74": [0, 0.69444, 0.08094, 0, 0.47222],
2295 "75": [0, 0.69444, 0.11983, 0, 0.69445],
2296 "76": [0, 0.69444, 0, 0, 0.54167],
2297 "77": [0, 0.69444, 0.08094, 0, 0.875],
2298 "78": [0, 0.69444, 0.08094, 0, 0.70834],
2299 "79": [0, 0.69444, 0.07555, 0, 0.73611],
2300 "80": [0, 0.69444, 0.08293, 0, 0.63889],
2301 "81": [0.125, 0.69444, 0.07555, 0, 0.73611],
2302 "82": [0, 0.69444, 0.08293, 0, 0.64584],
2303 "83": [0, 0.69444, 0.09205, 0, 0.55556],
2304 "84": [0, 0.69444, 0.13372, 0, 0.68056],
2305 "85": [0, 0.69444, 0.08094, 0, 0.6875],
2306 "86": [0, 0.69444, 0.1615, 0, 0.66667],
2307 "87": [0, 0.69444, 0.1615, 0, 0.94445],
2308 "88": [0, 0.69444, 0.13372, 0, 0.66667],
2309 "89": [0, 0.69444, 0.17261, 0, 0.66667],
2310 "90": [0, 0.69444, 0.11983, 0, 0.61111],
2311 "91": [0.25, 0.75, 0.15942, 0, 0.28889],
2312 "93": [0.25, 0.75, 0.08719, 0, 0.28889],
2313 "94": [0, 0.69444, 0.0799, 0, 0.5],
2314 "95": [0.35, 0.09444, 0.08616, 0, 0.5],
2315 "97": [0, 0.44444, 981e-5, 0, 0.48056],
2316 "98": [0, 0.69444, 0.03057, 0, 0.51667],
2317 "99": [0, 0.44444, 0.08336, 0, 0.44445],
2318 "100": [0, 0.69444, 0.09483, 0, 0.51667],
2319 "101": [0, 0.44444, 0.06778, 0, 0.44445],
2320 "102": [0, 0.69444, 0.21705, 0, 0.30556],
2321 "103": [0.19444, 0.44444, 0.10836, 0, 0.5],
2322 "104": [0, 0.69444, 0.01778, 0, 0.51667],
2323 "105": [0, 0.67937, 0.09718, 0, 0.23889],
2324 "106": [0.19444, 0.67937, 0.09162, 0, 0.26667],
2325 "107": [0, 0.69444, 0.08336, 0, 0.48889],
2326 "108": [0, 0.69444, 0.09483, 0, 0.23889],
2327 "109": [0, 0.44444, 0.01778, 0, 0.79445],
2328 "110": [0, 0.44444, 0.01778, 0, 0.51667],
2329 "111": [0, 0.44444, 0.06613, 0, 0.5],
2330 "112": [0.19444, 0.44444, 0.0389, 0, 0.51667],
2331 "113": [0.19444, 0.44444, 0.04169, 0, 0.51667],
2332 "114": [0, 0.44444, 0.10836, 0, 0.34167],
2333 "115": [0, 0.44444, 0.0778, 0, 0.38333],
2334 "116": [0, 0.57143, 0.07225, 0, 0.36111],
2335 "117": [0, 0.44444, 0.04169, 0, 0.51667],
2336 "118": [0, 0.44444, 0.10836, 0, 0.46111],
2337 "119": [0, 0.44444, 0.10836, 0, 0.68334],
2338 "120": [0, 0.44444, 0.09169, 0, 0.46111],
2339 "121": [0.19444, 0.44444, 0.10836, 0, 0.46111],
2340 "122": [0, 0.44444, 0.08752, 0, 0.43472],
2341 "126": [0.35, 0.32659, 0.08826, 0, 0.5],
2342 "160": [0, 0, 0, 0, 0.25],
2343 "168": [0, 0.67937, 0.06385, 0, 0.5],
2344 "176": [0, 0.69444, 0, 0, 0.73752],
2345 "184": [0.17014, 0, 0, 0, 0.44445],
2346 "305": [0, 0.44444, 0.04169, 0, 0.23889],
2347 "567": [0.19444, 0.44444, 0.04169, 0, 0.26667],
2348 "710": [0, 0.69444, 0.0799, 0, 0.5],
2349 "711": [0, 0.63194, 0.08432, 0, 0.5],
2350 "713": [0, 0.60889, 0.08776, 0, 0.5],
2351 "714": [0, 0.69444, 0.09205, 0, 0.5],
2352 "715": [0, 0.69444, 0, 0, 0.5],
2353 "728": [0, 0.69444, 0.09483, 0, 0.5],
2354 "729": [0, 0.67937, 0.07774, 0, 0.27778],
2355 "730": [0, 0.69444, 0, 0, 0.73752],
2356 "732": [0, 0.67659, 0.08826, 0, 0.5],
2357 "733": [0, 0.69444, 0.09205, 0, 0.5],
2358 "915": [0, 0.69444, 0.13372, 0, 0.54167],
2359 "916": [0, 0.69444, 0, 0, 0.83334],
2360 "920": [0, 0.69444, 0.07555, 0, 0.77778],
2361 "923": [0, 0.69444, 0, 0, 0.61111],
2362 "926": [0, 0.69444, 0.12816, 0, 0.66667],
2363 "928": [0, 0.69444, 0.08094, 0, 0.70834],
2364 "931": [0, 0.69444, 0.11983, 0, 0.72222],
2365 "933": [0, 0.69444, 0.09031, 0, 0.77778],
2366 "934": [0, 0.69444, 0.04603, 0, 0.72222],
2367 "936": [0, 0.69444, 0.09031, 0, 0.77778],
2368 "937": [0, 0.69444, 0.08293, 0, 0.72222],
2369 "8211": [0, 0.44444, 0.08616, 0, 0.5],
2370 "8212": [0, 0.44444, 0.08616, 0, 1],
2371 "8216": [0, 0.69444, 0.07816, 0, 0.27778],
2372 "8217": [0, 0.69444, 0.07816, 0, 0.27778],
2373 "8220": [0, 0.69444, 0.14205, 0, 0.5],
2374 "8221": [0, 0.69444, 316e-5, 0, 0.5]
2375 },
2376 "SansSerif-Regular": {
2377 "32": [0, 0, 0, 0, 0.25],
2378 "33": [0, 0.69444, 0, 0, 0.31945],
2379 "34": [0, 0.69444, 0, 0, 0.5],
2380 "35": [0.19444, 0.69444, 0, 0, 0.83334],
2381 "36": [0.05556, 0.75, 0, 0, 0.5],
2382 "37": [0.05556, 0.75, 0, 0, 0.83334],
2383 "38": [0, 0.69444, 0, 0, 0.75834],
2384 "39": [0, 0.69444, 0, 0, 0.27778],
2385 "40": [0.25, 0.75, 0, 0, 0.38889],
2386 "41": [0.25, 0.75, 0, 0, 0.38889],
2387 "42": [0, 0.75, 0, 0, 0.5],
2388 "43": [0.08333, 0.58333, 0, 0, 0.77778],
2389 "44": [0.125, 0.08333, 0, 0, 0.27778],
2390 "45": [0, 0.44444, 0, 0, 0.33333],
2391 "46": [0, 0.08333, 0, 0, 0.27778],
2392 "47": [0.25, 0.75, 0, 0, 0.5],
2393 "48": [0, 0.65556, 0, 0, 0.5],
2394 "49": [0, 0.65556, 0, 0, 0.5],
2395 "50": [0, 0.65556, 0, 0, 0.5],
2396 "51": [0, 0.65556, 0, 0, 0.5],
2397 "52": [0, 0.65556, 0, 0, 0.5],
2398 "53": [0, 0.65556, 0, 0, 0.5],
2399 "54": [0, 0.65556, 0, 0, 0.5],
2400 "55": [0, 0.65556, 0, 0, 0.5],
2401 "56": [0, 0.65556, 0, 0, 0.5],
2402 "57": [0, 0.65556, 0, 0, 0.5],
2403 "58": [0, 0.44444, 0, 0, 0.27778],
2404 "59": [0.125, 0.44444, 0, 0, 0.27778],
2405 "61": [-0.13, 0.37, 0, 0, 0.77778],
2406 "63": [0, 0.69444, 0, 0, 0.47222],
2407 "64": [0, 0.69444, 0, 0, 0.66667],
2408 "65": [0, 0.69444, 0, 0, 0.66667],
2409 "66": [0, 0.69444, 0, 0, 0.66667],
2410 "67": [0, 0.69444, 0, 0, 0.63889],
2411 "68": [0, 0.69444, 0, 0, 0.72223],
2412 "69": [0, 0.69444, 0, 0, 0.59722],
2413 "70": [0, 0.69444, 0, 0, 0.56945],
2414 "71": [0, 0.69444, 0, 0, 0.66667],
2415 "72": [0, 0.69444, 0, 0, 0.70834],
2416 "73": [0, 0.69444, 0, 0, 0.27778],
2417 "74": [0, 0.69444, 0, 0, 0.47222],
2418 "75": [0, 0.69444, 0, 0, 0.69445],
2419 "76": [0, 0.69444, 0, 0, 0.54167],
2420 "77": [0, 0.69444, 0, 0, 0.875],
2421 "78": [0, 0.69444, 0, 0, 0.70834],
2422 "79": [0, 0.69444, 0, 0, 0.73611],
2423 "80": [0, 0.69444, 0, 0, 0.63889],
2424 "81": [0.125, 0.69444, 0, 0, 0.73611],
2425 "82": [0, 0.69444, 0, 0, 0.64584],
2426 "83": [0, 0.69444, 0, 0, 0.55556],
2427 "84": [0, 0.69444, 0, 0, 0.68056],
2428 "85": [0, 0.69444, 0, 0, 0.6875],
2429 "86": [0, 0.69444, 0.01389, 0, 0.66667],
2430 "87": [0, 0.69444, 0.01389, 0, 0.94445],
2431 "88": [0, 0.69444, 0, 0, 0.66667],
2432 "89": [0, 0.69444, 0.025, 0, 0.66667],
2433 "90": [0, 0.69444, 0, 0, 0.61111],
2434 "91": [0.25, 0.75, 0, 0, 0.28889],
2435 "93": [0.25, 0.75, 0, 0, 0.28889],
2436 "94": [0, 0.69444, 0, 0, 0.5],
2437 "95": [0.35, 0.09444, 0.02778, 0, 0.5],
2438 "97": [0, 0.44444, 0, 0, 0.48056],
2439 "98": [0, 0.69444, 0, 0, 0.51667],
2440 "99": [0, 0.44444, 0, 0, 0.44445],
2441 "100": [0, 0.69444, 0, 0, 0.51667],
2442 "101": [0, 0.44444, 0, 0, 0.44445],
2443 "102": [0, 0.69444, 0.06944, 0, 0.30556],
2444 "103": [0.19444, 0.44444, 0.01389, 0, 0.5],
2445 "104": [0, 0.69444, 0, 0, 0.51667],
2446 "105": [0, 0.67937, 0, 0, 0.23889],
2447 "106": [0.19444, 0.67937, 0, 0, 0.26667],
2448 "107": [0, 0.69444, 0, 0, 0.48889],
2449 "108": [0, 0.69444, 0, 0, 0.23889],
2450 "109": [0, 0.44444, 0, 0, 0.79445],
2451 "110": [0, 0.44444, 0, 0, 0.51667],
2452 "111": [0, 0.44444, 0, 0, 0.5],
2453 "112": [0.19444, 0.44444, 0, 0, 0.51667],
2454 "113": [0.19444, 0.44444, 0, 0, 0.51667],
2455 "114": [0, 0.44444, 0.01389, 0, 0.34167],
2456 "115": [0, 0.44444, 0, 0, 0.38333],
2457 "116": [0, 0.57143, 0, 0, 0.36111],
2458 "117": [0, 0.44444, 0, 0, 0.51667],
2459 "118": [0, 0.44444, 0.01389, 0, 0.46111],
2460 "119": [0, 0.44444, 0.01389, 0, 0.68334],
2461 "120": [0, 0.44444, 0, 0, 0.46111],
2462 "121": [0.19444, 0.44444, 0.01389, 0, 0.46111],
2463 "122": [0, 0.44444, 0, 0, 0.43472],
2464 "126": [0.35, 0.32659, 0, 0, 0.5],
2465 "160": [0, 0, 0, 0, 0.25],
2466 "168": [0, 0.67937, 0, 0, 0.5],
2467 "176": [0, 0.69444, 0, 0, 0.66667],
2468 "184": [0.17014, 0, 0, 0, 0.44445],
2469 "305": [0, 0.44444, 0, 0, 0.23889],
2470 "567": [0.19444, 0.44444, 0, 0, 0.26667],
2471 "710": [0, 0.69444, 0, 0, 0.5],
2472 "711": [0, 0.63194, 0, 0, 0.5],
2473 "713": [0, 0.60889, 0, 0, 0.5],
2474 "714": [0, 0.69444, 0, 0, 0.5],
2475 "715": [0, 0.69444, 0, 0, 0.5],
2476 "728": [0, 0.69444, 0, 0, 0.5],
2477 "729": [0, 0.67937, 0, 0, 0.27778],
2478 "730": [0, 0.69444, 0, 0, 0.66667],
2479 "732": [0, 0.67659, 0, 0, 0.5],
2480 "733": [0, 0.69444, 0, 0, 0.5],
2481 "915": [0, 0.69444, 0, 0, 0.54167],
2482 "916": [0, 0.69444, 0, 0, 0.83334],
2483 "920": [0, 0.69444, 0, 0, 0.77778],
2484 "923": [0, 0.69444, 0, 0, 0.61111],
2485 "926": [0, 0.69444, 0, 0, 0.66667],
2486 "928": [0, 0.69444, 0, 0, 0.70834],
2487 "931": [0, 0.69444, 0, 0, 0.72222],
2488 "933": [0, 0.69444, 0, 0, 0.77778],
2489 "934": [0, 0.69444, 0, 0, 0.72222],
2490 "936": [0, 0.69444, 0, 0, 0.77778],
2491 "937": [0, 0.69444, 0, 0, 0.72222],
2492 "8211": [0, 0.44444, 0.02778, 0, 0.5],
2493 "8212": [0, 0.44444, 0.02778, 0, 1],
2494 "8216": [0, 0.69444, 0, 0, 0.27778],
2495 "8217": [0, 0.69444, 0, 0, 0.27778],
2496 "8220": [0, 0.69444, 0, 0, 0.5],
2497 "8221": [0, 0.69444, 0, 0, 0.5]
2498 },
2499 "Script-Regular": {
2500 "32": [0, 0, 0, 0, 0.25],
2501 "65": [0, 0.7, 0.22925, 0, 0.80253],
2502 "66": [0, 0.7, 0.04087, 0, 0.90757],
2503 "67": [0, 0.7, 0.1689, 0, 0.66619],
2504 "68": [0, 0.7, 0.09371, 0, 0.77443],
2505 "69": [0, 0.7, 0.18583, 0, 0.56162],
2506 "70": [0, 0.7, 0.13634, 0, 0.89544],
2507 "71": [0, 0.7, 0.17322, 0, 0.60961],
2508 "72": [0, 0.7, 0.29694, 0, 0.96919],
2509 "73": [0, 0.7, 0.19189, 0, 0.80907],
2510 "74": [0.27778, 0.7, 0.19189, 0, 1.05159],
2511 "75": [0, 0.7, 0.31259, 0, 0.91364],
2512 "76": [0, 0.7, 0.19189, 0, 0.87373],
2513 "77": [0, 0.7, 0.15981, 0, 1.08031],
2514 "78": [0, 0.7, 0.3525, 0, 0.9015],
2515 "79": [0, 0.7, 0.08078, 0, 0.73787],
2516 "80": [0, 0.7, 0.08078, 0, 1.01262],
2517 "81": [0, 0.7, 0.03305, 0, 0.88282],
2518 "82": [0, 0.7, 0.06259, 0, 0.85],
2519 "83": [0, 0.7, 0.19189, 0, 0.86767],
2520 "84": [0, 0.7, 0.29087, 0, 0.74697],
2521 "85": [0, 0.7, 0.25815, 0, 0.79996],
2522 "86": [0, 0.7, 0.27523, 0, 0.62204],
2523 "87": [0, 0.7, 0.27523, 0, 0.80532],
2524 "88": [0, 0.7, 0.26006, 0, 0.94445],
2525 "89": [0, 0.7, 0.2939, 0, 0.70961],
2526 "90": [0, 0.7, 0.24037, 0, 0.8212],
2527 "160": [0, 0, 0, 0, 0.25]
2528 },
2529 "Size1-Regular": {
2530 "32": [0, 0, 0, 0, 0.25],
2531 "40": [0.35001, 0.85, 0, 0, 0.45834],
2532 "41": [0.35001, 0.85, 0, 0, 0.45834],
2533 "47": [0.35001, 0.85, 0, 0, 0.57778],
2534 "91": [0.35001, 0.85, 0, 0, 0.41667],
2535 "92": [0.35001, 0.85, 0, 0, 0.57778],
2536 "93": [0.35001, 0.85, 0, 0, 0.41667],
2537 "123": [0.35001, 0.85, 0, 0, 0.58334],
2538 "125": [0.35001, 0.85, 0, 0, 0.58334],
2539 "160": [0, 0, 0, 0, 0.25],
2540 "710": [0, 0.72222, 0, 0, 0.55556],
2541 "732": [0, 0.72222, 0, 0, 0.55556],
2542 "770": [0, 0.72222, 0, 0, 0.55556],
2543 "771": [0, 0.72222, 0, 0, 0.55556],
2544 "8214": [-99e-5, 0.601, 0, 0, 0.77778],
2545 "8593": [1e-5, 0.6, 0, 0, 0.66667],
2546 "8595": [1e-5, 0.6, 0, 0, 0.66667],
2547 "8657": [1e-5, 0.6, 0, 0, 0.77778],
2548 "8659": [1e-5, 0.6, 0, 0, 0.77778],
2549 "8719": [0.25001, 0.75, 0, 0, 0.94445],
2550 "8720": [0.25001, 0.75, 0, 0, 0.94445],
2551 "8721": [0.25001, 0.75, 0, 0, 1.05556],
2552 "8730": [0.35001, 0.85, 0, 0, 1],
2553 "8739": [-599e-5, 0.606, 0, 0, 0.33333],
2554 "8741": [-599e-5, 0.606, 0, 0, 0.55556],
2555 "8747": [0.30612, 0.805, 0.19445, 0, 0.47222],
2556 "8748": [0.306, 0.805, 0.19445, 0, 0.47222],
2557 "8749": [0.306, 0.805, 0.19445, 0, 0.47222],
2558 "8750": [0.30612, 0.805, 0.19445, 0, 0.47222],
2559 "8896": [0.25001, 0.75, 0, 0, 0.83334],
2560 "8897": [0.25001, 0.75, 0, 0, 0.83334],
2561 "8898": [0.25001, 0.75, 0, 0, 0.83334],
2562 "8899": [0.25001, 0.75, 0, 0, 0.83334],
2563 "8968": [0.35001, 0.85, 0, 0, 0.47222],
2564 "8969": [0.35001, 0.85, 0, 0, 0.47222],
2565 "8970": [0.35001, 0.85, 0, 0, 0.47222],
2566 "8971": [0.35001, 0.85, 0, 0, 0.47222],
2567 "9168": [-99e-5, 0.601, 0, 0, 0.66667],
2568 "10216": [0.35001, 0.85, 0, 0, 0.47222],
2569 "10217": [0.35001, 0.85, 0, 0, 0.47222],
2570 "10752": [0.25001, 0.75, 0, 0, 1.11111],
2571 "10753": [0.25001, 0.75, 0, 0, 1.11111],
2572 "10754": [0.25001, 0.75, 0, 0, 1.11111],
2573 "10756": [0.25001, 0.75, 0, 0, 0.83334],
2574 "10758": [0.25001, 0.75, 0, 0, 0.83334]
2575 },
2576 "Size2-Regular": {
2577 "32": [0, 0, 0, 0, 0.25],
2578 "40": [0.65002, 1.15, 0, 0, 0.59722],
2579 "41": [0.65002, 1.15, 0, 0, 0.59722],
2580 "47": [0.65002, 1.15, 0, 0, 0.81111],
2581 "91": [0.65002, 1.15, 0, 0, 0.47222],
2582 "92": [0.65002, 1.15, 0, 0, 0.81111],
2583 "93": [0.65002, 1.15, 0, 0, 0.47222],
2584 "123": [0.65002, 1.15, 0, 0, 0.66667],
2585 "125": [0.65002, 1.15, 0, 0, 0.66667],
2586 "160": [0, 0, 0, 0, 0.25],
2587 "710": [0, 0.75, 0, 0, 1],
2588 "732": [0, 0.75, 0, 0, 1],
2589 "770": [0, 0.75, 0, 0, 1],
2590 "771": [0, 0.75, 0, 0, 1],
2591 "8719": [0.55001, 1.05, 0, 0, 1.27778],
2592 "8720": [0.55001, 1.05, 0, 0, 1.27778],
2593 "8721": [0.55001, 1.05, 0, 0, 1.44445],
2594 "8730": [0.65002, 1.15, 0, 0, 1],
2595 "8747": [0.86225, 1.36, 0.44445, 0, 0.55556],
2596 "8748": [0.862, 1.36, 0.44445, 0, 0.55556],
2597 "8749": [0.862, 1.36, 0.44445, 0, 0.55556],
2598 "8750": [0.86225, 1.36, 0.44445, 0, 0.55556],
2599 "8896": [0.55001, 1.05, 0, 0, 1.11111],
2600 "8897": [0.55001, 1.05, 0, 0, 1.11111],
2601 "8898": [0.55001, 1.05, 0, 0, 1.11111],
2602 "8899": [0.55001, 1.05, 0, 0, 1.11111],
2603 "8968": [0.65002, 1.15, 0, 0, 0.52778],
2604 "8969": [0.65002, 1.15, 0, 0, 0.52778],
2605 "8970": [0.65002, 1.15, 0, 0, 0.52778],
2606 "8971": [0.65002, 1.15, 0, 0, 0.52778],
2607 "10216": [0.65002, 1.15, 0, 0, 0.61111],
2608 "10217": [0.65002, 1.15, 0, 0, 0.61111],
2609 "10752": [0.55001, 1.05, 0, 0, 1.51112],
2610 "10753": [0.55001, 1.05, 0, 0, 1.51112],
2611 "10754": [0.55001, 1.05, 0, 0, 1.51112],
2612 "10756": [0.55001, 1.05, 0, 0, 1.11111],
2613 "10758": [0.55001, 1.05, 0, 0, 1.11111]
2614 },
2615 "Size3-Regular": {
2616 "32": [0, 0, 0, 0, 0.25],
2617 "40": [0.95003, 1.45, 0, 0, 0.73611],
2618 "41": [0.95003, 1.45, 0, 0, 0.73611],
2619 "47": [0.95003, 1.45, 0, 0, 1.04445],
2620 "91": [0.95003, 1.45, 0, 0, 0.52778],
2621 "92": [0.95003, 1.45, 0, 0, 1.04445],
2622 "93": [0.95003, 1.45, 0, 0, 0.52778],
2623 "123": [0.95003, 1.45, 0, 0, 0.75],
2624 "125": [0.95003, 1.45, 0, 0, 0.75],
2625 "160": [0, 0, 0, 0, 0.25],
2626 "710": [0, 0.75, 0, 0, 1.44445],
2627 "732": [0, 0.75, 0, 0, 1.44445],
2628 "770": [0, 0.75, 0, 0, 1.44445],
2629 "771": [0, 0.75, 0, 0, 1.44445],
2630 "8730": [0.95003, 1.45, 0, 0, 1],
2631 "8968": [0.95003, 1.45, 0, 0, 0.58334],
2632 "8969": [0.95003, 1.45, 0, 0, 0.58334],
2633 "8970": [0.95003, 1.45, 0, 0, 0.58334],
2634 "8971": [0.95003, 1.45, 0, 0, 0.58334],
2635 "10216": [0.95003, 1.45, 0, 0, 0.75],
2636 "10217": [0.95003, 1.45, 0, 0, 0.75]
2637 },
2638 "Size4-Regular": {
2639 "32": [0, 0, 0, 0, 0.25],
2640 "40": [1.25003, 1.75, 0, 0, 0.79167],
2641 "41": [1.25003, 1.75, 0, 0, 0.79167],
2642 "47": [1.25003, 1.75, 0, 0, 1.27778],
2643 "91": [1.25003, 1.75, 0, 0, 0.58334],
2644 "92": [1.25003, 1.75, 0, 0, 1.27778],
2645 "93": [1.25003, 1.75, 0, 0, 0.58334],
2646 "123": [1.25003, 1.75, 0, 0, 0.80556],
2647 "125": [1.25003, 1.75, 0, 0, 0.80556],
2648 "160": [0, 0, 0, 0, 0.25],
2649 "710": [0, 0.825, 0, 0, 1.8889],
2650 "732": [0, 0.825, 0, 0, 1.8889],
2651 "770": [0, 0.825, 0, 0, 1.8889],
2652 "771": [0, 0.825, 0, 0, 1.8889],
2653 "8730": [1.25003, 1.75, 0, 0, 1],
2654 "8968": [1.25003, 1.75, 0, 0, 0.63889],
2655 "8969": [1.25003, 1.75, 0, 0, 0.63889],
2656 "8970": [1.25003, 1.75, 0, 0, 0.63889],
2657 "8971": [1.25003, 1.75, 0, 0, 0.63889],
2658 "9115": [0.64502, 1.155, 0, 0, 0.875],
2659 "9116": [1e-5, 0.6, 0, 0, 0.875],
2660 "9117": [0.64502, 1.155, 0, 0, 0.875],
2661 "9118": [0.64502, 1.155, 0, 0, 0.875],
2662 "9119": [1e-5, 0.6, 0, 0, 0.875],
2663 "9120": [0.64502, 1.155, 0, 0, 0.875],
2664 "9121": [0.64502, 1.155, 0, 0, 0.66667],
2665 "9122": [-99e-5, 0.601, 0, 0, 0.66667],
2666 "9123": [0.64502, 1.155, 0, 0, 0.66667],
2667 "9124": [0.64502, 1.155, 0, 0, 0.66667],
2668 "9125": [-99e-5, 0.601, 0, 0, 0.66667],
2669 "9126": [0.64502, 1.155, 0, 0, 0.66667],
2670 "9127": [1e-5, 0.9, 0, 0, 0.88889],
2671 "9128": [0.65002, 1.15, 0, 0, 0.88889],
2672 "9129": [0.90001, 0, 0, 0, 0.88889],
2673 "9130": [0, 0.3, 0, 0, 0.88889],
2674 "9131": [1e-5, 0.9, 0, 0, 0.88889],
2675 "9132": [0.65002, 1.15, 0, 0, 0.88889],
2676 "9133": [0.90001, 0, 0, 0, 0.88889],
2677 "9143": [0.88502, 0.915, 0, 0, 1.05556],
2678 "10216": [1.25003, 1.75, 0, 0, 0.80556],
2679 "10217": [1.25003, 1.75, 0, 0, 0.80556],
2680 "57344": [-499e-5, 0.605, 0, 0, 1.05556],
2681 "57345": [-499e-5, 0.605, 0, 0, 1.05556],
2682 "57680": [0, 0.12, 0, 0, 0.45],
2683 "57681": [0, 0.12, 0, 0, 0.45],
2684 "57682": [0, 0.12, 0, 0, 0.45],
2685 "57683": [0, 0.12, 0, 0, 0.45]
2686 },
2687 "Typewriter-Regular": {
2688 "32": [0, 0, 0, 0, 0.525],
2689 "33": [0, 0.61111, 0, 0, 0.525],
2690 "34": [0, 0.61111, 0, 0, 0.525],
2691 "35": [0, 0.61111, 0, 0, 0.525],
2692 "36": [0.08333, 0.69444, 0, 0, 0.525],
2693 "37": [0.08333, 0.69444, 0, 0, 0.525],
2694 "38": [0, 0.61111, 0, 0, 0.525],
2695 "39": [0, 0.61111, 0, 0, 0.525],
2696 "40": [0.08333, 0.69444, 0, 0, 0.525],
2697 "41": [0.08333, 0.69444, 0, 0, 0.525],
2698 "42": [0, 0.52083, 0, 0, 0.525],
2699 "43": [-0.08056, 0.53055, 0, 0, 0.525],
2700 "44": [0.13889, 0.125, 0, 0, 0.525],
2701 "45": [-0.08056, 0.53055, 0, 0, 0.525],
2702 "46": [0, 0.125, 0, 0, 0.525],
2703 "47": [0.08333, 0.69444, 0, 0, 0.525],
2704 "48": [0, 0.61111, 0, 0, 0.525],
2705 "49": [0, 0.61111, 0, 0, 0.525],
2706 "50": [0, 0.61111, 0, 0, 0.525],
2707 "51": [0, 0.61111, 0, 0, 0.525],
2708 "52": [0, 0.61111, 0, 0, 0.525],
2709 "53": [0, 0.61111, 0, 0, 0.525],
2710 "54": [0, 0.61111, 0, 0, 0.525],
2711 "55": [0, 0.61111, 0, 0, 0.525],
2712 "56": [0, 0.61111, 0, 0, 0.525],
2713 "57": [0, 0.61111, 0, 0, 0.525],
2714 "58": [0, 0.43056, 0, 0, 0.525],
2715 "59": [0.13889, 0.43056, 0, 0, 0.525],
2716 "60": [-0.05556, 0.55556, 0, 0, 0.525],
2717 "61": [-0.19549, 0.41562, 0, 0, 0.525],
2718 "62": [-0.05556, 0.55556, 0, 0, 0.525],
2719 "63": [0, 0.61111, 0, 0, 0.525],
2720 "64": [0, 0.61111, 0, 0, 0.525],
2721 "65": [0, 0.61111, 0, 0, 0.525],
2722 "66": [0, 0.61111, 0, 0, 0.525],
2723 "67": [0, 0.61111, 0, 0, 0.525],
2724 "68": [0, 0.61111, 0, 0, 0.525],
2725 "69": [0, 0.61111, 0, 0, 0.525],
2726 "70": [0, 0.61111, 0, 0, 0.525],
2727 "71": [0, 0.61111, 0, 0, 0.525],
2728 "72": [0, 0.61111, 0, 0, 0.525],
2729 "73": [0, 0.61111, 0, 0, 0.525],
2730 "74": [0, 0.61111, 0, 0, 0.525],
2731 "75": [0, 0.61111, 0, 0, 0.525],
2732 "76": [0, 0.61111, 0, 0, 0.525],
2733 "77": [0, 0.61111, 0, 0, 0.525],
2734 "78": [0, 0.61111, 0, 0, 0.525],
2735 "79": [0, 0.61111, 0, 0, 0.525],
2736 "80": [0, 0.61111, 0, 0, 0.525],
2737 "81": [0.13889, 0.61111, 0, 0, 0.525],
2738 "82": [0, 0.61111, 0, 0, 0.525],
2739 "83": [0, 0.61111, 0, 0, 0.525],
2740 "84": [0, 0.61111, 0, 0, 0.525],
2741 "85": [0, 0.61111, 0, 0, 0.525],
2742 "86": [0, 0.61111, 0, 0, 0.525],
2743 "87": [0, 0.61111, 0, 0, 0.525],
2744 "88": [0, 0.61111, 0, 0, 0.525],
2745 "89": [0, 0.61111, 0, 0, 0.525],
2746 "90": [0, 0.61111, 0, 0, 0.525],
2747 "91": [0.08333, 0.69444, 0, 0, 0.525],
2748 "92": [0.08333, 0.69444, 0, 0, 0.525],
2749 "93": [0.08333, 0.69444, 0, 0, 0.525],
2750 "94": [0, 0.61111, 0, 0, 0.525],
2751 "95": [0.09514, 0, 0, 0, 0.525],
2752 "96": [0, 0.61111, 0, 0, 0.525],
2753 "97": [0, 0.43056, 0, 0, 0.525],
2754 "98": [0, 0.61111, 0, 0, 0.525],
2755 "99": [0, 0.43056, 0, 0, 0.525],
2756 "100": [0, 0.61111, 0, 0, 0.525],
2757 "101": [0, 0.43056, 0, 0, 0.525],
2758 "102": [0, 0.61111, 0, 0, 0.525],
2759 "103": [0.22222, 0.43056, 0, 0, 0.525],
2760 "104": [0, 0.61111, 0, 0, 0.525],
2761 "105": [0, 0.61111, 0, 0, 0.525],
2762 "106": [0.22222, 0.61111, 0, 0, 0.525],
2763 "107": [0, 0.61111, 0, 0, 0.525],
2764 "108": [0, 0.61111, 0, 0, 0.525],
2765 "109": [0, 0.43056, 0, 0, 0.525],
2766 "110": [0, 0.43056, 0, 0, 0.525],
2767 "111": [0, 0.43056, 0, 0, 0.525],
2768 "112": [0.22222, 0.43056, 0, 0, 0.525],
2769 "113": [0.22222, 0.43056, 0, 0, 0.525],
2770 "114": [0, 0.43056, 0, 0, 0.525],
2771 "115": [0, 0.43056, 0, 0, 0.525],
2772 "116": [0, 0.55358, 0, 0, 0.525],
2773 "117": [0, 0.43056, 0, 0, 0.525],
2774 "118": [0, 0.43056, 0, 0, 0.525],
2775 "119": [0, 0.43056, 0, 0, 0.525],
2776 "120": [0, 0.43056, 0, 0, 0.525],
2777 "121": [0.22222, 0.43056, 0, 0, 0.525],
2778 "122": [0, 0.43056, 0, 0, 0.525],
2779 "123": [0.08333, 0.69444, 0, 0, 0.525],
2780 "124": [0.08333, 0.69444, 0, 0, 0.525],
2781 "125": [0.08333, 0.69444, 0, 0, 0.525],
2782 "126": [0, 0.61111, 0, 0, 0.525],
2783 "127": [0, 0.61111, 0, 0, 0.525],
2784 "160": [0, 0, 0, 0, 0.525],
2785 "176": [0, 0.61111, 0, 0, 0.525],
2786 "184": [0.19445, 0, 0, 0, 0.525],
2787 "305": [0, 0.43056, 0, 0, 0.525],
2788 "567": [0.22222, 0.43056, 0, 0, 0.525],
2789 "711": [0, 0.56597, 0, 0, 0.525],
2790 "713": [0, 0.56555, 0, 0, 0.525],
2791 "714": [0, 0.61111, 0, 0, 0.525],
2792 "715": [0, 0.61111, 0, 0, 0.525],
2793 "728": [0, 0.61111, 0, 0, 0.525],
2794 "730": [0, 0.61111, 0, 0, 0.525],
2795 "770": [0, 0.61111, 0, 0, 0.525],
2796 "771": [0, 0.61111, 0, 0, 0.525],
2797 "776": [0, 0.61111, 0, 0, 0.525],
2798 "915": [0, 0.61111, 0, 0, 0.525],
2799 "916": [0, 0.61111, 0, 0, 0.525],
2800 "920": [0, 0.61111, 0, 0, 0.525],
2801 "923": [0, 0.61111, 0, 0, 0.525],
2802 "926": [0, 0.61111, 0, 0, 0.525],
2803 "928": [0, 0.61111, 0, 0, 0.525],
2804 "931": [0, 0.61111, 0, 0, 0.525],
2805 "933": [0, 0.61111, 0, 0, 0.525],
2806 "934": [0, 0.61111, 0, 0, 0.525],
2807 "936": [0, 0.61111, 0, 0, 0.525],
2808 "937": [0, 0.61111, 0, 0, 0.525],
2809 "8216": [0, 0.61111, 0, 0, 0.525],
2810 "8217": [0, 0.61111, 0, 0, 0.525],
2811 "8242": [0, 0.61111, 0, 0, 0.525],
2812 "9251": [0.11111, 0.21944, 0, 0, 0.525]
2813 }
2814};
2815var sigmasAndXis = {
2816 slant: [0.25, 0.25, 0.25],
2817 // sigma1
2818 space: [0, 0, 0],
2819 // sigma2
2820 stretch: [0, 0, 0],
2821 // sigma3
2822 shrink: [0, 0, 0],
2823 // sigma4
2824 xHeight: [0.431, 0.431, 0.431],
2825 // sigma5
2826 quad: [1, 1.171, 1.472],
2827 // sigma6
2828 extraSpace: [0, 0, 0],
2829 // sigma7
2830 num1: [0.677, 0.732, 0.925],
2831 // sigma8
2832 num2: [0.394, 0.384, 0.387],
2833 // sigma9
2834 num3: [0.444, 0.471, 0.504],
2835 // sigma10
2836 denom1: [0.686, 0.752, 1.025],
2837 // sigma11
2838 denom2: [0.345, 0.344, 0.532],
2839 // sigma12
2840 sup1: [0.413, 0.503, 0.504],
2841 // sigma13
2842 sup2: [0.363, 0.431, 0.404],
2843 // sigma14
2844 sup3: [0.289, 0.286, 0.294],
2845 // sigma15
2846 sub1: [0.15, 0.143, 0.2],
2847 // sigma16
2848 sub2: [0.247, 0.286, 0.4],
2849 // sigma17
2850 supDrop: [0.386, 0.353, 0.494],
2851 // sigma18
2852 subDrop: [0.05, 0.071, 0.1],
2853 // sigma19
2854 delim1: [2.39, 1.7, 1.98],
2855 // sigma20
2856 delim2: [1.01, 1.157, 1.42],
2857 // sigma21
2858 axisHeight: [0.25, 0.25, 0.25],
2859 // sigma22
2860 // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
2861 // they correspond to the font parameters of the extension fonts (family 3).
2862 // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
2863 // match cmex7, we'd use cmex7.tfm values for script and scriptscript
2864 // values.
2865 defaultRuleThickness: [0.04, 0.049, 0.049],
2866 // xi8; cmex7: 0.049
2867 bigOpSpacing1: [0.111, 0.111, 0.111],
2868 // xi9
2869 bigOpSpacing2: [0.166, 0.166, 0.166],
2870 // xi10
2871 bigOpSpacing3: [0.2, 0.2, 0.2],
2872 // xi11
2873 bigOpSpacing4: [0.6, 0.611, 0.611],
2874 // xi12; cmex7: 0.611
2875 bigOpSpacing5: [0.1, 0.143, 0.143],
2876 // xi13; cmex7: 0.143
2877 // The \sqrt rule width is taken from the height of the surd character.
2878 // Since we use the same font at all sizes, this thickness doesn't scale.
2879 sqrtRuleThickness: [0.04, 0.04, 0.04],
2880 // This value determines how large a pt is, for metrics which are defined
2881 // in terms of pts.
2882 // This value is also used in katex.less; if you change it make sure the
2883 // values match.
2884 ptPerEm: [10, 10, 10],
2885 // The space between adjacent `|` columns in an array definition. From
2886 // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
2887 doubleRuleSep: [0.2, 0.2, 0.2],
2888 // The width of separator lines in {array} environments. From
2889 // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
2890 arrayRuleWidth: [0.04, 0.04, 0.04],
2891 // Two values from LaTeX source2e:
2892 fboxsep: [0.3, 0.3, 0.3],
2893 // 3 pt / ptPerEm
2894 fboxrule: [0.04, 0.04, 0.04]
2895 // 0.4 pt / ptPerEm
2896};
2897var extraCharacterMap = {
2898 // Latin-1
2899 "Å": "A",
2900 "Ð": "D",
2901 "Þ": "o",
2902 "å": "a",
2903 "ð": "d",
2904 "þ": "o",
2905 // Cyrillic
2906 "А": "A",
2907 "Б": "B",
2908 "В": "B",
2909 "Г": "F",
2910 "Д": "A",
2911 "Е": "E",
2912 "Ж": "K",
2913 "З": "3",
2914 "И": "N",
2915 "Й": "N",
2916 "К": "K",
2917 "Л": "N",
2918 "М": "M",
2919 "Н": "H",
2920 "О": "O",
2921 "П": "N",
2922 "Р": "P",
2923 "С": "C",
2924 "Т": "T",
2925 "У": "y",
2926 "Ф": "O",
2927 "Х": "X",
2928 "Ц": "U",
2929 "Ч": "h",
2930 "Ш": "W",
2931 "Щ": "W",
2932 "Ъ": "B",
2933 "Ы": "X",
2934 "Ь": "B",
2935 "Э": "3",
2936 "Ю": "X",
2937 "Я": "R",
2938 "а": "a",
2939 "б": "b",
2940 "в": "a",
2941 "г": "r",
2942 "д": "y",
2943 "е": "e",
2944 "ж": "m",
2945 "з": "e",
2946 "и": "n",
2947 "й": "n",
2948 "к": "n",
2949 "л": "n",
2950 "м": "m",
2951 "н": "n",
2952 "о": "o",
2953 "п": "n",
2954 "р": "p",
2955 "с": "c",
2956 "т": "o",
2957 "у": "y",
2958 "ф": "b",
2959 "х": "x",
2960 "ц": "n",
2961 "ч": "n",
2962 "ш": "w",
2963 "щ": "w",
2964 "ъ": "a",
2965 "ы": "m",
2966 "ь": "a",
2967 "э": "e",
2968 "ю": "m",
2969 "я": "r"
2970};
2971function setFontMetrics(fontName, metrics) {
2972 fontMetricsData[fontName] = metrics;
2973}
2974function getCharacterMetrics(character, font, mode) {
2975 if (!fontMetricsData[font]) {
2976 throw new Error("Font metrics not found for font: " + font + ".");
2977 }
2978 var ch = character.charCodeAt(0);
2979 var metrics = fontMetricsData[font][ch];
2980 if (!metrics && character[0] in extraCharacterMap) {
2981 ch = extraCharacterMap[character[0]].charCodeAt(0);
2982 metrics = fontMetricsData[font][ch];
2983 }
2984 if (!metrics && mode === "text") {
2985 if (supportedCodepoint(ch)) {
2986 metrics = fontMetricsData[font][77];
2987 }
2988 }
2989 if (metrics) {
2990 return {
2991 depth: metrics[0],
2992 height: metrics[1],
2993 italic: metrics[2],
2994 skew: metrics[3],
2995 width: metrics[4]
2996 };
2997 }
2998}
2999var fontMetricsBySizeIndex = {};
3000function getGlobalMetrics(size) {
3001 var sizeIndex;
3002 if (size >= 5) {
3003 sizeIndex = 0;
3004 } else if (size >= 3) {
3005 sizeIndex = 1;
3006 } else {
3007 sizeIndex = 2;
3008 }
3009 if (!fontMetricsBySizeIndex[sizeIndex]) {
3010 var metrics = fontMetricsBySizeIndex[sizeIndex] = {
3011 cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
3012 };
3013 for (var key in sigmasAndXis) {
3014 if (sigmasAndXis.hasOwnProperty(key)) {
3015 metrics[key] = sigmasAndXis[key][sizeIndex];
3016 }
3017 }
3018 }
3019 return fontMetricsBySizeIndex[sizeIndex];
3020}
3021var sizeStyleMap = [
3022 // Each element contains [textsize, scriptsize, scriptscriptsize].
3023 // The size mappings are taken from TeX with \normalsize=10pt.
3024 [1, 1, 1],
3025 // size1: [5, 5, 5] \tiny
3026 [2, 1, 1],
3027 // size2: [6, 5, 5]
3028 [3, 1, 1],
3029 // size3: [7, 5, 5] \scriptsize
3030 [4, 2, 1],
3031 // size4: [8, 6, 5] \footnotesize
3032 [5, 2, 1],
3033 // size5: [9, 6, 5] \small
3034 [6, 3, 1],
3035 // size6: [10, 7, 5] \normalsize
3036 [7, 4, 2],
3037 // size7: [12, 8, 6] \large
3038 [8, 6, 3],
3039 // size8: [14.4, 10, 7] \Large
3040 [9, 7, 6],
3041 // size9: [17.28, 12, 10] \LARGE
3042 [10, 8, 7],
3043 // size10: [20.74, 14.4, 12] \huge
3044 [11, 10, 9]
3045 // size11: [24.88, 20.74, 17.28] \HUGE
3046];
3047var sizeMultipliers = [
3048 // fontMetrics.js:getGlobalMetrics also uses size indexes, so if
3049 // you change size indexes, change that function.
3050 0.5,
3051 0.6,
3052 0.7,
3053 0.8,
3054 0.9,
3055 1,
3056 1.2,
3057 1.44,
3058 1.728,
3059 2.074,
3060 2.488
3061];
3062var sizeAtStyle = function sizeAtStyle2(size, style) {
3063 return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];
3064};
3065class Options {
3066 // A font family applies to a group of fonts (i.e. SansSerif), while a font
3067 // represents a specific font (i.e. SansSerif Bold).
3068 // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm
3069 /**
3070 * The base size index.
3071 */
3072 constructor(data) {
3073 this.style = void 0;
3074 this.color = void 0;
3075 this.size = void 0;
3076 this.textSize = void 0;
3077 this.phantom = void 0;
3078 this.font = void 0;
3079 this.fontFamily = void 0;
3080 this.fontWeight = void 0;
3081 this.fontShape = void 0;
3082 this.sizeMultiplier = void 0;
3083 this.maxSize = void 0;
3084 this.minRuleThickness = void 0;
3085 this._fontMetrics = void 0;
3086 this.style = data.style;
3087 this.color = data.color;
3088 this.size = data.size || Options.BASESIZE;
3089 this.textSize = data.textSize || this.size;
3090 this.phantom = !!data.phantom;
3091 this.font = data.font || "";
3092 this.fontFamily = data.fontFamily || "";
3093 this.fontWeight = data.fontWeight || "";
3094 this.fontShape = data.fontShape || "";
3095 this.sizeMultiplier = sizeMultipliers[this.size - 1];
3096 this.maxSize = data.maxSize;
3097 this.minRuleThickness = data.minRuleThickness;
3098 this._fontMetrics = void 0;
3099 }
3100 /**
3101 * Returns a new options object with the same properties as "this". Properties
3102 * from "extension" will be copied to the new options object.
3103 */
3104 extend(extension) {
3105 var data = {
3106 style: this.style,
3107 size: this.size,
3108 textSize: this.textSize,
3109 color: this.color,
3110 phantom: this.phantom,
3111 font: this.font,
3112 fontFamily: this.fontFamily,
3113 fontWeight: this.fontWeight,
3114 fontShape: this.fontShape,
3115 maxSize: this.maxSize,
3116 minRuleThickness: this.minRuleThickness
3117 };
3118 for (var key in extension) {
3119 if (extension.hasOwnProperty(key)) {
3120 data[key] = extension[key];
3121 }
3122 }
3123 return new Options(data);
3124 }
3125 /**
3126 * Return an options object with the given style. If `this.style === style`,
3127 * returns `this`.
3128 */
3129 havingStyle(style) {
3130 if (this.style === style) {
3131 return this;
3132 } else {
3133 return this.extend({
3134 style,
3135 size: sizeAtStyle(this.textSize, style)
3136 });
3137 }
3138 }
3139 /**
3140 * Return an options object with a cramped version of the current style. If
3141 * the current style is cramped, returns `this`.
3142 */
3143 havingCrampedStyle() {
3144 return this.havingStyle(this.style.cramp());
3145 }
3146 /**
3147 * Return an options object with the given size and in at least `\textstyle`.
3148 * Returns `this` if appropriate.
3149 */
3150 havingSize(size) {
3151 if (this.size === size && this.textSize === size) {
3152 return this;
3153 } else {
3154 return this.extend({
3155 style: this.style.text(),
3156 size,
3157 textSize: size,
3158 sizeMultiplier: sizeMultipliers[size - 1]
3159 });
3160 }
3161 }
3162 /**
3163 * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
3164 * changes to at least `\textstyle`.
3165 */
3166 havingBaseStyle(style) {
3167 style = style || this.style.text();
3168 var wantSize = sizeAtStyle(Options.BASESIZE, style);
3169 if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) {
3170 return this;
3171 } else {
3172 return this.extend({
3173 style,
3174 size: wantSize
3175 });
3176 }
3177 }
3178 /**
3179 * Remove the effect of sizing changes such as \Huge.
3180 * Keep the effect of the current style, such as \scriptstyle.
3181 */
3182 havingBaseSizing() {
3183 var size;
3184 switch (this.style.id) {
3185 case 4:
3186 case 5:
3187 size = 3;
3188 break;
3189 case 6:
3190 case 7:
3191 size = 1;
3192 break;
3193 default:
3194 size = 6;
3195 }
3196 return this.extend({
3197 style: this.style.text(),
3198 size
3199 });
3200 }
3201 /**
3202 * Create a new options object with the given color.
3203 */
3204 withColor(color) {
3205 return this.extend({
3206 color
3207 });
3208 }
3209 /**
3210 * Create a new options object with "phantom" set to true.
3211 */
3212 withPhantom() {
3213 return this.extend({
3214 phantom: true
3215 });
3216 }
3217 /**
3218 * Creates a new options object with the given math font or old text font.
3219 * @type {[type]}
3220 */
3221 withFont(font) {
3222 return this.extend({
3223 font
3224 });
3225 }
3226 /**
3227 * Create a new options objects with the given fontFamily.
3228 */
3229 withTextFontFamily(fontFamily) {
3230 return this.extend({
3231 fontFamily,
3232 font: ""
3233 });
3234 }
3235 /**
3236 * Creates a new options object with the given font weight
3237 */
3238 withTextFontWeight(fontWeight) {
3239 return this.extend({
3240 fontWeight,
3241 font: ""
3242 });
3243 }
3244 /**
3245 * Creates a new options object with the given font weight
3246 */
3247 withTextFontShape(fontShape) {
3248 return this.extend({
3249 fontShape,
3250 font: ""
3251 });
3252 }
3253 /**
3254 * Return the CSS sizing classes required to switch from enclosing options
3255 * `oldOptions` to `this`. Returns an array of classes.
3256 */
3257 sizingClasses(oldOptions) {
3258 if (oldOptions.size !== this.size) {
3259 return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
3260 } else {
3261 return [];
3262 }
3263 }
3264 /**
3265 * Return the CSS sizing classes required to switch to the base size. Like
3266 * `this.havingSize(BASESIZE).sizingClasses(this)`.
3267 */
3268 baseSizingClasses() {
3269 if (this.size !== Options.BASESIZE) {
3270 return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
3271 } else {
3272 return [];
3273 }
3274 }
3275 /**
3276 * Return the font metrics for this size.
3277 */
3278 fontMetrics() {
3279 if (!this._fontMetrics) {
3280 this._fontMetrics = getGlobalMetrics(this.size);
3281 }
3282 return this._fontMetrics;
3283 }
3284 /**
3285 * Gets the CSS color of the current options object
3286 */
3287 getColor() {
3288 if (this.phantom) {
3289 return "transparent";
3290 } else {
3291 return this.color;
3292 }
3293 }
3294}
3295Options.BASESIZE = 6;
3296var ptPerUnit = {
3297 // https://en.wikibooks.org/wiki/LaTeX/Lengths and
3298 // https://tex.stackexchange.com/a/8263
3299 "pt": 1,
3300 // TeX point
3301 "mm": 7227 / 2540,
3302 // millimeter
3303 "cm": 7227 / 254,
3304 // centimeter
3305 "in": 72.27,
3306 // inch
3307 "bp": 803 / 800,
3308 // big (PostScript) points
3309 "pc": 12,
3310 // pica
3311 "dd": 1238 / 1157,
3312 // didot
3313 "cc": 14856 / 1157,
3314 // cicero (12 didot)
3315 "nd": 685 / 642,
3316 // new didot
3317 "nc": 1370 / 107,
3318 // new cicero (12 new didot)
3319 "sp": 1 / 65536,
3320 // scaled point (TeX's internal smallest unit)
3321 // https://tex.stackexchange.com/a/41371
3322 "px": 803 / 800
3323 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
3324};
3325var relativeUnit = {
3326 "ex": true,
3327 "em": true,
3328 "mu": true
3329};
3330var validUnit = function validUnit2(unit) {
3331 if (typeof unit !== "string") {
3332 unit = unit.unit;
3333 }
3334 return unit in ptPerUnit || unit in relativeUnit || unit === "ex";
3335};
3336var calculateSize = function calculateSize2(sizeValue, options) {
3337 var scale;
3338 if (sizeValue.unit in ptPerUnit) {
3339 scale = ptPerUnit[sizeValue.unit] / options.fontMetrics().ptPerEm / options.sizeMultiplier;
3340 } else if (sizeValue.unit === "mu") {
3341 scale = options.fontMetrics().cssEmPerMu;
3342 } else {
3343 var unitOptions;
3344 if (options.style.isTight()) {
3345 unitOptions = options.havingStyle(options.style.text());
3346 } else {
3347 unitOptions = options;
3348 }
3349 if (sizeValue.unit === "ex") {
3350 scale = unitOptions.fontMetrics().xHeight;
3351 } else if (sizeValue.unit === "em") {
3352 scale = unitOptions.fontMetrics().quad;
3353 } else {
3354 throw new ParseError("Invalid unit: '" + sizeValue.unit + "'");
3355 }
3356 if (unitOptions !== options) {
3357 scale *= unitOptions.sizeMultiplier / options.sizeMultiplier;
3358 }
3359 }
3360 return Math.min(sizeValue.number * scale, options.maxSize);
3361};
3362var makeEm = function makeEm2(n) {
3363 return +n.toFixed(4) + "em";
3364};
3365var createClass = function createClass2(classes) {
3366 return classes.filter((cls) => cls).join(" ");
3367};
3368var initNode = function initNode2(classes, options, style) {
3369 this.classes = classes || [];
3370 this.attributes = {};
3371 this.height = 0;
3372 this.depth = 0;
3373 this.maxFontSize = 0;
3374 this.style = style || {};
3375 if (options) {
3376 if (options.style.isTight()) {
3377 this.classes.push("mtight");
3378 }
3379 var color = options.getColor();
3380 if (color) {
3381 this.style.color = color;
3382 }
3383 }
3384};
3385var toNode = function toNode2(tagName) {
3386 var node = document.createElement(tagName);
3387 node.className = createClass(this.classes);
3388 for (var style in this.style) {
3389 if (this.style.hasOwnProperty(style)) {
3390 node.style[style] = this.style[style];
3391 }
3392 }
3393 for (var attr in this.attributes) {
3394 if (this.attributes.hasOwnProperty(attr)) {
3395 node.setAttribute(attr, this.attributes[attr]);
3396 }
3397 }
3398 for (var i = 0; i < this.children.length; i++) {
3399 node.appendChild(this.children[i].toNode());
3400 }
3401 return node;
3402};
3403var toMarkup = function toMarkup2(tagName) {
3404 var markup = "<" + tagName;
3405 if (this.classes.length) {
3406 markup += ' class="' + utils.escape(createClass(this.classes)) + '"';
3407 }
3408 var styles2 = "";
3409 for (var style in this.style) {
3410 if (this.style.hasOwnProperty(style)) {
3411 styles2 += utils.hyphenate(style) + ":" + this.style[style] + ";";
3412 }
3413 }
3414 if (styles2) {
3415 markup += ' style="' + utils.escape(styles2) + '"';
3416 }
3417 for (var attr in this.attributes) {
3418 if (this.attributes.hasOwnProperty(attr)) {
3419 markup += " " + attr + '="' + utils.escape(this.attributes[attr]) + '"';
3420 }
3421 }
3422 markup += ">";
3423 for (var i = 0; i < this.children.length; i++) {
3424 markup += this.children[i].toMarkup();
3425 }
3426 markup += "</" + tagName + ">";
3427 return markup;
3428};
3429class Span {
3430 constructor(classes, children, options, style) {
3431 this.children = void 0;
3432 this.attributes = void 0;
3433 this.classes = void 0;
3434 this.height = void 0;
3435 this.depth = void 0;
3436 this.width = void 0;
3437 this.maxFontSize = void 0;
3438 this.style = void 0;
3439 initNode.call(this, classes, options, style);
3440 this.children = children || [];
3441 }
3442 /**
3443 * Sets an arbitrary attribute on the span. Warning: use this wisely. Not
3444 * all browsers support attributes the same, and having too many custom
3445 * attributes is probably bad.
3446 */
3447 setAttribute(attribute, value) {
3448 this.attributes[attribute] = value;
3449 }
3450 hasClass(className) {
3451 return utils.contains(this.classes, className);
3452 }
3453 toNode() {
3454 return toNode.call(this, "span");
3455 }
3456 toMarkup() {
3457 return toMarkup.call(this, "span");
3458 }
3459}
3460class Anchor {
3461 constructor(href, classes, children, options) {
3462 this.children = void 0;
3463 this.attributes = void 0;
3464 this.classes = void 0;
3465 this.height = void 0;
3466 this.depth = void 0;
3467 this.maxFontSize = void 0;
3468 this.style = void 0;
3469 initNode.call(this, classes, options);
3470 this.children = children || [];
3471 this.setAttribute("href", href);
3472 }
3473 setAttribute(attribute, value) {
3474 this.attributes[attribute] = value;
3475 }
3476 hasClass(className) {
3477 return utils.contains(this.classes, className);
3478 }
3479 toNode() {
3480 return toNode.call(this, "a");
3481 }
3482 toMarkup() {
3483 return toMarkup.call(this, "a");
3484 }
3485}
3486class Img {
3487 constructor(src, alt, style) {
3488 this.src = void 0;
3489 this.alt = void 0;
3490 this.classes = void 0;
3491 this.height = void 0;
3492 this.depth = void 0;
3493 this.maxFontSize = void 0;
3494 this.style = void 0;
3495 this.alt = alt;
3496 this.src = src;
3497 this.classes = ["mord"];
3498 this.style = style;
3499 }
3500 hasClass(className) {
3501 return utils.contains(this.classes, className);
3502 }
3503 toNode() {
3504 var node = document.createElement("img");
3505 node.src = this.src;
3506 node.alt = this.alt;
3507 node.className = "mord";
3508 for (var style in this.style) {
3509 if (this.style.hasOwnProperty(style)) {
3510 node.style[style] = this.style[style];
3511 }
3512 }
3513 return node;
3514 }
3515 toMarkup() {
3516 var markup = "<img src='" + this.src + " 'alt='" + this.alt + "' ";
3517 var styles2 = "";
3518 for (var style in this.style) {
3519 if (this.style.hasOwnProperty(style)) {
3520 styles2 += utils.hyphenate(style) + ":" + this.style[style] + ";";
3521 }
3522 }
3523 if (styles2) {
3524 markup += ' style="' + utils.escape(styles2) + '"';
3525 }
3526 markup += "'/>";
3527 return markup;
3528 }
3529}
3530var iCombinations = {
3531 "î": "ı̂",
3532 "ï": "ı̈",
3533 "í": "ı́",
3534 // 'ī': '\u0131\u0304', // enable when we add Extended Latin
3535 "ì": "ı̀"
3536};
3537class SymbolNode {
3538 constructor(text2, height, depth, italic, skew, width, classes, style) {
3539 this.text = void 0;
3540 this.height = void 0;
3541 this.depth = void 0;
3542 this.italic = void 0;
3543 this.skew = void 0;
3544 this.width = void 0;
3545 this.maxFontSize = void 0;
3546 this.classes = void 0;
3547 this.style = void 0;
3548 this.text = text2;
3549 this.height = height || 0;
3550 this.depth = depth || 0;
3551 this.italic = italic || 0;
3552 this.skew = skew || 0;
3553 this.width = width || 0;
3554 this.classes = classes || [];
3555 this.style = style || {};
3556 this.maxFontSize = 0;
3557 var script = scriptFromCodepoint(this.text.charCodeAt(0));
3558 if (script) {
3559 this.classes.push(script + "_fallback");
3560 }
3561 if (/[îïíì]/.test(this.text)) {
3562 this.text = iCombinations[this.text];
3563 }
3564 }
3565 hasClass(className) {
3566 return utils.contains(this.classes, className);
3567 }
3568 /**
3569 * Creates a text node or span from a symbol node. Note that a span is only
3570 * created if it is needed.
3571 */
3572 toNode() {
3573 var node = document.createTextNode(this.text);
3574 var span = null;
3575 if (this.italic > 0) {
3576 span = document.createElement("span");
3577 span.style.marginRight = makeEm(this.italic);
3578 }
3579 if (this.classes.length > 0) {
3580 span = span || document.createElement("span");
3581 span.className = createClass(this.classes);
3582 }
3583 for (var style in this.style) {
3584 if (this.style.hasOwnProperty(style)) {
3585 span = span || document.createElement("span");
3586 span.style[style] = this.style[style];
3587 }
3588 }
3589 if (span) {
3590 span.appendChild(node);
3591 return span;
3592 } else {
3593 return node;
3594 }
3595 }
3596 /**
3597 * Creates markup for a symbol node.
3598 */
3599 toMarkup() {
3600 var needsSpan = false;
3601 var markup = "<span";
3602 if (this.classes.length) {
3603 needsSpan = true;
3604 markup += ' class="';
3605 markup += utils.escape(createClass(this.classes));
3606 markup += '"';
3607 }
3608 var styles2 = "";
3609 if (this.italic > 0) {
3610 styles2 += "margin-right:" + this.italic + "em;";
3611 }
3612 for (var style in this.style) {
3613 if (this.style.hasOwnProperty(style)) {
3614 styles2 += utils.hyphenate(style) + ":" + this.style[style] + ";";
3615 }
3616 }
3617 if (styles2) {
3618 needsSpan = true;
3619 markup += ' style="' + utils.escape(styles2) + '"';
3620 }
3621 var escaped = utils.escape(this.text);
3622 if (needsSpan) {
3623 markup += ">";
3624 markup += escaped;
3625 markup += "</span>";
3626 return markup;
3627 } else {
3628 return escaped;
3629 }
3630 }
3631}
3632class SvgNode {
3633 constructor(children, attributes) {
3634 this.children = void 0;
3635 this.attributes = void 0;
3636 this.children = children || [];
3637 this.attributes = attributes || {};
3638 }
3639 toNode() {
3640 var svgNS = "http://www.w3.org/2000/svg";
3641 var node = document.createElementNS(svgNS, "svg");
3642 for (var attr in this.attributes) {
3643 if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
3644 node.setAttribute(attr, this.attributes[attr]);
3645 }
3646 }
3647 for (var i = 0; i < this.children.length; i++) {
3648 node.appendChild(this.children[i].toNode());
3649 }
3650 return node;
3651 }
3652 toMarkup() {
3653 var markup = '<svg xmlns="http://www.w3.org/2000/svg"';
3654 for (var attr in this.attributes) {
3655 if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
3656 markup += " " + attr + "='" + this.attributes[attr] + "'";
3657 }
3658 }
3659 markup += ">";
3660 for (var i = 0; i < this.children.length; i++) {
3661 markup += this.children[i].toMarkup();
3662 }
3663 markup += "</svg>";
3664 return markup;
3665 }
3666}
3667class PathNode {
3668 constructor(pathName, alternate) {
3669 this.pathName = void 0;
3670 this.alternate = void 0;
3671 this.pathName = pathName;
3672 this.alternate = alternate;
3673 }
3674 toNode() {
3675 var svgNS = "http://www.w3.org/2000/svg";
3676 var node = document.createElementNS(svgNS, "path");
3677 if (this.alternate) {
3678 node.setAttribute("d", this.alternate);
3679 } else {
3680 node.setAttribute("d", path[this.pathName]);
3681 }
3682 return node;
3683 }
3684 toMarkup() {
3685 if (this.alternate) {
3686 return "<path d='" + this.alternate + "'/>";
3687 } else {
3688 return "<path d='" + path[this.pathName] + "'/>";
3689 }
3690 }
3691}
3692class LineNode {
3693 constructor(attributes) {
3694 this.attributes = void 0;
3695 this.attributes = attributes || {};
3696 }
3697 toNode() {
3698 var svgNS = "http://www.w3.org/2000/svg";
3699 var node = document.createElementNS(svgNS, "line");
3700 for (var attr in this.attributes) {
3701 if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
3702 node.setAttribute(attr, this.attributes[attr]);
3703 }
3704 }
3705 return node;
3706 }
3707 toMarkup() {
3708 var markup = "<line";
3709 for (var attr in this.attributes) {
3710 if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
3711 markup += " " + attr + "='" + this.attributes[attr] + "'";
3712 }
3713 }
3714 markup += "/>";
3715 return markup;
3716 }
3717}
3718function assertSymbolDomNode(group) {
3719 if (group instanceof SymbolNode) {
3720 return group;
3721 } else {
3722 throw new Error("Expected symbolNode but got " + String(group) + ".");
3723 }
3724}
3725function assertSpan(group) {
3726 if (group instanceof Span) {
3727 return group;
3728 } else {
3729 throw new Error("Expected span<HtmlDomNode> but got " + String(group) + ".");
3730 }
3731}
3732var ATOMS = {
3733 "bin": 1,
3734 "close": 1,
3735 "inner": 1,
3736 "open": 1,
3737 "punct": 1,
3738 "rel": 1
3739};
3740var NON_ATOMS = {
3741 "accent-token": 1,
3742 "mathord": 1,
3743 "op-token": 1,
3744 "spacing": 1,
3745 "textord": 1
3746};
3747var symbols = {
3748 "math": {},
3749 "text": {}
3750};
3751function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) {
3752 symbols[mode][name] = {
3753 font,
3754 group,
3755 replace
3756 };
3757 if (acceptUnicodeChar && replace) {
3758 symbols[mode][replace] = symbols[mode][name];
3759 }
3760}
3761var math = "math";
3762var text = "text";
3763var main = "main";
3764var ams = "ams";
3765var accent = "accent-token";
3766var bin = "bin";
3767var close = "close";
3768var inner = "inner";
3769var mathord = "mathord";
3770var op = "op-token";
3771var open = "open";
3772var punct = "punct";
3773var rel = "rel";
3774var spacing = "spacing";
3775var textord = "textord";
3776defineSymbol(math, main, rel, "≡", "\\equiv", true);
3777defineSymbol(math, main, rel, "≺", "\\prec", true);
3778defineSymbol(math, main, rel, "≻", "\\succ", true);
3779defineSymbol(math, main, rel, "∼", "\\sim", true);
3780defineSymbol(math, main, rel, "⊥", "\\perp");
3781defineSymbol(math, main, rel, "⪯", "\\preceq", true);
3782defineSymbol(math, main, rel, "⪰", "\\succeq", true);
3783defineSymbol(math, main, rel, "≃", "\\simeq", true);
3784defineSymbol(math, main, rel, "∣", "\\mid", true);
3785defineSymbol(math, main, rel, "≪", "\\ll", true);
3786defineSymbol(math, main, rel, "≫", "\\gg", true);
3787defineSymbol(math, main, rel, "≍", "\\asymp", true);
3788defineSymbol(math, main, rel, "∥", "\\parallel");
3789defineSymbol(math, main, rel, "⋈", "\\bowtie", true);
3790defineSymbol(math, main, rel, "⌣", "\\smile", true);
3791defineSymbol(math, main, rel, "⊑", "\\sqsubseteq", true);
3792defineSymbol(math, main, rel, "⊒", "\\sqsupseteq", true);
3793defineSymbol(math, main, rel, "≐", "\\doteq", true);
3794defineSymbol(math, main, rel, "⌢", "\\frown", true);
3795defineSymbol(math, main, rel, "∋", "\\ni", true);
3796defineSymbol(math, main, rel, "∝", "\\propto", true);
3797defineSymbol(math, main, rel, "⊢", "\\vdash", true);
3798defineSymbol(math, main, rel, "⊣", "\\dashv", true);
3799defineSymbol(math, main, rel, "∋", "\\owns");
3800defineSymbol(math, main, punct, ".", "\\ldotp");
3801defineSymbol(math, main, punct, "⋅", "\\cdotp");
3802defineSymbol(math, main, textord, "#", "\\#");
3803defineSymbol(text, main, textord, "#", "\\#");
3804defineSymbol(math, main, textord, "&", "\\&");
3805defineSymbol(text, main, textord, "&", "\\&");
3806defineSymbol(math, main, textord, "ℵ", "\\aleph", true);
3807defineSymbol(math, main, textord, "∀", "\\forall", true);
3808defineSymbol(math, main, textord, "ℏ", "\\hbar", true);
3809defineSymbol(math, main, textord, "∃", "\\exists", true);
3810defineSymbol(math, main, textord, "∇", "\\nabla", true);
3811defineSymbol(math, main, textord, "♭", "\\flat", true);
3812defineSymbol(math, main, textord, "ℓ", "\\ell", true);
3813defineSymbol(math, main, textord, "♮", "\\natural", true);
3814defineSymbol(math, main, textord, "♣", "\\clubsuit", true);
3815defineSymbol(math, main, textord, "℘", "\\wp", true);
3816defineSymbol(math, main, textord, "♯", "\\sharp", true);
3817defineSymbol(math, main, textord, "♢", "\\diamondsuit", true);
3818defineSymbol(math, main, textord, "ℜ", "\\Re", true);
3819defineSymbol(math, main, textord, "♡", "\\heartsuit", true);
3820defineSymbol(math, main, textord, "ℑ", "\\Im", true);
3821defineSymbol(math, main, textord, "♠", "\\spadesuit", true);
3822defineSymbol(math, main, textord, "§", "\\S", true);
3823defineSymbol(text, main, textord, "§", "\\S");
3824defineSymbol(math, main, textord, "¶", "\\P", true);
3825defineSymbol(text, main, textord, "¶", "\\P");
3826defineSymbol(math, main, textord, "†", "\\dag");
3827defineSymbol(text, main, textord, "†", "\\dag");
3828defineSymbol(text, main, textord, "†", "\\textdagger");
3829defineSymbol(math, main, textord, "‡", "\\ddag");
3830defineSymbol(text, main, textord, "‡", "\\ddag");
3831defineSymbol(text, main, textord, "‡", "\\textdaggerdbl");
3832defineSymbol(math, main, close, "⎱", "\\rmoustache", true);
3833defineSymbol(math, main, open, "⎰", "\\lmoustache", true);
3834defineSymbol(math, main, close, "⟯", "\\rgroup", true);
3835defineSymbol(math, main, open, "⟮", "\\lgroup", true);
3836defineSymbol(math, main, bin, "∓", "\\mp", true);
3837defineSymbol(math, main, bin, "⊖", "\\ominus", true);
3838defineSymbol(math, main, bin, "⊎", "\\uplus", true);
3839defineSymbol(math, main, bin, "⊓", "\\sqcap", true);
3840defineSymbol(math, main, bin, "∗", "\\ast");
3841defineSymbol(math, main, bin, "⊔", "\\sqcup", true);
3842defineSymbol(math, main, bin, "◯", "\\bigcirc", true);
3843defineSymbol(math, main, bin, "∙", "\\bullet", true);
3844defineSymbol(math, main, bin, "‡", "\\ddagger");
3845defineSymbol(math, main, bin, "≀", "\\wr", true);
3846defineSymbol(math, main, bin, "⨿", "\\amalg");
3847defineSymbol(math, main, bin, "&", "\\And");
3848defineSymbol(math, main, rel, "⟵", "\\longleftarrow", true);
3849defineSymbol(math, main, rel, "⇐", "\\Leftarrow", true);
3850defineSymbol(math, main, rel, "⟸", "\\Longleftarrow", true);
3851defineSymbol(math, main, rel, "⟶", "\\longrightarrow", true);
3852defineSymbol(math, main, rel, "⇒", "\\Rightarrow", true);
3853defineSymbol(math, main, rel, "⟹", "\\Longrightarrow", true);
3854defineSymbol(math, main, rel, "↔", "\\leftrightarrow", true);
3855defineSymbol(math, main, rel, "⟷", "\\longleftrightarrow", true);
3856defineSymbol(math, main, rel, "⇔", "\\Leftrightarrow", true);
3857defineSymbol(math, main, rel, "⟺", "\\Longleftrightarrow", true);
3858defineSymbol(math, main, rel, "↦", "\\mapsto", true);
3859defineSymbol(math, main, rel, "⟼", "\\longmapsto", true);
3860defineSymbol(math, main, rel, "↗", "\\nearrow", true);
3861defineSymbol(math, main, rel, "↩", "\\hookleftarrow", true);
3862defineSymbol(math, main, rel, "↪", "\\hookrightarrow", true);
3863defineSymbol(math, main, rel, "↘", "\\searrow", true);
3864defineSymbol(math, main, rel, "↼", "\\leftharpoonup", true);
3865defineSymbol(math, main, rel, "⇀", "\\rightharpoonup", true);
3866defineSymbol(math, main, rel, "↙", "\\swarrow", true);
3867defineSymbol(math, main, rel, "↽", "\\leftharpoondown", true);
3868defineSymbol(math, main, rel, "⇁", "\\rightharpoondown", true);
3869defineSymbol(math, main, rel, "↖", "\\nwarrow", true);
3870defineSymbol(math, main, rel, "⇌", "\\rightleftharpoons", true);
3871defineSymbol(math, ams, rel, "≮", "\\nless", true);
3872defineSymbol(math, ams, rel, "", "\\@nleqslant");
3873defineSymbol(math, ams, rel, "", "\\@nleqq");
3874defineSymbol(math, ams, rel, "⪇", "\\lneq", true);
3875defineSymbol(math, ams, rel, "≨", "\\lneqq", true);
3876defineSymbol(math, ams, rel, "", "\\@lvertneqq");
3877defineSymbol(math, ams, rel, "⋦", "\\lnsim", true);
3878defineSymbol(math, ams, rel, "⪉", "\\lnapprox", true);
3879defineSymbol(math, ams, rel, "⊀", "\\nprec", true);
3880defineSymbol(math, ams, rel, "⋠", "\\npreceq", true);
3881defineSymbol(math, ams, rel, "⋨", "\\precnsim", true);
3882defineSymbol(math, ams, rel, "⪹", "\\precnapprox", true);
3883defineSymbol(math, ams, rel, "≁", "\\nsim", true);
3884defineSymbol(math, ams, rel, "", "\\@nshortmid");
3885defineSymbol(math, ams, rel, "∤", "\\nmid", true);
3886defineSymbol(math, ams, rel, "⊬", "\\nvdash", true);
3887defineSymbol(math, ams, rel, "⊭", "\\nvDash", true);
3888defineSymbol(math, ams, rel, "⋪", "\\ntriangleleft");
3889defineSymbol(math, ams, rel, "⋬", "\\ntrianglelefteq", true);
3890defineSymbol(math, ams, rel, "⊊", "\\subsetneq", true);
3891defineSymbol(math, ams, rel, "", "\\@varsubsetneq");
3892defineSymbol(math, ams, rel, "⫋", "\\subsetneqq", true);
3893defineSymbol(math, ams, rel, "", "\\@varsubsetneqq");
3894defineSymbol(math, ams, rel, "≯", "\\ngtr", true);
3895defineSymbol(math, ams, rel, "", "\\@ngeqslant");
3896defineSymbol(math, ams, rel, "", "\\@ngeqq");
3897defineSymbol(math, ams, rel, "⪈", "\\gneq", true);
3898defineSymbol(math, ams, rel, "≩", "\\gneqq", true);
3899defineSymbol(math, ams, rel, "", "\\@gvertneqq");
3900defineSymbol(math, ams, rel, "⋧", "\\gnsim", true);
3901defineSymbol(math, ams, rel, "⪊", "\\gnapprox", true);
3902defineSymbol(math, ams, rel, "⊁", "\\nsucc", true);
3903defineSymbol(math, ams, rel, "⋡", "\\nsucceq", true);
3904defineSymbol(math, ams, rel, "⋩", "\\succnsim", true);
3905defineSymbol(math, ams, rel, "⪺", "\\succnapprox", true);
3906defineSymbol(math, ams, rel, "≆", "\\ncong", true);
3907defineSymbol(math, ams, rel, "", "\\@nshortparallel");
3908defineSymbol(math, ams, rel, "∦", "\\nparallel", true);
3909defineSymbol(math, ams, rel, "⊯", "\\nVDash", true);
3910defineSymbol(math, ams, rel, "⋫", "\\ntriangleright");
3911defineSymbol(math, ams, rel, "⋭", "\\ntrianglerighteq", true);
3912defineSymbol(math, ams, rel, "", "\\@nsupseteqq");
3913defineSymbol(math, ams, rel, "⊋", "\\supsetneq", true);
3914defineSymbol(math, ams, rel, "", "\\@varsupsetneq");
3915defineSymbol(math, ams, rel, "⫌", "\\supsetneqq", true);
3916defineSymbol(math, ams, rel, "", "\\@varsupsetneqq");
3917defineSymbol(math, ams, rel, "⊮", "\\nVdash", true);
3918defineSymbol(math, ams, rel, "⪵", "\\precneqq", true);
3919defineSymbol(math, ams, rel, "⪶", "\\succneqq", true);
3920defineSymbol(math, ams, rel, "", "\\@nsubseteqq");
3921defineSymbol(math, ams, bin, "⊴", "\\unlhd");
3922defineSymbol(math, ams, bin, "⊵", "\\unrhd");
3923defineSymbol(math, ams, rel, "↚", "\\nleftarrow", true);
3924defineSymbol(math, ams, rel, "↛", "\\nrightarrow", true);
3925defineSymbol(math, ams, rel, "⇍", "\\nLeftarrow", true);
3926defineSymbol(math, ams, rel, "⇏", "\\nRightarrow", true);
3927defineSymbol(math, ams, rel, "↮", "\\nleftrightarrow", true);
3928defineSymbol(math, ams, rel, "⇎", "\\nLeftrightarrow", true);
3929defineSymbol(math, ams, rel, "△", "\\vartriangle");
3930defineSymbol(math, ams, textord, "ℏ", "\\hslash");
3931defineSymbol(math, ams, textord, "▽", "\\triangledown");
3932defineSymbol(math, ams, textord, "◊", "\\lozenge");
3933defineSymbol(math, ams, textord, "Ⓢ", "\\circledS");
3934defineSymbol(math, ams, textord, "®", "\\circledR");
3935defineSymbol(text, ams, textord, "®", "\\circledR");
3936defineSymbol(math, ams, textord, "∡", "\\measuredangle", true);
3937defineSymbol(math, ams, textord, "∄", "\\nexists");
3938defineSymbol(math, ams, textord, "℧", "\\mho");
3939defineSymbol(math, ams, textord, "Ⅎ", "\\Finv", true);
3940defineSymbol(math, ams, textord, "⅁", "\\Game", true);
3941defineSymbol(math, ams, textord, "‵", "\\backprime");
3942defineSymbol(math, ams, textord, "▲", "\\blacktriangle");
3943defineSymbol(math, ams, textord, "▼", "\\blacktriangledown");
3944defineSymbol(math, ams, textord, "■", "\\blacksquare");
3945defineSymbol(math, ams, textord, "⧫", "\\blacklozenge");
3946defineSymbol(math, ams, textord, "★", "\\bigstar");
3947defineSymbol(math, ams, textord, "∢", "\\sphericalangle", true);
3948defineSymbol(math, ams, textord, "∁", "\\complement", true);
3949defineSymbol(math, ams, textord, "ð", "\\eth", true);
3950defineSymbol(text, main, textord, "ð", "ð");
3951defineSymbol(math, ams, textord, "╱", "\\diagup");
3952defineSymbol(math, ams, textord, "╲", "\\diagdown");
3953defineSymbol(math, ams, textord, "□", "\\square");
3954defineSymbol(math, ams, textord, "□", "\\Box");
3955defineSymbol(math, ams, textord, "◊", "\\Diamond");
3956defineSymbol(math, ams, textord, "¥", "\\yen", true);
3957defineSymbol(text, ams, textord, "¥", "\\yen", true);
3958defineSymbol(math, ams, textord, "✓", "\\checkmark", true);
3959defineSymbol(text, ams, textord, "✓", "\\checkmark");
3960defineSymbol(math, ams, textord, "ℶ", "\\beth", true);
3961defineSymbol(math, ams, textord, "ℸ", "\\daleth", true);
3962defineSymbol(math, ams, textord, "ℷ", "\\gimel", true);
3963defineSymbol(math, ams, textord, "ϝ", "\\digamma", true);
3964defineSymbol(math, ams, textord, "ϰ", "\\varkappa");
3965defineSymbol(math, ams, open, "┌", "\\@ulcorner", true);
3966defineSymbol(math, ams, close, "┐", "\\@urcorner", true);
3967defineSymbol(math, ams, open, "└", "\\@llcorner", true);
3968defineSymbol(math, ams, close, "┘", "\\@lrcorner", true);
3969defineSymbol(math, ams, rel, "≦", "\\leqq", true);
3970defineSymbol(math, ams, rel, "⩽", "\\leqslant", true);
3971defineSymbol(math, ams, rel, "⪕", "\\eqslantless", true);
3972defineSymbol(math, ams, rel, "≲", "\\lesssim", true);
3973defineSymbol(math, ams, rel, "⪅", "\\lessapprox", true);
3974defineSymbol(math, ams, rel, "≊", "\\approxeq", true);
3975defineSymbol(math, ams, bin, "⋖", "\\lessdot");
3976defineSymbol(math, ams, rel, "⋘", "\\lll", true);
3977defineSymbol(math, ams, rel, "≶", "\\lessgtr", true);
3978defineSymbol(math, ams, rel, "⋚", "\\lesseqgtr", true);
3979defineSymbol(math, ams, rel, "⪋", "\\lesseqqgtr", true);
3980defineSymbol(math, ams, rel, "≑", "\\doteqdot");
3981defineSymbol(math, ams, rel, "≓", "\\risingdotseq", true);
3982defineSymbol(math, ams, rel, "≒", "\\fallingdotseq", true);
3983defineSymbol(math, ams, rel, "∽", "\\backsim", true);
3984defineSymbol(math, ams, rel, "⋍", "\\backsimeq", true);
3985defineSymbol(math, ams, rel, "⫅", "\\subseteqq", true);
3986defineSymbol(math, ams, rel, "⋐", "\\Subset", true);
3987defineSymbol(math, ams, rel, "⊏", "\\sqsubset", true);
3988defineSymbol(math, ams, rel, "≼", "\\preccurlyeq", true);
3989defineSymbol(math, ams, rel, "⋞", "\\curlyeqprec", true);
3990defineSymbol(math, ams, rel, "≾", "\\precsim", true);
3991defineSymbol(math, ams, rel, "⪷", "\\precapprox", true);
3992defineSymbol(math, ams, rel, "⊲", "\\vartriangleleft");
3993defineSymbol(math, ams, rel, "⊴", "\\trianglelefteq");
3994defineSymbol(math, ams, rel, "⊨", "\\vDash", true);
3995defineSymbol(math, ams, rel, "⊪", "\\Vvdash", true);
3996defineSymbol(math, ams, rel, "⌣", "\\smallsmile");
3997defineSymbol(math, ams, rel, "⌢", "\\smallfrown");
3998defineSymbol(math, ams, rel, "≏", "\\bumpeq", true);
3999defineSymbol(math, ams, rel, "≎", "\\Bumpeq", true);
4000defineSymbol(math, ams, rel, "≧", "\\geqq", true);
4001defineSymbol(math, ams, rel, "⩾", "\\geqslant", true);
4002defineSymbol(math, ams, rel, "⪖", "\\eqslantgtr", true);
4003defineSymbol(math, ams, rel, "≳", "\\gtrsim", true);
4004defineSymbol(math, ams, rel, "⪆", "\\gtrapprox", true);
4005defineSymbol(math, ams, bin, "⋗", "\\gtrdot");
4006defineSymbol(math, ams, rel, "⋙", "\\ggg", true);
4007defineSymbol(math, ams, rel, "≷", "\\gtrless", true);
4008defineSymbol(math, ams, rel, "⋛", "\\gtreqless", true);
4009defineSymbol(math, ams, rel, "⪌", "\\gtreqqless", true);
4010defineSymbol(math, ams, rel, "≖", "\\eqcirc", true);
4011defineSymbol(math, ams, rel, "≗", "\\circeq", true);
4012defineSymbol(math, ams, rel, "≜", "\\triangleq", true);
4013defineSymbol(math, ams, rel, "∼", "\\thicksim");
4014defineSymbol(math, ams, rel, "≈", "\\thickapprox");
4015defineSymbol(math, ams, rel, "⫆", "\\supseteqq", true);
4016defineSymbol(math, ams, rel, "⋑", "\\Supset", true);
4017defineSymbol(math, ams, rel, "⊐", "\\sqsupset", true);
4018defineSymbol(math, ams, rel, "≽", "\\succcurlyeq", true);
4019defineSymbol(math, ams, rel, "⋟", "\\curlyeqsucc", true);
4020defineSymbol(math, ams, rel, "≿", "\\succsim", true);
4021defineSymbol(math, ams, rel, "⪸", "\\succapprox", true);
4022defineSymbol(math, ams, rel, "⊳", "\\vartriangleright");
4023defineSymbol(math, ams, rel, "⊵", "\\trianglerighteq");
4024defineSymbol(math, ams, rel, "⊩", "\\Vdash", true);
4025defineSymbol(math, ams, rel, "∣", "\\shortmid");
4026defineSymbol(math, ams, rel, "∥", "\\shortparallel");
4027defineSymbol(math, ams, rel, "≬", "\\between", true);
4028defineSymbol(math, ams, rel, "⋔", "\\pitchfork", true);
4029defineSymbol(math, ams, rel, "∝", "\\varpropto");
4030defineSymbol(math, ams, rel, "◀", "\\blacktriangleleft");
4031defineSymbol(math, ams, rel, "∴", "\\therefore", true);
4032defineSymbol(math, ams, rel, "∍", "\\backepsilon");
4033defineSymbol(math, ams, rel, "▶", "\\blacktriangleright");
4034defineSymbol(math, ams, rel, "∵", "\\because", true);
4035defineSymbol(math, ams, rel, "⋘", "\\llless");
4036defineSymbol(math, ams, rel, "⋙", "\\gggtr");
4037defineSymbol(math, ams, bin, "⊲", "\\lhd");
4038defineSymbol(math, ams, bin, "⊳", "\\rhd");
4039defineSymbol(math, ams, rel, "≂", "\\eqsim", true);
4040defineSymbol(math, main, rel, "⋈", "\\Join");
4041defineSymbol(math, ams, rel, "≑", "\\Doteq", true);
4042defineSymbol(math, ams, bin, "∔", "\\dotplus", true);
4043defineSymbol(math, ams, bin, "∖", "\\smallsetminus");
4044defineSymbol(math, ams, bin, "⋒", "\\Cap", true);
4045defineSymbol(math, ams, bin, "⋓", "\\Cup", true);
4046defineSymbol(math, ams, bin, "⩞", "\\doublebarwedge", true);
4047defineSymbol(math, ams, bin, "⊟", "\\boxminus", true);
4048defineSymbol(math, ams, bin, "⊞", "\\boxplus", true);
4049defineSymbol(math, ams, bin, "⋇", "\\divideontimes", true);
4050defineSymbol(math, ams, bin, "⋉", "\\ltimes", true);
4051defineSymbol(math, ams, bin, "⋊", "\\rtimes", true);
4052defineSymbol(math, ams, bin, "⋋", "\\leftthreetimes", true);
4053defineSymbol(math, ams, bin, "⋌", "\\rightthreetimes", true);
4054defineSymbol(math, ams, bin, "⋏", "\\curlywedge", true);
4055defineSymbol(math, ams, bin, "⋎", "\\curlyvee", true);
4056defineSymbol(math, ams, bin, "⊝", "\\circleddash", true);
4057defineSymbol(math, ams, bin, "⊛", "\\circledast", true);
4058defineSymbol(math, ams, bin, "⋅", "\\centerdot");
4059defineSymbol(math, ams, bin, "⊺", "\\intercal", true);
4060defineSymbol(math, ams, bin, "⋒", "\\doublecap");
4061defineSymbol(math, ams, bin, "⋓", "\\doublecup");
4062defineSymbol(math, ams, bin, "⊠", "\\boxtimes", true);
4063defineSymbol(math, ams, rel, "⇢", "\\dashrightarrow", true);
4064defineSymbol(math, ams, rel, "⇠", "\\dashleftarrow", true);
4065defineSymbol(math, ams, rel, "⇇", "\\leftleftarrows", true);
4066defineSymbol(math, ams, rel, "⇆", "\\leftrightarrows", true);
4067defineSymbol(math, ams, rel, "⇚", "\\Lleftarrow", true);
4068defineSymbol(math, ams, rel, "↞", "\\twoheadleftarrow", true);
4069defineSymbol(math, ams, rel, "↢", "\\leftarrowtail", true);
4070defineSymbol(math, ams, rel, "↫", "\\looparrowleft", true);
4071defineSymbol(math, ams, rel, "⇋", "\\leftrightharpoons", true);
4072defineSymbol(math, ams, rel, "↶", "\\curvearrowleft", true);
4073defineSymbol(math, ams, rel, "↺", "\\circlearrowleft", true);
4074defineSymbol(math, ams, rel, "↰", "\\Lsh", true);
4075defineSymbol(math, ams, rel, "⇈", "\\upuparrows", true);
4076defineSymbol(math, ams, rel, "↿", "\\upharpoonleft", true);
4077defineSymbol(math, ams, rel, "⇃", "\\downharpoonleft", true);
4078defineSymbol(math, main, rel, "⊶", "\\origof", true);
4079defineSymbol(math, main, rel, "⊷", "\\imageof", true);
4080defineSymbol(math, ams, rel, "⊸", "\\multimap", true);
4081defineSymbol(math, ams, rel, "↭", "\\leftrightsquigarrow", true);
4082defineSymbol(math, ams, rel, "⇉", "\\rightrightarrows", true);
4083defineSymbol(math, ams, rel, "⇄", "\\rightleftarrows", true);
4084defineSymbol(math, ams, rel, "↠", "\\twoheadrightarrow", true);
4085defineSymbol(math, ams, rel, "↣", "\\rightarrowtail", true);
4086defineSymbol(math, ams, rel, "↬", "\\looparrowright", true);
4087defineSymbol(math, ams, rel, "↷", "\\curvearrowright", true);
4088defineSymbol(math, ams, rel, "↻", "\\circlearrowright", true);
4089defineSymbol(math, ams, rel, "↱", "\\Rsh", true);
4090defineSymbol(math, ams, rel, "⇊", "\\downdownarrows", true);
4091defineSymbol(math, ams, rel, "↾", "\\upharpoonright", true);
4092defineSymbol(math, ams, rel, "⇂", "\\downharpoonright", true);
4093defineSymbol(math, ams, rel, "⇝", "\\rightsquigarrow", true);
4094defineSymbol(math, ams, rel, "⇝", "\\leadsto");
4095defineSymbol(math, ams, rel, "⇛", "\\Rrightarrow", true);
4096defineSymbol(math, ams, rel, "↾", "\\restriction");
4097defineSymbol(math, main, textord, "‘", "`");
4098defineSymbol(math, main, textord, "$", "\\$");
4099defineSymbol(text, main, textord, "$", "\\$");
4100defineSymbol(text, main, textord, "$", "\\textdollar");
4101defineSymbol(math, main, textord, "%", "\\%");
4102defineSymbol(text, main, textord, "%", "\\%");
4103defineSymbol(math, main, textord, "_", "\\_");
4104defineSymbol(text, main, textord, "_", "\\_");
4105defineSymbol(text, main, textord, "_", "\\textunderscore");
4106defineSymbol(math, main, textord, "∠", "\\angle", true);
4107defineSymbol(math, main, textord, "∞", "\\infty", true);
4108defineSymbol(math, main, textord, "′", "\\prime");
4109defineSymbol(math, main, textord, "△", "\\triangle");
4110defineSymbol(math, main, textord, "Γ", "\\Gamma", true);
4111defineSymbol(math, main, textord, "Δ", "\\Delta", true);
4112defineSymbol(math, main, textord, "Θ", "\\Theta", true);
4113defineSymbol(math, main, textord, "Λ", "\\Lambda", true);
4114defineSymbol(math, main, textord, "Ξ", "\\Xi", true);
4115defineSymbol(math, main, textord, "Π", "\\Pi", true);
4116defineSymbol(math, main, textord, "Σ", "\\Sigma", true);
4117defineSymbol(math, main, textord, "Υ", "\\Upsilon", true);
4118defineSymbol(math, main, textord, "Φ", "\\Phi", true);
4119defineSymbol(math, main, textord, "Ψ", "\\Psi", true);
4120defineSymbol(math, main, textord, "Ω", "\\Omega", true);
4121defineSymbol(math, main, textord, "A", "Α");
4122defineSymbol(math, main, textord, "B", "Β");
4123defineSymbol(math, main, textord, "E", "Ε");
4124defineSymbol(math, main, textord, "Z", "Ζ");
4125defineSymbol(math, main, textord, "H", "Η");
4126defineSymbol(math, main, textord, "I", "Ι");
4127defineSymbol(math, main, textord, "K", "Κ");
4128defineSymbol(math, main, textord, "M", "Μ");
4129defineSymbol(math, main, textord, "N", "Ν");
4130defineSymbol(math, main, textord, "O", "Ο");
4131defineSymbol(math, main, textord, "P", "Ρ");
4132defineSymbol(math, main, textord, "T", "Τ");
4133defineSymbol(math, main, textord, "X", "Χ");
4134defineSymbol(math, main, textord, "¬", "\\neg", true);
4135defineSymbol(math, main, textord, "¬", "\\lnot");
4136defineSymbol(math, main, textord, "⊤", "\\top");
4137defineSymbol(math, main, textord, "⊥", "\\bot");
4138defineSymbol(math, main, textord, "∅", "\\emptyset");
4139defineSymbol(math, ams, textord, "∅", "\\varnothing");
4140defineSymbol(math, main, mathord, "α", "\\alpha", true);
4141defineSymbol(math, main, mathord, "β", "\\beta", true);
4142defineSymbol(math, main, mathord, "γ", "\\gamma", true);
4143defineSymbol(math, main, mathord, "δ", "\\delta", true);
4144defineSymbol(math, main, mathord, "ϵ", "\\epsilon", true);
4145defineSymbol(math, main, mathord, "ζ", "\\zeta", true);
4146defineSymbol(math, main, mathord, "η", "\\eta", true);
4147defineSymbol(math, main, mathord, "θ", "\\theta", true);
4148defineSymbol(math, main, mathord, "ι", "\\iota", true);
4149defineSymbol(math, main, mathord, "κ", "\\kappa", true);
4150defineSymbol(math, main, mathord, "λ", "\\lambda", true);
4151defineSymbol(math, main, mathord, "μ", "\\mu", true);
4152defineSymbol(math, main, mathord, "ν", "\\nu", true);
4153defineSymbol(math, main, mathord, "ξ", "\\xi", true);
4154defineSymbol(math, main, mathord, "ο", "\\omicron", true);
4155defineSymbol(math, main, mathord, "π", "\\pi", true);
4156defineSymbol(math, main, mathord, "ρ", "\\rho", true);
4157defineSymbol(math, main, mathord, "σ", "\\sigma", true);
4158defineSymbol(math, main, mathord, "τ", "\\tau", true);
4159defineSymbol(math, main, mathord, "υ", "\\upsilon", true);
4160defineSymbol(math, main, mathord, "ϕ", "\\phi", true);
4161defineSymbol(math, main, mathord, "χ", "\\chi", true);
4162defineSymbol(math, main, mathord, "ψ", "\\psi", true);
4163defineSymbol(math, main, mathord, "ω", "\\omega", true);
4164defineSymbol(math, main, mathord, "ε", "\\varepsilon", true);
4165defineSymbol(math, main, mathord, "ϑ", "\\vartheta", true);
4166defineSymbol(math, main, mathord, "ϖ", "\\varpi", true);
4167defineSymbol(math, main, mathord, "ϱ", "\\varrho", true);
4168defineSymbol(math, main, mathord, "ς", "\\varsigma", true);
4169defineSymbol(math, main, mathord, "φ", "\\varphi", true);
4170defineSymbol(math, main, bin, "∗", "*", true);
4171defineSymbol(math, main, bin, "+", "+");
4172defineSymbol(math, main, bin, "−", "-", true);
4173defineSymbol(math, main, bin, "⋅", "\\cdot", true);
4174defineSymbol(math, main, bin, "∘", "\\circ", true);
4175defineSymbol(math, main, bin, "÷", "\\div", true);
4176defineSymbol(math, main, bin, "±", "\\pm", true);
4177defineSymbol(math, main, bin, "×", "\\times", true);
4178defineSymbol(math, main, bin, "∩", "\\cap", true);
4179defineSymbol(math, main, bin, "∪", "\\cup", true);
4180defineSymbol(math, main, bin, "∖", "\\setminus", true);
4181defineSymbol(math, main, bin, "∧", "\\land");
4182defineSymbol(math, main, bin, "∨", "\\lor");
4183defineSymbol(math, main, bin, "∧", "\\wedge", true);
4184defineSymbol(math, main, bin, "∨", "\\vee", true);
4185defineSymbol(math, main, textord, "√", "\\surd");
4186defineSymbol(math, main, open, "⟨", "\\langle", true);
4187defineSymbol(math, main, open, "∣", "\\lvert");
4188defineSymbol(math, main, open, "∥", "\\lVert");
4189defineSymbol(math, main, close, "?", "?");
4190defineSymbol(math, main, close, "!", "!");
4191defineSymbol(math, main, close, "⟩", "\\rangle", true);
4192defineSymbol(math, main, close, "∣", "\\rvert");
4193defineSymbol(math, main, close, "∥", "\\rVert");
4194defineSymbol(math, main, rel, "=", "=");
4195defineSymbol(math, main, rel, ":", ":");
4196defineSymbol(math, main, rel, "≈", "\\approx", true);
4197defineSymbol(math, main, rel, "≅", "\\cong", true);
4198defineSymbol(math, main, rel, "≥", "\\ge");
4199defineSymbol(math, main, rel, "≥", "\\geq", true);
4200defineSymbol(math, main, rel, "←", "\\gets");
4201defineSymbol(math, main, rel, ">", "\\gt", true);
4202defineSymbol(math, main, rel, "∈", "\\in", true);
4203defineSymbol(math, main, rel, "", "\\@not");
4204defineSymbol(math, main, rel, "⊂", "\\subset", true);
4205defineSymbol(math, main, rel, "⊃", "\\supset", true);
4206defineSymbol(math, main, rel, "⊆", "\\subseteq", true);
4207defineSymbol(math, main, rel, "⊇", "\\supseteq", true);
4208defineSymbol(math, ams, rel, "⊈", "\\nsubseteq", true);
4209defineSymbol(math, ams, rel, "⊉", "\\nsupseteq", true);
4210defineSymbol(math, main, rel, "⊨", "\\models");
4211defineSymbol(math, main, rel, "←", "\\leftarrow", true);
4212defineSymbol(math, main, rel, "≤", "\\le");
4213defineSymbol(math, main, rel, "≤", "\\leq", true);
4214defineSymbol(math, main, rel, "<", "\\lt", true);
4215defineSymbol(math, main, rel, "→", "\\rightarrow", true);
4216defineSymbol(math, main, rel, "→", "\\to");
4217defineSymbol(math, ams, rel, "≱", "\\ngeq", true);
4218defineSymbol(math, ams, rel, "≰", "\\nleq", true);
4219defineSymbol(math, main, spacing, " ", "\\ ");
4220defineSymbol(math, main, spacing, " ", "\\space");
4221defineSymbol(math, main, spacing, " ", "\\nobreakspace");
4222defineSymbol(text, main, spacing, " ", "\\ ");
4223defineSymbol(text, main, spacing, " ", " ");
4224defineSymbol(text, main, spacing, " ", "\\space");
4225defineSymbol(text, main, spacing, " ", "\\nobreakspace");
4226defineSymbol(math, main, spacing, null, "\\nobreak");
4227defineSymbol(math, main, spacing, null, "\\allowbreak");
4228defineSymbol(math, main, punct, ",", ",");
4229defineSymbol(math, main, punct, ";", ";");
4230defineSymbol(math, ams, bin, "⊼", "\\barwedge", true);
4231defineSymbol(math, ams, bin, "⊻", "\\veebar", true);
4232defineSymbol(math, main, bin, "⊙", "\\odot", true);
4233defineSymbol(math, main, bin, "⊕", "\\oplus", true);
4234defineSymbol(math, main, bin, "⊗", "\\otimes", true);
4235defineSymbol(math, main, textord, "∂", "\\partial", true);
4236defineSymbol(math, main, bin, "⊘", "\\oslash", true);
4237defineSymbol(math, ams, bin, "⊚", "\\circledcirc", true);
4238defineSymbol(math, ams, bin, "⊡", "\\boxdot", true);
4239defineSymbol(math, main, bin, "△", "\\bigtriangleup");
4240defineSymbol(math, main, bin, "▽", "\\bigtriangledown");
4241defineSymbol(math, main, bin, "†", "\\dagger");
4242defineSymbol(math, main, bin, "⋄", "\\diamond");
4243defineSymbol(math, main, bin, "⋆", "\\star");
4244defineSymbol(math, main, bin, "◃", "\\triangleleft");
4245defineSymbol(math, main, bin, "▹", "\\triangleright");
4246defineSymbol(math, main, open, "{", "\\{");
4247defineSymbol(text, main, textord, "{", "\\{");
4248defineSymbol(text, main, textord, "{", "\\textbraceleft");
4249defineSymbol(math, main, close, "}", "\\}");
4250defineSymbol(text, main, textord, "}", "\\}");
4251defineSymbol(text, main, textord, "}", "\\textbraceright");
4252defineSymbol(math, main, open, "{", "\\lbrace");
4253defineSymbol(math, main, close, "}", "\\rbrace");
4254defineSymbol(math, main, open, "[", "\\lbrack", true);
4255defineSymbol(text, main, textord, "[", "\\lbrack", true);
4256defineSymbol(math, main, close, "]", "\\rbrack", true);
4257defineSymbol(text, main, textord, "]", "\\rbrack", true);
4258defineSymbol(math, main, open, "(", "\\lparen", true);
4259defineSymbol(math, main, close, ")", "\\rparen", true);
4260defineSymbol(text, main, textord, "<", "\\textless", true);
4261defineSymbol(text, main, textord, ">", "\\textgreater", true);
4262defineSymbol(math, main, open, "⌊", "\\lfloor", true);
4263defineSymbol(math, main, close, "⌋", "\\rfloor", true);
4264defineSymbol(math, main, open, "⌈", "\\lceil", true);
4265defineSymbol(math, main, close, "⌉", "\\rceil", true);
4266defineSymbol(math, main, textord, "\\", "\\backslash");
4267defineSymbol(math, main, textord, "∣", "|");
4268defineSymbol(math, main, textord, "∣", "\\vert");
4269defineSymbol(text, main, textord, "|", "\\textbar", true);
4270defineSymbol(math, main, textord, "∥", "\\|");
4271defineSymbol(math, main, textord, "∥", "\\Vert");
4272defineSymbol(text, main, textord, "∥", "\\textbardbl");
4273defineSymbol(text, main, textord, "~", "\\textasciitilde");
4274defineSymbol(text, main, textord, "\\", "\\textbackslash");
4275defineSymbol(text, main, textord, "^", "\\textasciicircum");
4276defineSymbol(math, main, rel, "↑", "\\uparrow", true);
4277defineSymbol(math, main, rel, "⇑", "\\Uparrow", true);
4278defineSymbol(math, main, rel, "↓", "\\downarrow", true);
4279defineSymbol(math, main, rel, "⇓", "\\Downarrow", true);
4280defineSymbol(math, main, rel, "↕", "\\updownarrow", true);
4281defineSymbol(math, main, rel, "⇕", "\\Updownarrow", true);
4282defineSymbol(math, main, op, "∐", "\\coprod");
4283defineSymbol(math, main, op, "⋁", "\\bigvee");
4284defineSymbol(math, main, op, "⋀", "\\bigwedge");
4285defineSymbol(math, main, op, "⨄", "\\biguplus");
4286defineSymbol(math, main, op, "⋂", "\\bigcap");
4287defineSymbol(math, main, op, "⋃", "\\bigcup");
4288defineSymbol(math, main, op, "∫", "\\int");
4289defineSymbol(math, main, op, "∫", "\\intop");
4290defineSymbol(math, main, op, "∬", "\\iint");
4291defineSymbol(math, main, op, "∭", "\\iiint");
4292defineSymbol(math, main, op, "∏", "\\prod");
4293defineSymbol(math, main, op, "∑", "\\sum");
4294defineSymbol(math, main, op, "⨂", "\\bigotimes");
4295defineSymbol(math, main, op, "⨁", "\\bigoplus");
4296defineSymbol(math, main, op, "⨀", "\\bigodot");
4297defineSymbol(math, main, op, "∮", "\\oint");
4298defineSymbol(math, main, op, "∯", "\\oiint");
4299defineSymbol(math, main, op, "∰", "\\oiiint");
4300defineSymbol(math, main, op, "⨆", "\\bigsqcup");
4301defineSymbol(math, main, op, "∫", "\\smallint");
4302defineSymbol(text, main, inner, "…", "\\textellipsis");
4303defineSymbol(math, main, inner, "…", "\\mathellipsis");
4304defineSymbol(text, main, inner, "…", "\\ldots", true);
4305defineSymbol(math, main, inner, "…", "\\ldots", true);
4306defineSymbol(math, main, inner, "⋯", "\\@cdots", true);
4307defineSymbol(math, main, inner, "⋱", "\\ddots", true);
4308defineSymbol(math, main, textord, "⋮", "\\varvdots");
4309defineSymbol(math, main, accent, "ˊ", "\\acute");
4310defineSymbol(math, main, accent, "ˋ", "\\grave");
4311defineSymbol(math, main, accent, "¨", "\\ddot");
4312defineSymbol(math, main, accent, "~", "\\tilde");
4313defineSymbol(math, main, accent, "ˉ", "\\bar");
4314defineSymbol(math, main, accent, "˘", "\\breve");
4315defineSymbol(math, main, accent, "ˇ", "\\check");
4316defineSymbol(math, main, accent, "^", "\\hat");
4317defineSymbol(math, main, accent, "⃗", "\\vec");
4318defineSymbol(math, main, accent, "˙", "\\dot");
4319defineSymbol(math, main, accent, "˚", "\\mathring");
4320defineSymbol(math, main, mathord, "", "\\@imath");
4321defineSymbol(math, main, mathord, "", "\\@jmath");
4322defineSymbol(math, main, textord, "ı", "ı");
4323defineSymbol(math, main, textord, "ȷ", "ȷ");
4324defineSymbol(text, main, textord, "ı", "\\i", true);
4325defineSymbol(text, main, textord, "ȷ", "\\j", true);
4326defineSymbol(text, main, textord, "ß", "\\ss", true);
4327defineSymbol(text, main, textord, "æ", "\\ae", true);
4328defineSymbol(text, main, textord, "œ", "\\oe", true);
4329defineSymbol(text, main, textord, "ø", "\\o", true);
4330defineSymbol(text, main, textord, "Æ", "\\AE", true);
4331defineSymbol(text, main, textord, "Œ", "\\OE", true);
4332defineSymbol(text, main, textord, "Ø", "\\O", true);
4333defineSymbol(text, main, accent, "ˊ", "\\'");
4334defineSymbol(text, main, accent, "ˋ", "\\`");
4335defineSymbol(text, main, accent, "ˆ", "\\^");
4336defineSymbol(text, main, accent, "˜", "\\~");
4337defineSymbol(text, main, accent, "ˉ", "\\=");
4338defineSymbol(text, main, accent, "˘", "\\u");
4339defineSymbol(text, main, accent, "˙", "\\.");
4340defineSymbol(text, main, accent, "¸", "\\c");
4341defineSymbol(text, main, accent, "˚", "\\r");
4342defineSymbol(text, main, accent, "ˇ", "\\v");
4343defineSymbol(text, main, accent, "¨", '\\"');
4344defineSymbol(text, main, accent, "˝", "\\H");
4345defineSymbol(text, main, accent, "◯", "\\textcircled");
4346var ligatures = {
4347 "--": true,
4348 "---": true,
4349 "``": true,
4350 "''": true
4351};
4352defineSymbol(text, main, textord, "–", "--", true);
4353defineSymbol(text, main, textord, "–", "\\textendash");
4354defineSymbol(text, main, textord, "—", "---", true);
4355defineSymbol(text, main, textord, "—", "\\textemdash");
4356defineSymbol(text, main, textord, "‘", "`", true);
4357defineSymbol(text, main, textord, "‘", "\\textquoteleft");
4358defineSymbol(text, main, textord, "’", "'", true);
4359defineSymbol(text, main, textord, "’", "\\textquoteright");
4360defineSymbol(text, main, textord, "“", "``", true);
4361defineSymbol(text, main, textord, "“", "\\textquotedblleft");
4362defineSymbol(text, main, textord, "”", "''", true);
4363defineSymbol(text, main, textord, "”", "\\textquotedblright");
4364defineSymbol(math, main, textord, "°", "\\degree", true);
4365defineSymbol(text, main, textord, "°", "\\degree");
4366defineSymbol(text, main, textord, "°", "\\textdegree", true);
4367defineSymbol(math, main, textord, "£", "\\pounds");
4368defineSymbol(math, main, textord, "£", "\\mathsterling", true);
4369defineSymbol(text, main, textord, "£", "\\pounds");
4370defineSymbol(text, main, textord, "£", "\\textsterling", true);
4371defineSymbol(math, ams, textord, "✠", "\\maltese");
4372defineSymbol(text, ams, textord, "✠", "\\maltese");
4373var mathTextSymbols = '0123456789/@."';
4374for (var i = 0; i < mathTextSymbols.length; i++) {
4375 var ch = mathTextSymbols.charAt(i);
4376 defineSymbol(math, main, textord, ch, ch);
4377}
4378var textSymbols = '0123456789!@*()-=+";:?/.,';
4379for (var _i = 0; _i < textSymbols.length; _i++) {
4380 var _ch = textSymbols.charAt(_i);
4381 defineSymbol(text, main, textord, _ch, _ch);
4382}
4383var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
4384for (var _i2 = 0; _i2 < letters.length; _i2++) {
4385 var _ch2 = letters.charAt(_i2);
4386 defineSymbol(math, main, mathord, _ch2, _ch2);
4387 defineSymbol(text, main, textord, _ch2, _ch2);
4388}
4389defineSymbol(math, ams, textord, "C", "ℂ");
4390defineSymbol(text, ams, textord, "C", "ℂ");
4391defineSymbol(math, ams, textord, "H", "ℍ");
4392defineSymbol(text, ams, textord, "H", "ℍ");
4393defineSymbol(math, ams, textord, "N", "ℕ");
4394defineSymbol(text, ams, textord, "N", "ℕ");
4395defineSymbol(math, ams, textord, "P", "ℙ");
4396defineSymbol(text, ams, textord, "P", "ℙ");
4397defineSymbol(math, ams, textord, "Q", "ℚ");
4398defineSymbol(text, ams, textord, "Q", "ℚ");
4399defineSymbol(math, ams, textord, "R", "ℝ");
4400defineSymbol(text, ams, textord, "R", "ℝ");
4401defineSymbol(math, ams, textord, "Z", "ℤ");
4402defineSymbol(text, ams, textord, "Z", "ℤ");
4403defineSymbol(math, main, mathord, "h", "ℎ");
4404defineSymbol(text, main, mathord, "h", "ℎ");
4405var wideChar = "";
4406for (var _i3 = 0; _i3 < letters.length; _i3++) {
4407 var _ch3 = letters.charAt(_i3);
4408 wideChar = String.fromCharCode(55349, 56320 + _i3);
4409 defineSymbol(math, main, mathord, _ch3, wideChar);
4410 defineSymbol(text, main, textord, _ch3, wideChar);
4411 wideChar = String.fromCharCode(55349, 56372 + _i3);
4412 defineSymbol(math, main, mathord, _ch3, wideChar);
4413 defineSymbol(text, main, textord, _ch3, wideChar);
4414 wideChar = String.fromCharCode(55349, 56424 + _i3);
4415 defineSymbol(math, main, mathord, _ch3, wideChar);
4416 defineSymbol(text, main, textord, _ch3, wideChar);
4417 wideChar = String.fromCharCode(55349, 56580 + _i3);
4418 defineSymbol(math, main, mathord, _ch3, wideChar);
4419 defineSymbol(text, main, textord, _ch3, wideChar);
4420 wideChar = String.fromCharCode(55349, 56684 + _i3);
4421 defineSymbol(math, main, mathord, _ch3, wideChar);
4422 defineSymbol(text, main, textord, _ch3, wideChar);
4423 wideChar = String.fromCharCode(55349, 56736 + _i3);
4424 defineSymbol(math, main, mathord, _ch3, wideChar);
4425 defineSymbol(text, main, textord, _ch3, wideChar);
4426 wideChar = String.fromCharCode(55349, 56788 + _i3);
4427 defineSymbol(math, main, mathord, _ch3, wideChar);
4428 defineSymbol(text, main, textord, _ch3, wideChar);
4429 wideChar = String.fromCharCode(55349, 56840 + _i3);
4430 defineSymbol(math, main, mathord, _ch3, wideChar);
4431 defineSymbol(text, main, textord, _ch3, wideChar);
4432 wideChar = String.fromCharCode(55349, 56944 + _i3);
4433 defineSymbol(math, main, mathord, _ch3, wideChar);
4434 defineSymbol(text, main, textord, _ch3, wideChar);
4435 if (_i3 < 26) {
4436 wideChar = String.fromCharCode(55349, 56632 + _i3);
4437 defineSymbol(math, main, mathord, _ch3, wideChar);
4438 defineSymbol(text, main, textord, _ch3, wideChar);
4439 wideChar = String.fromCharCode(55349, 56476 + _i3);
4440 defineSymbol(math, main, mathord, _ch3, wideChar);
4441 defineSymbol(text, main, textord, _ch3, wideChar);
4442 }
4443}
4444wideChar = String.fromCharCode(55349, 56668);
4445defineSymbol(math, main, mathord, "k", wideChar);
4446defineSymbol(text, main, textord, "k", wideChar);
4447for (var _i4 = 0; _i4 < 10; _i4++) {
4448 var _ch4 = _i4.toString();
4449 wideChar = String.fromCharCode(55349, 57294 + _i4);
4450 defineSymbol(math, main, mathord, _ch4, wideChar);
4451 defineSymbol(text, main, textord, _ch4, wideChar);
4452 wideChar = String.fromCharCode(55349, 57314 + _i4);
4453 defineSymbol(math, main, mathord, _ch4, wideChar);
4454 defineSymbol(text, main, textord, _ch4, wideChar);
4455 wideChar = String.fromCharCode(55349, 57324 + _i4);
4456 defineSymbol(math, main, mathord, _ch4, wideChar);
4457 defineSymbol(text, main, textord, _ch4, wideChar);
4458 wideChar = String.fromCharCode(55349, 57334 + _i4);
4459 defineSymbol(math, main, mathord, _ch4, wideChar);
4460 defineSymbol(text, main, textord, _ch4, wideChar);
4461}
4462var extraLatin = "ÐÞþ";
4463for (var _i5 = 0; _i5 < extraLatin.length; _i5++) {
4464 var _ch5 = extraLatin.charAt(_i5);
4465 defineSymbol(math, main, mathord, _ch5, _ch5);
4466 defineSymbol(text, main, textord, _ch5, _ch5);
4467}
4468var wideLatinLetterData = [
4469 ["mathbf", "textbf", "Main-Bold"],
4470 // A-Z bold upright
4471 ["mathbf", "textbf", "Main-Bold"],
4472 // a-z bold upright
4473 ["mathnormal", "textit", "Math-Italic"],
4474 // A-Z italic
4475 ["mathnormal", "textit", "Math-Italic"],
4476 // a-z italic
4477 ["boldsymbol", "boldsymbol", "Main-BoldItalic"],
4478 // A-Z bold italic
4479 ["boldsymbol", "boldsymbol", "Main-BoldItalic"],
4480 // a-z bold italic
4481 // Map fancy A-Z letters to script, not calligraphic.
4482 // This aligns with unicode-math and math fonts (except Cambria Math).
4483 ["mathscr", "textscr", "Script-Regular"],
4484 // A-Z script
4485 ["", "", ""],
4486 // a-z script. No font
4487 ["", "", ""],
4488 // A-Z bold script. No font
4489 ["", "", ""],
4490 // a-z bold script. No font
4491 ["mathfrak", "textfrak", "Fraktur-Regular"],
4492 // A-Z Fraktur
4493 ["mathfrak", "textfrak", "Fraktur-Regular"],
4494 // a-z Fraktur
4495 ["mathbb", "textbb", "AMS-Regular"],
4496 // A-Z double-struck
4497 ["mathbb", "textbb", "AMS-Regular"],
4498 // k double-struck
4499 // Note that we are using a bold font, but font metrics for regular Fraktur.
4500 ["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
4501 // A-Z bold Fraktur
4502 ["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
4503 // a-z bold Fraktur
4504 ["mathsf", "textsf", "SansSerif-Regular"],
4505 // A-Z sans-serif
4506 ["mathsf", "textsf", "SansSerif-Regular"],
4507 // a-z sans-serif
4508 ["mathboldsf", "textboldsf", "SansSerif-Bold"],
4509 // A-Z bold sans-serif
4510 ["mathboldsf", "textboldsf", "SansSerif-Bold"],
4511 // a-z bold sans-serif
4512 ["mathitsf", "textitsf", "SansSerif-Italic"],
4513 // A-Z italic sans-serif
4514 ["mathitsf", "textitsf", "SansSerif-Italic"],
4515 // a-z italic sans-serif
4516 ["", "", ""],
4517 // A-Z bold italic sans. No font
4518 ["", "", ""],
4519 // a-z bold italic sans. No font
4520 ["mathtt", "texttt", "Typewriter-Regular"],
4521 // A-Z monospace
4522 ["mathtt", "texttt", "Typewriter-Regular"]
4523 // a-z monospace
4524];
4525var wideNumeralData = [
4526 ["mathbf", "textbf", "Main-Bold"],
4527 // 0-9 bold
4528 ["", "", ""],
4529 // 0-9 double-struck. No KaTeX font.
4530 ["mathsf", "textsf", "SansSerif-Regular"],
4531 // 0-9 sans-serif
4532 ["mathboldsf", "textboldsf", "SansSerif-Bold"],
4533 // 0-9 bold sans-serif
4534 ["mathtt", "texttt", "Typewriter-Regular"]
4535 // 0-9 monospace
4536];
4537var wideCharacterFont = function wideCharacterFont2(wideChar2, mode) {
4538 var H = wideChar2.charCodeAt(0);
4539 var L = wideChar2.charCodeAt(1);
4540 var codePoint = (H - 55296) * 1024 + (L - 56320) + 65536;
4541 var j = mode === "math" ? 0 : 1;
4542 if (119808 <= codePoint && codePoint < 120484) {
4543 var i = Math.floor((codePoint - 119808) / 26);
4544 return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]];
4545 } else if (120782 <= codePoint && codePoint <= 120831) {
4546 var _i = Math.floor((codePoint - 120782) / 10);
4547 return [wideNumeralData[_i][2], wideNumeralData[_i][j]];
4548 } else if (codePoint === 120485 || codePoint === 120486) {
4549 return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];
4550 } else if (120486 < codePoint && codePoint < 120782) {
4551 return ["", ""];
4552 } else {
4553 throw new ParseError("Unsupported character: " + wideChar2);
4554 }
4555};
4556var lookupSymbol = function lookupSymbol2(value, fontName, mode) {
4557 if (symbols[mode][value] && symbols[mode][value].replace) {
4558 value = symbols[mode][value].replace;
4559 }
4560 return {
4561 value,
4562 metrics: getCharacterMetrics(value, fontName, mode)
4563 };
4564};
4565var makeSymbol = function makeSymbol2(value, fontName, mode, options, classes) {
4566 var lookup = lookupSymbol(value, fontName, mode);
4567 var metrics = lookup.metrics;
4568 value = lookup.value;
4569 var symbolNode;
4570 if (metrics) {
4571 var italic = metrics.italic;
4572 if (mode === "text" || options && options.font === "mathit") {
4573 italic = 0;
4574 }
4575 symbolNode = new SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes);
4576 } else {
4577 typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'"));
4578 symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes);
4579 }
4580 if (options) {
4581 symbolNode.maxFontSize = options.sizeMultiplier;
4582 if (options.style.isTight()) {
4583 symbolNode.classes.push("mtight");
4584 }
4585 var color = options.getColor();
4586 if (color) {
4587 symbolNode.style.color = color;
4588 }
4589 }
4590 return symbolNode;
4591};
4592var mathsym = function mathsym2(value, mode, options, classes) {
4593 if (classes === void 0) {
4594 classes = [];
4595 }
4596 if (options.font === "boldsymbol" && lookupSymbol(value, "Main-Bold", mode).metrics) {
4597 return makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"]));
4598 } else if (value === "\\" || symbols[mode][value].font === "main") {
4599 return makeSymbol(value, "Main-Regular", mode, options, classes);
4600 } else {
4601 return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"]));
4602 }
4603};
4604var boldsymbol = function boldsymbol2(value, mode, options, classes, type) {
4605 if (type !== "textord" && lookupSymbol(value, "Math-BoldItalic", mode).metrics) {
4606 return {
4607 fontName: "Math-BoldItalic",
4608 fontClass: "boldsymbol"
4609 };
4610 } else {
4611 return {
4612 fontName: "Main-Bold",
4613 fontClass: "mathbf"
4614 };
4615 }
4616};
4617var makeOrd = function makeOrd2(group, options, type) {
4618 var mode = group.mode;
4619 var text2 = group.text;
4620 var classes = ["mord"];
4621 var isFont = mode === "math" || mode === "text" && options.font;
4622 var fontOrFamily = isFont ? options.font : options.fontFamily;
4623 var wideFontName = "";
4624 var wideFontClass = "";
4625 if (text2.charCodeAt(0) === 55349) {
4626 [wideFontName, wideFontClass] = wideCharacterFont(text2, mode);
4627 }
4628 if (wideFontName.length > 0) {
4629 return makeSymbol(text2, wideFontName, mode, options, classes.concat(wideFontClass));
4630 } else if (fontOrFamily) {
4631 var fontName;
4632 var fontClasses;
4633 if (fontOrFamily === "boldsymbol") {
4634 var fontData = boldsymbol(text2, mode, options, classes, type);
4635 fontName = fontData.fontName;
4636 fontClasses = [fontData.fontClass];
4637 } else if (isFont) {
4638 fontName = fontMap[fontOrFamily].fontName;
4639 fontClasses = [fontOrFamily];
4640 } else {
4641 fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape);
4642 fontClasses = [fontOrFamily, options.fontWeight, options.fontShape];
4643 }
4644 if (lookupSymbol(text2, fontName, mode).metrics) {
4645 return makeSymbol(text2, fontName, mode, options, classes.concat(fontClasses));
4646 } else if (ligatures.hasOwnProperty(text2) && fontName.slice(0, 10) === "Typewriter") {
4647 var parts = [];
4648 for (var i = 0; i < text2.length; i++) {
4649 parts.push(makeSymbol(text2[i], fontName, mode, options, classes.concat(fontClasses)));
4650 }
4651 return makeFragment(parts);
4652 }
4653 }
4654 if (type === "mathord") {
4655 return makeSymbol(text2, "Math-Italic", mode, options, classes.concat(["mathnormal"]));
4656 } else if (type === "textord") {
4657 var font = symbols[mode][text2] && symbols[mode][text2].font;
4658 if (font === "ams") {
4659 var _fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape);
4660 return makeSymbol(text2, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape));
4661 } else if (font === "main" || !font) {
4662 var _fontName2 = retrieveTextFontName("textrm", options.fontWeight, options.fontShape);
4663 return makeSymbol(text2, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape));
4664 } else {
4665 var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape);
4666 return makeSymbol(text2, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape));
4667 }
4668 } else {
4669 throw new Error("unexpected type: " + type + " in makeOrd");
4670 }
4671};
4672var canCombine = (prev, next) => {
4673 if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) {
4674 return false;
4675 }
4676 if (prev.classes.length === 1) {
4677 var cls = prev.classes[0];
4678 if (cls === "mbin" || cls === "mord") {
4679 return false;
4680 }
4681 }
4682 for (var style in prev.style) {
4683 if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) {
4684 return false;
4685 }
4686 }
4687 for (var _style in next.style) {
4688 if (next.style.hasOwnProperty(_style) && prev.style[_style] !== next.style[_style]) {
4689 return false;
4690 }
4691 }
4692 return true;
4693};
4694var tryCombineChars = (chars) => {
4695 for (var i = 0; i < chars.length - 1; i++) {
4696 var prev = chars[i];
4697 var next = chars[i + 1];
4698 if (prev instanceof SymbolNode && next instanceof SymbolNode && canCombine(prev, next)) {
4699 prev.text += next.text;
4700 prev.height = Math.max(prev.height, next.height);
4701 prev.depth = Math.max(prev.depth, next.depth);
4702 prev.italic = next.italic;
4703 chars.splice(i + 1, 1);
4704 i--;
4705 }
4706 }
4707 return chars;
4708};
4709var sizeElementFromChildren = function sizeElementFromChildren2(elem) {
4710 var height = 0;
4711 var depth = 0;
4712 var maxFontSize = 0;
4713 for (var i = 0; i < elem.children.length; i++) {
4714 var child = elem.children[i];
4715 if (child.height > height) {
4716 height = child.height;
4717 }
4718 if (child.depth > depth) {
4719 depth = child.depth;
4720 }
4721 if (child.maxFontSize > maxFontSize) {
4722 maxFontSize = child.maxFontSize;
4723 }
4724 }
4725 elem.height = height;
4726 elem.depth = depth;
4727 elem.maxFontSize = maxFontSize;
4728};
4729var makeSpan$2 = function makeSpan(classes, children, options, style) {
4730 var span = new Span(classes, children, options, style);
4731 sizeElementFromChildren(span);
4732 return span;
4733};
4734var makeSvgSpan = (classes, children, options, style) => new Span(classes, children, options, style);
4735var makeLineSpan = function makeLineSpan2(className, options, thickness) {
4736 var line = makeSpan$2([className], [], options);
4737 line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
4738 line.style.borderBottomWidth = makeEm(line.height);
4739 line.maxFontSize = 1;
4740 return line;
4741};
4742var makeAnchor = function makeAnchor2(href, classes, children, options) {
4743 var anchor = new Anchor(href, classes, children, options);
4744 sizeElementFromChildren(anchor);
4745 return anchor;
4746};
4747var makeFragment = function makeFragment2(children) {
4748 var fragment = new DocumentFragment(children);
4749 sizeElementFromChildren(fragment);
4750 return fragment;
4751};
4752var wrapFragment = function wrapFragment2(group, options) {
4753 if (group instanceof DocumentFragment) {
4754 return makeSpan$2([], [group], options);
4755 }
4756 return group;
4757};
4758var getVListChildrenAndDepth = function getVListChildrenAndDepth2(params) {
4759 if (params.positionType === "individualShift") {
4760 var oldChildren = params.children;
4761 var children = [oldChildren[0]];
4762 var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth;
4763 var currPos = _depth;
4764 for (var i = 1; i < oldChildren.length; i++) {
4765 var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth;
4766 var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth);
4767 currPos = currPos + diff;
4768 children.push({
4769 type: "kern",
4770 size
4771 });
4772 children.push(oldChildren[i]);
4773 }
4774 return {
4775 children,
4776 depth: _depth
4777 };
4778 }
4779 var depth;
4780 if (params.positionType === "top") {
4781 var bottom = params.positionData;
4782 for (var _i = 0; _i < params.children.length; _i++) {
4783 var child = params.children[_i];
4784 bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth;
4785 }
4786 depth = bottom;
4787 } else if (params.positionType === "bottom") {
4788 depth = -params.positionData;
4789 } else {
4790 var firstChild = params.children[0];
4791 if (firstChild.type !== "elem") {
4792 throw new Error('First child must have type "elem".');
4793 }
4794 if (params.positionType === "shift") {
4795 depth = -firstChild.elem.depth - params.positionData;
4796 } else if (params.positionType === "firstBaseline") {
4797 depth = -firstChild.elem.depth;
4798 } else {
4799 throw new Error("Invalid positionType " + params.positionType + ".");
4800 }
4801 }
4802 return {
4803 children: params.children,
4804 depth
4805 };
4806};
4807var makeVList = function makeVList2(params, options) {
4808 var {
4809 children,
4810 depth
4811 } = getVListChildrenAndDepth(params);
4812 var pstrutSize = 0;
4813 for (var i = 0; i < children.length; i++) {
4814 var child = children[i];
4815 if (child.type === "elem") {
4816 var elem = child.elem;
4817 pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height);
4818 }
4819 }
4820 pstrutSize += 2;
4821 var pstrut = makeSpan$2(["pstrut"], []);
4822 pstrut.style.height = makeEm(pstrutSize);
4823 var realChildren = [];
4824 var minPos = depth;
4825 var maxPos = depth;
4826 var currPos = depth;
4827 for (var _i2 = 0; _i2 < children.length; _i2++) {
4828 var _child = children[_i2];
4829 if (_child.type === "kern") {
4830 currPos += _child.size;
4831 } else {
4832 var _elem = _child.elem;
4833 var classes = _child.wrapperClasses || [];
4834 var style = _child.wrapperStyle || {};
4835 var childWrap = makeSpan$2(classes, [pstrut, _elem], void 0, style);
4836 childWrap.style.top = makeEm(-pstrutSize - currPos - _elem.depth);
4837 if (_child.marginLeft) {
4838 childWrap.style.marginLeft = _child.marginLeft;
4839 }
4840 if (_child.marginRight) {
4841 childWrap.style.marginRight = _child.marginRight;
4842 }
4843 realChildren.push(childWrap);
4844 currPos += _elem.height + _elem.depth;
4845 }
4846 minPos = Math.min(minPos, currPos);
4847 maxPos = Math.max(maxPos, currPos);
4848 }
4849 var vlist = makeSpan$2(["vlist"], realChildren);
4850 vlist.style.height = makeEm(maxPos);
4851 var rows;
4852 if (minPos < 0) {
4853 var emptySpan = makeSpan$2([], []);
4854 var depthStrut = makeSpan$2(["vlist"], [emptySpan]);
4855 depthStrut.style.height = makeEm(-minPos);
4856 var topStrut = makeSpan$2(["vlist-s"], [new SymbolNode("​")]);
4857 rows = [makeSpan$2(["vlist-r"], [vlist, topStrut]), makeSpan$2(["vlist-r"], [depthStrut])];
4858 } else {
4859 rows = [makeSpan$2(["vlist-r"], [vlist])];
4860 }
4861 var vtable = makeSpan$2(["vlist-t"], rows);
4862 if (rows.length === 2) {
4863 vtable.classes.push("vlist-t2");
4864 }
4865 vtable.height = maxPos;
4866 vtable.depth = -minPos;
4867 return vtable;
4868};
4869var makeGlue = (measurement, options) => {
4870 var rule = makeSpan$2(["mspace"], [], options);
4871 var size = calculateSize(measurement, options);
4872 rule.style.marginRight = makeEm(size);
4873 return rule;
4874};
4875var retrieveTextFontName = function retrieveTextFontName2(fontFamily, fontWeight, fontShape) {
4876 var baseFontName = "";
4877 switch (fontFamily) {
4878 case "amsrm":
4879 baseFontName = "AMS";
4880 break;
4881 case "textrm":
4882 baseFontName = "Main";
4883 break;
4884 case "textsf":
4885 baseFontName = "SansSerif";
4886 break;
4887 case "texttt":
4888 baseFontName = "Typewriter";
4889 break;
4890 default:
4891 baseFontName = fontFamily;
4892 }
4893 var fontStylesName;
4894 if (fontWeight === "textbf" && fontShape === "textit") {
4895 fontStylesName = "BoldItalic";
4896 } else if (fontWeight === "textbf") {
4897 fontStylesName = "Bold";
4898 } else if (fontWeight === "textit") {
4899 fontStylesName = "Italic";
4900 } else {
4901 fontStylesName = "Regular";
4902 }
4903 return baseFontName + "-" + fontStylesName;
4904};
4905var fontMap = {
4906 // styles
4907 "mathbf": {
4908 variant: "bold",
4909 fontName: "Main-Bold"
4910 },
4911 "mathrm": {
4912 variant: "normal",
4913 fontName: "Main-Regular"
4914 },
4915 "textit": {
4916 variant: "italic",
4917 fontName: "Main-Italic"
4918 },
4919 "mathit": {
4920 variant: "italic",
4921 fontName: "Main-Italic"
4922 },
4923 "mathnormal": {
4924 variant: "italic",
4925 fontName: "Math-Italic"
4926 },
4927 // "boldsymbol" is missing because they require the use of multiple fonts:
4928 // Math-BoldItalic and Main-Bold. This is handled by a special case in
4929 // makeOrd which ends up calling boldsymbol.
4930 // families
4931 "mathbb": {
4932 variant: "double-struck",
4933 fontName: "AMS-Regular"
4934 },
4935 "mathcal": {
4936 variant: "script",
4937 fontName: "Caligraphic-Regular"
4938 },
4939 "mathfrak": {
4940 variant: "fraktur",
4941 fontName: "Fraktur-Regular"
4942 },
4943 "mathscr": {
4944 variant: "script",
4945 fontName: "Script-Regular"
4946 },
4947 "mathsf": {
4948 variant: "sans-serif",
4949 fontName: "SansSerif-Regular"
4950 },
4951 "mathtt": {
4952 variant: "monospace",
4953 fontName: "Typewriter-Regular"
4954 }
4955};
4956var svgData = {
4957 // path, width, height
4958 vec: ["vec", 0.471, 0.714],
4959 // values from the font glyph
4960 oiintSize1: ["oiintSize1", 0.957, 0.499],
4961 // oval to overlay the integrand
4962 oiintSize2: ["oiintSize2", 1.472, 0.659],
4963 oiiintSize1: ["oiiintSize1", 1.304, 0.499],
4964 oiiintSize2: ["oiiintSize2", 1.98, 0.659]
4965};
4966var staticSvg = function staticSvg2(value, options) {
4967 var [pathName, width, height] = svgData[value];
4968 var path2 = new PathNode(pathName);
4969 var svgNode = new SvgNode([path2], {
4970 "width": makeEm(width),
4971 "height": makeEm(height),
4972 // Override CSS rule `.katex svg { width: 100% }`
4973 "style": "width:" + makeEm(width),
4974 "viewBox": "0 0 " + 1e3 * width + " " + 1e3 * height,
4975 "preserveAspectRatio": "xMinYMin"
4976 });
4977 var span = makeSvgSpan(["overlay"], [svgNode], options);
4978 span.height = height;
4979 span.style.height = makeEm(height);
4980 span.style.width = makeEm(width);
4981 return span;
4982};
4983var buildCommon = {
4984 fontMap,
4985 makeSymbol,
4986 mathsym,
4987 makeSpan: makeSpan$2,
4988 makeSvgSpan,
4989 makeLineSpan,
4990 makeAnchor,
4991 makeFragment,
4992 wrapFragment,
4993 makeVList,
4994 makeOrd,
4995 makeGlue,
4996 staticSvg,
4997 svgData,
4998 tryCombineChars
4999};
5000var thinspace = {
5001 number: 3,
5002 unit: "mu"
5003};
5004var mediumspace = {
5005 number: 4,
5006 unit: "mu"
5007};
5008var thickspace = {
5009 number: 5,
5010 unit: "mu"
5011};
5012var spacings = {
5013 mord: {
5014 mop: thinspace,
5015 mbin: mediumspace,
5016 mrel: thickspace,
5017 minner: thinspace
5018 },
5019 mop: {
5020 mord: thinspace,
5021 mop: thinspace,
5022 mrel: thickspace,
5023 minner: thinspace
5024 },
5025 mbin: {
5026 mord: mediumspace,
5027 mop: mediumspace,
5028 mopen: mediumspace,
5029 minner: mediumspace
5030 },
5031 mrel: {
5032 mord: thickspace,
5033 mop: thickspace,
5034 mopen: thickspace,
5035 minner: thickspace
5036 },
5037 mopen: {},
5038 mclose: {
5039 mop: thinspace,
5040 mbin: mediumspace,
5041 mrel: thickspace,
5042 minner: thinspace
5043 },
5044 mpunct: {
5045 mord: thinspace,
5046 mop: thinspace,
5047 mrel: thickspace,
5048 mopen: thinspace,
5049 mclose: thinspace,
5050 mpunct: thinspace,
5051 minner: thinspace
5052 },
5053 minner: {
5054 mord: thinspace,
5055 mop: thinspace,
5056 mbin: mediumspace,
5057 mrel: thickspace,
5058 mopen: thinspace,
5059 mpunct: thinspace,
5060 minner: thinspace
5061 }
5062};
5063var tightSpacings = {
5064 mord: {
5065 mop: thinspace
5066 },
5067 mop: {
5068 mord: thinspace,
5069 mop: thinspace
5070 },
5071 mbin: {},
5072 mrel: {},
5073 mopen: {},
5074 mclose: {
5075 mop: thinspace
5076 },
5077 mpunct: {},
5078 minner: {
5079 mop: thinspace
5080 }
5081};
5082var _functions = {};
5083var _htmlGroupBuilders = {};
5084var _mathmlGroupBuilders = {};
5085function defineFunction(_ref) {
5086 var {
5087 type,
5088 names,
5089 props,
5090 handler,
5091 htmlBuilder: htmlBuilder3,
5092 mathmlBuilder: mathmlBuilder3
5093 } = _ref;
5094 var data = {
5095 type,
5096 numArgs: props.numArgs,
5097 argTypes: props.argTypes,
5098 allowedInArgument: !!props.allowedInArgument,
5099 allowedInText: !!props.allowedInText,
5100 allowedInMath: props.allowedInMath === void 0 ? true : props.allowedInMath,
5101 numOptionalArgs: props.numOptionalArgs || 0,
5102 infix: !!props.infix,
5103 primitive: !!props.primitive,
5104 handler
5105 };
5106 for (var i = 0; i < names.length; ++i) {
5107 _functions[names[i]] = data;
5108 }
5109 if (type) {
5110 if (htmlBuilder3) {
5111 _htmlGroupBuilders[type] = htmlBuilder3;
5112 }
5113 if (mathmlBuilder3) {
5114 _mathmlGroupBuilders[type] = mathmlBuilder3;
5115 }
5116 }
5117}
5118function defineFunctionBuilders(_ref2) {
5119 var {
5120 type,
5121 htmlBuilder: htmlBuilder3,
5122 mathmlBuilder: mathmlBuilder3
5123 } = _ref2;
5124 defineFunction({
5125 type,
5126 names: [],
5127 props: {
5128 numArgs: 0
5129 },
5130 handler() {
5131 throw new Error("Should never be called.");
5132 },
5133 htmlBuilder: htmlBuilder3,
5134 mathmlBuilder: mathmlBuilder3
5135 });
5136}
5137var normalizeArgument = function normalizeArgument2(arg) {
5138 return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg;
5139};
5140var ordargument = function ordargument2(arg) {
5141 return arg.type === "ordgroup" ? arg.body : [arg];
5142};
5143var makeSpan$1 = buildCommon.makeSpan;
5144var binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"];
5145var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"];
5146var styleMap$1 = {
5147 "display": Style$1.DISPLAY,
5148 "text": Style$1.TEXT,
5149 "script": Style$1.SCRIPT,
5150 "scriptscript": Style$1.SCRIPTSCRIPT
5151};
5152var DomEnum = {
5153 mord: "mord",
5154 mop: "mop",
5155 mbin: "mbin",
5156 mrel: "mrel",
5157 mopen: "mopen",
5158 mclose: "mclose",
5159 mpunct: "mpunct",
5160 minner: "minner"
5161};
5162var buildExpression$1 = function buildExpression(expression, options, isRealGroup, surrounding) {
5163 if (surrounding === void 0) {
5164 surrounding = [null, null];
5165 }
5166 var groups = [];
5167 for (var i = 0; i < expression.length; i++) {
5168 var output = buildGroup$1(expression[i], options);
5169 if (output instanceof DocumentFragment) {
5170 var children = output.children;
5171 groups.push(...children);
5172 } else {
5173 groups.push(output);
5174 }
5175 }
5176 buildCommon.tryCombineChars(groups);
5177 if (!isRealGroup) {
5178 return groups;
5179 }
5180 var glueOptions = options;
5181 if (expression.length === 1) {
5182 var node = expression[0];
5183 if (node.type === "sizing") {
5184 glueOptions = options.havingSize(node.size);
5185 } else if (node.type === "styling") {
5186 glueOptions = options.havingStyle(styleMap$1[node.style]);
5187 }
5188 }
5189 var dummyPrev = makeSpan$1([surrounding[0] || "leftmost"], [], options);
5190 var dummyNext = makeSpan$1([surrounding[1] || "rightmost"], [], options);
5191 var isRoot = isRealGroup === "root";
5192 traverseNonSpaceNodes(groups, (node2, prev) => {
5193 var prevType = prev.classes[0];
5194 var type = node2.classes[0];
5195 if (prevType === "mbin" && utils.contains(binRightCanceller, type)) {
5196 prev.classes[0] = "mord";
5197 } else if (type === "mbin" && utils.contains(binLeftCanceller, prevType)) {
5198 node2.classes[0] = "mord";
5199 }
5200 }, {
5201 node: dummyPrev
5202 }, dummyNext, isRoot);
5203 traverseNonSpaceNodes(groups, (node2, prev) => {
5204 var prevType = getTypeOfDomTree(prev);
5205 var type = getTypeOfDomTree(node2);
5206 var space = prevType && type ? node2.hasClass("mtight") ? tightSpacings[prevType][type] : spacings[prevType][type] : null;
5207 if (space) {
5208 return buildCommon.makeGlue(space, glueOptions);
5209 }
5210 }, {
5211 node: dummyPrev
5212 }, dummyNext, isRoot);
5213 return groups;
5214};
5215var traverseNonSpaceNodes = function traverseNonSpaceNodes2(nodes, callback, prev, next, isRoot) {
5216 if (next) {
5217 nodes.push(next);
5218 }
5219 var i = 0;
5220 for (; i < nodes.length; i++) {
5221 var node = nodes[i];
5222 var partialGroup = checkPartialGroup(node);
5223 if (partialGroup) {
5224 traverseNonSpaceNodes2(partialGroup.children, callback, prev, null, isRoot);
5225 continue;
5226 }
5227 var nonspace = !node.hasClass("mspace");
5228 if (nonspace) {
5229 var result = callback(node, prev.node);
5230 if (result) {
5231 if (prev.insertAfter) {
5232 prev.insertAfter(result);
5233 } else {
5234 nodes.unshift(result);
5235 i++;
5236 }
5237 }
5238 }
5239 if (nonspace) {
5240 prev.node = node;
5241 } else if (isRoot && node.hasClass("newline")) {
5242 prev.node = makeSpan$1(["leftmost"]);
5243 }
5244 prev.insertAfter = ((index) => (n) => {
5245 nodes.splice(index + 1, 0, n);
5246 i++;
5247 })(i);
5248 }
5249 if (next) {
5250 nodes.pop();
5251 }
5252};
5253var checkPartialGroup = function checkPartialGroup2(node) {
5254 if (node instanceof DocumentFragment || node instanceof Anchor || node instanceof Span && node.hasClass("enclosing")) {
5255 return node;
5256 }
5257 return null;
5258};
5259var getOutermostNode = function getOutermostNode2(node, side) {
5260 var partialGroup = checkPartialGroup(node);
5261 if (partialGroup) {
5262 var children = partialGroup.children;
5263 if (children.length) {
5264 if (side === "right") {
5265 return getOutermostNode2(children[children.length - 1], "right");
5266 } else if (side === "left") {
5267 return getOutermostNode2(children[0], "left");
5268 }
5269 }
5270 }
5271 return node;
5272};
5273var getTypeOfDomTree = function getTypeOfDomTree2(node, side) {
5274 if (!node) {
5275 return null;
5276 }
5277 if (side) {
5278 node = getOutermostNode(node, side);
5279 }
5280 return DomEnum[node.classes[0]] || null;
5281};
5282var makeNullDelimiter = function makeNullDelimiter2(options, classes) {
5283 var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses());
5284 return makeSpan$1(classes.concat(moreClasses));
5285};
5286var buildGroup$1 = function buildGroup(group, options, baseOptions) {
5287 if (!group) {
5288 return makeSpan$1();
5289 }
5290 if (_htmlGroupBuilders[group.type]) {
5291 var groupNode = _htmlGroupBuilders[group.type](group, options);
5292 if (baseOptions && options.size !== baseOptions.size) {
5293 groupNode = makeSpan$1(options.sizingClasses(baseOptions), [groupNode], options);
5294 var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
5295 groupNode.height *= multiplier;
5296 groupNode.depth *= multiplier;
5297 }
5298 return groupNode;
5299 } else {
5300 throw new ParseError("Got group of unknown type: '" + group.type + "'");
5301 }
5302};
5303function buildHTMLUnbreakable(children, options) {
5304 var body = makeSpan$1(["base"], children, options);
5305 var strut = makeSpan$1(["strut"]);
5306 strut.style.height = makeEm(body.height + body.depth);
5307 if (body.depth) {
5308 strut.style.verticalAlign = makeEm(-body.depth);
5309 }
5310 body.children.unshift(strut);
5311 return body;
5312}
5313function buildHTML(tree, options) {
5314 var tag = null;
5315 if (tree.length === 1 && tree[0].type === "tag") {
5316 tag = tree[0].tag;
5317 tree = tree[0].body;
5318 }
5319 var expression = buildExpression$1(tree, options, "root");
5320 var eqnNum;
5321 if (expression.length === 2 && expression[1].hasClass("tag")) {
5322 eqnNum = expression.pop();
5323 }
5324 var children = [];
5325 var parts = [];
5326 for (var i = 0; i < expression.length; i++) {
5327 parts.push(expression[i]);
5328 if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) {
5329 var nobreak = false;
5330 while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) {
5331 i++;
5332 parts.push(expression[i]);
5333 if (expression[i].hasClass("nobreak")) {
5334 nobreak = true;
5335 }
5336 }
5337 if (!nobreak) {
5338 children.push(buildHTMLUnbreakable(parts, options));
5339 parts = [];
5340 }
5341 } else if (expression[i].hasClass("newline")) {
5342 parts.pop();
5343 if (parts.length > 0) {
5344 children.push(buildHTMLUnbreakable(parts, options));
5345 parts = [];
5346 }
5347 children.push(expression[i]);
5348 }
5349 }
5350 if (parts.length > 0) {
5351 children.push(buildHTMLUnbreakable(parts, options));
5352 }
5353 var tagChild;
5354 if (tag) {
5355 tagChild = buildHTMLUnbreakable(buildExpression$1(tag, options, true));
5356 tagChild.classes = ["tag"];
5357 children.push(tagChild);
5358 } else if (eqnNum) {
5359 children.push(eqnNum);
5360 }
5361 var htmlNode = makeSpan$1(["katex-html"], children);
5362 htmlNode.setAttribute("aria-hidden", "true");
5363 if (tagChild) {
5364 var strut = tagChild.children[0];
5365 strut.style.height = makeEm(htmlNode.height + htmlNode.depth);
5366 if (htmlNode.depth) {
5367 strut.style.verticalAlign = makeEm(-htmlNode.depth);
5368 }
5369 }
5370 return htmlNode;
5371}
5372function newDocumentFragment(children) {
5373 return new DocumentFragment(children);
5374}
5375class MathNode {
5376 constructor(type, children, classes) {
5377 this.type = void 0;
5378 this.attributes = void 0;
5379 this.children = void 0;
5380 this.classes = void 0;
5381 this.type = type;
5382 this.attributes = {};
5383 this.children = children || [];
5384 this.classes = classes || [];
5385 }
5386 /**
5387 * Sets an attribute on a MathML node. MathML depends on attributes to convey a
5388 * semantic content, so this is used heavily.
5389 */
5390 setAttribute(name, value) {
5391 this.attributes[name] = value;
5392 }
5393 /**
5394 * Gets an attribute on a MathML node.
5395 */
5396 getAttribute(name) {
5397 return this.attributes[name];
5398 }
5399 /**
5400 * Converts the math node into a MathML-namespaced DOM element.
5401 */
5402 toNode() {
5403 var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
5404 for (var attr in this.attributes) {
5405 if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
5406 node.setAttribute(attr, this.attributes[attr]);
5407 }
5408 }
5409 if (this.classes.length > 0) {
5410 node.className = createClass(this.classes);
5411 }
5412 for (var i = 0; i < this.children.length; i++) {
5413 node.appendChild(this.children[i].toNode());
5414 }
5415 return node;
5416 }
5417 /**
5418 * Converts the math node into an HTML markup string.
5419 */
5420 toMarkup() {
5421 var markup = "<" + this.type;
5422 for (var attr in this.attributes) {
5423 if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
5424 markup += " " + attr + '="';
5425 markup += utils.escape(this.attributes[attr]);
5426 markup += '"';
5427 }
5428 }
5429 if (this.classes.length > 0) {
5430 markup += ' class ="' + utils.escape(createClass(this.classes)) + '"';
5431 }
5432 markup += ">";
5433 for (var i = 0; i < this.children.length; i++) {
5434 markup += this.children[i].toMarkup();
5435 }
5436 markup += "</" + this.type + ">";
5437 return markup;
5438 }
5439 /**
5440 * Converts the math node into a string, similar to innerText, but escaped.
5441 */
5442 toText() {
5443 return this.children.map((child) => child.toText()).join("");
5444 }
5445}
5446class TextNode {
5447 constructor(text2) {
5448 this.text = void 0;
5449 this.text = text2;
5450 }
5451 /**
5452 * Converts the text node into a DOM text node.
5453 */
5454 toNode() {
5455 return document.createTextNode(this.text);
5456 }
5457 /**
5458 * Converts the text node into escaped HTML markup
5459 * (representing the text itself).
5460 */
5461 toMarkup() {
5462 return utils.escape(this.toText());
5463 }
5464 /**
5465 * Converts the text node into a string
5466 * (representing the text itself).
5467 */
5468 toText() {
5469 return this.text;
5470 }
5471}
5472class SpaceNode {
5473 /**
5474 * Create a Space node with width given in CSS ems.
5475 */
5476 constructor(width) {
5477 this.width = void 0;
5478 this.character = void 0;
5479 this.width = width;
5480 if (width >= 0.05555 && width <= 0.05556) {
5481 this.character = " ";
5482 } else if (width >= 0.1666 && width <= 0.1667) {
5483 this.character = " ";
5484 } else if (width >= 0.2222 && width <= 0.2223) {
5485 this.character = " ";
5486 } else if (width >= 0.2777 && width <= 0.2778) {
5487 this.character = "  ";
5488 } else if (width >= -0.05556 && width <= -0.05555) {
5489 this.character = " ⁣";
5490 } else if (width >= -0.1667 && width <= -0.1666) {
5491 this.character = " ⁣";
5492 } else if (width >= -0.2223 && width <= -0.2222) {
5493 this.character = " ⁣";
5494 } else if (width >= -0.2778 && width <= -0.2777) {
5495 this.character = " ⁣";
5496 } else {
5497 this.character = null;
5498 }
5499 }
5500 /**
5501 * Converts the math node into a MathML-namespaced DOM element.
5502 */
5503 toNode() {
5504 if (this.character) {
5505 return document.createTextNode(this.character);
5506 } else {
5507 var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace");
5508 node.setAttribute("width", makeEm(this.width));
5509 return node;
5510 }
5511 }
5512 /**
5513 * Converts the math node into an HTML markup string.
5514 */
5515 toMarkup() {
5516 if (this.character) {
5517 return "<mtext>" + this.character + "</mtext>";
5518 } else {
5519 return '<mspace width="' + makeEm(this.width) + '"/>';
5520 }
5521 }
5522 /**
5523 * Converts the math node into a string, similar to innerText.
5524 */
5525 toText() {
5526 if (this.character) {
5527 return this.character;
5528 } else {
5529 return " ";
5530 }
5531 }
5532}
5533var mathMLTree = {
5534 MathNode,
5535 TextNode,
5536 SpaceNode,
5537 newDocumentFragment
5538};
5539var makeText = function makeText2(text2, mode, options) {
5540 if (symbols[mode][text2] && symbols[mode][text2].replace && text2.charCodeAt(0) !== 55349 && !(ligatures.hasOwnProperty(text2) && options && (options.fontFamily && options.fontFamily.slice(4, 6) === "tt" || options.font && options.font.slice(4, 6) === "tt"))) {
5541 text2 = symbols[mode][text2].replace;
5542 }
5543 return new mathMLTree.TextNode(text2);
5544};
5545var makeRow = function makeRow2(body) {
5546 if (body.length === 1) {
5547 return body[0];
5548 } else {
5549 return new mathMLTree.MathNode("mrow", body);
5550 }
5551};
5552var getVariant = function getVariant2(group, options) {
5553 if (options.fontFamily === "texttt") {
5554 return "monospace";
5555 } else if (options.fontFamily === "textsf") {
5556 if (options.fontShape === "textit" && options.fontWeight === "textbf") {
5557 return "sans-serif-bold-italic";
5558 } else if (options.fontShape === "textit") {
5559 return "sans-serif-italic";
5560 } else if (options.fontWeight === "textbf") {
5561 return "bold-sans-serif";
5562 } else {
5563 return "sans-serif";
5564 }
5565 } else if (options.fontShape === "textit" && options.fontWeight === "textbf") {
5566 return "bold-italic";
5567 } else if (options.fontShape === "textit") {
5568 return "italic";
5569 } else if (options.fontWeight === "textbf") {
5570 return "bold";
5571 }
5572 var font = options.font;
5573 if (!font || font === "mathnormal") {
5574 return null;
5575 }
5576 var mode = group.mode;
5577 if (font === "mathit") {
5578 return "italic";
5579 } else if (font === "boldsymbol") {
5580 return group.type === "textord" ? "bold" : "bold-italic";
5581 } else if (font === "mathbf") {
5582 return "bold";
5583 } else if (font === "mathbb") {
5584 return "double-struck";
5585 } else if (font === "mathfrak") {
5586 return "fraktur";
5587 } else if (font === "mathscr" || font === "mathcal") {
5588 return "script";
5589 } else if (font === "mathsf") {
5590 return "sans-serif";
5591 } else if (font === "mathtt") {
5592 return "monospace";
5593 }
5594 var text2 = group.text;
5595 if (utils.contains(["\\imath", "\\jmath"], text2)) {
5596 return null;
5597 }
5598 if (symbols[mode][text2] && symbols[mode][text2].replace) {
5599 text2 = symbols[mode][text2].replace;
5600 }
5601 var fontName = buildCommon.fontMap[font].fontName;
5602 if (getCharacterMetrics(text2, fontName, mode)) {
5603 return buildCommon.fontMap[font].variant;
5604 }
5605 return null;
5606};
5607var buildExpression2 = function buildExpression3(expression, options, isOrdgroup) {
5608 if (expression.length === 1) {
5609 var group = buildGroup2(expression[0], options);
5610 if (isOrdgroup && group instanceof MathNode && group.type === "mo") {
5611 group.setAttribute("lspace", "0em");
5612 group.setAttribute("rspace", "0em");
5613 }
5614 return [group];
5615 }
5616 var groups = [];
5617 var lastGroup;
5618 for (var i = 0; i < expression.length; i++) {
5619 var _group = buildGroup2(expression[i], options);
5620 if (_group instanceof MathNode && lastGroup instanceof MathNode) {
5621 if (_group.type === "mtext" && lastGroup.type === "mtext" && _group.getAttribute("mathvariant") === lastGroup.getAttribute("mathvariant")) {
5622 lastGroup.children.push(..._group.children);
5623 continue;
5624 } else if (_group.type === "mn" && lastGroup.type === "mn") {
5625 lastGroup.children.push(..._group.children);
5626 continue;
5627 } else if (_group.type === "mi" && _group.children.length === 1 && lastGroup.type === "mn") {
5628 var child = _group.children[0];
5629 if (child instanceof TextNode && child.text === ".") {
5630 lastGroup.children.push(..._group.children);
5631 continue;
5632 }
5633 } else if (lastGroup.type === "mi" && lastGroup.children.length === 1) {
5634 var lastChild = lastGroup.children[0];
5635 if (lastChild instanceof TextNode && lastChild.text === "̸" && (_group.type === "mo" || _group.type === "mi" || _group.type === "mn")) {
5636 var _child = _group.children[0];
5637 if (_child instanceof TextNode && _child.text.length > 0) {
5638 _child.text = _child.text.slice(0, 1) + "̸" + _child.text.slice(1);
5639 groups.pop();
5640 }
5641 }
5642 }
5643 }
5644 groups.push(_group);
5645 lastGroup = _group;
5646 }
5647 return groups;
5648};
5649var buildExpressionRow = function buildExpressionRow2(expression, options, isOrdgroup) {
5650 return makeRow(buildExpression2(expression, options, isOrdgroup));
5651};
5652var buildGroup2 = function buildGroup3(group, options) {
5653 if (!group) {
5654 return new mathMLTree.MathNode("mrow");
5655 }
5656 if (_mathmlGroupBuilders[group.type]) {
5657 var result = _mathmlGroupBuilders[group.type](group, options);
5658 return result;
5659 } else {
5660 throw new ParseError("Got group of unknown type: '" + group.type + "'");
5661 }
5662};
5663function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) {
5664 var expression = buildExpression2(tree, options);
5665 var wrapper;
5666 if (expression.length === 1 && expression[0] instanceof MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) {
5667 wrapper = expression[0];
5668 } else {
5669 wrapper = new mathMLTree.MathNode("mrow", expression);
5670 }
5671 var annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]);
5672 annotation.setAttribute("encoding", "application/x-tex");
5673 var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
5674 var math2 = new mathMLTree.MathNode("math", [semantics]);
5675 math2.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
5676 if (isDisplayMode) {
5677 math2.setAttribute("display", "block");
5678 }
5679 var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml";
5680 return buildCommon.makeSpan([wrapperClass], [math2]);
5681}
5682var optionsFromSettings = function optionsFromSettings2(settings) {
5683 return new Options({
5684 style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT,
5685 maxSize: settings.maxSize,
5686 minRuleThickness: settings.minRuleThickness
5687 });
5688};
5689var displayWrap = function displayWrap2(node, settings) {
5690 if (settings.displayMode) {
5691 var classes = ["katex-display"];
5692 if (settings.leqno) {
5693 classes.push("leqno");
5694 }
5695 if (settings.fleqn) {
5696 classes.push("fleqn");
5697 }
5698 node = buildCommon.makeSpan(classes, [node]);
5699 }
5700 return node;
5701};
5702var buildTree = function buildTree2(tree, expression, settings) {
5703 var options = optionsFromSettings(settings);
5704 var katexNode;
5705 if (settings.output === "mathml") {
5706 return buildMathML(tree, expression, options, settings.displayMode, true);
5707 } else if (settings.output === "html") {
5708 var htmlNode = buildHTML(tree, options);
5709 katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
5710 } else {
5711 var mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false);
5712 var _htmlNode = buildHTML(tree, options);
5713 katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]);
5714 }
5715 return displayWrap(katexNode, settings);
5716};
5717var buildHTMLTree = function buildHTMLTree2(tree, expression, settings) {
5718 var options = optionsFromSettings(settings);
5719 var htmlNode = buildHTML(tree, options);
5720 var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
5721 return displayWrap(katexNode, settings);
5722};
5723var stretchyCodePoint = {
5724 widehat: "^",
5725 widecheck: "ˇ",
5726 widetilde: "~",
5727 utilde: "~",
5728 overleftarrow: "←",
5729 underleftarrow: "←",
5730 xleftarrow: "←",
5731 overrightarrow: "→",
5732 underrightarrow: "→",
5733 xrightarrow: "→",
5734 underbrace: "⏟",
5735 overbrace: "⏞",
5736 overgroup: "⏠",
5737 undergroup: "⏡",
5738 overleftrightarrow: "↔",
5739 underleftrightarrow: "↔",
5740 xleftrightarrow: "↔",
5741 Overrightarrow: "⇒",
5742 xRightarrow: "⇒",
5743 overleftharpoon: "↼",
5744 xleftharpoonup: "↼",
5745 overrightharpoon: "⇀",
5746 xrightharpoonup: "⇀",
5747 xLeftarrow: "⇐",
5748 xLeftrightarrow: "⇔",
5749 xhookleftarrow: "↩",
5750 xhookrightarrow: "↪",
5751 xmapsto: "↦",
5752 xrightharpoondown: "⇁",
5753 xleftharpoondown: "↽",
5754 xrightleftharpoons: "⇌",
5755 xleftrightharpoons: "⇋",
5756 xtwoheadleftarrow: "↞",
5757 xtwoheadrightarrow: "↠",
5758 xlongequal: "=",
5759 xtofrom: "⇄",
5760 xrightleftarrows: "⇄",
5761 xrightequilibrium: "⇌",
5762 // Not a perfect match.
5763 xleftequilibrium: "⇋",
5764 // None better available.
5765 "\\cdrightarrow": "→",
5766 "\\cdleftarrow": "←",
5767 "\\cdlongequal": "="
5768};
5769var mathMLnode = function mathMLnode2(label) {
5770 var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/, "")])]);
5771 node.setAttribute("stretchy", "true");
5772 return node;
5773};
5774var katexImagesData = {
5775 // path(s), minWidth, height, align
5776 overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
5777 overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
5778 underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
5779 underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
5780 xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"],
5781 "\\cdrightarrow": [["rightarrow"], 3, 522, "xMaxYMin"],
5782 // CD minwwidth2.5pc
5783 xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"],
5784 "\\cdleftarrow": [["leftarrow"], 3, 522, "xMinYMin"],
5785 Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"],
5786 xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"],
5787 xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"],
5788 overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"],
5789 xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"],
5790 xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"],
5791 overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
5792 xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
5793 xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"],
5794 xlongequal: [["longequal"], 0.888, 334, "xMinYMin"],
5795 "\\cdlongequal": [["longequal"], 3, 334, "xMinYMin"],
5796 xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"],
5797 xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"],
5798 overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
5799 overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548],
5800 underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548],
5801 underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
5802 xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522],
5803 xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560],
5804 xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716],
5805 xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716],
5806 xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522],
5807 xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522],
5808 overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
5809 underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
5810 overgroup: [["leftgroup", "rightgroup"], 0.888, 342],
5811 undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342],
5812 xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522],
5813 xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528],
5814 // The next three arrows are from the mhchem package.
5815 // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the
5816 // document as \xrightarrow or \xrightleftharpoons. Those have
5817 // min-length = 1.75em, so we set min-length on these next three to match.
5818 xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901],
5819 xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716],
5820 xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716]
5821};
5822var groupLength = function groupLength2(arg) {
5823 if (arg.type === "ordgroup") {
5824 return arg.body.length;
5825 } else {
5826 return 1;
5827 }
5828};
5829var svgSpan = function svgSpan2(group, options) {
5830 function buildSvgSpan_() {
5831 var viewBoxWidth = 4e5;
5832 var label = group.label.slice(1);
5833 if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) {
5834 var grp = group;
5835 var numChars = groupLength(grp.base);
5836 var viewBoxHeight;
5837 var pathName;
5838 var _height;
5839 if (numChars > 5) {
5840 if (label === "widehat" || label === "widecheck") {
5841 viewBoxHeight = 420;
5842 viewBoxWidth = 2364;
5843 _height = 0.42;
5844 pathName = label + "4";
5845 } else {
5846 viewBoxHeight = 312;
5847 viewBoxWidth = 2340;
5848 _height = 0.34;
5849 pathName = "tilde4";
5850 }
5851 } else {
5852 var imgIndex = [1, 1, 2, 2, 3, 3][numChars];
5853 if (label === "widehat" || label === "widecheck") {
5854 viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex];
5855 viewBoxHeight = [0, 239, 300, 360, 420][imgIndex];
5856 _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex];
5857 pathName = label + imgIndex;
5858 } else {
5859 viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex];
5860 viewBoxHeight = [0, 260, 286, 306, 312][imgIndex];
5861 _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex];
5862 pathName = "tilde" + imgIndex;
5863 }
5864 }
5865 var path2 = new PathNode(pathName);
5866 var svgNode = new SvgNode([path2], {
5867 "width": "100%",
5868 "height": makeEm(_height),
5869 "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight,
5870 "preserveAspectRatio": "none"
5871 });
5872 return {
5873 span: buildCommon.makeSvgSpan([], [svgNode], options),
5874 minWidth: 0,
5875 height: _height
5876 };
5877 } else {
5878 var spans = [];
5879 var data = katexImagesData[label];
5880 var [paths, _minWidth, _viewBoxHeight] = data;
5881 var _height2 = _viewBoxHeight / 1e3;
5882 var numSvgChildren = paths.length;
5883 var widthClasses;
5884 var aligns;
5885 if (numSvgChildren === 1) {
5886 var align1 = data[3];
5887 widthClasses = ["hide-tail"];
5888 aligns = [align1];
5889 } else if (numSvgChildren === 2) {
5890 widthClasses = ["halfarrow-left", "halfarrow-right"];
5891 aligns = ["xMinYMin", "xMaxYMin"];
5892 } else if (numSvgChildren === 3) {
5893 widthClasses = ["brace-left", "brace-center", "brace-right"];
5894 aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"];
5895 } else {
5896 throw new Error("Correct katexImagesData or update code here to support\n " + numSvgChildren + " children.");
5897 }
5898 for (var i = 0; i < numSvgChildren; i++) {
5899 var _path = new PathNode(paths[i]);
5900 var _svgNode = new SvgNode([_path], {
5901 "width": "400em",
5902 "height": makeEm(_height2),
5903 "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight,
5904 "preserveAspectRatio": aligns[i] + " slice"
5905 });
5906 var _span = buildCommon.makeSvgSpan([widthClasses[i]], [_svgNode], options);
5907 if (numSvgChildren === 1) {
5908 return {
5909 span: _span,
5910 minWidth: _minWidth,
5911 height: _height2
5912 };
5913 } else {
5914 _span.style.height = makeEm(_height2);
5915 spans.push(_span);
5916 }
5917 }
5918 return {
5919 span: buildCommon.makeSpan(["stretchy"], spans, options),
5920 minWidth: _minWidth,
5921 height: _height2
5922 };
5923 }
5924 }
5925 var {
5926 span,
5927 minWidth,
5928 height
5929 } = buildSvgSpan_();
5930 span.height = height;
5931 span.style.height = makeEm(height);
5932 if (minWidth > 0) {
5933 span.style.minWidth = makeEm(minWidth);
5934 }
5935 return span;
5936};
5937var encloseSpan = function encloseSpan2(inner2, label, topPad, bottomPad, options) {
5938 var img;
5939 var totalHeight = inner2.height + inner2.depth + topPad + bottomPad;
5940 if (/fbox|color|angl/.test(label)) {
5941 img = buildCommon.makeSpan(["stretchy", label], [], options);
5942 if (label === "fbox") {
5943 var color = options.color && options.getColor();
5944 if (color) {
5945 img.style.borderColor = color;
5946 }
5947 }
5948 } else {
5949 var lines = [];
5950 if (/^[bx]cancel$/.test(label)) {
5951 lines.push(new LineNode({
5952 "x1": "0",
5953 "y1": "0",
5954 "x2": "100%",
5955 "y2": "100%",
5956 "stroke-width": "0.046em"
5957 }));
5958 }
5959 if (/^x?cancel$/.test(label)) {
5960 lines.push(new LineNode({
5961 "x1": "0",
5962 "y1": "100%",
5963 "x2": "100%",
5964 "y2": "0",
5965 "stroke-width": "0.046em"
5966 }));
5967 }
5968 var svgNode = new SvgNode(lines, {
5969 "width": "100%",
5970 "height": makeEm(totalHeight)
5971 });
5972 img = buildCommon.makeSvgSpan([], [svgNode], options);
5973 }
5974 img.height = totalHeight;
5975 img.style.height = makeEm(totalHeight);
5976 return img;
5977};
5978var stretchy = {
5979 encloseSpan,
5980 mathMLnode,
5981 svgSpan
5982};
5983function assertNodeType(node, type) {
5984 if (!node || node.type !== type) {
5985 throw new Error("Expected node of type " + type + ", but got " + (node ? "node of type " + node.type : String(node)));
5986 }
5987 return node;
5988}
5989function assertSymbolNodeType(node) {
5990 var typedNode = checkSymbolNodeType(node);
5991 if (!typedNode) {
5992 throw new Error("Expected node of symbol group type, but got " + (node ? "node of type " + node.type : String(node)));
5993 }
5994 return typedNode;
5995}
5996function checkSymbolNodeType(node) {
5997 if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) {
5998 return node;
5999 }
6000 return null;
6001}
6002var htmlBuilder$a = (grp, options) => {
6003 var base;
6004 var group;
6005 var supSubGroup;
6006 if (grp && grp.type === "supsub") {
6007 group = assertNodeType(grp.base, "accent");
6008 base = group.base;
6009 grp.base = base;
6010 supSubGroup = assertSpan(buildGroup$1(grp, options));
6011 grp.base = group;
6012 } else {
6013 group = assertNodeType(grp, "accent");
6014 base = group.base;
6015 }
6016 var body = buildGroup$1(base, options.havingCrampedStyle());
6017 var mustShift = group.isShifty && utils.isCharacterBox(base);
6018 var skew = 0;
6019 if (mustShift) {
6020 var baseChar = utils.getBaseElem(base);
6021 var baseGroup = buildGroup$1(baseChar, options.havingCrampedStyle());
6022 skew = assertSymbolDomNode(baseGroup).skew;
6023 }
6024 var accentBelow = group.label === "\\c";
6025 var clearance = accentBelow ? body.height + body.depth : Math.min(body.height, options.fontMetrics().xHeight);
6026 var accentBody;
6027 if (!group.isStretchy) {
6028 var accent2;
6029 var width;
6030 if (group.label === "\\vec") {
6031 accent2 = buildCommon.staticSvg("vec", options);
6032 width = buildCommon.svgData.vec[1];
6033 } else {
6034 accent2 = buildCommon.makeOrd({
6035 mode: group.mode,
6036 text: group.label
6037 }, options, "textord");
6038 accent2 = assertSymbolDomNode(accent2);
6039 accent2.italic = 0;
6040 width = accent2.width;
6041 if (accentBelow) {
6042 clearance += accent2.depth;
6043 }
6044 }
6045 accentBody = buildCommon.makeSpan(["accent-body"], [accent2]);
6046 var accentFull = group.label === "\\textcircled";
6047 if (accentFull) {
6048 accentBody.classes.push("accent-full");
6049 clearance = body.height;
6050 }
6051 var left = skew;
6052 if (!accentFull) {
6053 left -= width / 2;
6054 }
6055 accentBody.style.left = makeEm(left);
6056 if (group.label === "\\textcircled") {
6057 accentBody.style.top = ".2em";
6058 }
6059 accentBody = buildCommon.makeVList({
6060 positionType: "firstBaseline",
6061 children: [{
6062 type: "elem",
6063 elem: body
6064 }, {
6065 type: "kern",
6066 size: -clearance
6067 }, {
6068 type: "elem",
6069 elem: accentBody
6070 }]
6071 }, options);
6072 } else {
6073 accentBody = stretchy.svgSpan(group, options);
6074 accentBody = buildCommon.makeVList({
6075 positionType: "firstBaseline",
6076 children: [{
6077 type: "elem",
6078 elem: body
6079 }, {
6080 type: "elem",
6081 elem: accentBody,
6082 wrapperClasses: ["svg-align"],
6083 wrapperStyle: skew > 0 ? {
6084 width: "calc(100% - " + makeEm(2 * skew) + ")",
6085 marginLeft: makeEm(2 * skew)
6086 } : void 0
6087 }]
6088 }, options);
6089 }
6090 var accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options);
6091 if (supSubGroup) {
6092 supSubGroup.children[0] = accentWrap;
6093 supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height);
6094 supSubGroup.classes[0] = "mord";
6095 return supSubGroup;
6096 } else {
6097 return accentWrap;
6098 }
6099};
6100var mathmlBuilder$9 = (group, options) => {
6101 var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]);
6102 var node = new mathMLTree.MathNode("mover", [buildGroup2(group.base, options), accentNode]);
6103 node.setAttribute("accent", "true");
6104 return node;
6105};
6106var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map((accent2) => "\\" + accent2).join("|"));
6107defineFunction({
6108 type: "accent",
6109 names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"],
6110 props: {
6111 numArgs: 1
6112 },
6113 handler: (context, args) => {
6114 var base = normalizeArgument(args[0]);
6115 var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);
6116 var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck";
6117 return {
6118 type: "accent",
6119 mode: context.parser.mode,
6120 label: context.funcName,
6121 isStretchy,
6122 isShifty,
6123 base
6124 };
6125 },
6126 htmlBuilder: htmlBuilder$a,
6127 mathmlBuilder: mathmlBuilder$9
6128});
6129defineFunction({
6130 type: "accent",
6131 names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"],
6132 props: {
6133 numArgs: 1,
6134 allowedInText: true,
6135 allowedInMath: true,
6136 // unless in strict mode
6137 argTypes: ["primitive"]
6138 },
6139 handler: (context, args) => {
6140 var base = args[0];
6141 var mode = context.parser.mode;
6142 if (mode === "math") {
6143 context.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + context.funcName + " works only in text mode");
6144 mode = "text";
6145 }
6146 return {
6147 type: "accent",
6148 mode,
6149 label: context.funcName,
6150 isStretchy: false,
6151 isShifty: true,
6152 base
6153 };
6154 },
6155 htmlBuilder: htmlBuilder$a,
6156 mathmlBuilder: mathmlBuilder$9
6157});
6158defineFunction({
6159 type: "accentUnder",
6160 names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
6161 props: {
6162 numArgs: 1
6163 },
6164 handler: (_ref, args) => {
6165 var {
6166 parser,
6167 funcName
6168 } = _ref;
6169 var base = args[0];
6170 return {
6171 type: "accentUnder",
6172 mode: parser.mode,
6173 label: funcName,
6174 base
6175 };
6176 },
6177 htmlBuilder: (group, options) => {
6178 var innerGroup = buildGroup$1(group.base, options);
6179 var accentBody = stretchy.svgSpan(group, options);
6180 var kern = group.label === "\\utilde" ? 0.12 : 0;
6181 var vlist = buildCommon.makeVList({
6182 positionType: "top",
6183 positionData: innerGroup.height,
6184 children: [{
6185 type: "elem",
6186 elem: accentBody,
6187 wrapperClasses: ["svg-align"]
6188 }, {
6189 type: "kern",
6190 size: kern
6191 }, {
6192 type: "elem",
6193 elem: innerGroup
6194 }]
6195 }, options);
6196 return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options);
6197 },
6198 mathmlBuilder: (group, options) => {
6199 var accentNode = stretchy.mathMLnode(group.label);
6200 var node = new mathMLTree.MathNode("munder", [buildGroup2(group.base, options), accentNode]);
6201 node.setAttribute("accentunder", "true");
6202 return node;
6203 }
6204});
6205var paddedNode = (group) => {
6206 var node = new mathMLTree.MathNode("mpadded", group ? [group] : []);
6207 node.setAttribute("width", "+0.6em");
6208 node.setAttribute("lspace", "0.3em");
6209 return node;
6210};
6211defineFunction({
6212 type: "xArrow",
6213 names: [
6214 "\\xleftarrow",
6215 "\\xrightarrow",
6216 "\\xLeftarrow",
6217 "\\xRightarrow",
6218 "\\xleftrightarrow",
6219 "\\xLeftrightarrow",
6220 "\\xhookleftarrow",
6221 "\\xhookrightarrow",
6222 "\\xmapsto",
6223 "\\xrightharpoondown",
6224 "\\xrightharpoonup",
6225 "\\xleftharpoondown",
6226 "\\xleftharpoonup",
6227 "\\xrightleftharpoons",
6228 "\\xleftrightharpoons",
6229 "\\xlongequal",
6230 "\\xtwoheadrightarrow",
6231 "\\xtwoheadleftarrow",
6232 "\\xtofrom",
6233 // The next 3 functions are here to support the mhchem extension.
6234 // Direct use of these functions is discouraged and may break someday.
6235 "\\xrightleftarrows",
6236 "\\xrightequilibrium",
6237 "\\xleftequilibrium",
6238 // The next 3 functions are here only to support the {CD} environment.
6239 "\\\\cdrightarrow",
6240 "\\\\cdleftarrow",
6241 "\\\\cdlongequal"
6242 ],
6243 props: {
6244 numArgs: 1,
6245 numOptionalArgs: 1
6246 },
6247 handler(_ref, args, optArgs) {
6248 var {
6249 parser,
6250 funcName
6251 } = _ref;
6252 return {
6253 type: "xArrow",
6254 mode: parser.mode,
6255 label: funcName,
6256 body: args[0],
6257 below: optArgs[0]
6258 };
6259 },
6260 // Flow is unable to correctly infer the type of `group`, even though it's
6261 // unambiguously determined from the passed-in `type` above.
6262 htmlBuilder(group, options) {
6263 var style = options.style;
6264 var newOptions = options.havingStyle(style.sup());
6265 var upperGroup = buildCommon.wrapFragment(buildGroup$1(group.body, newOptions, options), options);
6266 var arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd";
6267 upperGroup.classes.push(arrowPrefix + "-arrow-pad");
6268 var lowerGroup;
6269 if (group.below) {
6270 newOptions = options.havingStyle(style.sub());
6271 lowerGroup = buildCommon.wrapFragment(buildGroup$1(group.below, newOptions, options), options);
6272 lowerGroup.classes.push(arrowPrefix + "-arrow-pad");
6273 }
6274 var arrowBody = stretchy.svgSpan(group, options);
6275 var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height;
6276 var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111;
6277 if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") {
6278 upperShift -= upperGroup.depth;
6279 }
6280 var vlist;
6281 if (lowerGroup) {
6282 var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;
6283 vlist = buildCommon.makeVList({
6284 positionType: "individualShift",
6285 children: [{
6286 type: "elem",
6287 elem: upperGroup,
6288 shift: upperShift
6289 }, {
6290 type: "elem",
6291 elem: arrowBody,
6292 shift: arrowShift
6293 }, {
6294 type: "elem",
6295 elem: lowerGroup,
6296 shift: lowerShift
6297 }]
6298 }, options);
6299 } else {
6300 vlist = buildCommon.makeVList({
6301 positionType: "individualShift",
6302 children: [{
6303 type: "elem",
6304 elem: upperGroup,
6305 shift: upperShift
6306 }, {
6307 type: "elem",
6308 elem: arrowBody,
6309 shift: arrowShift
6310 }]
6311 }, options);
6312 }
6313 vlist.children[0].children[0].children[1].classes.push("svg-align");
6314 return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options);
6315 },
6316 mathmlBuilder(group, options) {
6317 var arrowNode = stretchy.mathMLnode(group.label);
6318 arrowNode.setAttribute("minsize", group.label.charAt(0) === "x" ? "1.75em" : "3.0em");
6319 var node;
6320 if (group.body) {
6321 var upperNode = paddedNode(buildGroup2(group.body, options));
6322 if (group.below) {
6323 var lowerNode = paddedNode(buildGroup2(group.below, options));
6324 node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]);
6325 } else {
6326 node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]);
6327 }
6328 } else if (group.below) {
6329 var _lowerNode = paddedNode(buildGroup2(group.below, options));
6330 node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]);
6331 } else {
6332 node = paddedNode();
6333 node = new mathMLTree.MathNode("mover", [arrowNode, node]);
6334 }
6335 return node;
6336 }
6337});
6338var makeSpan2 = buildCommon.makeSpan;
6339function htmlBuilder$9(group, options) {
6340 var elements = buildExpression$1(group.body, options, true);
6341 return makeSpan2([group.mclass], elements, options);
6342}
6343function mathmlBuilder$8(group, options) {
6344 var node;
6345 var inner2 = buildExpression2(group.body, options);
6346 if (group.mclass === "minner") {
6347 node = new mathMLTree.MathNode("mpadded", inner2);
6348 } else if (group.mclass === "mord") {
6349 if (group.isCharacterBox) {
6350 node = inner2[0];
6351 node.type = "mi";
6352 } else {
6353 node = new mathMLTree.MathNode("mi", inner2);
6354 }
6355 } else {
6356 if (group.isCharacterBox) {
6357 node = inner2[0];
6358 node.type = "mo";
6359 } else {
6360 node = new mathMLTree.MathNode("mo", inner2);
6361 }
6362 if (group.mclass === "mbin") {
6363 node.attributes.lspace = "0.22em";
6364 node.attributes.rspace = "0.22em";
6365 } else if (group.mclass === "mpunct") {
6366 node.attributes.lspace = "0em";
6367 node.attributes.rspace = "0.17em";
6368 } else if (group.mclass === "mopen" || group.mclass === "mclose") {
6369 node.attributes.lspace = "0em";
6370 node.attributes.rspace = "0em";
6371 } else if (group.mclass === "minner") {
6372 node.attributes.lspace = "0.0556em";
6373 node.attributes.width = "+0.1111em";
6374 }
6375 }
6376 return node;
6377}
6378defineFunction({
6379 type: "mclass",
6380 names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
6381 props: {
6382 numArgs: 1,
6383 primitive: true
6384 },
6385 handler(_ref, args) {
6386 var {
6387 parser,
6388 funcName
6389 } = _ref;
6390 var body = args[0];
6391 return {
6392 type: "mclass",
6393 mode: parser.mode,
6394 mclass: "m" + funcName.slice(5),
6395 // TODO(kevinb): don't prefix with 'm'
6396 body: ordargument(body),
6397 isCharacterBox: utils.isCharacterBox(body)
6398 };
6399 },
6400 htmlBuilder: htmlBuilder$9,
6401 mathmlBuilder: mathmlBuilder$8
6402});
6403var binrelClass = (arg) => {
6404 var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg;
6405 if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) {
6406 return "m" + atom.family;
6407 } else {
6408 return "mord";
6409 }
6410};
6411defineFunction({
6412 type: "mclass",
6413 names: ["\\@binrel"],
6414 props: {
6415 numArgs: 2
6416 },
6417 handler(_ref2, args) {
6418 var {
6419 parser
6420 } = _ref2;
6421 return {
6422 type: "mclass",
6423 mode: parser.mode,
6424 mclass: binrelClass(args[0]),
6425 body: ordargument(args[1]),
6426 isCharacterBox: utils.isCharacterBox(args[1])
6427 };
6428 }
6429});
6430defineFunction({
6431 type: "mclass",
6432 names: ["\\stackrel", "\\overset", "\\underset"],
6433 props: {
6434 numArgs: 2
6435 },
6436 handler(_ref3, args) {
6437 var {
6438 parser,
6439 funcName
6440 } = _ref3;
6441 var baseArg = args[1];
6442 var shiftedArg = args[0];
6443 var mclass;
6444 if (funcName !== "\\stackrel") {
6445 mclass = binrelClass(baseArg);
6446 } else {
6447 mclass = "mrel";
6448 }
6449 var baseOp = {
6450 type: "op",
6451 mode: baseArg.mode,
6452 limits: true,
6453 alwaysHandleSupSub: true,
6454 parentIsSupSub: false,
6455 symbol: false,
6456 suppressBaseShift: funcName !== "\\stackrel",
6457 body: ordargument(baseArg)
6458 };
6459 var supsub = {
6460 type: "supsub",
6461 mode: shiftedArg.mode,
6462 base: baseOp,
6463 sup: funcName === "\\underset" ? null : shiftedArg,
6464 sub: funcName === "\\underset" ? shiftedArg : null
6465 };
6466 return {
6467 type: "mclass",
6468 mode: parser.mode,
6469 mclass,
6470 body: [supsub],
6471 isCharacterBox: utils.isCharacterBox(supsub)
6472 };
6473 },
6474 htmlBuilder: htmlBuilder$9,
6475 mathmlBuilder: mathmlBuilder$8
6476});
6477defineFunction({
6478 type: "pmb",
6479 names: ["\\pmb"],
6480 props: {
6481 numArgs: 1,
6482 allowedInText: true
6483 },
6484 handler(_ref, args) {
6485 var {
6486 parser
6487 } = _ref;
6488 return {
6489 type: "pmb",
6490 mode: parser.mode,
6491 mclass: binrelClass(args[0]),
6492 body: ordargument(args[0])
6493 };
6494 },
6495 htmlBuilder(group, options) {
6496 var elements = buildExpression$1(group.body, options, true);
6497 var node = buildCommon.makeSpan([group.mclass], elements, options);
6498 node.style.textShadow = "0.02em 0.01em 0.04px";
6499 return node;
6500 },
6501 mathmlBuilder(group, style) {
6502 var inner2 = buildExpression2(group.body, style);
6503 var node = new mathMLTree.MathNode("mstyle", inner2);
6504 node.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px");
6505 return node;
6506 }
6507});
6508var cdArrowFunctionName = {
6509 ">": "\\\\cdrightarrow",
6510 "<": "\\\\cdleftarrow",
6511 "=": "\\\\cdlongequal",
6512 "A": "\\uparrow",
6513 "V": "\\downarrow",
6514 "|": "\\Vert",
6515 ".": "no arrow"
6516};
6517var newCell = () => {
6518 return {
6519 type: "styling",
6520 body: [],
6521 mode: "math",
6522 style: "display"
6523 };
6524};
6525var isStartOfArrow = (node) => {
6526 return node.type === "textord" && node.text === "@";
6527};
6528var isLabelEnd = (node, endChar) => {
6529 return (node.type === "mathord" || node.type === "atom") && node.text === endChar;
6530};
6531function cdArrow(arrowChar, labels, parser) {
6532 var funcName = cdArrowFunctionName[arrowChar];
6533 switch (funcName) {
6534 case "\\\\cdrightarrow":
6535 case "\\\\cdleftarrow":
6536 return parser.callFunction(funcName, [labels[0]], [labels[1]]);
6537 case "\\uparrow":
6538 case "\\downarrow": {
6539 var leftLabel = parser.callFunction("\\\\cdleft", [labels[0]], []);
6540 var bareArrow = {
6541 type: "atom",
6542 text: funcName,
6543 mode: "math",
6544 family: "rel"
6545 };
6546 var sizedArrow = parser.callFunction("\\Big", [bareArrow], []);
6547 var rightLabel = parser.callFunction("\\\\cdright", [labels[1]], []);
6548 var arrowGroup = {
6549 type: "ordgroup",
6550 mode: "math",
6551 body: [leftLabel, sizedArrow, rightLabel]
6552 };
6553 return parser.callFunction("\\\\cdparent", [arrowGroup], []);
6554 }
6555 case "\\\\cdlongequal":
6556 return parser.callFunction("\\\\cdlongequal", [], []);
6557 case "\\Vert": {
6558 var arrow = {
6559 type: "textord",
6560 text: "\\Vert",
6561 mode: "math"
6562 };
6563 return parser.callFunction("\\Big", [arrow], []);
6564 }
6565 default:
6566 return {
6567 type: "textord",
6568 text: " ",
6569 mode: "math"
6570 };
6571 }
6572}
6573function parseCD(parser) {
6574 var parsedRows = [];
6575 parser.gullet.beginGroup();
6576 parser.gullet.macros.set("\\cr", "\\\\\\relax");
6577 parser.gullet.beginGroup();
6578 while (true) {
6579 parsedRows.push(parser.parseExpression(false, "\\\\"));
6580 parser.gullet.endGroup();
6581 parser.gullet.beginGroup();
6582 var next = parser.fetch().text;
6583 if (next === "&" || next === "\\\\") {
6584 parser.consume();
6585 } else if (next === "\\end") {
6586 if (parsedRows[parsedRows.length - 1].length === 0) {
6587 parsedRows.pop();
6588 }
6589 break;
6590 } else {
6591 throw new ParseError("Expected \\\\ or \\cr or \\end", parser.nextToken);
6592 }
6593 }
6594 var row = [];
6595 var body = [row];
6596 for (var i = 0; i < parsedRows.length; i++) {
6597 var rowNodes = parsedRows[i];
6598 var cell = newCell();
6599 for (var j = 0; j < rowNodes.length; j++) {
6600 if (!isStartOfArrow(rowNodes[j])) {
6601 cell.body.push(rowNodes[j]);
6602 } else {
6603 row.push(cell);
6604 j += 1;
6605 var arrowChar = assertSymbolNodeType(rowNodes[j]).text;
6606 var labels = new Array(2);
6607 labels[0] = {
6608 type: "ordgroup",
6609 mode: "math",
6610 body: []
6611 };
6612 labels[1] = {
6613 type: "ordgroup",
6614 mode: "math",
6615 body: []
6616 };
6617 if ("=|.".indexOf(arrowChar) > -1)
6618 ;
6619 else if ("<>AV".indexOf(arrowChar) > -1) {
6620 for (var labelNum = 0; labelNum < 2; labelNum++) {
6621 var inLabel = true;
6622 for (var k = j + 1; k < rowNodes.length; k++) {
6623 if (isLabelEnd(rowNodes[k], arrowChar)) {
6624 inLabel = false;
6625 j = k;
6626 break;
6627 }
6628 if (isStartOfArrow(rowNodes[k])) {
6629 throw new ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[k]);
6630 }
6631 labels[labelNum].body.push(rowNodes[k]);
6632 }
6633 if (inLabel) {
6634 throw new ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[j]);
6635 }
6636 }
6637 } else {
6638 throw new ParseError('Expected one of "<>AV=|." after @', rowNodes[j]);
6639 }
6640 var arrow = cdArrow(arrowChar, labels, parser);
6641 var wrappedArrow = {
6642 type: "styling",
6643 body: [arrow],
6644 mode: "math",
6645 style: "display"
6646 // CD is always displaystyle.
6647 };
6648 row.push(wrappedArrow);
6649 cell = newCell();
6650 }
6651 }
6652 if (i % 2 === 0) {
6653 row.push(cell);
6654 } else {
6655 row.shift();
6656 }
6657 row = [];
6658 body.push(row);
6659 }
6660 parser.gullet.endGroup();
6661 parser.gullet.endGroup();
6662 var cols = new Array(body[0].length).fill({
6663 type: "align",
6664 align: "c",
6665 pregap: 0.25,
6666 // CD package sets \enskip between columns.
6667 postgap: 0.25
6668 // So pre and post each get half an \enskip, i.e. 0.25em.
6669 });
6670 return {
6671 type: "array",
6672 mode: "math",
6673 body,
6674 arraystretch: 1,
6675 addJot: true,
6676 rowGaps: [null],
6677 cols,
6678 colSeparationType: "CD",
6679 hLinesBeforeRow: new Array(body.length + 1).fill([])
6680 };
6681}
6682defineFunction({
6683 type: "cdlabel",
6684 names: ["\\\\cdleft", "\\\\cdright"],
6685 props: {
6686 numArgs: 1
6687 },
6688 handler(_ref, args) {
6689 var {
6690 parser,
6691 funcName
6692 } = _ref;
6693 return {
6694 type: "cdlabel",
6695 mode: parser.mode,
6696 side: funcName.slice(4),
6697 label: args[0]
6698 };
6699 },
6700 htmlBuilder(group, options) {
6701 var newOptions = options.havingStyle(options.style.sup());
6702 var label = buildCommon.wrapFragment(buildGroup$1(group.label, newOptions, options), options);
6703 label.classes.push("cd-label-" + group.side);
6704 label.style.bottom = makeEm(0.8 - label.depth);
6705 label.height = 0;
6706 label.depth = 0;
6707 return label;
6708 },
6709 mathmlBuilder(group, options) {
6710 var label = new mathMLTree.MathNode("mrow", [buildGroup2(group.label, options)]);
6711 label = new mathMLTree.MathNode("mpadded", [label]);
6712 label.setAttribute("width", "0");
6713 if (group.side === "left") {
6714 label.setAttribute("lspace", "-1width");
6715 }
6716 label.setAttribute("voffset", "0.7em");
6717 label = new mathMLTree.MathNode("mstyle", [label]);
6718 label.setAttribute("displaystyle", "false");
6719 label.setAttribute("scriptlevel", "1");
6720 return label;
6721 }
6722});
6723defineFunction({
6724 type: "cdlabelparent",
6725 names: ["\\\\cdparent"],
6726 props: {
6727 numArgs: 1
6728 },
6729 handler(_ref2, args) {
6730 var {
6731 parser
6732 } = _ref2;
6733 return {
6734 type: "cdlabelparent",
6735 mode: parser.mode,
6736 fragment: args[0]
6737 };
6738 },
6739 htmlBuilder(group, options) {
6740 var parent = buildCommon.wrapFragment(buildGroup$1(group.fragment, options), options);
6741 parent.classes.push("cd-vert-arrow");
6742 return parent;
6743 },
6744 mathmlBuilder(group, options) {
6745 return new mathMLTree.MathNode("mrow", [buildGroup2(group.fragment, options)]);
6746 }
6747});
6748defineFunction({
6749 type: "textord",
6750 names: ["\\@char"],
6751 props: {
6752 numArgs: 1,
6753 allowedInText: true
6754 },
6755 handler(_ref, args) {
6756 var {
6757 parser
6758 } = _ref;
6759 var arg = assertNodeType(args[0], "ordgroup");
6760 var group = arg.body;
6761 var number = "";
6762 for (var i = 0; i < group.length; i++) {
6763 var node = assertNodeType(group[i], "textord");
6764 number += node.text;
6765 }
6766 var code = parseInt(number);
6767 var text2;
6768 if (isNaN(code)) {
6769 throw new ParseError("\\@char has non-numeric argument " + number);
6770 } else if (code < 0 || code >= 1114111) {
6771 throw new ParseError("\\@char with invalid code point " + number);
6772 } else if (code <= 65535) {
6773 text2 = String.fromCharCode(code);
6774 } else {
6775 code -= 65536;
6776 text2 = String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
6777 }
6778 return {
6779 type: "textord",
6780 mode: parser.mode,
6781 text: text2
6782 };
6783 }
6784});
6785var htmlBuilder$8 = (group, options) => {
6786 var elements = buildExpression$1(group.body, options.withColor(group.color), false);
6787 return buildCommon.makeFragment(elements);
6788};
6789var mathmlBuilder$7 = (group, options) => {
6790 var inner2 = buildExpression2(group.body, options.withColor(group.color));
6791 var node = new mathMLTree.MathNode("mstyle", inner2);
6792 node.setAttribute("mathcolor", group.color);
6793 return node;
6794};
6795defineFunction({
6796 type: "color",
6797 names: ["\\textcolor"],
6798 props: {
6799 numArgs: 2,
6800 allowedInText: true,
6801 argTypes: ["color", "original"]
6802 },
6803 handler(_ref, args) {
6804 var {
6805 parser
6806 } = _ref;
6807 var color = assertNodeType(args[0], "color-token").color;
6808 var body = args[1];
6809 return {
6810 type: "color",
6811 mode: parser.mode,
6812 color,
6813 body: ordargument(body)
6814 };
6815 },
6816 htmlBuilder: htmlBuilder$8,
6817 mathmlBuilder: mathmlBuilder$7
6818});
6819defineFunction({
6820 type: "color",
6821 names: ["\\color"],
6822 props: {
6823 numArgs: 1,
6824 allowedInText: true,
6825 argTypes: ["color"]
6826 },
6827 handler(_ref2, args) {
6828 var {
6829 parser,
6830 breakOnTokenText
6831 } = _ref2;
6832 var color = assertNodeType(args[0], "color-token").color;
6833 parser.gullet.macros.set("\\current@color", color);
6834 var body = parser.parseExpression(true, breakOnTokenText);
6835 return {
6836 type: "color",
6837 mode: parser.mode,
6838 color,
6839 body
6840 };
6841 },
6842 htmlBuilder: htmlBuilder$8,
6843 mathmlBuilder: mathmlBuilder$7
6844});
6845defineFunction({
6846 type: "cr",
6847 names: ["\\\\"],
6848 props: {
6849 numArgs: 0,
6850 numOptionalArgs: 0,
6851 allowedInText: true
6852 },
6853 handler(_ref, args, optArgs) {
6854 var {
6855 parser
6856 } = _ref;
6857 var size = parser.gullet.future().text === "[" ? parser.parseSizeGroup(true) : null;
6858 var newLine = !parser.settings.displayMode || !parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline does nothing in display mode");
6859 return {
6860 type: "cr",
6861 mode: parser.mode,
6862 newLine,
6863 size: size && assertNodeType(size, "size").value
6864 };
6865 },
6866 // The following builders are called only at the top level,
6867 // not within tabular/array environments.
6868 htmlBuilder(group, options) {
6869 var span = buildCommon.makeSpan(["mspace"], [], options);
6870 if (group.newLine) {
6871 span.classes.push("newline");
6872 if (group.size) {
6873 span.style.marginTop = makeEm(calculateSize(group.size, options));
6874 }
6875 }
6876 return span;
6877 },
6878 mathmlBuilder(group, options) {
6879 var node = new mathMLTree.MathNode("mspace");
6880 if (group.newLine) {
6881 node.setAttribute("linebreak", "newline");
6882 if (group.size) {
6883 node.setAttribute("height", makeEm(calculateSize(group.size, options)));
6884 }
6885 }
6886 return node;
6887 }
6888});
6889var globalMap = {
6890 "\\global": "\\global",
6891 "\\long": "\\\\globallong",
6892 "\\\\globallong": "\\\\globallong",
6893 "\\def": "\\gdef",
6894 "\\gdef": "\\gdef",
6895 "\\edef": "\\xdef",
6896 "\\xdef": "\\xdef",
6897 "\\let": "\\\\globallet",
6898 "\\futurelet": "\\\\globalfuture"
6899};
6900var checkControlSequence = (tok) => {
6901 var name = tok.text;
6902 if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
6903 throw new ParseError("Expected a control sequence", tok);
6904 }
6905 return name;
6906};
6907var getRHS = (parser) => {
6908 var tok = parser.gullet.popToken();
6909 if (tok.text === "=") {
6910 tok = parser.gullet.popToken();
6911 if (tok.text === " ") {
6912 tok = parser.gullet.popToken();
6913 }
6914 }
6915 return tok;
6916};
6917var letCommand = (parser, name, tok, global) => {
6918 var macro = parser.gullet.macros.get(tok.text);
6919 if (macro == null) {
6920 tok.noexpand = true;
6921 macro = {
6922 tokens: [tok],
6923 numArgs: 0,
6924 // reproduce the same behavior in expansion
6925 unexpandable: !parser.gullet.isExpandable(tok.text)
6926 };
6927 }
6928 parser.gullet.macros.set(name, macro, global);
6929};
6930defineFunction({
6931 type: "internal",
6932 names: [
6933 "\\global",
6934 "\\long",
6935 "\\\\globallong"
6936 // can’t be entered directly
6937 ],
6938 props: {
6939 numArgs: 0,
6940 allowedInText: true
6941 },
6942 handler(_ref) {
6943 var {
6944 parser,
6945 funcName
6946 } = _ref;
6947 parser.consumeSpaces();
6948 var token = parser.fetch();
6949 if (globalMap[token.text]) {
6950 if (funcName === "\\global" || funcName === "\\\\globallong") {
6951 token.text = globalMap[token.text];
6952 }
6953 return assertNodeType(parser.parseFunction(), "internal");
6954 }
6955 throw new ParseError("Invalid token after macro prefix", token);
6956 }
6957});
6958defineFunction({
6959 type: "internal",
6960 names: ["\\def", "\\gdef", "\\edef", "\\xdef"],
6961 props: {
6962 numArgs: 0,
6963 allowedInText: true,
6964 primitive: true
6965 },
6966 handler(_ref2) {
6967 var {
6968 parser,
6969 funcName
6970 } = _ref2;
6971 var tok = parser.gullet.popToken();
6972 var name = tok.text;
6973 if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
6974 throw new ParseError("Expected a control sequence", tok);
6975 }
6976 var numArgs = 0;
6977 var insert;
6978 var delimiters2 = [[]];
6979 while (parser.gullet.future().text !== "{") {
6980 tok = parser.gullet.popToken();
6981 if (tok.text === "#") {
6982 if (parser.gullet.future().text === "{") {
6983 insert = parser.gullet.future();
6984 delimiters2[numArgs].push("{");
6985 break;
6986 }
6987 tok = parser.gullet.popToken();
6988 if (!/^[1-9]$/.test(tok.text)) {
6989 throw new ParseError('Invalid argument number "' + tok.text + '"');
6990 }
6991 if (parseInt(tok.text) !== numArgs + 1) {
6992 throw new ParseError('Argument number "' + tok.text + '" out of order');
6993 }
6994 numArgs++;
6995 delimiters2.push([]);
6996 } else if (tok.text === "EOF") {
6997 throw new ParseError("Expected a macro definition");
6998 } else {
6999 delimiters2[numArgs].push(tok.text);
7000 }
7001 }
7002 var {
7003 tokens
7004 } = parser.gullet.consumeArg();
7005 if (insert) {
7006 tokens.unshift(insert);
7007 }
7008 if (funcName === "\\edef" || funcName === "\\xdef") {
7009 tokens = parser.gullet.expandTokens(tokens);
7010 tokens.reverse();
7011 }
7012 parser.gullet.macros.set(name, {
7013 tokens,
7014 numArgs,
7015 delimiters: delimiters2
7016 }, funcName === globalMap[funcName]);
7017 return {
7018 type: "internal",
7019 mode: parser.mode
7020 };
7021 }
7022});
7023defineFunction({
7024 type: "internal",
7025 names: [
7026 "\\let",
7027 "\\\\globallet"
7028 // can’t be entered directly
7029 ],
7030 props: {
7031 numArgs: 0,
7032 allowedInText: true,
7033 primitive: true
7034 },
7035 handler(_ref3) {
7036 var {
7037 parser,
7038 funcName
7039 } = _ref3;
7040 var name = checkControlSequence(parser.gullet.popToken());
7041 parser.gullet.consumeSpaces();
7042 var tok = getRHS(parser);
7043 letCommand(parser, name, tok, funcName === "\\\\globallet");
7044 return {
7045 type: "internal",
7046 mode: parser.mode
7047 };
7048 }
7049});
7050defineFunction({
7051 type: "internal",
7052 names: [
7053 "\\futurelet",
7054 "\\\\globalfuture"
7055 // can’t be entered directly
7056 ],
7057 props: {
7058 numArgs: 0,
7059 allowedInText: true,
7060 primitive: true
7061 },
7062 handler(_ref4) {
7063 var {
7064 parser,
7065 funcName
7066 } = _ref4;
7067 var name = checkControlSequence(parser.gullet.popToken());
7068 var middle = parser.gullet.popToken();
7069 var tok = parser.gullet.popToken();
7070 letCommand(parser, name, tok, funcName === "\\\\globalfuture");
7071 parser.gullet.pushToken(tok);
7072 parser.gullet.pushToken(middle);
7073 return {
7074 type: "internal",
7075 mode: parser.mode
7076 };
7077 }
7078});
7079var getMetrics = function getMetrics2(symbol, font, mode) {
7080 var replace = symbols.math[symbol] && symbols.math[symbol].replace;
7081 var metrics = getCharacterMetrics(replace || symbol, font, mode);
7082 if (!metrics) {
7083 throw new Error("Unsupported symbol " + symbol + " and font size " + font + ".");
7084 }
7085 return metrics;
7086};
7087var styleWrap = function styleWrap2(delim, toStyle, options, classes) {
7088 var newOptions = options.havingBaseStyle(toStyle);
7089 var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options);
7090 var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;
7091 span.height *= delimSizeMultiplier;
7092 span.depth *= delimSizeMultiplier;
7093 span.maxFontSize = newOptions.sizeMultiplier;
7094 return span;
7095};
7096var centerSpan = function centerSpan2(span, options, style) {
7097 var newOptions = options.havingBaseStyle(style);
7098 var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight;
7099 span.classes.push("delimcenter");
7100 span.style.top = makeEm(shift);
7101 span.height -= shift;
7102 span.depth += shift;
7103};
7104var makeSmallDelim = function makeSmallDelim2(delim, style, center, options, mode, classes) {
7105 var text2 = buildCommon.makeSymbol(delim, "Main-Regular", mode, options);
7106 var span = styleWrap(text2, style, options, classes);
7107 if (center) {
7108 centerSpan(span, options, style);
7109 }
7110 return span;
7111};
7112var mathrmSize = function mathrmSize2(value, size, mode, options) {
7113 return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options);
7114};
7115var makeLargeDelim = function makeLargeDelim2(delim, size, center, options, mode, classes) {
7116 var inner2 = mathrmSize(delim, size, mode, options);
7117 var span = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner2], options), Style$1.TEXT, options, classes);
7118 if (center) {
7119 centerSpan(span, options, Style$1.TEXT);
7120 }
7121 return span;
7122};
7123var makeGlyphSpan = function makeGlyphSpan2(symbol, font, mode) {
7124 var sizeClass;
7125 if (font === "Size1-Regular") {
7126 sizeClass = "delim-size1";
7127 } else {
7128 sizeClass = "delim-size4";
7129 }
7130 var corner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]);
7131 return {
7132 type: "elem",
7133 elem: corner
7134 };
7135};
7136var makeInner = function makeInner2(ch, height, options) {
7137 var width = fontMetricsData["Size4-Regular"][ch.charCodeAt(0)] ? fontMetricsData["Size4-Regular"][ch.charCodeAt(0)][4] : fontMetricsData["Size1-Regular"][ch.charCodeAt(0)][4];
7138 var path2 = new PathNode("inner", innerPath(ch, Math.round(1e3 * height)));
7139 var svgNode = new SvgNode([path2], {
7140 "width": makeEm(width),
7141 "height": makeEm(height),
7142 // Override CSS rule `.katex svg { width: 100% }`
7143 "style": "width:" + makeEm(width),
7144 "viewBox": "0 0 " + 1e3 * width + " " + Math.round(1e3 * height),
7145 "preserveAspectRatio": "xMinYMin"
7146 });
7147 var span = buildCommon.makeSvgSpan([], [svgNode], options);
7148 span.height = height;
7149 span.style.height = makeEm(height);
7150 span.style.width = makeEm(width);
7151 return {
7152 type: "elem",
7153 elem: span
7154 };
7155};
7156var lapInEms = 8e-3;
7157var lap = {
7158 type: "kern",
7159 size: -1 * lapInEms
7160};
7161var verts = ["|", "\\lvert", "\\rvert", "\\vert"];
7162var doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"];
7163var makeStackedDelim = function makeStackedDelim2(delim, heightTotal, center, options, mode, classes) {
7164 var top;
7165 var middle;
7166 var repeat;
7167 var bottom;
7168 var svgLabel = "";
7169 var viewBoxWidth = 0;
7170 top = repeat = bottom = delim;
7171 middle = null;
7172 var font = "Size1-Regular";
7173 if (delim === "\\uparrow") {
7174 repeat = bottom = "⏐";
7175 } else if (delim === "\\Uparrow") {
7176 repeat = bottom = "‖";
7177 } else if (delim === "\\downarrow") {
7178 top = repeat = "⏐";
7179 } else if (delim === "\\Downarrow") {
7180 top = repeat = "‖";
7181 } else if (delim === "\\updownarrow") {
7182 top = "\\uparrow";
7183 repeat = "⏐";
7184 bottom = "\\downarrow";
7185 } else if (delim === "\\Updownarrow") {
7186 top = "\\Uparrow";
7187 repeat = "‖";
7188 bottom = "\\Downarrow";
7189 } else if (utils.contains(verts, delim)) {
7190 repeat = "∣";
7191 svgLabel = "vert";
7192 viewBoxWidth = 333;
7193 } else if (utils.contains(doubleVerts, delim)) {
7194 repeat = "∥";
7195 svgLabel = "doublevert";
7196 viewBoxWidth = 556;
7197 } else if (delim === "[" || delim === "\\lbrack") {
7198 top = "⎡";
7199 repeat = "⎢";
7200 bottom = "⎣";
7201 font = "Size4-Regular";
7202 svgLabel = "lbrack";
7203 viewBoxWidth = 667;
7204 } else if (delim === "]" || delim === "\\rbrack") {
7205 top = "⎤";
7206 repeat = "⎥";
7207 bottom = "⎦";
7208 font = "Size4-Regular";
7209 svgLabel = "rbrack";
7210 viewBoxWidth = 667;
7211 } else if (delim === "\\lfloor" || delim === "⌊") {
7212 repeat = top = "⎢";
7213 bottom = "⎣";
7214 font = "Size4-Regular";
7215 svgLabel = "lfloor";
7216 viewBoxWidth = 667;
7217 } else if (delim === "\\lceil" || delim === "⌈") {
7218 top = "⎡";
7219 repeat = bottom = "⎢";
7220 font = "Size4-Regular";
7221 svgLabel = "lceil";
7222 viewBoxWidth = 667;
7223 } else if (delim === "\\rfloor" || delim === "⌋") {
7224 repeat = top = "⎥";
7225 bottom = "⎦";
7226 font = "Size4-Regular";
7227 svgLabel = "rfloor";
7228 viewBoxWidth = 667;
7229 } else if (delim === "\\rceil" || delim === "⌉") {
7230 top = "⎤";
7231 repeat = bottom = "⎥";
7232 font = "Size4-Regular";
7233 svgLabel = "rceil";
7234 viewBoxWidth = 667;
7235 } else if (delim === "(" || delim === "\\lparen") {
7236 top = "⎛";
7237 repeat = "⎜";
7238 bottom = "⎝";
7239 font = "Size4-Regular";
7240 svgLabel = "lparen";
7241 viewBoxWidth = 875;
7242 } else if (delim === ")" || delim === "\\rparen") {
7243 top = "⎞";
7244 repeat = "⎟";
7245 bottom = "⎠";
7246 font = "Size4-Regular";
7247 svgLabel = "rparen";
7248 viewBoxWidth = 875;
7249 } else if (delim === "\\{" || delim === "\\lbrace") {
7250 top = "⎧";
7251 middle = "⎨";
7252 bottom = "⎩";
7253 repeat = "⎪";
7254 font = "Size4-Regular";
7255 } else if (delim === "\\}" || delim === "\\rbrace") {
7256 top = "⎫";
7257 middle = "⎬";
7258 bottom = "⎭";
7259 repeat = "⎪";
7260 font = "Size4-Regular";
7261 } else if (delim === "\\lgroup" || delim === "⟮") {
7262 top = "⎧";
7263 bottom = "⎩";
7264 repeat = "⎪";
7265 font = "Size4-Regular";
7266 } else if (delim === "\\rgroup" || delim === "⟯") {
7267 top = "⎫";
7268 bottom = "⎭";
7269 repeat = "⎪";
7270 font = "Size4-Regular";
7271 } else if (delim === "\\lmoustache" || delim === "⎰") {
7272 top = "⎧";
7273 bottom = "⎭";
7274 repeat = "⎪";
7275 font = "Size4-Regular";
7276 } else if (delim === "\\rmoustache" || delim === "⎱") {
7277 top = "⎫";
7278 bottom = "⎩";
7279 repeat = "⎪";
7280 font = "Size4-Regular";
7281 }
7282 var topMetrics = getMetrics(top, font, mode);
7283 var topHeightTotal = topMetrics.height + topMetrics.depth;
7284 var repeatMetrics = getMetrics(repeat, font, mode);
7285 var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth;
7286 var bottomMetrics = getMetrics(bottom, font, mode);
7287 var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth;
7288 var middleHeightTotal = 0;
7289 var middleFactor = 1;
7290 if (middle !== null) {
7291 var middleMetrics = getMetrics(middle, font, mode);
7292 middleHeightTotal = middleMetrics.height + middleMetrics.depth;
7293 middleFactor = 2;
7294 }
7295 var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal;
7296 var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal)));
7297 var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal;
7298 var axisHeight = options.fontMetrics().axisHeight;
7299 if (center) {
7300 axisHeight *= options.sizeMultiplier;
7301 }
7302 var depth = realHeightTotal / 2 - axisHeight;
7303 var stack = [];
7304 if (svgLabel.length > 0) {
7305 var midHeight = realHeightTotal - topHeightTotal - bottomHeightTotal;
7306 var viewBoxHeight = Math.round(realHeightTotal * 1e3);
7307 var pathStr = tallDelim(svgLabel, Math.round(midHeight * 1e3));
7308 var path2 = new PathNode(svgLabel, pathStr);
7309 var width = (viewBoxWidth / 1e3).toFixed(3) + "em";
7310 var height = (viewBoxHeight / 1e3).toFixed(3) + "em";
7311 var svg = new SvgNode([path2], {
7312 "width": width,
7313 "height": height,
7314 "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight
7315 });
7316 var wrapper = buildCommon.makeSvgSpan([], [svg], options);
7317 wrapper.height = viewBoxHeight / 1e3;
7318 wrapper.style.width = width;
7319 wrapper.style.height = height;
7320 stack.push({
7321 type: "elem",
7322 elem: wrapper
7323 });
7324 } else {
7325 stack.push(makeGlyphSpan(bottom, font, mode));
7326 stack.push(lap);
7327 if (middle === null) {
7328 var innerHeight = realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms;
7329 stack.push(makeInner(repeat, innerHeight, options));
7330 } else {
7331 var _innerHeight = (realHeightTotal - topHeightTotal - bottomHeightTotal - middleHeightTotal) / 2 + 2 * lapInEms;
7332 stack.push(makeInner(repeat, _innerHeight, options));
7333 stack.push(lap);
7334 stack.push(makeGlyphSpan(middle, font, mode));
7335 stack.push(lap);
7336 stack.push(makeInner(repeat, _innerHeight, options));
7337 }
7338 stack.push(lap);
7339 stack.push(makeGlyphSpan(top, font, mode));
7340 }
7341 var newOptions = options.havingBaseStyle(Style$1.TEXT);
7342 var inner2 = buildCommon.makeVList({
7343 positionType: "bottom",
7344 positionData: depth,
7345 children: stack
7346 }, newOptions);
7347 return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner2], newOptions), Style$1.TEXT, options, classes);
7348};
7349var vbPad = 80;
7350var emPad = 0.08;
7351var sqrtSvg = function sqrtSvg2(sqrtName, height, viewBoxHeight, extraVinculum, options) {
7352 var path2 = sqrtPath(sqrtName, extraVinculum, viewBoxHeight);
7353 var pathNode = new PathNode(sqrtName, path2);
7354 var svg = new SvgNode([pathNode], {
7355 // Note: 1000:1 ratio of viewBox to document em width.
7356 "width": "400em",
7357 "height": makeEm(height),
7358 "viewBox": "0 0 400000 " + viewBoxHeight,
7359 "preserveAspectRatio": "xMinYMin slice"
7360 });
7361 return buildCommon.makeSvgSpan(["hide-tail"], [svg], options);
7362};
7363var makeSqrtImage = function makeSqrtImage2(height, options) {
7364 var newOptions = options.havingBaseSizing();
7365 var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions);
7366 var sizeMultiplier = newOptions.sizeMultiplier;
7367 var extraVinculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness);
7368 var span;
7369 var spanHeight = 0;
7370 var texHeight = 0;
7371 var viewBoxHeight = 0;
7372 var advanceWidth;
7373 if (delim.type === "small") {
7374 viewBoxHeight = 1e3 + 1e3 * extraVinculum + vbPad;
7375 if (height < 1) {
7376 sizeMultiplier = 1;
7377 } else if (height < 1.4) {
7378 sizeMultiplier = 0.7;
7379 }
7380 spanHeight = (1 + extraVinculum + emPad) / sizeMultiplier;
7381 texHeight = (1 + extraVinculum) / sizeMultiplier;
7382 span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraVinculum, options);
7383 span.style.minWidth = "0.853em";
7384 advanceWidth = 0.833 / sizeMultiplier;
7385 } else if (delim.type === "large") {
7386 viewBoxHeight = (1e3 + vbPad) * sizeToMaxHeight[delim.size];
7387 texHeight = (sizeToMaxHeight[delim.size] + extraVinculum) / sizeMultiplier;
7388 spanHeight = (sizeToMaxHeight[delim.size] + extraVinculum + emPad) / sizeMultiplier;
7389 span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraVinculum, options);
7390 span.style.minWidth = "1.02em";
7391 advanceWidth = 1 / sizeMultiplier;
7392 } else {
7393 spanHeight = height + extraVinculum + emPad;
7394 texHeight = height + extraVinculum;
7395 viewBoxHeight = Math.floor(1e3 * height + extraVinculum) + vbPad;
7396 span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraVinculum, options);
7397 span.style.minWidth = "0.742em";
7398 advanceWidth = 1.056;
7399 }
7400 span.height = texHeight;
7401 span.style.height = makeEm(spanHeight);
7402 return {
7403 span,
7404 advanceWidth,
7405 // Calculate the actual line width.
7406 // This actually should depend on the chosen font -- e.g. \boldmath
7407 // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
7408 // have thicker rules.
7409 ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraVinculum) * sizeMultiplier
7410 };
7411};
7412var stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "\\surd"];
7413var stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱"];
7414var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"];
7415var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3];
7416var makeSizedDelim = function makeSizedDelim2(delim, size, options, mode, classes) {
7417 if (delim === "<" || delim === "\\lt" || delim === "⟨") {
7418 delim = "\\langle";
7419 } else if (delim === ">" || delim === "\\gt" || delim === "⟩") {
7420 delim = "\\rangle";
7421 }
7422 if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) {
7423 return makeLargeDelim(delim, size, false, options, mode, classes);
7424 } else if (utils.contains(stackAlwaysDelimiters, delim)) {
7425 return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);
7426 } else {
7427 throw new ParseError("Illegal delimiter: '" + delim + "'");
7428 }
7429};
7430var stackNeverDelimiterSequence = [{
7431 type: "small",
7432 style: Style$1.SCRIPTSCRIPT
7433}, {
7434 type: "small",
7435 style: Style$1.SCRIPT
7436}, {
7437 type: "small",
7438 style: Style$1.TEXT
7439}, {
7440 type: "large",
7441 size: 1
7442}, {
7443 type: "large",
7444 size: 2
7445}, {
7446 type: "large",
7447 size: 3
7448}, {
7449 type: "large",
7450 size: 4
7451}];
7452var stackAlwaysDelimiterSequence = [{
7453 type: "small",
7454 style: Style$1.SCRIPTSCRIPT
7455}, {
7456 type: "small",
7457 style: Style$1.SCRIPT
7458}, {
7459 type: "small",
7460 style: Style$1.TEXT
7461}, {
7462 type: "stack"
7463}];
7464var stackLargeDelimiterSequence = [{
7465 type: "small",
7466 style: Style$1.SCRIPTSCRIPT
7467}, {
7468 type: "small",
7469 style: Style$1.SCRIPT
7470}, {
7471 type: "small",
7472 style: Style$1.TEXT
7473}, {
7474 type: "large",
7475 size: 1
7476}, {
7477 type: "large",
7478 size: 2
7479}, {
7480 type: "large",
7481 size: 3
7482}, {
7483 type: "large",
7484 size: 4
7485}, {
7486 type: "stack"
7487}];
7488var delimTypeToFont = function delimTypeToFont2(type) {
7489 if (type.type === "small") {
7490 return "Main-Regular";
7491 } else if (type.type === "large") {
7492 return "Size" + type.size + "-Regular";
7493 } else if (type.type === "stack") {
7494 return "Size4-Regular";
7495 } else {
7496 throw new Error("Add support for delim type '" + type.type + "' here.");
7497 }
7498};
7499var traverseSequence = function traverseSequence2(delim, height, sequence, options) {
7500 var start = Math.min(2, 3 - options.style.size);
7501 for (var i = start; i < sequence.length; i++) {
7502 if (sequence[i].type === "stack") {
7503 break;
7504 }
7505 var metrics = getMetrics(delim, delimTypeToFont(sequence[i]), "math");
7506 var heightDepth = metrics.height + metrics.depth;
7507 if (sequence[i].type === "small") {
7508 var newOptions = options.havingBaseStyle(sequence[i].style);
7509 heightDepth *= newOptions.sizeMultiplier;
7510 }
7511 if (heightDepth > height) {
7512 return sequence[i];
7513 }
7514 }
7515 return sequence[sequence.length - 1];
7516};
7517var makeCustomSizedDelim = function makeCustomSizedDelim2(delim, height, center, options, mode, classes) {
7518 if (delim === "<" || delim === "\\lt" || delim === "⟨") {
7519 delim = "\\langle";
7520 } else if (delim === ">" || delim === "\\gt" || delim === "⟩") {
7521 delim = "\\rangle";
7522 }
7523 var sequence;
7524 if (utils.contains(stackNeverDelimiters, delim)) {
7525 sequence = stackNeverDelimiterSequence;
7526 } else if (utils.contains(stackLargeDelimiters, delim)) {
7527 sequence = stackLargeDelimiterSequence;
7528 } else {
7529 sequence = stackAlwaysDelimiterSequence;
7530 }
7531 var delimType = traverseSequence(delim, height, sequence, options);
7532 if (delimType.type === "small") {
7533 return makeSmallDelim(delim, delimType.style, center, options, mode, classes);
7534 } else if (delimType.type === "large") {
7535 return makeLargeDelim(delim, delimType.size, center, options, mode, classes);
7536 } else {
7537 return makeStackedDelim(delim, height, center, options, mode, classes);
7538 }
7539};
7540var makeLeftRightDelim = function makeLeftRightDelim2(delim, height, depth, options, mode, classes) {
7541 var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier;
7542 var delimiterFactor = 901;
7543 var delimiterExtend = 5 / options.fontMetrics().ptPerEm;
7544 var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight);
7545 var totalHeight = Math.max(
7546 // In real TeX, calculations are done using integral values which are
7547 // 65536 per pt, or 655360 per em. So, the division here truncates in
7548 // TeX but doesn't here, producing different results. If we wanted to
7549 // exactly match TeX's calculation, we could do
7550 // Math.floor(655360 * maxDistFromAxis / 500) *
7551 // delimiterFactor / 655360
7552 // (To see the difference, compare
7553 // x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
7554 // in TeX and KaTeX)
7555 maxDistFromAxis / 500 * delimiterFactor,
7556 2 * maxDistFromAxis - delimiterExtend
7557 );
7558 return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);
7559};
7560var delimiter = {
7561 sqrtImage: makeSqrtImage,
7562 sizedDelim: makeSizedDelim,
7563 sizeToMaxHeight,
7564 customSizedDelim: makeCustomSizedDelim,
7565 leftRightDelim: makeLeftRightDelim
7566};
7567var delimiterSizes = {
7568 "\\bigl": {
7569 mclass: "mopen",
7570 size: 1
7571 },
7572 "\\Bigl": {
7573 mclass: "mopen",
7574 size: 2
7575 },
7576 "\\biggl": {
7577 mclass: "mopen",
7578 size: 3
7579 },
7580 "\\Biggl": {
7581 mclass: "mopen",
7582 size: 4
7583 },
7584 "\\bigr": {
7585 mclass: "mclose",
7586 size: 1
7587 },
7588 "\\Bigr": {
7589 mclass: "mclose",
7590 size: 2
7591 },
7592 "\\biggr": {
7593 mclass: "mclose",
7594 size: 3
7595 },
7596 "\\Biggr": {
7597 mclass: "mclose",
7598 size: 4
7599 },
7600 "\\bigm": {
7601 mclass: "mrel",
7602 size: 1
7603 },
7604 "\\Bigm": {
7605 mclass: "mrel",
7606 size: 2
7607 },
7608 "\\biggm": {
7609 mclass: "mrel",
7610 size: 3
7611 },
7612 "\\Biggm": {
7613 mclass: "mrel",
7614 size: 4
7615 },
7616 "\\big": {
7617 mclass: "mord",
7618 size: 1
7619 },
7620 "\\Big": {
7621 mclass: "mord",
7622 size: 2
7623 },
7624 "\\bigg": {
7625 mclass: "mord",
7626 size: 3
7627 },
7628 "\\Bigg": {
7629 mclass: "mord",
7630 size: 4
7631 }
7632};
7633var delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "<", ">", "\\langle", "⟨", "\\rangle", "⟩", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."];
7634function checkDelimiter(delim, context) {
7635 var symDelim = checkSymbolNodeType(delim);
7636 if (symDelim && utils.contains(delimiters, symDelim.text)) {
7637 return symDelim;
7638 } else if (symDelim) {
7639 throw new ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim);
7640 } else {
7641 throw new ParseError("Invalid delimiter type '" + delim.type + "'", delim);
7642 }
7643}
7644defineFunction({
7645 type: "delimsizing",
7646 names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
7647 props: {
7648 numArgs: 1,
7649 argTypes: ["primitive"]
7650 },
7651 handler: (context, args) => {
7652 var delim = checkDelimiter(args[0], context);
7653 return {
7654 type: "delimsizing",
7655 mode: context.parser.mode,
7656 size: delimiterSizes[context.funcName].size,
7657 mclass: delimiterSizes[context.funcName].mclass,
7658 delim: delim.text
7659 };
7660 },
7661 htmlBuilder: (group, options) => {
7662 if (group.delim === ".") {
7663 return buildCommon.makeSpan([group.mclass]);
7664 }
7665 return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]);
7666 },
7667 mathmlBuilder: (group) => {
7668 var children = [];
7669 if (group.delim !== ".") {
7670 children.push(makeText(group.delim, group.mode));
7671 }
7672 var node = new mathMLTree.MathNode("mo", children);
7673 if (group.mclass === "mopen" || group.mclass === "mclose") {
7674 node.setAttribute("fence", "true");
7675 } else {
7676 node.setAttribute("fence", "false");
7677 }
7678 node.setAttribute("stretchy", "true");
7679 var size = makeEm(delimiter.sizeToMaxHeight[group.size]);
7680 node.setAttribute("minsize", size);
7681 node.setAttribute("maxsize", size);
7682 return node;
7683 }
7684});
7685function assertParsed(group) {
7686 if (!group.body) {
7687 throw new Error("Bug: The leftright ParseNode wasn't fully parsed.");
7688 }
7689}
7690defineFunction({
7691 type: "leftright-right",
7692 names: ["\\right"],
7693 props: {
7694 numArgs: 1,
7695 primitive: true
7696 },
7697 handler: (context, args) => {
7698 var color = context.parser.gullet.macros.get("\\current@color");
7699 if (color && typeof color !== "string") {
7700 throw new ParseError("\\current@color set to non-string in \\right");
7701 }
7702 return {
7703 type: "leftright-right",
7704 mode: context.parser.mode,
7705 delim: checkDelimiter(args[0], context).text,
7706 color
7707 // undefined if not set via \color
7708 };
7709 }
7710});
7711defineFunction({
7712 type: "leftright",
7713 names: ["\\left"],
7714 props: {
7715 numArgs: 1,
7716 primitive: true
7717 },
7718 handler: (context, args) => {
7719 var delim = checkDelimiter(args[0], context);
7720 var parser = context.parser;
7721 ++parser.leftrightDepth;
7722 var body = parser.parseExpression(false);
7723 --parser.leftrightDepth;
7724 parser.expect("\\right", false);
7725 var right = assertNodeType(parser.parseFunction(), "leftright-right");
7726 return {
7727 type: "leftright",
7728 mode: parser.mode,
7729 body,
7730 left: delim.text,
7731 right: right.delim,
7732 rightColor: right.color
7733 };
7734 },
7735 htmlBuilder: (group, options) => {
7736 assertParsed(group);
7737 var inner2 = buildExpression$1(group.body, options, true, ["mopen", "mclose"]);
7738 var innerHeight = 0;
7739 var innerDepth = 0;
7740 var hadMiddle = false;
7741 for (var i = 0; i < inner2.length; i++) {
7742 if (inner2[i].isMiddle) {
7743 hadMiddle = true;
7744 } else {
7745 innerHeight = Math.max(inner2[i].height, innerHeight);
7746 innerDepth = Math.max(inner2[i].depth, innerDepth);
7747 }
7748 }
7749 innerHeight *= options.sizeMultiplier;
7750 innerDepth *= options.sizeMultiplier;
7751 var leftDelim;
7752 if (group.left === ".") {
7753 leftDelim = makeNullDelimiter(options, ["mopen"]);
7754 } else {
7755 leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]);
7756 }
7757 inner2.unshift(leftDelim);
7758 if (hadMiddle) {
7759 for (var _i = 1; _i < inner2.length; _i++) {
7760 var middleDelim = inner2[_i];
7761 var isMiddle = middleDelim.isMiddle;
7762 if (isMiddle) {
7763 inner2[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []);
7764 }
7765 }
7766 }
7767 var rightDelim;
7768 if (group.right === ".") {
7769 rightDelim = makeNullDelimiter(options, ["mclose"]);
7770 } else {
7771 var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options;
7772 rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]);
7773 }
7774 inner2.push(rightDelim);
7775 return buildCommon.makeSpan(["minner"], inner2, options);
7776 },
7777 mathmlBuilder: (group, options) => {
7778 assertParsed(group);
7779 var inner2 = buildExpression2(group.body, options);
7780 if (group.left !== ".") {
7781 var leftNode = new mathMLTree.MathNode("mo", [makeText(group.left, group.mode)]);
7782 leftNode.setAttribute("fence", "true");
7783 inner2.unshift(leftNode);
7784 }
7785 if (group.right !== ".") {
7786 var rightNode = new mathMLTree.MathNode("mo", [makeText(group.right, group.mode)]);
7787 rightNode.setAttribute("fence", "true");
7788 if (group.rightColor) {
7789 rightNode.setAttribute("mathcolor", group.rightColor);
7790 }
7791 inner2.push(rightNode);
7792 }
7793 return makeRow(inner2);
7794 }
7795});
7796defineFunction({
7797 type: "middle",
7798 names: ["\\middle"],
7799 props: {
7800 numArgs: 1,
7801 primitive: true
7802 },
7803 handler: (context, args) => {
7804 var delim = checkDelimiter(args[0], context);
7805 if (!context.parser.leftrightDepth) {
7806 throw new ParseError("\\middle without preceding \\left", delim);
7807 }
7808 return {
7809 type: "middle",
7810 mode: context.parser.mode,
7811 delim: delim.text
7812 };
7813 },
7814 htmlBuilder: (group, options) => {
7815 var middleDelim;
7816 if (group.delim === ".") {
7817 middleDelim = makeNullDelimiter(options, []);
7818 } else {
7819 middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []);
7820 var isMiddle = {
7821 delim: group.delim,
7822 options
7823 };
7824 middleDelim.isMiddle = isMiddle;
7825 }
7826 return middleDelim;
7827 },
7828 mathmlBuilder: (group, options) => {
7829 var textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode);
7830 var middleNode = new mathMLTree.MathNode("mo", [textNode]);
7831 middleNode.setAttribute("fence", "true");
7832 middleNode.setAttribute("lspace", "0.05em");
7833 middleNode.setAttribute("rspace", "0.05em");
7834 return middleNode;
7835 }
7836});
7837var htmlBuilder$7 = (group, options) => {
7838 var inner2 = buildCommon.wrapFragment(buildGroup$1(group.body, options), options);
7839 var label = group.label.slice(1);
7840 var scale = options.sizeMultiplier;
7841 var img;
7842 var imgShift = 0;
7843 var isSingleChar = utils.isCharacterBox(group.body);
7844 if (label === "sout") {
7845 img = buildCommon.makeSpan(["stretchy", "sout"]);
7846 img.height = options.fontMetrics().defaultRuleThickness / scale;
7847 imgShift = -0.5 * options.fontMetrics().xHeight;
7848 } else if (label === "phase") {
7849 var lineWeight = calculateSize({
7850 number: 0.6,
7851 unit: "pt"
7852 }, options);
7853 var clearance = calculateSize({
7854 number: 0.35,
7855 unit: "ex"
7856 }, options);
7857 var newOptions = options.havingBaseSizing();
7858 scale = scale / newOptions.sizeMultiplier;
7859 var angleHeight = inner2.height + inner2.depth + lineWeight + clearance;
7860 inner2.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight);
7861 var viewBoxHeight = Math.floor(1e3 * angleHeight * scale);
7862 var path2 = phasePath(viewBoxHeight);
7863 var svgNode = new SvgNode([new PathNode("phase", path2)], {
7864 "width": "400em",
7865 "height": makeEm(viewBoxHeight / 1e3),
7866 "viewBox": "0 0 400000 " + viewBoxHeight,
7867 "preserveAspectRatio": "xMinYMin slice"
7868 });
7869 img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode], options);
7870 img.style.height = makeEm(angleHeight);
7871 imgShift = inner2.depth + lineWeight + clearance;
7872 } else {
7873 if (/cancel/.test(label)) {
7874 if (!isSingleChar) {
7875 inner2.classes.push("cancel-pad");
7876 }
7877 } else if (label === "angl") {
7878 inner2.classes.push("anglpad");
7879 } else {
7880 inner2.classes.push("boxpad");
7881 }
7882 var topPad = 0;
7883 var bottomPad = 0;
7884 var ruleThickness = 0;
7885 if (/box/.test(label)) {
7886 ruleThickness = Math.max(
7887 options.fontMetrics().fboxrule,
7888 // default
7889 options.minRuleThickness
7890 // User override.
7891 );
7892 topPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness);
7893 bottomPad = topPad;
7894 } else if (label === "angl") {
7895 ruleThickness = Math.max(options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
7896 topPad = 4 * ruleThickness;
7897 bottomPad = Math.max(0, 0.25 - inner2.depth);
7898 } else {
7899 topPad = isSingleChar ? 0.2 : 0;
7900 bottomPad = topPad;
7901 }
7902 img = stretchy.encloseSpan(inner2, label, topPad, bottomPad, options);
7903 if (/fbox|boxed|fcolorbox/.test(label)) {
7904 img.style.borderStyle = "solid";
7905 img.style.borderWidth = makeEm(ruleThickness);
7906 } else if (label === "angl" && ruleThickness !== 0.049) {
7907 img.style.borderTopWidth = makeEm(ruleThickness);
7908 img.style.borderRightWidth = makeEm(ruleThickness);
7909 }
7910 imgShift = inner2.depth + bottomPad;
7911 if (group.backgroundColor) {
7912 img.style.backgroundColor = group.backgroundColor;
7913 if (group.borderColor) {
7914 img.style.borderColor = group.borderColor;
7915 }
7916 }
7917 }
7918 var vlist;
7919 if (group.backgroundColor) {
7920 vlist = buildCommon.makeVList({
7921 positionType: "individualShift",
7922 children: [
7923 // Put the color background behind inner;
7924 {
7925 type: "elem",
7926 elem: img,
7927 shift: imgShift
7928 },
7929 {
7930 type: "elem",
7931 elem: inner2,
7932 shift: 0
7933 }
7934 ]
7935 }, options);
7936 } else {
7937 var classes = /cancel|phase/.test(label) ? ["svg-align"] : [];
7938 vlist = buildCommon.makeVList({
7939 positionType: "individualShift",
7940 children: [
7941 // Write the \cancel stroke on top of inner.
7942 {
7943 type: "elem",
7944 elem: inner2,
7945 shift: 0
7946 },
7947 {
7948 type: "elem",
7949 elem: img,
7950 shift: imgShift,
7951 wrapperClasses: classes
7952 }
7953 ]
7954 }, options);
7955 }
7956 if (/cancel/.test(label)) {
7957 vlist.height = inner2.height;
7958 vlist.depth = inner2.depth;
7959 }
7960 if (/cancel/.test(label) && !isSingleChar) {
7961 return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options);
7962 } else {
7963 return buildCommon.makeSpan(["mord"], [vlist], options);
7964 }
7965};
7966var mathmlBuilder$6 = (group, options) => {
7967 var fboxsep = 0;
7968 var node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup2(group.body, options)]);
7969 switch (group.label) {
7970 case "\\cancel":
7971 node.setAttribute("notation", "updiagonalstrike");
7972 break;
7973 case "\\bcancel":
7974 node.setAttribute("notation", "downdiagonalstrike");
7975 break;
7976 case "\\phase":
7977 node.setAttribute("notation", "phasorangle");
7978 break;
7979 case "\\sout":
7980 node.setAttribute("notation", "horizontalstrike");
7981 break;
7982 case "\\fbox":
7983 node.setAttribute("notation", "box");
7984 break;
7985 case "\\angl":
7986 node.setAttribute("notation", "actuarial");
7987 break;
7988 case "\\fcolorbox":
7989 case "\\colorbox":
7990 fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm;
7991 node.setAttribute("width", "+" + 2 * fboxsep + "pt");
7992 node.setAttribute("height", "+" + 2 * fboxsep + "pt");
7993 node.setAttribute("lspace", fboxsep + "pt");
7994 node.setAttribute("voffset", fboxsep + "pt");
7995 if (group.label === "\\fcolorbox") {
7996 var thk = Math.max(
7997 options.fontMetrics().fboxrule,
7998 // default
7999 options.minRuleThickness
8000 // user override
8001 );
8002 node.setAttribute("style", "border: " + thk + "em solid " + String(group.borderColor));
8003 }
8004 break;
8005 case "\\xcancel":
8006 node.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
8007 break;
8008 }
8009 if (group.backgroundColor) {
8010 node.setAttribute("mathbackground", group.backgroundColor);
8011 }
8012 return node;
8013};
8014defineFunction({
8015 type: "enclose",
8016 names: ["\\colorbox"],
8017 props: {
8018 numArgs: 2,
8019 allowedInText: true,
8020 argTypes: ["color", "text"]
8021 },
8022 handler(_ref, args, optArgs) {
8023 var {
8024 parser,
8025 funcName
8026 } = _ref;
8027 var color = assertNodeType(args[0], "color-token").color;
8028 var body = args[1];
8029 return {
8030 type: "enclose",
8031 mode: parser.mode,
8032 label: funcName,
8033 backgroundColor: color,
8034 body
8035 };
8036 },
8037 htmlBuilder: htmlBuilder$7,
8038 mathmlBuilder: mathmlBuilder$6
8039});
8040defineFunction({
8041 type: "enclose",
8042 names: ["\\fcolorbox"],
8043 props: {
8044 numArgs: 3,
8045 allowedInText: true,
8046 argTypes: ["color", "color", "text"]
8047 },
8048 handler(_ref2, args, optArgs) {
8049 var {
8050 parser,
8051 funcName
8052 } = _ref2;
8053 var borderColor = assertNodeType(args[0], "color-token").color;
8054 var backgroundColor = assertNodeType(args[1], "color-token").color;
8055 var body = args[2];
8056 return {
8057 type: "enclose",
8058 mode: parser.mode,
8059 label: funcName,
8060 backgroundColor,
8061 borderColor,
8062 body
8063 };
8064 },
8065 htmlBuilder: htmlBuilder$7,
8066 mathmlBuilder: mathmlBuilder$6
8067});
8068defineFunction({
8069 type: "enclose",
8070 names: ["\\fbox"],
8071 props: {
8072 numArgs: 1,
8073 argTypes: ["hbox"],
8074 allowedInText: true
8075 },
8076 handler(_ref3, args) {
8077 var {
8078 parser
8079 } = _ref3;
8080 return {
8081 type: "enclose",
8082 mode: parser.mode,
8083 label: "\\fbox",
8084 body: args[0]
8085 };
8086 }
8087});
8088defineFunction({
8089 type: "enclose",
8090 names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"],
8091 props: {
8092 numArgs: 1
8093 },
8094 handler(_ref4, args) {
8095 var {
8096 parser,
8097 funcName
8098 } = _ref4;
8099 var body = args[0];
8100 return {
8101 type: "enclose",
8102 mode: parser.mode,
8103 label: funcName,
8104 body
8105 };
8106 },
8107 htmlBuilder: htmlBuilder$7,
8108 mathmlBuilder: mathmlBuilder$6
8109});
8110defineFunction({
8111 type: "enclose",
8112 names: ["\\angl"],
8113 props: {
8114 numArgs: 1,
8115 argTypes: ["hbox"],
8116 allowedInText: false
8117 },
8118 handler(_ref5, args) {
8119 var {
8120 parser
8121 } = _ref5;
8122 return {
8123 type: "enclose",
8124 mode: parser.mode,
8125 label: "\\angl",
8126 body: args[0]
8127 };
8128 }
8129});
8130var _environments = {};
8131function defineEnvironment(_ref) {
8132 var {
8133 type,
8134 names,
8135 props,
8136 handler,
8137 htmlBuilder: htmlBuilder3,
8138 mathmlBuilder: mathmlBuilder3
8139 } = _ref;
8140 var data = {
8141 type,
8142 numArgs: props.numArgs || 0,
8143 allowedInText: false,
8144 numOptionalArgs: 0,
8145 handler
8146 };
8147 for (var i = 0; i < names.length; ++i) {
8148 _environments[names[i]] = data;
8149 }
8150 if (htmlBuilder3) {
8151 _htmlGroupBuilders[type] = htmlBuilder3;
8152 }
8153 if (mathmlBuilder3) {
8154 _mathmlGroupBuilders[type] = mathmlBuilder3;
8155 }
8156}
8157var _macros = {};
8158function defineMacro(name, body) {
8159 _macros[name] = body;
8160}
8161function getHLines(parser) {
8162 var hlineInfo = [];
8163 parser.consumeSpaces();
8164 var nxt = parser.fetch().text;
8165 if (nxt === "\\relax") {
8166 parser.consume();
8167 parser.consumeSpaces();
8168 nxt = parser.fetch().text;
8169 }
8170 while (nxt === "\\hline" || nxt === "\\hdashline") {
8171 parser.consume();
8172 hlineInfo.push(nxt === "\\hdashline");
8173 parser.consumeSpaces();
8174 nxt = parser.fetch().text;
8175 }
8176 return hlineInfo;
8177}
8178var validateAmsEnvironmentContext = (context) => {
8179 var settings = context.parser.settings;
8180 if (!settings.displayMode) {
8181 throw new ParseError("{" + context.envName + "} can be used only in display mode.");
8182 }
8183};
8184function getAutoTag(name) {
8185 if (name.indexOf("ed") === -1) {
8186 return name.indexOf("*") === -1;
8187 }
8188}
8189function parseArray(parser, _ref, style) {
8190 var {
8191 hskipBeforeAndAfter,
8192 addJot,
8193 cols,
8194 arraystretch,
8195 colSeparationType,
8196 autoTag,
8197 singleRow,
8198 emptySingleRow,
8199 maxNumCols,
8200 leqno
8201 } = _ref;
8202 parser.gullet.beginGroup();
8203 if (!singleRow) {
8204 parser.gullet.macros.set("\\cr", "\\\\\\relax");
8205 }
8206 if (!arraystretch) {
8207 var stretch = parser.gullet.expandMacroAsText("\\arraystretch");
8208 if (stretch == null) {
8209 arraystretch = 1;
8210 } else {
8211 arraystretch = parseFloat(stretch);
8212 if (!arraystretch || arraystretch < 0) {
8213 throw new ParseError("Invalid \\arraystretch: " + stretch);
8214 }
8215 }
8216 }
8217 parser.gullet.beginGroup();
8218 var row = [];
8219 var body = [row];
8220 var rowGaps = [];
8221 var hLinesBeforeRow = [];
8222 var tags = autoTag != null ? [] : void 0;
8223 function beginRow() {
8224 if (autoTag) {
8225 parser.gullet.macros.set("\\@eqnsw", "1", true);
8226 }
8227 }
8228 function endRow() {
8229 if (tags) {
8230 if (parser.gullet.macros.get("\\df@tag")) {
8231 tags.push(parser.subparse([new Token("\\df@tag")]));
8232 parser.gullet.macros.set("\\df@tag", void 0, true);
8233 } else {
8234 tags.push(Boolean(autoTag) && parser.gullet.macros.get("\\@eqnsw") === "1");
8235 }
8236 }
8237 }
8238 beginRow();
8239 hLinesBeforeRow.push(getHLines(parser));
8240 while (true) {
8241 var cell = parser.parseExpression(false, singleRow ? "\\end" : "\\\\");
8242 parser.gullet.endGroup();
8243 parser.gullet.beginGroup();
8244 cell = {
8245 type: "ordgroup",
8246 mode: parser.mode,
8247 body: cell
8248 };
8249 if (style) {
8250 cell = {
8251 type: "styling",
8252 mode: parser.mode,
8253 style,
8254 body: [cell]
8255 };
8256 }
8257 row.push(cell);
8258 var next = parser.fetch().text;
8259 if (next === "&") {
8260 if (maxNumCols && row.length === maxNumCols) {
8261 if (singleRow || colSeparationType) {
8262 throw new ParseError("Too many tab characters: &", parser.nextToken);
8263 } else {
8264 parser.settings.reportNonstrict("textEnv", "Too few columns specified in the {array} column argument.");
8265 }
8266 }
8267 parser.consume();
8268 } else if (next === "\\end") {
8269 endRow();
8270 if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow)) {
8271 body.pop();
8272 }
8273 if (hLinesBeforeRow.length < body.length + 1) {
8274 hLinesBeforeRow.push([]);
8275 }
8276 break;
8277 } else if (next === "\\\\") {
8278 parser.consume();
8279 var size = void 0;
8280 if (parser.gullet.future().text !== " ") {
8281 size = parser.parseSizeGroup(true);
8282 }
8283 rowGaps.push(size ? size.value : null);
8284 endRow();
8285 hLinesBeforeRow.push(getHLines(parser));
8286 row = [];
8287 body.push(row);
8288 beginRow();
8289 } else {
8290 throw new ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken);
8291 }
8292 }
8293 parser.gullet.endGroup();
8294 parser.gullet.endGroup();
8295 return {
8296 type: "array",
8297 mode: parser.mode,
8298 addJot,
8299 arraystretch,
8300 body,
8301 cols,
8302 rowGaps,
8303 hskipBeforeAndAfter,
8304 hLinesBeforeRow,
8305 colSeparationType,
8306 tags,
8307 leqno
8308 };
8309}
8310function dCellStyle(envName) {
8311 if (envName.slice(0, 1) === "d") {
8312 return "display";
8313 } else {
8314 return "text";
8315 }
8316}
8317var htmlBuilder$6 = function htmlBuilder(group, options) {
8318 var r;
8319 var c;
8320 var nr = group.body.length;
8321 var hLinesBeforeRow = group.hLinesBeforeRow;
8322 var nc = 0;
8323 var body = new Array(nr);
8324 var hlines = [];
8325 var ruleThickness = Math.max(
8326 // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
8327 options.fontMetrics().arrayRuleWidth,
8328 options.minRuleThickness
8329 // User override.
8330 );
8331 var pt = 1 / options.fontMetrics().ptPerEm;
8332 var arraycolsep = 5 * pt;
8333 if (group.colSeparationType && group.colSeparationType === "small") {
8334 var localMultiplier = options.havingStyle(Style$1.SCRIPT).sizeMultiplier;
8335 arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier);
8336 }
8337 var baselineskip = group.colSeparationType === "CD" ? calculateSize({
8338 number: 3,
8339 unit: "ex"
8340 }, options) : 12 * pt;
8341 var jot = 3 * pt;
8342 var arrayskip = group.arraystretch * baselineskip;
8343 var arstrutHeight = 0.7 * arrayskip;
8344 var arstrutDepth = 0.3 * arrayskip;
8345 var totalHeight = 0;
8346 function setHLinePos(hlinesInGap) {
8347 for (var i = 0; i < hlinesInGap.length; ++i) {
8348 if (i > 0) {
8349 totalHeight += 0.25;
8350 }
8351 hlines.push({
8352 pos: totalHeight,
8353 isDashed: hlinesInGap[i]
8354 });
8355 }
8356 }
8357 setHLinePos(hLinesBeforeRow[0]);
8358 for (r = 0; r < group.body.length; ++r) {
8359 var inrow = group.body[r];
8360 var height = arstrutHeight;
8361 var depth = arstrutDepth;
8362 if (nc < inrow.length) {
8363 nc = inrow.length;
8364 }
8365 var outrow = new Array(inrow.length);
8366 for (c = 0; c < inrow.length; ++c) {
8367 var elt = buildGroup$1(inrow[c], options);
8368 if (depth < elt.depth) {
8369 depth = elt.depth;
8370 }
8371 if (height < elt.height) {
8372 height = elt.height;
8373 }
8374 outrow[c] = elt;
8375 }
8376 var rowGap = group.rowGaps[r];
8377 var gap = 0;
8378 if (rowGap) {
8379 gap = calculateSize(rowGap, options);
8380 if (gap > 0) {
8381 gap += arstrutDepth;
8382 if (depth < gap) {
8383 depth = gap;
8384 }
8385 gap = 0;
8386 }
8387 }
8388 if (group.addJot) {
8389 depth += jot;
8390 }
8391 outrow.height = height;
8392 outrow.depth = depth;
8393 totalHeight += height;
8394 outrow.pos = totalHeight;
8395 totalHeight += depth + gap;
8396 body[r] = outrow;
8397 setHLinePos(hLinesBeforeRow[r + 1]);
8398 }
8399 var offset = totalHeight / 2 + options.fontMetrics().axisHeight;
8400 var colDescriptions = group.cols || [];
8401 var cols = [];
8402 var colSep;
8403 var colDescrNum;
8404 var tagSpans = [];
8405 if (group.tags && group.tags.some((tag2) => tag2)) {
8406 for (r = 0; r < nr; ++r) {
8407 var rw = body[r];
8408 var shift = rw.pos - offset;
8409 var tag = group.tags[r];
8410 var tagSpan = void 0;
8411 if (tag === true) {
8412 tagSpan = buildCommon.makeSpan(["eqn-num"], [], options);
8413 } else if (tag === false) {
8414 tagSpan = buildCommon.makeSpan([], [], options);
8415 } else {
8416 tagSpan = buildCommon.makeSpan([], buildExpression$1(tag, options, true), options);
8417 }
8418 tagSpan.depth = rw.depth;
8419 tagSpan.height = rw.height;
8420 tagSpans.push({
8421 type: "elem",
8422 elem: tagSpan,
8423 shift
8424 });
8425 }
8426 }
8427 for (
8428 c = 0, colDescrNum = 0;
8429 // Continue while either there are more columns or more column
8430 // descriptions, so trailing separators don't get lost.
8431 c < nc || colDescrNum < colDescriptions.length;
8432 ++c, ++colDescrNum
8433 ) {
8434 var colDescr = colDescriptions[colDescrNum] || {};
8435 var firstSeparator = true;
8436 while (colDescr.type === "separator") {
8437 if (!firstSeparator) {
8438 colSep = buildCommon.makeSpan(["arraycolsep"], []);
8439 colSep.style.width = makeEm(options.fontMetrics().doubleRuleSep);
8440 cols.push(colSep);
8441 }
8442 if (colDescr.separator === "|" || colDescr.separator === ":") {
8443 var lineType = colDescr.separator === "|" ? "solid" : "dashed";
8444 var separator = buildCommon.makeSpan(["vertical-separator"], [], options);
8445 separator.style.height = makeEm(totalHeight);
8446 separator.style.borderRightWidth = makeEm(ruleThickness);
8447 separator.style.borderRightStyle = lineType;
8448 separator.style.margin = "0 " + makeEm(-ruleThickness / 2);
8449 var _shift = totalHeight - offset;
8450 if (_shift) {
8451 separator.style.verticalAlign = makeEm(-_shift);
8452 }
8453 cols.push(separator);
8454 } else {
8455 throw new ParseError("Invalid separator type: " + colDescr.separator);
8456 }
8457 colDescrNum++;
8458 colDescr = colDescriptions[colDescrNum] || {};
8459 firstSeparator = false;
8460 }
8461 if (c >= nc) {
8462 continue;
8463 }
8464 var sepwidth = void 0;
8465 if (c > 0 || group.hskipBeforeAndAfter) {
8466 sepwidth = utils.deflt(colDescr.pregap, arraycolsep);
8467 if (sepwidth !== 0) {
8468 colSep = buildCommon.makeSpan(["arraycolsep"], []);
8469 colSep.style.width = makeEm(sepwidth);
8470 cols.push(colSep);
8471 }
8472 }
8473 var col = [];
8474 for (r = 0; r < nr; ++r) {
8475 var row = body[r];
8476 var elem = row[c];
8477 if (!elem) {
8478 continue;
8479 }
8480 var _shift2 = row.pos - offset;
8481 elem.depth = row.depth;
8482 elem.height = row.height;
8483 col.push({
8484 type: "elem",
8485 elem,
8486 shift: _shift2
8487 });
8488 }
8489 col = buildCommon.makeVList({
8490 positionType: "individualShift",
8491 children: col
8492 }, options);
8493 col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]);
8494 cols.push(col);
8495 if (c < nc - 1 || group.hskipBeforeAndAfter) {
8496 sepwidth = utils.deflt(colDescr.postgap, arraycolsep);
8497 if (sepwidth !== 0) {
8498 colSep = buildCommon.makeSpan(["arraycolsep"], []);
8499 colSep.style.width = makeEm(sepwidth);
8500 cols.push(colSep);
8501 }
8502 }
8503 }
8504 body = buildCommon.makeSpan(["mtable"], cols);
8505 if (hlines.length > 0) {
8506 var line = buildCommon.makeLineSpan("hline", options, ruleThickness);
8507 var dashes = buildCommon.makeLineSpan("hdashline", options, ruleThickness);
8508 var vListElems = [{
8509 type: "elem",
8510 elem: body,
8511 shift: 0
8512 }];
8513 while (hlines.length > 0) {
8514 var hline = hlines.pop();
8515 var lineShift = hline.pos - offset;
8516 if (hline.isDashed) {
8517 vListElems.push({
8518 type: "elem",
8519 elem: dashes,
8520 shift: lineShift
8521 });
8522 } else {
8523 vListElems.push({
8524 type: "elem",
8525 elem: line,
8526 shift: lineShift
8527 });
8528 }
8529 }
8530 body = buildCommon.makeVList({
8531 positionType: "individualShift",
8532 children: vListElems
8533 }, options);
8534 }
8535 if (tagSpans.length === 0) {
8536 return buildCommon.makeSpan(["mord"], [body], options);
8537 } else {
8538 var eqnNumCol = buildCommon.makeVList({
8539 positionType: "individualShift",
8540 children: tagSpans
8541 }, options);
8542 eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options);
8543 return buildCommon.makeFragment([body, eqnNumCol]);
8544 }
8545};
8546var alignMap = {
8547 c: "center ",
8548 l: "left ",
8549 r: "right "
8550};
8551var mathmlBuilder$5 = function mathmlBuilder(group, options) {
8552 var tbl = [];
8553 var glue = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]);
8554 var tag = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]);
8555 for (var i = 0; i < group.body.length; i++) {
8556 var rw = group.body[i];
8557 var row = [];
8558 for (var j = 0; j < rw.length; j++) {
8559 row.push(new mathMLTree.MathNode("mtd", [buildGroup2(rw[j], options)]));
8560 }
8561 if (group.tags && group.tags[i]) {
8562 row.unshift(glue);
8563 row.push(glue);
8564 if (group.leqno) {
8565 row.unshift(tag);
8566 } else {
8567 row.push(tag);
8568 }
8569 }
8570 tbl.push(new mathMLTree.MathNode("mtr", row));
8571 }
8572 var table = new mathMLTree.MathNode("mtable", tbl);
8573 var gap = group.arraystretch === 0.5 ? 0.1 : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
8574 table.setAttribute("rowspacing", makeEm(gap));
8575 var menclose = "";
8576 var align = "";
8577 if (group.cols && group.cols.length > 0) {
8578 var cols = group.cols;
8579 var columnLines = "";
8580 var prevTypeWasAlign = false;
8581 var iStart = 0;
8582 var iEnd = cols.length;
8583 if (cols[0].type === "separator") {
8584 menclose += "top ";
8585 iStart = 1;
8586 }
8587 if (cols[cols.length - 1].type === "separator") {
8588 menclose += "bottom ";
8589 iEnd -= 1;
8590 }
8591 for (var _i = iStart; _i < iEnd; _i++) {
8592 if (cols[_i].type === "align") {
8593 align += alignMap[cols[_i].align];
8594 if (prevTypeWasAlign) {
8595 columnLines += "none ";
8596 }
8597 prevTypeWasAlign = true;
8598 } else if (cols[_i].type === "separator") {
8599 if (prevTypeWasAlign) {
8600 columnLines += cols[_i].separator === "|" ? "solid " : "dashed ";
8601 prevTypeWasAlign = false;
8602 }
8603 }
8604 }
8605 table.setAttribute("columnalign", align.trim());
8606 if (/[sd]/.test(columnLines)) {
8607 table.setAttribute("columnlines", columnLines.trim());
8608 }
8609 }
8610 if (group.colSeparationType === "align") {
8611 var _cols = group.cols || [];
8612 var spacing2 = "";
8613 for (var _i2 = 1; _i2 < _cols.length; _i2++) {
8614 spacing2 += _i2 % 2 ? "0em " : "1em ";
8615 }
8616 table.setAttribute("columnspacing", spacing2.trim());
8617 } else if (group.colSeparationType === "alignat" || group.colSeparationType === "gather") {
8618 table.setAttribute("columnspacing", "0em");
8619 } else if (group.colSeparationType === "small") {
8620 table.setAttribute("columnspacing", "0.2778em");
8621 } else if (group.colSeparationType === "CD") {
8622 table.setAttribute("columnspacing", "0.5em");
8623 } else {
8624 table.setAttribute("columnspacing", "1em");
8625 }
8626 var rowLines = "";
8627 var hlines = group.hLinesBeforeRow;
8628 menclose += hlines[0].length > 0 ? "left " : "";
8629 menclose += hlines[hlines.length - 1].length > 0 ? "right " : "";
8630 for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) {
8631 rowLines += hlines[_i3].length === 0 ? "none " : hlines[_i3][0] ? "dashed " : "solid ";
8632 }
8633 if (/[sd]/.test(rowLines)) {
8634 table.setAttribute("rowlines", rowLines.trim());
8635 }
8636 if (menclose !== "") {
8637 table = new mathMLTree.MathNode("menclose", [table]);
8638 table.setAttribute("notation", menclose.trim());
8639 }
8640 if (group.arraystretch && group.arraystretch < 1) {
8641 table = new mathMLTree.MathNode("mstyle", [table]);
8642 table.setAttribute("scriptlevel", "1");
8643 }
8644 return table;
8645};
8646var alignedHandler = function alignedHandler2(context, args) {
8647 if (context.envName.indexOf("ed") === -1) {
8648 validateAmsEnvironmentContext(context);
8649 }
8650 var cols = [];
8651 var separationType = context.envName.indexOf("at") > -1 ? "alignat" : "align";
8652 var isSplit = context.envName === "split";
8653 var res = parseArray(context.parser, {
8654 cols,
8655 addJot: true,
8656 autoTag: isSplit ? void 0 : getAutoTag(context.envName),
8657 emptySingleRow: true,
8658 colSeparationType: separationType,
8659 maxNumCols: isSplit ? 2 : void 0,
8660 leqno: context.parser.settings.leqno
8661 }, "display");
8662 var numMaths;
8663 var numCols = 0;
8664 var emptyGroup = {
8665 type: "ordgroup",
8666 mode: context.mode,
8667 body: []
8668 };
8669 if (args[0] && args[0].type === "ordgroup") {
8670 var arg0 = "";
8671 for (var i = 0; i < args[0].body.length; i++) {
8672 var textord2 = assertNodeType(args[0].body[i], "textord");
8673 arg0 += textord2.text;
8674 }
8675 numMaths = Number(arg0);
8676 numCols = numMaths * 2;
8677 }
8678 var isAligned = !numCols;
8679 res.body.forEach(function(row) {
8680 for (var _i4 = 1; _i4 < row.length; _i4 += 2) {
8681 var styling = assertNodeType(row[_i4], "styling");
8682 var ordgroup = assertNodeType(styling.body[0], "ordgroup");
8683 ordgroup.body.unshift(emptyGroup);
8684 }
8685 if (!isAligned) {
8686 var curMaths = row.length / 2;
8687 if (numMaths < curMaths) {
8688 throw new ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]);
8689 }
8690 } else if (numCols < row.length) {
8691 numCols = row.length;
8692 }
8693 });
8694 for (var _i5 = 0; _i5 < numCols; ++_i5) {
8695 var align = "r";
8696 var pregap = 0;
8697 if (_i5 % 2 === 1) {
8698 align = "l";
8699 } else if (_i5 > 0 && isAligned) {
8700 pregap = 1;
8701 }
8702 cols[_i5] = {
8703 type: "align",
8704 align,
8705 pregap,
8706 postgap: 0
8707 };
8708 }
8709 res.colSeparationType = isAligned ? "align" : "alignat";
8710 return res;
8711};
8712defineEnvironment({
8713 type: "array",
8714 names: ["array", "darray"],
8715 props: {
8716 numArgs: 1
8717 },
8718 handler(context, args) {
8719 var symNode = checkSymbolNodeType(args[0]);
8720 var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
8721 var cols = colalign.map(function(nde) {
8722 var node = assertSymbolNodeType(nde);
8723 var ca = node.text;
8724 if ("lcr".indexOf(ca) !== -1) {
8725 return {
8726 type: "align",
8727 align: ca
8728 };
8729 } else if (ca === "|") {
8730 return {
8731 type: "separator",
8732 separator: "|"
8733 };
8734 } else if (ca === ":") {
8735 return {
8736 type: "separator",
8737 separator: ":"
8738 };
8739 }
8740 throw new ParseError("Unknown column alignment: " + ca, nde);
8741 });
8742 var res = {
8743 cols,
8744 hskipBeforeAndAfter: true,
8745 // \@preamble in lttab.dtx
8746 maxNumCols: cols.length
8747 };
8748 return parseArray(context.parser, res, dCellStyle(context.envName));
8749 },
8750 htmlBuilder: htmlBuilder$6,
8751 mathmlBuilder: mathmlBuilder$5
8752});
8753defineEnvironment({
8754 type: "array",
8755 names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"],
8756 props: {
8757 numArgs: 0
8758 },
8759 handler(context) {
8760 var delimiters2 = {
8761 "matrix": null,
8762 "pmatrix": ["(", ")"],
8763 "bmatrix": ["[", "]"],
8764 "Bmatrix": ["\\{", "\\}"],
8765 "vmatrix": ["|", "|"],
8766 "Vmatrix": ["\\Vert", "\\Vert"]
8767 }[context.envName.replace("*", "")];
8768 var colAlign = "c";
8769 var payload = {
8770 hskipBeforeAndAfter: false,
8771 cols: [{
8772 type: "align",
8773 align: colAlign
8774 }]
8775 };
8776 if (context.envName.charAt(context.envName.length - 1) === "*") {
8777 var parser = context.parser;
8778 parser.consumeSpaces();
8779 if (parser.fetch().text === "[") {
8780 parser.consume();
8781 parser.consumeSpaces();
8782 colAlign = parser.fetch().text;
8783 if ("lcr".indexOf(colAlign) === -1) {
8784 throw new ParseError("Expected l or c or r", parser.nextToken);
8785 }
8786 parser.consume();
8787 parser.consumeSpaces();
8788 parser.expect("]");
8789 parser.consume();
8790 payload.cols = [{
8791 type: "align",
8792 align: colAlign
8793 }];
8794 }
8795 }
8796 var res = parseArray(context.parser, payload, dCellStyle(context.envName));
8797 var numCols = Math.max(0, ...res.body.map((row) => row.length));
8798 res.cols = new Array(numCols).fill({
8799 type: "align",
8800 align: colAlign
8801 });
8802 return delimiters2 ? {
8803 type: "leftright",
8804 mode: context.mode,
8805 body: [res],
8806 left: delimiters2[0],
8807 right: delimiters2[1],
8808 rightColor: void 0
8809 // \right uninfluenced by \color in array
8810 } : res;
8811 },
8812 htmlBuilder: htmlBuilder$6,
8813 mathmlBuilder: mathmlBuilder$5
8814});
8815defineEnvironment({
8816 type: "array",
8817 names: ["smallmatrix"],
8818 props: {
8819 numArgs: 0
8820 },
8821 handler(context) {
8822 var payload = {
8823 arraystretch: 0.5
8824 };
8825 var res = parseArray(context.parser, payload, "script");
8826 res.colSeparationType = "small";
8827 return res;
8828 },
8829 htmlBuilder: htmlBuilder$6,
8830 mathmlBuilder: mathmlBuilder$5
8831});
8832defineEnvironment({
8833 type: "array",
8834 names: ["subarray"],
8835 props: {
8836 numArgs: 1
8837 },
8838 handler(context, args) {
8839 var symNode = checkSymbolNodeType(args[0]);
8840 var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
8841 var cols = colalign.map(function(nde) {
8842 var node = assertSymbolNodeType(nde);
8843 var ca = node.text;
8844 if ("lc".indexOf(ca) !== -1) {
8845 return {
8846 type: "align",
8847 align: ca
8848 };
8849 }
8850 throw new ParseError("Unknown column alignment: " + ca, nde);
8851 });
8852 if (cols.length > 1) {
8853 throw new ParseError("{subarray} can contain only one column");
8854 }
8855 var res = {
8856 cols,
8857 hskipBeforeAndAfter: false,
8858 arraystretch: 0.5
8859 };
8860 res = parseArray(context.parser, res, "script");
8861 if (res.body.length > 0 && res.body[0].length > 1) {
8862 throw new ParseError("{subarray} can contain only one column");
8863 }
8864 return res;
8865 },
8866 htmlBuilder: htmlBuilder$6,
8867 mathmlBuilder: mathmlBuilder$5
8868});
8869defineEnvironment({
8870 type: "array",
8871 names: ["cases", "dcases", "rcases", "drcases"],
8872 props: {
8873 numArgs: 0
8874 },
8875 handler(context) {
8876 var payload = {
8877 arraystretch: 1.2,
8878 cols: [{
8879 type: "align",
8880 align: "l",
8881 pregap: 0,
8882 // TODO(kevinb) get the current style.
8883 // For now we use the metrics for TEXT style which is what we were
8884 // doing before. Before attempting to get the current style we
8885 // should look at TeX's behavior especially for \over and matrices.
8886 postgap: 1
8887 /* 1em quad */
8888 }, {
8889 type: "align",
8890 align: "l",
8891 pregap: 0,
8892 postgap: 0
8893 }]
8894 };
8895 var res = parseArray(context.parser, payload, dCellStyle(context.envName));
8896 return {
8897 type: "leftright",
8898 mode: context.mode,
8899 body: [res],
8900 left: context.envName.indexOf("r") > -1 ? "." : "\\{",
8901 right: context.envName.indexOf("r") > -1 ? "\\}" : ".",
8902 rightColor: void 0
8903 };
8904 },
8905 htmlBuilder: htmlBuilder$6,
8906 mathmlBuilder: mathmlBuilder$5
8907});
8908defineEnvironment({
8909 type: "array",
8910 names: ["align", "align*", "aligned", "split"],
8911 props: {
8912 numArgs: 0
8913 },
8914 handler: alignedHandler,
8915 htmlBuilder: htmlBuilder$6,
8916 mathmlBuilder: mathmlBuilder$5
8917});
8918defineEnvironment({
8919 type: "array",
8920 names: ["gathered", "gather", "gather*"],
8921 props: {
8922 numArgs: 0
8923 },
8924 handler(context) {
8925 if (utils.contains(["gather", "gather*"], context.envName)) {
8926 validateAmsEnvironmentContext(context);
8927 }
8928 var res = {
8929 cols: [{
8930 type: "align",
8931 align: "c"
8932 }],
8933 addJot: true,
8934 colSeparationType: "gather",
8935 autoTag: getAutoTag(context.envName),
8936 emptySingleRow: true,
8937 leqno: context.parser.settings.leqno
8938 };
8939 return parseArray(context.parser, res, "display");
8940 },
8941 htmlBuilder: htmlBuilder$6,
8942 mathmlBuilder: mathmlBuilder$5
8943});
8944defineEnvironment({
8945 type: "array",
8946 names: ["alignat", "alignat*", "alignedat"],
8947 props: {
8948 numArgs: 1
8949 },
8950 handler: alignedHandler,
8951 htmlBuilder: htmlBuilder$6,
8952 mathmlBuilder: mathmlBuilder$5
8953});
8954defineEnvironment({
8955 type: "array",
8956 names: ["equation", "equation*"],
8957 props: {
8958 numArgs: 0
8959 },
8960 handler(context) {
8961 validateAmsEnvironmentContext(context);
8962 var res = {
8963 autoTag: getAutoTag(context.envName),
8964 emptySingleRow: true,
8965 singleRow: true,
8966 maxNumCols: 1,
8967 leqno: context.parser.settings.leqno
8968 };
8969 return parseArray(context.parser, res, "display");
8970 },
8971 htmlBuilder: htmlBuilder$6,
8972 mathmlBuilder: mathmlBuilder$5
8973});
8974defineEnvironment({
8975 type: "array",
8976 names: ["CD"],
8977 props: {
8978 numArgs: 0
8979 },
8980 handler(context) {
8981 validateAmsEnvironmentContext(context);
8982 return parseCD(context.parser);
8983 },
8984 htmlBuilder: htmlBuilder$6,
8985 mathmlBuilder: mathmlBuilder$5
8986});
8987defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}");
8988defineMacro("\\notag", "\\nonumber");
8989defineFunction({
8990 type: "text",
8991 // Doesn't matter what this is.
8992 names: ["\\hline", "\\hdashline"],
8993 props: {
8994 numArgs: 0,
8995 allowedInText: true,
8996 allowedInMath: true
8997 },
8998 handler(context, args) {
8999 throw new ParseError(context.funcName + " valid only within array environment");
9000 }
9001});
9002var environments = _environments;
9003defineFunction({
9004 type: "environment",
9005 names: ["\\begin", "\\end"],
9006 props: {
9007 numArgs: 1,
9008 argTypes: ["text"]
9009 },
9010 handler(_ref, args) {
9011 var {
9012 parser,
9013 funcName
9014 } = _ref;
9015 var nameGroup = args[0];
9016 if (nameGroup.type !== "ordgroup") {
9017 throw new ParseError("Invalid environment name", nameGroup);
9018 }
9019 var envName = "";
9020 for (var i = 0; i < nameGroup.body.length; ++i) {
9021 envName += assertNodeType(nameGroup.body[i], "textord").text;
9022 }
9023 if (funcName === "\\begin") {
9024 if (!environments.hasOwnProperty(envName)) {
9025 throw new ParseError("No such environment: " + envName, nameGroup);
9026 }
9027 var env = environments[envName];
9028 var {
9029 args: _args,
9030 optArgs
9031 } = parser.parseArguments("\\begin{" + envName + "}", env);
9032 var context = {
9033 mode: parser.mode,
9034 envName,
9035 parser
9036 };
9037 var result = env.handler(context, _args, optArgs);
9038 parser.expect("\\end", false);
9039 var endNameToken = parser.nextToken;
9040 var end = assertNodeType(parser.parseFunction(), "environment");
9041 if (end.name !== envName) {
9042 throw new ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end.name + "}", endNameToken);
9043 }
9044 return result;
9045 }
9046 return {
9047 type: "environment",
9048 mode: parser.mode,
9049 name: envName,
9050 nameGroup
9051 };
9052 }
9053});
9054var htmlBuilder$5 = (group, options) => {
9055 var font = group.font;
9056 var newOptions = options.withFont(font);
9057 return buildGroup$1(group.body, newOptions);
9058};
9059var mathmlBuilder$4 = (group, options) => {
9060 var font = group.font;
9061 var newOptions = options.withFont(font);
9062 return buildGroup2(group.body, newOptions);
9063};
9064var fontAliases = {
9065 "\\Bbb": "\\mathbb",
9066 "\\bold": "\\mathbf",
9067 "\\frak": "\\mathfrak",
9068 "\\bm": "\\boldsymbol"
9069};
9070defineFunction({
9071 type: "font",
9072 names: [
9073 // styles, except \boldsymbol defined below
9074 "\\mathrm",
9075 "\\mathit",
9076 "\\mathbf",
9077 "\\mathnormal",
9078 // families
9079 "\\mathbb",
9080 "\\mathcal",
9081 "\\mathfrak",
9082 "\\mathscr",
9083 "\\mathsf",
9084 "\\mathtt",
9085 // aliases, except \bm defined below
9086 "\\Bbb",
9087 "\\bold",
9088 "\\frak"
9089 ],
9090 props: {
9091 numArgs: 1,
9092 allowedInArgument: true
9093 },
9094 handler: (_ref, args) => {
9095 var {
9096 parser,
9097 funcName
9098 } = _ref;
9099 var body = normalizeArgument(args[0]);
9100 var func = funcName;
9101 if (func in fontAliases) {
9102 func = fontAliases[func];
9103 }
9104 return {
9105 type: "font",
9106 mode: parser.mode,
9107 font: func.slice(1),
9108 body
9109 };
9110 },
9111 htmlBuilder: htmlBuilder$5,
9112 mathmlBuilder: mathmlBuilder$4
9113});
9114defineFunction({
9115 type: "mclass",
9116 names: ["\\boldsymbol", "\\bm"],
9117 props: {
9118 numArgs: 1
9119 },
9120 handler: (_ref2, args) => {
9121 var {
9122 parser
9123 } = _ref2;
9124 var body = args[0];
9125 var isCharacterBox3 = utils.isCharacterBox(body);
9126 return {
9127 type: "mclass",
9128 mode: parser.mode,
9129 mclass: binrelClass(body),
9130 body: [{
9131 type: "font",
9132 mode: parser.mode,
9133 font: "boldsymbol",
9134 body
9135 }],
9136 isCharacterBox: isCharacterBox3
9137 };
9138 }
9139});
9140defineFunction({
9141 type: "font",
9142 names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"],
9143 props: {
9144 numArgs: 0,
9145 allowedInText: true
9146 },
9147 handler: (_ref3, args) => {
9148 var {
9149 parser,
9150 funcName,
9151 breakOnTokenText
9152 } = _ref3;
9153 var {
9154 mode
9155 } = parser;
9156 var body = parser.parseExpression(true, breakOnTokenText);
9157 var style = "math" + funcName.slice(1);
9158 return {
9159 type: "font",
9160 mode,
9161 font: style,
9162 body: {
9163 type: "ordgroup",
9164 mode: parser.mode,
9165 body
9166 }
9167 };
9168 },
9169 htmlBuilder: htmlBuilder$5,
9170 mathmlBuilder: mathmlBuilder$4
9171});
9172var adjustStyle = (size, originalStyle) => {
9173 var style = originalStyle;
9174 if (size === "display") {
9175 style = style.id >= Style$1.SCRIPT.id ? style.text() : Style$1.DISPLAY;
9176 } else if (size === "text" && style.size === Style$1.DISPLAY.size) {
9177 style = Style$1.TEXT;
9178 } else if (size === "script") {
9179 style = Style$1.SCRIPT;
9180 } else if (size === "scriptscript") {
9181 style = Style$1.SCRIPTSCRIPT;
9182 }
9183 return style;
9184};
9185var htmlBuilder$4 = (group, options) => {
9186 var style = adjustStyle(group.size, options.style);
9187 var nstyle = style.fracNum();
9188 var dstyle = style.fracDen();
9189 var newOptions;
9190 newOptions = options.havingStyle(nstyle);
9191 var numerm = buildGroup$1(group.numer, newOptions, options);
9192 if (group.continued) {
9193 var hStrut = 8.5 / options.fontMetrics().ptPerEm;
9194 var dStrut = 3.5 / options.fontMetrics().ptPerEm;
9195 numerm.height = numerm.height < hStrut ? hStrut : numerm.height;
9196 numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth;
9197 }
9198 newOptions = options.havingStyle(dstyle);
9199 var denomm = buildGroup$1(group.denom, newOptions, options);
9200 var rule;
9201 var ruleWidth;
9202 var ruleSpacing;
9203 if (group.hasBarLine) {
9204 if (group.barSize) {
9205 ruleWidth = calculateSize(group.barSize, options);
9206 rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth);
9207 } else {
9208 rule = buildCommon.makeLineSpan("frac-line", options);
9209 }
9210 ruleWidth = rule.height;
9211 ruleSpacing = rule.height;
9212 } else {
9213 rule = null;
9214 ruleWidth = 0;
9215 ruleSpacing = options.fontMetrics().defaultRuleThickness;
9216 }
9217 var numShift;
9218 var clearance;
9219 var denomShift;
9220 if (style.size === Style$1.DISPLAY.size || group.size === "display") {
9221 numShift = options.fontMetrics().num1;
9222 if (ruleWidth > 0) {
9223 clearance = 3 * ruleSpacing;
9224 } else {
9225 clearance = 7 * ruleSpacing;
9226 }
9227 denomShift = options.fontMetrics().denom1;
9228 } else {
9229 if (ruleWidth > 0) {
9230 numShift = options.fontMetrics().num2;
9231 clearance = ruleSpacing;
9232 } else {
9233 numShift = options.fontMetrics().num3;
9234 clearance = 3 * ruleSpacing;
9235 }
9236 denomShift = options.fontMetrics().denom2;
9237 }
9238 var frac;
9239 if (!rule) {
9240 var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift);
9241 if (candidateClearance < clearance) {
9242 numShift += 0.5 * (clearance - candidateClearance);
9243 denomShift += 0.5 * (clearance - candidateClearance);
9244 }
9245 frac = buildCommon.makeVList({
9246 positionType: "individualShift",
9247 children: [{
9248 type: "elem",
9249 elem: denomm,
9250 shift: denomShift
9251 }, {
9252 type: "elem",
9253 elem: numerm,
9254 shift: -numShift
9255 }]
9256 }, options);
9257 } else {
9258 var axisHeight = options.fontMetrics().axisHeight;
9259 if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) {
9260 numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth));
9261 }
9262 if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) {
9263 denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift));
9264 }
9265 var midShift = -(axisHeight - 0.5 * ruleWidth);
9266 frac = buildCommon.makeVList({
9267 positionType: "individualShift",
9268 children: [{
9269 type: "elem",
9270 elem: denomm,
9271 shift: denomShift
9272 }, {
9273 type: "elem",
9274 elem: rule,
9275 shift: midShift
9276 }, {
9277 type: "elem",
9278 elem: numerm,
9279 shift: -numShift
9280 }]
9281 }, options);
9282 }
9283 newOptions = options.havingStyle(style);
9284 frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier;
9285 frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier;
9286 var delimSize;
9287 if (style.size === Style$1.DISPLAY.size) {
9288 delimSize = options.fontMetrics().delim1;
9289 } else if (style.size === Style$1.SCRIPTSCRIPT.size) {
9290 delimSize = options.havingStyle(Style$1.SCRIPT).fontMetrics().delim2;
9291 } else {
9292 delimSize = options.fontMetrics().delim2;
9293 }
9294 var leftDelim;
9295 var rightDelim;
9296 if (group.leftDelim == null) {
9297 leftDelim = makeNullDelimiter(options, ["mopen"]);
9298 } else {
9299 leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]);
9300 }
9301 if (group.continued) {
9302 rightDelim = buildCommon.makeSpan([]);
9303 } else if (group.rightDelim == null) {
9304 rightDelim = makeNullDelimiter(options, ["mclose"]);
9305 } else {
9306 rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]);
9307 }
9308 return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options);
9309};
9310var mathmlBuilder$3 = (group, options) => {
9311 var node = new mathMLTree.MathNode("mfrac", [buildGroup2(group.numer, options), buildGroup2(group.denom, options)]);
9312 if (!group.hasBarLine) {
9313 node.setAttribute("linethickness", "0px");
9314 } else if (group.barSize) {
9315 var ruleWidth = calculateSize(group.barSize, options);
9316 node.setAttribute("linethickness", makeEm(ruleWidth));
9317 }
9318 var style = adjustStyle(group.size, options.style);
9319 if (style.size !== options.style.size) {
9320 node = new mathMLTree.MathNode("mstyle", [node]);
9321 var isDisplay = style.size === Style$1.DISPLAY.size ? "true" : "false";
9322 node.setAttribute("displaystyle", isDisplay);
9323 node.setAttribute("scriptlevel", "0");
9324 }
9325 if (group.leftDelim != null || group.rightDelim != null) {
9326 var withDelims = [];
9327 if (group.leftDelim != null) {
9328 var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]);
9329 leftOp.setAttribute("fence", "true");
9330 withDelims.push(leftOp);
9331 }
9332 withDelims.push(node);
9333 if (group.rightDelim != null) {
9334 var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]);
9335 rightOp.setAttribute("fence", "true");
9336 withDelims.push(rightOp);
9337 }
9338 return makeRow(withDelims);
9339 }
9340 return node;
9341};
9342defineFunction({
9343 type: "genfrac",
9344 names: [
9345 "\\dfrac",
9346 "\\frac",
9347 "\\tfrac",
9348 "\\dbinom",
9349 "\\binom",
9350 "\\tbinom",
9351 "\\\\atopfrac",
9352 // can’t be entered directly
9353 "\\\\bracefrac",
9354 "\\\\brackfrac"
9355 // ditto
9356 ],
9357 props: {
9358 numArgs: 2,
9359 allowedInArgument: true
9360 },
9361 handler: (_ref, args) => {
9362 var {
9363 parser,
9364 funcName
9365 } = _ref;
9366 var numer = args[0];
9367 var denom = args[1];
9368 var hasBarLine;
9369 var leftDelim = null;
9370 var rightDelim = null;
9371 var size = "auto";
9372 switch (funcName) {
9373 case "\\dfrac":
9374 case "\\frac":
9375 case "\\tfrac":
9376 hasBarLine = true;
9377 break;
9378 case "\\\\atopfrac":
9379 hasBarLine = false;
9380 break;
9381 case "\\dbinom":
9382 case "\\binom":
9383 case "\\tbinom":
9384 hasBarLine = false;
9385 leftDelim = "(";
9386 rightDelim = ")";
9387 break;
9388 case "\\\\bracefrac":
9389 hasBarLine = false;
9390 leftDelim = "\\{";
9391 rightDelim = "\\}";
9392 break;
9393 case "\\\\brackfrac":
9394 hasBarLine = false;
9395 leftDelim = "[";
9396 rightDelim = "]";
9397 break;
9398 default:
9399 throw new Error("Unrecognized genfrac command");
9400 }
9401 switch (funcName) {
9402 case "\\dfrac":
9403 case "\\dbinom":
9404 size = "display";
9405 break;
9406 case "\\tfrac":
9407 case "\\tbinom":
9408 size = "text";
9409 break;
9410 }
9411 return {
9412 type: "genfrac",
9413 mode: parser.mode,
9414 continued: false,
9415 numer,
9416 denom,
9417 hasBarLine,
9418 leftDelim,
9419 rightDelim,
9420 size,
9421 barSize: null
9422 };
9423 },
9424 htmlBuilder: htmlBuilder$4,
9425 mathmlBuilder: mathmlBuilder$3
9426});
9427defineFunction({
9428 type: "genfrac",
9429 names: ["\\cfrac"],
9430 props: {
9431 numArgs: 2
9432 },
9433 handler: (_ref2, args) => {
9434 var {
9435 parser,
9436 funcName
9437 } = _ref2;
9438 var numer = args[0];
9439 var denom = args[1];
9440 return {
9441 type: "genfrac",
9442 mode: parser.mode,
9443 continued: true,
9444 numer,
9445 denom,
9446 hasBarLine: true,
9447 leftDelim: null,
9448 rightDelim: null,
9449 size: "display",
9450 barSize: null
9451 };
9452 }
9453});
9454defineFunction({
9455 type: "infix",
9456 names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
9457 props: {
9458 numArgs: 0,
9459 infix: true
9460 },
9461 handler(_ref3) {
9462 var {
9463 parser,
9464 funcName,
9465 token
9466 } = _ref3;
9467 var replaceWith;
9468 switch (funcName) {
9469 case "\\over":
9470 replaceWith = "\\frac";
9471 break;
9472 case "\\choose":
9473 replaceWith = "\\binom";
9474 break;
9475 case "\\atop":
9476 replaceWith = "\\\\atopfrac";
9477 break;
9478 case "\\brace":
9479 replaceWith = "\\\\bracefrac";
9480 break;
9481 case "\\brack":
9482 replaceWith = "\\\\brackfrac";
9483 break;
9484 default:
9485 throw new Error("Unrecognized infix genfrac command");
9486 }
9487 return {
9488 type: "infix",
9489 mode: parser.mode,
9490 replaceWith,
9491 token
9492 };
9493 }
9494});
9495var stylArray = ["display", "text", "script", "scriptscript"];
9496var delimFromValue = function delimFromValue2(delimString) {
9497 var delim = null;
9498 if (delimString.length > 0) {
9499 delim = delimString;
9500 delim = delim === "." ? null : delim;
9501 }
9502 return delim;
9503};
9504defineFunction({
9505 type: "genfrac",
9506 names: ["\\genfrac"],
9507 props: {
9508 numArgs: 6,
9509 allowedInArgument: true,
9510 argTypes: ["math", "math", "size", "text", "math", "math"]
9511 },
9512 handler(_ref4, args) {
9513 var {
9514 parser
9515 } = _ref4;
9516 var numer = args[4];
9517 var denom = args[5];
9518 var leftNode = normalizeArgument(args[0]);
9519 var leftDelim = leftNode.type === "atom" && leftNode.family === "open" ? delimFromValue(leftNode.text) : null;
9520 var rightNode = normalizeArgument(args[1]);
9521 var rightDelim = rightNode.type === "atom" && rightNode.family === "close" ? delimFromValue(rightNode.text) : null;
9522 var barNode = assertNodeType(args[2], "size");
9523 var hasBarLine;
9524 var barSize = null;
9525 if (barNode.isBlank) {
9526 hasBarLine = true;
9527 } else {
9528 barSize = barNode.value;
9529 hasBarLine = barSize.number > 0;
9530 }
9531 var size = "auto";
9532 var styl = args[3];
9533 if (styl.type === "ordgroup") {
9534 if (styl.body.length > 0) {
9535 var textOrd = assertNodeType(styl.body[0], "textord");
9536 size = stylArray[Number(textOrd.text)];
9537 }
9538 } else {
9539 styl = assertNodeType(styl, "textord");
9540 size = stylArray[Number(styl.text)];
9541 }
9542 return {
9543 type: "genfrac",
9544 mode: parser.mode,
9545 numer,
9546 denom,
9547 continued: false,
9548 hasBarLine,
9549 barSize,
9550 leftDelim,
9551 rightDelim,
9552 size
9553 };
9554 },
9555 htmlBuilder: htmlBuilder$4,
9556 mathmlBuilder: mathmlBuilder$3
9557});
9558defineFunction({
9559 type: "infix",
9560 names: ["\\above"],
9561 props: {
9562 numArgs: 1,
9563 argTypes: ["size"],
9564 infix: true
9565 },
9566 handler(_ref5, args) {
9567 var {
9568 parser,
9569 funcName,
9570 token
9571 } = _ref5;
9572 return {
9573 type: "infix",
9574 mode: parser.mode,
9575 replaceWith: "\\\\abovefrac",
9576 size: assertNodeType(args[0], "size").value,
9577 token
9578 };
9579 }
9580});
9581defineFunction({
9582 type: "genfrac",
9583 names: ["\\\\abovefrac"],
9584 props: {
9585 numArgs: 3,
9586 argTypes: ["math", "size", "math"]
9587 },
9588 handler: (_ref6, args) => {
9589 var {
9590 parser,
9591 funcName
9592 } = _ref6;
9593 var numer = args[0];
9594 var barSize = assert(assertNodeType(args[1], "infix").size);
9595 var denom = args[2];
9596 var hasBarLine = barSize.number > 0;
9597 return {
9598 type: "genfrac",
9599 mode: parser.mode,
9600 numer,
9601 denom,
9602 continued: false,
9603 hasBarLine,
9604 barSize,
9605 leftDelim: null,
9606 rightDelim: null,
9607 size: "auto"
9608 };
9609 },
9610 htmlBuilder: htmlBuilder$4,
9611 mathmlBuilder: mathmlBuilder$3
9612});
9613var htmlBuilder$3 = (grp, options) => {
9614 var style = options.style;
9615 var supSubGroup;
9616 var group;
9617 if (grp.type === "supsub") {
9618 supSubGroup = grp.sup ? buildGroup$1(grp.sup, options.havingStyle(style.sup()), options) : buildGroup$1(grp.sub, options.havingStyle(style.sub()), options);
9619 group = assertNodeType(grp.base, "horizBrace");
9620 } else {
9621 group = assertNodeType(grp, "horizBrace");
9622 }
9623 var body = buildGroup$1(group.base, options.havingBaseStyle(Style$1.DISPLAY));
9624 var braceBody = stretchy.svgSpan(group, options);
9625 var vlist;
9626 if (group.isOver) {
9627 vlist = buildCommon.makeVList({
9628 positionType: "firstBaseline",
9629 children: [{
9630 type: "elem",
9631 elem: body
9632 }, {
9633 type: "kern",
9634 size: 0.1
9635 }, {
9636 type: "elem",
9637 elem: braceBody
9638 }]
9639 }, options);
9640 vlist.children[0].children[0].children[1].classes.push("svg-align");
9641 } else {
9642 vlist = buildCommon.makeVList({
9643 positionType: "bottom",
9644 positionData: body.depth + 0.1 + braceBody.height,
9645 children: [{
9646 type: "elem",
9647 elem: braceBody
9648 }, {
9649 type: "kern",
9650 size: 0.1
9651 }, {
9652 type: "elem",
9653 elem: body
9654 }]
9655 }, options);
9656 vlist.children[0].children[0].children[0].classes.push("svg-align");
9657 }
9658 if (supSubGroup) {
9659 var vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
9660 if (group.isOver) {
9661 vlist = buildCommon.makeVList({
9662 positionType: "firstBaseline",
9663 children: [{
9664 type: "elem",
9665 elem: vSpan
9666 }, {
9667 type: "kern",
9668 size: 0.2
9669 }, {
9670 type: "elem",
9671 elem: supSubGroup
9672 }]
9673 }, options);
9674 } else {
9675 vlist = buildCommon.makeVList({
9676 positionType: "bottom",
9677 positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth,
9678 children: [{
9679 type: "elem",
9680 elem: supSubGroup
9681 }, {
9682 type: "kern",
9683 size: 0.2
9684 }, {
9685 type: "elem",
9686 elem: vSpan
9687 }]
9688 }, options);
9689 }
9690 }
9691 return buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
9692};
9693var mathmlBuilder$2 = (group, options) => {
9694 var accentNode = stretchy.mathMLnode(group.label);
9695 return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [buildGroup2(group.base, options), accentNode]);
9696};
9697defineFunction({
9698 type: "horizBrace",
9699 names: ["\\overbrace", "\\underbrace"],
9700 props: {
9701 numArgs: 1
9702 },
9703 handler(_ref, args) {
9704 var {
9705 parser,
9706 funcName
9707 } = _ref;
9708 return {
9709 type: "horizBrace",
9710 mode: parser.mode,
9711 label: funcName,
9712 isOver: /^\\over/.test(funcName),
9713 base: args[0]
9714 };
9715 },
9716 htmlBuilder: htmlBuilder$3,
9717 mathmlBuilder: mathmlBuilder$2
9718});
9719defineFunction({
9720 type: "href",
9721 names: ["\\href"],
9722 props: {
9723 numArgs: 2,
9724 argTypes: ["url", "original"],
9725 allowedInText: true
9726 },
9727 handler: (_ref, args) => {
9728 var {
9729 parser
9730 } = _ref;
9731 var body = args[1];
9732 var href = assertNodeType(args[0], "url").url;
9733 if (!parser.settings.isTrusted({
9734 command: "\\href",
9735 url: href
9736 })) {
9737 return parser.formatUnsupportedCmd("\\href");
9738 }
9739 return {
9740 type: "href",
9741 mode: parser.mode,
9742 href,
9743 body: ordargument(body)
9744 };
9745 },
9746 htmlBuilder: (group, options) => {
9747 var elements = buildExpression$1(group.body, options, false);
9748 return buildCommon.makeAnchor(group.href, [], elements, options);
9749 },
9750 mathmlBuilder: (group, options) => {
9751 var math2 = buildExpressionRow(group.body, options);
9752 if (!(math2 instanceof MathNode)) {
9753 math2 = new MathNode("mrow", [math2]);
9754 }
9755 math2.setAttribute("href", group.href);
9756 return math2;
9757 }
9758});
9759defineFunction({
9760 type: "href",
9761 names: ["\\url"],
9762 props: {
9763 numArgs: 1,
9764 argTypes: ["url"],
9765 allowedInText: true
9766 },
9767 handler: (_ref2, args) => {
9768 var {
9769 parser
9770 } = _ref2;
9771 var href = assertNodeType(args[0], "url").url;
9772 if (!parser.settings.isTrusted({
9773 command: "\\url",
9774 url: href
9775 })) {
9776 return parser.formatUnsupportedCmd("\\url");
9777 }
9778 var chars = [];
9779 for (var i = 0; i < href.length; i++) {
9780 var c = href[i];
9781 if (c === "~") {
9782 c = "\\textasciitilde";
9783 }
9784 chars.push({
9785 type: "textord",
9786 mode: "text",
9787 text: c
9788 });
9789 }
9790 var body = {
9791 type: "text",
9792 mode: parser.mode,
9793 font: "\\texttt",
9794 body: chars
9795 };
9796 return {
9797 type: "href",
9798 mode: parser.mode,
9799 href,
9800 body: ordargument(body)
9801 };
9802 }
9803});
9804defineFunction({
9805 type: "hbox",
9806 names: ["\\hbox"],
9807 props: {
9808 numArgs: 1,
9809 argTypes: ["text"],
9810 allowedInText: true,
9811 primitive: true
9812 },
9813 handler(_ref, args) {
9814 var {
9815 parser
9816 } = _ref;
9817 return {
9818 type: "hbox",
9819 mode: parser.mode,
9820 body: ordargument(args[0])
9821 };
9822 },
9823 htmlBuilder(group, options) {
9824 var elements = buildExpression$1(group.body, options, false);
9825 return buildCommon.makeFragment(elements);
9826 },
9827 mathmlBuilder(group, options) {
9828 return new mathMLTree.MathNode("mrow", buildExpression2(group.body, options));
9829 }
9830});
9831defineFunction({
9832 type: "html",
9833 names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"],
9834 props: {
9835 numArgs: 2,
9836 argTypes: ["raw", "original"],
9837 allowedInText: true
9838 },
9839 handler: (_ref, args) => {
9840 var {
9841 parser,
9842 funcName,
9843 token
9844 } = _ref;
9845 var value = assertNodeType(args[0], "raw").string;
9846 var body = args[1];
9847 if (parser.settings.strict) {
9848 parser.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode");
9849 }
9850 var trustContext;
9851 var attributes = {};
9852 switch (funcName) {
9853 case "\\htmlClass":
9854 attributes.class = value;
9855 trustContext = {
9856 command: "\\htmlClass",
9857 class: value
9858 };
9859 break;
9860 case "\\htmlId":
9861 attributes.id = value;
9862 trustContext = {
9863 command: "\\htmlId",
9864 id: value
9865 };
9866 break;
9867 case "\\htmlStyle":
9868 attributes.style = value;
9869 trustContext = {
9870 command: "\\htmlStyle",
9871 style: value
9872 };
9873 break;
9874 case "\\htmlData": {
9875 var data = value.split(",");
9876 for (var i = 0; i < data.length; i++) {
9877 var keyVal = data[i].split("=");
9878 if (keyVal.length !== 2) {
9879 throw new ParseError("Error parsing key-value for \\htmlData");
9880 }
9881 attributes["data-" + keyVal[0].trim()] = keyVal[1].trim();
9882 }
9883 trustContext = {
9884 command: "\\htmlData",
9885 attributes
9886 };
9887 break;
9888 }
9889 default:
9890 throw new Error("Unrecognized html command");
9891 }
9892 if (!parser.settings.isTrusted(trustContext)) {
9893 return parser.formatUnsupportedCmd(funcName);
9894 }
9895 return {
9896 type: "html",
9897 mode: parser.mode,
9898 attributes,
9899 body: ordargument(body)
9900 };
9901 },
9902 htmlBuilder: (group, options) => {
9903 var elements = buildExpression$1(group.body, options, false);
9904 var classes = ["enclosing"];
9905 if (group.attributes.class) {
9906 classes.push(...group.attributes.class.trim().split(/\s+/));
9907 }
9908 var span = buildCommon.makeSpan(classes, elements, options);
9909 for (var attr in group.attributes) {
9910 if (attr !== "class" && group.attributes.hasOwnProperty(attr)) {
9911 span.setAttribute(attr, group.attributes[attr]);
9912 }
9913 }
9914 return span;
9915 },
9916 mathmlBuilder: (group, options) => {
9917 return buildExpressionRow(group.body, options);
9918 }
9919});
9920defineFunction({
9921 type: "htmlmathml",
9922 names: ["\\html@mathml"],
9923 props: {
9924 numArgs: 2,
9925 allowedInText: true
9926 },
9927 handler: (_ref, args) => {
9928 var {
9929 parser
9930 } = _ref;
9931 return {
9932 type: "htmlmathml",
9933 mode: parser.mode,
9934 html: ordargument(args[0]),
9935 mathml: ordargument(args[1])
9936 };
9937 },
9938 htmlBuilder: (group, options) => {
9939 var elements = buildExpression$1(group.html, options, false);
9940 return buildCommon.makeFragment(elements);
9941 },
9942 mathmlBuilder: (group, options) => {
9943 return buildExpressionRow(group.mathml, options);
9944 }
9945});
9946var sizeData = function sizeData2(str) {
9947 if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) {
9948 return {
9949 number: +str,
9950 unit: "bp"
9951 };
9952 } else {
9953 var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str);
9954 if (!match) {
9955 throw new ParseError("Invalid size: '" + str + "' in \\includegraphics");
9956 }
9957 var data = {
9958 number: +(match[1] + match[2]),
9959 // sign + magnitude, cast to number
9960 unit: match[3]
9961 };
9962 if (!validUnit(data)) {
9963 throw new ParseError("Invalid unit: '" + data.unit + "' in \\includegraphics.");
9964 }
9965 return data;
9966 }
9967};
9968defineFunction({
9969 type: "includegraphics",
9970 names: ["\\includegraphics"],
9971 props: {
9972 numArgs: 1,
9973 numOptionalArgs: 1,
9974 argTypes: ["raw", "url"],
9975 allowedInText: false
9976 },
9977 handler: (_ref, args, optArgs) => {
9978 var {
9979 parser
9980 } = _ref;
9981 var width = {
9982 number: 0,
9983 unit: "em"
9984 };
9985 var height = {
9986 number: 0.9,
9987 unit: "em"
9988 };
9989 var totalheight = {
9990 number: 0,
9991 unit: "em"
9992 };
9993 var alt = "";
9994 if (optArgs[0]) {
9995 var attributeStr = assertNodeType(optArgs[0], "raw").string;
9996 var attributes = attributeStr.split(",");
9997 for (var i = 0; i < attributes.length; i++) {
9998 var keyVal = attributes[i].split("=");
9999 if (keyVal.length === 2) {
10000 var str = keyVal[1].trim();
10001 switch (keyVal[0].trim()) {
10002 case "alt":
10003 alt = str;
10004 break;
10005 case "width":
10006 width = sizeData(str);
10007 break;
10008 case "height":
10009 height = sizeData(str);
10010 break;
10011 case "totalheight":
10012 totalheight = sizeData(str);
10013 break;
10014 default:
10015 throw new ParseError("Invalid key: '" + keyVal[0] + "' in \\includegraphics.");
10016 }
10017 }
10018 }
10019 }
10020 var src = assertNodeType(args[0], "url").url;
10021 if (alt === "") {
10022 alt = src;
10023 alt = alt.replace(/^.*[\\/]/, "");
10024 alt = alt.substring(0, alt.lastIndexOf("."));
10025 }
10026 if (!parser.settings.isTrusted({
10027 command: "\\includegraphics",
10028 url: src
10029 })) {
10030 return parser.formatUnsupportedCmd("\\includegraphics");
10031 }
10032 return {
10033 type: "includegraphics",
10034 mode: parser.mode,
10035 alt,
10036 width,
10037 height,
10038 totalheight,
10039 src
10040 };
10041 },
10042 htmlBuilder: (group, options) => {
10043 var height = calculateSize(group.height, options);
10044 var depth = 0;
10045 if (group.totalheight.number > 0) {
10046 depth = calculateSize(group.totalheight, options) - height;
10047 }
10048 var width = 0;
10049 if (group.width.number > 0) {
10050 width = calculateSize(group.width, options);
10051 }
10052 var style = {
10053 height: makeEm(height + depth)
10054 };
10055 if (width > 0) {
10056 style.width = makeEm(width);
10057 }
10058 if (depth > 0) {
10059 style.verticalAlign = makeEm(-depth);
10060 }
10061 var node = new Img(group.src, group.alt, style);
10062 node.height = height;
10063 node.depth = depth;
10064 return node;
10065 },
10066 mathmlBuilder: (group, options) => {
10067 var node = new mathMLTree.MathNode("mglyph", []);
10068 node.setAttribute("alt", group.alt);
10069 var height = calculateSize(group.height, options);
10070 var depth = 0;
10071 if (group.totalheight.number > 0) {
10072 depth = calculateSize(group.totalheight, options) - height;
10073 node.setAttribute("valign", makeEm(-depth));
10074 }
10075 node.setAttribute("height", makeEm(height + depth));
10076 if (group.width.number > 0) {
10077 var width = calculateSize(group.width, options);
10078 node.setAttribute("width", makeEm(width));
10079 }
10080 node.setAttribute("src", group.src);
10081 return node;
10082 }
10083});
10084defineFunction({
10085 type: "kern",
10086 names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
10087 props: {
10088 numArgs: 1,
10089 argTypes: ["size"],
10090 primitive: true,
10091 allowedInText: true
10092 },
10093 handler(_ref, args) {
10094 var {
10095 parser,
10096 funcName
10097 } = _ref;
10098 var size = assertNodeType(args[0], "size");
10099 if (parser.settings.strict) {
10100 var mathFunction = funcName[1] === "m";
10101 var muUnit = size.value.unit === "mu";
10102 if (mathFunction) {
10103 if (!muUnit) {
10104 parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units"));
10105 }
10106 if (parser.mode !== "math") {
10107 parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode");
10108 }
10109 } else {
10110 if (muUnit) {
10111 parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units");
10112 }
10113 }
10114 }
10115 return {
10116 type: "kern",
10117 mode: parser.mode,
10118 dimension: size.value
10119 };
10120 },
10121 htmlBuilder(group, options) {
10122 return buildCommon.makeGlue(group.dimension, options);
10123 },
10124 mathmlBuilder(group, options) {
10125 var dimension = calculateSize(group.dimension, options);
10126 return new mathMLTree.SpaceNode(dimension);
10127 }
10128});
10129defineFunction({
10130 type: "lap",
10131 names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
10132 props: {
10133 numArgs: 1,
10134 allowedInText: true
10135 },
10136 handler: (_ref, args) => {
10137 var {
10138 parser,
10139 funcName
10140 } = _ref;
10141 var body = args[0];
10142 return {
10143 type: "lap",
10144 mode: parser.mode,
10145 alignment: funcName.slice(5),
10146 body
10147 };
10148 },
10149 htmlBuilder: (group, options) => {
10150 var inner2;
10151 if (group.alignment === "clap") {
10152 inner2 = buildCommon.makeSpan([], [buildGroup$1(group.body, options)]);
10153 inner2 = buildCommon.makeSpan(["inner"], [inner2], options);
10154 } else {
10155 inner2 = buildCommon.makeSpan(["inner"], [buildGroup$1(group.body, options)]);
10156 }
10157 var fix = buildCommon.makeSpan(["fix"], []);
10158 var node = buildCommon.makeSpan([group.alignment], [inner2, fix], options);
10159 var strut = buildCommon.makeSpan(["strut"]);
10160 strut.style.height = makeEm(node.height + node.depth);
10161 if (node.depth) {
10162 strut.style.verticalAlign = makeEm(-node.depth);
10163 }
10164 node.children.unshift(strut);
10165 node = buildCommon.makeSpan(["thinbox"], [node], options);
10166 return buildCommon.makeSpan(["mord", "vbox"], [node], options);
10167 },
10168 mathmlBuilder: (group, options) => {
10169 var node = new mathMLTree.MathNode("mpadded", [buildGroup2(group.body, options)]);
10170 if (group.alignment !== "rlap") {
10171 var offset = group.alignment === "llap" ? "-1" : "-0.5";
10172 node.setAttribute("lspace", offset + "width");
10173 }
10174 node.setAttribute("width", "0px");
10175 return node;
10176 }
10177});
10178defineFunction({
10179 type: "styling",
10180 names: ["\\(", "$"],
10181 props: {
10182 numArgs: 0,
10183 allowedInText: true,
10184 allowedInMath: false
10185 },
10186 handler(_ref, args) {
10187 var {
10188 funcName,
10189 parser
10190 } = _ref;
10191 var outerMode = parser.mode;
10192 parser.switchMode("math");
10193 var close2 = funcName === "\\(" ? "\\)" : "$";
10194 var body = parser.parseExpression(false, close2);
10195 parser.expect(close2);
10196 parser.switchMode(outerMode);
10197 return {
10198 type: "styling",
10199 mode: parser.mode,
10200 style: "text",
10201 body
10202 };
10203 }
10204});
10205defineFunction({
10206 type: "text",
10207 // Doesn't matter what this is.
10208 names: ["\\)", "\\]"],
10209 props: {
10210 numArgs: 0,
10211 allowedInText: true,
10212 allowedInMath: false
10213 },
10214 handler(context, args) {
10215 throw new ParseError("Mismatched " + context.funcName);
10216 }
10217});
10218var chooseMathStyle = (group, options) => {
10219 switch (options.style.size) {
10220 case Style$1.DISPLAY.size:
10221 return group.display;
10222 case Style$1.TEXT.size:
10223 return group.text;
10224 case Style$1.SCRIPT.size:
10225 return group.script;
10226 case Style$1.SCRIPTSCRIPT.size:
10227 return group.scriptscript;
10228 default:
10229 return group.text;
10230 }
10231};
10232defineFunction({
10233 type: "mathchoice",
10234 names: ["\\mathchoice"],
10235 props: {
10236 numArgs: 4,
10237 primitive: true
10238 },
10239 handler: (_ref, args) => {
10240 var {
10241 parser
10242 } = _ref;
10243 return {
10244 type: "mathchoice",
10245 mode: parser.mode,
10246 display: ordargument(args[0]),
10247 text: ordargument(args[1]),
10248 script: ordargument(args[2]),
10249 scriptscript: ordargument(args[3])
10250 };
10251 },
10252 htmlBuilder: (group, options) => {
10253 var body = chooseMathStyle(group, options);
10254 var elements = buildExpression$1(body, options, false);
10255 return buildCommon.makeFragment(elements);
10256 },
10257 mathmlBuilder: (group, options) => {
10258 var body = chooseMathStyle(group, options);
10259 return buildExpressionRow(body, options);
10260 }
10261});
10262var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift) => {
10263 base = buildCommon.makeSpan([], [base]);
10264 var subIsSingleCharacter = subGroup && utils.isCharacterBox(subGroup);
10265 var sub2;
10266 var sup2;
10267 if (supGroup) {
10268 var elem = buildGroup$1(supGroup, options.havingStyle(style.sup()), options);
10269 sup2 = {
10270 elem,
10271 kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth)
10272 };
10273 }
10274 if (subGroup) {
10275 var _elem = buildGroup$1(subGroup, options.havingStyle(style.sub()), options);
10276 sub2 = {
10277 elem: _elem,
10278 kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height)
10279 };
10280 }
10281 var finalGroup;
10282 if (sup2 && sub2) {
10283 var bottom = options.fontMetrics().bigOpSpacing5 + sub2.elem.height + sub2.elem.depth + sub2.kern + base.depth + baseShift;
10284 finalGroup = buildCommon.makeVList({
10285 positionType: "bottom",
10286 positionData: bottom,
10287 children: [{
10288 type: "kern",
10289 size: options.fontMetrics().bigOpSpacing5
10290 }, {
10291 type: "elem",
10292 elem: sub2.elem,
10293 marginLeft: makeEm(-slant)
10294 }, {
10295 type: "kern",
10296 size: sub2.kern
10297 }, {
10298 type: "elem",
10299 elem: base
10300 }, {
10301 type: "kern",
10302 size: sup2.kern
10303 }, {
10304 type: "elem",
10305 elem: sup2.elem,
10306 marginLeft: makeEm(slant)
10307 }, {
10308 type: "kern",
10309 size: options.fontMetrics().bigOpSpacing5
10310 }]
10311 }, options);
10312 } else if (sub2) {
10313 var top = base.height - baseShift;
10314 finalGroup = buildCommon.makeVList({
10315 positionType: "top",
10316 positionData: top,
10317 children: [{
10318 type: "kern",
10319 size: options.fontMetrics().bigOpSpacing5
10320 }, {
10321 type: "elem",
10322 elem: sub2.elem,
10323 marginLeft: makeEm(-slant)
10324 }, {
10325 type: "kern",
10326 size: sub2.kern
10327 }, {
10328 type: "elem",
10329 elem: base
10330 }]
10331 }, options);
10332 } else if (sup2) {
10333 var _bottom = base.depth + baseShift;
10334 finalGroup = buildCommon.makeVList({
10335 positionType: "bottom",
10336 positionData: _bottom,
10337 children: [{
10338 type: "elem",
10339 elem: base
10340 }, {
10341 type: "kern",
10342 size: sup2.kern
10343 }, {
10344 type: "elem",
10345 elem: sup2.elem,
10346 marginLeft: makeEm(slant)
10347 }, {
10348 type: "kern",
10349 size: options.fontMetrics().bigOpSpacing5
10350 }]
10351 }, options);
10352 } else {
10353 return base;
10354 }
10355 var parts = [finalGroup];
10356 if (sub2 && slant !== 0 && !subIsSingleCharacter) {
10357 var spacer = buildCommon.makeSpan(["mspace"], [], options);
10358 spacer.style.marginRight = makeEm(slant);
10359 parts.unshift(spacer);
10360 }
10361 return buildCommon.makeSpan(["mop", "op-limits"], parts, options);
10362};
10363var noSuccessor = ["\\smallint"];
10364var htmlBuilder$2 = (grp, options) => {
10365 var supGroup;
10366 var subGroup;
10367 var hasLimits = false;
10368 var group;
10369 if (grp.type === "supsub") {
10370 supGroup = grp.sup;
10371 subGroup = grp.sub;
10372 group = assertNodeType(grp.base, "op");
10373 hasLimits = true;
10374 } else {
10375 group = assertNodeType(grp, "op");
10376 }
10377 var style = options.style;
10378 var large = false;
10379 if (style.size === Style$1.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) {
10380 large = true;
10381 }
10382 var base;
10383 if (group.symbol) {
10384 var fontName = large ? "Size2-Regular" : "Size1-Regular";
10385 var stash = "";
10386 if (group.name === "\\oiint" || group.name === "\\oiiint") {
10387 stash = group.name.slice(1);
10388 group.name = stash === "oiint" ? "\\iint" : "\\iiint";
10389 }
10390 base = buildCommon.makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]);
10391 if (stash.length > 0) {
10392 var italic = base.italic;
10393 var oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options);
10394 base = buildCommon.makeVList({
10395 positionType: "individualShift",
10396 children: [{
10397 type: "elem",
10398 elem: base,
10399 shift: 0
10400 }, {
10401 type: "elem",
10402 elem: oval,
10403 shift: large ? 0.08 : 0
10404 }]
10405 }, options);
10406 group.name = "\\" + stash;
10407 base.classes.unshift("mop");
10408 base.italic = italic;
10409 }
10410 } else if (group.body) {
10411 var inner2 = buildExpression$1(group.body, options, true);
10412 if (inner2.length === 1 && inner2[0] instanceof SymbolNode) {
10413 base = inner2[0];
10414 base.classes[0] = "mop";
10415 } else {
10416 base = buildCommon.makeSpan(["mop"], inner2, options);
10417 }
10418 } else {
10419 var output = [];
10420 for (var i = 1; i < group.name.length; i++) {
10421 output.push(buildCommon.mathsym(group.name[i], group.mode, options));
10422 }
10423 base = buildCommon.makeSpan(["mop"], output, options);
10424 }
10425 var baseShift = 0;
10426 var slant = 0;
10427 if ((base instanceof SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) {
10428 baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight;
10429 slant = base.italic;
10430 }
10431 if (hasLimits) {
10432 return assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift);
10433 } else {
10434 if (baseShift) {
10435 base.style.position = "relative";
10436 base.style.top = makeEm(baseShift);
10437 }
10438 return base;
10439 }
10440};
10441var mathmlBuilder$1 = (group, options) => {
10442 var node;
10443 if (group.symbol) {
10444 node = new MathNode("mo", [makeText(group.name, group.mode)]);
10445 if (utils.contains(noSuccessor, group.name)) {
10446 node.setAttribute("largeop", "false");
10447 }
10448 } else if (group.body) {
10449 node = new MathNode("mo", buildExpression2(group.body, options));
10450 } else {
10451 node = new MathNode("mi", [new TextNode(group.name.slice(1))]);
10452 var operator = new MathNode("mo", [makeText("⁡", "text")]);
10453 if (group.parentIsSupSub) {
10454 node = new MathNode("mrow", [node, operator]);
10455 } else {
10456 node = newDocumentFragment([node, operator]);
10457 }
10458 }
10459 return node;
10460};
10461var singleCharBigOps = {
10462 "∏": "\\prod",
10463 "∐": "\\coprod",
10464 "∑": "\\sum",
10465 "⋀": "\\bigwedge",
10466 "⋁": "\\bigvee",
10467 "⋂": "\\bigcap",
10468 "⋃": "\\bigcup",
10469 "⨀": "\\bigodot",
10470 "⨁": "\\bigoplus",
10471 "⨂": "\\bigotimes",
10472 "⨄": "\\biguplus",
10473 "⨆": "\\bigsqcup"
10474};
10475defineFunction({
10476 type: "op",
10477 names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "∏", "∐", "∑", "⋀", "⋁", "⋂", "⋃", "⨀", "⨁", "⨂", "⨄", "⨆"],
10478 props: {
10479 numArgs: 0
10480 },
10481 handler: (_ref, args) => {
10482 var {
10483 parser,
10484 funcName
10485 } = _ref;
10486 var fName = funcName;
10487 if (fName.length === 1) {
10488 fName = singleCharBigOps[fName];
10489 }
10490 return {
10491 type: "op",
10492 mode: parser.mode,
10493 limits: true,
10494 parentIsSupSub: false,
10495 symbol: true,
10496 name: fName
10497 };
10498 },
10499 htmlBuilder: htmlBuilder$2,
10500 mathmlBuilder: mathmlBuilder$1
10501});
10502defineFunction({
10503 type: "op",
10504 names: ["\\mathop"],
10505 props: {
10506 numArgs: 1,
10507 primitive: true
10508 },
10509 handler: (_ref2, args) => {
10510 var {
10511 parser
10512 } = _ref2;
10513 var body = args[0];
10514 return {
10515 type: "op",
10516 mode: parser.mode,
10517 limits: false,
10518 parentIsSupSub: false,
10519 symbol: false,
10520 body: ordargument(body)
10521 };
10522 },
10523 htmlBuilder: htmlBuilder$2,
10524 mathmlBuilder: mathmlBuilder$1
10525});
10526var singleCharIntegrals = {
10527 "∫": "\\int",
10528 "∬": "\\iint",
10529 "∭": "\\iiint",
10530 "∮": "\\oint",
10531 "∯": "\\oiint",
10532 "∰": "\\oiiint"
10533};
10534defineFunction({
10535 type: "op",
10536 names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"],
10537 props: {
10538 numArgs: 0
10539 },
10540 handler(_ref3) {
10541 var {
10542 parser,
10543 funcName
10544 } = _ref3;
10545 return {
10546 type: "op",
10547 mode: parser.mode,
10548 limits: false,
10549 parentIsSupSub: false,
10550 symbol: false,
10551 name: funcName
10552 };
10553 },
10554 htmlBuilder: htmlBuilder$2,
10555 mathmlBuilder: mathmlBuilder$1
10556});
10557defineFunction({
10558 type: "op",
10559 names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
10560 props: {
10561 numArgs: 0
10562 },
10563 handler(_ref4) {
10564 var {
10565 parser,
10566 funcName
10567 } = _ref4;
10568 return {
10569 type: "op",
10570 mode: parser.mode,
10571 limits: true,
10572 parentIsSupSub: false,
10573 symbol: false,
10574 name: funcName
10575 };
10576 },
10577 htmlBuilder: htmlBuilder$2,
10578 mathmlBuilder: mathmlBuilder$1
10579});
10580defineFunction({
10581 type: "op",
10582 names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "∫", "∬", "∭", "∮", "∯", "∰"],
10583 props: {
10584 numArgs: 0
10585 },
10586 handler(_ref5) {
10587 var {
10588 parser,
10589 funcName
10590 } = _ref5;
10591 var fName = funcName;
10592 if (fName.length === 1) {
10593 fName = singleCharIntegrals[fName];
10594 }
10595 return {
10596 type: "op",
10597 mode: parser.mode,
10598 limits: false,
10599 parentIsSupSub: false,
10600 symbol: true,
10601 name: fName
10602 };
10603 },
10604 htmlBuilder: htmlBuilder$2,
10605 mathmlBuilder: mathmlBuilder$1
10606});
10607var htmlBuilder$1 = (grp, options) => {
10608 var supGroup;
10609 var subGroup;
10610 var hasLimits = false;
10611 var group;
10612 if (grp.type === "supsub") {
10613 supGroup = grp.sup;
10614 subGroup = grp.sub;
10615 group = assertNodeType(grp.base, "operatorname");
10616 hasLimits = true;
10617 } else {
10618 group = assertNodeType(grp, "operatorname");
10619 }
10620 var base;
10621 if (group.body.length > 0) {
10622 var body = group.body.map((child2) => {
10623 var childText = child2.text;
10624 if (typeof childText === "string") {
10625 return {
10626 type: "textord",
10627 mode: child2.mode,
10628 text: childText
10629 };
10630 } else {
10631 return child2;
10632 }
10633 });
10634 var expression = buildExpression$1(body, options.withFont("mathrm"), true);
10635 for (var i = 0; i < expression.length; i++) {
10636 var child = expression[i];
10637 if (child instanceof SymbolNode) {
10638 child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
10639 }
10640 }
10641 base = buildCommon.makeSpan(["mop"], expression, options);
10642 } else {
10643 base = buildCommon.makeSpan(["mop"], [], options);
10644 }
10645 if (hasLimits) {
10646 return assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0);
10647 } else {
10648 return base;
10649 }
10650};
10651var mathmlBuilder2 = (group, options) => {
10652 var expression = buildExpression2(group.body, options.withFont("mathrm"));
10653 var isAllString = true;
10654 for (var i = 0; i < expression.length; i++) {
10655 var node = expression[i];
10656 if (node instanceof mathMLTree.SpaceNode)
10657 ;
10658 else if (node instanceof mathMLTree.MathNode) {
10659 switch (node.type) {
10660 case "mi":
10661 case "mn":
10662 case "ms":
10663 case "mspace":
10664 case "mtext":
10665 break;
10666 case "mo": {
10667 var child = node.children[0];
10668 if (node.children.length === 1 && child instanceof mathMLTree.TextNode) {
10669 child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
10670 } else {
10671 isAllString = false;
10672 }
10673 break;
10674 }
10675 default:
10676 isAllString = false;
10677 }
10678 } else {
10679 isAllString = false;
10680 }
10681 }
10682 if (isAllString) {
10683 var word = expression.map((node2) => node2.toText()).join("");
10684 expression = [new mathMLTree.TextNode(word)];
10685 }
10686 var identifier = new mathMLTree.MathNode("mi", expression);
10687 identifier.setAttribute("mathvariant", "normal");
10688 var operator = new mathMLTree.MathNode("mo", [makeText("⁡", "text")]);
10689 if (group.parentIsSupSub) {
10690 return new mathMLTree.MathNode("mrow", [identifier, operator]);
10691 } else {
10692 return mathMLTree.newDocumentFragment([identifier, operator]);
10693 }
10694};
10695defineFunction({
10696 type: "operatorname",
10697 names: ["\\operatorname@", "\\operatornamewithlimits"],
10698 props: {
10699 numArgs: 1
10700 },
10701 handler: (_ref, args) => {
10702 var {
10703 parser,
10704 funcName
10705 } = _ref;
10706 var body = args[0];
10707 return {
10708 type: "operatorname",
10709 mode: parser.mode,
10710 body: ordargument(body),
10711 alwaysHandleSupSub: funcName === "\\operatornamewithlimits",
10712 limits: false,
10713 parentIsSupSub: false
10714 };
10715 },
10716 htmlBuilder: htmlBuilder$1,
10717 mathmlBuilder: mathmlBuilder2
10718});
10719defineMacro("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@");
10720defineFunctionBuilders({
10721 type: "ordgroup",
10722 htmlBuilder(group, options) {
10723 if (group.semisimple) {
10724 return buildCommon.makeFragment(buildExpression$1(group.body, options, false));
10725 }
10726 return buildCommon.makeSpan(["mord"], buildExpression$1(group.body, options, true), options);
10727 },
10728 mathmlBuilder(group, options) {
10729 return buildExpressionRow(group.body, options, true);
10730 }
10731});
10732defineFunction({
10733 type: "overline",
10734 names: ["\\overline"],
10735 props: {
10736 numArgs: 1
10737 },
10738 handler(_ref, args) {
10739 var {
10740 parser
10741 } = _ref;
10742 var body = args[0];
10743 return {
10744 type: "overline",
10745 mode: parser.mode,
10746 body
10747 };
10748 },
10749 htmlBuilder(group, options) {
10750 var innerGroup = buildGroup$1(group.body, options.havingCrampedStyle());
10751 var line = buildCommon.makeLineSpan("overline-line", options);
10752 var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
10753 var vlist = buildCommon.makeVList({
10754 positionType: "firstBaseline",
10755 children: [{
10756 type: "elem",
10757 elem: innerGroup
10758 }, {
10759 type: "kern",
10760 size: 3 * defaultRuleThickness
10761 }, {
10762 type: "elem",
10763 elem: line
10764 }, {
10765 type: "kern",
10766 size: defaultRuleThickness
10767 }]
10768 }, options);
10769 return buildCommon.makeSpan(["mord", "overline"], [vlist], options);
10770 },
10771 mathmlBuilder(group, options) {
10772 var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("‾")]);
10773 operator.setAttribute("stretchy", "true");
10774 var node = new mathMLTree.MathNode("mover", [buildGroup2(group.body, options), operator]);
10775 node.setAttribute("accent", "true");
10776 return node;
10777 }
10778});
10779defineFunction({
10780 type: "phantom",
10781 names: ["\\phantom"],
10782 props: {
10783 numArgs: 1,
10784 allowedInText: true
10785 },
10786 handler: (_ref, args) => {
10787 var {
10788 parser
10789 } = _ref;
10790 var body = args[0];
10791 return {
10792 type: "phantom",
10793 mode: parser.mode,
10794 body: ordargument(body)
10795 };
10796 },
10797 htmlBuilder: (group, options) => {
10798 var elements = buildExpression$1(group.body, options.withPhantom(), false);
10799 return buildCommon.makeFragment(elements);
10800 },
10801 mathmlBuilder: (group, options) => {
10802 var inner2 = buildExpression2(group.body, options);
10803 return new mathMLTree.MathNode("mphantom", inner2);
10804 }
10805});
10806defineFunction({
10807 type: "hphantom",
10808 names: ["\\hphantom"],
10809 props: {
10810 numArgs: 1,
10811 allowedInText: true
10812 },
10813 handler: (_ref2, args) => {
10814 var {
10815 parser
10816 } = _ref2;
10817 var body = args[0];
10818 return {
10819 type: "hphantom",
10820 mode: parser.mode,
10821 body
10822 };
10823 },
10824 htmlBuilder: (group, options) => {
10825 var node = buildCommon.makeSpan([], [buildGroup$1(group.body, options.withPhantom())]);
10826 node.height = 0;
10827 node.depth = 0;
10828 if (node.children) {
10829 for (var i = 0; i < node.children.length; i++) {
10830 node.children[i].height = 0;
10831 node.children[i].depth = 0;
10832 }
10833 }
10834 node = buildCommon.makeVList({
10835 positionType: "firstBaseline",
10836 children: [{
10837 type: "elem",
10838 elem: node
10839 }]
10840 }, options);
10841 return buildCommon.makeSpan(["mord"], [node], options);
10842 },
10843 mathmlBuilder: (group, options) => {
10844 var inner2 = buildExpression2(ordargument(group.body), options);
10845 var phantom = new mathMLTree.MathNode("mphantom", inner2);
10846 var node = new mathMLTree.MathNode("mpadded", [phantom]);
10847 node.setAttribute("height", "0px");
10848 node.setAttribute("depth", "0px");
10849 return node;
10850 }
10851});
10852defineFunction({
10853 type: "vphantom",
10854 names: ["\\vphantom"],
10855 props: {
10856 numArgs: 1,
10857 allowedInText: true
10858 },
10859 handler: (_ref3, args) => {
10860 var {
10861 parser
10862 } = _ref3;
10863 var body = args[0];
10864 return {
10865 type: "vphantom",
10866 mode: parser.mode,
10867 body
10868 };
10869 },
10870 htmlBuilder: (group, options) => {
10871 var inner2 = buildCommon.makeSpan(["inner"], [buildGroup$1(group.body, options.withPhantom())]);
10872 var fix = buildCommon.makeSpan(["fix"], []);
10873 return buildCommon.makeSpan(["mord", "rlap"], [inner2, fix], options);
10874 },
10875 mathmlBuilder: (group, options) => {
10876 var inner2 = buildExpression2(ordargument(group.body), options);
10877 var phantom = new mathMLTree.MathNode("mphantom", inner2);
10878 var node = new mathMLTree.MathNode("mpadded", [phantom]);
10879 node.setAttribute("width", "0px");
10880 return node;
10881 }
10882});
10883defineFunction({
10884 type: "raisebox",
10885 names: ["\\raisebox"],
10886 props: {
10887 numArgs: 2,
10888 argTypes: ["size", "hbox"],
10889 allowedInText: true
10890 },
10891 handler(_ref, args) {
10892 var {
10893 parser
10894 } = _ref;
10895 var amount = assertNodeType(args[0], "size").value;
10896 var body = args[1];
10897 return {
10898 type: "raisebox",
10899 mode: parser.mode,
10900 dy: amount,
10901 body
10902 };
10903 },
10904 htmlBuilder(group, options) {
10905 var body = buildGroup$1(group.body, options);
10906 var dy = calculateSize(group.dy, options);
10907 return buildCommon.makeVList({
10908 positionType: "shift",
10909 positionData: -dy,
10910 children: [{
10911 type: "elem",
10912 elem: body
10913 }]
10914 }, options);
10915 },
10916 mathmlBuilder(group, options) {
10917 var node = new mathMLTree.MathNode("mpadded", [buildGroup2(group.body, options)]);
10918 var dy = group.dy.number + group.dy.unit;
10919 node.setAttribute("voffset", dy);
10920 return node;
10921 }
10922});
10923defineFunction({
10924 type: "internal",
10925 names: ["\\relax"],
10926 props: {
10927 numArgs: 0,
10928 allowedInText: true
10929 },
10930 handler(_ref) {
10931 var {
10932 parser
10933 } = _ref;
10934 return {
10935 type: "internal",
10936 mode: parser.mode
10937 };
10938 }
10939});
10940defineFunction({
10941 type: "rule",
10942 names: ["\\rule"],
10943 props: {
10944 numArgs: 2,
10945 numOptionalArgs: 1,
10946 argTypes: ["size", "size", "size"]
10947 },
10948 handler(_ref, args, optArgs) {
10949 var {
10950 parser
10951 } = _ref;
10952 var shift = optArgs[0];
10953 var width = assertNodeType(args[0], "size");
10954 var height = assertNodeType(args[1], "size");
10955 return {
10956 type: "rule",
10957 mode: parser.mode,
10958 shift: shift && assertNodeType(shift, "size").value,
10959 width: width.value,
10960 height: height.value
10961 };
10962 },
10963 htmlBuilder(group, options) {
10964 var rule = buildCommon.makeSpan(["mord", "rule"], [], options);
10965 var width = calculateSize(group.width, options);
10966 var height = calculateSize(group.height, options);
10967 var shift = group.shift ? calculateSize(group.shift, options) : 0;
10968 rule.style.borderRightWidth = makeEm(width);
10969 rule.style.borderTopWidth = makeEm(height);
10970 rule.style.bottom = makeEm(shift);
10971 rule.width = width;
10972 rule.height = height + shift;
10973 rule.depth = -shift;
10974 rule.maxFontSize = height * 1.125 * options.sizeMultiplier;
10975 return rule;
10976 },
10977 mathmlBuilder(group, options) {
10978 var width = calculateSize(group.width, options);
10979 var height = calculateSize(group.height, options);
10980 var shift = group.shift ? calculateSize(group.shift, options) : 0;
10981 var color = options.color && options.getColor() || "black";
10982 var rule = new mathMLTree.MathNode("mspace");
10983 rule.setAttribute("mathbackground", color);
10984 rule.setAttribute("width", makeEm(width));
10985 rule.setAttribute("height", makeEm(height));
10986 var wrapper = new mathMLTree.MathNode("mpadded", [rule]);
10987 if (shift >= 0) {
10988 wrapper.setAttribute("height", makeEm(shift));
10989 } else {
10990 wrapper.setAttribute("height", makeEm(shift));
10991 wrapper.setAttribute("depth", makeEm(-shift));
10992 }
10993 wrapper.setAttribute("voffset", makeEm(shift));
10994 return wrapper;
10995 }
10996});
10997function sizingGroup(value, options, baseOptions) {
10998 var inner2 = buildExpression$1(value, options, false);
10999 var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
11000 for (var i = 0; i < inner2.length; i++) {
11001 var pos = inner2[i].classes.indexOf("sizing");
11002 if (pos < 0) {
11003 Array.prototype.push.apply(inner2[i].classes, options.sizingClasses(baseOptions));
11004 } else if (inner2[i].classes[pos + 1] === "reset-size" + options.size) {
11005 inner2[i].classes[pos + 1] = "reset-size" + baseOptions.size;
11006 }
11007 inner2[i].height *= multiplier;
11008 inner2[i].depth *= multiplier;
11009 }
11010 return buildCommon.makeFragment(inner2);
11011}
11012var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"];
11013var htmlBuilder2 = (group, options) => {
11014 var newOptions = options.havingSize(group.size);
11015 return sizingGroup(group.body, newOptions, options);
11016};
11017defineFunction({
11018 type: "sizing",
11019 names: sizeFuncs,
11020 props: {
11021 numArgs: 0,
11022 allowedInText: true
11023 },
11024 handler: (_ref, args) => {
11025 var {
11026 breakOnTokenText,
11027 funcName,
11028 parser
11029 } = _ref;
11030 var body = parser.parseExpression(false, breakOnTokenText);
11031 return {
11032 type: "sizing",
11033 mode: parser.mode,
11034 // Figure out what size to use based on the list of functions above
11035 size: sizeFuncs.indexOf(funcName) + 1,
11036 body
11037 };
11038 },
11039 htmlBuilder: htmlBuilder2,
11040 mathmlBuilder: (group, options) => {
11041 var newOptions = options.havingSize(group.size);
11042 var inner2 = buildExpression2(group.body, newOptions);
11043 var node = new mathMLTree.MathNode("mstyle", inner2);
11044 node.setAttribute("mathsize", makeEm(newOptions.sizeMultiplier));
11045 return node;
11046 }
11047});
11048defineFunction({
11049 type: "smash",
11050 names: ["\\smash"],
11051 props: {
11052 numArgs: 1,
11053 numOptionalArgs: 1,
11054 allowedInText: true
11055 },
11056 handler: (_ref, args, optArgs) => {
11057 var {
11058 parser
11059 } = _ref;
11060 var smashHeight = false;
11061 var smashDepth = false;
11062 var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
11063 if (tbArg) {
11064 var letter = "";
11065 for (var i = 0; i < tbArg.body.length; ++i) {
11066 var node = tbArg.body[i];
11067 letter = node.text;
11068 if (letter === "t") {
11069 smashHeight = true;
11070 } else if (letter === "b") {
11071 smashDepth = true;
11072 } else {
11073 smashHeight = false;
11074 smashDepth = false;
11075 break;
11076 }
11077 }
11078 } else {
11079 smashHeight = true;
11080 smashDepth = true;
11081 }
11082 var body = args[0];
11083 return {
11084 type: "smash",
11085 mode: parser.mode,
11086 body,
11087 smashHeight,
11088 smashDepth
11089 };
11090 },
11091 htmlBuilder: (group, options) => {
11092 var node = buildCommon.makeSpan([], [buildGroup$1(group.body, options)]);
11093 if (!group.smashHeight && !group.smashDepth) {
11094 return node;
11095 }
11096 if (group.smashHeight) {
11097 node.height = 0;
11098 if (node.children) {
11099 for (var i = 0; i < node.children.length; i++) {
11100 node.children[i].height = 0;
11101 }
11102 }
11103 }
11104 if (group.smashDepth) {
11105 node.depth = 0;
11106 if (node.children) {
11107 for (var _i = 0; _i < node.children.length; _i++) {
11108 node.children[_i].depth = 0;
11109 }
11110 }
11111 }
11112 var smashedNode = buildCommon.makeVList({
11113 positionType: "firstBaseline",
11114 children: [{
11115 type: "elem",
11116 elem: node
11117 }]
11118 }, options);
11119 return buildCommon.makeSpan(["mord"], [smashedNode], options);
11120 },
11121 mathmlBuilder: (group, options) => {
11122 var node = new mathMLTree.MathNode("mpadded", [buildGroup2(group.body, options)]);
11123 if (group.smashHeight) {
11124 node.setAttribute("height", "0px");
11125 }
11126 if (group.smashDepth) {
11127 node.setAttribute("depth", "0px");
11128 }
11129 return node;
11130 }
11131});
11132defineFunction({
11133 type: "sqrt",
11134 names: ["\\sqrt"],
11135 props: {
11136 numArgs: 1,
11137 numOptionalArgs: 1
11138 },
11139 handler(_ref, args, optArgs) {
11140 var {
11141 parser
11142 } = _ref;
11143 var index = optArgs[0];
11144 var body = args[0];
11145 return {
11146 type: "sqrt",
11147 mode: parser.mode,
11148 body,
11149 index
11150 };
11151 },
11152 htmlBuilder(group, options) {
11153 var inner2 = buildGroup$1(group.body, options.havingCrampedStyle());
11154 if (inner2.height === 0) {
11155 inner2.height = options.fontMetrics().xHeight;
11156 }
11157 inner2 = buildCommon.wrapFragment(inner2, options);
11158 var metrics = options.fontMetrics();
11159 var theta = metrics.defaultRuleThickness;
11160 var phi = theta;
11161 if (options.style.id < Style$1.TEXT.id) {
11162 phi = options.fontMetrics().xHeight;
11163 }
11164 var lineClearance = theta + phi / 4;
11165 var minDelimiterHeight = inner2.height + inner2.depth + lineClearance + theta;
11166 var {
11167 span: img,
11168 ruleWidth,
11169 advanceWidth
11170 } = delimiter.sqrtImage(minDelimiterHeight, options);
11171 var delimDepth = img.height - ruleWidth;
11172 if (delimDepth > inner2.height + inner2.depth + lineClearance) {
11173 lineClearance = (lineClearance + delimDepth - inner2.height - inner2.depth) / 2;
11174 }
11175 var imgShift = img.height - inner2.height - lineClearance - ruleWidth;
11176 inner2.style.paddingLeft = makeEm(advanceWidth);
11177 var body = buildCommon.makeVList({
11178 positionType: "firstBaseline",
11179 children: [{
11180 type: "elem",
11181 elem: inner2,
11182 wrapperClasses: ["svg-align"]
11183 }, {
11184 type: "kern",
11185 size: -(inner2.height + imgShift)
11186 }, {
11187 type: "elem",
11188 elem: img
11189 }, {
11190 type: "kern",
11191 size: ruleWidth
11192 }]
11193 }, options);
11194 if (!group.index) {
11195 return buildCommon.makeSpan(["mord", "sqrt"], [body], options);
11196 } else {
11197 var newOptions = options.havingStyle(Style$1.SCRIPTSCRIPT);
11198 var rootm = buildGroup$1(group.index, newOptions, options);
11199 var toShift = 0.6 * (body.height - body.depth);
11200 var rootVList = buildCommon.makeVList({
11201 positionType: "shift",
11202 positionData: -toShift,
11203 children: [{
11204 type: "elem",
11205 elem: rootm
11206 }]
11207 }, options);
11208 var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]);
11209 return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options);
11210 }
11211 },
11212 mathmlBuilder(group, options) {
11213 var {
11214 body,
11215 index
11216 } = group;
11217 return index ? new mathMLTree.MathNode("mroot", [buildGroup2(body, options), buildGroup2(index, options)]) : new mathMLTree.MathNode("msqrt", [buildGroup2(body, options)]);
11218 }
11219});
11220var styleMap = {
11221 "display": Style$1.DISPLAY,
11222 "text": Style$1.TEXT,
11223 "script": Style$1.SCRIPT,
11224 "scriptscript": Style$1.SCRIPTSCRIPT
11225};
11226defineFunction({
11227 type: "styling",
11228 names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
11229 props: {
11230 numArgs: 0,
11231 allowedInText: true,
11232 primitive: true
11233 },
11234 handler(_ref, args) {
11235 var {
11236 breakOnTokenText,
11237 funcName,
11238 parser
11239 } = _ref;
11240 var body = parser.parseExpression(true, breakOnTokenText);
11241 var style = funcName.slice(1, funcName.length - 5);
11242 return {
11243 type: "styling",
11244 mode: parser.mode,
11245 // Figure out what style to use by pulling out the style from
11246 // the function name
11247 style,
11248 body
11249 };
11250 },
11251 htmlBuilder(group, options) {
11252 var newStyle = styleMap[group.style];
11253 var newOptions = options.havingStyle(newStyle).withFont("");
11254 return sizingGroup(group.body, newOptions, options);
11255 },
11256 mathmlBuilder(group, options) {
11257 var newStyle = styleMap[group.style];
11258 var newOptions = options.havingStyle(newStyle);
11259 var inner2 = buildExpression2(group.body, newOptions);
11260 var node = new mathMLTree.MathNode("mstyle", inner2);
11261 var styleAttributes = {
11262 "display": ["0", "true"],
11263 "text": ["0", "false"],
11264 "script": ["1", "false"],
11265 "scriptscript": ["2", "false"]
11266 };
11267 var attr = styleAttributes[group.style];
11268 node.setAttribute("scriptlevel", attr[0]);
11269 node.setAttribute("displaystyle", attr[1]);
11270 return node;
11271 }
11272});
11273var htmlBuilderDelegate = function htmlBuilderDelegate2(group, options) {
11274 var base = group.base;
11275 if (!base) {
11276 return null;
11277 } else if (base.type === "op") {
11278 var delegate = base.limits && (options.style.size === Style$1.DISPLAY.size || base.alwaysHandleSupSub);
11279 return delegate ? htmlBuilder$2 : null;
11280 } else if (base.type === "operatorname") {
11281 var _delegate = base.alwaysHandleSupSub && (options.style.size === Style$1.DISPLAY.size || base.limits);
11282 return _delegate ? htmlBuilder$1 : null;
11283 } else if (base.type === "accent") {
11284 return utils.isCharacterBox(base.base) ? htmlBuilder$a : null;
11285 } else if (base.type === "horizBrace") {
11286 var isSup = !group.sub;
11287 return isSup === base.isOver ? htmlBuilder$3 : null;
11288 } else {
11289 return null;
11290 }
11291};
11292defineFunctionBuilders({
11293 type: "supsub",
11294 htmlBuilder(group, options) {
11295 var builderDelegate = htmlBuilderDelegate(group, options);
11296 if (builderDelegate) {
11297 return builderDelegate(group, options);
11298 }
11299 var {
11300 base: valueBase,
11301 sup: valueSup,
11302 sub: valueSub
11303 } = group;
11304 var base = buildGroup$1(valueBase, options);
11305 var supm;
11306 var subm;
11307 var metrics = options.fontMetrics();
11308 var supShift = 0;
11309 var subShift = 0;
11310 var isCharacterBox3 = valueBase && utils.isCharacterBox(valueBase);
11311 if (valueSup) {
11312 var newOptions = options.havingStyle(options.style.sup());
11313 supm = buildGroup$1(valueSup, newOptions, options);
11314 if (!isCharacterBox3) {
11315 supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier;
11316 }
11317 }
11318 if (valueSub) {
11319 var _newOptions = options.havingStyle(options.style.sub());
11320 subm = buildGroup$1(valueSub, _newOptions, options);
11321 if (!isCharacterBox3) {
11322 subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier;
11323 }
11324 }
11325 var minSupShift;
11326 if (options.style === Style$1.DISPLAY) {
11327 minSupShift = metrics.sup1;
11328 } else if (options.style.cramped) {
11329 minSupShift = metrics.sup3;
11330 } else {
11331 minSupShift = metrics.sup2;
11332 }
11333 var multiplier = options.sizeMultiplier;
11334 var marginRight = makeEm(0.5 / metrics.ptPerEm / multiplier);
11335 var marginLeft = null;
11336 if (subm) {
11337 var isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint");
11338 if (base instanceof SymbolNode || isOiint) {
11339 marginLeft = makeEm(-base.italic);
11340 }
11341 }
11342 var supsub;
11343 if (supm && subm) {
11344 supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
11345 subShift = Math.max(subShift, metrics.sub2);
11346 var ruleWidth = metrics.defaultRuleThickness;
11347 var maxWidth = 4 * ruleWidth;
11348 if (supShift - supm.depth - (subm.height - subShift) < maxWidth) {
11349 subShift = maxWidth - (supShift - supm.depth) + subm.height;
11350 var psi = 0.8 * metrics.xHeight - (supShift - supm.depth);
11351 if (psi > 0) {
11352 supShift += psi;
11353 subShift -= psi;
11354 }
11355 }
11356 var vlistElem = [{
11357 type: "elem",
11358 elem: subm,
11359 shift: subShift,
11360 marginRight,
11361 marginLeft
11362 }, {
11363 type: "elem",
11364 elem: supm,
11365 shift: -supShift,
11366 marginRight
11367 }];
11368 supsub = buildCommon.makeVList({
11369 positionType: "individualShift",
11370 children: vlistElem
11371 }, options);
11372 } else if (subm) {
11373 subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight);
11374 var _vlistElem = [{
11375 type: "elem",
11376 elem: subm,
11377 marginLeft,
11378 marginRight
11379 }];
11380 supsub = buildCommon.makeVList({
11381 positionType: "shift",
11382 positionData: subShift,
11383 children: _vlistElem
11384 }, options);
11385 } else if (supm) {
11386 supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
11387 supsub = buildCommon.makeVList({
11388 positionType: "shift",
11389 positionData: -supShift,
11390 children: [{
11391 type: "elem",
11392 elem: supm,
11393 marginRight
11394 }]
11395 }, options);
11396 } else {
11397 throw new Error("supsub must have either sup or sub.");
11398 }
11399 var mclass = getTypeOfDomTree(base, "right") || "mord";
11400 return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options);
11401 },
11402 mathmlBuilder(group, options) {
11403 var isBrace = false;
11404 var isOver;
11405 var isSup;
11406 if (group.base && group.base.type === "horizBrace") {
11407 isSup = !!group.sup;
11408 if (isSup === group.base.isOver) {
11409 isBrace = true;
11410 isOver = group.base.isOver;
11411 }
11412 }
11413 if (group.base && (group.base.type === "op" || group.base.type === "operatorname")) {
11414 group.base.parentIsSupSub = true;
11415 }
11416 var children = [buildGroup2(group.base, options)];
11417 if (group.sub) {
11418 children.push(buildGroup2(group.sub, options));
11419 }
11420 if (group.sup) {
11421 children.push(buildGroup2(group.sup, options));
11422 }
11423 var nodeType;
11424 if (isBrace) {
11425 nodeType = isOver ? "mover" : "munder";
11426 } else if (!group.sub) {
11427 var base = group.base;
11428 if (base && base.type === "op" && base.limits && (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) {
11429 nodeType = "mover";
11430 } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options.style === Style$1.DISPLAY)) {
11431 nodeType = "mover";
11432 } else {
11433 nodeType = "msup";
11434 }
11435 } else if (!group.sup) {
11436 var _base = group.base;
11437 if (_base && _base.type === "op" && _base.limits && (options.style === Style$1.DISPLAY || _base.alwaysHandleSupSub)) {
11438 nodeType = "munder";
11439 } else if (_base && _base.type === "operatorname" && _base.alwaysHandleSupSub && (_base.limits || options.style === Style$1.DISPLAY)) {
11440 nodeType = "munder";
11441 } else {
11442 nodeType = "msub";
11443 }
11444 } else {
11445 var _base2 = group.base;
11446 if (_base2 && _base2.type === "op" && _base2.limits && options.style === Style$1.DISPLAY) {
11447 nodeType = "munderover";
11448 } else if (_base2 && _base2.type === "operatorname" && _base2.alwaysHandleSupSub && (options.style === Style$1.DISPLAY || _base2.limits)) {
11449 nodeType = "munderover";
11450 } else {
11451 nodeType = "msubsup";
11452 }
11453 }
11454 return new mathMLTree.MathNode(nodeType, children);
11455 }
11456});
11457defineFunctionBuilders({
11458 type: "atom",
11459 htmlBuilder(group, options) {
11460 return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]);
11461 },
11462 mathmlBuilder(group, options) {
11463 var node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]);
11464 if (group.family === "bin") {
11465 var variant = getVariant(group, options);
11466 if (variant === "bold-italic") {
11467 node.setAttribute("mathvariant", variant);
11468 }
11469 } else if (group.family === "punct") {
11470 node.setAttribute("separator", "true");
11471 } else if (group.family === "open" || group.family === "close") {
11472 node.setAttribute("stretchy", "false");
11473 }
11474 return node;
11475 }
11476});
11477var defaultVariant = {
11478 "mi": "italic",
11479 "mn": "normal",
11480 "mtext": "normal"
11481};
11482defineFunctionBuilders({
11483 type: "mathord",
11484 htmlBuilder(group, options) {
11485 return buildCommon.makeOrd(group, options, "mathord");
11486 },
11487 mathmlBuilder(group, options) {
11488 var node = new mathMLTree.MathNode("mi", [makeText(group.text, group.mode, options)]);
11489 var variant = getVariant(group, options) || "italic";
11490 if (variant !== defaultVariant[node.type]) {
11491 node.setAttribute("mathvariant", variant);
11492 }
11493 return node;
11494 }
11495});
11496defineFunctionBuilders({
11497 type: "textord",
11498 htmlBuilder(group, options) {
11499 return buildCommon.makeOrd(group, options, "textord");
11500 },
11501 mathmlBuilder(group, options) {
11502 var text2 = makeText(group.text, group.mode, options);
11503 var variant = getVariant(group, options) || "normal";
11504 var node;
11505 if (group.mode === "text") {
11506 node = new mathMLTree.MathNode("mtext", [text2]);
11507 } else if (/[0-9]/.test(group.text)) {
11508 node = new mathMLTree.MathNode("mn", [text2]);
11509 } else if (group.text === "\\prime") {
11510 node = new mathMLTree.MathNode("mo", [text2]);
11511 } else {
11512 node = new mathMLTree.MathNode("mi", [text2]);
11513 }
11514 if (variant !== defaultVariant[node.type]) {
11515 node.setAttribute("mathvariant", variant);
11516 }
11517 return node;
11518 }
11519});
11520var cssSpace = {
11521 "\\nobreak": "nobreak",
11522 "\\allowbreak": "allowbreak"
11523};
11524var regularSpace = {
11525 " ": {},
11526 "\\ ": {},
11527 "~": {
11528 className: "nobreak"
11529 },
11530 "\\space": {},
11531 "\\nobreakspace": {
11532 className: "nobreak"
11533 }
11534};
11535defineFunctionBuilders({
11536 type: "spacing",
11537 htmlBuilder(group, options) {
11538 if (regularSpace.hasOwnProperty(group.text)) {
11539 var className = regularSpace[group.text].className || "";
11540 if (group.mode === "text") {
11541 var ord = buildCommon.makeOrd(group, options, "textord");
11542 ord.classes.push(className);
11543 return ord;
11544 } else {
11545 return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group.text, group.mode, options)], options);
11546 }
11547 } else if (cssSpace.hasOwnProperty(group.text)) {
11548 return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options);
11549 } else {
11550 throw new ParseError('Unknown type of space "' + group.text + '"');
11551 }
11552 },
11553 mathmlBuilder(group, options) {
11554 var node;
11555 if (regularSpace.hasOwnProperty(group.text)) {
11556 node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode(" ")]);
11557 } else if (cssSpace.hasOwnProperty(group.text)) {
11558 return new mathMLTree.MathNode("mspace");
11559 } else {
11560 throw new ParseError('Unknown type of space "' + group.text + '"');
11561 }
11562 return node;
11563 }
11564});
11565var pad = () => {
11566 var padNode = new mathMLTree.MathNode("mtd", []);
11567 padNode.setAttribute("width", "50%");
11568 return padNode;
11569};
11570defineFunctionBuilders({
11571 type: "tag",
11572 mathmlBuilder(group, options) {
11573 var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]);
11574 table.setAttribute("width", "100%");
11575 return table;
11576 }
11577});
11578var textFontFamilies = {
11579 "\\text": void 0,
11580 "\\textrm": "textrm",
11581 "\\textsf": "textsf",
11582 "\\texttt": "texttt",
11583 "\\textnormal": "textrm"
11584};
11585var textFontWeights = {
11586 "\\textbf": "textbf",
11587 "\\textmd": "textmd"
11588};
11589var textFontShapes = {
11590 "\\textit": "textit",
11591 "\\textup": "textup"
11592};
11593var optionsWithFont = (group, options) => {
11594 var font = group.font;
11595 if (!font) {
11596 return options;
11597 } else if (textFontFamilies[font]) {
11598 return options.withTextFontFamily(textFontFamilies[font]);
11599 } else if (textFontWeights[font]) {
11600 return options.withTextFontWeight(textFontWeights[font]);
11601 } else {
11602 return options.withTextFontShape(textFontShapes[font]);
11603 }
11604};
11605defineFunction({
11606 type: "text",
11607 names: [
11608 // Font families
11609 "\\text",
11610 "\\textrm",
11611 "\\textsf",
11612 "\\texttt",
11613 "\\textnormal",
11614 // Font weights
11615 "\\textbf",
11616 "\\textmd",
11617 // Font Shapes
11618 "\\textit",
11619 "\\textup"
11620 ],
11621 props: {
11622 numArgs: 1,
11623 argTypes: ["text"],
11624 allowedInArgument: true,
11625 allowedInText: true
11626 },
11627 handler(_ref, args) {
11628 var {
11629 parser,
11630 funcName
11631 } = _ref;
11632 var body = args[0];
11633 return {
11634 type: "text",
11635 mode: parser.mode,
11636 body: ordargument(body),
11637 font: funcName
11638 };
11639 },
11640 htmlBuilder(group, options) {
11641 var newOptions = optionsWithFont(group, options);
11642 var inner2 = buildExpression$1(group.body, newOptions, true);
11643 return buildCommon.makeSpan(["mord", "text"], inner2, newOptions);
11644 },
11645 mathmlBuilder(group, options) {
11646 var newOptions = optionsWithFont(group, options);
11647 return buildExpressionRow(group.body, newOptions);
11648 }
11649});
11650defineFunction({
11651 type: "underline",
11652 names: ["\\underline"],
11653 props: {
11654 numArgs: 1,
11655 allowedInText: true
11656 },
11657 handler(_ref, args) {
11658 var {
11659 parser
11660 } = _ref;
11661 return {
11662 type: "underline",
11663 mode: parser.mode,
11664 body: args[0]
11665 };
11666 },
11667 htmlBuilder(group, options) {
11668 var innerGroup = buildGroup$1(group.body, options);
11669 var line = buildCommon.makeLineSpan("underline-line", options);
11670 var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
11671 var vlist = buildCommon.makeVList({
11672 positionType: "top",
11673 positionData: innerGroup.height,
11674 children: [{
11675 type: "kern",
11676 size: defaultRuleThickness
11677 }, {
11678 type: "elem",
11679 elem: line
11680 }, {
11681 type: "kern",
11682 size: 3 * defaultRuleThickness
11683 }, {
11684 type: "elem",
11685 elem: innerGroup
11686 }]
11687 }, options);
11688 return buildCommon.makeSpan(["mord", "underline"], [vlist], options);
11689 },
11690 mathmlBuilder(group, options) {
11691 var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("‾")]);
11692 operator.setAttribute("stretchy", "true");
11693 var node = new mathMLTree.MathNode("munder", [buildGroup2(group.body, options), operator]);
11694 node.setAttribute("accentunder", "true");
11695 return node;
11696 }
11697});
11698defineFunction({
11699 type: "vcenter",
11700 names: ["\\vcenter"],
11701 props: {
11702 numArgs: 1,
11703 argTypes: ["original"],
11704 // In LaTeX, \vcenter can act only on a box.
11705 allowedInText: false
11706 },
11707 handler(_ref, args) {
11708 var {
11709 parser
11710 } = _ref;
11711 return {
11712 type: "vcenter",
11713 mode: parser.mode,
11714 body: args[0]
11715 };
11716 },
11717 htmlBuilder(group, options) {
11718 var body = buildGroup$1(group.body, options);
11719 var axisHeight = options.fontMetrics().axisHeight;
11720 var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight));
11721 return buildCommon.makeVList({
11722 positionType: "shift",
11723 positionData: dy,
11724 children: [{
11725 type: "elem",
11726 elem: body
11727 }]
11728 }, options);
11729 },
11730 mathmlBuilder(group, options) {
11731 return new mathMLTree.MathNode("mpadded", [buildGroup2(group.body, options)], ["vcenter"]);
11732 }
11733});
11734defineFunction({
11735 type: "verb",
11736 names: ["\\verb"],
11737 props: {
11738 numArgs: 0,
11739 allowedInText: true
11740 },
11741 handler(context, args, optArgs) {
11742 throw new ParseError("\\verb ended by end of line instead of matching delimiter");
11743 },
11744 htmlBuilder(group, options) {
11745 var text2 = makeVerb(group);
11746 var body = [];
11747 var newOptions = options.havingStyle(options.style.text());
11748 for (var i = 0; i < text2.length; i++) {
11749 var c = text2[i];
11750 if (c === "~") {
11751 c = "\\textasciitilde";
11752 }
11753 body.push(buildCommon.makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"]));
11754 }
11755 return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions);
11756 },
11757 mathmlBuilder(group, options) {
11758 var text2 = new mathMLTree.TextNode(makeVerb(group));
11759 var node = new mathMLTree.MathNode("mtext", [text2]);
11760 node.setAttribute("mathvariant", "monospace");
11761 return node;
11762 }
11763});
11764var makeVerb = (group) => group.body.replace(/ /g, group.star ? "␣" : " ");
11765var functions = _functions;
11766var spaceRegexString = "[ \r\n ]";
11767var controlWordRegexString = "\\\\[a-zA-Z@]+";
11768var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]";
11769var controlWordWhitespaceRegexString = "(" + controlWordRegexString + ")" + spaceRegexString + "*";
11770var controlSpaceRegexString = "\\\\(\n|[ \r ]+\n?)[ \r ]*";
11771var combiningDiacriticalMarkString = "[̀-ͯ]";
11772var combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$");
11773var tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace
11774(controlSpaceRegexString + "|") + // \whitespace
11775"([!-\\[\\]-‧‪-퟿豈-￿]" + // single codepoint
11776(combiningDiacriticalMarkString + "*") + // ...plus accents
11777"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair
11778(combiningDiacriticalMarkString + "*") + // ...plus accents
11779"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5" + // \verb unstarred
11780("|" + controlWordWhitespaceRegexString) + // \macroName + spaces
11781("|" + controlSymbolRegexString + ")");
11782class Lexer {
11783 // Category codes. The lexer only supports comment characters (14) for now.
11784 // MacroExpander additionally distinguishes active (13).
11785 constructor(input, settings) {
11786 this.input = void 0;
11787 this.settings = void 0;
11788 this.tokenRegex = void 0;
11789 this.catcodes = void 0;
11790 this.input = input;
11791 this.settings = settings;
11792 this.tokenRegex = new RegExp(tokenRegexString, "g");
11793 this.catcodes = {
11794 "%": 14,
11795 // comment character
11796 "~": 13
11797 // active character
11798 };
11799 }
11800 setCatcode(char, code) {
11801 this.catcodes[char] = code;
11802 }
11803 /**
11804 * This function lexes a single token.
11805 */
11806 lex() {
11807 var input = this.input;
11808 var pos = this.tokenRegex.lastIndex;
11809 if (pos === input.length) {
11810 return new Token("EOF", new SourceLocation(this, pos, pos));
11811 }
11812 var match = this.tokenRegex.exec(input);
11813 if (match === null || match.index !== pos) {
11814 throw new ParseError("Unexpected character: '" + input[pos] + "'", new Token(input[pos], new SourceLocation(this, pos, pos + 1)));
11815 }
11816 var text2 = match[6] || match[3] || (match[2] ? "\\ " : " ");
11817 if (this.catcodes[text2] === 14) {
11818 var nlIndex = input.indexOf("\n", this.tokenRegex.lastIndex);
11819 if (nlIndex === -1) {
11820 this.tokenRegex.lastIndex = input.length;
11821 this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)");
11822 } else {
11823 this.tokenRegex.lastIndex = nlIndex + 1;
11824 }
11825 return this.lex();
11826 }
11827 return new Token(text2, new SourceLocation(this, pos, this.tokenRegex.lastIndex));
11828 }
11829}
11830class Namespace {
11831 /**
11832 * Both arguments are optional. The first argument is an object of
11833 * built-in mappings which never change. The second argument is an object
11834 * of initial (global-level) mappings, which will constantly change
11835 * according to any global/top-level `set`s done.
11836 */
11837 constructor(builtins, globalMacros) {
11838 if (builtins === void 0) {
11839 builtins = {};
11840 }
11841 if (globalMacros === void 0) {
11842 globalMacros = {};
11843 }
11844 this.current = void 0;
11845 this.builtins = void 0;
11846 this.undefStack = void 0;
11847 this.current = globalMacros;
11848 this.builtins = builtins;
11849 this.undefStack = [];
11850 }
11851 /**
11852 * Start a new nested group, affecting future local `set`s.
11853 */
11854 beginGroup() {
11855 this.undefStack.push({});
11856 }
11857 /**
11858 * End current nested group, restoring values before the group began.
11859 */
11860 endGroup() {
11861 if (this.undefStack.length === 0) {
11862 throw new ParseError("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");
11863 }
11864 var undefs = this.undefStack.pop();
11865 for (var undef in undefs) {
11866 if (undefs.hasOwnProperty(undef)) {
11867 if (undefs[undef] == null) {
11868 delete this.current[undef];
11869 } else {
11870 this.current[undef] = undefs[undef];
11871 }
11872 }
11873 }
11874 }
11875 /**
11876 * Ends all currently nested groups (if any), restoring values before the
11877 * groups began. Useful in case of an error in the middle of parsing.
11878 */
11879 endGroups() {
11880 while (this.undefStack.length > 0) {
11881 this.endGroup();
11882 }
11883 }
11884 /**
11885 * Detect whether `name` has a definition. Equivalent to
11886 * `get(name) != null`.
11887 */
11888 has(name) {
11889 return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name);
11890 }
11891 /**
11892 * Get the current value of a name, or `undefined` if there is no value.
11893 *
11894 * Note: Do not use `if (namespace.get(...))` to detect whether a macro
11895 * is defined, as the definition may be the empty string which evaluates
11896 * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or
11897 * `if (namespace.has(...))`.
11898 */
11899 get(name) {
11900 if (this.current.hasOwnProperty(name)) {
11901 return this.current[name];
11902 } else {
11903 return this.builtins[name];
11904 }
11905 }
11906 /**
11907 * Set the current value of a name, and optionally set it globally too.
11908 * Local set() sets the current value and (when appropriate) adds an undo
11909 * operation to the undo stack. Global set() may change the undo
11910 * operation at every level, so takes time linear in their number.
11911 * A value of undefined means to delete existing definitions.
11912 */
11913 set(name, value, global) {
11914 if (global === void 0) {
11915 global = false;
11916 }
11917 if (global) {
11918 for (var i = 0; i < this.undefStack.length; i++) {
11919 delete this.undefStack[i][name];
11920 }
11921 if (this.undefStack.length > 0) {
11922 this.undefStack[this.undefStack.length - 1][name] = value;
11923 }
11924 } else {
11925 var top = this.undefStack[this.undefStack.length - 1];
11926 if (top && !top.hasOwnProperty(name)) {
11927 top[name] = this.current[name];
11928 }
11929 }
11930 if (value == null) {
11931 delete this.current[name];
11932 } else {
11933 this.current[name] = value;
11934 }
11935 }
11936}
11937var macros = _macros;
11938defineMacro("\\noexpand", function(context) {
11939 var t = context.popToken();
11940 if (context.isExpandable(t.text)) {
11941 t.noexpand = true;
11942 t.treatAsRelax = true;
11943 }
11944 return {
11945 tokens: [t],
11946 numArgs: 0
11947 };
11948});
11949defineMacro("\\expandafter", function(context) {
11950 var t = context.popToken();
11951 context.expandOnce(true);
11952 return {
11953 tokens: [t],
11954 numArgs: 0
11955 };
11956});
11957defineMacro("\\@firstoftwo", function(context) {
11958 var args = context.consumeArgs(2);
11959 return {
11960 tokens: args[0],
11961 numArgs: 0
11962 };
11963});
11964defineMacro("\\@secondoftwo", function(context) {
11965 var args = context.consumeArgs(2);
11966 return {
11967 tokens: args[1],
11968 numArgs: 0
11969 };
11970});
11971defineMacro("\\@ifnextchar", function(context) {
11972 var args = context.consumeArgs(3);
11973 context.consumeSpaces();
11974 var nextToken = context.future();
11975 if (args[0].length === 1 && args[0][0].text === nextToken.text) {
11976 return {
11977 tokens: args[1],
11978 numArgs: 0
11979 };
11980 } else {
11981 return {
11982 tokens: args[2],
11983 numArgs: 0
11984 };
11985 }
11986});
11987defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}");
11988defineMacro("\\TextOrMath", function(context) {
11989 var args = context.consumeArgs(2);
11990 if (context.mode === "text") {
11991 return {
11992 tokens: args[0],
11993 numArgs: 0
11994 };
11995 } else {
11996 return {
11997 tokens: args[1],
11998 numArgs: 0
11999 };
12000 }
12001});
12002var digitToNumber = {
12003 "0": 0,
12004 "1": 1,
12005 "2": 2,
12006 "3": 3,
12007 "4": 4,
12008 "5": 5,
12009 "6": 6,
12010 "7": 7,
12011 "8": 8,
12012 "9": 9,
12013 "a": 10,
12014 "A": 10,
12015 "b": 11,
12016 "B": 11,
12017 "c": 12,
12018 "C": 12,
12019 "d": 13,
12020 "D": 13,
12021 "e": 14,
12022 "E": 14,
12023 "f": 15,
12024 "F": 15
12025};
12026defineMacro("\\char", function(context) {
12027 var token = context.popToken();
12028 var base;
12029 var number = "";
12030 if (token.text === "'") {
12031 base = 8;
12032 token = context.popToken();
12033 } else if (token.text === '"') {
12034 base = 16;
12035 token = context.popToken();
12036 } else if (token.text === "`") {
12037 token = context.popToken();
12038 if (token.text[0] === "\\") {
12039 number = token.text.charCodeAt(1);
12040 } else if (token.text === "EOF") {
12041 throw new ParseError("\\char` missing argument");
12042 } else {
12043 number = token.text.charCodeAt(0);
12044 }
12045 } else {
12046 base = 10;
12047 }
12048 if (base) {
12049 number = digitToNumber[token.text];
12050 if (number == null || number >= base) {
12051 throw new ParseError("Invalid base-" + base + " digit " + token.text);
12052 }
12053 var digit;
12054 while ((digit = digitToNumber[context.future().text]) != null && digit < base) {
12055 number *= base;
12056 number += digit;
12057 context.popToken();
12058 }
12059 }
12060 return "\\@char{" + number + "}";
12061});
12062var newcommand = (context, existsOK, nonexistsOK) => {
12063 var arg = context.consumeArg().tokens;
12064 if (arg.length !== 1) {
12065 throw new ParseError("\\newcommand's first argument must be a macro name");
12066 }
12067 var name = arg[0].text;
12068 var exists = context.isDefined(name);
12069 if (exists && !existsOK) {
12070 throw new ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand"));
12071 }
12072 if (!exists && !nonexistsOK) {
12073 throw new ParseError("\\renewcommand{" + name + "} when command " + name + " does not yet exist; use \\newcommand");
12074 }
12075 var numArgs = 0;
12076 arg = context.consumeArg().tokens;
12077 if (arg.length === 1 && arg[0].text === "[") {
12078 var argText = "";
12079 var token = context.expandNextToken();
12080 while (token.text !== "]" && token.text !== "EOF") {
12081 argText += token.text;
12082 token = context.expandNextToken();
12083 }
12084 if (!argText.match(/^\s*[0-9]+\s*$/)) {
12085 throw new ParseError("Invalid number of arguments: " + argText);
12086 }
12087 numArgs = parseInt(argText);
12088 arg = context.consumeArg().tokens;
12089 }
12090 context.macros.set(name, {
12091 tokens: arg,
12092 numArgs
12093 });
12094 return "";
12095};
12096defineMacro("\\newcommand", (context) => newcommand(context, false, true));
12097defineMacro("\\renewcommand", (context) => newcommand(context, true, false));
12098defineMacro("\\providecommand", (context) => newcommand(context, true, true));
12099defineMacro("\\message", (context) => {
12100 var arg = context.consumeArgs(1)[0];
12101 console.log(arg.reverse().map((token) => token.text).join(""));
12102 return "";
12103});
12104defineMacro("\\errmessage", (context) => {
12105 var arg = context.consumeArgs(1)[0];
12106 console.error(arg.reverse().map((token) => token.text).join(""));
12107 return "";
12108});
12109defineMacro("\\show", (context) => {
12110 var tok = context.popToken();
12111 var name = tok.text;
12112 console.log(tok, context.macros.get(name), functions[name], symbols.math[name], symbols.text[name]);
12113 return "";
12114});
12115defineMacro("\\bgroup", "{");
12116defineMacro("\\egroup", "}");
12117defineMacro("~", "\\nobreakspace");
12118defineMacro("\\lq", "`");
12119defineMacro("\\rq", "'");
12120defineMacro("\\aa", "\\r a");
12121defineMacro("\\AA", "\\r A");
12122defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}");
12123defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
12124defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");
12125defineMacro("ℬ", "\\mathscr{B}");
12126defineMacro("ℰ", "\\mathscr{E}");
12127defineMacro("ℱ", "\\mathscr{F}");
12128defineMacro("ℋ", "\\mathscr{H}");
12129defineMacro("ℐ", "\\mathscr{I}");
12130defineMacro("ℒ", "\\mathscr{L}");
12131defineMacro("ℳ", "\\mathscr{M}");
12132defineMacro("ℛ", "\\mathscr{R}");
12133defineMacro("ℭ", "\\mathfrak{C}");
12134defineMacro("ℌ", "\\mathfrak{H}");
12135defineMacro("ℨ", "\\mathfrak{Z}");
12136defineMacro("\\Bbbk", "\\Bbb{k}");
12137defineMacro("·", "\\cdotp");
12138defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
12139defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
12140defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
12141defineMacro("\\mathstrut", "\\vphantom{(}");
12142defineMacro("\\underbar", "\\underline{\\text{#1}}");
12143defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');
12144defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");
12145defineMacro("\\ne", "\\neq");
12146defineMacro("≠", "\\neq");
12147defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");
12148defineMacro("∉", "\\notin");
12149defineMacro("≘", "\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");
12150defineMacro("≙", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");
12151defineMacro("≚", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");
12152defineMacro("≛", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");
12153defineMacro("≝", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");
12154defineMacro("≞", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");
12155defineMacro("≟", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");
12156defineMacro("⟂", "\\perp");
12157defineMacro("‼", "\\mathclose{!\\mkern-0.8mu!}");
12158defineMacro("∌", "\\notni");
12159defineMacro("⌜", "\\ulcorner");
12160defineMacro("⌝", "\\urcorner");
12161defineMacro("⌞", "\\llcorner");
12162defineMacro("⌟", "\\lrcorner");
12163defineMacro("©", "\\copyright");
12164defineMacro("®", "\\textregistered");
12165defineMacro("️", "\\textregistered");
12166defineMacro("\\ulcorner", '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');
12167defineMacro("\\urcorner", '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');
12168defineMacro("\\llcorner", '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');
12169defineMacro("\\lrcorner", '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');
12170defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}");
12171defineMacro("⋮", "\\vdots");
12172defineMacro("\\varGamma", "\\mathit{\\Gamma}");
12173defineMacro("\\varDelta", "\\mathit{\\Delta}");
12174defineMacro("\\varTheta", "\\mathit{\\Theta}");
12175defineMacro("\\varLambda", "\\mathit{\\Lambda}");
12176defineMacro("\\varXi", "\\mathit{\\Xi}");
12177defineMacro("\\varPi", "\\mathit{\\Pi}");
12178defineMacro("\\varSigma", "\\mathit{\\Sigma}");
12179defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}");
12180defineMacro("\\varPhi", "\\mathit{\\Phi}");
12181defineMacro("\\varPsi", "\\mathit{\\Psi}");
12182defineMacro("\\varOmega", "\\mathit{\\Omega}");
12183defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}");
12184defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");
12185defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}");
12186defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
12187defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
12188defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;");
12189var dotsByToken = {
12190 ",": "\\dotsc",
12191 "\\not": "\\dotsb",
12192 // \keybin@ checks for the following:
12193 "+": "\\dotsb",
12194 "=": "\\dotsb",
12195 "<": "\\dotsb",
12196 ">": "\\dotsb",
12197 "-": "\\dotsb",
12198 "*": "\\dotsb",
12199 ":": "\\dotsb",
12200 // Symbols whose definition starts with \DOTSB:
12201 "\\DOTSB": "\\dotsb",
12202 "\\coprod": "\\dotsb",
12203 "\\bigvee": "\\dotsb",
12204 "\\bigwedge": "\\dotsb",
12205 "\\biguplus": "\\dotsb",
12206 "\\bigcap": "\\dotsb",
12207 "\\bigcup": "\\dotsb",
12208 "\\prod": "\\dotsb",
12209 "\\sum": "\\dotsb",
12210 "\\bigotimes": "\\dotsb",
12211 "\\bigoplus": "\\dotsb",
12212 "\\bigodot": "\\dotsb",
12213 "\\bigsqcup": "\\dotsb",
12214 "\\And": "\\dotsb",
12215 "\\longrightarrow": "\\dotsb",
12216 "\\Longrightarrow": "\\dotsb",
12217 "\\longleftarrow": "\\dotsb",
12218 "\\Longleftarrow": "\\dotsb",
12219 "\\longleftrightarrow": "\\dotsb",
12220 "\\Longleftrightarrow": "\\dotsb",
12221 "\\mapsto": "\\dotsb",
12222 "\\longmapsto": "\\dotsb",
12223 "\\hookrightarrow": "\\dotsb",
12224 "\\doteq": "\\dotsb",
12225 // Symbols whose definition starts with \mathbin:
12226 "\\mathbin": "\\dotsb",
12227 // Symbols whose definition starts with \mathrel:
12228 "\\mathrel": "\\dotsb",
12229 "\\relbar": "\\dotsb",
12230 "\\Relbar": "\\dotsb",
12231 "\\xrightarrow": "\\dotsb",
12232 "\\xleftarrow": "\\dotsb",
12233 // Symbols whose definition starts with \DOTSI:
12234 "\\DOTSI": "\\dotsi",
12235 "\\int": "\\dotsi",
12236 "\\oint": "\\dotsi",
12237 "\\iint": "\\dotsi",
12238 "\\iiint": "\\dotsi",
12239 "\\iiiint": "\\dotsi",
12240 "\\idotsint": "\\dotsi",
12241 // Symbols whose definition starts with \DOTSX:
12242 "\\DOTSX": "\\dotsx"
12243};
12244defineMacro("\\dots", function(context) {
12245 var thedots = "\\dotso";
12246 var next = context.expandAfterFuture().text;
12247 if (next in dotsByToken) {
12248 thedots = dotsByToken[next];
12249 } else if (next.slice(0, 4) === "\\not") {
12250 thedots = "\\dotsb";
12251 } else if (next in symbols.math) {
12252 if (utils.contains(["bin", "rel"], symbols.math[next].group)) {
12253 thedots = "\\dotsb";
12254 }
12255 }
12256 return thedots;
12257});
12258var spaceAfterDots = {
12259 // \rightdelim@ checks for the following:
12260 ")": true,
12261 "]": true,
12262 "\\rbrack": true,
12263 "\\}": true,
12264 "\\rbrace": true,
12265 "\\rangle": true,
12266 "\\rceil": true,
12267 "\\rfloor": true,
12268 "\\rgroup": true,
12269 "\\rmoustache": true,
12270 "\\right": true,
12271 "\\bigr": true,
12272 "\\biggr": true,
12273 "\\Bigr": true,
12274 "\\Biggr": true,
12275 // \extra@ also tests for the following:
12276 "$": true,
12277 // \extrap@ checks for the following:
12278 ";": true,
12279 ".": true,
12280 ",": true
12281};
12282defineMacro("\\dotso", function(context) {
12283 var next = context.future().text;
12284 if (next in spaceAfterDots) {
12285 return "\\ldots\\,";
12286 } else {
12287 return "\\ldots";
12288 }
12289});
12290defineMacro("\\dotsc", function(context) {
12291 var next = context.future().text;
12292 if (next in spaceAfterDots && next !== ",") {
12293 return "\\ldots\\,";
12294 } else {
12295 return "\\ldots";
12296 }
12297});
12298defineMacro("\\cdots", function(context) {
12299 var next = context.future().text;
12300 if (next in spaceAfterDots) {
12301 return "\\@cdots\\,";
12302 } else {
12303 return "\\@cdots";
12304 }
12305});
12306defineMacro("\\dotsb", "\\cdots");
12307defineMacro("\\dotsm", "\\cdots");
12308defineMacro("\\dotsi", "\\!\\cdots");
12309defineMacro("\\dotsx", "\\ldots\\,");
12310defineMacro("\\DOTSI", "\\relax");
12311defineMacro("\\DOTSB", "\\relax");
12312defineMacro("\\DOTSX", "\\relax");
12313defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");
12314defineMacro("\\,", "\\tmspace+{3mu}{.1667em}");
12315defineMacro("\\thinspace", "\\,");
12316defineMacro("\\>", "\\mskip{4mu}");
12317defineMacro("\\:", "\\tmspace+{4mu}{.2222em}");
12318defineMacro("\\medspace", "\\:");
12319defineMacro("\\;", "\\tmspace+{5mu}{.2777em}");
12320defineMacro("\\thickspace", "\\;");
12321defineMacro("\\!", "\\tmspace-{3mu}{.1667em}");
12322defineMacro("\\negthinspace", "\\!");
12323defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}");
12324defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}");
12325defineMacro("\\enspace", "\\kern.5em ");
12326defineMacro("\\enskip", "\\hskip.5em\\relax");
12327defineMacro("\\quad", "\\hskip1em\\relax");
12328defineMacro("\\qquad", "\\hskip2em\\relax");
12329defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren");
12330defineMacro("\\tag@paren", "\\tag@literal{({#1})}");
12331defineMacro("\\tag@literal", (context) => {
12332 if (context.macros.get("\\df@tag")) {
12333 throw new ParseError("Multiple \\tag");
12334 }
12335 return "\\gdef\\df@tag{\\text{#1}}";
12336});
12337defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");
12338defineMacro("\\pod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");
12339defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}");
12340defineMacro("\\mod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");
12341defineMacro("\\newline", "\\\\\\relax");
12342defineMacro("\\TeX", "\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");
12343var latexRaiseA = makeEm(fontMetricsData["Main-Regular"]["T".charCodeAt(0)][1] - 0.7 * fontMetricsData["Main-Regular"]["A".charCodeAt(0)][1]);
12344defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}");
12345defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}");
12346defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace");
12347defineMacro("\\@hspace", "\\hskip #1\\relax");
12348defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax");
12349defineMacro("\\ordinarycolon", ":");
12350defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}");
12351defineMacro("\\dblcolon", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');
12352defineMacro("\\coloneqq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');
12353defineMacro("\\Coloneqq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');
12354defineMacro("\\coloneq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');
12355defineMacro("\\Coloneq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');
12356defineMacro("\\eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');
12357defineMacro("\\Eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');
12358defineMacro("\\eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');
12359defineMacro("\\Eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');
12360defineMacro("\\colonapprox", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');
12361defineMacro("\\Colonapprox", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');
12362defineMacro("\\colonsim", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');
12363defineMacro("\\Colonsim", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');
12364defineMacro("∷", "\\dblcolon");
12365defineMacro("∹", "\\eqcolon");
12366defineMacro("≔", "\\coloneqq");
12367defineMacro("≕", "\\eqqcolon");
12368defineMacro("⩴", "\\Coloneqq");
12369defineMacro("\\ratio", "\\vcentcolon");
12370defineMacro("\\coloncolon", "\\dblcolon");
12371defineMacro("\\colonequals", "\\coloneqq");
12372defineMacro("\\coloncolonequals", "\\Coloneqq");
12373defineMacro("\\equalscolon", "\\eqqcolon");
12374defineMacro("\\equalscoloncolon", "\\Eqqcolon");
12375defineMacro("\\colonminus", "\\coloneq");
12376defineMacro("\\coloncolonminus", "\\Coloneq");
12377defineMacro("\\minuscolon", "\\eqcolon");
12378defineMacro("\\minuscoloncolon", "\\Eqcolon");
12379defineMacro("\\coloncolonapprox", "\\Colonapprox");
12380defineMacro("\\coloncolonsim", "\\Colonsim");
12381defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
12382defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");
12383defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
12384defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");
12385defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");
12386defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}");
12387defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}");
12388defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}");
12389defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}");
12390defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}");
12391defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}");
12392defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}");
12393defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}");
12394defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{≩}");
12395defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{≨}");
12396defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{≱}");
12397defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{≱}");
12398defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{≰}");
12399defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{≰}");
12400defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
12401defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
12402defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{⊈}");
12403defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{⊉}");
12404defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
12405defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
12406defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
12407defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}");
12408defineMacro("\\imath", "\\html@mathml{\\@imath}{ı}");
12409defineMacro("\\jmath", "\\html@mathml{\\@jmath}{ȷ}");
12410defineMacro("\\llbracket", "\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");
12411defineMacro("\\rrbracket", "\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");
12412defineMacro("⟦", "\\llbracket");
12413defineMacro("⟧", "\\rrbracket");
12414defineMacro("\\lBrace", "\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");
12415defineMacro("\\rBrace", "\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");
12416defineMacro("⦃", "\\lBrace");
12417defineMacro("⦄", "\\rBrace");
12418defineMacro("\\minuso", "\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");
12419defineMacro("⦵", "\\minuso");
12420defineMacro("\\darr", "\\downarrow");
12421defineMacro("\\dArr", "\\Downarrow");
12422defineMacro("\\Darr", "\\Downarrow");
12423defineMacro("\\lang", "\\langle");
12424defineMacro("\\rang", "\\rangle");
12425defineMacro("\\uarr", "\\uparrow");
12426defineMacro("\\uArr", "\\Uparrow");
12427defineMacro("\\Uarr", "\\Uparrow");
12428defineMacro("\\N", "\\mathbb{N}");
12429defineMacro("\\R", "\\mathbb{R}");
12430defineMacro("\\Z", "\\mathbb{Z}");
12431defineMacro("\\alef", "\\aleph");
12432defineMacro("\\alefsym", "\\aleph");
12433defineMacro("\\Alpha", "\\mathrm{A}");
12434defineMacro("\\Beta", "\\mathrm{B}");
12435defineMacro("\\bull", "\\bullet");
12436defineMacro("\\Chi", "\\mathrm{X}");
12437defineMacro("\\clubs", "\\clubsuit");
12438defineMacro("\\cnums", "\\mathbb{C}");
12439defineMacro("\\Complex", "\\mathbb{C}");
12440defineMacro("\\Dagger", "\\ddagger");
12441defineMacro("\\diamonds", "\\diamondsuit");
12442defineMacro("\\empty", "\\emptyset");
12443defineMacro("\\Epsilon", "\\mathrm{E}");
12444defineMacro("\\Eta", "\\mathrm{H}");
12445defineMacro("\\exist", "\\exists");
12446defineMacro("\\harr", "\\leftrightarrow");
12447defineMacro("\\hArr", "\\Leftrightarrow");
12448defineMacro("\\Harr", "\\Leftrightarrow");
12449defineMacro("\\hearts", "\\heartsuit");
12450defineMacro("\\image", "\\Im");
12451defineMacro("\\infin", "\\infty");
12452defineMacro("\\Iota", "\\mathrm{I}");
12453defineMacro("\\isin", "\\in");
12454defineMacro("\\Kappa", "\\mathrm{K}");
12455defineMacro("\\larr", "\\leftarrow");
12456defineMacro("\\lArr", "\\Leftarrow");
12457defineMacro("\\Larr", "\\Leftarrow");
12458defineMacro("\\lrarr", "\\leftrightarrow");
12459defineMacro("\\lrArr", "\\Leftrightarrow");
12460defineMacro("\\Lrarr", "\\Leftrightarrow");
12461defineMacro("\\Mu", "\\mathrm{M}");
12462defineMacro("\\natnums", "\\mathbb{N}");
12463defineMacro("\\Nu", "\\mathrm{N}");
12464defineMacro("\\Omicron", "\\mathrm{O}");
12465defineMacro("\\plusmn", "\\pm");
12466defineMacro("\\rarr", "\\rightarrow");
12467defineMacro("\\rArr", "\\Rightarrow");
12468defineMacro("\\Rarr", "\\Rightarrow");
12469defineMacro("\\real", "\\Re");
12470defineMacro("\\reals", "\\mathbb{R}");
12471defineMacro("\\Reals", "\\mathbb{R}");
12472defineMacro("\\Rho", "\\mathrm{P}");
12473defineMacro("\\sdot", "\\cdot");
12474defineMacro("\\sect", "\\S");
12475defineMacro("\\spades", "\\spadesuit");
12476defineMacro("\\sub", "\\subset");
12477defineMacro("\\sube", "\\subseteq");
12478defineMacro("\\supe", "\\supseteq");
12479defineMacro("\\Tau", "\\mathrm{T}");
12480defineMacro("\\thetasym", "\\vartheta");
12481defineMacro("\\weierp", "\\wp");
12482defineMacro("\\Zeta", "\\mathrm{Z}");
12483defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
12484defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
12485defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits");
12486defineMacro("\\bra", "\\mathinner{\\langle{#1}|}");
12487defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}");
12488defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}");
12489defineMacro("\\Bra", "\\left\\langle#1\\right|");
12490defineMacro("\\Ket", "\\left|#1\\right\\rangle");
12491var braketHelper = (one) => (context) => {
12492 var left = context.consumeArg().tokens;
12493 var middle = context.consumeArg().tokens;
12494 var middleDouble = context.consumeArg().tokens;
12495 var right = context.consumeArg().tokens;
12496 var oldMiddle = context.macros.get("|");
12497 var oldMiddleDouble = context.macros.get("\\|");
12498 context.macros.beginGroup();
12499 var midMacro = (double) => (context2) => {
12500 if (one) {
12501 context2.macros.set("|", oldMiddle);
12502 if (middleDouble.length) {
12503 context2.macros.set("\\|", oldMiddleDouble);
12504 }
12505 }
12506 var doubled = double;
12507 if (!double && middleDouble.length) {
12508 var nextToken = context2.future();
12509 if (nextToken.text === "|") {
12510 context2.popToken();
12511 doubled = true;
12512 }
12513 }
12514 return {
12515 tokens: doubled ? middleDouble : middle,
12516 numArgs: 0
12517 };
12518 };
12519 context.macros.set("|", midMacro(false));
12520 if (middleDouble.length) {
12521 context.macros.set("\\|", midMacro(true));
12522 }
12523 var arg = context.consumeArg().tokens;
12524 var expanded = context.expandTokens([
12525 ...right,
12526 ...arg,
12527 ...left
12528 // reversed
12529 ]);
12530 context.macros.endGroup();
12531 return {
12532 tokens: expanded.reverse(),
12533 numArgs: 0
12534 };
12535};
12536defineMacro("\\bra@ket", braketHelper(false));
12537defineMacro("\\bra@set", braketHelper(true));
12538defineMacro("\\Braket", "\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");
12539defineMacro("\\Set", "\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");
12540defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");
12541defineMacro("\\angln", "{\\angl n}");
12542defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
12543defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
12544defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
12545defineMacro("\\red", "\\textcolor{##df0030}{#1}");
12546defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
12547defineMacro("\\gray", "\\textcolor{gray}{#1}");
12548defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
12549defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
12550defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
12551defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
12552defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
12553defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
12554defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
12555defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
12556defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
12557defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
12558defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
12559defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
12560defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
12561defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
12562defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
12563defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
12564defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
12565defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
12566defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
12567defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
12568defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
12569defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
12570defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
12571defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
12572defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
12573defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
12574defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
12575defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
12576defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
12577defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
12578defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
12579defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
12580defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
12581defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
12582defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
12583defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
12584defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
12585defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
12586defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
12587defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
12588defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
12589defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
12590defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
12591defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
12592defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
12593defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
12594defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
12595defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
12596defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
12597defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
12598var implicitCommands = {
12599 "^": true,
12600 // Parser.js
12601 "_": true,
12602 // Parser.js
12603 "\\limits": true,
12604 // Parser.js
12605 "\\nolimits": true
12606 // Parser.js
12607};
12608class MacroExpander {
12609 constructor(input, settings, mode) {
12610 this.settings = void 0;
12611 this.expansionCount = void 0;
12612 this.lexer = void 0;
12613 this.macros = void 0;
12614 this.stack = void 0;
12615 this.mode = void 0;
12616 this.settings = settings;
12617 this.expansionCount = 0;
12618 this.feed(input);
12619 this.macros = new Namespace(macros, settings.macros);
12620 this.mode = mode;
12621 this.stack = [];
12622 }
12623 /**
12624 * Feed a new input string to the same MacroExpander
12625 * (with existing macros etc.).
12626 */
12627 feed(input) {
12628 this.lexer = new Lexer(input, this.settings);
12629 }
12630 /**
12631 * Switches between "text" and "math" modes.
12632 */
12633 switchMode(newMode) {
12634 this.mode = newMode;
12635 }
12636 /**
12637 * Start a new group nesting within all namespaces.
12638 */
12639 beginGroup() {
12640 this.macros.beginGroup();
12641 }
12642 /**
12643 * End current group nesting within all namespaces.
12644 */
12645 endGroup() {
12646 this.macros.endGroup();
12647 }
12648 /**
12649 * Ends all currently nested groups (if any), restoring values before the
12650 * groups began. Useful in case of an error in the middle of parsing.
12651 */
12652 endGroups() {
12653 this.macros.endGroups();
12654 }
12655 /**
12656 * Returns the topmost token on the stack, without expanding it.
12657 * Similar in behavior to TeX's `\futurelet`.
12658 */
12659 future() {
12660 if (this.stack.length === 0) {
12661 this.pushToken(this.lexer.lex());
12662 }
12663 return this.stack[this.stack.length - 1];
12664 }
12665 /**
12666 * Remove and return the next unexpanded token.
12667 */
12668 popToken() {
12669 this.future();
12670 return this.stack.pop();
12671 }
12672 /**
12673 * Add a given token to the token stack. In particular, this get be used
12674 * to put back a token returned from one of the other methods.
12675 */
12676 pushToken(token) {
12677 this.stack.push(token);
12678 }
12679 /**
12680 * Append an array of tokens to the token stack.
12681 */
12682 pushTokens(tokens) {
12683 this.stack.push(...tokens);
12684 }
12685 /**
12686 * Find an macro argument without expanding tokens and append the array of
12687 * tokens to the token stack. Uses Token as a container for the result.
12688 */
12689 scanArgument(isOptional) {
12690 var start;
12691 var end;
12692 var tokens;
12693 if (isOptional) {
12694 this.consumeSpaces();
12695 if (this.future().text !== "[") {
12696 return null;
12697 }
12698 start = this.popToken();
12699 ({
12700 tokens,
12701 end
12702 } = this.consumeArg(["]"]));
12703 } else {
12704 ({
12705 tokens,
12706 start,
12707 end
12708 } = this.consumeArg());
12709 }
12710 this.pushToken(new Token("EOF", end.loc));
12711 this.pushTokens(tokens);
12712 return start.range(end, "");
12713 }
12714 /**
12715 * Consume all following space tokens, without expansion.
12716 */
12717 consumeSpaces() {
12718 for (; ; ) {
12719 var token = this.future();
12720 if (token.text === " ") {
12721 this.stack.pop();
12722 } else {
12723 break;
12724 }
12725 }
12726 }
12727 /**
12728 * Consume an argument from the token stream, and return the resulting array
12729 * of tokens and start/end token.
12730 */
12731 consumeArg(delims) {
12732 var tokens = [];
12733 var isDelimited = delims && delims.length > 0;
12734 if (!isDelimited) {
12735 this.consumeSpaces();
12736 }
12737 var start = this.future();
12738 var tok;
12739 var depth = 0;
12740 var match = 0;
12741 do {
12742 tok = this.popToken();
12743 tokens.push(tok);
12744 if (tok.text === "{") {
12745 ++depth;
12746 } else if (tok.text === "}") {
12747 --depth;
12748 if (depth === -1) {
12749 throw new ParseError("Extra }", tok);
12750 }
12751 } else if (tok.text === "EOF") {
12752 throw new ParseError("Unexpected end of input in a macro argument, expected '" + (delims && isDelimited ? delims[match] : "}") + "'", tok);
12753 }
12754 if (delims && isDelimited) {
12755 if ((depth === 0 || depth === 1 && delims[match] === "{") && tok.text === delims[match]) {
12756 ++match;
12757 if (match === delims.length) {
12758 tokens.splice(-match, match);
12759 break;
12760 }
12761 } else {
12762 match = 0;
12763 }
12764 }
12765 } while (depth !== 0 || isDelimited);
12766 if (start.text === "{" && tokens[tokens.length - 1].text === "}") {
12767 tokens.pop();
12768 tokens.shift();
12769 }
12770 tokens.reverse();
12771 return {
12772 tokens,
12773 start,
12774 end: tok
12775 };
12776 }
12777 /**
12778 * Consume the specified number of (delimited) arguments from the token
12779 * stream and return the resulting array of arguments.
12780 */
12781 consumeArgs(numArgs, delimiters2) {
12782 if (delimiters2) {
12783 if (delimiters2.length !== numArgs + 1) {
12784 throw new ParseError("The length of delimiters doesn't match the number of args!");
12785 }
12786 var delims = delimiters2[0];
12787 for (var i = 0; i < delims.length; i++) {
12788 var tok = this.popToken();
12789 if (delims[i] !== tok.text) {
12790 throw new ParseError("Use of the macro doesn't match its definition", tok);
12791 }
12792 }
12793 }
12794 var args = [];
12795 for (var _i = 0; _i < numArgs; _i++) {
12796 args.push(this.consumeArg(delimiters2 && delimiters2[_i + 1]).tokens);
12797 }
12798 return args;
12799 }
12800 /**
12801 * Expand the next token only once if possible.
12802 *
12803 * If the token is expanded, the resulting tokens will be pushed onto
12804 * the stack in reverse order, and the number of such tokens will be
12805 * returned. This number might be zero or positive.
12806 *
12807 * If not, the return value is `false`, and the next token remains at the
12808 * top of the stack.
12809 *
12810 * In either case, the next token will be on the top of the stack,
12811 * or the stack will be empty (in case of empty expansion
12812 * and no other tokens).
12813 *
12814 * Used to implement `expandAfterFuture` and `expandNextToken`.
12815 *
12816 * If expandableOnly, only expandable tokens are expanded and
12817 * an undefined control sequence results in an error.
12818 */
12819 expandOnce(expandableOnly) {
12820 var topToken = this.popToken();
12821 var name = topToken.text;
12822 var expansion = !topToken.noexpand ? this._getExpansion(name) : null;
12823 if (expansion == null || expandableOnly && expansion.unexpandable) {
12824 if (expandableOnly && expansion == null && name[0] === "\\" && !this.isDefined(name)) {
12825 throw new ParseError("Undefined control sequence: " + name);
12826 }
12827 this.pushToken(topToken);
12828 return false;
12829 }
12830 this.expansionCount++;
12831 if (this.expansionCount > this.settings.maxExpand) {
12832 throw new ParseError("Too many expansions: infinite loop or need to increase maxExpand setting");
12833 }
12834 var tokens = expansion.tokens;
12835 var args = this.consumeArgs(expansion.numArgs, expansion.delimiters);
12836 if (expansion.numArgs) {
12837 tokens = tokens.slice();
12838 for (var i = tokens.length - 1; i >= 0; --i) {
12839 var tok = tokens[i];
12840 if (tok.text === "#") {
12841 if (i === 0) {
12842 throw new ParseError("Incomplete placeholder at end of macro body", tok);
12843 }
12844 tok = tokens[--i];
12845 if (tok.text === "#") {
12846 tokens.splice(i + 1, 1);
12847 } else if (/^[1-9]$/.test(tok.text)) {
12848 tokens.splice(i, 2, ...args[+tok.text - 1]);
12849 } else {
12850 throw new ParseError("Not a valid argument number", tok);
12851 }
12852 }
12853 }
12854 }
12855 this.pushTokens(tokens);
12856 return tokens.length;
12857 }
12858 /**
12859 * Expand the next token only once (if possible), and return the resulting
12860 * top token on the stack (without removing anything from the stack).
12861 * Similar in behavior to TeX's `\expandafter\futurelet`.
12862 * Equivalent to expandOnce() followed by future().
12863 */
12864 expandAfterFuture() {
12865 this.expandOnce();
12866 return this.future();
12867 }
12868 /**
12869 * Recursively expand first token, then return first non-expandable token.
12870 */
12871 expandNextToken() {
12872 for (; ; ) {
12873 if (this.expandOnce() === false) {
12874 var token = this.stack.pop();
12875 if (token.treatAsRelax) {
12876 token.text = "\\relax";
12877 }
12878 return token;
12879 }
12880 }
12881 throw new Error();
12882 }
12883 /**
12884 * Fully expand the given macro name and return the resulting list of
12885 * tokens, or return `undefined` if no such macro is defined.
12886 */
12887 expandMacro(name) {
12888 return this.macros.has(name) ? this.expandTokens([new Token(name)]) : void 0;
12889 }
12890 /**
12891 * Fully expand the given token stream and return the resulting list of
12892 * tokens. Note that the input tokens are in reverse order, but the
12893 * output tokens are in forward order.
12894 */
12895 expandTokens(tokens) {
12896 var output = [];
12897 var oldStackLength = this.stack.length;
12898 this.pushTokens(tokens);
12899 while (this.stack.length > oldStackLength) {
12900 if (this.expandOnce(true) === false) {
12901 var token = this.stack.pop();
12902 if (token.treatAsRelax) {
12903 token.noexpand = false;
12904 token.treatAsRelax = false;
12905 }
12906 output.push(token);
12907 }
12908 }
12909 return output;
12910 }
12911 /**
12912 * Fully expand the given macro name and return the result as a string,
12913 * or return `undefined` if no such macro is defined.
12914 */
12915 expandMacroAsText(name) {
12916 var tokens = this.expandMacro(name);
12917 if (tokens) {
12918 return tokens.map((token) => token.text).join("");
12919 } else {
12920 return tokens;
12921 }
12922 }
12923 /**
12924 * Returns the expanded macro as a reversed array of tokens and a macro
12925 * argument count. Or returns `null` if no such macro.
12926 */
12927 _getExpansion(name) {
12928 var definition = this.macros.get(name);
12929 if (definition == null) {
12930 return definition;
12931 }
12932 if (name.length === 1) {
12933 var catcode = this.lexer.catcodes[name];
12934 if (catcode != null && catcode !== 13) {
12935 return;
12936 }
12937 }
12938 var expansion = typeof definition === "function" ? definition(this) : definition;
12939 if (typeof expansion === "string") {
12940 var numArgs = 0;
12941 if (expansion.indexOf("#") !== -1) {
12942 var stripped = expansion.replace(/##/g, "");
12943 while (stripped.indexOf("#" + (numArgs + 1)) !== -1) {
12944 ++numArgs;
12945 }
12946 }
12947 var bodyLexer = new Lexer(expansion, this.settings);
12948 var tokens = [];
12949 var tok = bodyLexer.lex();
12950 while (tok.text !== "EOF") {
12951 tokens.push(tok);
12952 tok = bodyLexer.lex();
12953 }
12954 tokens.reverse();
12955 var expanded = {
12956 tokens,
12957 numArgs
12958 };
12959 return expanded;
12960 }
12961 return expansion;
12962 }
12963 /**
12964 * Determine whether a command is currently "defined" (has some
12965 * functionality), meaning that it's a macro (in the current group),
12966 * a function, a symbol, or one of the special commands listed in
12967 * `implicitCommands`.
12968 */
12969 isDefined(name) {
12970 return this.macros.has(name) || functions.hasOwnProperty(name) || symbols.math.hasOwnProperty(name) || symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);
12971 }
12972 /**
12973 * Determine whether a command is expandable.
12974 */
12975 isExpandable(name) {
12976 var macro = this.macros.get(name);
12977 return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable : functions.hasOwnProperty(name) && !functions[name].primitive;
12978 }
12979}
12980var unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/;
12981var uSubsAndSups = Object.freeze({
12982 "₊": "+",
12983 "₋": "-",
12984 "₌": "=",
12985 "₍": "(",
12986 "₎": ")",
12987 "₀": "0",
12988 "₁": "1",
12989 "₂": "2",
12990 "₃": "3",
12991 "₄": "4",
12992 "₅": "5",
12993 "₆": "6",
12994 "₇": "7",
12995 "₈": "8",
12996 "₉": "9",
12997 "ₐ": "a",
12998 "ₑ": "e",
12999 "ₕ": "h",
13000 "ᵢ": "i",
13001 "ⱼ": "j",
13002 "ₖ": "k",
13003 "ₗ": "l",
13004 "ₘ": "m",
13005 "ₙ": "n",
13006 "ₒ": "o",
13007 "ₚ": "p",
13008 "ᵣ": "r",
13009 "ₛ": "s",
13010 "ₜ": "t",
13011 "ᵤ": "u",
13012 "ᵥ": "v",
13013 "ₓ": "x",
13014 "ᵦ": "β",
13015 "ᵧ": "γ",
13016 "ᵨ": "ρ",
13017 "ᵩ": "ϕ",
13018 "ᵪ": "χ",
13019 "⁺": "+",
13020 "⁻": "-",
13021 "⁼": "=",
13022 "⁽": "(",
13023 "⁾": ")",
13024 "⁰": "0",
13025 "¹": "1",
13026 "²": "2",
13027 "³": "3",
13028 "⁴": "4",
13029 "⁵": "5",
13030 "⁶": "6",
13031 "⁷": "7",
13032 "⁸": "8",
13033 "⁹": "9",
13034 "ᴬ": "A",
13035 "ᴮ": "B",
13036 "ᴰ": "D",
13037 "ᴱ": "E",
13038 "ᴳ": "G",
13039 "ᴴ": "H",
13040 "ᴵ": "I",
13041 "ᴶ": "J",
13042 "ᴷ": "K",
13043 "ᴸ": "L",
13044 "ᴹ": "M",
13045 "ᴺ": "N",
13046 "ᴼ": "O",
13047 "ᴾ": "P",
13048 "ᴿ": "R",
13049 "ᵀ": "T",
13050 "ᵁ": "U",
13051 "ⱽ": "V",
13052 "ᵂ": "W",
13053 "ᵃ": "a",
13054 "ᵇ": "b",
13055 "ᶜ": "c",
13056 "ᵈ": "d",
13057 "ᵉ": "e",
13058 "ᶠ": "f",
13059 "ᵍ": "g",
13060 "ʰ": "h",
13061 "ⁱ": "i",
13062 "ʲ": "j",
13063 "ᵏ": "k",
13064 "ˡ": "l",
13065 "ᵐ": "m",
13066 "ⁿ": "n",
13067 "ᵒ": "o",
13068 "ᵖ": "p",
13069 "ʳ": "r",
13070 "ˢ": "s",
13071 "ᵗ": "t",
13072 "ᵘ": "u",
13073 "ᵛ": "v",
13074 "ʷ": "w",
13075 "ˣ": "x",
13076 "ʸ": "y",
13077 "ᶻ": "z",
13078 "ᵝ": "β",
13079 "ᵞ": "γ",
13080 "ᵟ": "δ",
13081 "ᵠ": "ϕ",
13082 "ᵡ": "χ",
13083 "ᶿ": "θ"
13084});
13085var unicodeAccents = {
13086 "́": {
13087 "text": "\\'",
13088 "math": "\\acute"
13089 },
13090 "̀": {
13091 "text": "\\`",
13092 "math": "\\grave"
13093 },
13094 "̈": {
13095 "text": '\\"',
13096 "math": "\\ddot"
13097 },
13098 "̃": {
13099 "text": "\\~",
13100 "math": "\\tilde"
13101 },
13102 "̄": {
13103 "text": "\\=",
13104 "math": "\\bar"
13105 },
13106 "̆": {
13107 "text": "\\u",
13108 "math": "\\breve"
13109 },
13110 "̌": {
13111 "text": "\\v",
13112 "math": "\\check"
13113 },
13114 "̂": {
13115 "text": "\\^",
13116 "math": "\\hat"
13117 },
13118 "̇": {
13119 "text": "\\.",
13120 "math": "\\dot"
13121 },
13122 "̊": {
13123 "text": "\\r",
13124 "math": "\\mathring"
13125 },
13126 "̋": {
13127 "text": "\\H"
13128 },
13129 "̧": {
13130 "text": "\\c"
13131 }
13132};
13133var unicodeSymbols = {
13134 "á": "á",
13135 "à": "à",
13136 "ä": "ä",
13137 "ǟ": "ǟ",
13138 "ã": "ã",
13139 "ā": "ā",
13140 "ă": "ă",
13141 "ắ": "ắ",
13142 "ằ": "ằ",
13143 "ẵ": "ẵ",
13144 "ǎ": "ǎ",
13145 "â": "â",
13146 "ấ": "ấ",
13147 "ầ": "ầ",
13148 "ẫ": "ẫ",
13149 "ȧ": "ȧ",
13150 "ǡ": "ǡ",
13151 "å": "å",
13152 "ǻ": "ǻ",
13153 "ḃ": "ḃ",
13154 "ć": "ć",
13155 "ḉ": "ḉ",
13156 "č": "č",
13157 "ĉ": "ĉ",
13158 "ċ": "ċ",
13159 "ç": "ç",
13160 "ď": "ď",
13161 "ḋ": "ḋ",
13162 "ḑ": "ḑ",
13163 "é": "é",
13164 "è": "è",
13165 "ë": "ë",
13166 "ẽ": "ẽ",
13167 "ē": "ē",
13168 "ḗ": "ḗ",
13169 "ḕ": "ḕ",
13170 "ĕ": "ĕ",
13171 "ḝ": "ḝ",
13172 "ě": "ě",
13173 "ê": "ê",
13174 "ế": "ế",
13175 "ề": "ề",
13176 "ễ": "ễ",
13177 "ė": "ė",
13178 "ȩ": "ȩ",
13179 "ḟ": "ḟ",
13180 "ǵ": "ǵ",
13181 "ḡ": "ḡ",
13182 "ğ": "ğ",
13183 "ǧ": "ǧ",
13184 "ĝ": "ĝ",
13185 "ġ": "ġ",
13186 "ģ": "ģ",
13187 "ḧ": "ḧ",
13188 "ȟ": "ȟ",
13189 "ĥ": "ĥ",
13190 "ḣ": "ḣ",
13191 "ḩ": "ḩ",
13192 "í": "í",
13193 "ì": "ì",
13194 "ï": "ï",
13195 "ḯ": "ḯ",
13196 "ĩ": "ĩ",
13197 "ī": "ī",
13198 "ĭ": "ĭ",
13199 "ǐ": "ǐ",
13200 "î": "î",
13201 "ǰ": "ǰ",
13202 "ĵ": "ĵ",
13203 "ḱ": "ḱ",
13204 "ǩ": "ǩ",
13205 "ķ": "ķ",
13206 "ĺ": "ĺ",
13207 "ľ": "ľ",
13208 "ļ": "ļ",
13209 "ḿ": "ḿ",
13210 "ṁ": "ṁ",
13211 "ń": "ń",
13212 "ǹ": "ǹ",
13213 "ñ": "ñ",
13214 "ň": "ň",
13215 "ṅ": "ṅ",
13216 "ņ": "ņ",
13217 "ó": "ó",
13218 "ò": "ò",
13219 "ö": "ö",
13220 "ȫ": "ȫ",
13221 "õ": "õ",
13222 "ṍ": "ṍ",
13223 "ṏ": "ṏ",
13224 "ȭ": "ȭ",
13225 "ō": "ō",
13226 "ṓ": "ṓ",
13227 "ṑ": "ṑ",
13228 "ŏ": "ŏ",
13229 "ǒ": "ǒ",
13230 "ô": "ô",
13231 "ố": "ố",
13232 "ồ": "ồ",
13233 "ỗ": "ỗ",
13234 "ȯ": "ȯ",
13235 "ȱ": "ȱ",
13236 "ő": "ő",
13237 "ṕ": "ṕ",
13238 "ṗ": "ṗ",
13239 "ŕ": "ŕ",
13240 "ř": "ř",
13241 "ṙ": "ṙ",
13242 "ŗ": "ŗ",
13243 "ś": "ś",
13244 "ṥ": "ṥ",
13245 "š": "š",
13246 "ṧ": "ṧ",
13247 "ŝ": "ŝ",
13248 "ṡ": "ṡ",
13249 "ş": "ş",
13250 "ẗ": "ẗ",
13251 "ť": "ť",
13252 "ṫ": "ṫ",
13253 "ţ": "ţ",
13254 "ú": "ú",
13255 "ù": "ù",
13256 "ü": "ü",
13257 "ǘ": "ǘ",
13258 "ǜ": "ǜ",
13259 "ǖ": "ǖ",
13260 "ǚ": "ǚ",
13261 "ũ": "ũ",
13262 "ṹ": "ṹ",
13263 "ū": "ū",
13264 "ṻ": "ṻ",
13265 "ŭ": "ŭ",
13266 "ǔ": "ǔ",
13267 "û": "û",
13268 "ů": "ů",
13269 "ű": "ű",
13270 "ṽ": "ṽ",
13271 "ẃ": "ẃ",
13272 "ẁ": "ẁ",
13273 "ẅ": "ẅ",
13274 "ŵ": "ŵ",
13275 "ẇ": "ẇ",
13276 "ẘ": "ẘ",
13277 "ẍ": "ẍ",
13278 "ẋ": "ẋ",
13279 "ý": "ý",
13280 "ỳ": "ỳ",
13281 "ÿ": "ÿ",
13282 "ỹ": "ỹ",
13283 "ȳ": "ȳ",
13284 "ŷ": "ŷ",
13285 "ẏ": "ẏ",
13286 "ẙ": "ẙ",
13287 "ź": "ź",
13288 "ž": "ž",
13289 "ẑ": "ẑ",
13290 "ż": "ż",
13291 "Á": "Á",
13292 "À": "À",
13293 "Ä": "Ä",
13294 "Ǟ": "Ǟ",
13295 "Ã": "Ã",
13296 "Ā": "Ā",
13297 "Ă": "Ă",
13298 "Ắ": "Ắ",
13299 "Ằ": "Ằ",
13300 "Ẵ": "Ẵ",
13301 "Ǎ": "Ǎ",
13302 "Â": "Â",
13303 "Ấ": "Ấ",
13304 "Ầ": "Ầ",
13305 "Ẫ": "Ẫ",
13306 "Ȧ": "Ȧ",
13307 "Ǡ": "Ǡ",
13308 "Å": "Å",
13309 "Ǻ": "Ǻ",
13310 "Ḃ": "Ḃ",
13311 "Ć": "Ć",
13312 "Ḉ": "Ḉ",
13313 "Č": "Č",
13314 "Ĉ": "Ĉ",
13315 "Ċ": "Ċ",
13316 "Ç": "Ç",
13317 "Ď": "Ď",
13318 "Ḋ": "Ḋ",
13319 "Ḑ": "Ḑ",
13320 "É": "É",
13321 "È": "È",
13322 "Ë": "Ë",
13323 "Ẽ": "Ẽ",
13324 "Ē": "Ē",
13325 "Ḗ": "Ḗ",
13326 "Ḕ": "Ḕ",
13327 "Ĕ": "Ĕ",
13328 "Ḝ": "Ḝ",
13329 "Ě": "Ě",
13330 "Ê": "Ê",
13331 "Ế": "Ế",
13332 "Ề": "Ề",
13333 "Ễ": "Ễ",
13334 "Ė": "Ė",
13335 "Ȩ": "Ȩ",
13336 "Ḟ": "Ḟ",
13337 "Ǵ": "Ǵ",
13338 "Ḡ": "Ḡ",
13339 "Ğ": "Ğ",
13340 "Ǧ": "Ǧ",
13341 "Ĝ": "Ĝ",
13342 "Ġ": "Ġ",
13343 "Ģ": "Ģ",
13344 "Ḧ": "Ḧ",
13345 "Ȟ": "Ȟ",
13346 "Ĥ": "Ĥ",
13347 "Ḣ": "Ḣ",
13348 "Ḩ": "Ḩ",
13349 "Í": "Í",
13350 "Ì": "Ì",
13351 "Ï": "Ï",
13352 "Ḯ": "Ḯ",
13353 "Ĩ": "Ĩ",
13354 "Ī": "Ī",
13355 "Ĭ": "Ĭ",
13356 "Ǐ": "Ǐ",
13357 "Î": "Î",
13358 "İ": "İ",
13359 "Ĵ": "Ĵ",
13360 "Ḱ": "Ḱ",
13361 "Ǩ": "Ǩ",
13362 "Ķ": "Ķ",
13363 "Ĺ": "Ĺ",
13364 "Ľ": "Ľ",
13365 "Ļ": "Ļ",
13366 "Ḿ": "Ḿ",
13367 "Ṁ": "Ṁ",
13368 "Ń": "Ń",
13369 "Ǹ": "Ǹ",
13370 "Ñ": "Ñ",
13371 "Ň": "Ň",
13372 "Ṅ": "Ṅ",
13373 "Ņ": "Ņ",
13374 "Ó": "Ó",
13375 "Ò": "Ò",
13376 "Ö": "Ö",
13377 "Ȫ": "Ȫ",
13378 "Õ": "Õ",
13379 "Ṍ": "Ṍ",
13380 "Ṏ": "Ṏ",
13381 "Ȭ": "Ȭ",
13382 "Ō": "Ō",
13383 "Ṓ": "Ṓ",
13384 "Ṑ": "Ṑ",
13385 "Ŏ": "Ŏ",
13386 "Ǒ": "Ǒ",
13387 "Ô": "Ô",
13388 "Ố": "Ố",
13389 "Ồ": "Ồ",
13390 "Ỗ": "Ỗ",
13391 "Ȯ": "Ȯ",
13392 "Ȱ": "Ȱ",
13393 "Ő": "Ő",
13394 "Ṕ": "Ṕ",
13395 "Ṗ": "Ṗ",
13396 "Ŕ": "Ŕ",
13397 "Ř": "Ř",
13398 "Ṙ": "Ṙ",
13399 "Ŗ": "Ŗ",
13400 "Ś": "Ś",
13401 "Ṥ": "Ṥ",
13402 "Š": "Š",
13403 "Ṧ": "Ṧ",
13404 "Ŝ": "Ŝ",
13405 "Ṡ": "Ṡ",
13406 "Ş": "Ş",
13407 "Ť": "Ť",
13408 "Ṫ": "Ṫ",
13409 "Ţ": "Ţ",
13410 "Ú": "Ú",
13411 "Ù": "Ù",
13412 "Ü": "Ü",
13413 "Ǘ": "Ǘ",
13414 "Ǜ": "Ǜ",
13415 "Ǖ": "Ǖ",
13416 "Ǚ": "Ǚ",
13417 "Ũ": "Ũ",
13418 "Ṹ": "Ṹ",
13419 "Ū": "Ū",
13420 "Ṻ": "Ṻ",
13421 "Ŭ": "Ŭ",
13422 "Ǔ": "Ǔ",
13423 "Û": "Û",
13424 "Ů": "Ů",
13425 "Ű": "Ű",
13426 "Ṽ": "Ṽ",
13427 "Ẃ": "Ẃ",
13428 "Ẁ": "Ẁ",
13429 "Ẅ": "Ẅ",
13430 "Ŵ": "Ŵ",
13431 "Ẇ": "Ẇ",
13432 "Ẍ": "Ẍ",
13433 "Ẋ": "Ẋ",
13434 "Ý": "Ý",
13435 "Ỳ": "Ỳ",
13436 "Ÿ": "Ÿ",
13437 "Ỹ": "Ỹ",
13438 "Ȳ": "Ȳ",
13439 "Ŷ": "Ŷ",
13440 "Ẏ": "Ẏ",
13441 "Ź": "Ź",
13442 "Ž": "Ž",
13443 "Ẑ": "Ẑ",
13444 "Ż": "Ż",
13445 "ά": "ά",
13446 "ὰ": "ὰ",
13447 "ᾱ": "ᾱ",
13448 "ᾰ": "ᾰ",
13449 "έ": "έ",
13450 "ὲ": "ὲ",
13451 "ή": "ή",
13452 "ὴ": "ὴ",
13453 "ί": "ί",
13454 "ὶ": "ὶ",
13455 "ϊ": "ϊ",
13456 "ΐ": "ΐ",
13457 "ῒ": "ῒ",
13458 "ῑ": "ῑ",
13459 "ῐ": "ῐ",
13460 "ό": "ό",
13461 "ὸ": "ὸ",
13462 "ύ": "ύ",
13463 "ὺ": "ὺ",
13464 "ϋ": "ϋ",
13465 "ΰ": "ΰ",
13466 "ῢ": "ῢ",
13467 "ῡ": "ῡ",
13468 "ῠ": "ῠ",
13469 "ώ": "ώ",
13470 "ὼ": "ὼ",
13471 "Ύ": "Ύ",
13472 "Ὺ": "Ὺ",
13473 "Ϋ": "Ϋ",
13474 "Ῡ": "Ῡ",
13475 "Ῠ": "Ῠ",
13476 "Ώ": "Ώ",
13477 "Ὼ": "Ὼ"
13478};
13479class Parser {
13480 constructor(input, settings) {
13481 this.mode = void 0;
13482 this.gullet = void 0;
13483 this.settings = void 0;
13484 this.leftrightDepth = void 0;
13485 this.nextToken = void 0;
13486 this.mode = "math";
13487 this.gullet = new MacroExpander(input, settings, this.mode);
13488 this.settings = settings;
13489 this.leftrightDepth = 0;
13490 }
13491 /**
13492 * Checks a result to make sure it has the right type, and throws an
13493 * appropriate error otherwise.
13494 */
13495 expect(text2, consume) {
13496 if (consume === void 0) {
13497 consume = true;
13498 }
13499 if (this.fetch().text !== text2) {
13500 throw new ParseError("Expected '" + text2 + "', got '" + this.fetch().text + "'", this.fetch());
13501 }
13502 if (consume) {
13503 this.consume();
13504 }
13505 }
13506 /**
13507 * Discards the current lookahead token, considering it consumed.
13508 */
13509 consume() {
13510 this.nextToken = null;
13511 }
13512 /**
13513 * Return the current lookahead token, or if there isn't one (at the
13514 * beginning, or if the previous lookahead token was consume()d),
13515 * fetch the next token as the new lookahead token and return it.
13516 */
13517 fetch() {
13518 if (this.nextToken == null) {
13519 this.nextToken = this.gullet.expandNextToken();
13520 }
13521 return this.nextToken;
13522 }
13523 /**
13524 * Switches between "text" and "math" modes.
13525 */
13526 switchMode(newMode) {
13527 this.mode = newMode;
13528 this.gullet.switchMode(newMode);
13529 }
13530 /**
13531 * Main parsing function, which parses an entire input.
13532 */
13533 parse() {
13534 if (!this.settings.globalGroup) {
13535 this.gullet.beginGroup();
13536 }
13537 if (this.settings.colorIsTextColor) {
13538 this.gullet.macros.set("\\color", "\\textcolor");
13539 }
13540 try {
13541 var parse = this.parseExpression(false);
13542 this.expect("EOF");
13543 if (!this.settings.globalGroup) {
13544 this.gullet.endGroup();
13545 }
13546 return parse;
13547 } finally {
13548 this.gullet.endGroups();
13549 }
13550 }
13551 /**
13552 * Fully parse a separate sequence of tokens as a separate job.
13553 * Tokens should be specified in reverse order, as in a MacroDefinition.
13554 */
13555 subparse(tokens) {
13556 var oldToken = this.nextToken;
13557 this.consume();
13558 this.gullet.pushToken(new Token("}"));
13559 this.gullet.pushTokens(tokens);
13560 var parse = this.parseExpression(false);
13561 this.expect("}");
13562 this.nextToken = oldToken;
13563 return parse;
13564 }
13565 /**
13566 * Parses an "expression", which is a list of atoms.
13567 *
13568 * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
13569 * happens when functions have higher precedence han infix
13570 * nodes in implicit parses.
13571 *
13572 * `breakOnTokenText`: The text of the token that the expression should end
13573 * with, or `null` if something else should end the
13574 * expression.
13575 */
13576 parseExpression(breakOnInfix, breakOnTokenText) {
13577 var body = [];
13578 while (true) {
13579 if (this.mode === "math") {
13580 this.consumeSpaces();
13581 }
13582 var lex = this.fetch();
13583 if (Parser.endOfExpression.indexOf(lex.text) !== -1) {
13584 break;
13585 }
13586 if (breakOnTokenText && lex.text === breakOnTokenText) {
13587 break;
13588 }
13589 if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) {
13590 break;
13591 }
13592 var atom = this.parseAtom(breakOnTokenText);
13593 if (!atom) {
13594 break;
13595 } else if (atom.type === "internal") {
13596 continue;
13597 }
13598 body.push(atom);
13599 }
13600 if (this.mode === "text") {
13601 this.formLigatures(body);
13602 }
13603 return this.handleInfixNodes(body);
13604 }
13605 /**
13606 * Rewrites infix operators such as \over with corresponding commands such
13607 * as \frac.
13608 *
13609 * There can only be one infix operator per group. If there's more than one
13610 * then the expression is ambiguous. This can be resolved by adding {}.
13611 */
13612 handleInfixNodes(body) {
13613 var overIndex = -1;
13614 var funcName;
13615 for (var i = 0; i < body.length; i++) {
13616 if (body[i].type === "infix") {
13617 if (overIndex !== -1) {
13618 throw new ParseError("only one infix operator per group", body[i].token);
13619 }
13620 overIndex = i;
13621 funcName = body[i].replaceWith;
13622 }
13623 }
13624 if (overIndex !== -1 && funcName) {
13625 var numerNode;
13626 var denomNode;
13627 var numerBody = body.slice(0, overIndex);
13628 var denomBody = body.slice(overIndex + 1);
13629 if (numerBody.length === 1 && numerBody[0].type === "ordgroup") {
13630 numerNode = numerBody[0];
13631 } else {
13632 numerNode = {
13633 type: "ordgroup",
13634 mode: this.mode,
13635 body: numerBody
13636 };
13637 }
13638 if (denomBody.length === 1 && denomBody[0].type === "ordgroup") {
13639 denomNode = denomBody[0];
13640 } else {
13641 denomNode = {
13642 type: "ordgroup",
13643 mode: this.mode,
13644 body: denomBody
13645 };
13646 }
13647 var node;
13648 if (funcName === "\\\\abovefrac") {
13649 node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []);
13650 } else {
13651 node = this.callFunction(funcName, [numerNode, denomNode], []);
13652 }
13653 return [node];
13654 } else {
13655 return body;
13656 }
13657 }
13658 /**
13659 * Handle a subscript or superscript with nice errors.
13660 */
13661 handleSupSubscript(name) {
13662 var symbolToken = this.fetch();
13663 var symbol = symbolToken.text;
13664 this.consume();
13665 this.consumeSpaces();
13666 var group = this.parseGroup(name);
13667 if (!group) {
13668 throw new ParseError("Expected group after '" + symbol + "'", symbolToken);
13669 }
13670 return group;
13671 }
13672 /**
13673 * Converts the textual input of an unsupported command into a text node
13674 * contained within a color node whose color is determined by errorColor
13675 */
13676 formatUnsupportedCmd(text2) {
13677 var textordArray = [];
13678 for (var i = 0; i < text2.length; i++) {
13679 textordArray.push({
13680 type: "textord",
13681 mode: "text",
13682 text: text2[i]
13683 });
13684 }
13685 var textNode = {
13686 type: "text",
13687 mode: this.mode,
13688 body: textordArray
13689 };
13690 var colorNode = {
13691 type: "color",
13692 mode: this.mode,
13693 color: this.settings.errorColor,
13694 body: [textNode]
13695 };
13696 return colorNode;
13697 }
13698 /**
13699 * Parses a group with optional super/subscripts.
13700 */
13701 parseAtom(breakOnTokenText) {
13702 var base = this.parseGroup("atom", breakOnTokenText);
13703 if (this.mode === "text") {
13704 return base;
13705 }
13706 var superscript;
13707 var subscript;
13708 while (true) {
13709 this.consumeSpaces();
13710 var lex = this.fetch();
13711 if (lex.text === "\\limits" || lex.text === "\\nolimits") {
13712 if (base && base.type === "op") {
13713 var limits = lex.text === "\\limits";
13714 base.limits = limits;
13715 base.alwaysHandleSupSub = true;
13716 } else if (base && base.type === "operatorname") {
13717 if (base.alwaysHandleSupSub) {
13718 base.limits = lex.text === "\\limits";
13719 }
13720 } else {
13721 throw new ParseError("Limit controls must follow a math operator", lex);
13722 }
13723 this.consume();
13724 } else if (lex.text === "^") {
13725 if (superscript) {
13726 throw new ParseError("Double superscript", lex);
13727 }
13728 superscript = this.handleSupSubscript("superscript");
13729 } else if (lex.text === "_") {
13730 if (subscript) {
13731 throw new ParseError("Double subscript", lex);
13732 }
13733 subscript = this.handleSupSubscript("subscript");
13734 } else if (lex.text === "'") {
13735 if (superscript) {
13736 throw new ParseError("Double superscript", lex);
13737 }
13738 var prime = {
13739 type: "textord",
13740 mode: this.mode,
13741 text: "\\prime"
13742 };
13743 var primes = [prime];
13744 this.consume();
13745 while (this.fetch().text === "'") {
13746 primes.push(prime);
13747 this.consume();
13748 }
13749 if (this.fetch().text === "^") {
13750 primes.push(this.handleSupSubscript("superscript"));
13751 }
13752 superscript = {
13753 type: "ordgroup",
13754 mode: this.mode,
13755 body: primes
13756 };
13757 } else if (uSubsAndSups[lex.text]) {
13758 var str = uSubsAndSups[lex.text];
13759 var isSub = unicodeSubRegEx.test(lex.text);
13760 this.consume();
13761 while (true) {
13762 var token = this.fetch().text;
13763 if (!uSubsAndSups[token]) {
13764 break;
13765 }
13766 if (unicodeSubRegEx.test(token) !== isSub) {
13767 break;
13768 }
13769 this.consume();
13770 str += uSubsAndSups[token];
13771 }
13772 var body = new Parser(str, this.settings).parse();
13773 if (isSub) {
13774 subscript = {
13775 type: "ordgroup",
13776 mode: "math",
13777 body
13778 };
13779 } else {
13780 superscript = {
13781 type: "ordgroup",
13782 mode: "math",
13783 body
13784 };
13785 }
13786 } else {
13787 break;
13788 }
13789 }
13790 if (superscript || subscript) {
13791 return {
13792 type: "supsub",
13793 mode: this.mode,
13794 base,
13795 sup: superscript,
13796 sub: subscript
13797 };
13798 } else {
13799 return base;
13800 }
13801 }
13802 /**
13803 * Parses an entire function, including its base and all of its arguments.
13804 */
13805 parseFunction(breakOnTokenText, name) {
13806 var token = this.fetch();
13807 var func = token.text;
13808 var funcData = functions[func];
13809 if (!funcData) {
13810 return null;
13811 }
13812 this.consume();
13813 if (name && name !== "atom" && !funcData.allowedInArgument) {
13814 throw new ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token);
13815 } else if (this.mode === "text" && !funcData.allowedInText) {
13816 throw new ParseError("Can't use function '" + func + "' in text mode", token);
13817 } else if (this.mode === "math" && funcData.allowedInMath === false) {
13818 throw new ParseError("Can't use function '" + func + "' in math mode", token);
13819 }
13820 var {
13821 args,
13822 optArgs
13823 } = this.parseArguments(func, funcData);
13824 return this.callFunction(func, args, optArgs, token, breakOnTokenText);
13825 }
13826 /**
13827 * Call a function handler with a suitable context and arguments.
13828 */
13829 callFunction(name, args, optArgs, token, breakOnTokenText) {
13830 var context = {
13831 funcName: name,
13832 parser: this,
13833 token,
13834 breakOnTokenText
13835 };
13836 var func = functions[name];
13837 if (func && func.handler) {
13838 return func.handler(context, args, optArgs);
13839 } else {
13840 throw new ParseError("No function handler for " + name);
13841 }
13842 }
13843 /**
13844 * Parses the arguments of a function or environment
13845 */
13846 parseArguments(func, funcData) {
13847 var totalArgs = funcData.numArgs + funcData.numOptionalArgs;
13848 if (totalArgs === 0) {
13849 return {
13850 args: [],
13851 optArgs: []
13852 };
13853 }
13854 var args = [];
13855 var optArgs = [];
13856 for (var i = 0; i < totalArgs; i++) {
13857 var argType = funcData.argTypes && funcData.argTypes[i];
13858 var isOptional = i < funcData.numOptionalArgs;
13859 if (funcData.primitive && argType == null || // \sqrt expands into primitive if optional argument doesn't exist
13860 funcData.type === "sqrt" && i === 1 && optArgs[0] == null) {
13861 argType = "primitive";
13862 }
13863 var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional);
13864 if (isOptional) {
13865 optArgs.push(arg);
13866 } else if (arg != null) {
13867 args.push(arg);
13868 } else {
13869 throw new ParseError("Null argument, please report this as a bug");
13870 }
13871 }
13872 return {
13873 args,
13874 optArgs
13875 };
13876 }
13877 /**
13878 * Parses a group when the mode is changing.
13879 */
13880 parseGroupOfType(name, type, optional) {
13881 switch (type) {
13882 case "color":
13883 return this.parseColorGroup(optional);
13884 case "size":
13885 return this.parseSizeGroup(optional);
13886 case "url":
13887 return this.parseUrlGroup(optional);
13888 case "math":
13889 case "text":
13890 return this.parseArgumentGroup(optional, type);
13891 case "hbox": {
13892 var group = this.parseArgumentGroup(optional, "text");
13893 return group != null ? {
13894 type: "styling",
13895 mode: group.mode,
13896 body: [group],
13897 style: "text"
13898 // simulate \textstyle
13899 } : null;
13900 }
13901 case "raw": {
13902 var token = this.parseStringGroup("raw", optional);
13903 return token != null ? {
13904 type: "raw",
13905 mode: "text",
13906 string: token.text
13907 } : null;
13908 }
13909 case "primitive": {
13910 if (optional) {
13911 throw new ParseError("A primitive argument cannot be optional");
13912 }
13913 var _group = this.parseGroup(name);
13914 if (_group == null) {
13915 throw new ParseError("Expected group as " + name, this.fetch());
13916 }
13917 return _group;
13918 }
13919 case "original":
13920 case null:
13921 case void 0:
13922 return this.parseArgumentGroup(optional);
13923 default:
13924 throw new ParseError("Unknown group type as " + name, this.fetch());
13925 }
13926 }
13927 /**
13928 * Discard any space tokens, fetching the next non-space token.
13929 */
13930 consumeSpaces() {
13931 while (this.fetch().text === " ") {
13932 this.consume();
13933 }
13934 }
13935 /**
13936 * Parses a group, essentially returning the string formed by the
13937 * brace-enclosed tokens plus some position information.
13938 */
13939 parseStringGroup(modeName, optional) {
13940 var argToken = this.gullet.scanArgument(optional);
13941 if (argToken == null) {
13942 return null;
13943 }
13944 var str = "";
13945 var nextToken;
13946 while ((nextToken = this.fetch()).text !== "EOF") {
13947 str += nextToken.text;
13948 this.consume();
13949 }
13950 this.consume();
13951 argToken.text = str;
13952 return argToken;
13953 }
13954 /**
13955 * Parses a regex-delimited group: the largest sequence of tokens
13956 * whose concatenated strings match `regex`. Returns the string
13957 * formed by the tokens plus some position information.
13958 */
13959 parseRegexGroup(regex, modeName) {
13960 var firstToken = this.fetch();
13961 var lastToken = firstToken;
13962 var str = "";
13963 var nextToken;
13964 while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) {
13965 lastToken = nextToken;
13966 str += lastToken.text;
13967 this.consume();
13968 }
13969 if (str === "") {
13970 throw new ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken);
13971 }
13972 return firstToken.range(lastToken, str);
13973 }
13974 /**
13975 * Parses a color description.
13976 */
13977 parseColorGroup(optional) {
13978 var res = this.parseStringGroup("color", optional);
13979 if (res == null) {
13980 return null;
13981 }
13982 var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);
13983 if (!match) {
13984 throw new ParseError("Invalid color: '" + res.text + "'", res);
13985 }
13986 var color = match[0];
13987 if (/^[0-9a-f]{6}$/i.test(color)) {
13988 color = "#" + color;
13989 }
13990 return {
13991 type: "color-token",
13992 mode: this.mode,
13993 color
13994 };
13995 }
13996 /**
13997 * Parses a size specification, consisting of magnitude and unit.
13998 */
13999 parseSizeGroup(optional) {
14000 var res;
14001 var isBlank = false;
14002 this.gullet.consumeSpaces();
14003 if (!optional && this.gullet.future().text !== "{") {
14004 res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size");
14005 } else {
14006 res = this.parseStringGroup("size", optional);
14007 }
14008 if (!res) {
14009 return null;
14010 }
14011 if (!optional && res.text.length === 0) {
14012 res.text = "0pt";
14013 isBlank = true;
14014 }
14015 var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text);
14016 if (!match) {
14017 throw new ParseError("Invalid size: '" + res.text + "'", res);
14018 }
14019 var data = {
14020 number: +(match[1] + match[2]),
14021 // sign + magnitude, cast to number
14022 unit: match[3]
14023 };
14024 if (!validUnit(data)) {
14025 throw new ParseError("Invalid unit: '" + data.unit + "'", res);
14026 }
14027 return {
14028 type: "size",
14029 mode: this.mode,
14030 value: data,
14031 isBlank
14032 };
14033 }
14034 /**
14035 * Parses an URL, checking escaped letters and allowed protocols,
14036 * and setting the catcode of % as an active character (as in \hyperref).
14037 */
14038 parseUrlGroup(optional) {
14039 this.gullet.lexer.setCatcode("%", 13);
14040 this.gullet.lexer.setCatcode("~", 12);
14041 var res = this.parseStringGroup("url", optional);
14042 this.gullet.lexer.setCatcode("%", 14);
14043 this.gullet.lexer.setCatcode("~", 13);
14044 if (res == null) {
14045 return null;
14046 }
14047 var url = res.text.replace(/\\([#$%&~_^{}])/g, "$1");
14048 return {
14049 type: "url",
14050 mode: this.mode,
14051 url
14052 };
14053 }
14054 /**
14055 * Parses an argument with the mode specified.
14056 */
14057 parseArgumentGroup(optional, mode) {
14058 var argToken = this.gullet.scanArgument(optional);
14059 if (argToken == null) {
14060 return null;
14061 }
14062 var outerMode = this.mode;
14063 if (mode) {
14064 this.switchMode(mode);
14065 }
14066 this.gullet.beginGroup();
14067 var expression = this.parseExpression(false, "EOF");
14068 this.expect("EOF");
14069 this.gullet.endGroup();
14070 var result = {
14071 type: "ordgroup",
14072 mode: this.mode,
14073 loc: argToken.loc,
14074 body: expression
14075 };
14076 if (mode) {
14077 this.switchMode(outerMode);
14078 }
14079 return result;
14080 }
14081 /**
14082 * Parses an ordinary group, which is either a single nucleus (like "x")
14083 * or an expression in braces (like "{x+y}") or an implicit group, a group
14084 * that starts at the current position, and ends right before a higher explicit
14085 * group ends, or at EOF.
14086 */
14087 parseGroup(name, breakOnTokenText) {
14088 var firstToken = this.fetch();
14089 var text2 = firstToken.text;
14090 var result;
14091 if (text2 === "{" || text2 === "\\begingroup") {
14092 this.consume();
14093 var groupEnd = text2 === "{" ? "}" : "\\endgroup";
14094 this.gullet.beginGroup();
14095 var expression = this.parseExpression(false, groupEnd);
14096 var lastToken = this.fetch();
14097 this.expect(groupEnd);
14098 this.gullet.endGroup();
14099 result = {
14100 type: "ordgroup",
14101 mode: this.mode,
14102 loc: SourceLocation.range(firstToken, lastToken),
14103 body: expression,
14104 // A group formed by \begingroup...\endgroup is a semi-simple group
14105 // which doesn't affect spacing in math mode, i.e., is transparent.
14106 // https://tex.stackexchange.com/questions/1930/when-should-one-
14107 // use-begingroup-instead-of-bgroup
14108 semisimple: text2 === "\\begingroup" || void 0
14109 };
14110 } else {
14111 result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol();
14112 if (result == null && text2[0] === "\\" && !implicitCommands.hasOwnProperty(text2)) {
14113 if (this.settings.throwOnError) {
14114 throw new ParseError("Undefined control sequence: " + text2, firstToken);
14115 }
14116 result = this.formatUnsupportedCmd(text2);
14117 this.consume();
14118 }
14119 }
14120 return result;
14121 }
14122 /**
14123 * Form ligature-like combinations of characters for text mode.
14124 * This includes inputs like "--", "---", "``" and "''".
14125 * The result will simply replace multiple textord nodes with a single
14126 * character in each value by a single textord node having multiple
14127 * characters in its value. The representation is still ASCII source.
14128 * The group will be modified in place.
14129 */
14130 formLigatures(group) {
14131 var n = group.length - 1;
14132 for (var i = 0; i < n; ++i) {
14133 var a = group[i];
14134 var v = a.text;
14135 if (v === "-" && group[i + 1].text === "-") {
14136 if (i + 1 < n && group[i + 2].text === "-") {
14137 group.splice(i, 3, {
14138 type: "textord",
14139 mode: "text",
14140 loc: SourceLocation.range(a, group[i + 2]),
14141 text: "---"
14142 });
14143 n -= 2;
14144 } else {
14145 group.splice(i, 2, {
14146 type: "textord",
14147 mode: "text",
14148 loc: SourceLocation.range(a, group[i + 1]),
14149 text: "--"
14150 });
14151 n -= 1;
14152 }
14153 }
14154 if ((v === "'" || v === "`") && group[i + 1].text === v) {
14155 group.splice(i, 2, {
14156 type: "textord",
14157 mode: "text",
14158 loc: SourceLocation.range(a, group[i + 1]),
14159 text: v + v
14160 });
14161 n -= 1;
14162 }
14163 }
14164 }
14165 /**
14166 * Parse a single symbol out of the string. Here, we handle single character
14167 * symbols and special functions like \verb.
14168 */
14169 parseSymbol() {
14170 var nucleus = this.fetch();
14171 var text2 = nucleus.text;
14172 if (/^\\verb[^a-zA-Z]/.test(text2)) {
14173 this.consume();
14174 var arg = text2.slice(5);
14175 var star = arg.charAt(0) === "*";
14176 if (star) {
14177 arg = arg.slice(1);
14178 }
14179 if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) {
14180 throw new ParseError("\\verb assertion failed --\n please report what input caused this bug");
14181 }
14182 arg = arg.slice(1, -1);
14183 return {
14184 type: "verb",
14185 mode: "text",
14186 body: arg,
14187 star
14188 };
14189 }
14190 if (unicodeSymbols.hasOwnProperty(text2[0]) && !symbols[this.mode][text2[0]]) {
14191 if (this.settings.strict && this.mode === "math") {
14192 this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + text2[0] + '" used in math mode', nucleus);
14193 }
14194 text2 = unicodeSymbols[text2[0]] + text2.slice(1);
14195 }
14196 var match = combiningDiacriticalMarksEndRegex.exec(text2);
14197 if (match) {
14198 text2 = text2.substring(0, match.index);
14199 if (text2 === "i") {
14200 text2 = "ı";
14201 } else if (text2 === "j") {
14202 text2 = "ȷ";
14203 }
14204 }
14205 var symbol;
14206 if (symbols[this.mode][text2]) {
14207 if (this.settings.strict && this.mode === "math" && extraLatin.indexOf(text2) >= 0) {
14208 this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + text2[0] + '" used in math mode', nucleus);
14209 }
14210 var group = symbols[this.mode][text2].group;
14211 var loc = SourceLocation.range(nucleus);
14212 var s;
14213 if (ATOMS.hasOwnProperty(group)) {
14214 var family = group;
14215 s = {
14216 type: "atom",
14217 mode: this.mode,
14218 family,
14219 loc,
14220 text: text2
14221 };
14222 } else {
14223 s = {
14224 type: group,
14225 mode: this.mode,
14226 loc,
14227 text: text2
14228 };
14229 }
14230 symbol = s;
14231 } else if (text2.charCodeAt(0) >= 128) {
14232 if (this.settings.strict) {
14233 if (!supportedCodepoint(text2.charCodeAt(0))) {
14234 this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + text2[0] + '"' + (" (" + text2.charCodeAt(0) + ")"), nucleus);
14235 } else if (this.mode === "math") {
14236 this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + text2[0] + '" used in math mode', nucleus);
14237 }
14238 }
14239 symbol = {
14240 type: "textord",
14241 mode: "text",
14242 loc: SourceLocation.range(nucleus),
14243 text: text2
14244 };
14245 } else {
14246 return null;
14247 }
14248 this.consume();
14249 if (match) {
14250 for (var i = 0; i < match[0].length; i++) {
14251 var accent2 = match[0][i];
14252 if (!unicodeAccents[accent2]) {
14253 throw new ParseError("Unknown accent ' " + accent2 + "'", nucleus);
14254 }
14255 var command = unicodeAccents[accent2][this.mode] || unicodeAccents[accent2].text;
14256 if (!command) {
14257 throw new ParseError("Accent " + accent2 + " unsupported in " + this.mode + " mode", nucleus);
14258 }
14259 symbol = {
14260 type: "accent",
14261 mode: this.mode,
14262 loc: SourceLocation.range(nucleus),
14263 label: command,
14264 isStretchy: false,
14265 isShifty: true,
14266 // $FlowFixMe
14267 base: symbol
14268 };
14269 }
14270 }
14271 return symbol;
14272 }
14273}
14274Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
14275var parseTree = function parseTree2(toParse, settings) {
14276 if (!(typeof toParse === "string" || toParse instanceof String)) {
14277 throw new TypeError("KaTeX can only parse string typed expression");
14278 }
14279 var parser = new Parser(toParse, settings);
14280 delete parser.gullet.macros.current["\\df@tag"];
14281 var tree = parser.parse();
14282 delete parser.gullet.macros.current["\\current@color"];
14283 delete parser.gullet.macros.current["\\color"];
14284 if (parser.gullet.macros.get("\\df@tag")) {
14285 if (!settings.displayMode) {
14286 throw new ParseError("\\tag works only in display equations");
14287 }
14288 tree = [{
14289 type: "tag",
14290 mode: "text",
14291 body: tree,
14292 tag: parser.subparse([new Token("\\df@tag")])
14293 }];
14294 }
14295 return tree;
14296};
14297var render = function render2(expression, baseNode, options) {
14298 baseNode.textContent = "";
14299 var node = renderToDomTree(expression, options).toNode();
14300 baseNode.appendChild(node);
14301};
14302if (typeof document !== "undefined") {
14303 if (document.compatMode !== "CSS1Compat") {
14304 typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype.");
14305 render = function render3() {
14306 throw new ParseError("KaTeX doesn't work in quirks mode.");
14307 };
14308 }
14309}
14310var renderToString = function renderToString2(expression, options) {
14311 var markup = renderToDomTree(expression, options).toMarkup();
14312 return markup;
14313};
14314var generateParseTree = function generateParseTree2(expression, options) {
14315 var settings = new Settings(options);
14316 return parseTree(expression, settings);
14317};
14318var renderError = function renderError2(error, expression, options) {
14319 if (options.throwOnError || !(error instanceof ParseError)) {
14320 throw error;
14321 }
14322 var node = buildCommon.makeSpan(["katex-error"], [new SymbolNode(expression)]);
14323 node.setAttribute("title", error.toString());
14324 node.setAttribute("style", "color:" + options.errorColor);
14325 return node;
14326};
14327var renderToDomTree = function renderToDomTree2(expression, options) {
14328 var settings = new Settings(options);
14329 try {
14330 var tree = parseTree(expression, settings);
14331 return buildTree(tree, expression, settings);
14332 } catch (error) {
14333 return renderError(error, expression, settings);
14334 }
14335};
14336var renderToHTMLTree = function renderToHTMLTree2(expression, options) {
14337 var settings = new Settings(options);
14338 try {
14339 var tree = parseTree(expression, settings);
14340 return buildHTMLTree(tree, expression, settings);
14341 } catch (error) {
14342 return renderError(error, expression, settings);
14343 }
14344};
14345var katex = {
14346 /**
14347 * Current KaTeX version
14348 */
14349 version: "0.16.9",
14350 /**
14351 * Renders the given LaTeX into an HTML+MathML combination, and adds
14352 * it as a child to the specified DOM node.
14353 */
14354 render,
14355 /**
14356 * Renders the given LaTeX into an HTML+MathML combination string,
14357 * for sending to the client.
14358 */
14359 renderToString,
14360 /**
14361 * KaTeX error, usually during parsing.
14362 */
14363 ParseError,
14364 /**
14365 * The shema of Settings
14366 */
14367 SETTINGS_SCHEMA,
14368 /**
14369 * Parses the given LaTeX into KaTeX's internal parse tree structure,
14370 * without rendering to HTML or MathML.
14371 *
14372 * NOTE: This method is not currently recommended for public use.
14373 * The internal tree representation is unstable and is very likely
14374 * to change. Use at your own risk.
14375 */
14376 __parse: generateParseTree,
14377 /**
14378 * Renders the given LaTeX into an HTML+MathML internal DOM tree
14379 * representation, without flattening that representation to a string.
14380 *
14381 * NOTE: This method is not currently recommended for public use.
14382 * The internal tree representation is unstable and is very likely
14383 * to change. Use at your own risk.
14384 */
14385 __renderToDomTree: renderToDomTree,
14386 /**
14387 * Renders the given LaTeX into an HTML internal DOM tree representation,
14388 * without MathML and without flattening that representation to a string.
14389 *
14390 * NOTE: This method is not currently recommended for public use.
14391 * The internal tree representation is unstable and is very likely
14392 * to change. Use at your own risk.
14393 */
14394 __renderToHTMLTree: renderToHTMLTree,
14395 /**
14396 * extends internal font metrics object with a new object
14397 * each key in the new object represents a font name
14398 */
14399 __setFontMetrics: setFontMetrics,
14400 /**
14401 * adds a new symbol to builtin symbols table
14402 */
14403 __defineSymbol: defineSymbol,
14404 /**
14405 * adds a new function to builtin function list,
14406 * which directly produce parse tree elements
14407 * and have their own html/mathml builders
14408 */
14409 __defineFunction: defineFunction,
14410 /**
14411 * adds a new macro to builtin macro list
14412 */
14413 __defineMacro: defineMacro,
14414 /**
14415 * Expose the dom tree node types, which can be useful for type checking nodes.
14416 *
14417 * NOTE: This method is not currently recommended for public use.
14418 * The internal tree representation is unstable and is very likely
14419 * to change. Use at your own risk.
14420 */
14421 __domTree: {
14422 Span,
14423 Anchor,
14424 SymbolNode,
14425 SvgNode,
14426 PathNode,
14427 LineNode
14428 }
14429};
14430export {
14431 katex as default
14432};