KaTeX

KaTeX 修改版, 可以工作与 兼容模式.可能会出现Bug.效果未知

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/34253/224512/KaTeX.js

  1. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.katex = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. "use strict";
  3.  
  4. var _ParseError = require("./src/ParseError");
  5.  
  6. var _ParseError2 = _interopRequireDefault(_ParseError);
  7.  
  8. var _Settings = require("./src/Settings");
  9.  
  10. var _Settings2 = _interopRequireDefault(_Settings);
  11.  
  12. var _buildTree = require("./src/buildTree");
  13.  
  14. var _buildTree2 = _interopRequireDefault(_buildTree);
  15.  
  16. var _parseTree = require("./src/parseTree");
  17.  
  18. var _parseTree2 = _interopRequireDefault(_parseTree);
  19.  
  20. var _utils = require("./src/utils");
  21.  
  22. var _utils2 = _interopRequireDefault(_utils);
  23.  
  24. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  25.  
  26. /**
  27. * Parse and build an expression, and place that expression in the DOM node
  28. * given.
  29. */
  30. var render = function render(expression, baseNode, options) {
  31. _utils2.default.clearNode(baseNode);
  32.  
  33. var settings = new _Settings2.default(options);
  34.  
  35. var tree = (0, _parseTree2.default)(expression, settings);
  36. var node = (0, _buildTree2.default)(tree, expression, settings).toNode();
  37.  
  38. baseNode.appendChild(node);
  39. };
  40.  
  41. // KaTeX's styles don't work properly in quirks mode. Print out an error, and
  42. // disable rendering.
  43. /* eslint no-console:0 */
  44. /**
  45. * This is the main entry point for KaTeX. Here, we expose functions for
  46. * rendering expressions either to DOM nodes or to markup strings.
  47. *
  48. * We also expose the ParseError class to check if errors thrown from KaTeX are
  49. * errors in the expression, or errors in javascript handling.
  50. */
  51. /*///////////////////////////////////
  52. if (typeof document !== "undefined") {
  53. if (document.compatMode !== "CSS1Compat") {
  54. typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your " + "website has a suitable doctype.");
  55.  
  56. render = function render() {
  57. throw new _ParseError2.default("KaTeX doesn't work in quirks mode.");
  58. };
  59. }
  60. }
  61. *///////////////////////////////
  62. /**
  63. * Parse and build an expression, and return the markup for that.
  64. */
  65. var renderToString = function renderToString(expression, options) {
  66. var settings = new _Settings2.default(options);
  67.  
  68. var tree = (0, _parseTree2.default)(expression, settings);
  69. return (0, _buildTree2.default)(tree, expression, settings).toMarkup();
  70. };
  71.  
  72. /**
  73. * Parse an expression and return the parse tree.
  74. */
  75. var generateParseTree = function generateParseTree(expression, options) {
  76. var settings = new _Settings2.default(options);
  77. return (0, _parseTree2.default)(expression, settings);
  78. };
  79.  
  80. module.exports = {
  81. render: render,
  82. renderToString: renderToString,
  83. /**
  84. * NOTE: This method is not currently recommended for public use.
  85. * The internal tree representation is unstable and is very likely
  86. * to change. Use at your own risk.
  87. */
  88. __parse: generateParseTree,
  89. ParseError: _ParseError2.default
  90. };
  91.  
  92. },{"./src/ParseError":84,"./src/Settings":87,"./src/buildTree":94,"./src/parseTree":109,"./src/utils":115}],2:[function(require,module,exports){
  93. module.exports = { "default": require("core-js/library/fn/array/from"), __esModule: true };
  94. },{"core-js/library/fn/array/from":12}],3:[function(require,module,exports){
  95. module.exports = { "default": require("core-js/library/fn/get-iterator"), __esModule: true };
  96. },{"core-js/library/fn/get-iterator":13}],4:[function(require,module,exports){
  97. module.exports = { "default": require("core-js/library/fn/is-iterable"), __esModule: true };
  98. },{"core-js/library/fn/is-iterable":14}],5:[function(require,module,exports){
  99. module.exports = { "default": require("core-js/library/fn/json/stringify"), __esModule: true };
  100. },{"core-js/library/fn/json/stringify":15}],6:[function(require,module,exports){
  101. module.exports = { "default": require("core-js/library/fn/object/define-property"), __esModule: true };
  102. },{"core-js/library/fn/object/define-property":16}],7:[function(require,module,exports){
  103. module.exports = { "default": require("core-js/library/fn/object/freeze"), __esModule: true };
  104. },{"core-js/library/fn/object/freeze":17}],8:[function(require,module,exports){
  105. "use strict";
  106.  
  107. exports.__esModule = true;
  108.  
  109. exports.default = function (instance, Constructor) {
  110. if (!(instance instanceof Constructor)) {
  111. throw new TypeError("Cannot call a class as a function");
  112. }
  113. };
  114. },{}],9:[function(require,module,exports){
  115. "use strict";
  116.  
  117. exports.__esModule = true;
  118.  
  119. var _defineProperty = require("../core-js/object/define-property");
  120.  
  121. var _defineProperty2 = _interopRequireDefault(_defineProperty);
  122.  
  123. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  124.  
  125. exports.default = function () {
  126. function defineProperties(target, props) {
  127. for (var i = 0; i < props.length; i++) {
  128. var descriptor = props[i];
  129. descriptor.enumerable = descriptor.enumerable || false;
  130. descriptor.configurable = true;
  131. if ("value" in descriptor) descriptor.writable = true;
  132. (0, _defineProperty2.default)(target, descriptor.key, descriptor);
  133. }
  134. }
  135.  
  136. return function (Constructor, protoProps, staticProps) {
  137. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  138. if (staticProps) defineProperties(Constructor, staticProps);
  139. return Constructor;
  140. };
  141. }();
  142. },{"../core-js/object/define-property":6}],10:[function(require,module,exports){
  143. "use strict";
  144.  
  145. exports.__esModule = true;
  146.  
  147. var _isIterable2 = require("../core-js/is-iterable");
  148.  
  149. var _isIterable3 = _interopRequireDefault(_isIterable2);
  150.  
  151. var _getIterator2 = require("../core-js/get-iterator");
  152.  
  153. var _getIterator3 = _interopRequireDefault(_getIterator2);
  154.  
  155. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  156.  
  157. exports.default = function () {
  158. function sliceIterator(arr, i) {
  159. var _arr = [];
  160. var _n = true;
  161. var _d = false;
  162. var _e = undefined;
  163.  
  164. try {
  165. for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
  166. _arr.push(_s.value);
  167.  
  168. if (i && _arr.length === i) break;
  169. }
  170. } catch (err) {
  171. _d = true;
  172. _e = err;
  173. } finally {
  174. try {
  175. if (!_n && _i["return"]) _i["return"]();
  176. } finally {
  177. if (_d) throw _e;
  178. }
  179. }
  180.  
  181. return _arr;
  182. }
  183.  
  184. return function (arr, i) {
  185. if (Array.isArray(arr)) {
  186. return arr;
  187. } else if ((0, _isIterable3.default)(Object(arr))) {
  188. return sliceIterator(arr, i);
  189. } else {
  190. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  191. }
  192. };
  193. }();
  194. },{"../core-js/get-iterator":3,"../core-js/is-iterable":4}],11:[function(require,module,exports){
  195. "use strict";
  196.  
  197. exports.__esModule = true;
  198.  
  199. var _from = require("../core-js/array/from");
  200.  
  201. var _from2 = _interopRequireDefault(_from);
  202.  
  203. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  204.  
  205. exports.default = function (arr) {
  206. if (Array.isArray(arr)) {
  207. for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
  208. arr2[i] = arr[i];
  209. }
  210.  
  211. return arr2;
  212. } else {
  213. return (0, _from2.default)(arr);
  214. }
  215. };
  216. },{"../core-js/array/from":2}],12:[function(require,module,exports){
  217. require('../../modules/es6.string.iterator');
  218. require('../../modules/es6.array.from');
  219. module.exports = require('../../modules/_core').Array.from;
  220.  
  221. },{"../../modules/_core":24,"../../modules/es6.array.from":73,"../../modules/es6.string.iterator":77}],13:[function(require,module,exports){
  222. require('../modules/web.dom.iterable');
  223. require('../modules/es6.string.iterator');
  224. module.exports = require('../modules/core.get-iterator');
  225.  
  226. },{"../modules/core.get-iterator":71,"../modules/es6.string.iterator":77,"../modules/web.dom.iterable":78}],14:[function(require,module,exports){
  227. require('../modules/web.dom.iterable');
  228. require('../modules/es6.string.iterator');
  229. module.exports = require('../modules/core.is-iterable');
  230.  
  231. },{"../modules/core.is-iterable":72,"../modules/es6.string.iterator":77,"../modules/web.dom.iterable":78}],15:[function(require,module,exports){
  232. var core = require('../../modules/_core');
  233. var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify });
  234. module.exports = function stringify(it) { // eslint-disable-line no-unused-vars
  235. return $JSON.stringify.apply($JSON, arguments);
  236. };
  237.  
  238. },{"../../modules/_core":24}],16:[function(require,module,exports){
  239. require('../../modules/es6.object.define-property');
  240. var $Object = require('../../modules/_core').Object;
  241. module.exports = function defineProperty(it, key, desc) {
  242. return $Object.defineProperty(it, key, desc);
  243. };
  244.  
  245. },{"../../modules/_core":24,"../../modules/es6.object.define-property":75}],17:[function(require,module,exports){
  246. require('../../modules/es6.object.freeze');
  247. module.exports = require('../../modules/_core').Object.freeze;
  248.  
  249. },{"../../modules/_core":24,"../../modules/es6.object.freeze":76}],18:[function(require,module,exports){
  250. module.exports = function (it) {
  251. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  252. return it;
  253. };
  254.  
  255. },{}],19:[function(require,module,exports){
  256. module.exports = function () { /* empty */ };
  257.  
  258. },{}],20:[function(require,module,exports){
  259. var isObject = require('./_is-object');
  260. module.exports = function (it) {
  261. if (!isObject(it)) throw TypeError(it + ' is not an object!');
  262. return it;
  263. };
  264.  
  265. },{"./_is-object":40}],21:[function(require,module,exports){
  266. // false -> Array#indexOf
  267. // true -> Array#includes
  268. var toIObject = require('./_to-iobject');
  269. var toLength = require('./_to-length');
  270. var toAbsoluteIndex = require('./_to-absolute-index');
  271. module.exports = function (IS_INCLUDES) {
  272. return function ($this, el, fromIndex) {
  273. var O = toIObject($this);
  274. var length = toLength(O.length);
  275. var index = toAbsoluteIndex(fromIndex, length);
  276. var value;
  277. // Array#includes uses SameValueZero equality algorithm
  278. // eslint-disable-next-line no-self-compare
  279. if (IS_INCLUDES && el != el) while (length > index) {
  280. value = O[index++];
  281. // eslint-disable-next-line no-self-compare
  282. if (value != value) return true;
  283. // Array#indexOf ignores holes, Array#includes - not
  284. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  285. if (O[index] === el) return IS_INCLUDES || index || 0;
  286. } return !IS_INCLUDES && -1;
  287. };
  288. };
  289.  
  290. },{"./_to-absolute-index":62,"./_to-iobject":64,"./_to-length":65}],22:[function(require,module,exports){
  291. // getting tag from 19.1.3.6 Object.prototype.toString()
  292. var cof = require('./_cof');
  293. var TAG = require('./_wks')('toStringTag');
  294. // ES3 wrong here
  295. var ARG = cof(function () { return arguments; }()) == 'Arguments';
  296.  
  297. // fallback for IE11 Script Access Denied error
  298. var tryGet = function (it, key) {
  299. try {
  300. return it[key];
  301. } catch (e) { /* empty */ }
  302. };
  303.  
  304. module.exports = function (it) {
  305. var O, T, B;
  306. return it === undefined ? 'Undefined' : it === null ? 'Null'
  307. // @@toStringTag case
  308. : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
  309. // builtinTag case
  310. : ARG ? cof(O)
  311. // ES3 arguments fallback
  312. : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  313. };
  314.  
  315. },{"./_cof":23,"./_wks":69}],23:[function(require,module,exports){
  316. var toString = {}.toString;
  317.  
  318. module.exports = function (it) {
  319. return toString.call(it).slice(8, -1);
  320. };
  321.  
  322. },{}],24:[function(require,module,exports){
  323. var core = module.exports = { version: '2.5.1' };
  324. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  325.  
  326. },{}],25:[function(require,module,exports){
  327. 'use strict';
  328. var $defineProperty = require('./_object-dp');
  329. var createDesc = require('./_property-desc');
  330.  
  331. module.exports = function (object, index, value) {
  332. if (index in object) $defineProperty.f(object, index, createDesc(0, value));
  333. else object[index] = value;
  334. };
  335.  
  336. },{"./_object-dp":50,"./_property-desc":56}],26:[function(require,module,exports){
  337. // optional / simple context binding
  338. var aFunction = require('./_a-function');
  339. module.exports = function (fn, that, length) {
  340. aFunction(fn);
  341. if (that === undefined) return fn;
  342. switch (length) {
  343. case 1: return function (a) {
  344. return fn.call(that, a);
  345. };
  346. case 2: return function (a, b) {
  347. return fn.call(that, a, b);
  348. };
  349. case 3: return function (a, b, c) {
  350. return fn.call(that, a, b, c);
  351. };
  352. }
  353. return function (/* ...args */) {
  354. return fn.apply(that, arguments);
  355. };
  356. };
  357.  
  358. },{"./_a-function":18}],27:[function(require,module,exports){
  359. // 7.2.1 RequireObjectCoercible(argument)
  360. module.exports = function (it) {
  361. if (it == undefined) throw TypeError("Can't call method on " + it);
  362. return it;
  363. };
  364.  
  365. },{}],28:[function(require,module,exports){
  366. // Thank's IE8 for his funny defineProperty
  367. module.exports = !require('./_fails')(function () {
  368. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  369. });
  370.  
  371. },{"./_fails":32}],29:[function(require,module,exports){
  372. var isObject = require('./_is-object');
  373. var document = require('./_global').document;
  374. // typeof document.createElement is 'object' in old IE
  375. var is = isObject(document) && isObject(document.createElement);
  376. module.exports = function (it) {
  377. return is ? document.createElement(it) : {};
  378. };
  379.  
  380. },{"./_global":33,"./_is-object":40}],30:[function(require,module,exports){
  381. // IE 8- don't enum bug keys
  382. module.exports = (
  383. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  384. ).split(',');
  385.  
  386. },{}],31:[function(require,module,exports){
  387. var global = require('./_global');
  388. var core = require('./_core');
  389. var ctx = require('./_ctx');
  390. var hide = require('./_hide');
  391. var PROTOTYPE = 'prototype';
  392.  
  393. var $export = function (type, name, source) {
  394. var IS_FORCED = type & $export.F;
  395. var IS_GLOBAL = type & $export.G;
  396. var IS_STATIC = type & $export.S;
  397. var IS_PROTO = type & $export.P;
  398. var IS_BIND = type & $export.B;
  399. var IS_WRAP = type & $export.W;
  400. var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
  401. var expProto = exports[PROTOTYPE];
  402. var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
  403. var key, own, out;
  404. if (IS_GLOBAL) source = name;
  405. for (key in source) {
  406. // contains in native
  407. own = !IS_FORCED && target && target[key] !== undefined;
  408. if (own && key in exports) continue;
  409. // export native or passed
  410. out = own ? target[key] : source[key];
  411. // prevent global pollution for namespaces
  412. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  413. // bind timers to global for call from export context
  414. : IS_BIND && own ? ctx(out, global)
  415. // wrap global constructors for prevent change them in library
  416. : IS_WRAP && target[key] == out ? (function (C) {
  417. var F = function (a, b, c) {
  418. if (this instanceof C) {
  419. switch (arguments.length) {
  420. case 0: return new C();
  421. case 1: return new C(a);
  422. case 2: return new C(a, b);
  423. } return new C(a, b, c);
  424. } return C.apply(this, arguments);
  425. };
  426. F[PROTOTYPE] = C[PROTOTYPE];
  427. return F;
  428. // make static versions for prototype methods
  429. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  430. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  431. if (IS_PROTO) {
  432. (exports.virtual || (exports.virtual = {}))[key] = out;
  433. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  434. if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
  435. }
  436. }
  437. };
  438. // type bitmap
  439. $export.F = 1; // forced
  440. $export.G = 2; // global
  441. $export.S = 4; // static
  442. $export.P = 8; // proto
  443. $export.B = 16; // bind
  444. $export.W = 32; // wrap
  445. $export.U = 64; // safe
  446. $export.R = 128; // real proto method for `library`
  447. module.exports = $export;
  448.  
  449. },{"./_core":24,"./_ctx":26,"./_global":33,"./_hide":35}],32:[function(require,module,exports){
  450. module.exports = function (exec) {
  451. try {
  452. return !!exec();
  453. } catch (e) {
  454. return true;
  455. }
  456. };
  457.  
  458. },{}],33:[function(require,module,exports){
  459. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  460. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  461. ? window : typeof self != 'undefined' && self.Math == Math ? self
  462. // eslint-disable-next-line no-new-func
  463. : Function('return this')();
  464. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  465.  
  466. },{}],34:[function(require,module,exports){
  467. var hasOwnProperty = {}.hasOwnProperty;
  468. module.exports = function (it, key) {
  469. return hasOwnProperty.call(it, key);
  470. };
  471.  
  472. },{}],35:[function(require,module,exports){
  473. var dP = require('./_object-dp');
  474. var createDesc = require('./_property-desc');
  475. module.exports = require('./_descriptors') ? function (object, key, value) {
  476. return dP.f(object, key, createDesc(1, value));
  477. } : function (object, key, value) {
  478. object[key] = value;
  479. return object;
  480. };
  481.  
  482. },{"./_descriptors":28,"./_object-dp":50,"./_property-desc":56}],36:[function(require,module,exports){
  483. var document = require('./_global').document;
  484. module.exports = document && document.documentElement;
  485.  
  486. },{"./_global":33}],37:[function(require,module,exports){
  487. module.exports = !require('./_descriptors') && !require('./_fails')(function () {
  488. return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
  489. });
  490.  
  491. },{"./_descriptors":28,"./_dom-create":29,"./_fails":32}],38:[function(require,module,exports){
  492. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  493. var cof = require('./_cof');
  494. // eslint-disable-next-line no-prototype-builtins
  495. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  496. return cof(it) == 'String' ? it.split('') : Object(it);
  497. };
  498.  
  499. },{"./_cof":23}],39:[function(require,module,exports){
  500. // check on default Array iterator
  501. var Iterators = require('./_iterators');
  502. var ITERATOR = require('./_wks')('iterator');
  503. var ArrayProto = Array.prototype;
  504.  
  505. module.exports = function (it) {
  506. return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
  507. };
  508.  
  509. },{"./_iterators":46,"./_wks":69}],40:[function(require,module,exports){
  510. module.exports = function (it) {
  511. return typeof it === 'object' ? it !== null : typeof it === 'function';
  512. };
  513.  
  514. },{}],41:[function(require,module,exports){
  515. // call something on iterator step with safe closing on error
  516. var anObject = require('./_an-object');
  517. module.exports = function (iterator, fn, value, entries) {
  518. try {
  519. return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  520. // 7.4.6 IteratorClose(iterator, completion)
  521. } catch (e) {
  522. var ret = iterator['return'];
  523. if (ret !== undefined) anObject(ret.call(iterator));
  524. throw e;
  525. }
  526. };
  527.  
  528. },{"./_an-object":20}],42:[function(require,module,exports){
  529. 'use strict';
  530. var create = require('./_object-create');
  531. var descriptor = require('./_property-desc');
  532. var setToStringTag = require('./_set-to-string-tag');
  533. var IteratorPrototype = {};
  534.  
  535. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  536. require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });
  537.  
  538. module.exports = function (Constructor, NAME, next) {
  539. Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
  540. setToStringTag(Constructor, NAME + ' Iterator');
  541. };
  542.  
  543. },{"./_hide":35,"./_object-create":49,"./_property-desc":56,"./_set-to-string-tag":58,"./_wks":69}],43:[function(require,module,exports){
  544. 'use strict';
  545. var LIBRARY = require('./_library');
  546. var $export = require('./_export');
  547. var redefine = require('./_redefine');
  548. var hide = require('./_hide');
  549. var has = require('./_has');
  550. var Iterators = require('./_iterators');
  551. var $iterCreate = require('./_iter-create');
  552. var setToStringTag = require('./_set-to-string-tag');
  553. var getPrototypeOf = require('./_object-gpo');
  554. var ITERATOR = require('./_wks')('iterator');
  555. var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
  556. var FF_ITERATOR = '@@iterator';
  557. var KEYS = 'keys';
  558. var VALUES = 'values';
  559.  
  560. var returnThis = function () { return this; };
  561.  
  562. module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  563. $iterCreate(Constructor, NAME, next);
  564. var getMethod = function (kind) {
  565. if (!BUGGY && kind in proto) return proto[kind];
  566. switch (kind) {
  567. case KEYS: return function keys() { return new Constructor(this, kind); };
  568. case VALUES: return function values() { return new Constructor(this, kind); };
  569. } return function entries() { return new Constructor(this, kind); };
  570. };
  571. var TAG = NAME + ' Iterator';
  572. var DEF_VALUES = DEFAULT == VALUES;
  573. var VALUES_BUG = false;
  574. var proto = Base.prototype;
  575. var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  576. var $default = $native || getMethod(DEFAULT);
  577. var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  578. var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  579. var methods, key, IteratorPrototype;
  580. // Fix native
  581. if ($anyNative) {
  582. IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
  583. if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
  584. // Set @@toStringTag to native iterators
  585. setToStringTag(IteratorPrototype, TAG, true);
  586. // fix for some old engines
  587. if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
  588. }
  589. }
  590. // fix Array#{values, @@iterator}.name in V8 / FF
  591. if (DEF_VALUES && $native && $native.name !== VALUES) {
  592. VALUES_BUG = true;
  593. $default = function values() { return $native.call(this); };
  594. }
  595. // Define iterator
  596. if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
  597. hide(proto, ITERATOR, $default);
  598. }
  599. // Plug for library
  600. Iterators[NAME] = $default;
  601. Iterators[TAG] = returnThis;
  602. if (DEFAULT) {
  603. methods = {
  604. values: DEF_VALUES ? $default : getMethod(VALUES),
  605. keys: IS_SET ? $default : getMethod(KEYS),
  606. entries: $entries
  607. };
  608. if (FORCED) for (key in methods) {
  609. if (!(key in proto)) redefine(proto, key, methods[key]);
  610. } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  611. }
  612. return methods;
  613. };
  614.  
  615. },{"./_export":31,"./_has":34,"./_hide":35,"./_iter-create":42,"./_iterators":46,"./_library":47,"./_object-gpo":52,"./_redefine":57,"./_set-to-string-tag":58,"./_wks":69}],44:[function(require,module,exports){
  616. var ITERATOR = require('./_wks')('iterator');
  617. var SAFE_CLOSING = false;
  618.  
  619. try {
  620. var riter = [7][ITERATOR]();
  621. riter['return'] = function () { SAFE_CLOSING = true; };
  622. // eslint-disable-next-line no-throw-literal
  623. Array.from(riter, function () { throw 2; });
  624. } catch (e) { /* empty */ }
  625.  
  626. module.exports = function (exec, skipClosing) {
  627. if (!skipClosing && !SAFE_CLOSING) return false;
  628. var safe = false;
  629. try {
  630. var arr = [7];
  631. var iter = arr[ITERATOR]();
  632. iter.next = function () { return { done: safe = true }; };
  633. arr[ITERATOR] = function () { return iter; };
  634. exec(arr);
  635. } catch (e) { /* empty */ }
  636. return safe;
  637. };
  638.  
  639. },{"./_wks":69}],45:[function(require,module,exports){
  640. module.exports = function (done, value) {
  641. return { value: value, done: !!done };
  642. };
  643.  
  644. },{}],46:[function(require,module,exports){
  645. module.exports = {};
  646.  
  647. },{}],47:[function(require,module,exports){
  648. module.exports = true;
  649.  
  650. },{}],48:[function(require,module,exports){
  651. var META = require('./_uid')('meta');
  652. var isObject = require('./_is-object');
  653. var has = require('./_has');
  654. var setDesc = require('./_object-dp').f;
  655. var id = 0;
  656. var isExtensible = Object.isExtensible || function () {
  657. return true;
  658. };
  659. var FREEZE = !require('./_fails')(function () {
  660. return isExtensible(Object.preventExtensions({}));
  661. });
  662. var setMeta = function (it) {
  663. setDesc(it, META, { value: {
  664. i: 'O' + ++id, // object ID
  665. w: {} // weak collections IDs
  666. } });
  667. };
  668. var fastKey = function (it, create) {
  669. // return primitive with prefix
  670. if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  671. if (!has(it, META)) {
  672. // can't set metadata to uncaught frozen object
  673. if (!isExtensible(it)) return 'F';
  674. // not necessary to add metadata
  675. if (!create) return 'E';
  676. // add missing metadata
  677. setMeta(it);
  678. // return object ID
  679. } return it[META].i;
  680. };
  681. var getWeak = function (it, create) {
  682. if (!has(it, META)) {
  683. // can't set metadata to uncaught frozen object
  684. if (!isExtensible(it)) return true;
  685. // not necessary to add metadata
  686. if (!create) return false;
  687. // add missing metadata
  688. setMeta(it);
  689. // return hash weak collections IDs
  690. } return it[META].w;
  691. };
  692. // add metadata on freeze-family methods calling
  693. var onFreeze = function (it) {
  694. if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
  695. return it;
  696. };
  697. var meta = module.exports = {
  698. KEY: META,
  699. NEED: false,
  700. fastKey: fastKey,
  701. getWeak: getWeak,
  702. onFreeze: onFreeze
  703. };
  704.  
  705. },{"./_fails":32,"./_has":34,"./_is-object":40,"./_object-dp":50,"./_uid":68}],49:[function(require,module,exports){
  706. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  707. var anObject = require('./_an-object');
  708. var dPs = require('./_object-dps');
  709. var enumBugKeys = require('./_enum-bug-keys');
  710. var IE_PROTO = require('./_shared-key')('IE_PROTO');
  711. var Empty = function () { /* empty */ };
  712. var PROTOTYPE = 'prototype';
  713.  
  714. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  715. var createDict = function () {
  716. // Thrash, waste and sodomy: IE GC bug
  717. var iframe = require('./_dom-create')('iframe');
  718. var i = enumBugKeys.length;
  719. var lt = '<';
  720. var gt = '>';
  721. var iframeDocument;
  722. iframe.style.display = 'none';
  723. require('./_html').appendChild(iframe);
  724. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  725. // createDict = iframe.contentWindow.Object;
  726. // html.removeChild(iframe);
  727. iframeDocument = iframe.contentWindow.document;
  728. iframeDocument.open();
  729. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  730. iframeDocument.close();
  731. createDict = iframeDocument.F;
  732. while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
  733. return createDict();
  734. };
  735.  
  736. module.exports = Object.create || function create(O, Properties) {
  737. var result;
  738. if (O !== null) {
  739. Empty[PROTOTYPE] = anObject(O);
  740. result = new Empty();
  741. Empty[PROTOTYPE] = null;
  742. // add "__proto__" for Object.getPrototypeOf polyfill
  743. result[IE_PROTO] = O;
  744. } else result = createDict();
  745. return Properties === undefined ? result : dPs(result, Properties);
  746. };
  747.  
  748. },{"./_an-object":20,"./_dom-create":29,"./_enum-bug-keys":30,"./_html":36,"./_object-dps":51,"./_shared-key":59}],50:[function(require,module,exports){
  749. var anObject = require('./_an-object');
  750. var IE8_DOM_DEFINE = require('./_ie8-dom-define');
  751. var toPrimitive = require('./_to-primitive');
  752. var dP = Object.defineProperty;
  753.  
  754. exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  755. anObject(O);
  756. P = toPrimitive(P, true);
  757. anObject(Attributes);
  758. if (IE8_DOM_DEFINE) try {
  759. return dP(O, P, Attributes);
  760. } catch (e) { /* empty */ }
  761. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  762. if ('value' in Attributes) O[P] = Attributes.value;
  763. return O;
  764. };
  765.  
  766. },{"./_an-object":20,"./_descriptors":28,"./_ie8-dom-define":37,"./_to-primitive":67}],51:[function(require,module,exports){
  767. var dP = require('./_object-dp');
  768. var anObject = require('./_an-object');
  769. var getKeys = require('./_object-keys');
  770.  
  771. module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {
  772. anObject(O);
  773. var keys = getKeys(Properties);
  774. var length = keys.length;
  775. var i = 0;
  776. var P;
  777. while (length > i) dP.f(O, P = keys[i++], Properties[P]);
  778. return O;
  779. };
  780.  
  781. },{"./_an-object":20,"./_descriptors":28,"./_object-dp":50,"./_object-keys":54}],52:[function(require,module,exports){
  782. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  783. var has = require('./_has');
  784. var toObject = require('./_to-object');
  785. var IE_PROTO = require('./_shared-key')('IE_PROTO');
  786. var ObjectProto = Object.prototype;
  787.  
  788. module.exports = Object.getPrototypeOf || function (O) {
  789. O = toObject(O);
  790. if (has(O, IE_PROTO)) return O[IE_PROTO];
  791. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  792. return O.constructor.prototype;
  793. } return O instanceof Object ? ObjectProto : null;
  794. };
  795.  
  796. },{"./_has":34,"./_shared-key":59,"./_to-object":66}],53:[function(require,module,exports){
  797. var has = require('./_has');
  798. var toIObject = require('./_to-iobject');
  799. var arrayIndexOf = require('./_array-includes')(false);
  800. var IE_PROTO = require('./_shared-key')('IE_PROTO');
  801.  
  802. module.exports = function (object, names) {
  803. var O = toIObject(object);
  804. var i = 0;
  805. var result = [];
  806. var key;
  807. for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
  808. // Don't enum bug & hidden keys
  809. while (names.length > i) if (has(O, key = names[i++])) {
  810. ~arrayIndexOf(result, key) || result.push(key);
  811. }
  812. return result;
  813. };
  814.  
  815. },{"./_array-includes":21,"./_has":34,"./_shared-key":59,"./_to-iobject":64}],54:[function(require,module,exports){
  816. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  817. var $keys = require('./_object-keys-internal');
  818. var enumBugKeys = require('./_enum-bug-keys');
  819.  
  820. module.exports = Object.keys || function keys(O) {
  821. return $keys(O, enumBugKeys);
  822. };
  823.  
  824. },{"./_enum-bug-keys":30,"./_object-keys-internal":53}],55:[function(require,module,exports){
  825. // most Object methods by ES6 should accept primitives
  826. var $export = require('./_export');
  827. var core = require('./_core');
  828. var fails = require('./_fails');
  829. module.exports = function (KEY, exec) {
  830. var fn = (core.Object || {})[KEY] || Object[KEY];
  831. var exp = {};
  832. exp[KEY] = exec(fn);
  833. $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
  834. };
  835.  
  836. },{"./_core":24,"./_export":31,"./_fails":32}],56:[function(require,module,exports){
  837. module.exports = function (bitmap, value) {
  838. return {
  839. enumerable: !(bitmap & 1),
  840. configurable: !(bitmap & 2),
  841. writable: !(bitmap & 4),
  842. value: value
  843. };
  844. };
  845.  
  846. },{}],57:[function(require,module,exports){
  847. module.exports = require('./_hide');
  848.  
  849. },{"./_hide":35}],58:[function(require,module,exports){
  850. var def = require('./_object-dp').f;
  851. var has = require('./_has');
  852. var TAG = require('./_wks')('toStringTag');
  853.  
  854. module.exports = function (it, tag, stat) {
  855. if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
  856. };
  857.  
  858. },{"./_has":34,"./_object-dp":50,"./_wks":69}],59:[function(require,module,exports){
  859. var shared = require('./_shared')('keys');
  860. var uid = require('./_uid');
  861. module.exports = function (key) {
  862. return shared[key] || (shared[key] = uid(key));
  863. };
  864.  
  865. },{"./_shared":60,"./_uid":68}],60:[function(require,module,exports){
  866. var global = require('./_global');
  867. var SHARED = '__core-js_shared__';
  868. var store = global[SHARED] || (global[SHARED] = {});
  869. module.exports = function (key) {
  870. return store[key] || (store[key] = {});
  871. };
  872.  
  873. },{"./_global":33}],61:[function(require,module,exports){
  874. var toInteger = require('./_to-integer');
  875. var defined = require('./_defined');
  876. // true -> String#at
  877. // false -> String#codePointAt
  878. module.exports = function (TO_STRING) {
  879. return function (that, pos) {
  880. var s = String(defined(that));
  881. var i = toInteger(pos);
  882. var l = s.length;
  883. var a, b;
  884. if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
  885. a = s.charCodeAt(i);
  886. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  887. ? TO_STRING ? s.charAt(i) : a
  888. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  889. };
  890. };
  891.  
  892. },{"./_defined":27,"./_to-integer":63}],62:[function(require,module,exports){
  893. var toInteger = require('./_to-integer');
  894. var max = Math.max;
  895. var min = Math.min;
  896. module.exports = function (index, length) {
  897. index = toInteger(index);
  898. return index < 0 ? max(index + length, 0) : min(index, length);
  899. };
  900.  
  901. },{"./_to-integer":63}],63:[function(require,module,exports){
  902. // 7.1.4 ToInteger
  903. var ceil = Math.ceil;
  904. var floor = Math.floor;
  905. module.exports = function (it) {
  906. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  907. };
  908.  
  909. },{}],64:[function(require,module,exports){
  910. // to indexed object, toObject with fallback for non-array-like ES3 strings
  911. var IObject = require('./_iobject');
  912. var defined = require('./_defined');
  913. module.exports = function (it) {
  914. return IObject(defined(it));
  915. };
  916.  
  917. },{"./_defined":27,"./_iobject":38}],65:[function(require,module,exports){
  918. // 7.1.15 ToLength
  919. var toInteger = require('./_to-integer');
  920. var min = Math.min;
  921. module.exports = function (it) {
  922. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  923. };
  924.  
  925. },{"./_to-integer":63}],66:[function(require,module,exports){
  926. // 7.1.13 ToObject(argument)
  927. var defined = require('./_defined');
  928. module.exports = function (it) {
  929. return Object(defined(it));
  930. };
  931.  
  932. },{"./_defined":27}],67:[function(require,module,exports){
  933. // 7.1.1 ToPrimitive(input [, PreferredType])
  934. var isObject = require('./_is-object');
  935. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  936. // and the second argument - flag - preferred type is a string
  937. module.exports = function (it, S) {
  938. if (!isObject(it)) return it;
  939. var fn, val;
  940. if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  941. if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  942. if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  943. throw TypeError("Can't convert object to primitive value");
  944. };
  945.  
  946. },{"./_is-object":40}],68:[function(require,module,exports){
  947. var id = 0;
  948. var px = Math.random();
  949. module.exports = function (key) {
  950. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  951. };
  952.  
  953. },{}],69:[function(require,module,exports){
  954. var store = require('./_shared')('wks');
  955. var uid = require('./_uid');
  956. var Symbol = require('./_global').Symbol;
  957. var USE_SYMBOL = typeof Symbol == 'function';
  958.  
  959. var $exports = module.exports = function (name) {
  960. return store[name] || (store[name] =
  961. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
  962. };
  963.  
  964. $exports.store = store;
  965.  
  966. },{"./_global":33,"./_shared":60,"./_uid":68}],70:[function(require,module,exports){
  967. var classof = require('./_classof');
  968. var ITERATOR = require('./_wks')('iterator');
  969. var Iterators = require('./_iterators');
  970. module.exports = require('./_core').getIteratorMethod = function (it) {
  971. if (it != undefined) return it[ITERATOR]
  972. || it['@@iterator']
  973. || Iterators[classof(it)];
  974. };
  975.  
  976. },{"./_classof":22,"./_core":24,"./_iterators":46,"./_wks":69}],71:[function(require,module,exports){
  977. var anObject = require('./_an-object');
  978. var get = require('./core.get-iterator-method');
  979. module.exports = require('./_core').getIterator = function (it) {
  980. var iterFn = get(it);
  981. if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
  982. return anObject(iterFn.call(it));
  983. };
  984.  
  985. },{"./_an-object":20,"./_core":24,"./core.get-iterator-method":70}],72:[function(require,module,exports){
  986. var classof = require('./_classof');
  987. var ITERATOR = require('./_wks')('iterator');
  988. var Iterators = require('./_iterators');
  989. module.exports = require('./_core').isIterable = function (it) {
  990. var O = Object(it);
  991. return O[ITERATOR] !== undefined
  992. || '@@iterator' in O
  993. // eslint-disable-next-line no-prototype-builtins
  994. || Iterators.hasOwnProperty(classof(O));
  995. };
  996.  
  997. },{"./_classof":22,"./_core":24,"./_iterators":46,"./_wks":69}],73:[function(require,module,exports){
  998. 'use strict';
  999. var ctx = require('./_ctx');
  1000. var $export = require('./_export');
  1001. var toObject = require('./_to-object');
  1002. var call = require('./_iter-call');
  1003. var isArrayIter = require('./_is-array-iter');
  1004. var toLength = require('./_to-length');
  1005. var createProperty = require('./_create-property');
  1006. var getIterFn = require('./core.get-iterator-method');
  1007.  
  1008. $export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', {
  1009. // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
  1010. from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
  1011. var O = toObject(arrayLike);
  1012. var C = typeof this == 'function' ? this : Array;
  1013. var aLen = arguments.length;
  1014. var mapfn = aLen > 1 ? arguments[1] : undefined;
  1015. var mapping = mapfn !== undefined;
  1016. var index = 0;
  1017. var iterFn = getIterFn(O);
  1018. var length, result, step, iterator;
  1019. if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
  1020. // if object isn't iterable or it's array with default iterator - use simple case
  1021. if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
  1022. for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
  1023. createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
  1024. }
  1025. } else {
  1026. length = toLength(O.length);
  1027. for (result = new C(length); length > index; index++) {
  1028. createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
  1029. }
  1030. }
  1031. result.length = index;
  1032. return result;
  1033. }
  1034. });
  1035.  
  1036. },{"./_create-property":25,"./_ctx":26,"./_export":31,"./_is-array-iter":39,"./_iter-call":41,"./_iter-detect":44,"./_to-length":65,"./_to-object":66,"./core.get-iterator-method":70}],74:[function(require,module,exports){
  1037. 'use strict';
  1038. var addToUnscopables = require('./_add-to-unscopables');
  1039. var step = require('./_iter-step');
  1040. var Iterators = require('./_iterators');
  1041. var toIObject = require('./_to-iobject');
  1042.  
  1043. // 22.1.3.4 Array.prototype.entries()
  1044. // 22.1.3.13 Array.prototype.keys()
  1045. // 22.1.3.29 Array.prototype.values()
  1046. // 22.1.3.30 Array.prototype[@@iterator]()
  1047. module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {
  1048. this._t = toIObject(iterated); // target
  1049. this._i = 0; // next index
  1050. this._k = kind; // kind
  1051. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  1052. }, function () {
  1053. var O = this._t;
  1054. var kind = this._k;
  1055. var index = this._i++;
  1056. if (!O || index >= O.length) {
  1057. this._t = undefined;
  1058. return step(1);
  1059. }
  1060. if (kind == 'keys') return step(0, index);
  1061. if (kind == 'values') return step(0, O[index]);
  1062. return step(0, [index, O[index]]);
  1063. }, 'values');
  1064.  
  1065. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  1066. Iterators.Arguments = Iterators.Array;
  1067.  
  1068. addToUnscopables('keys');
  1069. addToUnscopables('values');
  1070. addToUnscopables('entries');
  1071.  
  1072. },{"./_add-to-unscopables":19,"./_iter-define":43,"./_iter-step":45,"./_iterators":46,"./_to-iobject":64}],75:[function(require,module,exports){
  1073. var $export = require('./_export');
  1074. // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
  1075. $export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f });
  1076.  
  1077. },{"./_descriptors":28,"./_export":31,"./_object-dp":50}],76:[function(require,module,exports){
  1078. // 19.1.2.5 Object.freeze(O)
  1079. var isObject = require('./_is-object');
  1080. var meta = require('./_meta').onFreeze;
  1081.  
  1082. require('./_object-sap')('freeze', function ($freeze) {
  1083. return function freeze(it) {
  1084. return $freeze && isObject(it) ? $freeze(meta(it)) : it;
  1085. };
  1086. });
  1087.  
  1088. },{"./_is-object":40,"./_meta":48,"./_object-sap":55}],77:[function(require,module,exports){
  1089. 'use strict';
  1090. var $at = require('./_string-at')(true);
  1091.  
  1092. // 21.1.3.27 String.prototype[@@iterator]()
  1093. require('./_iter-define')(String, 'String', function (iterated) {
  1094. this._t = String(iterated); // target
  1095. this._i = 0; // next index
  1096. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  1097. }, function () {
  1098. var O = this._t;
  1099. var index = this._i;
  1100. var point;
  1101. if (index >= O.length) return { value: undefined, done: true };
  1102. point = $at(O, index);
  1103. this._i += point.length;
  1104. return { value: point, done: false };
  1105. });
  1106.  
  1107. },{"./_iter-define":43,"./_string-at":61}],78:[function(require,module,exports){
  1108. require('./es6.array.iterator');
  1109. var global = require('./_global');
  1110. var hide = require('./_hide');
  1111. var Iterators = require('./_iterators');
  1112. var TO_STRING_TAG = require('./_wks')('toStringTag');
  1113.  
  1114. var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
  1115. 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
  1116. 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
  1117. 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
  1118. 'TextTrackList,TouchList').split(',');
  1119.  
  1120. for (var i = 0; i < DOMIterables.length; i++) {
  1121. var NAME = DOMIterables[i];
  1122. var Collection = global[NAME];
  1123. var proto = Collection && Collection.prototype;
  1124. if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
  1125. Iterators[NAME] = Iterators.Array;
  1126. }
  1127.  
  1128. },{"./_global":33,"./_hide":35,"./_iterators":46,"./_wks":69,"./es6.array.iterator":74}],79:[function(require,module,exports){
  1129. function getRelocatable(re) {
  1130. // In the future, this could use a WeakMap instead of an expando.
  1131. if (!re.__matchAtRelocatable) {
  1132. // Disjunctions are the lowest-precedence operator, so we can make any
  1133. // pattern match the empty string by appending `|()` to it:
  1134. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns
  1135. var source = re.source + '|()';
  1136.  
  1137. // We always make the new regex global.
  1138. var flags = 'g' + (re.ignoreCase ? 'i' : '') + (re.multiline ? 'm' : '') + (re.unicode ? 'u' : '')
  1139. // sticky (/.../y) doesn't make sense in conjunction with our relocation
  1140. // logic, so we ignore it here.
  1141. ;
  1142.  
  1143. re.__matchAtRelocatable = new RegExp(source, flags);
  1144. }
  1145. return re.__matchAtRelocatable;
  1146. }
  1147.  
  1148. function matchAt(re, str, pos) {
  1149. if (re.global || re.sticky) {
  1150. throw new Error('matchAt(...): Only non-global regexes are supported');
  1151. }
  1152. var reloc = getRelocatable(re);
  1153. reloc.lastIndex = pos;
  1154. var match = reloc.exec(str);
  1155. // Last capturing group is our sentinel that indicates whether the regex
  1156. // matched at the given location.
  1157. if (match[match.length - 1] == null) {
  1158. // Original regex matched.
  1159. match.length = match.length - 1;
  1160. return match;
  1161. } else {
  1162. return null;
  1163. }
  1164. }
  1165.  
  1166. module.exports = matchAt;
  1167. },{}],80:[function(require,module,exports){
  1168. /*
  1169. object-assign
  1170. (c) Sindre Sorhus
  1171. @license MIT
  1172. */
  1173.  
  1174. 'use strict';
  1175. /* eslint-disable no-unused-vars */
  1176. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  1177. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1178. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  1179.  
  1180. function toObject(val) {
  1181. if (val === null || val === undefined) {
  1182. throw new TypeError('Object.assign cannot be called with null or undefined');
  1183. }
  1184.  
  1185. return Object(val);
  1186. }
  1187.  
  1188. function shouldUseNative() {
  1189. try {
  1190. if (!Object.assign) {
  1191. return false;
  1192. }
  1193.  
  1194. // Detect buggy property enumeration order in older V8 versions.
  1195.  
  1196. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  1197. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  1198. test1[5] = 'de';
  1199. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  1200. return false;
  1201. }
  1202.  
  1203. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  1204. var test2 = {};
  1205. for (var i = 0; i < 10; i++) {
  1206. test2['_' + String.fromCharCode(i)] = i;
  1207. }
  1208. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  1209. return test2[n];
  1210. });
  1211. if (order2.join('') !== '0123456789') {
  1212. return false;
  1213. }
  1214.  
  1215. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  1216. var test3 = {};
  1217. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  1218. test3[letter] = letter;
  1219. });
  1220. if (Object.keys(Object.assign({}, test3)).join('') !==
  1221. 'abcdefghijklmnopqrst') {
  1222. return false;
  1223. }
  1224.  
  1225. return true;
  1226. } catch (err) {
  1227. // We don't expect any of the above to throw, but better to be safe.
  1228. return false;
  1229. }
  1230. }
  1231.  
  1232. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  1233. var from;
  1234. var to = toObject(target);
  1235. var symbols;
  1236.  
  1237. for (var s = 1; s < arguments.length; s++) {
  1238. from = Object(arguments[s]);
  1239.  
  1240. for (var key in from) {
  1241. if (hasOwnProperty.call(from, key)) {
  1242. to[key] = from[key];
  1243. }
  1244. }
  1245.  
  1246. if (getOwnPropertySymbols) {
  1247. symbols = getOwnPropertySymbols(from);
  1248. for (var i = 0; i < symbols.length; i++) {
  1249. if (propIsEnumerable.call(from, symbols[i])) {
  1250. to[symbols[i]] = from[symbols[i]];
  1251. }
  1252. }
  1253. }
  1254. }
  1255.  
  1256. return to;
  1257. };
  1258.  
  1259. },{}],81:[function(require,module,exports){
  1260. "use strict";
  1261.  
  1262. Object.defineProperty(exports, "__esModule", {
  1263. value: true
  1264. });
  1265. exports.controlWordRegex = undefined;
  1266.  
  1267. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  1268.  
  1269. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  1270.  
  1271. var _createClass2 = require("babel-runtime/helpers/createClass");
  1272.  
  1273. var _createClass3 = _interopRequireDefault(_createClass2);
  1274.  
  1275. var _matchAt = require("match-at");
  1276.  
  1277. var _matchAt2 = _interopRequireDefault(_matchAt);
  1278.  
  1279. var _ParseError = require("./ParseError");
  1280.  
  1281. var _ParseError2 = _interopRequireDefault(_ParseError);
  1282.  
  1283. var _SourceLocation = require("./SourceLocation");
  1284.  
  1285. var _SourceLocation2 = _interopRequireDefault(_SourceLocation);
  1286.  
  1287. var _Token = require("./Token");
  1288.  
  1289. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1290.  
  1291. /* The following tokenRegex
  1292. * - matches typical whitespace (but not NBSP etc.) using its first group
  1293. * - matches comments (must have trailing newlines)
  1294. * - does not match any control character \x00-\x1f except whitespace
  1295. * - does not match a bare backslash
  1296. * - matches any ASCII character except those just mentioned
  1297. * - does not match the BMP private use area \uE000-\uF8FF
  1298. * - does not match bare surrogate code units
  1299. * - matches any BMP character except for those just described
  1300. * - matches any valid Unicode surrogate pair
  1301. * - matches a backslash followed by one or more letters
  1302. * - matches a backslash followed by any BMP character, including newline
  1303. * Just because the Lexer matches something doesn't mean it's valid input:
  1304. * If there is no matching function or symbol definition, the Parser will
  1305. * still reject the input.
  1306. */
  1307.  
  1308. /**
  1309. * The Lexer class handles tokenizing the input in various ways. Since our
  1310. * parser expects us to be able to backtrack, the lexer allows lexing from any
  1311. * given starting point.
  1312. *
  1313. * Its main exposed function is the `lex` function, which takes a position to
  1314. * lex from and a type of token to lex. It defers to the appropriate `_innerLex`
  1315. * function.
  1316. *
  1317. * The various `_innerLex` functions perform the actual lexing of different
  1318. * kinds.
  1319. */
  1320.  
  1321. var commentRegexString = "%[^\n]*[\n]";
  1322. var controlWordRegexString = "\\\\[a-zA-Z@]+";
  1323. var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]";
  1324. var tokenRegex = new RegExp("([ \r\n\t]+)|" + ( // whitespace
  1325. "(" + commentRegexString + "|") + // comments
  1326. "[!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + // single codepoint
  1327. "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair
  1328. "|\\\\verb\\*([^]).*?\\3" + // \verb*
  1329. "|\\\\verb([^*a-zA-Z]).*?\\4" + ( // \verb unstarred
  1330. "|" + controlWordRegexString) + ( // \macroName
  1331. "|" + controlSymbolRegexString) + // \\, \', etc.
  1332. ")");
  1333.  
  1334. // tokenRegex has no ^ marker, as required by matchAt.
  1335. // These regexs are for matching results from tokenRegex,
  1336. // so they do have ^ markers.
  1337. var controlWordRegex = exports.controlWordRegex = new RegExp("^" + controlWordRegexString);
  1338. var commentRegex = new RegExp("^" + commentRegexString);
  1339.  
  1340. /** Main Lexer class */
  1341.  
  1342. var Lexer = function () {
  1343. function Lexer(input) {
  1344. (0, _classCallCheck3.default)(this, Lexer);
  1345.  
  1346. this.input = input;
  1347. this.pos = 0;
  1348. }
  1349.  
  1350. /**
  1351. * This function lexes a single token.
  1352. */
  1353.  
  1354.  
  1355. (0, _createClass3.default)(Lexer, [{
  1356. key: "lex",
  1357. value: function lex() {
  1358. var input = this.input;
  1359. var pos = this.pos;
  1360. if (pos === input.length) {
  1361. return new _Token.Token("EOF", new _SourceLocation2.default(this, pos, pos));
  1362. }
  1363. var match = (0, _matchAt2.default)(tokenRegex, input, pos);
  1364. if (match === null) {
  1365. throw new _ParseError2.default("Unexpected character: '" + input[pos] + "'", new _Token.Token(input[pos], new _SourceLocation2.default(this, pos, pos + 1)));
  1366. }
  1367. var text = match[2] || " ";
  1368. var start = this.pos;
  1369. this.pos += match[0].length;
  1370. var end = this.pos;
  1371.  
  1372. if (commentRegex.test(text)) {
  1373. return this.lex();
  1374. } else {
  1375. return new _Token.Token(text, new _SourceLocation2.default(this, start, end));
  1376. }
  1377. }
  1378. }]);
  1379. return Lexer;
  1380. }();
  1381.  
  1382. exports.default = Lexer;
  1383.  
  1384. },{"./ParseError":84,"./SourceLocation":88,"./Token":90,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9,"match-at":79}],82:[function(require,module,exports){
  1385. "use strict";
  1386.  
  1387. Object.defineProperty(exports, "__esModule", {
  1388. value: true
  1389. });
  1390.  
  1391. var _toConsumableArray2 = require("babel-runtime/helpers/toConsumableArray");
  1392.  
  1393. var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
  1394.  
  1395. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  1396.  
  1397. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  1398.  
  1399. var _createClass2 = require("babel-runtime/helpers/createClass");
  1400.  
  1401. var _createClass3 = _interopRequireDefault(_createClass2);
  1402.  
  1403. var _Lexer = require("./Lexer");
  1404.  
  1405. var _Lexer2 = _interopRequireDefault(_Lexer);
  1406.  
  1407. var _Token = require("./Token");
  1408.  
  1409. var _macros = require("./macros");
  1410.  
  1411. var _macros2 = _interopRequireDefault(_macros);
  1412.  
  1413. var _ParseError = require("./ParseError");
  1414.  
  1415. var _ParseError2 = _interopRequireDefault(_ParseError);
  1416.  
  1417. var _objectAssign = require("object-assign");
  1418.  
  1419. var _objectAssign2 = _interopRequireDefault(_objectAssign);
  1420.  
  1421. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1422.  
  1423. var MacroExpander = function () {
  1424. function MacroExpander(input, macros) {
  1425. (0, _classCallCheck3.default)(this, MacroExpander);
  1426.  
  1427. this.lexer = new _Lexer2.default(input);
  1428. this.macros = (0, _objectAssign2.default)({}, _macros2.default, macros);
  1429. this.stack = []; // contains tokens in REVERSE order
  1430. }
  1431.  
  1432. /**
  1433. * Returns the topmost token on the stack, without expanding it.
  1434. * Similar in behavior to TeX's `\futurelet`.
  1435. */
  1436.  
  1437.  
  1438. (0, _createClass3.default)(MacroExpander, [{
  1439. key: "future",
  1440. value: function future() {
  1441. if (this.stack.length === 0) {
  1442. this.pushToken(this.lexer.lex());
  1443. }
  1444. return this.stack[this.stack.length - 1];
  1445. }
  1446.  
  1447. /**
  1448. * Remove and return the next unexpanded token.
  1449. */
  1450.  
  1451. }, {
  1452. key: "popToken",
  1453. value: function popToken() {
  1454. this.future(); // ensure non-empty stack
  1455. return this.stack.pop();
  1456. }
  1457.  
  1458. /**
  1459. * Consume all following space tokens, without expansion.
  1460. */
  1461.  
  1462. }, {
  1463. key: "consumeSpaces",
  1464. value: function consumeSpaces() {
  1465. for (;;) {
  1466. var token = this.future();
  1467. if (token.text === " ") {
  1468. this.stack.pop();
  1469. } else {
  1470. break;
  1471. }
  1472. }
  1473. }
  1474.  
  1475. /**
  1476. * Expand the next token only once if possible.
  1477. *
  1478. * If the token is expanded, the resulting tokens will be pushed onto
  1479. * the stack in reverse order and will be returned as an array,
  1480. * also in reverse order.
  1481. *
  1482. * If not, the next token will be returned without removing it
  1483. * from the stack. This case can be detected by a `Token` return value
  1484. * instead of an `Array` return value.
  1485. *
  1486. * In either case, the next token will be on the top of the stack,
  1487. * or the stack will be empty.
  1488. *
  1489. * Used to implement `expandAfterFuture` and `expandNextToken`.
  1490. *
  1491. * At the moment, macro expansion doesn't handle delimited macros,
  1492. * i.e. things like those defined by \def\foo#1\end{…}.
  1493. * See the TeX book page 202ff. for details on how those should behave.
  1494. */
  1495.  
  1496. }, {
  1497. key: "expandOnce",
  1498. value: function expandOnce() {
  1499. var _stack;
  1500.  
  1501. var topToken = this.popToken();
  1502. var name = topToken.text;
  1503. var isMacro = name.charAt(0) === "\\";
  1504. if (isMacro && _Lexer.controlWordRegex.test(name)) {
  1505. // Consume all spaces after \macro (but not \\, \', etc.)
  1506. this.consumeSpaces();
  1507. }
  1508. if (!(isMacro && this.macros.hasOwnProperty(name))) {
  1509. // Fully expanded
  1510. this.pushToken(topToken);
  1511. return topToken;
  1512. }
  1513.  
  1514. var _getExpansion2 = this._getExpansion(name),
  1515. tokens = _getExpansion2.tokens,
  1516. numArgs = _getExpansion2.numArgs;
  1517.  
  1518. var expansion = tokens;
  1519. if (numArgs) {
  1520. var args = [];
  1521. // obtain arguments, either single token or balanced {…} group
  1522. for (var i = 0; i < numArgs; ++i) {
  1523. this.consumeSpaces(); // ignore spaces before each argument
  1524. var startOfArg = this.popToken();
  1525. if (startOfArg.text === "{") {
  1526. var arg = [];
  1527. var depth = 1;
  1528. while (depth !== 0) {
  1529. var tok = this.popToken();
  1530. arg.push(tok);
  1531. if (tok.text === "{") {
  1532. ++depth;
  1533. } else if (tok.text === "}") {
  1534. --depth;
  1535. } else if (tok.text === "EOF") {
  1536. throw new _ParseError2.default("End of input in macro argument", startOfArg);
  1537. }
  1538. }
  1539. arg.pop(); // remove last }
  1540. arg.reverse(); // like above, to fit in with stack order
  1541. args[i] = arg;
  1542. } else if (startOfArg.text === "EOF") {
  1543. throw new _ParseError2.default("End of input expecting macro argument", topToken);
  1544. } else {
  1545. args[i] = [startOfArg];
  1546. }
  1547. }
  1548. // paste arguments in place of the placeholders
  1549. expansion = expansion.slice(); // make a shallow copy
  1550. for (var _i = expansion.length - 1; _i >= 0; --_i) {
  1551. var _tok = expansion[_i];
  1552. if (_tok.text === "#") {
  1553. if (_i === 0) {
  1554. throw new _ParseError2.default("Incomplete placeholder at end of macro body", _tok);
  1555. }
  1556. _tok = expansion[--_i]; // next token on stack
  1557. if (_tok.text === "#") {
  1558. // ## → #
  1559. expansion.splice(_i + 1, 1); // drop first #
  1560. } else if (/^[1-9]$/.test(_tok.text)) {
  1561. var _expansion;
  1562.  
  1563. // replace the placeholder with the indicated argument
  1564. (_expansion = expansion).splice.apply(_expansion, [_i, 2].concat((0, _toConsumableArray3.default)(args[+_tok.text - 1])));
  1565. } else {
  1566. throw new _ParseError2.default("Not a valid argument number", _tok);
  1567. }
  1568. }
  1569. }
  1570. }
  1571. // Concatenate expansion onto top of stack.
  1572. (_stack = this.stack).push.apply(_stack, (0, _toConsumableArray3.default)(expansion));
  1573. return expansion;
  1574. }
  1575.  
  1576. /**
  1577. * Expand the next token only once (if possible), and return the resulting
  1578. * top token on the stack (without removing anything from the stack).
  1579. * Similar in behavior to TeX's `\expandafter\futurelet`.
  1580. * Equivalent to expandOnce() followed by future().
  1581. */
  1582.  
  1583. }, {
  1584. key: "expandAfterFuture",
  1585. value: function expandAfterFuture() {
  1586. this.expandOnce();
  1587. return this.future();
  1588. }
  1589.  
  1590. /**
  1591. * Recursively expand first token, then return first non-expandable token.
  1592. */
  1593.  
  1594. }, {
  1595. key: "expandNextToken",
  1596. value: function expandNextToken() {
  1597. for (;;) {
  1598. var expanded = this.expandOnce();
  1599. // expandOnce returns Token if and only if it's fully expanded.
  1600. if (expanded instanceof _Token.Token) {
  1601. // \relax stops the expansion, but shouldn't get returned (a
  1602. // null return value couldn't get implemented as a function).
  1603. if (expanded.text === "\\relax") {
  1604. this.stack.pop();
  1605. } else {
  1606. return this.stack.pop(); // === expanded
  1607. }
  1608. }
  1609. }
  1610.  
  1611. // Flow unable to figure out that this pathway is impossible.
  1612. // https://github.com/facebook/flow/issues/4808
  1613. throw new Error(); // eslint-disable-line no-unreachable
  1614. }
  1615.  
  1616. /**
  1617. * Returns the expanded macro as a reversed array of tokens and a macro
  1618. * argument count.
  1619. * Caches macro expansions for those that were defined simple TeX strings.
  1620. */
  1621.  
  1622. }, {
  1623. key: "_getExpansion",
  1624. value: function _getExpansion(name) {
  1625. var definition = this.macros[name];
  1626. var expansion = typeof definition === "function" ? definition(this) : definition;
  1627. if (typeof expansion === "string") {
  1628. var numArgs = 0;
  1629. if (expansion.indexOf("#") !== -1) {
  1630. var stripped = expansion.replace(/##/g, "");
  1631. while (stripped.indexOf("#" + (numArgs + 1)) !== -1) {
  1632. ++numArgs;
  1633. }
  1634. }
  1635. var bodyLexer = new _Lexer2.default(expansion);
  1636. var tokens = [];
  1637. var tok = bodyLexer.lex();
  1638. while (tok.text !== "EOF") {
  1639. tokens.push(tok);
  1640. tok = bodyLexer.lex();
  1641. }
  1642. tokens.reverse(); // to fit in with stack using push and pop
  1643. var expanded = { tokens: tokens, numArgs: numArgs };
  1644. // Cannot cache a macro defined using a function since it relies on
  1645. // parser context.
  1646. if (typeof definition !== "function") {
  1647. this.macros[name] = expanded;
  1648. }
  1649. return expanded;
  1650. }
  1651.  
  1652. return expansion;
  1653. }
  1654.  
  1655. /**
  1656. * Add a given token to the token stack. In particular, this get be used
  1657. * to put back a token returned from one of the other methods.
  1658. */
  1659.  
  1660. }, {
  1661. key: "pushToken",
  1662. value: function pushToken(token) {
  1663. this.stack.push(token);
  1664. }
  1665. }]);
  1666. return MacroExpander;
  1667. }();
  1668. /**
  1669. * This file contains the “gullet” where macros are expanded
  1670. * until only non-macro tokens remain.
  1671. */
  1672.  
  1673. exports.default = MacroExpander;
  1674.  
  1675. },{"./Lexer":81,"./ParseError":84,"./Token":90,"./macros":107,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9,"babel-runtime/helpers/toConsumableArray":11,"object-assign":80}],83:[function(require,module,exports){
  1676. "use strict";
  1677.  
  1678. Object.defineProperty(exports, "__esModule", {
  1679. value: true
  1680. });
  1681.  
  1682. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  1683.  
  1684. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  1685.  
  1686. var _createClass2 = require("babel-runtime/helpers/createClass");
  1687.  
  1688. var _createClass3 = _interopRequireDefault(_createClass2);
  1689.  
  1690. var _fontMetrics2 = require("./fontMetrics");
  1691.  
  1692. var _fontMetrics3 = _interopRequireDefault(_fontMetrics2);
  1693.  
  1694. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1695.  
  1696. var sizeStyleMap = [
  1697. // Each element contains [textsize, scriptsize, scriptscriptsize].
  1698. // The size mappings are taken from TeX with \normalsize=10pt.
  1699. [1, 1, 1], // size1: [5, 5, 5] \tiny
  1700. [2, 1, 1], // size2: [6, 5, 5]
  1701. [3, 1, 1], // size3: [7, 5, 5] \scriptsize
  1702. [4, 2, 1], // size4: [8, 6, 5] \footnotesize
  1703. [5, 2, 1], // size5: [9, 6, 5] \small
  1704. [6, 3, 1], // size6: [10, 7, 5] \normalsize
  1705. [7, 4, 2], // size7: [12, 8, 6] \large
  1706. [8, 6, 3], // size8: [14.4, 10, 7] \Large
  1707. [9, 7, 6], // size9: [17.28, 12, 10] \LARGE
  1708. [10, 8, 7], // size10: [20.74, 14.4, 12] \huge
  1709. [11, 10, 9]];
  1710. /**
  1711. * This file contains information about the options that the Parser carries
  1712. * around with it while parsing. Data is held in an `Options` object, and when
  1713. * recursing, a new `Options` object can be created with the `.with*` and
  1714. * `.reset` functions.
  1715. */
  1716.  
  1717. var sizeMultipliers = [
  1718. // fontMetrics.js:getFontMetrics also uses size indexes, so if
  1719. // you change size indexes, change that function.
  1720. 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488];
  1721.  
  1722. var sizeAtStyle = function sizeAtStyle(size, style) {
  1723. return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];
  1724. };
  1725.  
  1726. /**
  1727. * This is the main options class. It contains the current style, size, color,
  1728. * and font.
  1729. *
  1730. * Options objects should not be modified. To create a new Options with
  1731. * different properties, call a `.having*` method.
  1732. */
  1733. var Options = function () {
  1734. function Options(data) {
  1735. (0, _classCallCheck3.default)(this, Options);
  1736.  
  1737. this.style = data.style;
  1738. this.color = data.color;
  1739. this.size = data.size || Options.BASESIZE;
  1740. this.textSize = data.textSize || this.size;
  1741. this.phantom = !!data.phantom;
  1742. this.font = data.font;
  1743. this.sizeMultiplier = sizeMultipliers[this.size - 1];
  1744. this.maxSize = data.maxSize;
  1745. this._fontMetrics = undefined;
  1746. }
  1747.  
  1748. /**
  1749. * Returns a new options object with the same properties as "this". Properties
  1750. * from "extension" will be copied to the new options object.
  1751. */
  1752.  
  1753.  
  1754. /**
  1755. * The base size index.
  1756. */
  1757.  
  1758.  
  1759. (0, _createClass3.default)(Options, [{
  1760. key: "extend",
  1761. value: function extend(extension) {
  1762. var data = {
  1763. style: this.style,
  1764. size: this.size,
  1765. textSize: this.textSize,
  1766. color: this.color,
  1767. phantom: this.phantom,
  1768. font: this.font,
  1769. maxSize: this.maxSize
  1770. };
  1771.  
  1772. for (var key in extension) {
  1773. if (extension.hasOwnProperty(key)) {
  1774. data[key] = extension[key];
  1775. }
  1776. }
  1777.  
  1778. return new Options(data);
  1779. }
  1780.  
  1781. /**
  1782. * Return an options object with the given style. If `this.style === style`,
  1783. * returns `this`.
  1784. */
  1785.  
  1786. }, {
  1787. key: "havingStyle",
  1788. value: function havingStyle(style) {
  1789. if (this.style === style) {
  1790. return this;
  1791. } else {
  1792. return this.extend({
  1793. style: style,
  1794. size: sizeAtStyle(this.textSize, style)
  1795. });
  1796. }
  1797. }
  1798.  
  1799. /**
  1800. * Return an options object with a cramped version of the current style. If
  1801. * the current style is cramped, returns `this`.
  1802. */
  1803.  
  1804. }, {
  1805. key: "havingCrampedStyle",
  1806. value: function havingCrampedStyle() {
  1807. return this.havingStyle(this.style.cramp());
  1808. }
  1809.  
  1810. /**
  1811. * Return an options object with the given size and in at least `\textstyle`.
  1812. * Returns `this` if appropriate.
  1813. */
  1814.  
  1815. }, {
  1816. key: "havingSize",
  1817. value: function havingSize(size) {
  1818. if (this.size === size && this.textSize === size) {
  1819. return this;
  1820. } else {
  1821. return this.extend({
  1822. style: this.style.text(),
  1823. size: size,
  1824. textSize: size
  1825. });
  1826. }
  1827. }
  1828.  
  1829. /**
  1830. * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
  1831. * changes to at least `\textstyle`.
  1832. */
  1833.  
  1834. }, {
  1835. key: "havingBaseStyle",
  1836. value: function havingBaseStyle(style) {
  1837. style = style || this.style.text();
  1838. var wantSize = sizeAtStyle(Options.BASESIZE, style);
  1839. if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) {
  1840. return this;
  1841. } else {
  1842. return this.extend({
  1843. style: style,
  1844. size: wantSize
  1845. });
  1846. }
  1847. }
  1848.  
  1849. /**
  1850. * Create a new options object with the given color.
  1851. */
  1852.  
  1853. }, {
  1854. key: "withColor",
  1855. value: function withColor(color) {
  1856. return this.extend({
  1857. color: color
  1858. });
  1859. }
  1860.  
  1861. /**
  1862. * Create a new options object with "phantom" set to true.
  1863. */
  1864.  
  1865. }, {
  1866. key: "withPhantom",
  1867. value: function withPhantom() {
  1868. return this.extend({
  1869. phantom: true
  1870. });
  1871. }
  1872.  
  1873. /**
  1874. * Create a new options objects with the give font.
  1875. */
  1876.  
  1877. }, {
  1878. key: "withFont",
  1879. value: function withFont(font) {
  1880. return this.extend({
  1881. font: font || this.font
  1882. });
  1883. }
  1884.  
  1885. /**
  1886. * Return the CSS sizing classes required to switch from enclosing options
  1887. * `oldOptions` to `this`. Returns an array of classes.
  1888. */
  1889.  
  1890. }, {
  1891. key: "sizingClasses",
  1892. value: function sizingClasses(oldOptions) {
  1893. if (oldOptions.size !== this.size) {
  1894. return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
  1895. } else {
  1896. return [];
  1897. }
  1898. }
  1899.  
  1900. /**
  1901. * Return the CSS sizing classes required to switch to the base size. Like
  1902. * `this.havingSize(BASESIZE).sizingClasses(this)`.
  1903. */
  1904.  
  1905. }, {
  1906. key: "baseSizingClasses",
  1907. value: function baseSizingClasses() {
  1908. if (this.size !== Options.BASESIZE) {
  1909. return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
  1910. } else {
  1911. return [];
  1912. }
  1913. }
  1914.  
  1915. /**
  1916. * Return the font metrics for this size.
  1917. */
  1918.  
  1919. }, {
  1920. key: "fontMetrics",
  1921. value: function fontMetrics() {
  1922. if (!this._fontMetrics) {
  1923. this._fontMetrics = _fontMetrics3.default.getFontMetrics(this.size);
  1924. }
  1925. return this._fontMetrics;
  1926. }
  1927.  
  1928. /**
  1929. * A map of color names to CSS colors.
  1930. * TODO(emily): Remove this when we have real macros
  1931. */
  1932.  
  1933. }, {
  1934. key: "getColor",
  1935.  
  1936.  
  1937. /**
  1938. * Gets the CSS color of the current options object, accounting for the
  1939. * `colorMap`.
  1940. */
  1941. value: function getColor() {
  1942. if (this.phantom) {
  1943. return "transparent";
  1944. } else if (this.color != null && Options.colorMap.hasOwnProperty(this.color)) {
  1945. return Options.colorMap[this.color];
  1946. } else {
  1947. return this.color;
  1948. }
  1949. }
  1950. }]);
  1951. return Options;
  1952. }();
  1953.  
  1954. Options.BASESIZE = 6;
  1955. Options.colorMap = {
  1956. "katex-blue": "#6495ed",
  1957. "katex-orange": "#ffa500",
  1958. "katex-pink": "#ff00af",
  1959. "katex-red": "#df0030",
  1960. "katex-green": "#28ae7b",
  1961. "katex-gray": "gray",
  1962. "katex-purple": "#9d38bd",
  1963. "katex-blueA": "#ccfaff",
  1964. "katex-blueB": "#80f6ff",
  1965. "katex-blueC": "#63d9ea",
  1966. "katex-blueD": "#11accd",
  1967. "katex-blueE": "#0c7f99",
  1968. "katex-tealA": "#94fff5",
  1969. "katex-tealB": "#26edd5",
  1970. "katex-tealC": "#01d1c1",
  1971. "katex-tealD": "#01a995",
  1972. "katex-tealE": "#208170",
  1973. "katex-greenA": "#b6ffb0",
  1974. "katex-greenB": "#8af281",
  1975. "katex-greenC": "#74cf70",
  1976. "katex-greenD": "#1fab54",
  1977. "katex-greenE": "#0d923f",
  1978. "katex-goldA": "#ffd0a9",
  1979. "katex-goldB": "#ffbb71",
  1980. "katex-goldC": "#ff9c39",
  1981. "katex-goldD": "#e07d10",
  1982. "katex-goldE": "#a75a05",
  1983. "katex-redA": "#fca9a9",
  1984. "katex-redB": "#ff8482",
  1985. "katex-redC": "#f9685d",
  1986. "katex-redD": "#e84d39",
  1987. "katex-redE": "#bc2612",
  1988. "katex-maroonA": "#ffbde0",
  1989. "katex-maroonB": "#ff92c6",
  1990. "katex-maroonC": "#ed5fa6",
  1991. "katex-maroonD": "#ca337c",
  1992. "katex-maroonE": "#9e034e",
  1993. "katex-purpleA": "#ddd7ff",
  1994. "katex-purpleB": "#c6b9fc",
  1995. "katex-purpleC": "#aa87ff",
  1996. "katex-purpleD": "#7854ab",
  1997. "katex-purpleE": "#543b78",
  1998. "katex-mintA": "#f5f9e8",
  1999. "katex-mintB": "#edf2df",
  2000. "katex-mintC": "#e0e5cc",
  2001. "katex-grayA": "#f6f7f7",
  2002. "katex-grayB": "#f0f1f2",
  2003. "katex-grayC": "#e3e5e6",
  2004. "katex-grayD": "#d6d8da",
  2005. "katex-grayE": "#babec2",
  2006. "katex-grayF": "#888d93",
  2007. "katex-grayG": "#626569",
  2008. "katex-grayH": "#3b3e40",
  2009. "katex-grayI": "#21242c",
  2010. "katex-kaBlue": "#314453",
  2011. "katex-kaGreen": "#71B307"
  2012. };
  2013. exports.default = Options;
  2014.  
  2015. },{"./fontMetrics":101,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],84:[function(require,module,exports){
  2016. "use strict";
  2017.  
  2018. Object.defineProperty(exports, "__esModule", {
  2019. value: true
  2020. });
  2021.  
  2022. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2023.  
  2024. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2025.  
  2026. var _ParseNode = require("./ParseNode");
  2027.  
  2028. var _ParseNode2 = _interopRequireDefault(_ParseNode);
  2029.  
  2030. var _Token = require("./Token");
  2031.  
  2032. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2033.  
  2034. /**
  2035. * This is the ParseError class, which is the main error thrown by KaTeX
  2036. * functions when something has gone wrong. This is used to distinguish internal
  2037. * errors from errors in the expression that the user provided.
  2038. *
  2039. * If possible, a caller should provide a Token or ParseNode with information
  2040. * about where in the source string the problem occurred.
  2041. */
  2042. var ParseError =
  2043. // Error position based on passed-in Token or ParseNode.
  2044.  
  2045. function ParseError(message, // The error message
  2046. token) // An object providing position information
  2047. {
  2048. (0, _classCallCheck3.default)(this, ParseError);
  2049.  
  2050. var error = "KaTeX parse error: " + message;
  2051. var start = void 0;
  2052.  
  2053. var loc = token && token.loc;
  2054. if (loc && loc.start <= loc.end) {
  2055. // If we have the input and a position, make the error a bit fancier
  2056.  
  2057. // Get the input
  2058. var input = loc.lexer.input;
  2059.  
  2060. // Prepend some information
  2061. start = loc.start;
  2062. var end = loc.end;
  2063. if (start === input.length) {
  2064. error += " at end of input: ";
  2065. } else {
  2066. error += " at position " + (start + 1) + ": ";
  2067. }
  2068.  
  2069. // Underline token in question using combining underscores
  2070. var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332");
  2071.  
  2072. // Extract some context from the input and add it to the error
  2073. var left = void 0;
  2074. if (start > 15) {
  2075. left = "…" + input.slice(start - 15, start);
  2076. } else {
  2077. left = input.slice(0, start);
  2078. }
  2079. var right = void 0;
  2080. if (end + 15 < input.length) {
  2081. right = input.slice(end, end + 15) + "…";
  2082. } else {
  2083. right = input.slice(end);
  2084. }
  2085. error += left + underlined + right;
  2086. }
  2087.  
  2088. // Some hackery to make ParseError a prototype of Error
  2089. // See http://stackoverflow.com/a/8460753
  2090. var self = new Error(error);
  2091. self.name = "ParseError";
  2092. // $FlowFixMe
  2093. self.__proto__ = ParseError.prototype;
  2094. // $FlowFixMe
  2095. self.position = start;
  2096. return self;
  2097. };
  2098.  
  2099. // $FlowFixMe More hackery
  2100.  
  2101.  
  2102. ParseError.prototype.__proto__ = Error.prototype;
  2103.  
  2104. exports.default = ParseError;
  2105.  
  2106. },{"./ParseNode":85,"./Token":90,"babel-runtime/helpers/classCallCheck":8}],85:[function(require,module,exports){
  2107. "use strict";
  2108.  
  2109. Object.defineProperty(exports, "__esModule", {
  2110. value: true
  2111. });
  2112.  
  2113. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2114.  
  2115. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2116.  
  2117. var _Token = require("./Token");
  2118.  
  2119. var _SourceLocation = require("./SourceLocation");
  2120.  
  2121. var _SourceLocation2 = _interopRequireDefault(_SourceLocation);
  2122.  
  2123. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2124.  
  2125. /**
  2126. * The resulting parse tree nodes of the parse tree.
  2127. *
  2128. * It is possible to provide position information, so that a `ParseNode` can
  2129. * fulfill a role similar to a `Token` in error reporting.
  2130. * For details on the corresponding properties see `Token` constructor.
  2131. * Providing such information can lead to better error reporting.
  2132. */
  2133. var ParseNode = function ParseNode(type, // type of node, like e.g. "ordgroup"
  2134. value, // type-specific representation of the node
  2135. mode, // parse mode in action for this node, "math" or "text"
  2136. firstToken, // first token of the input for this node,
  2137. lastToken) // last token of the input for this node,
  2138. // will default to firstToken if unset
  2139. {
  2140. (0, _classCallCheck3.default)(this, ParseNode);
  2141.  
  2142. this.type = type;
  2143. this.value = value;
  2144. this.mode = mode;
  2145. this.loc = _SourceLocation2.default.range(firstToken, lastToken);
  2146. };
  2147.  
  2148. exports.default = ParseNode;
  2149.  
  2150. },{"./SourceLocation":88,"./Token":90,"babel-runtime/helpers/classCallCheck":8}],86:[function(require,module,exports){
  2151. "use strict";
  2152.  
  2153. Object.defineProperty(exports, "__esModule", {
  2154. value: true
  2155. });
  2156.  
  2157. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2158.  
  2159. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2160.  
  2161. var _createClass2 = require("babel-runtime/helpers/createClass");
  2162.  
  2163. var _createClass3 = _interopRequireDefault(_createClass2);
  2164.  
  2165. var _functions = require("./functions");
  2166.  
  2167. var _functions2 = _interopRequireDefault(_functions);
  2168.  
  2169. var _environments = require("./environments");
  2170.  
  2171. var _environments2 = _interopRequireDefault(_environments);
  2172.  
  2173. var _MacroExpander = require("./MacroExpander");
  2174.  
  2175. var _MacroExpander2 = _interopRequireDefault(_MacroExpander);
  2176.  
  2177. var _symbols = require("./symbols");
  2178.  
  2179. var _symbols2 = _interopRequireDefault(_symbols);
  2180.  
  2181. var _utils = require("./utils");
  2182.  
  2183. var _utils2 = _interopRequireDefault(_utils);
  2184.  
  2185. var _units = require("./units");
  2186.  
  2187. var _unicodeRegexes = require("./unicodeRegexes");
  2188.  
  2189. var _ParseNode = require("./ParseNode");
  2190.  
  2191. var _ParseNode2 = _interopRequireDefault(_ParseNode);
  2192.  
  2193. var _ParseError = require("./ParseError");
  2194.  
  2195. var _ParseError2 = _interopRequireDefault(_ParseError);
  2196.  
  2197. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2198.  
  2199. /**
  2200. * This file contains the parser used to parse out a TeX expression from the
  2201. * input. Since TeX isn't context-free, standard parsers don't work particularly
  2202. * well.
  2203. *
  2204. * The strategy of this parser is as such:
  2205. *
  2206. * The main functions (the `.parse...` ones) take a position in the current
  2207. * parse string to parse tokens from. The lexer (found in Lexer.js, stored at
  2208. * this.lexer) also supports pulling out tokens at arbitrary places. When
  2209. * individual tokens are needed at a position, the lexer is called to pull out a
  2210. * token, which is then used.
  2211. *
  2212. * The parser has a property called "mode" indicating the mode that
  2213. * the parser is currently in. Currently it has to be one of "math" or
  2214. * "text", which denotes whether the current environment is a math-y
  2215. * one or a text-y one (e.g. inside \text). Currently, this serves to
  2216. * limit the functions which can be used in text mode.
  2217. *
  2218. * The main functions then return an object which contains the useful data that
  2219. * was parsed at its given point, and a new position at the end of the parsed
  2220. * data. The main functions can call each other and continue the parsing by
  2221. * using the returned position as a new starting point.
  2222. *
  2223. * There are also extra `.handle...` functions, which pull out some reused
  2224. * functionality into self-contained functions.
  2225. *
  2226. * The earlier functions return ParseNodes.
  2227. * The later functions (which are called deeper in the parse) sometimes return
  2228. * ParsedFuncOrArgOrDollar, which contain a ParseNode as well as some data about
  2229. * whether the parsed object is a function which is missing some arguments, or a
  2230. * standalone object which can be used as an argument to another function.
  2231. */
  2232.  
  2233. /* TODO: Uncomment when porting to flow.
  2234. type ParsedType = "fn" | "arg" | "$"
  2235. type ParsedFunc = {|
  2236. type: "fn",
  2237. result: string, // Function name defined via defineFunction (e.g. "\\frac").
  2238. token: Token,
  2239. |};
  2240. type ParsedArg = {|
  2241. type: "arg",
  2242. result: ParseNode,
  2243. token: Token,
  2244. |};
  2245. type ParsedDollar = {|
  2246. // Math mode switch
  2247. type: "$",
  2248. result: "$",
  2249. token: Token,
  2250. |};
  2251. type ParsedFuncOrArgOrDollar = ParsedFunc | ParsedArg | ParsedDollar;
  2252. */
  2253.  
  2254. /**
  2255. * @param {ParseNode} result
  2256. * @param {Token} token
  2257. * @return {ParsedArg}
  2258. */
  2259. function newArgument(result, token) {
  2260. return { type: "arg", result: result, token: token };
  2261. }
  2262.  
  2263. /**
  2264. * @param {Token} token
  2265. * @return {ParsedFunc}
  2266. */
  2267. /* eslint no-constant-condition:0 */
  2268. function newFunction(token) {
  2269. return { type: "fn", result: token.text, token: token };
  2270. }
  2271.  
  2272. /**
  2273. * @param {Token} token
  2274. * @return {ParsedDollar}
  2275. */
  2276. function newDollar(token) {
  2277. return { type: "$", result: "$", token: token };
  2278. }
  2279.  
  2280. /**
  2281. * @param {ParsedFuncOrArgOrDollar} parsed
  2282. * @return {ParsedFuncOrArg}
  2283. */
  2284. function assertFuncOrArg(parsed) {
  2285. if (parsed.type === "$") {
  2286. throw new _ParseError2.default("Unexpected $", parsed.token);
  2287. }
  2288. return parsed;
  2289. }
  2290.  
  2291. var Parser = function () {
  2292. function Parser(input, settings) {
  2293. (0, _classCallCheck3.default)(this, Parser);
  2294.  
  2295. // Create a new macro expander (gullet) and (indirectly via that) also a
  2296. // new lexer (mouth) for this parser (stomach, in the language of TeX)
  2297. this.gullet = new _MacroExpander2.default(input, settings.macros);
  2298. // Use old \color behavior (same as LaTeX's \textcolor) if requested.
  2299. // We do this after the macros object has been copied by MacroExpander.
  2300. if (settings.colorIsTextColor) {
  2301. this.gullet.macros["\\color"] = "\\textcolor";
  2302. }
  2303. // Store the settings for use in parsing
  2304. this.settings = settings;
  2305. // Count leftright depth (for \middle errors)
  2306. this.leftrightDepth = 0;
  2307. }
  2308.  
  2309. /**
  2310. * Checks a result to make sure it has the right type, and throws an
  2311. * appropriate error otherwise.
  2312. *
  2313. * @param {boolean=} consume whether to consume the expected token,
  2314. * defaults to true
  2315. */
  2316.  
  2317.  
  2318. (0, _createClass3.default)(Parser, [{
  2319. key: "expect",
  2320. value: function expect(text, consume) {
  2321. if (this.nextToken.text !== text) {
  2322. throw new _ParseError2.default("Expected '" + text + "', got '" + this.nextToken.text + "'", this.nextToken);
  2323. }
  2324. if (consume !== false) {
  2325. this.consume();
  2326. }
  2327. }
  2328.  
  2329. /**
  2330. * Considers the current look ahead token as consumed,
  2331. * and fetches the one after that as the new look ahead.
  2332. */
  2333.  
  2334. }, {
  2335. key: "consume",
  2336. value: function consume() {
  2337. this.nextToken = this.gullet.expandNextToken();
  2338. }
  2339.  
  2340. /**
  2341. * Switches between "text" and "math" modes.
  2342. */
  2343.  
  2344. }, {
  2345. key: "switchMode",
  2346. value: function switchMode(newMode) {
  2347. this.mode = newMode;
  2348. }
  2349.  
  2350. /**
  2351. * Main parsing function, which parses an entire input.
  2352. *
  2353. * @return {Array.<ParseNode>}
  2354. */
  2355.  
  2356. }, {
  2357. key: "parse",
  2358. value: function parse() {
  2359. // Try to parse the input
  2360. this.mode = "math";
  2361. this.consume();
  2362. var parse = this.parseInput();
  2363. return parse;
  2364. }
  2365.  
  2366. /**
  2367. * Parses an entire input tree.
  2368. */
  2369.  
  2370. }, {
  2371. key: "parseInput",
  2372. value: function parseInput() {
  2373. // Parse an expression
  2374. var expression = this.parseExpression(false);
  2375. // If we succeeded, make sure there's an EOF at the end
  2376. this.expect("EOF", false);
  2377. return expression;
  2378. }
  2379. }, {
  2380. key: "parseExpression",
  2381.  
  2382.  
  2383. /**
  2384. * Parses an "expression", which is a list of atoms.
  2385. *
  2386. * @param {boolean} breakOnInfix Should the parsing stop when we hit infix
  2387. * nodes? This happens when functions have higher precendence
  2388. * than infix nodes in implicit parses.
  2389. *
  2390. * @param {?string} breakOnTokenText The text of the token that the expression
  2391. * should end with, or `null` if something else should end the
  2392. * expression.
  2393. *
  2394. * @return {Array<ParseNode>}
  2395. */
  2396. value: function parseExpression(breakOnInfix, breakOnTokenText) {
  2397. var body = [];
  2398. // Keep adding atoms to the body until we can't parse any more atoms (either
  2399. // we reached the end, a }, or a \right)
  2400. while (true) {
  2401. // Ignore spaces in math mode
  2402. if (this.mode === "math") {
  2403. this.consumeSpaces();
  2404. }
  2405. var lex = this.nextToken;
  2406. if (Parser.endOfExpression.indexOf(lex.text) !== -1) {
  2407. break;
  2408. }
  2409. if (breakOnTokenText && lex.text === breakOnTokenText) {
  2410. break;
  2411. }
  2412. if (breakOnInfix && _functions2.default[lex.text] && _functions2.default[lex.text].infix) {
  2413. break;
  2414. }
  2415. var atom = this.parseAtom(breakOnTokenText);
  2416. if (!atom) {
  2417. if (!this.settings.throwOnError && lex.text[0] === "\\") {
  2418. var errorNode = this.handleUnsupportedCmd();
  2419. body.push(errorNode);
  2420. continue;
  2421. }
  2422.  
  2423. break;
  2424. }
  2425. body.push(atom);
  2426. }
  2427. return this.handleInfixNodes(body);
  2428. }
  2429.  
  2430. /**
  2431. * Rewrites infix operators such as \over with corresponding commands such
  2432. * as \frac.
  2433. *
  2434. * There can only be one infix operator per group. If there's more than one
  2435. * then the expression is ambiguous. This can be resolved by adding {}.
  2436. *
  2437. * @param {Array<ParseNode>} body
  2438. * @return {Array<ParseNode>}
  2439. */
  2440.  
  2441. }, {
  2442. key: "handleInfixNodes",
  2443. value: function handleInfixNodes(body) {
  2444. var overIndex = -1;
  2445. var funcName = void 0;
  2446.  
  2447. for (var i = 0; i < body.length; i++) {
  2448. var node = body[i];
  2449. if (node.type === "infix") {
  2450. if (overIndex !== -1) {
  2451. throw new _ParseError2.default("only one infix operator per group", node.value.token);
  2452. }
  2453. overIndex = i;
  2454. funcName = node.value.replaceWith;
  2455. }
  2456. }
  2457.  
  2458. if (overIndex !== -1) {
  2459. var numerNode = void 0;
  2460. var denomNode = void 0;
  2461.  
  2462. var numerBody = body.slice(0, overIndex);
  2463. var denomBody = body.slice(overIndex + 1);
  2464.  
  2465. if (numerBody.length === 1 && numerBody[0].type === "ordgroup") {
  2466. numerNode = numerBody[0];
  2467. } else {
  2468. numerNode = new _ParseNode2.default("ordgroup", numerBody, this.mode);
  2469. }
  2470.  
  2471. if (denomBody.length === 1 && denomBody[0].type === "ordgroup") {
  2472. denomNode = denomBody[0];
  2473. } else {
  2474. denomNode = new _ParseNode2.default("ordgroup", denomBody, this.mode);
  2475. }
  2476.  
  2477. var value = this.callFunction(funcName, [numerNode, denomNode], []);
  2478. return [new _ParseNode2.default(value.type, value, this.mode)];
  2479. } else {
  2480. return body;
  2481. }
  2482. }
  2483.  
  2484. // The greediness of a superscript or subscript
  2485.  
  2486. }, {
  2487. key: "handleSupSubscript",
  2488.  
  2489.  
  2490. /**
  2491. * Handle a subscript or superscript with nice errors.
  2492. * @param {string} name For error reporting.
  2493. * @return {ParsedNode}
  2494. */
  2495. value: function handleSupSubscript(name) {
  2496. var symbolToken = this.nextToken;
  2497. var symbol = symbolToken.text;
  2498. this.consume();
  2499. this.consumeSpaces(); // ignore spaces before sup/subscript argument
  2500. var group = this.parseGroup();
  2501.  
  2502. if (!group) {
  2503. if (!this.settings.throwOnError && this.nextToken.text[0] === "\\") {
  2504. return this.handleUnsupportedCmd();
  2505. } else {
  2506. throw new _ParseError2.default("Expected group after '" + symbol + "'", symbolToken);
  2507. }
  2508. }
  2509.  
  2510. var arg = assertFuncOrArg(group);
  2511. if (arg.type === "fn") {
  2512. // ^ and _ have a greediness, so handle interactions with functions'
  2513. // greediness
  2514. var funcGreediness = _functions2.default[group.result].greediness;
  2515. if (funcGreediness > Parser.SUPSUB_GREEDINESS) {
  2516. return this.parseGivenFunction(group);
  2517. } else {
  2518. throw new _ParseError2.default("Got function '" + group.result + "' with no arguments " + "as " + name, symbolToken);
  2519. }
  2520. } else {
  2521. return group.result;
  2522. }
  2523. }
  2524.  
  2525. /**
  2526. * Converts the textual input of an unsupported command into a text node
  2527. * contained within a color node whose color is determined by errorColor
  2528. */
  2529.  
  2530. }, {
  2531. key: "handleUnsupportedCmd",
  2532. value: function handleUnsupportedCmd() {
  2533. var text = this.nextToken.text;
  2534. var textordArray = [];
  2535.  
  2536. for (var i = 0; i < text.length; i++) {
  2537. textordArray.push(new _ParseNode2.default("textord", text[i], "text"));
  2538. }
  2539.  
  2540. var textNode = new _ParseNode2.default("text", {
  2541. body: textordArray,
  2542. type: "text"
  2543. }, this.mode);
  2544.  
  2545. var colorNode = new _ParseNode2.default("color", {
  2546. color: this.settings.errorColor,
  2547. value: [textNode],
  2548. type: "color"
  2549. }, this.mode);
  2550.  
  2551. this.consume();
  2552. return colorNode;
  2553. }
  2554.  
  2555. /**
  2556. * Parses a group with optional super/subscripts.
  2557. *
  2558. * @param {"]" | "}"} breakOnTokenText - character to stop parsing the group on.
  2559. * @return {?ParseNode}
  2560. */
  2561.  
  2562. }, {
  2563. key: "parseAtom",
  2564. value: function parseAtom(breakOnTokenText) {
  2565. // The body of an atom is an implicit group, so that things like
  2566. // \left(x\right)^2 work correctly.
  2567. var base = this.parseImplicitGroup(breakOnTokenText);
  2568.  
  2569. // In text mode, we don't have superscripts or subscripts
  2570. if (this.mode === "text") {
  2571. return base;
  2572. }
  2573.  
  2574. // Note that base may be empty (i.e. null) at this point.
  2575.  
  2576. var superscript = void 0;
  2577. var subscript = void 0;
  2578. while (true) {
  2579. // Guaranteed in math mode, so eat any spaces first.
  2580. this.consumeSpaces();
  2581.  
  2582. // Lex the first token
  2583. var lex = this.nextToken;
  2584.  
  2585. if (lex.text === "\\limits" || lex.text === "\\nolimits") {
  2586. // We got a limit control
  2587. if (!base || base.type !== "op") {
  2588. throw new _ParseError2.default("Limit controls must follow a math operator", lex);
  2589. } else {
  2590. var limits = lex.text === "\\limits";
  2591. base.value.limits = limits;
  2592. base.value.alwaysHandleSupSub = true;
  2593. }
  2594. this.consume();
  2595. } else if (lex.text === "^") {
  2596. // We got a superscript start
  2597. if (superscript) {
  2598. throw new _ParseError2.default("Double superscript", lex);
  2599. }
  2600. superscript = this.handleSupSubscript("superscript");
  2601. } else if (lex.text === "_") {
  2602. // We got a subscript start
  2603. if (subscript) {
  2604. throw new _ParseError2.default("Double subscript", lex);
  2605. }
  2606. subscript = this.handleSupSubscript("subscript");
  2607. } else if (lex.text === "'") {
  2608. // We got a prime
  2609. if (superscript) {
  2610. throw new _ParseError2.default("Double superscript", lex);
  2611. }
  2612. var prime = new _ParseNode2.default("textord", "\\prime", this.mode);
  2613.  
  2614. // Many primes can be grouped together, so we handle this here
  2615. var primes = [prime];
  2616. this.consume();
  2617. // Keep lexing tokens until we get something that's not a prime
  2618. while (this.nextToken.text === "'") {
  2619. // For each one, add another prime to the list
  2620. primes.push(prime);
  2621. this.consume();
  2622. }
  2623. // If there's a superscript following the primes, combine that
  2624. // superscript in with the primes.
  2625. if (this.nextToken.text === "^") {
  2626. primes.push(this.handleSupSubscript("superscript"));
  2627. }
  2628. // Put everything into an ordgroup as the superscript
  2629. superscript = new _ParseNode2.default("ordgroup", primes, this.mode);
  2630. } else {
  2631. // If it wasn't ^, _, or ', stop parsing super/subscripts
  2632. break;
  2633. }
  2634. }
  2635.  
  2636. if (superscript || subscript) {
  2637. // If we got either a superscript or subscript, create a supsub
  2638. return new _ParseNode2.default("supsub", {
  2639. base: base,
  2640. sup: superscript,
  2641. sub: subscript
  2642. }, this.mode);
  2643. } else {
  2644. // Otherwise return the original body
  2645. return base;
  2646. }
  2647. }
  2648.  
  2649. // A list of the size-changing functions, for use in parseImplicitGroup
  2650.  
  2651.  
  2652. // A list of the style-changing functions, for use in parseImplicitGroup
  2653.  
  2654.  
  2655. // Old font functions
  2656.  
  2657. }, {
  2658. key: "parseImplicitGroup",
  2659.  
  2660.  
  2661. /**
  2662. * Parses an implicit group, which is a group that starts at the end of a
  2663. * specified, and ends right before a higher explicit group ends, or at EOL. It
  2664. * is used for functions that appear to affect the current style, like \Large or
  2665. * \textrm, where instead of keeping a style we just pretend that there is an
  2666. * implicit grouping after it until the end of the group. E.g.
  2667. * small text {\Large large text} small text again
  2668. * It is also used for \left and \right to get the correct grouping.
  2669. *
  2670. * @param {"]" | "}"} breakOnTokenText - character to stop parsing the group on.
  2671. * @return {?ParseNode}
  2672. */
  2673. value: function parseImplicitGroup(breakOnTokenText) {
  2674. var start = this.parseSymbol();
  2675.  
  2676. if (start == null) {
  2677. // If we didn't get anything we handle, fall back to parseFunction
  2678. return this.parseFunction();
  2679. }
  2680.  
  2681. var func = start.result;
  2682.  
  2683. if (func === "\\left") {
  2684. // If we see a left:
  2685. // Parse the entire left function (including the delimiter)
  2686. var left = this.parseGivenFunction(start);
  2687. // Parse out the implicit body
  2688. ++this.leftrightDepth;
  2689. var body = this.parseExpression(false);
  2690. --this.leftrightDepth;
  2691. // Check the next token
  2692. this.expect("\\right", false);
  2693. var right = this.parseFunction();
  2694. return new _ParseNode2.default("leftright", {
  2695. body: body,
  2696. left: left.value.value,
  2697. right: right.value.value
  2698. }, this.mode);
  2699. } else if (func === "\\begin") {
  2700. // begin...end is similar to left...right
  2701. var begin = this.parseGivenFunction(start);
  2702. var envName = begin.value.name;
  2703. if (!_environments2.default.has(envName)) {
  2704. throw new _ParseError2.default("No such environment: " + envName, begin.value.nameGroup);
  2705. }
  2706. // Build the environment object. Arguments and other information will
  2707. // be made available to the begin and end methods using properties.
  2708. var env = _environments2.default.get(envName);
  2709.  
  2710. var _parseArguments = this.parseArguments("\\begin{" + envName + "}", env),
  2711. args = _parseArguments.args,
  2712. optArgs = _parseArguments.optArgs;
  2713.  
  2714. var context = {
  2715. mode: this.mode,
  2716. envName: envName,
  2717. parser: this
  2718. };
  2719. var result = env.handler(context, args, optArgs);
  2720. this.expect("\\end", false);
  2721. var endNameToken = this.nextToken;
  2722. var end = this.parseFunction();
  2723. if (end.value.name !== envName) {
  2724. throw new _ParseError2.default("Mismatch: \\begin{" + envName + "} matched " + "by \\end{" + end.value.name + "}", endNameToken);
  2725. }
  2726. result.position = end.position;
  2727. return result;
  2728. } else if (_utils2.default.contains(Parser.sizeFuncs, func)) {
  2729. // If we see a sizing function, parse out the implicit body
  2730. this.consumeSpaces();
  2731. var _body = this.parseExpression(false, breakOnTokenText);
  2732. return new _ParseNode2.default("sizing", {
  2733. // Figure out what size to use based on the list of functions above
  2734. size: _utils2.default.indexOf(Parser.sizeFuncs, func) + 1,
  2735. value: _body
  2736. }, this.mode);
  2737. } else if (_utils2.default.contains(Parser.styleFuncs, func)) {
  2738. // If we see a styling function, parse out the implicit body
  2739. this.consumeSpaces();
  2740. var _body2 = this.parseExpression(true, breakOnTokenText);
  2741. return new _ParseNode2.default("styling", {
  2742. // Figure out what style to use by pulling out the style from
  2743. // the function name
  2744. style: func.slice(1, func.length - 5),
  2745. value: _body2
  2746. }, this.mode);
  2747. } else if (func in Parser.oldFontFuncs) {
  2748. var style = Parser.oldFontFuncs[func];
  2749. // If we see an old font function, parse out the implicit body
  2750. this.consumeSpaces();
  2751. var _body3 = this.parseExpression(true, breakOnTokenText);
  2752. if (style.slice(0, 4) === 'text') {
  2753. return new _ParseNode2.default("text", {
  2754. style: style,
  2755. body: new _ParseNode2.default("ordgroup", _body3, this.mode)
  2756. }, this.mode);
  2757. } else {
  2758. return new _ParseNode2.default("font", {
  2759. font: style,
  2760. body: new _ParseNode2.default("ordgroup", _body3, this.mode)
  2761. }, this.mode);
  2762. }
  2763. } else if (func === "\\color") {
  2764. // If we see a styling function, parse out the implicit body
  2765. var color = this.parseColorGroup(false);
  2766. if (!color) {
  2767. throw new _ParseError2.default("\\color not followed by color");
  2768. }
  2769. var _body4 = this.parseExpression(true, breakOnTokenText);
  2770. return new _ParseNode2.default("color", {
  2771. type: "color",
  2772. color: color.result.value,
  2773. value: _body4
  2774. }, this.mode);
  2775. } else if (func === "$") {
  2776. if (this.mode === "math") {
  2777. throw new _ParseError2.default("$ within math mode");
  2778. }
  2779. this.consume();
  2780. var outerMode = this.mode;
  2781. this.switchMode("math");
  2782. var _body5 = this.parseExpression(false, "$");
  2783. this.expect("$", true);
  2784. this.switchMode(outerMode);
  2785. return new _ParseNode2.default("styling", {
  2786. style: "text",
  2787. value: _body5
  2788. }, "math");
  2789. } else {
  2790. // Defer to parseGivenFunction if it's not a function we handle
  2791. return this.parseGivenFunction(start);
  2792. }
  2793. }
  2794.  
  2795. /**
  2796. * Parses an entire function, including its base and all of its arguments.
  2797. * It also handles the case where the parsed node is not a function.
  2798. *
  2799. * @return {?ParseNode}
  2800. */
  2801.  
  2802. }, {
  2803. key: "parseFunction",
  2804. value: function parseFunction() {
  2805. var baseGroup = this.parseGroup();
  2806. return baseGroup ? this.parseGivenFunction(baseGroup) : null;
  2807. }
  2808.  
  2809. /**
  2810. * Same as parseFunction(), except that the base is provided, guaranteeing a
  2811. * non-nullable result.
  2812. *
  2813. * @param {ParsedFuncOrArgOrDollar} baseGroup
  2814. * @return {ParseNode}
  2815. */
  2816.  
  2817. }, {
  2818. key: "parseGivenFunction",
  2819. value: function parseGivenFunction(baseGroup) {
  2820. baseGroup = assertFuncOrArg(baseGroup);
  2821. if (baseGroup.type === "fn") {
  2822. var func = baseGroup.result;
  2823. var funcData = _functions2.default[func];
  2824. if (this.mode === "text" && !funcData.allowedInText) {
  2825. throw new _ParseError2.default("Can't use function '" + func + "' in text mode", baseGroup.token);
  2826. } else if (this.mode === "math" && funcData.allowedInMath === false) {
  2827. throw new _ParseError2.default("Can't use function '" + func + "' in math mode", baseGroup.token);
  2828. }
  2829.  
  2830. var _parseArguments2 = this.parseArguments(func, funcData),
  2831. args = _parseArguments2.args,
  2832. optArgs = _parseArguments2.optArgs;
  2833.  
  2834. var token = baseGroup.token;
  2835. var result = this.callFunction(func, args, optArgs, token);
  2836. return new _ParseNode2.default(result.type, result, this.mode);
  2837. } else {
  2838. return baseGroup.result;
  2839. }
  2840. }
  2841.  
  2842. /**
  2843. * Call a function handler with a suitable context and arguments.
  2844. * @param {string} name
  2845. * @param {Array<ParseNode>} args
  2846. * @param {Array<?ParseNode>} optArgs
  2847. * @param {Token=} token
  2848. */
  2849.  
  2850. }, {
  2851. key: "callFunction",
  2852. value: function callFunction(name, args, optArgs, token) {
  2853. var context = {
  2854. funcName: name,
  2855. parser: this,
  2856. token: token
  2857. };
  2858. return _functions2.default[name].handler(context, args, optArgs);
  2859. }
  2860.  
  2861. /**
  2862. * Parses the arguments of a function or environment
  2863. *
  2864. * @param {string} func "\name" or "\begin{name}"
  2865. * @param {{
  2866. * numArgs: number,
  2867. * numOptionalArgs: (number|undefined),
  2868. * }} funcData
  2869. * @return {{
  2870. * args: Array<ParseNode>,
  2871. * optArgs: Array<?ParseNode>,
  2872. * }}
  2873. */
  2874.  
  2875. }, {
  2876. key: "parseArguments",
  2877. value: function parseArguments(func, funcData) {
  2878. var totalArgs = funcData.numArgs + funcData.numOptionalArgs;
  2879. if (totalArgs === 0) {
  2880. return { args: [], optArgs: [] };
  2881. }
  2882.  
  2883. var baseGreediness = funcData.greediness;
  2884. var args = [];
  2885. var optArgs = [];
  2886.  
  2887. for (var i = 0; i < totalArgs; i++) {
  2888. var argType = funcData.argTypes && funcData.argTypes[i];
  2889. var isOptional = i < funcData.numOptionalArgs;
  2890. // Ignore spaces between arguments. As the TeXbook says:
  2891. // "After you have said ‘\def\row#1#2{...}’, you are allowed to
  2892. // put spaces between the arguments (e.g., ‘\row x n’), because
  2893. // TeX doesn’t use single spaces as undelimited arguments."
  2894. if (i > 0 && !isOptional) {
  2895. this.consumeSpaces();
  2896. }
  2897. // Also consume leading spaces in math mode, as parseSymbol
  2898. // won't know what to do with them. This can only happen with
  2899. // macros, e.g. \frac\foo\foo where \foo expands to a space symbol.
  2900. // In LaTeX, the \foo's get treated as (blank) arguments).
  2901. // In KaTeX, for now, both spaces will get consumed.
  2902. // TODO(edemaine)
  2903. if (i === 0 && !isOptional && this.mode === "math") {
  2904. this.consumeSpaces();
  2905. }
  2906. var nextToken = this.nextToken;
  2907. var arg = argType ? this.parseGroupOfType(argType, isOptional) : this.parseGroup(isOptional);
  2908. if (!arg) {
  2909. if (isOptional) {
  2910. optArgs.push(null);
  2911. continue;
  2912. }
  2913. if (!this.settings.throwOnError && this.nextToken.text[0] === "\\") {
  2914. arg = newArgument(this.handleUnsupportedCmd(), nextToken);
  2915. } else {
  2916. throw new _ParseError2.default("Expected group after '" + func + "'", nextToken);
  2917. }
  2918. }
  2919. var argNode = void 0;
  2920. arg = assertFuncOrArg(arg);
  2921. if (arg.type === "fn") {
  2922. var argGreediness = _functions2.default[arg.result].greediness;
  2923. if (argGreediness > baseGreediness) {
  2924. argNode = this.parseGivenFunction(arg);
  2925. } else {
  2926. throw new _ParseError2.default("Got function '" + arg.result + "' as " + "argument to '" + func + "'", nextToken);
  2927. }
  2928. } else {
  2929. argNode = arg.result;
  2930. }
  2931. (isOptional ? optArgs : args).push(argNode);
  2932. }
  2933.  
  2934. return { args: args, optArgs: optArgs };
  2935. }
  2936.  
  2937. /**
  2938. * Parses a group when the mode is changing.
  2939. *
  2940. * @return {?ParsedFuncOrArgOrDollar}
  2941. */
  2942.  
  2943. }, {
  2944. key: "parseGroupOfType",
  2945. value: function parseGroupOfType(innerMode, optional) {
  2946. var outerMode = this.mode;
  2947. // Handle `original` argTypes
  2948. if (innerMode === "original") {
  2949. innerMode = outerMode;
  2950. }
  2951.  
  2952. if (innerMode === "color") {
  2953. return this.parseColorGroup(optional);
  2954. }
  2955. if (innerMode === "size") {
  2956. return this.parseSizeGroup(optional);
  2957. }
  2958.  
  2959. // By the time we get here, innerMode is one of "text" or "math".
  2960. // We switch the mode of the parser, recurse, then restore the old mode.
  2961. this.switchMode(innerMode);
  2962. var res = this.parseGroup(optional);
  2963. this.switchMode(outerMode);
  2964. return res;
  2965. }
  2966. }, {
  2967. key: "consumeSpaces",
  2968. value: function consumeSpaces() {
  2969. while (this.nextToken.text === " ") {
  2970. this.consume();
  2971. }
  2972. }
  2973.  
  2974. /**
  2975. * Parses a group, essentially returning the string formed by the
  2976. * brace-enclosed tokens plus some position information.
  2977. *
  2978. * @param {string} modeName Used to describe the mode in error messages
  2979. * @param {boolean=} optional Whether the group is optional or required
  2980. * @return {?Token}
  2981. */
  2982.  
  2983. }, {
  2984. key: "parseStringGroup",
  2985. value: function parseStringGroup(modeName, optional) {
  2986. if (optional && this.nextToken.text !== "[") {
  2987. return null;
  2988. }
  2989. var outerMode = this.mode;
  2990. this.mode = "text";
  2991. this.expect(optional ? "[" : "{");
  2992. var str = "";
  2993. var firstToken = this.nextToken;
  2994. var lastToken = firstToken;
  2995. while (this.nextToken.text !== (optional ? "]" : "}")) {
  2996. if (this.nextToken.text === "EOF") {
  2997. throw new _ParseError2.default("Unexpected end of input in " + modeName, firstToken.range(this.nextToken, str));
  2998. }
  2999. lastToken = this.nextToken;
  3000. str += lastToken.text;
  3001. this.consume();
  3002. }
  3003. this.mode = outerMode;
  3004. this.expect(optional ? "]" : "}");
  3005. return firstToken.range(lastToken, str);
  3006. }
  3007.  
  3008. /**
  3009. * Parses a regex-delimited group: the largest sequence of tokens
  3010. * whose concatenated strings match `regex`. Returns the string
  3011. * formed by the tokens plus some position information.
  3012. *
  3013. * @param {RegExp} regex
  3014. * @param {string} modeName Used to describe the mode in error messages
  3015. * @return {Token}
  3016. */
  3017.  
  3018. }, {
  3019. key: "parseRegexGroup",
  3020. value: function parseRegexGroup(regex, modeName) {
  3021. var outerMode = this.mode;
  3022. this.mode = "text";
  3023. var firstToken = this.nextToken;
  3024. var lastToken = firstToken;
  3025. var str = "";
  3026. while (this.nextToken.text !== "EOF" && regex.test(str + this.nextToken.text)) {
  3027. lastToken = this.nextToken;
  3028. str += lastToken.text;
  3029. this.consume();
  3030. }
  3031. if (str === "") {
  3032. throw new _ParseError2.default("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken);
  3033. }
  3034. this.mode = outerMode;
  3035. return firstToken.range(lastToken, str);
  3036. }
  3037.  
  3038. /**
  3039. * Parses a color description.
  3040. */
  3041.  
  3042. }, {
  3043. key: "parseColorGroup",
  3044. value: function parseColorGroup(optional) {
  3045. var res = this.parseStringGroup("color", optional);
  3046. if (!res) {
  3047. return null;
  3048. }
  3049. var match = /^(#[a-f0-9]{3}|#[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);
  3050. if (!match) {
  3051. throw new _ParseError2.default("Invalid color: '" + res.text + "'", res);
  3052. }
  3053. return newArgument(new _ParseNode2.default("color", match[0], this.mode), res);
  3054. }
  3055.  
  3056. /**
  3057. * Parses a size specification, consisting of magnitude and unit.
  3058. */
  3059.  
  3060. }, {
  3061. key: "parseSizeGroup",
  3062. value: function parseSizeGroup(optional) {
  3063. var res = void 0;
  3064. if (!optional && this.nextToken.text !== "{") {
  3065. res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size");
  3066. } else {
  3067. res = this.parseStringGroup("size", optional);
  3068. }
  3069. if (!res) {
  3070. return null;
  3071. }
  3072. var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text);
  3073. if (!match) {
  3074. throw new _ParseError2.default("Invalid size: '" + res.text + "'", res);
  3075. }
  3076. var data = {
  3077. number: +(match[1] + match[2]), // sign + magnitude, cast to number
  3078. unit: match[3]
  3079. };
  3080. if (!(0, _units.validUnit)(data)) {
  3081. throw new _ParseError2.default("Invalid unit: '" + data.unit + "'", res);
  3082. }
  3083. return newArgument(new _ParseNode2.default("size", data, this.mode), res);
  3084. }
  3085.  
  3086. /**
  3087. * If the argument is false or absent, this parses an ordinary group,
  3088. * which is either a single nucleus (like "x") or an expression
  3089. * in braces (like "{x+y}").
  3090. * If the argument is true, it parses either a bracket-delimited expression
  3091. * (like "[x+y]") or returns null to indicate the absence of a
  3092. * bracket-enclosed group.
  3093. *
  3094. * @param {boolean=} optional Whether the group is optional or required
  3095. * @return {?ParsedFuncOrArgOrDollar}
  3096. */
  3097.  
  3098. }, {
  3099. key: "parseGroup",
  3100. value: function parseGroup(optional) {
  3101. var firstToken = this.nextToken;
  3102. // Try to parse an open brace
  3103. if (this.nextToken.text === (optional ? "[" : "{")) {
  3104. // If we get a brace, parse an expression
  3105. this.consume();
  3106. var expression = this.parseExpression(false, optional ? "]" : "}");
  3107. var lastToken = this.nextToken;
  3108. // Make sure we get a close brace
  3109. this.expect(optional ? "]" : "}");
  3110. if (this.mode === "text") {
  3111. this.formLigatures(expression);
  3112. }
  3113. return newArgument(new _ParseNode2.default("ordgroup", expression, this.mode, firstToken, lastToken), firstToken.range(lastToken, firstToken.text));
  3114. } else {
  3115. // Otherwise, just return a nucleus, or nothing for an optional group
  3116. return optional ? null : this.parseSymbol();
  3117. }
  3118. }
  3119.  
  3120. /**
  3121. * Form ligature-like combinations of characters for text mode.
  3122. * This includes inputs like "--", "---", "``" and "''".
  3123. * The result will simply replace multiple textord nodes with a single
  3124. * character in each value by a single textord node having multiple
  3125. * characters in its value. The representation is still ASCII source.
  3126. *
  3127. * @param {Array.<ParseNode>} group the nodes of this group,
  3128. * list will be moified in place
  3129. */
  3130.  
  3131. }, {
  3132. key: "formLigatures",
  3133. value: function formLigatures(group) {
  3134. var n = group.length - 1;
  3135. for (var i = 0; i < n; ++i) {
  3136. var a = group[i];
  3137. var v = a.value;
  3138. if (v === "-" && group[i + 1].value === "-") {
  3139. if (i + 1 < n && group[i + 2].value === "-") {
  3140. group.splice(i, 3, new _ParseNode2.default("textord", "---", "text", a, group[i + 2]));
  3141. n -= 2;
  3142. } else {
  3143. group.splice(i, 2, new _ParseNode2.default("textord", "--", "text", a, group[i + 1]));
  3144. n -= 1;
  3145. }
  3146. }
  3147. if ((v === "'" || v === "`") && group[i + 1].value === v) {
  3148. group.splice(i, 2, new _ParseNode2.default("textord", v + v, "text", a, group[i + 1]));
  3149. n -= 1;
  3150. }
  3151. }
  3152. }
  3153.  
  3154. /**
  3155. * Parse a single symbol out of the string. Here, we handle both the functions
  3156. * we have defined, as well as the single character symbols
  3157. *
  3158. * @return {?ParsedFuncOrArgOrDollar}
  3159. */
  3160.  
  3161. }, {
  3162. key: "parseSymbol",
  3163. value: function parseSymbol() {
  3164. var nucleus = this.nextToken;
  3165.  
  3166. if (_functions2.default[nucleus.text]) {
  3167. this.consume();
  3168. // If there exists a function with this name, we return the function and
  3169. // say that it is a function.
  3170. return newFunction(nucleus);
  3171. } else if (_symbols2.default[this.mode][nucleus.text]) {
  3172. this.consume();
  3173. // Otherwise if this is a no-argument function, find the type it
  3174. // corresponds to in the symbols map
  3175. return newArgument(new _ParseNode2.default(_symbols2.default[this.mode][nucleus.text].group, nucleus.text, this.mode, nucleus), nucleus);
  3176. } else if (this.mode === "text" && _unicodeRegexes.cjkRegex.test(nucleus.text)) {
  3177. this.consume();
  3178. return newArgument(new _ParseNode2.default("textord", nucleus.text, this.mode, nucleus), nucleus);
  3179. } else if (nucleus.text === "$") {
  3180. return newDollar(nucleus);
  3181. } else if (/^\\verb[^a-zA-Z]/.test(nucleus.text)) {
  3182. this.consume();
  3183. var arg = nucleus.text.slice(5);
  3184. var star = arg.charAt(0) === "*";
  3185. if (star) {
  3186. arg = arg.slice(1);
  3187. }
  3188. // Lexer's tokenRegex is constructed to always have matching
  3189. // first/last characters.
  3190. if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) {
  3191. throw new _ParseError2.default("\\verb assertion failed --\n please report what input caused this bug");
  3192. }
  3193. arg = arg.slice(1, -1); // remove first and last char
  3194. return newArgument(new _ParseNode2.default("verb", {
  3195. body: arg,
  3196. star: star
  3197. }, "text"), nucleus);
  3198. } else {
  3199. return null;
  3200. }
  3201. }
  3202. }]);
  3203. return Parser;
  3204. }();
  3205.  
  3206. Parser.endOfExpression = ["}", "\\end", "\\right", "&", "\\\\", "\\cr"];
  3207. Parser.SUPSUB_GREEDINESS = 1;
  3208. Parser.sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"];
  3209. Parser.styleFuncs = ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"];
  3210. Parser.oldFontFuncs = {
  3211. "\\rm": "mathrm",
  3212. "\\sf": "mathsf",
  3213. "\\tt": "mathtt",
  3214. "\\bf": "mathbf",
  3215. "\\it": "mathit"
  3216. //"\\sl": "textsl",
  3217. //"\\sc": "textsc",
  3218. };
  3219. exports.default = Parser;
  3220.  
  3221. },{"./MacroExpander":82,"./ParseError":84,"./ParseNode":85,"./environments":99,"./functions":103,"./symbols":112,"./unicodeRegexes":113,"./units":114,"./utils":115,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],87:[function(require,module,exports){
  3222. "use strict";
  3223.  
  3224. Object.defineProperty(exports, "__esModule", {
  3225. value: true
  3226. });
  3227.  
  3228. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  3229.  
  3230. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  3231.  
  3232. var _utils = require("./utils");
  3233.  
  3234. var _utils2 = _interopRequireDefault(_utils);
  3235.  
  3236. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3237.  
  3238. /**
  3239. * The main Settings object
  3240. *
  3241. * The current options stored are:
  3242. * - displayMode: Whether the expression should be typeset as inline math
  3243. * (false, the default), meaning that the math starts in
  3244. * \textstyle and is placed in an inline-block); or as display
  3245. * math (true), meaning that the math starts in \displaystyle
  3246. * and is placed in a block with vertical margin.
  3247. */
  3248. var Settings = function Settings(options) {
  3249. (0, _classCallCheck3.default)(this, Settings);
  3250.  
  3251. // allow null options
  3252. options = options || {};
  3253. this.displayMode = _utils2.default.deflt(options.displayMode, false);
  3254. this.throwOnError = _utils2.default.deflt(options.throwOnError, true);
  3255. this.errorColor = _utils2.default.deflt(options.errorColor, "#cc0000");
  3256. this.macros = options.macros || {};
  3257. this.colorIsTextColor = _utils2.default.deflt(options.colorIsTextColor, false);
  3258. this.maxSize = Math.max(0, _utils2.default.deflt(options.maxSize, Infinity));
  3259. };
  3260. /**
  3261. * This is a module for storing settings passed into KaTeX. It correctly handles
  3262. * default settings.
  3263. */
  3264.  
  3265. exports.default = Settings;
  3266.  
  3267. },{"./utils":115,"babel-runtime/helpers/classCallCheck":8}],88:[function(require,module,exports){
  3268. "use strict";
  3269.  
  3270. Object.defineProperty(exports, "__esModule", {
  3271. value: true
  3272. });
  3273.  
  3274. var _freeze = require("babel-runtime/core-js/object/freeze");
  3275.  
  3276. var _freeze2 = _interopRequireDefault(_freeze);
  3277.  
  3278. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  3279.  
  3280. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  3281.  
  3282. var _createClass2 = require("babel-runtime/helpers/createClass");
  3283.  
  3284. var _createClass3 = _interopRequireDefault(_createClass2);
  3285.  
  3286. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3287.  
  3288. /**
  3289. * Lexing or parsing positional information for error reporting.
  3290. * This object is immutable.
  3291. */
  3292. var SourceLocation = function () {
  3293. // End offset, zero-based exclusive.
  3294.  
  3295. // Lexer holding the input string.
  3296. function SourceLocation(lexer, start, end) {
  3297. (0, _classCallCheck3.default)(this, SourceLocation);
  3298.  
  3299. this.lexer = lexer;
  3300. this.start = start;
  3301. this.end = end;
  3302. (0, _freeze2.default)(this); // Immutable to allow sharing in range().
  3303. }
  3304.  
  3305. /**
  3306. * Merges two `SourceLocation`s from location providers, given they are
  3307. * provided in order of appearance.
  3308. * - Returns the first one's location if only the first is provided.
  3309. * - Returns a merged range of the first and the last if both are provided
  3310. * and their lexers match.
  3311. * - Otherwise, returns null.
  3312. */
  3313. // Start offset, zero-based inclusive.
  3314.  
  3315.  
  3316. (0, _createClass3.default)(SourceLocation, null, [{
  3317. key: "range",
  3318. value: function range(first, second) {
  3319. if (!second) {
  3320. return first && first.loc;
  3321. } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) {
  3322. return null;
  3323. } else {
  3324. return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end);
  3325. }
  3326. }
  3327. }]);
  3328. return SourceLocation;
  3329. }();
  3330.  
  3331. exports.default = SourceLocation;
  3332.  
  3333. },{"babel-runtime/core-js/object/freeze":7,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],89:[function(require,module,exports){
  3334. "use strict";
  3335.  
  3336. Object.defineProperty(exports, "__esModule", {
  3337. value: true
  3338. });
  3339.  
  3340. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  3341.  
  3342. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  3343.  
  3344. var _createClass2 = require("babel-runtime/helpers/createClass");
  3345.  
  3346. var _createClass3 = _interopRequireDefault(_createClass2);
  3347.  
  3348. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3349.  
  3350. /**
  3351. * This file contains information and classes for the various kinds of styles
  3352. * used in TeX. It provides a generic `Style` class, which holds information
  3353. * about a specific style. It then provides instances of all the different kinds
  3354. * of styles possible, and provides functions to move between them and get
  3355. * information about them.
  3356. */
  3357.  
  3358. /**
  3359. * The main style class. Contains a unique id for the style, a size (which is
  3360. * the same for cramped and uncramped version of a style), and a cramped flag.
  3361. */
  3362. var Style = function () {
  3363. function Style(id, size, cramped) {
  3364. (0, _classCallCheck3.default)(this, Style);
  3365.  
  3366. this.id = id;
  3367. this.size = size;
  3368. this.cramped = cramped;
  3369. }
  3370.  
  3371. /**
  3372. * Get the style of a superscript given a base in the current style.
  3373. */
  3374.  
  3375.  
  3376. (0, _createClass3.default)(Style, [{
  3377. key: "sup",
  3378. value: function sup() {
  3379. return styles[_sup[this.id]];
  3380. }
  3381.  
  3382. /**
  3383. * Get the style of a subscript given a base in the current style.
  3384. */
  3385.  
  3386. }, {
  3387. key: "sub",
  3388. value: function sub() {
  3389. return styles[_sub[this.id]];
  3390. }
  3391.  
  3392. /**
  3393. * Get the style of a fraction numerator given the fraction in the current
  3394. * style.
  3395. */
  3396.  
  3397. }, {
  3398. key: "fracNum",
  3399. value: function fracNum() {
  3400. return styles[_fracNum[this.id]];
  3401. }
  3402.  
  3403. /**
  3404. * Get the style of a fraction denominator given the fraction in the current
  3405. * style.
  3406. */
  3407.  
  3408. }, {
  3409. key: "fracDen",
  3410. value: function fracDen() {
  3411. return styles[_fracDen[this.id]];
  3412. }
  3413.  
  3414. /**
  3415. * Get the cramped version of a style (in particular, cramping a cramped style
  3416. * doesn't change the style).
  3417. */
  3418.  
  3419. }, {
  3420. key: "cramp",
  3421. value: function cramp() {
  3422. return styles[_cramp[this.id]];
  3423. }
  3424.  
  3425. /**
  3426. * Get a text or display version of this style.
  3427. */
  3428.  
  3429. }, {
  3430. key: "text",
  3431. value: function text() {
  3432. return styles[_text[this.id]];
  3433. }
  3434.  
  3435. /**
  3436. * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
  3437. */
  3438.  
  3439. }, {
  3440. key: "isTight",
  3441. value: function isTight() {
  3442. return this.size >= 2;
  3443. }
  3444. }]);
  3445. return Style;
  3446. }();
  3447.  
  3448. // Export an interface for type checking, but don't expose the implementation.
  3449. // This way, no more styles can be generated.
  3450.  
  3451.  
  3452. // IDs of the different styles
  3453. var D = 0;
  3454. var Dc = 1;
  3455. var T = 2;
  3456. var Tc = 3;
  3457. var S = 4;
  3458. var Sc = 5;
  3459. var SS = 6;
  3460. var SSc = 7;
  3461.  
  3462. // Instances of the different styles
  3463. var 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)];
  3464.  
  3465. // Lookup tables for switching from one style to another
  3466. var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];
  3467. var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];
  3468. var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];
  3469. var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];
  3470. var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];
  3471. var _text = [D, Dc, T, Tc, T, Tc, T, Tc];
  3472.  
  3473. // We only export some of the styles.
  3474. exports.default = {
  3475. DISPLAY: styles[D],
  3476. TEXT: styles[T],
  3477. SCRIPT: styles[S],
  3478. SCRIPTSCRIPT: styles[SS]
  3479. };
  3480.  
  3481. },{"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],90:[function(require,module,exports){
  3482. "use strict";
  3483.  
  3484. Object.defineProperty(exports, "__esModule", {
  3485. value: true
  3486. });
  3487. exports.Token = undefined;
  3488.  
  3489. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  3490.  
  3491. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  3492.  
  3493. var _createClass2 = require("babel-runtime/helpers/createClass");
  3494.  
  3495. var _createClass3 = _interopRequireDefault(_createClass2);
  3496.  
  3497. var _SourceLocation = require("./SourceLocation");
  3498.  
  3499. var _SourceLocation2 = _interopRequireDefault(_SourceLocation);
  3500.  
  3501. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3502.  
  3503. /**
  3504. * The resulting token returned from `lex`.
  3505. *
  3506. * It consists of the token text plus some position information.
  3507. * The position information is essentially a range in an input string,
  3508. * but instead of referencing the bare input string, we refer to the lexer.
  3509. * That way it is possible to attach extra metadata to the input string,
  3510. * like for example a file name or similar.
  3511. *
  3512. * The position information is optional, so it is OK to construct synthetic
  3513. * tokens if appropriate. Not providing available position information may
  3514. * lead to degraded error reporting, though.
  3515. */
  3516.  
  3517.  
  3518. /**
  3519. * Interface required to break circular dependency between Token, Lexer, and
  3520. * ParseError.
  3521. */
  3522. var Token = exports.Token = function () {
  3523. function Token(text, // the text of this token
  3524. loc) {
  3525. (0, _classCallCheck3.default)(this, Token);
  3526.  
  3527. this.text = text;
  3528. this.loc = loc;
  3529. }
  3530.  
  3531. /**
  3532. * Given a pair of tokens (this and endToken), compute a `Token` encompassing
  3533. * the whole input range enclosed by these two.
  3534. */
  3535.  
  3536.  
  3537. (0, _createClass3.default)(Token, [{
  3538. key: "range",
  3539. value: function range(endToken, // last token of the range, inclusive
  3540. text) // the text of the newly constructed token
  3541. {
  3542. return new Token(text, _SourceLocation2.default.range(this, endToken));
  3543. }
  3544. }]);
  3545. return Token;
  3546. }();
  3547.  
  3548. },{"./SourceLocation":88,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],91:[function(require,module,exports){
  3549. "use strict";
  3550.  
  3551. Object.defineProperty(exports, "__esModule", {
  3552. value: true
  3553. });
  3554.  
  3555. var _domTree = require("./domTree");
  3556.  
  3557. var _domTree2 = _interopRequireDefault(_domTree);
  3558.  
  3559. var _fontMetrics = require("./fontMetrics");
  3560.  
  3561. var _fontMetrics2 = _interopRequireDefault(_fontMetrics);
  3562.  
  3563. var _symbols = require("./symbols");
  3564.  
  3565. var _symbols2 = _interopRequireDefault(_symbols);
  3566.  
  3567. var _utils = require("./utils");
  3568.  
  3569. var _utils2 = _interopRequireDefault(_utils);
  3570.  
  3571. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3572.  
  3573. // The following have to be loaded from Main-Italic font, using class mainit
  3574. /* eslint no-console:0 */
  3575. /**
  3576. * This module contains general functions that can be used for building
  3577. * different kinds of domTree nodes in a consistent manner.
  3578. */
  3579.  
  3580. var mainitLetters = ["\\imath", // dotless i
  3581. "\\jmath", // dotless j
  3582. "\\pounds"];
  3583.  
  3584. /**
  3585. * Looks up the given symbol in fontMetrics, after applying any symbol
  3586. * replacements defined in symbol.js
  3587. */
  3588. var lookupSymbol = function lookupSymbol(value, fontFamily, mode) {
  3589. // Replace the value with its replaced value from symbol.js
  3590. if (_symbols2.default[mode][value] && _symbols2.default[mode][value].replace) {
  3591. value = _symbols2.default[mode][value].replace;
  3592. }
  3593. return {
  3594. value: value,
  3595. metrics: _fontMetrics2.default.getCharacterMetrics(value, fontFamily)
  3596. };
  3597. };
  3598.  
  3599. /**
  3600. * Makes a symbolNode after translation via the list of symbols in symbols.js.
  3601. * Correctly pulls out metrics for the character, and optionally takes a list of
  3602. * classes to be attached to the node.
  3603. *
  3604. * TODO: make argument order closer to makeSpan
  3605. * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
  3606. * should if present come first in `classes`.
  3607. */
  3608. var makeSymbol = function makeSymbol(value, fontFamily, mode, options, classes) {
  3609. var lookup = lookupSymbol(value, fontFamily, mode);
  3610. var metrics = lookup.metrics;
  3611. value = lookup.value;
  3612.  
  3613. var symbolNode = void 0;
  3614. if (metrics) {
  3615. var italic = metrics.italic;
  3616. if (mode === "text") {
  3617. italic = 0;
  3618. }
  3619. symbolNode = new _domTree2.default.symbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, classes);
  3620. } else {
  3621. // TODO(emily): Figure out a good way to only print this in development
  3622. typeof console !== "undefined" && console.warn("No character metrics for '" + value + "' in style '" + fontFamily + "'");
  3623. symbolNode = new _domTree2.default.symbolNode(value, 0, 0, 0, 0, classes);
  3624. }
  3625.  
  3626. if (options) {
  3627. symbolNode.maxFontSize = options.sizeMultiplier;
  3628. if (options.style.isTight()) {
  3629. symbolNode.classes.push("mtight");
  3630. }
  3631. if (options.getColor()) {
  3632. symbolNode.style.color = options.getColor();
  3633. }
  3634. }
  3635.  
  3636. return symbolNode;
  3637. };
  3638.  
  3639. /**
  3640. * Makes a symbol in Main-Regular or AMS-Regular.
  3641. * Used for rel, bin, open, close, inner, and punct.
  3642. */
  3643. var mathsym = function mathsym(value, mode, options, classes) {
  3644. // Decide what font to render the symbol in by its entry in the symbols
  3645. // table.
  3646. // Have a special case for when the value = \ because the \ is used as a
  3647. // textord in unsupported command errors but cannot be parsed as a regular
  3648. // text ordinal and is therefore not present as a symbol in the symbols
  3649. // table for text
  3650. if (value === "\\" || _symbols2.default[mode][value].font === "main") {
  3651. return makeSymbol(value, "Main-Regular", mode, options, classes);
  3652. } else {
  3653. return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"]));
  3654. }
  3655. };
  3656.  
  3657. /**
  3658. * Makes a symbol in the default font for mathords and textords.
  3659. */
  3660. var mathDefault = function mathDefault(value, mode, options, classes, type) {
  3661. if (type === "mathord") {
  3662. var fontLookup = mathit(value, mode, options, classes);
  3663. return makeSymbol(value, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass]));
  3664. } else if (type === "textord") {
  3665. var font = _symbols2.default[mode][value] && _symbols2.default[mode][value].font;
  3666. if (font === "ams") {
  3667. return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"]));
  3668. } else {
  3669. // if (font === "main") {
  3670. return makeSymbol(value, "Main-Regular", mode, options, classes.concat(["mathrm"]));
  3671. }
  3672. } else {
  3673. throw new Error("unexpected type: " + type + " in mathDefault");
  3674. }
  3675. };
  3676.  
  3677. /**
  3678. * Determines which of the two font names (Main-Italic and Math-Italic) and
  3679. * corresponding style tags (mainit or mathit) to use for font "mathit",
  3680. * depending on the symbol. Use this function instead of fontMap for font
  3681. * "mathit".
  3682. */
  3683. var mathit = function mathit(value, mode, options, classes) {
  3684. if (/[0-9]/.test(value.charAt(0)) ||
  3685. // glyphs for \imath and \jmath do not exist in Math-Italic so we
  3686. // need to use Main-Italic instead
  3687. _utils2.default.contains(mainitLetters, value)) {
  3688. return {
  3689. fontName: "Main-Italic",
  3690. fontClass: "mainit"
  3691. };
  3692. } else {
  3693. return {
  3694. fontName: "Math-Italic",
  3695. fontClass: "mathit"
  3696. };
  3697. }
  3698. };
  3699.  
  3700. /**
  3701. * Makes either a mathord or textord in the correct font and color.
  3702. */
  3703. var makeOrd = function makeOrd(group, options, type) {
  3704. var mode = group.mode;
  3705. var value = group.value;
  3706.  
  3707. var classes = ["mord"];
  3708.  
  3709. var font = options.font;
  3710. if (font) {
  3711. var fontLookup = void 0;
  3712. if (font === "mathit" || _utils2.default.contains(mainitLetters, value)) {
  3713. fontLookup = mathit(value, mode, options, classes);
  3714. } else {
  3715. fontLookup = fontMap[font];
  3716. }
  3717. if (lookupSymbol(value, fontLookup.fontName, mode).metrics) {
  3718. return makeSymbol(value, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass || font]));
  3719. } else {
  3720. return mathDefault(value, mode, options, classes, type);
  3721. }
  3722. } else {
  3723. return mathDefault(value, mode, options, classes, type);
  3724. }
  3725. };
  3726.  
  3727. /**
  3728. * Combine as many characters as possible in the given array of characters
  3729. * via their tryCombine method.
  3730. */
  3731. var tryCombineChars = function tryCombineChars(chars) {
  3732. for (var i = 0; i < chars.length - 1; i++) {
  3733. if (chars[i].tryCombine(chars[i + 1])) {
  3734. chars.splice(i + 1, 1);
  3735. i--;
  3736. }
  3737. }
  3738. return chars;
  3739. };
  3740.  
  3741. /**
  3742. * Calculate the height, depth, and maxFontSize of an element based on its
  3743. * children.
  3744. */
  3745. var sizeElementFromChildren = function sizeElementFromChildren(elem) {
  3746. var height = 0;
  3747. var depth = 0;
  3748. var maxFontSize = 0;
  3749.  
  3750. if (elem.children) {
  3751. for (var i = 0; i < elem.children.length; i++) {
  3752. if (elem.children[i].height > height) {
  3753. height = elem.children[i].height;
  3754. }
  3755. if (elem.children[i].depth > depth) {
  3756. depth = elem.children[i].depth;
  3757. }
  3758. if (elem.children[i].maxFontSize > maxFontSize) {
  3759. maxFontSize = elem.children[i].maxFontSize;
  3760. }
  3761. }
  3762. }
  3763.  
  3764. elem.height = height;
  3765. elem.depth = depth;
  3766. elem.maxFontSize = maxFontSize;
  3767. };
  3768.  
  3769. /**
  3770. * Makes a span with the given list of classes, list of children, and options.
  3771. *
  3772. * TODO: Ensure that `options` is always provided (currently some call sites
  3773. * don't pass it).
  3774. * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
  3775. * should if present come first in `classes`.
  3776. */
  3777. var makeSpan = function makeSpan(classes, children, options) {
  3778. var span = new _domTree2.default.span(classes, children, options);
  3779.  
  3780. sizeElementFromChildren(span);
  3781.  
  3782. return span;
  3783. };
  3784.  
  3785. /**
  3786. * Prepends the given children to the given span, updating height, depth, and
  3787. * maxFontSize.
  3788. */
  3789. var prependChildren = function prependChildren(span, children) {
  3790. span.children = children.concat(span.children);
  3791.  
  3792. sizeElementFromChildren(span);
  3793. };
  3794.  
  3795. /**
  3796. * Makes a document fragment with the given list of children.
  3797. */
  3798. var makeFragment = function makeFragment(children) {
  3799. var fragment = new _domTree2.default.documentFragment(children);
  3800.  
  3801. sizeElementFromChildren(fragment);
  3802.  
  3803. return fragment;
  3804. };
  3805.  
  3806. /**
  3807. * Makes a vertical list by stacking elements and kerns on top of each other.
  3808. * Allows for many different ways of specifying the positioning method.
  3809. *
  3810. * Arguments:
  3811. * - children: A list of child or kern nodes to be stacked on top of each other
  3812. * (i.e. the first element will be at the bottom, and the last at
  3813. * the top). Element nodes are specified as
  3814. * {type: "elem", elem: node}
  3815. * while kern nodes are specified as
  3816. * {type: "kern", size: size}
  3817. * - positionType: The method by which the vlist should be positioned. Valid
  3818. * values are:
  3819. * - "individualShift": The children list only contains elem
  3820. * nodes, and each node contains an extra
  3821. * "shift" value of how much it should be
  3822. * shifted (note that shifting is always
  3823. * moving downwards). positionData is
  3824. * ignored.
  3825. * - "top": The positionData specifies the topmost point of
  3826. * the vlist (note this is expected to be a height,
  3827. * so positive values move up)
  3828. * - "bottom": The positionData specifies the bottommost point
  3829. * of the vlist (note this is expected to be a
  3830. * depth, so positive values move down
  3831. * - "shift": The vlist will be positioned such that its
  3832. * baseline is positionData away from the baseline
  3833. * of the first child. Positive values move
  3834. * downwards.
  3835. * - "firstBaseline": The vlist will be positioned such that
  3836. * its baseline is aligned with the
  3837. * baseline of the first child.
  3838. * positionData is ignored. (this is
  3839. * equivalent to "shift" with
  3840. * positionData=0)
  3841. * - positionData: Data used in different ways depending on positionType
  3842. * - options: An Options object
  3843. *
  3844. */
  3845. var makeVList = function makeVList(children, positionType, positionData, options) {
  3846. var depth = void 0;
  3847. var currPos = void 0;
  3848. var i = void 0;
  3849. if (positionType === "individualShift") {
  3850. var oldChildren = children;
  3851. children = [oldChildren[0]];
  3852.  
  3853. // Add in kerns to the list of children to get each element to be
  3854. // shifted to the correct specified shift
  3855. depth = -oldChildren[0].shift - oldChildren[0].elem.depth;
  3856. currPos = depth;
  3857. for (i = 1; i < oldChildren.length; i++) {
  3858. var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth;
  3859. var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth);
  3860.  
  3861. currPos = currPos + diff;
  3862.  
  3863. children.push({ type: "kern", size: size });
  3864. children.push(oldChildren[i]);
  3865. }
  3866. } else if (positionType === "top") {
  3867. // We always start at the bottom, so calculate the bottom by adding up
  3868. // all the sizes
  3869. var bottom = positionData;
  3870. for (i = 0; i < children.length; i++) {
  3871. if (children[i].type === "kern") {
  3872. bottom -= children[i].size;
  3873. } else {
  3874. bottom -= children[i].elem.height + children[i].elem.depth;
  3875. }
  3876. }
  3877. depth = bottom;
  3878. } else if (positionType === "bottom") {
  3879. depth = -positionData;
  3880. } else if (positionType === "shift") {
  3881. depth = -children[0].elem.depth - positionData;
  3882. } else if (positionType === "firstBaseline") {
  3883. depth = -children[0].elem.depth;
  3884. } else {
  3885. depth = 0;
  3886. }
  3887.  
  3888. // Create a strut that is taller than any list item. The strut is added to
  3889. // each item, where it will determine the item's baseline. Since it has
  3890. // `overflow:hidden`, the strut's top edge will sit on the item's line box's
  3891. // top edge and the strut's bottom edge will sit on the item's baseline,
  3892. // with no additional line-height spacing. This allows the item baseline to
  3893. // be positioned precisely without worrying about font ascent and
  3894. // line-height.
  3895. var pstrutSize = 0;
  3896. for (i = 0; i < children.length; i++) {
  3897. if (children[i].type === "elem") {
  3898. var child = children[i].elem;
  3899. pstrutSize = Math.max(pstrutSize, child.maxFontSize, child.height);
  3900. }
  3901. }
  3902. pstrutSize += 2;
  3903. var pstrut = makeSpan(["pstrut"], []);
  3904. pstrut.style.height = pstrutSize + "em";
  3905.  
  3906. // Create a new list of actual children at the correct offsets
  3907. var realChildren = [];
  3908. var minPos = depth;
  3909. var maxPos = depth;
  3910. currPos = depth;
  3911. for (i = 0; i < children.length; i++) {
  3912. if (children[i].type === "kern") {
  3913. currPos += children[i].size;
  3914. } else {
  3915. var _child = children[i].elem;
  3916.  
  3917. var childWrap = makeSpan([], [pstrut, _child]);
  3918. childWrap.style.top = -pstrutSize - currPos - _child.depth + "em";
  3919. if (children[i].marginLeft) {
  3920. childWrap.style.marginLeft = children[i].marginLeft;
  3921. }
  3922. if (children[i].marginRight) {
  3923. childWrap.style.marginRight = children[i].marginRight;
  3924. }
  3925.  
  3926. realChildren.push(childWrap);
  3927. currPos += _child.height + _child.depth;
  3928. }
  3929. minPos = Math.min(minPos, currPos);
  3930. maxPos = Math.max(maxPos, currPos);
  3931. }
  3932.  
  3933. // The vlist contents go in a table-cell with `vertical-align:bottom`.
  3934. // This cell's bottom edge will determine the containing table's baseline
  3935. // without overly expanding the containing line-box.
  3936. var vlist = makeSpan(["vlist"], realChildren);
  3937. vlist.style.height = maxPos + "em";
  3938.  
  3939. // A second row is used if necessary to represent the vlist's depth.
  3940. var rows = void 0;
  3941. if (minPos < 0) {
  3942. var depthStrut = makeSpan(["vlist"], []);
  3943. depthStrut.style.height = -minPos + "em";
  3944.  
  3945. // Safari wants the first row to have inline content; otherwise it
  3946. // puts the bottom of the *second* row on the baseline.
  3947. var topStrut = makeSpan(["vlist-s"], [new _domTree2.default.symbolNode("\u200B")]);
  3948.  
  3949. rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])];
  3950. } else {
  3951. rows = [makeSpan(["vlist-r"], [vlist])];
  3952. }
  3953.  
  3954. var vtable = makeSpan(["vlist-t"], rows);
  3955. if (rows.length === 2) {
  3956. vtable.classes.push("vlist-t2");
  3957. }
  3958. vtable.height = maxPos;
  3959. vtable.depth = -minPos;
  3960. return vtable;
  3961. };
  3962.  
  3963. // Converts verb group into body string, dealing with \verb* form
  3964. var makeVerb = function makeVerb(group, options) {
  3965. var text = group.value.body;
  3966. if (group.value.star) {
  3967. text = text.replace(/ /g, "\u2423"); // Open Box
  3968. } else {
  3969. text = text.replace(/ /g, '\xA0'); // No-Break Space
  3970. // (so that, in particular, spaces don't coalesce)
  3971. }
  3972. return text;
  3973. };
  3974.  
  3975. // A map of spacing functions to their attributes, like size and corresponding
  3976. // CSS class
  3977. var spacingFunctions = {
  3978. "\\qquad": {
  3979. size: "2em",
  3980. className: "qquad"
  3981. },
  3982. "\\quad": {
  3983. size: "1em",
  3984. className: "quad"
  3985. },
  3986. "\\enspace": {
  3987. size: "0.5em",
  3988. className: "enspace"
  3989. },
  3990. "\\;": {
  3991. size: "0.277778em",
  3992. className: "thickspace"
  3993. },
  3994. "\\:": {
  3995. size: "0.22222em",
  3996. className: "mediumspace"
  3997. },
  3998. "\\,": {
  3999. size: "0.16667em",
  4000. className: "thinspace"
  4001. },
  4002. "\\!": {
  4003. size: "-0.16667em",
  4004. className: "negativethinspace"
  4005. }
  4006. };
  4007.  
  4008. /**
  4009. * Maps TeX font commands to objects containing:
  4010. * - variant: string used for "mathvariant" attribute in buildMathML.js
  4011. * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics
  4012. */
  4013. // A map between tex font commands an MathML mathvariant attribute values
  4014. var fontMap = {
  4015. // styles
  4016. "mathbf": {
  4017. variant: "bold",
  4018. fontName: "Main-Bold"
  4019. },
  4020. "mathrm": {
  4021. variant: "normal",
  4022. fontName: "Main-Regular"
  4023. },
  4024. "textit": {
  4025. variant: "italic",
  4026. fontName: "Main-Italic"
  4027. },
  4028.  
  4029. // "mathit" is missing because it requires the use of two fonts: Main-Italic
  4030. // and Math-Italic. This is handled by a special case in makeOrd which ends
  4031. // up calling mathit.
  4032.  
  4033. // families
  4034. "mathbb": {
  4035. variant: "double-struck",
  4036. fontName: "AMS-Regular"
  4037. },
  4038. "mathcal": {
  4039. variant: "script",
  4040. fontName: "Caligraphic-Regular"
  4041. },
  4042. "mathfrak": {
  4043. variant: "fraktur",
  4044. fontName: "Fraktur-Regular"
  4045. },
  4046. "mathscr": {
  4047. variant: "script",
  4048. fontName: "Script-Regular"
  4049. },
  4050. "mathsf": {
  4051. variant: "sans-serif",
  4052. fontName: "SansSerif-Regular"
  4053. },
  4054. "mathtt": {
  4055. variant: "monospace",
  4056. fontName: "Typewriter-Regular"
  4057. }
  4058. };
  4059.  
  4060. exports.default = {
  4061. fontMap: fontMap,
  4062. makeSymbol: makeSymbol,
  4063. mathsym: mathsym,
  4064. makeSpan: makeSpan,
  4065. makeFragment: makeFragment,
  4066. makeVList: makeVList,
  4067. makeOrd: makeOrd,
  4068. makeVerb: makeVerb,
  4069. tryCombineChars: tryCombineChars,
  4070. prependChildren: prependChildren,
  4071. spacingFunctions: spacingFunctions
  4072. };
  4073.  
  4074. },{"./domTree":98,"./fontMetrics":101,"./symbols":112,"./utils":115}],92:[function(require,module,exports){
  4075. "use strict";
  4076.  
  4077. Object.defineProperty(exports, "__esModule", {
  4078. value: true
  4079. });
  4080. exports.buildGroup = exports.groupTypes = exports.makeNullDelimiter = exports.buildExpression = exports.spliceSpaces = undefined;
  4081.  
  4082. var _stringify = require("babel-runtime/core-js/json/stringify");
  4083.  
  4084. var _stringify2 = _interopRequireDefault(_stringify);
  4085.  
  4086. exports.default = buildHTML;
  4087.  
  4088. var _ParseError = require("./ParseError");
  4089.  
  4090. var _ParseError2 = _interopRequireDefault(_ParseError);
  4091.  
  4092. var _Style = require("./Style");
  4093.  
  4094. var _Style2 = _interopRequireDefault(_Style);
  4095.  
  4096. var _buildCommon = require("./buildCommon");
  4097.  
  4098. var _buildCommon2 = _interopRequireDefault(_buildCommon);
  4099.  
  4100. var _delimiter = require("./delimiter");
  4101.  
  4102. var _delimiter2 = _interopRequireDefault(_delimiter);
  4103.  
  4104. var _domTree = require("./domTree");
  4105.  
  4106. var _domTree2 = _interopRequireDefault(_domTree);
  4107.  
  4108. var _units = require("./units");
  4109.  
  4110. var _utils = require("./utils");
  4111.  
  4112. var _utils2 = _interopRequireDefault(_utils);
  4113.  
  4114. var _stretchy = require("./stretchy");
  4115.  
  4116. var _stretchy2 = _interopRequireDefault(_stretchy);
  4117.  
  4118. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4119.  
  4120. /**
  4121. * WARNING: New methods on groupTypes should be added to src/functions.
  4122. *
  4123. * This file does the main work of building a domTree structure from a parse
  4124. * tree. The entry point is the `buildHTML` function, which takes a parse tree.
  4125. * Then, the buildExpression, buildGroup, and various groupTypes functions are
  4126. * called, to produce a final HTML tree.
  4127. */
  4128.  
  4129. var makeSpan = _buildCommon2.default.makeSpan;
  4130.  
  4131. var isSpace = function isSpace(node) {
  4132. return node instanceof _domTree2.default.span && node.classes[0] === "mspace";
  4133. };
  4134.  
  4135. // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`)
  4136. // depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,
  4137. // and the text before Rule 19.
  4138. var isBin = function isBin(node) {
  4139. return node && node.classes[0] === "mbin";
  4140. };
  4141.  
  4142. var isBinLeftCanceller = function isBinLeftCanceller(node, isRealGroup) {
  4143. // TODO: This code assumes that a node's math class is the first element
  4144. // of its `classes` array. A later cleanup should ensure this, for
  4145. // instance by changing the signature of `makeSpan`.
  4146. if (node) {
  4147. return _utils2.default.contains(["mbin", "mopen", "mrel", "mop", "mpunct"], node.classes[0]);
  4148. } else {
  4149. return isRealGroup;
  4150. }
  4151. };
  4152.  
  4153. var isBinRightCanceller = function isBinRightCanceller(node, isRealGroup) {
  4154. if (node) {
  4155. return _utils2.default.contains(["mrel", "mclose", "mpunct"], node.classes[0]);
  4156. } else {
  4157. return isRealGroup;
  4158. }
  4159. };
  4160.  
  4161. /**
  4162. * Splice out any spaces from `children` starting at position `i`, and return
  4163. * the spliced-out array. Returns null if `children[i]` does not exist or is not
  4164. * a space.
  4165. */
  4166. var spliceSpaces = exports.spliceSpaces = function spliceSpaces(children, i) {
  4167. var j = i;
  4168. while (j < children.length && isSpace(children[j])) {
  4169. j++;
  4170. }
  4171. if (j === i) {
  4172. return null;
  4173. } else {
  4174. return children.splice(i, j - i);
  4175. }
  4176. };
  4177.  
  4178. /**
  4179. * Take a list of nodes, build them in order, and return a list of the built
  4180. * nodes. documentFragments are flattened into their contents, so the
  4181. * returned list contains no fragments. `isRealGroup` is true if `expression`
  4182. * is a real group (no atoms will be added on either side), as opposed to
  4183. * a partial group (e.g. one created by \color).
  4184. */
  4185. var buildExpression = exports.buildExpression = function buildExpression(expression, options, isRealGroup) {
  4186. // Parse expressions into `groups`.
  4187. var groups = [];
  4188. for (var i = 0; i < expression.length; i++) {
  4189. var group = expression[i];
  4190. var output = buildGroup(group, options);
  4191. if (output instanceof _domTree2.default.documentFragment) {
  4192. Array.prototype.push.apply(groups, output.children);
  4193. } else {
  4194. groups.push(output);
  4195. }
  4196. }
  4197. // At this point `groups` consists entirely of `symbolNode`s and `span`s.
  4198.  
  4199. // Explicit spaces (e.g., \;, \,) should be ignored with respect to atom
  4200. // spacing (e.g., "add thick space between mord and mrel"). Since CSS
  4201. // adjacency rules implement atom spacing, spaces should be invisible to
  4202. // CSS. So we splice them out of `groups` and into the atoms themselves.
  4203. for (var _i = 0; _i < groups.length; _i++) {
  4204. var spaces = spliceSpaces(groups, _i);
  4205. if (spaces) {
  4206. // Splicing of spaces may have removed all remaining groups.
  4207. if (_i < groups.length) {
  4208. // If there is a following group, move space within it.
  4209. if (groups[_i] instanceof _domTree2.default.symbolNode) {
  4210. groups[_i] = makeSpan([].concat(groups[_i].classes), [groups[_i]]);
  4211. }
  4212. _buildCommon2.default.prependChildren(groups[_i], spaces);
  4213. } else {
  4214. // Otherwise, put any spaces back at the end of the groups.
  4215. Array.prototype.push.apply(groups, spaces);
  4216. break;
  4217. }
  4218. }
  4219. }
  4220.  
  4221. // Binary operators change to ordinary symbols in some contexts.
  4222. for (var _i2 = 0; _i2 < groups.length; _i2++) {
  4223. if (isBin(groups[_i2]) && (isBinLeftCanceller(groups[_i2 - 1], isRealGroup) || isBinRightCanceller(groups[_i2 + 1], isRealGroup))) {
  4224. groups[_i2].classes[0] = "mord";
  4225. }
  4226. }
  4227.  
  4228. // Process \\not commands within the group.
  4229. // TODO(kevinb): Handle multiple \\not commands in a row.
  4230. // TODO(kevinb): Handle \\not{abc} correctly. The \\not should appear over
  4231. // the 'a' instead of the 'c'.
  4232. for (var _i3 = 0; _i3 < groups.length; _i3++) {
  4233. if (groups[_i3].value === "\u0338" && _i3 + 1 < groups.length) {
  4234. var children = groups.slice(_i3, _i3 + 2);
  4235.  
  4236. children[0].classes = ["mainrm"];
  4237. // \u0338 is a combining glyph so we could reorder the children so
  4238. // that it comes after the other glyph. This works correctly on
  4239. // most browsers except for Safari. Instead we absolutely position
  4240. // the glyph and set its right side to match that of the other
  4241. // glyph which is visually equivalent.
  4242. children[0].style.position = "absolute";
  4243. children[0].style.right = "0";
  4244.  
  4245. // Copy the classes from the second glyph to the new container.
  4246. // This is so it behaves the same as though there was no \\not.
  4247. var classes = groups[_i3 + 1].classes;
  4248. var container = makeSpan(classes, children);
  4249.  
  4250. // LaTeX adds a space between ords separated by a \\not.
  4251. if (classes.indexOf("mord") !== -1) {
  4252. // \glue(\thickmuskip) 2.77771 plus 2.77771
  4253. container.style.paddingLeft = "0.277771em";
  4254. }
  4255.  
  4256. // Ensure that the \u0338 is positioned relative to the container.
  4257. container.style.position = "relative";
  4258. groups.splice(_i3, 2, container);
  4259. }
  4260. }
  4261.  
  4262. return groups;
  4263. };
  4264.  
  4265. // Return math atom class (mclass) of a domTree.
  4266. var getTypeOfDomTree = function getTypeOfDomTree(node) {
  4267. if (node instanceof _domTree2.default.documentFragment) {
  4268. if (node.children.length) {
  4269. return getTypeOfDomTree(node.children[node.children.length - 1]);
  4270. }
  4271. } else {
  4272. if (_utils2.default.contains(["mord", "mop", "mbin", "mrel", "mopen", "mclose", "mpunct", "minner"], node.classes[0])) {
  4273. return node.classes[0];
  4274. }
  4275. }
  4276. return null;
  4277. };
  4278.  
  4279. /**
  4280. * Sometimes, groups perform special rules when they have superscripts or
  4281. * subscripts attached to them. This function lets the `supsub` group know that
  4282. * its inner element should handle the superscripts and subscripts instead of
  4283. * handling them itself.
  4284. */
  4285. var shouldHandleSupSub = function shouldHandleSupSub(group, options) {
  4286. if (!group.value.base) {
  4287. return false;
  4288. } else {
  4289. var base = group.value.base;
  4290. if (base.type === "op") {
  4291. // Operators handle supsubs differently when they have limits
  4292. // (e.g. `\displaystyle\sum_2^3`)
  4293. return base.value.limits && (options.style.size === _Style2.default.DISPLAY.size || base.value.alwaysHandleSupSub);
  4294. } else if (base.type === "accent") {
  4295. return isCharacterBox(base.value.base);
  4296. } else if (base.type === "horizBrace") {
  4297. var isSup = group.value.sub ? false : true;
  4298. return isSup === base.value.isOver;
  4299. } else {
  4300. return null;
  4301. }
  4302. }
  4303. };
  4304.  
  4305. /**
  4306. * Sometimes we want to pull out the innermost element of a group. In most
  4307. * cases, this will just be the group itself, but when ordgroups and colors have
  4308. * a single element, we want to pull that out.
  4309. */
  4310. var getBaseElem = function getBaseElem(group) {
  4311. if (!group) {
  4312. return false;
  4313. } else if (group.type === "ordgroup") {
  4314. if (group.value.length === 1) {
  4315. return getBaseElem(group.value[0]);
  4316. } else {
  4317. return group;
  4318. }
  4319. } else if (group.type === "color") {
  4320. if (group.value.value.length === 1) {
  4321. return getBaseElem(group.value.value[0]);
  4322. } else {
  4323. return group;
  4324. }
  4325. } else if (group.type === "font") {
  4326. return getBaseElem(group.value.body);
  4327. } else {
  4328. return group;
  4329. }
  4330. };
  4331.  
  4332. /**
  4333. * TeXbook algorithms often reference "character boxes", which are simply groups
  4334. * with a single character in them. To decide if something is a character box,
  4335. * we find its innermost group, and see if it is a single character.
  4336. */
  4337. var isCharacterBox = function isCharacterBox(group) {
  4338. var baseElem = getBaseElem(group);
  4339.  
  4340. // These are all they types of groups which hold single characters
  4341. return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "bin" || baseElem.type === "rel" || baseElem.type === "inner" || baseElem.type === "open" || baseElem.type === "close" || baseElem.type === "punct";
  4342. };
  4343.  
  4344. var makeNullDelimiter = exports.makeNullDelimiter = function makeNullDelimiter(options, classes) {
  4345. var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses());
  4346. return makeSpan(classes.concat(moreClasses));
  4347. };
  4348.  
  4349. /**
  4350. * This is a map of group types to the function used to handle that type.
  4351. * Simpler types come at the beginning, while complicated types come afterwards.
  4352. */
  4353. var groupTypes = exports.groupTypes = {};
  4354.  
  4355. groupTypes.mathord = function (group, options) {
  4356. return _buildCommon2.default.makeOrd(group, options, "mathord");
  4357. };
  4358.  
  4359. groupTypes.textord = function (group, options) {
  4360. return _buildCommon2.default.makeOrd(group, options, "textord");
  4361. };
  4362.  
  4363. groupTypes.bin = function (group, options) {
  4364. return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mbin"]);
  4365. };
  4366.  
  4367. groupTypes.rel = function (group, options) {
  4368. return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mrel"]);
  4369. };
  4370.  
  4371. groupTypes.open = function (group, options) {
  4372. return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mopen"]);
  4373. };
  4374.  
  4375. groupTypes.close = function (group, options) {
  4376. return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mclose"]);
  4377. };
  4378.  
  4379. groupTypes.inner = function (group, options) {
  4380. return _buildCommon2.default.mathsym(group.value, group.mode, options, ["minner"]);
  4381. };
  4382.  
  4383. groupTypes.punct = function (group, options) {
  4384. return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mpunct"]);
  4385. };
  4386.  
  4387. groupTypes.ordgroup = function (group, options) {
  4388. return makeSpan(["mord"], buildExpression(group.value, options, true), options);
  4389. };
  4390.  
  4391. groupTypes.text = function (group, options) {
  4392. var newOptions = options.withFont(group.value.font);
  4393. var inner = buildExpression(group.value.body, newOptions, true);
  4394. _buildCommon2.default.tryCombineChars(inner);
  4395. return makeSpan(["mord", "text"], inner, newOptions);
  4396. };
  4397.  
  4398. groupTypes.color = function (group, options) {
  4399. var elements = buildExpression(group.value.value, options.withColor(group.value.color), false);
  4400.  
  4401. // \color isn't supposed to affect the type of the elements it contains.
  4402. // To accomplish this, we wrap the results in a fragment, so the inner
  4403. // elements will be able to directly interact with their neighbors. For
  4404. // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3`
  4405. return new _buildCommon2.default.makeFragment(elements);
  4406. };
  4407.  
  4408. groupTypes.supsub = function (group, options) {
  4409. // Superscript and subscripts are handled in the TeXbook on page
  4410. // 445-446, rules 18(a-f).
  4411.  
  4412. // Here is where we defer to the inner group if it should handle
  4413. // superscripts and subscripts itself.
  4414. if (shouldHandleSupSub(group, options)) {
  4415. return groupTypes[group.value.base.type](group, options);
  4416. }
  4417.  
  4418. var base = buildGroup(group.value.base, options);
  4419. var supm = void 0;
  4420. var subm = void 0;
  4421.  
  4422. var metrics = options.fontMetrics();
  4423. var newOptions = void 0;
  4424.  
  4425. // Rule 18a
  4426. var supShift = 0;
  4427. var subShift = 0;
  4428.  
  4429. if (group.value.sup) {
  4430. newOptions = options.havingStyle(options.style.sup());
  4431. supm = buildGroup(group.value.sup, newOptions, options);
  4432. if (!isCharacterBox(group.value.base)) {
  4433. supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier;
  4434. }
  4435. }
  4436.  
  4437. if (group.value.sub) {
  4438. newOptions = options.havingStyle(options.style.sub());
  4439. subm = buildGroup(group.value.sub, newOptions, options);
  4440. if (!isCharacterBox(group.value.base)) {
  4441. subShift = base.depth + newOptions.fontMetrics().subDrop * newOptions.sizeMultiplier / options.sizeMultiplier;
  4442. }
  4443. }
  4444.  
  4445. // Rule 18c
  4446. var minSupShift = void 0;
  4447. if (options.style === _Style2.default.DISPLAY) {
  4448. minSupShift = metrics.sup1;
  4449. } else if (options.style.cramped) {
  4450. minSupShift = metrics.sup3;
  4451. } else {
  4452. minSupShift = metrics.sup2;
  4453. }
  4454.  
  4455. // scriptspace is a font-size-independent size, so scale it
  4456. // appropriately
  4457. var multiplier = options.sizeMultiplier;
  4458. var scriptspace = 0.5 / metrics.ptPerEm / multiplier + "em";
  4459.  
  4460. var supsub = void 0;
  4461. if (!group.value.sup) {
  4462. // Rule 18b
  4463. subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight);
  4464.  
  4465. var vlistElem = [{ type: "elem", elem: subm, marginRight: scriptspace }];
  4466. // Subscripts shouldn't be shifted by the base's italic correction.
  4467. // Account for that by shifting the subscript back the appropriate
  4468. // amount. Note we only do this when the base is a single symbol.
  4469. if (base instanceof _domTree2.default.symbolNode) {
  4470. vlistElem[0].marginLeft = -base.italic + "em";
  4471. }
  4472.  
  4473. supsub = _buildCommon2.default.makeVList(vlistElem, "shift", subShift, options);
  4474. } else if (!group.value.sub) {
  4475. // Rule 18c, d
  4476. supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
  4477.  
  4478. supsub = _buildCommon2.default.makeVList([{ type: "elem", elem: supm, marginRight: scriptspace }], "shift", -supShift, options);
  4479. } else {
  4480. supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
  4481. subShift = Math.max(subShift, metrics.sub2);
  4482.  
  4483. var ruleWidth = metrics.defaultRuleThickness;
  4484.  
  4485. // Rule 18e
  4486. if (supShift - supm.depth - (subm.height - subShift) < 4 * ruleWidth) {
  4487. subShift = 4 * ruleWidth - (supShift - supm.depth) + subm.height;
  4488. var psi = 0.8 * metrics.xHeight - (supShift - supm.depth);
  4489. if (psi > 0) {
  4490. supShift += psi;
  4491. subShift -= psi;
  4492. }
  4493. }
  4494.  
  4495. var _vlistElem = [{ type: "elem", elem: subm, shift: subShift, marginRight: scriptspace }, { type: "elem", elem: supm, shift: -supShift, marginRight: scriptspace }];
  4496. // See comment above about subscripts not being shifted
  4497. if (base instanceof _domTree2.default.symbolNode) {
  4498. _vlistElem[0].marginLeft = -base.italic + "em";
  4499. }
  4500.  
  4501. supsub = _buildCommon2.default.makeVList(_vlistElem, "individualShift", null, options);
  4502. }
  4503.  
  4504. // We ensure to wrap the supsub vlist in a span.msupsub to reset text-align
  4505. var mclass = getTypeOfDomTree(base) || "mord";
  4506. return makeSpan([mclass], [base, makeSpan(["msupsub"], [supsub])], options);
  4507. };
  4508.  
  4509. groupTypes.genfrac = function (group, options) {
  4510. // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).
  4511. // Figure out what style this fraction should be in based on the
  4512. // function used
  4513. var style = options.style;
  4514. if (group.value.size === "display") {
  4515. style = _Style2.default.DISPLAY;
  4516. } else if (group.value.size === "text") {
  4517. style = _Style2.default.TEXT;
  4518. }
  4519.  
  4520. var nstyle = style.fracNum();
  4521. var dstyle = style.fracDen();
  4522. var newOptions = void 0;
  4523.  
  4524. newOptions = options.havingStyle(nstyle);
  4525. var numerm = buildGroup(group.value.numer, newOptions, options);
  4526.  
  4527. newOptions = options.havingStyle(dstyle);
  4528. var denomm = buildGroup(group.value.denom, newOptions, options);
  4529.  
  4530. var rule = void 0;
  4531. var ruleWidth = void 0;
  4532. var ruleSpacing = void 0;
  4533. if (group.value.hasBarLine) {
  4534. rule = makeLineSpan("frac-line", options);
  4535. ruleWidth = rule.height;
  4536. ruleSpacing = rule.height;
  4537. } else {
  4538. rule = null;
  4539. ruleWidth = 0;
  4540. ruleSpacing = options.fontMetrics().defaultRuleThickness;
  4541. }
  4542.  
  4543. // Rule 15b
  4544. var numShift = void 0;
  4545. var clearance = void 0;
  4546. var denomShift = void 0;
  4547. if (style.size === _Style2.default.DISPLAY.size) {
  4548. numShift = options.fontMetrics().num1;
  4549. if (ruleWidth > 0) {
  4550. clearance = 3 * ruleSpacing;
  4551. } else {
  4552. clearance = 7 * ruleSpacing;
  4553. }
  4554. denomShift = options.fontMetrics().denom1;
  4555. } else {
  4556. if (ruleWidth > 0) {
  4557. numShift = options.fontMetrics().num2;
  4558. clearance = ruleSpacing;
  4559. } else {
  4560. numShift = options.fontMetrics().num3;
  4561. clearance = 3 * ruleSpacing;
  4562. }
  4563. denomShift = options.fontMetrics().denom2;
  4564. }
  4565.  
  4566. var frac = void 0;
  4567. if (ruleWidth === 0) {
  4568. // Rule 15c
  4569. var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift);
  4570. if (candidateClearance < clearance) {
  4571. numShift += 0.5 * (clearance - candidateClearance);
  4572. denomShift += 0.5 * (clearance - candidateClearance);
  4573. }
  4574.  
  4575. frac = _buildCommon2.default.makeVList([{ type: "elem", elem: denomm, shift: denomShift }, { type: "elem", elem: numerm, shift: -numShift }], "individualShift", null, options);
  4576. } else {
  4577. // Rule 15d
  4578. var axisHeight = options.fontMetrics().axisHeight;
  4579.  
  4580. if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) {
  4581. numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth));
  4582. }
  4583.  
  4584. if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) {
  4585. denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift));
  4586. }
  4587.  
  4588. var midShift = -(axisHeight - 0.5 * ruleWidth);
  4589.  
  4590. frac = _buildCommon2.default.makeVList([{ type: "elem", elem: denomm, shift: denomShift }, { type: "elem", elem: rule, shift: midShift }, { type: "elem", elem: numerm, shift: -numShift }], "individualShift", null, options);
  4591. }
  4592.  
  4593. // Since we manually change the style sometimes (with \dfrac or \tfrac),
  4594. // account for the possible size change here.
  4595. newOptions = options.havingStyle(style);
  4596. frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier;
  4597. frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier;
  4598.  
  4599. // Rule 15e
  4600. var delimSize = void 0;
  4601. if (style.size === _Style2.default.DISPLAY.size) {
  4602. delimSize = options.fontMetrics().delim1;
  4603. } else {
  4604. delimSize = options.fontMetrics().delim2;
  4605. }
  4606.  
  4607. var leftDelim = void 0;
  4608. var rightDelim = void 0;
  4609. if (group.value.leftDelim == null) {
  4610. leftDelim = makeNullDelimiter(options, ["mopen"]);
  4611. } else {
  4612. leftDelim = _delimiter2.default.customSizedDelim(group.value.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]);
  4613. }
  4614. if (group.value.rightDelim == null) {
  4615. rightDelim = makeNullDelimiter(options, ["mclose"]);
  4616. } else {
  4617. rightDelim = _delimiter2.default.customSizedDelim(group.value.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]);
  4618. }
  4619.  
  4620. return makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, makeSpan(["mfrac"], [frac]), rightDelim], options);
  4621. };
  4622.  
  4623. groupTypes.spacing = function (group, options) {
  4624. if (group.value === "\\ " || group.value === "\\space" || group.value === " " || group.value === "~") {
  4625. // Spaces are generated by adding an actual space. Each of these
  4626. // things has an entry in the symbols table, so these will be turned
  4627. // into appropriate outputs.
  4628. if (group.mode === "text") {
  4629. return _buildCommon2.default.makeOrd(group, options, "textord");
  4630. } else {
  4631. return makeSpan(["mspace"], [_buildCommon2.default.mathsym(group.value, group.mode, options)], options);
  4632. }
  4633. } else {
  4634. // Other kinds of spaces are of arbitrary width. We use CSS to
  4635. // generate these.
  4636. return makeSpan(["mspace", _buildCommon2.default.spacingFunctions[group.value].className], [], options);
  4637. }
  4638. };
  4639.  
  4640. groupTypes.lap = function (group, options) {
  4641. // mathllap, mathrlap, mathclap
  4642. var inner = void 0;
  4643. if (group.value.alignment === "clap") {
  4644. // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/
  4645. inner = makeSpan([], [buildGroup(group.value.body, options)]);
  4646. // wrap, since CSS will center a .clap > .inner > span
  4647. inner = makeSpan(["inner"], [inner], options);
  4648. } else {
  4649. inner = makeSpan(["inner"], [buildGroup(group.value.body, options)]);
  4650. }
  4651. var fix = makeSpan(["fix"], []);
  4652. return makeSpan(["mord", group.value.alignment], [inner, fix], options);
  4653. };
  4654.  
  4655. groupTypes.smash = function (group, options) {
  4656. var node = makeSpan(["mord"], [buildGroup(group.value.body, options)]);
  4657.  
  4658. if (!group.value.smashHeight && !group.value.smashDepth) {
  4659. return node;
  4660. }
  4661.  
  4662. if (group.value.smashHeight) {
  4663. node.height = 0;
  4664. // In order to influence makeVList, we have to reset the children.
  4665. if (node.children) {
  4666. for (var i = 0; i < node.children.length; i++) {
  4667. node.children[i].height = 0;
  4668. }
  4669. }
  4670. }
  4671.  
  4672. if (group.value.smashDepth) {
  4673. node.depth = 0;
  4674. if (node.children) {
  4675. for (var _i4 = 0; _i4 < node.children.length; _i4++) {
  4676. node.children[_i4].depth = 0;
  4677. }
  4678. }
  4679. }
  4680.  
  4681. // At this point, we've reset the TeX-like height and depth values.
  4682. // But the span still has an HTML line height.
  4683. // makeVList applies "display: table-cell", which prevents the browser
  4684. // from acting on that line height. So we'll call makeVList now.
  4685.  
  4686. return _buildCommon2.default.makeVList([{ type: "elem", elem: node }], "firstBaseline", null, options);
  4687. };
  4688.  
  4689. groupTypes.op = function (group, options) {
  4690. // Operators are handled in the TeXbook pg. 443-444, rule 13(a).
  4691. var supGroup = void 0;
  4692. var subGroup = void 0;
  4693. var hasLimits = false;
  4694. if (group.type === "supsub") {
  4695. // If we have limits, supsub will pass us its group to handle. Pull
  4696. // out the superscript and subscript and set the group to the op in
  4697. // its base.
  4698. supGroup = group.value.sup;
  4699. subGroup = group.value.sub;
  4700. group = group.value.base;
  4701. hasLimits = true;
  4702. }
  4703.  
  4704. var style = options.style;
  4705.  
  4706. // Most operators have a large successor symbol, but these don't.
  4707. var noSuccessor = ["\\smallint"];
  4708.  
  4709. var large = false;
  4710. if (style.size === _Style2.default.DISPLAY.size && group.value.symbol && !_utils2.default.contains(noSuccessor, group.value.body)) {
  4711.  
  4712. // Most symbol operators get larger in displaystyle (rule 13)
  4713. large = true;
  4714. }
  4715.  
  4716. var base = void 0;
  4717. if (group.value.symbol) {
  4718. // If this is a symbol, create the symbol.
  4719. var fontName = large ? "Size2-Regular" : "Size1-Regular";
  4720. base = _buildCommon2.default.makeSymbol(group.value.body, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]);
  4721. } else if (group.value.value) {
  4722. // If this is a list, compose that list.
  4723. var inner = buildExpression(group.value.value, options, true);
  4724. if (inner.length === 1 && inner[0] instanceof _domTree2.default.symbolNode) {
  4725. base = inner[0];
  4726. base.classes[0] = "mop"; // replace old mclass
  4727. } else {
  4728. base = makeSpan(["mop"], inner, options);
  4729. }
  4730. } else {
  4731. // Otherwise, this is a text operator. Build the text from the
  4732. // operator's name.
  4733. // TODO(emily): Add a space in the middle of some of these
  4734. // operators, like \limsup
  4735. var output = [];
  4736. for (var i = 1; i < group.value.body.length; i++) {
  4737. output.push(_buildCommon2.default.mathsym(group.value.body[i], group.mode));
  4738. }
  4739. base = makeSpan(["mop"], output, options);
  4740. }
  4741.  
  4742. // If content of op is a single symbol, shift it vertically.
  4743. var baseShift = 0;
  4744. var slant = 0;
  4745. if (base instanceof _domTree2.default.symbolNode) {
  4746. // Shift the symbol so its center lies on the axis (rule 13). It
  4747. // appears that our fonts have the centers of the symbols already
  4748. // almost on the axis, so these numbers are very small. Note we
  4749. // don't actually apply this here, but instead it is used either in
  4750. // the vlist creation or separately when there are no limits.
  4751. baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight;
  4752.  
  4753. // The slant of the symbol is just its italic correction.
  4754. slant = base.italic;
  4755. }
  4756.  
  4757. if (hasLimits) {
  4758. // IE 8 clips \int if it is in a display: inline-block. We wrap it
  4759. // in a new span so it is an inline, and works.
  4760. base = makeSpan([], [base]);
  4761.  
  4762. var supm = void 0;
  4763. var supKern = void 0;
  4764. var subm = void 0;
  4765. var subKern = void 0;
  4766. var newOptions = void 0;
  4767. // We manually have to handle the superscripts and subscripts. This,
  4768. // aside from the kern calculations, is copied from supsub.
  4769. if (supGroup) {
  4770. newOptions = options.havingStyle(style.sup());
  4771. supm = buildGroup(supGroup, newOptions, options);
  4772.  
  4773. supKern = Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - supm.depth);
  4774. }
  4775.  
  4776. if (subGroup) {
  4777. newOptions = options.havingStyle(style.sub());
  4778. subm = buildGroup(subGroup, newOptions, options);
  4779.  
  4780. subKern = Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - subm.height);
  4781. }
  4782.  
  4783. // Build the final group as a vlist of the possible subscript, base,
  4784. // and possible superscript.
  4785. var finalGroup = void 0;
  4786. var top = void 0;
  4787. var bottom = void 0;
  4788. if (!supGroup) {
  4789. top = base.height - baseShift;
  4790.  
  4791. // Shift the limits by the slant of the symbol. Note
  4792. // that we are supposed to shift the limits by 1/2 of the slant,
  4793. // but since we are centering the limits adding a full slant of
  4794. // margin will shift by 1/2 that.
  4795. finalGroup = _buildCommon2.default.makeVList([{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: subm, marginLeft: -slant + "em" }, { type: "kern", size: subKern }, { type: "elem", elem: base }], "top", top, options);
  4796. } else if (!subGroup) {
  4797. bottom = base.depth + baseShift;
  4798.  
  4799. finalGroup = _buildCommon2.default.makeVList([{ type: "elem", elem: base }, { type: "kern", size: supKern }, { type: "elem", elem: supm, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }], "bottom", bottom, options);
  4800. } else if (!supGroup && !subGroup) {
  4801. // This case probably shouldn't occur (this would mean the
  4802. // supsub was sending us a group with no superscript or
  4803. // subscript) but be safe.
  4804. return base;
  4805. } else {
  4806. bottom = options.fontMetrics().bigOpSpacing5 + subm.height + subm.depth + subKern + base.depth + baseShift;
  4807.  
  4808. finalGroup = _buildCommon2.default.makeVList([{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: subm, marginLeft: -slant + "em" }, { type: "kern", size: subKern }, { type: "elem", elem: base }, { type: "kern", size: supKern }, { type: "elem", elem: supm, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }], "bottom", bottom, options);
  4809. }
  4810.  
  4811. return makeSpan(["mop", "op-limits"], [finalGroup], options);
  4812. } else {
  4813. if (baseShift) {
  4814. base.style.position = "relative";
  4815. base.style.top = baseShift + "em";
  4816. }
  4817.  
  4818. return base;
  4819. }
  4820. };
  4821.  
  4822. groupTypes.mod = function (group, options) {
  4823. var inner = [];
  4824.  
  4825. if (group.value.modType === "bmod") {
  4826. // “\nonscript\mskip-\medmuskip\mkern5mu”
  4827. if (!options.style.isTight()) {
  4828. inner.push(makeSpan(["mspace", "negativemediumspace"], [], options));
  4829. }
  4830. inner.push(makeSpan(["mspace", "thickspace"], [], options));
  4831. } else if (options.style.size === _Style2.default.DISPLAY.size) {
  4832. inner.push(makeSpan(["mspace", "quad"], [], options));
  4833. } else if (group.value.modType === "mod") {
  4834. inner.push(makeSpan(["mspace", "twelvemuspace"], [], options));
  4835. } else {
  4836. inner.push(makeSpan(["mspace", "eightmuspace"], [], options));
  4837. }
  4838.  
  4839. if (group.value.modType === "pod" || group.value.modType === "pmod") {
  4840. inner.push(_buildCommon2.default.mathsym("(", group.mode));
  4841. }
  4842.  
  4843. if (group.value.modType !== "pod") {
  4844. var modInner = [_buildCommon2.default.mathsym("m", group.mode), _buildCommon2.default.mathsym("o", group.mode), _buildCommon2.default.mathsym("d", group.mode)];
  4845. if (group.value.modType === "bmod") {
  4846. inner.push(makeSpan(["mbin"], modInner, options));
  4847. // “\mkern5mu\nonscript\mskip-\medmuskip”
  4848. inner.push(makeSpan(["mspace", "thickspace"], [], options));
  4849. if (!options.style.isTight()) {
  4850. inner.push(makeSpan(["mspace", "negativemediumspace"], [], options));
  4851. }
  4852. } else {
  4853. Array.prototype.push.apply(inner, modInner);
  4854. inner.push(makeSpan(["mspace", "sixmuspace"], [], options));
  4855. }
  4856. }
  4857.  
  4858. if (group.value.value) {
  4859. Array.prototype.push.apply(inner, buildExpression(group.value.value, options, false));
  4860. }
  4861.  
  4862. if (group.value.modType === "pod" || group.value.modType === "pmod") {
  4863. inner.push(_buildCommon2.default.mathsym(")", group.mode));
  4864. }
  4865.  
  4866. return _buildCommon2.default.makeFragment(inner);
  4867. };
  4868.  
  4869. groupTypes.katex = function (group, options) {
  4870. // The KaTeX logo. The offsets for the K and a were chosen to look
  4871. // good, but the offsets for the T, E, and X were taken from the
  4872. // definition of \TeX in TeX (see TeXbook pg. 356)
  4873. var k = makeSpan(["k"], [_buildCommon2.default.mathsym("K", group.mode)], options);
  4874. var a = makeSpan(["a"], [_buildCommon2.default.mathsym("A", group.mode)], options);
  4875.  
  4876. a.height = (a.height + 0.2) * 0.75;
  4877. a.depth = (a.height - 0.2) * 0.75;
  4878.  
  4879. var t = makeSpan(["t"], [_buildCommon2.default.mathsym("T", group.mode)], options);
  4880. var e = makeSpan(["e"], [_buildCommon2.default.mathsym("E", group.mode)], options);
  4881.  
  4882. e.height = e.height - 0.2155;
  4883. e.depth = e.depth + 0.2155;
  4884.  
  4885. var x = makeSpan(["x"], [_buildCommon2.default.mathsym("X", group.mode)], options);
  4886.  
  4887. return makeSpan(["mord", "katex-logo"], [k, a, t, e, x], options);
  4888. };
  4889.  
  4890. var makeLineSpan = function makeLineSpan(className, options, thickness) {
  4891. var line = makeSpan([className], [], options);
  4892. line.height = thickness || options.fontMetrics().defaultRuleThickness;
  4893. line.style.borderBottomWidth = line.height + "em";
  4894. line.maxFontSize = 1.0;
  4895. return line;
  4896. };
  4897.  
  4898. groupTypes.overline = function (group, options) {
  4899. // Overlines are handled in the TeXbook pg 443, Rule 9.
  4900.  
  4901. // Build the inner group in the cramped style.
  4902. var innerGroup = buildGroup(group.value.body, options.havingCrampedStyle());
  4903.  
  4904. // Create the line above the body
  4905. var line = makeLineSpan("overline-line", options);
  4906.  
  4907. // Generate the vlist, with the appropriate kerns
  4908. var vlist = _buildCommon2.default.makeVList([{ type: "elem", elem: innerGroup }, { type: "kern", size: 3 * line.height }, { type: "elem", elem: line }, { type: "kern", size: line.height }], "firstBaseline", null, options);
  4909.  
  4910. return makeSpan(["mord", "overline"], [vlist], options);
  4911. };
  4912.  
  4913. groupTypes.underline = function (group, options) {
  4914. // Underlines are handled in the TeXbook pg 443, Rule 10.
  4915. // Build the inner group.
  4916. var innerGroup = buildGroup(group.value.body, options);
  4917.  
  4918. // Create the line above the body
  4919. var line = makeLineSpan("underline-line", options);
  4920.  
  4921. // Generate the vlist, with the appropriate kerns
  4922. var vlist = _buildCommon2.default.makeVList([{ type: "kern", size: line.height }, { type: "elem", elem: line }, { type: "kern", size: 3 * line.height }, { type: "elem", elem: innerGroup }], "top", innerGroup.height, options);
  4923.  
  4924. return makeSpan(["mord", "underline"], [vlist], options);
  4925. };
  4926.  
  4927. groupTypes.sqrt = function (group, options) {
  4928. // Square roots are handled in the TeXbook pg. 443, Rule 11.
  4929.  
  4930. // First, we do the same steps as in overline to build the inner group
  4931. // and line
  4932. var inner = buildGroup(group.value.body, options.havingCrampedStyle());
  4933. if (inner.height === 0) {
  4934. // Render a small surd.
  4935. inner.height = options.fontMetrics().xHeight;
  4936. }
  4937.  
  4938. // Some groups can return document fragments. Handle those by wrapping
  4939. // them in a span.
  4940. if (inner instanceof _domTree2.default.documentFragment) {
  4941. inner = makeSpan([], [inner], options);
  4942. }
  4943.  
  4944. // Calculate the minimum size for the \surd delimiter
  4945. var metrics = options.fontMetrics();
  4946. var theta = metrics.defaultRuleThickness;
  4947.  
  4948. var phi = theta;
  4949. if (options.style.id < _Style2.default.TEXT.id) {
  4950. phi = options.fontMetrics().xHeight;
  4951. }
  4952.  
  4953. // Calculate the clearance between the body and line
  4954. var lineClearance = theta + phi / 4;
  4955.  
  4956. var minDelimiterHeight = (inner.height + inner.depth + lineClearance + theta) * options.sizeMultiplier;
  4957.  
  4958. // Create a sqrt SVG of the required minimum size
  4959. var img = _delimiter2.default.customSizedDelim("\\surd", minDelimiterHeight, false, options, group.mode);
  4960.  
  4961. // Calculate the actual line width.
  4962. // This actually should depend on the chosen font -- e.g. \boldmath
  4963. // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
  4964. // have thicker rules.
  4965. var ruleWidth = options.fontMetrics().sqrtRuleThickness * img.sizeMultiplier;
  4966.  
  4967. var delimDepth = img.height - ruleWidth;
  4968.  
  4969. // Adjust the clearance based on the delimiter size
  4970. if (delimDepth > inner.height + inner.depth + lineClearance) {
  4971. lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2;
  4972. }
  4973.  
  4974. // Shift the sqrt image
  4975. var imgShift = img.height - inner.height - lineClearance - ruleWidth;
  4976.  
  4977. inner.style.paddingLeft = img.advanceWidth + "em";
  4978.  
  4979. // Overlay the image and the argument.
  4980. var body = _buildCommon2.default.makeVList([{ type: "elem", elem: inner }, { type: "kern", size: -(inner.height + imgShift) }, { type: "elem", elem: img }, { type: "kern", size: ruleWidth }], "firstBaseline", null, options);
  4981. body.children[0].children[0].classes.push("svg-align");
  4982.  
  4983. if (!group.value.index) {
  4984. return makeSpan(["mord", "sqrt"], [body], options);
  4985. } else {
  4986. // Handle the optional root index
  4987.  
  4988. // The index is always in scriptscript style
  4989. var newOptions = options.havingStyle(_Style2.default.SCRIPTSCRIPT);
  4990. var rootm = buildGroup(group.value.index, newOptions, options);
  4991.  
  4992. // The amount the index is shifted by. This is taken from the TeX
  4993. // source, in the definition of `\r@@t`.
  4994. var toShift = 0.6 * (body.height - body.depth);
  4995.  
  4996. // Build a VList with the superscript shifted up correctly
  4997. var rootVList = _buildCommon2.default.makeVList([{ type: "elem", elem: rootm }], "shift", -toShift, options);
  4998. // Add a class surrounding it so we can add on the appropriate
  4999. // kerning
  5000. var rootVListWrap = makeSpan(["root"], [rootVList]);
  5001.  
  5002. return makeSpan(["mord", "sqrt"], [rootVListWrap, body], options);
  5003. }
  5004. };
  5005.  
  5006. function sizingGroup(value, options, baseOptions) {
  5007. var inner = buildExpression(value, options, false);
  5008. var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
  5009.  
  5010. // Add size-resetting classes to the inner list and set maxFontSize
  5011. // manually. Handle nested size changes.
  5012. for (var i = 0; i < inner.length; i++) {
  5013. var pos = _utils2.default.indexOf(inner[i].classes, "sizing");
  5014. if (pos < 0) {
  5015. Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions));
  5016. } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) {
  5017. // This is a nested size change: e.g., inner[i] is the "b" in
  5018. // `\Huge a \small b`. Override the old size (the `reset-` class)
  5019. // but not the new size.
  5020. inner[i].classes[pos + 1] = "reset-size" + baseOptions.size;
  5021. }
  5022.  
  5023. inner[i].height *= multiplier;
  5024. inner[i].depth *= multiplier;
  5025. }
  5026.  
  5027. return _buildCommon2.default.makeFragment(inner);
  5028. }
  5029.  
  5030. groupTypes.sizing = function (group, options) {
  5031. // Handle sizing operators like \Huge. Real TeX doesn't actually allow
  5032. // these functions inside of math expressions, so we do some special
  5033. // handling.
  5034. var newOptions = options.havingSize(group.value.size);
  5035. return sizingGroup(group.value.value, newOptions, options);
  5036. };
  5037.  
  5038. groupTypes.styling = function (group, options) {
  5039. // Style changes are handled in the TeXbook on pg. 442, Rule 3.
  5040.  
  5041. // Figure out what style we're changing to.
  5042. var styleMap = {
  5043. "display": _Style2.default.DISPLAY,
  5044. "text": _Style2.default.TEXT,
  5045. "script": _Style2.default.SCRIPT,
  5046. "scriptscript": _Style2.default.SCRIPTSCRIPT
  5047. };
  5048.  
  5049. var newStyle = styleMap[group.value.style];
  5050. var newOptions = options.havingStyle(newStyle);
  5051. return sizingGroup(group.value.value, newOptions, options);
  5052. };
  5053.  
  5054. groupTypes.font = function (group, options) {
  5055. var font = group.value.font;
  5056. return buildGroup(group.value.body, options.withFont(font));
  5057. };
  5058.  
  5059. groupTypes.verb = function (group, options) {
  5060. var text = _buildCommon2.default.makeVerb(group, options);
  5061. var body = [];
  5062. // \verb enters text mode and therefore is sized like \textstyle
  5063. var newOptions = options.havingStyle(options.style.text());
  5064. for (var i = 0; i < text.length; i++) {
  5065. if (text[i] === '\xA0') {
  5066. // spaces appear as nonbreaking space
  5067. // The space character isn't in the Typewriter-Regular font,
  5068. // so we implement it as a kern of the same size as a character.
  5069. // 0.525 is the width of a texttt character in LaTeX.
  5070. // It automatically gets scaled by the font size.
  5071. var rule = makeSpan(["mord", "rule"], [], newOptions);
  5072. rule.style.marginLeft = "0.525em";
  5073. body.push(rule);
  5074. } else {
  5075. body.push(_buildCommon2.default.makeSymbol(text[i], "Typewriter-Regular", group.mode, newOptions, ["mathtt"]));
  5076. }
  5077. }
  5078. _buildCommon2.default.tryCombineChars(body);
  5079. return makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), body, newOptions);
  5080. };
  5081.  
  5082. groupTypes.rule = function (group, options) {
  5083. // Make an empty span for the rule
  5084. var rule = makeSpan(["mord", "rule"], [], options);
  5085.  
  5086. // Calculate the shift, width, and height of the rule, and account for units
  5087. var shift = 0;
  5088. if (group.value.shift) {
  5089. shift = (0, _units.calculateSize)(group.value.shift, options);
  5090. }
  5091.  
  5092. var width = (0, _units.calculateSize)(group.value.width, options);
  5093. var height = (0, _units.calculateSize)(group.value.height, options);
  5094.  
  5095. // Style the rule to the right size
  5096. rule.style.borderRightWidth = width + "em";
  5097. rule.style.borderTopWidth = height + "em";
  5098. rule.style.bottom = shift + "em";
  5099.  
  5100. // Record the height and width
  5101. rule.width = width;
  5102. rule.height = height + shift;
  5103. rule.depth = -shift;
  5104. // Font size is the number large enough that the browser will
  5105. // reserve at least `absHeight` space above the baseline.
  5106. // The 1.125 factor was empirically determined
  5107. rule.maxFontSize = height * 1.125 * options.sizeMultiplier;
  5108.  
  5109. return rule;
  5110. };
  5111.  
  5112. groupTypes.kern = function (group, options) {
  5113. // Make an empty span for the rule
  5114. var rule = makeSpan(["mord", "rule"], [], options);
  5115.  
  5116. if (group.value.dimension) {
  5117. var dimension = (0, _units.calculateSize)(group.value.dimension, options);
  5118. rule.style.marginLeft = dimension + "em";
  5119. }
  5120.  
  5121. return rule;
  5122. };
  5123.  
  5124. groupTypes.accent = function (group, options) {
  5125. // Accents are handled in the TeXbook pg. 443, rule 12.
  5126. var base = group.value.base;
  5127.  
  5128. var supsubGroup = void 0;
  5129. if (group.type === "supsub") {
  5130. // If our base is a character box, and we have superscripts and
  5131. // subscripts, the supsub will defer to us. In particular, we want
  5132. // to attach the superscripts and subscripts to the inner body (so
  5133. // that the position of the superscripts and subscripts won't be
  5134. // affected by the height of the accent). We accomplish this by
  5135. // sticking the base of the accent into the base of the supsub, and
  5136. // rendering that, while keeping track of where the accent is.
  5137.  
  5138. // The supsub group is the group that was passed in
  5139. var supsub = group;
  5140. // The real accent group is the base of the supsub group
  5141. group = supsub.value.base;
  5142. // The character box is the base of the accent group
  5143. base = group.value.base;
  5144. // Stick the character box into the base of the supsub group
  5145. supsub.value.base = base;
  5146.  
  5147. // Rerender the supsub group with its new base, and store that
  5148. // result.
  5149. supsubGroup = buildGroup(supsub, options);
  5150. }
  5151.  
  5152. // Build the base group
  5153. var body = buildGroup(base, options.havingCrampedStyle());
  5154.  
  5155. // Does the accent need to shift for the skew of a character?
  5156. var mustShift = group.value.isShifty && isCharacterBox(base);
  5157.  
  5158. // Calculate the skew of the accent. This is based on the line "If the
  5159. // nucleus is not a single character, let s = 0; otherwise set s to the
  5160. // kern amount for the nucleus followed by the \skewchar of its font."
  5161. // Note that our skew metrics are just the kern between each character
  5162. // and the skewchar.
  5163. var skew = 0;
  5164. if (mustShift) {
  5165. // If the base is a character box, then we want the skew of the
  5166. // innermost character. To do that, we find the innermost character:
  5167. var baseChar = getBaseElem(base);
  5168. // Then, we render its group to get the symbol inside it
  5169. var baseGroup = buildGroup(baseChar, options.havingCrampedStyle());
  5170. // Finally, we pull the skew off of the symbol.
  5171. skew = baseGroup.skew;
  5172. // Note that we now throw away baseGroup, because the layers we
  5173. // removed with getBaseElem might contain things like \color which
  5174. // we can't get rid of.
  5175. // TODO(emily): Find a better way to get the skew
  5176. }
  5177.  
  5178. // calculate the amount of space between the body and the accent
  5179. var clearance = Math.min(body.height, options.fontMetrics().xHeight);
  5180.  
  5181. // Build the accent
  5182. var accentBody = void 0;
  5183. if (!group.value.isStretchy) {
  5184. var accent = _buildCommon2.default.makeSymbol(group.value.label, "Main-Regular", group.mode, options);
  5185. // Remove the italic correction of the accent, because it only serves to
  5186. // shift the accent over to a place we don't want.
  5187. accent.italic = 0;
  5188.  
  5189. // The \vec character that the fonts use is a combining character, and
  5190. // thus shows up much too far to the left. To account for this, we add a
  5191. // specific class which shifts the accent over to where we want it.
  5192. // TODO(emily): Fix this in a better way, like by changing the font
  5193. // Similarly, text accent \H is a combining character and
  5194. // requires a different adjustment.
  5195. var accentClass = null;
  5196. if (group.value.label === "\\vec") {
  5197. accentClass = "accent-vec";
  5198. } else if (group.value.label === '\\H') {
  5199. accentClass = "accent-hungarian";
  5200. }
  5201.  
  5202. accentBody = makeSpan([], [accent]);
  5203. accentBody = makeSpan(["accent-body", accentClass], [accentBody]);
  5204.  
  5205. // Shift the accent over by the skew. Note we shift by twice the skew
  5206. // because we are centering the accent, so by adding 2*skew to the left,
  5207. // we shift it to the right by 1*skew.
  5208. accentBody.style.marginLeft = 2 * skew + "em";
  5209.  
  5210. accentBody = _buildCommon2.default.makeVList([{ type: "elem", elem: body }, { type: "kern", size: -clearance }, { type: "elem", elem: accentBody }], "firstBaseline", null, options);
  5211. } else {
  5212. accentBody = _stretchy2.default.svgSpan(group, options);
  5213.  
  5214. accentBody = _buildCommon2.default.makeVList([{ type: "elem", elem: body }, { type: "elem", elem: accentBody }], "firstBaseline", null, options);
  5215.  
  5216. var styleSpan = accentBody.children[0].children[0].children[1];
  5217. styleSpan.classes.push("svg-align"); // text-align: left;
  5218. if (skew > 0) {
  5219. // Shorten the accent and nudge it to the right.
  5220. styleSpan.style.width = "calc(100% - " + 2 * skew + "em)";
  5221. styleSpan.style.marginLeft = 2 * skew + "em";
  5222. }
  5223. }
  5224.  
  5225. var accentWrap = makeSpan(["mord", "accent"], [accentBody], options);
  5226.  
  5227. if (supsubGroup) {
  5228. // Here, we replace the "base" child of the supsub with our newly
  5229. // generated accent.
  5230. supsubGroup.children[0] = accentWrap;
  5231.  
  5232. // Since we don't rerun the height calculation after replacing the
  5233. // accent, we manually recalculate height.
  5234. supsubGroup.height = Math.max(accentWrap.height, supsubGroup.height);
  5235.  
  5236. // Accents should always be ords, even when their innards are not.
  5237. supsubGroup.classes[0] = "mord";
  5238.  
  5239. return supsubGroup;
  5240. } else {
  5241. return accentWrap;
  5242. }
  5243. };
  5244.  
  5245. groupTypes.horizBrace = function (group, options) {
  5246. var style = options.style;
  5247.  
  5248. var hasSupSub = group.type === "supsub";
  5249. var supSubGroup = void 0;
  5250. var newOptions = void 0;
  5251. if (hasSupSub) {
  5252. // Ref: LaTeX source2e: }}}}\limits}
  5253. // i.e. LaTeX treats the brace similar to an op and passes it
  5254. // with \limits, so we need to assign supsub style.
  5255. if (group.value.sup) {
  5256. newOptions = options.havingStyle(style.sup());
  5257. supSubGroup = buildGroup(group.value.sup, newOptions, options);
  5258. } else {
  5259. newOptions = options.havingStyle(style.sub());
  5260. supSubGroup = buildGroup(group.value.sub, newOptions, options);
  5261. }
  5262. group = group.value.base;
  5263. }
  5264.  
  5265. // Build the base group
  5266. var body = buildGroup(group.value.base, options.havingBaseStyle(_Style2.default.DISPLAY));
  5267.  
  5268. // Create the stretchy element
  5269. var braceBody = _stretchy2.default.svgSpan(group, options);
  5270.  
  5271. // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓
  5272. // This first vlist contains the subject matter and the brace: equation
  5273. var vlist = void 0;
  5274. if (group.value.isOver) {
  5275. vlist = _buildCommon2.default.makeVList([{ type: "elem", elem: body }, { type: "kern", size: 0.1 }, { type: "elem", elem: braceBody }], "firstBaseline", null, options);
  5276. vlist.children[0].children[0].children[1].classes.push("svg-align");
  5277. } else {
  5278. vlist = _buildCommon2.default.makeVList([{ type: "elem", elem: braceBody }, { type: "kern", size: 0.1 }, { type: "elem", elem: body }], "bottom", body.depth + 0.1 + braceBody.height, options);
  5279. vlist.children[0].children[0].children[0].classes.push("svg-align");
  5280. }
  5281.  
  5282. if (hasSupSub) {
  5283. // In order to write the supsub, wrap the first vlist in another vlist:
  5284. // They can't all go in the same vlist, because the note might be wider
  5285. // than the equation. We want the equation to control the brace width.
  5286.  
  5287. // note long note long note
  5288. // ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓
  5289. // equation eqn eqn
  5290.  
  5291. var vSpan = makeSpan(["mord", group.value.isOver ? "mover" : "munder"], [vlist], options);
  5292.  
  5293. if (group.value.isOver) {
  5294. vlist = _buildCommon2.default.makeVList([{ type: "elem", elem: vSpan }, { type: "kern", size: 0.2 }, { type: "elem", elem: supSubGroup }], "firstBaseline", null, options);
  5295. } else {
  5296. vlist = _buildCommon2.default.makeVList([{ type: "elem", elem: supSubGroup }, { type: "kern", size: 0.2 }, { type: "elem", elem: vSpan }], "bottom", vSpan.depth + 0.2 + supSubGroup.height, options);
  5297. }
  5298. }
  5299.  
  5300. return makeSpan(["mord", group.value.isOver ? "mover" : "munder"], [vlist], options);
  5301. };
  5302.  
  5303. groupTypes.accentUnder = function (group, options) {
  5304. // Treat under accents much like underlines.
  5305. var innerGroup = buildGroup(group.value.base, options);
  5306.  
  5307. var accentBody = _stretchy2.default.svgSpan(group, options);
  5308. var kern = /tilde/.test(group.value.label) ? 0.12 : 0;
  5309.  
  5310. // Generate the vlist, with the appropriate kerns
  5311. var vlist = _buildCommon2.default.makeVList([{ type: "elem", elem: accentBody }, { type: "kern", size: kern }, { type: "elem", elem: innerGroup }], "bottom", accentBody.height + kern, options);
  5312.  
  5313. vlist.children[0].children[0].children[0].classes.push("svg-align");
  5314.  
  5315. return makeSpan(["mord", "accentunder"], [vlist], options);
  5316. };
  5317.  
  5318. groupTypes.enclose = function (group, options) {
  5319. // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox
  5320. var inner = buildGroup(group.value.body, options);
  5321.  
  5322. var label = group.value.label.substr(1);
  5323. var scale = options.sizeMultiplier;
  5324. var img = void 0;
  5325. var imgShift = 0;
  5326. var isColorbox = /color/.test(label);
  5327.  
  5328. if (label === "sout") {
  5329. img = makeSpan(["stretchy", "sout"]);
  5330. img.height = options.fontMetrics().defaultRuleThickness / scale;
  5331. imgShift = -0.5 * options.fontMetrics().xHeight;
  5332. } else {
  5333. // Add horizontal padding
  5334. inner.classes.push(/cancel/.test(label) ? "cancel-pad" : "boxpad");
  5335.  
  5336. // Add vertical padding
  5337. var vertPad = 0;
  5338. // ref: LaTeX source2e: \fboxsep = 3pt; \fboxrule = .4pt
  5339. // ref: cancel package: \advance\totalheight2\p@ % "+2"
  5340. if (/box/.test(label)) {
  5341. vertPad = label === "colorbox" ? 0.3 : 0.34;
  5342. } else {
  5343. vertPad = isCharacterBox(group.value.body) ? 0.2 : 0;
  5344. }
  5345.  
  5346. img = _stretchy2.default.encloseSpan(inner, label, vertPad, options);
  5347. imgShift = inner.depth + vertPad;
  5348.  
  5349. if (isColorbox) {
  5350. img.style.backgroundColor = group.value.backgroundColor.value;
  5351. if (label === "fcolorbox") {
  5352. img.style.borderColor = group.value.borderColor.value;
  5353. }
  5354. }
  5355. }
  5356.  
  5357. var vlist = void 0;
  5358. if (isColorbox) {
  5359. vlist = _buildCommon2.default.makeVList([
  5360. // Put the color background behind inner;
  5361. { type: "elem", elem: img, shift: imgShift }, { type: "elem", elem: inner, shift: 0 }], "individualShift", null, options);
  5362. } else {
  5363. vlist = _buildCommon2.default.makeVList([
  5364. // Write the \cancel stroke on top of inner.
  5365. { type: "elem", elem: inner, shift: 0 }, { type: "elem", elem: img, shift: imgShift }], "individualShift", null, options);
  5366. }
  5367.  
  5368. if (/cancel/.test(label)) {
  5369. vlist.children[0].children[0].children[1].classes.push("svg-align");
  5370.  
  5371. // cancel does not create horiz space for its line extension.
  5372. // That is, not when adjacent to a mord.
  5373. return makeSpan(["mord", "cancel-lap"], [vlist], options);
  5374. } else {
  5375. return makeSpan(["mord"], [vlist], options);
  5376. }
  5377. };
  5378.  
  5379. groupTypes.xArrow = function (group, options) {
  5380. var style = options.style;
  5381.  
  5382. // Build the argument groups in the appropriate style.
  5383. // Ref: amsmath.dtx: \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%
  5384.  
  5385. var newOptions = options.havingStyle(style.sup());
  5386. var upperGroup = buildGroup(group.value.body, newOptions, options);
  5387. upperGroup.classes.push("x-arrow-pad");
  5388.  
  5389. var lowerGroup = void 0;
  5390. if (group.value.below) {
  5391. // Build the lower group
  5392. newOptions = options.havingStyle(style.sub());
  5393. lowerGroup = buildGroup(group.value.below, newOptions, options);
  5394. lowerGroup.classes.push("x-arrow-pad");
  5395. }
  5396.  
  5397. var arrowBody = _stretchy2.default.svgSpan(group, options);
  5398.  
  5399. // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0.
  5400. // The point we want on the math axis is at 0.5 * arrowBody.height.
  5401. var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height;
  5402. // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi
  5403. var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111;
  5404.  
  5405. // Generate the vlist
  5406. var vlist = void 0;
  5407. if (group.value.below) {
  5408. var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;
  5409. vlist = _buildCommon2.default.makeVList([{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }, { type: "elem", elem: lowerGroup, shift: lowerShift }], "individualShift", null, options);
  5410. } else {
  5411. vlist = _buildCommon2.default.makeVList([{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }], "individualShift", null, options);
  5412. }
  5413.  
  5414. vlist.children[0].children[0].children[1].classes.push("svg-align");
  5415.  
  5416. return makeSpan(["mrel", "x-arrow"], [vlist], options);
  5417. };
  5418.  
  5419. groupTypes.mclass = function (group, options) {
  5420. var elements = buildExpression(group.value.value, options, true);
  5421.  
  5422. return makeSpan([group.value.mclass], elements, options);
  5423. };
  5424.  
  5425. groupTypes.raisebox = function (group, options) {
  5426. var body = groupTypes.sizing({ value: {
  5427. value: [{
  5428. type: "text",
  5429. value: {
  5430. body: group.value.value,
  5431. font: "mathrm" // simulate \textrm
  5432. }
  5433. }],
  5434. size: 6 // simulate \normalsize
  5435. } }, options);
  5436. var dy = (0, _units.calculateSize)(group.value.dy.value, options);
  5437. return _buildCommon2.default.makeVList([{
  5438. type: "elem",
  5439. elem: body
  5440. }], "shift", -dy, options);
  5441. };
  5442.  
  5443. /**
  5444. * buildGroup is the function that takes a group and calls the correct groupType
  5445. * function for it. It also handles the interaction of size and style changes
  5446. * between parents and children.
  5447. */
  5448. var buildGroup = exports.buildGroup = function buildGroup(group, options, baseOptions) {
  5449. if (!group) {
  5450. return makeSpan();
  5451. }
  5452.  
  5453. if (groupTypes[group.type]) {
  5454. // Call the groupTypes function
  5455. var groupNode = groupTypes[group.type](group, options);
  5456.  
  5457. // If the size changed between the parent and the current group, account
  5458. // for that size difference.
  5459. if (baseOptions && options.size !== baseOptions.size) {
  5460. groupNode = makeSpan(options.sizingClasses(baseOptions), [groupNode], options);
  5461.  
  5462. var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
  5463.  
  5464. groupNode.height *= multiplier;
  5465. groupNode.depth *= multiplier;
  5466. }
  5467.  
  5468. return groupNode;
  5469. } else {
  5470. throw new _ParseError2.default("Got group of unknown type: '" + group.type + "'");
  5471. }
  5472. };
  5473.  
  5474. /**
  5475. * Take an entire parse tree, and build it into an appropriate set of HTML
  5476. * nodes.
  5477. */
  5478. function buildHTML(tree, options) {
  5479. // buildExpression is destructive, so we need to make a clone
  5480. // of the incoming tree so that it isn't accidentally changed
  5481. tree = JSON.parse((0, _stringify2.default)(tree));
  5482.  
  5483. // Build the expression contained in the tree
  5484. var expression = buildExpression(tree, options, true);
  5485. var body = makeSpan(["base"], expression, options);
  5486.  
  5487. // Add struts, which ensure that the top of the HTML element falls at the
  5488. // height of the expression, and the bottom of the HTML element falls at the
  5489. // depth of the expression.
  5490. var topStrut = makeSpan(["strut"]);
  5491. var bottomStrut = makeSpan(["strut", "bottom"]);
  5492.  
  5493. topStrut.style.height = body.height + "em";
  5494. bottomStrut.style.height = body.height + body.depth + "em";
  5495. // We'd like to use `vertical-align: top` but in IE 9 this lowers the
  5496. // baseline of the box to the bottom of this strut (instead staying in the
  5497. // normal place) so we use an absolute value for vertical-align instead
  5498. bottomStrut.style.verticalAlign = -body.depth + "em";
  5499.  
  5500. // Wrap the struts and body together
  5501. var htmlNode = makeSpan(["katex-html"], [topStrut, bottomStrut, body]);
  5502.  
  5503. htmlNode.setAttribute("aria-hidden", "true");
  5504.  
  5505. return htmlNode;
  5506. }
  5507.  
  5508. },{"./ParseError":84,"./Style":89,"./buildCommon":91,"./delimiter":97,"./domTree":98,"./stretchy":110,"./units":114,"./utils":115,"babel-runtime/core-js/json/stringify":5}],93:[function(require,module,exports){
  5509. "use strict";
  5510.  
  5511. Object.defineProperty(exports, "__esModule", {
  5512. value: true
  5513. });
  5514. exports.buildGroup = exports.buildExpression = exports.groupTypes = exports.makeText = undefined;
  5515. exports.default = buildMathML;
  5516.  
  5517. var _buildCommon = require("./buildCommon");
  5518.  
  5519. var _buildCommon2 = _interopRequireDefault(_buildCommon);
  5520.  
  5521. var _fontMetrics = require("./fontMetrics");
  5522.  
  5523. var _fontMetrics2 = _interopRequireDefault(_fontMetrics);
  5524.  
  5525. var _mathMLTree = require("./mathMLTree");
  5526.  
  5527. var _mathMLTree2 = _interopRequireDefault(_mathMLTree);
  5528.  
  5529. var _ParseError = require("./ParseError");
  5530.  
  5531. var _ParseError2 = _interopRequireDefault(_ParseError);
  5532.  
  5533. var _Style = require("./Style");
  5534.  
  5535. var _Style2 = _interopRequireDefault(_Style);
  5536.  
  5537. var _symbols = require("./symbols");
  5538.  
  5539. var _symbols2 = _interopRequireDefault(_symbols);
  5540.  
  5541. var _utils = require("./utils");
  5542.  
  5543. var _utils2 = _interopRequireDefault(_utils);
  5544.  
  5545. var _stretchy = require("./stretchy");
  5546.  
  5547. var _stretchy2 = _interopRequireDefault(_stretchy);
  5548.  
  5549. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5550.  
  5551. /**
  5552. * Takes a symbol and converts it into a MathML text node after performing
  5553. * optional replacement from symbols.js.
  5554. */
  5555. /**
  5556. * WARNING: New methods on groupTypes should be added to src/functions.
  5557. *
  5558. * This file converts a parse tree into a cooresponding MathML tree. The main
  5559. * entry point is the `buildMathML` function, which takes a parse tree from the
  5560. * parser.
  5561. */
  5562.  
  5563. var makeText = exports.makeText = function makeText(text, mode) {
  5564. if (_symbols2.default[mode][text] && _symbols2.default[mode][text].replace) {
  5565. text = _symbols2.default[mode][text].replace;
  5566. }
  5567.  
  5568. return new _mathMLTree2.default.TextNode(text);
  5569. };
  5570.  
  5571. /**
  5572. * Returns the math variant as a string or null if none is required.
  5573. */
  5574. var getVariant = function getVariant(group, options) {
  5575. var font = options.font;
  5576. if (!font) {
  5577. return null;
  5578. }
  5579.  
  5580. var mode = group.mode;
  5581. if (font === "mathit") {
  5582. return "italic";
  5583. }
  5584.  
  5585. var value = group.value;
  5586. if (_utils2.default.contains(["\\imath", "\\jmath"], value)) {
  5587. return null;
  5588. }
  5589.  
  5590. if (_symbols2.default[mode][value] && _symbols2.default[mode][value].replace) {
  5591. value = _symbols2.default[mode][value].replace;
  5592. }
  5593.  
  5594. var fontName = _buildCommon2.default.fontMap[font].fontName;
  5595. if (_fontMetrics2.default.getCharacterMetrics(value, fontName)) {
  5596. return _buildCommon2.default.fontMap[options.font].variant;
  5597. }
  5598.  
  5599. return null;
  5600. };
  5601.  
  5602. /**
  5603. * Functions for handling the different types of groups found in the parse
  5604. * tree. Each function should take a parse group and return a MathML node.
  5605. */
  5606. var groupTypes = exports.groupTypes = {};
  5607.  
  5608. var defaultVariant = {
  5609. "mi": "italic",
  5610. "mn": "normal",
  5611. "mtext": "normal"
  5612. };
  5613.  
  5614. groupTypes.mathord = function (group, options) {
  5615. var node = new _mathMLTree2.default.MathNode("mi", [makeText(group.value, group.mode)]);
  5616.  
  5617. var variant = getVariant(group, options) || "italic";
  5618. if (variant !== defaultVariant[node.type]) {
  5619. node.setAttribute("mathvariant", variant);
  5620. }
  5621. return node;
  5622. };
  5623.  
  5624. groupTypes.textord = function (group, options) {
  5625. var text = makeText(group.value, group.mode);
  5626.  
  5627. var variant = getVariant(group, options) || "normal";
  5628.  
  5629. var node = void 0;
  5630. if (group.mode === 'text') {
  5631. node = new _mathMLTree2.default.MathNode("mtext", [text]);
  5632. } else if (/[0-9]/.test(group.value)) {
  5633. // TODO(kevinb) merge adjacent <mn> nodes
  5634. // do it as a post processing step
  5635. node = new _mathMLTree2.default.MathNode("mn", [text]);
  5636. } else if (group.value === "\\prime") {
  5637. node = new _mathMLTree2.default.MathNode("mo", [text]);
  5638. } else {
  5639. node = new _mathMLTree2.default.MathNode("mi", [text]);
  5640. }
  5641. if (variant !== defaultVariant[node.type]) {
  5642. node.setAttribute("mathvariant", variant);
  5643. }
  5644.  
  5645. return node;
  5646. };
  5647.  
  5648. groupTypes.bin = function (group) {
  5649. var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]);
  5650.  
  5651. return node;
  5652. };
  5653.  
  5654. groupTypes.rel = function (group) {
  5655. var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]);
  5656.  
  5657. return node;
  5658. };
  5659.  
  5660. groupTypes.open = function (group) {
  5661. var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]);
  5662.  
  5663. return node;
  5664. };
  5665.  
  5666. groupTypes.close = function (group) {
  5667. var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]);
  5668.  
  5669. return node;
  5670. };
  5671.  
  5672. groupTypes.inner = function (group) {
  5673. var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]);
  5674.  
  5675. return node;
  5676. };
  5677.  
  5678. groupTypes.punct = function (group) {
  5679. var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]);
  5680.  
  5681. node.setAttribute("separator", "true");
  5682.  
  5683. return node;
  5684. };
  5685.  
  5686. groupTypes.ordgroup = function (group, options) {
  5687. var inner = buildExpression(group.value, options);
  5688.  
  5689. var node = new _mathMLTree2.default.MathNode("mrow", inner);
  5690.  
  5691. return node;
  5692. };
  5693.  
  5694. groupTypes.text = function (group, options) {
  5695. var body = group.value.body;
  5696.  
  5697. // Convert each element of the body into MathML, and combine consecutive
  5698. // <mtext> outputs into a single <mtext> tag. In this way, we don't
  5699. // nest non-text items (e.g., $nested-math$) within an <mtext>.
  5700. var inner = [];
  5701. var currentText = null;
  5702. for (var i = 0; i < body.length; i++) {
  5703. var _group = buildGroup(body[i], options);
  5704. if (_group.type === 'mtext' && currentText != null) {
  5705. Array.prototype.push.apply(currentText.children, _group.children);
  5706. } else {
  5707. inner.push(_group);
  5708. if (_group.type === 'mtext') {
  5709. currentText = _group;
  5710. }
  5711. }
  5712. }
  5713.  
  5714. // If there is a single tag in the end (presumably <mtext>),
  5715. // just return it. Otherwise, wrap them in an <mrow>.
  5716. if (inner.length === 1) {
  5717. return inner[0];
  5718. } else {
  5719. return new _mathMLTree2.default.MathNode("mrow", inner);
  5720. }
  5721. };
  5722.  
  5723. groupTypes.color = function (group, options) {
  5724. var inner = buildExpression(group.value.value, options);
  5725.  
  5726. var node = new _mathMLTree2.default.MathNode("mstyle", inner);
  5727.  
  5728. node.setAttribute("mathcolor", group.value.color);
  5729.  
  5730. return node;
  5731. };
  5732.  
  5733. groupTypes.supsub = function (group, options) {
  5734. // Is the inner group a relevant horizonal brace?
  5735. var isBrace = false;
  5736. var isOver = void 0;
  5737. var isSup = void 0;
  5738. if (group.value.base) {
  5739. if (group.value.base.value.type === "horizBrace") {
  5740. isSup = group.value.sup ? true : false;
  5741. if (isSup === group.value.base.value.isOver) {
  5742. isBrace = true;
  5743. isOver = group.value.base.value.isOver;
  5744. }
  5745. }
  5746. }
  5747.  
  5748. var removeUnnecessaryRow = true;
  5749. var children = [buildGroup(group.value.base, options, removeUnnecessaryRow)];
  5750.  
  5751. if (group.value.sub) {
  5752. children.push(buildGroup(group.value.sub, options, removeUnnecessaryRow));
  5753. }
  5754.  
  5755. if (group.value.sup) {
  5756. children.push(buildGroup(group.value.sup, options, removeUnnecessaryRow));
  5757. }
  5758.  
  5759. var nodeType = void 0;
  5760. if (isBrace) {
  5761. nodeType = isOver ? "mover" : "munder";
  5762. } else if (!group.value.sub) {
  5763. nodeType = "msup";
  5764. } else if (!group.value.sup) {
  5765. nodeType = "msub";
  5766. } else {
  5767. var base = group.value.base;
  5768. if (base && base.value.limits && options.style === _Style2.default.DISPLAY) {
  5769. nodeType = "munderover";
  5770. } else {
  5771. nodeType = "msubsup";
  5772. }
  5773. }
  5774.  
  5775. var node = new _mathMLTree2.default.MathNode(nodeType, children);
  5776.  
  5777. return node;
  5778. };
  5779.  
  5780. groupTypes.genfrac = function (group, options) {
  5781. var node = new _mathMLTree2.default.MathNode("mfrac", [buildGroup(group.value.numer, options), buildGroup(group.value.denom, options)]);
  5782.  
  5783. if (!group.value.hasBarLine) {
  5784. node.setAttribute("linethickness", "0px");
  5785. }
  5786.  
  5787. if (group.value.leftDelim != null || group.value.rightDelim != null) {
  5788. var withDelims = [];
  5789.  
  5790. if (group.value.leftDelim != null) {
  5791. var leftOp = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode(group.value.leftDelim)]);
  5792.  
  5793. leftOp.setAttribute("fence", "true");
  5794.  
  5795. withDelims.push(leftOp);
  5796. }
  5797.  
  5798. withDelims.push(node);
  5799.  
  5800. if (group.value.rightDelim != null) {
  5801. var rightOp = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode(group.value.rightDelim)]);
  5802.  
  5803. rightOp.setAttribute("fence", "true");
  5804.  
  5805. withDelims.push(rightOp);
  5806. }
  5807.  
  5808. var outerNode = new _mathMLTree2.default.MathNode("mrow", withDelims);
  5809.  
  5810. return outerNode;
  5811. }
  5812.  
  5813. return node;
  5814. };
  5815.  
  5816. groupTypes.sqrt = function (group, options) {
  5817. var node = void 0;
  5818. if (group.value.index) {
  5819. node = new _mathMLTree2.default.MathNode("mroot", [buildGroup(group.value.body, options), buildGroup(group.value.index, options)]);
  5820. } else {
  5821. node = new _mathMLTree2.default.MathNode("msqrt", [buildGroup(group.value.body, options)]);
  5822. }
  5823.  
  5824. return node;
  5825. };
  5826.  
  5827. groupTypes.accent = function (group, options) {
  5828. var accentNode = void 0;
  5829. if (group.value.isStretchy) {
  5830. accentNode = _stretchy2.default.mathMLnode(group.value.label);
  5831. } else {
  5832. accentNode = new _mathMLTree2.default.MathNode("mo", [makeText(group.value.label, group.mode)]);
  5833. }
  5834.  
  5835. var node = new _mathMLTree2.default.MathNode("mover", [buildGroup(group.value.base, options), accentNode]);
  5836.  
  5837. node.setAttribute("accent", "true");
  5838.  
  5839. return node;
  5840. };
  5841.  
  5842. groupTypes.spacing = function (group) {
  5843. var node = void 0;
  5844.  
  5845. if (group.value === "\\ " || group.value === "\\space" || group.value === " " || group.value === "~") {
  5846. node = new _mathMLTree2.default.MathNode("mtext", [new _mathMLTree2.default.TextNode("\xA0")]);
  5847. } else {
  5848. node = new _mathMLTree2.default.MathNode("mspace");
  5849.  
  5850. node.setAttribute("width", _buildCommon2.default.spacingFunctions[group.value].size);
  5851. }
  5852.  
  5853. return node;
  5854. };
  5855.  
  5856. groupTypes.op = function (group, options) {
  5857. var node = void 0;
  5858.  
  5859. // TODO(emily): handle big operators using the `largeop` attribute
  5860.  
  5861. if (group.value.symbol) {
  5862. // This is a symbol. Just add the symbol.
  5863. node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value.body, group.mode)]);
  5864. } else if (group.value.value) {
  5865. // This is an operator with children. Add them.
  5866. node = new _mathMLTree2.default.MathNode("mo", buildExpression(group.value.value, options));
  5867. } else {
  5868. // This is a text operator. Add all of the characters from the
  5869. // operator's name.
  5870. // TODO(emily): Add a space in the middle of some of these
  5871. // operators, like \limsup.
  5872. node = new _mathMLTree2.default.MathNode("mi", [new _mathMLTree2.default.TextNode(group.value.body.slice(1))]);
  5873.  
  5874. // TODO(ron): Append an <mo>&ApplyFunction;</mo> as in \operatorname
  5875. // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.2
  5876. }
  5877.  
  5878. return node;
  5879. };
  5880.  
  5881. groupTypes.mod = function (group, options) {
  5882. var inner = [];
  5883.  
  5884. if (group.value.modType === "pod" || group.value.modType === "pmod") {
  5885. inner.push(new _mathMLTree2.default.MathNode("mo", [makeText("(", group.mode)]));
  5886. }
  5887. if (group.value.modType !== "pod") {
  5888. inner.push(new _mathMLTree2.default.MathNode("mo", [makeText("mod", group.mode)]));
  5889. }
  5890. if (group.value.value) {
  5891. var space = new _mathMLTree2.default.MathNode("mspace");
  5892. space.setAttribute("width", "0.333333em");
  5893. inner.push(space);
  5894. inner = inner.concat(buildExpression(group.value.value, options));
  5895. }
  5896. if (group.value.modType === "pod" || group.value.modType === "pmod") {
  5897. inner.push(new _mathMLTree2.default.MathNode("mo", [makeText(")", group.mode)]));
  5898. }
  5899.  
  5900. return new _mathMLTree2.default.MathNode("mo", inner);
  5901. };
  5902.  
  5903. groupTypes.katex = function (group) {
  5904. var node = new _mathMLTree2.default.MathNode("mtext", [new _mathMLTree2.default.TextNode("KaTeX")]);
  5905.  
  5906. return node;
  5907. };
  5908.  
  5909. groupTypes.font = function (group, options) {
  5910. var font = group.value.font;
  5911. return buildGroup(group.value.body, options.withFont(font));
  5912. };
  5913.  
  5914. groupTypes.styling = function (group, options) {
  5915. // Figure out what style we're changing to.
  5916. // TODO(kevinb): dedupe this with buildHTML.js
  5917. // This will be easier of handling of styling nodes is in the same file.
  5918. var styleMap = {
  5919. "display": _Style2.default.DISPLAY,
  5920. "text": _Style2.default.TEXT,
  5921. "script": _Style2.default.SCRIPT,
  5922. "scriptscript": _Style2.default.SCRIPTSCRIPT
  5923. };
  5924.  
  5925. var newStyle = styleMap[group.value.style];
  5926. var newOptions = options.havingStyle(newStyle);
  5927.  
  5928. var inner = buildExpression(group.value.value, newOptions);
  5929.  
  5930. var node = new _mathMLTree2.default.MathNode("mstyle", inner);
  5931.  
  5932. var styleAttributes = {
  5933. "display": ["0", "true"],
  5934. "text": ["0", "false"],
  5935. "script": ["1", "false"],
  5936. "scriptscript": ["2", "false"]
  5937. };
  5938.  
  5939. var attr = styleAttributes[group.value.style];
  5940.  
  5941. node.setAttribute("scriptlevel", attr[0]);
  5942. node.setAttribute("displaystyle", attr[1]);
  5943.  
  5944. return node;
  5945. };
  5946.  
  5947. groupTypes.sizing = function (group, options) {
  5948. var newOptions = options.havingSize(group.value.size);
  5949. var inner = buildExpression(group.value.value, newOptions);
  5950.  
  5951. var node = new _mathMLTree2.default.MathNode("mstyle", inner);
  5952.  
  5953. // TODO(emily): This doesn't produce the correct size for nested size
  5954. // changes, because we don't keep state of what style we're currently
  5955. // in, so we can't reset the size to normal before changing it. Now
  5956. // that we're passing an options parameter we should be able to fix
  5957. // this.
  5958. node.setAttribute("mathsize", newOptions.sizeMultiplier + "em");
  5959.  
  5960. return node;
  5961. };
  5962.  
  5963. groupTypes.verb = function (group, options) {
  5964. var text = new _mathMLTree2.default.TextNode(_buildCommon2.default.makeVerb(group, options));
  5965. var node = new _mathMLTree2.default.MathNode("mtext", [text]);
  5966. node.setAttribute("mathvariant", _buildCommon2.default.fontMap["mathtt"].variant);
  5967. return node;
  5968. };
  5969.  
  5970. groupTypes.overline = function (group, options) {
  5971. var operator = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode("\u203E")]);
  5972. operator.setAttribute("stretchy", "true");
  5973.  
  5974. var node = new _mathMLTree2.default.MathNode("mover", [buildGroup(group.value.body, options), operator]);
  5975. node.setAttribute("accent", "true");
  5976.  
  5977. return node;
  5978. };
  5979.  
  5980. groupTypes.underline = function (group, options) {
  5981. var operator = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode("\u203E")]);
  5982. operator.setAttribute("stretchy", "true");
  5983.  
  5984. var node = new _mathMLTree2.default.MathNode("munder", [buildGroup(group.value.body, options), operator]);
  5985. node.setAttribute("accentunder", "true");
  5986.  
  5987. return node;
  5988. };
  5989.  
  5990. groupTypes.accentUnder = function (group, options) {
  5991. var accentNode = _stretchy2.default.mathMLnode(group.value.label);
  5992. var node = new _mathMLTree2.default.MathNode("munder", [buildGroup(group.value.body, options), accentNode]);
  5993. node.setAttribute("accentunder", "true");
  5994. return node;
  5995. };
  5996.  
  5997. groupTypes.enclose = function (group, options) {
  5998. var node = new _mathMLTree2.default.MathNode("menclose", [buildGroup(group.value.body, options)]);
  5999. switch (group.value.label) {
  6000. case "\\cancel":
  6001. node.setAttribute("notation", "updiagonalstrike");
  6002. break;
  6003. case "\\bcancel":
  6004. node.setAttribute("notation", "downdiagonalstrike");
  6005. break;
  6006. case "\\sout":
  6007. node.setAttribute("notation", "horizontalstrike");
  6008. break;
  6009. case "\\fbox":
  6010. node.setAttribute("notation", "box");
  6011. break;
  6012. case "\\colorbox":
  6013. node.setAttribute("mathbackground", group.value.backgroundColor.value);
  6014. break;
  6015. case "\\fcolorbox":
  6016. node.setAttribute("mathbackground", group.value.backgroundColor.value);
  6017. // TODO(ron): I don't know any way to set the border color.
  6018. node.setAttribute("notation", "box");
  6019. break;
  6020. default:
  6021. // xcancel
  6022. node.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
  6023. }
  6024. return node;
  6025. };
  6026.  
  6027. groupTypes.horizBrace = function (group, options) {
  6028. var accentNode = _stretchy2.default.mathMLnode(group.value.label);
  6029. return new _mathMLTree2.default.MathNode(group.value.isOver ? "mover" : "munder", [buildGroup(group.value.base, options), accentNode]);
  6030. };
  6031.  
  6032. groupTypes.xArrow = function (group, options) {
  6033. var arrowNode = _stretchy2.default.mathMLnode(group.value.label);
  6034. var node = void 0;
  6035. var lowerNode = void 0;
  6036.  
  6037. if (group.value.body) {
  6038. var upperNode = buildGroup(group.value.body, options);
  6039. if (group.value.below) {
  6040. lowerNode = buildGroup(group.value.below, options);
  6041. node = new _mathMLTree2.default.MathNode("munderover", [arrowNode, lowerNode, upperNode]);
  6042. } else {
  6043. node = new _mathMLTree2.default.MathNode("mover", [arrowNode, upperNode]);
  6044. }
  6045. } else if (group.value.below) {
  6046. lowerNode = buildGroup(group.value.below, options);
  6047. node = new _mathMLTree2.default.MathNode("munder", [arrowNode, lowerNode]);
  6048. } else {
  6049. node = new _mathMLTree2.default.MathNode("mover", [arrowNode]);
  6050. }
  6051. return node;
  6052. };
  6053.  
  6054. groupTypes.rule = function (group) {
  6055. // TODO(emily): Figure out if there's an actual way to draw black boxes
  6056. // in MathML.
  6057. var node = new _mathMLTree2.default.MathNode("mrow");
  6058.  
  6059. return node;
  6060. };
  6061.  
  6062. groupTypes.kern = function (group) {
  6063. // TODO(kevin): Figure out if there's a way to add space in MathML
  6064. var node = new _mathMLTree2.default.MathNode("mrow");
  6065.  
  6066. return node;
  6067. };
  6068.  
  6069. groupTypes.lap = function (group, options) {
  6070. // mathllap, mathrlap, mathclap
  6071. var node = new _mathMLTree2.default.MathNode("mpadded", [buildGroup(group.value.body, options)]);
  6072.  
  6073. if (group.value.alignment !== "rlap") {
  6074. var offset = group.value.alignment === "llap" ? "-1" : "-0.5";
  6075. node.setAttribute("lspace", offset + "width");
  6076. }
  6077. node.setAttribute("width", "0px");
  6078.  
  6079. return node;
  6080. };
  6081.  
  6082. groupTypes.smash = function (group, options) {
  6083. var node = new _mathMLTree2.default.MathNode("mpadded", [buildGroup(group.value.body, options)]);
  6084.  
  6085. if (group.value.smashHeight) {
  6086. node.setAttribute("height", "0px");
  6087. }
  6088.  
  6089. if (group.value.smashDepth) {
  6090. node.setAttribute("depth", "0px");
  6091. }
  6092.  
  6093. return node;
  6094. };
  6095.  
  6096. groupTypes.mclass = function (group, options) {
  6097. var inner = buildExpression(group.value.value, options);
  6098. return new _mathMLTree2.default.MathNode("mstyle", inner);
  6099. };
  6100.  
  6101. groupTypes.raisebox = function (group, options) {
  6102. var node = new _mathMLTree2.default.MathNode("mpadded", [buildGroup(group.value.body, options)]);
  6103. var dy = group.value.dy.value.number + group.value.dy.value.unit;
  6104. node.setAttribute("voffset", dy);
  6105. return node;
  6106. };
  6107.  
  6108. /**
  6109. * Takes a list of nodes, builds them, and returns a list of the generated
  6110. * MathML nodes. A little simpler than the HTML version because we don't do any
  6111. * previous-node handling.
  6112. */
  6113. var buildExpression = exports.buildExpression = function buildExpression(expression, options) {
  6114. var groups = [];
  6115. for (var i = 0; i < expression.length; i++) {
  6116. var group = expression[i];
  6117. groups.push(buildGroup(group, options));
  6118. }
  6119.  
  6120. // TODO(kevinb): combine \\not with mrels and mords
  6121.  
  6122. return groups;
  6123. };
  6124.  
  6125. /**
  6126. * Takes a group from the parser and calls the appropriate groupTypes function
  6127. * on it to produce a MathML node.
  6128. */
  6129. var buildGroup = exports.buildGroup = function buildGroup(group, options) {
  6130. var removeUnnecessaryRow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6131.  
  6132. if (!group) {
  6133. return new _mathMLTree2.default.MathNode("mrow");
  6134. }
  6135.  
  6136. if (groupTypes[group.type]) {
  6137. // Call the groupTypes function
  6138. var result = groupTypes[group.type](group, options);
  6139. if (removeUnnecessaryRow) {
  6140. if (result.type === "mrow" && result.children.length === 1) {
  6141. return result.children[0];
  6142. }
  6143. }
  6144. return result;
  6145. } else {
  6146. throw new _ParseError2.default("Got group of unknown type: '" + group.type + "'");
  6147. }
  6148. };
  6149.  
  6150. /**
  6151. * Takes a full parse tree and settings and builds a MathML representation of
  6152. * it. In particular, we put the elements from building the parse tree into a
  6153. * <semantics> tag so we can also include that TeX source as an annotation.
  6154. *
  6155. * Note that we actually return a domTree element with a `<math>` inside it so
  6156. * we can do appropriate styling.
  6157. */
  6158. function buildMathML(tree, texExpression, options) {
  6159. var expression = buildExpression(tree, options);
  6160.  
  6161. // Wrap up the expression in an mrow so it is presented in the semantics
  6162. // tag correctly.
  6163. var wrapper = new _mathMLTree2.default.MathNode("mrow", expression);
  6164.  
  6165. // Build a TeX annotation of the source
  6166. var annotation = new _mathMLTree2.default.MathNode("annotation", [new _mathMLTree2.default.TextNode(texExpression)]);
  6167.  
  6168. annotation.setAttribute("encoding", "application/x-tex");
  6169.  
  6170. var semantics = new _mathMLTree2.default.MathNode("semantics", [wrapper, annotation]);
  6171.  
  6172. var math = new _mathMLTree2.default.MathNode("math", [semantics]);
  6173.  
  6174. // You can't style <math> nodes, so we wrap the node in a span.
  6175. return _buildCommon2.default.makeSpan(["katex-mathml"], [math]);
  6176. }
  6177.  
  6178. },{"./ParseError":84,"./Style":89,"./buildCommon":91,"./fontMetrics":101,"./mathMLTree":108,"./stretchy":110,"./symbols":112,"./utils":115}],94:[function(require,module,exports){
  6179. "use strict";
  6180.  
  6181. Object.defineProperty(exports, "__esModule", {
  6182. value: true
  6183. });
  6184.  
  6185. var _buildHTML = require("./buildHTML");
  6186.  
  6187. var _buildHTML2 = _interopRequireDefault(_buildHTML);
  6188.  
  6189. var _buildMathML = require("./buildMathML");
  6190.  
  6191. var _buildMathML2 = _interopRequireDefault(_buildMathML);
  6192.  
  6193. var _buildCommon = require("./buildCommon");
  6194.  
  6195. var _buildCommon2 = _interopRequireDefault(_buildCommon);
  6196.  
  6197. var _Options = require("./Options");
  6198.  
  6199. var _Options2 = _interopRequireDefault(_Options);
  6200.  
  6201. var _Settings = require("./Settings");
  6202.  
  6203. var _Settings2 = _interopRequireDefault(_Settings);
  6204.  
  6205. var _Style = require("./Style");
  6206.  
  6207. var _Style2 = _interopRequireDefault(_Style);
  6208.  
  6209. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6210.  
  6211. var buildTree = function buildTree(tree, expression, settings) {
  6212. settings = settings || new _Settings2.default({});
  6213.  
  6214. var startStyle = _Style2.default.TEXT;
  6215. if (settings.displayMode) {
  6216. startStyle = _Style2.default.DISPLAY;
  6217. }
  6218.  
  6219. // Setup the default options
  6220. var options = new _Options2.default({
  6221. style: startStyle,
  6222. maxSize: settings.maxSize
  6223. });
  6224.  
  6225. // `buildHTML` sometimes messes with the parse tree (like turning bins ->
  6226. // ords), so we build the MathML version first.
  6227. var mathMLNode = (0, _buildMathML2.default)(tree, expression, options);
  6228. var htmlNode = (0, _buildHTML2.default)(tree, options);
  6229.  
  6230. var katexNode = _buildCommon2.default.makeSpan(["katex"], [mathMLNode, htmlNode]);
  6231.  
  6232. if (settings.displayMode) {
  6233. return _buildCommon2.default.makeSpan(["katex-display"], [katexNode]);
  6234. } else {
  6235. return katexNode;
  6236. }
  6237. };
  6238.  
  6239. exports.default = buildTree;
  6240.  
  6241. },{"./Options":83,"./Settings":87,"./Style":89,"./buildCommon":91,"./buildHTML":92,"./buildMathML":93}],95:[function(require,module,exports){
  6242. "use strict";
  6243.  
  6244. Object.defineProperty(exports, "__esModule", {
  6245. value: true
  6246. });
  6247. exports._environments = undefined;
  6248. exports.default = defineEnvironment;
  6249.  
  6250. var _buildHTML = require("./buildHTML");
  6251.  
  6252. var _buildMathML = require("./buildMathML");
  6253.  
  6254. var _Options = require("./Options");
  6255.  
  6256. var _Options2 = _interopRequireDefault(_Options);
  6257.  
  6258. var _ParseNode = require("./ParseNode");
  6259.  
  6260. var _ParseNode2 = _interopRequireDefault(_ParseNode);
  6261.  
  6262. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6263.  
  6264. /**
  6265. * All registered environments.
  6266. * `environments.js` exports this same dictionary again and makes it public.
  6267. * `Parser.js` requires this dictionary via `environments.js`.
  6268. */
  6269.  
  6270.  
  6271. /**
  6272. * The context contains the following properties:
  6273. * - mode: current parsing mode.
  6274. * - envName: the name of the environment, one of the listed names.
  6275. * - parser: the parser object.
  6276. */
  6277.  
  6278.  
  6279. /**
  6280. * - context: information and references provided by the parser
  6281. * - args: an array of arguments passed to \begin{name}
  6282. * - optArgs: an array of optional arguments passed to \begin{name}
  6283. */
  6284.  
  6285.  
  6286. /**
  6287. * - numArgs: (default 0) The number of arguments after the \begin{name} function.
  6288. * - argTypes: (optional) Just like for a function
  6289. * - allowedInText: (default false) Whether or not the environment is allowed
  6290. * inside text mode (not enforced yet).
  6291. * - numOptionalArgs: (default 0) Just like for a function
  6292. */
  6293.  
  6294.  
  6295. /**
  6296. * Final enviornment spec for use at parse time.
  6297. * This is almost identical to `EnvDefSpec`, except it
  6298. * 1. includes the function handler
  6299. * 2. requires all arguments except argType
  6300. * It is generated by `defineEnvironment()` below.
  6301. */
  6302. var _environments = exports._environments = {};
  6303.  
  6304. function defineEnvironment(_ref) {
  6305. var type = _ref.type,
  6306. names = _ref.names,
  6307. props = _ref.props,
  6308. handler = _ref.handler,
  6309. htmlBuilder = _ref.htmlBuilder,
  6310. mathmlBuilder = _ref.mathmlBuilder;
  6311.  
  6312. // Set default values of environments
  6313. var data = {
  6314. numArgs: props.numArgs || 0,
  6315. greediness: 1,
  6316. allowedInText: false,
  6317. numOptionalArgs: 0,
  6318. handler: handler
  6319. };
  6320. for (var i = 0; i < names.length; ++i) {
  6321. _environments[names[i]] = data;
  6322. }
  6323. if (htmlBuilder) {
  6324. _buildHTML.groupTypes[type] = htmlBuilder;
  6325. }
  6326. if (mathmlBuilder) {
  6327. _buildMathML.groupTypes[type] = mathmlBuilder;
  6328. }
  6329. }
  6330.  
  6331. },{"./Options":83,"./ParseNode":85,"./buildHTML":92,"./buildMathML":93}],96:[function(require,module,exports){
  6332. "use strict";
  6333.  
  6334. Object.defineProperty(exports, "__esModule", {
  6335. value: true
  6336. });
  6337. exports.ordargument = exports._functions = undefined;
  6338. exports.default = defineFunction;
  6339.  
  6340. var _buildHTML = require("./buildHTML");
  6341.  
  6342. var _buildMathML = require("./buildMathML");
  6343.  
  6344. /**
  6345. * All registered functions.
  6346. * `functions.js` just exports this same dictionary again and makes it public.
  6347. * `Parser.js` requires this dictionary.
  6348. */
  6349.  
  6350.  
  6351. /** Context provided to function handlers for error messages. */
  6352.  
  6353.  
  6354. // TODO: Enumerate all allowed output types.
  6355.  
  6356.  
  6357. /**
  6358. * Final function spec for use at parse time.
  6359. * This is almost identical to `FunctionPropSpec`, except it
  6360. * 1. includes the function handler, and
  6361. * 2. requires all arguments except argTypes.
  6362. * It is generated by `defineFunction()` below.
  6363. */
  6364. var _functions = exports._functions = {};
  6365.  
  6366. function defineFunction(_ref) {
  6367. var type = _ref.type,
  6368. names = _ref.names,
  6369. props = _ref.props,
  6370. handler = _ref.handler,
  6371. htmlBuilder = _ref.htmlBuilder,
  6372. mathmlBuilder = _ref.mathmlBuilder;
  6373.  
  6374. // Set default values of functions
  6375. var data = {
  6376. numArgs: props.numArgs,
  6377. argTypes: props.argTypes,
  6378. greediness: props.greediness === undefined ? 1 : props.greediness,
  6379. allowedInText: !!props.allowedInText,
  6380. allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath,
  6381. numOptionalArgs: props.numOptionalArgs || 0,
  6382. infix: !!props.infix,
  6383. handler: handler
  6384. };
  6385. for (var i = 0; i < names.length; ++i) {
  6386. _functions[names[i]] = data;
  6387. }
  6388. if (type) {
  6389. if (htmlBuilder) {
  6390. _buildHTML.groupTypes[type] = htmlBuilder;
  6391. }
  6392. if (mathmlBuilder) {
  6393. _buildMathML.groupTypes[type] = mathmlBuilder;
  6394. }
  6395. }
  6396. }
  6397.  
  6398. // Since the corresponding buildHTML/buildMathML function expects a
  6399. // list of elements, we normalize for different kinds of arguments
  6400. var ordargument = exports.ordargument = function ordargument(arg) {
  6401. if (arg.type === "ordgroup") {
  6402. return arg.value;
  6403. } else {
  6404. return [arg];
  6405. }
  6406. };
  6407.  
  6408. },{"./buildHTML":92,"./buildMathML":93}],97:[function(require,module,exports){
  6409. "use strict";
  6410.  
  6411. Object.defineProperty(exports, "__esModule", {
  6412. value: true
  6413. });
  6414.  
  6415. var _ParseError = require("./ParseError");
  6416.  
  6417. var _ParseError2 = _interopRequireDefault(_ParseError);
  6418.  
  6419. var _Style = require("./Style");
  6420.  
  6421. var _Style2 = _interopRequireDefault(_Style);
  6422.  
  6423. var _domTree = require("./domTree");
  6424.  
  6425. var _domTree2 = _interopRequireDefault(_domTree);
  6426.  
  6427. var _buildCommon = require("./buildCommon");
  6428.  
  6429. var _buildCommon2 = _interopRequireDefault(_buildCommon);
  6430.  
  6431. var _fontMetrics = require("./fontMetrics");
  6432.  
  6433. var _fontMetrics2 = _interopRequireDefault(_fontMetrics);
  6434.  
  6435. var _symbols = require("./symbols");
  6436.  
  6437. var _symbols2 = _interopRequireDefault(_symbols);
  6438.  
  6439. var _utils = require("./utils");
  6440.  
  6441. var _utils2 = _interopRequireDefault(_utils);
  6442.  
  6443. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6444.  
  6445. /**
  6446. * Get the metrics for a given symbol and font, after transformation (i.e.
  6447. * after following replacement from symbols.js)
  6448. */
  6449. var getMetrics = function getMetrics(symbol, font) {
  6450. if (_symbols2.default.math[symbol] && _symbols2.default.math[symbol].replace) {
  6451. return _fontMetrics2.default.getCharacterMetrics(_symbols2.default.math[symbol].replace, font);
  6452. } else {
  6453. return _fontMetrics2.default.getCharacterMetrics(symbol, font);
  6454. }
  6455. };
  6456.  
  6457. /**
  6458. * Puts a delimiter span in a given style, and adds appropriate height, depth,
  6459. * and maxFontSizes.
  6460. */
  6461. /**
  6462. * This file deals with creating delimiters of various sizes. The TeXbook
  6463. * discusses these routines on page 441-442, in the "Another subroutine sets box
  6464. * x to a specified variable delimiter" paragraph.
  6465. *
  6466. * There are three main routines here. `makeSmallDelim` makes a delimiter in the
  6467. * normal font, but in either text, script, or scriptscript style.
  6468. * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1,
  6469. * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of
  6470. * smaller pieces that are stacked on top of one another.
  6471. *
  6472. * The functions take a parameter `center`, which determines if the delimiter
  6473. * should be centered around the axis.
  6474. *
  6475. * Then, there are three exposed functions. `sizedDelim` makes a delimiter in
  6476. * one of the given sizes. This is used for things like `\bigl`.
  6477. * `customSizedDelim` makes a delimiter with a given total height+depth. It is
  6478. * called in places like `\sqrt`. `leftRightDelim` makes an appropriate
  6479. * delimiter which surrounds an expression of a given height an depth. It is
  6480. * used in `\left` and `\right`.
  6481. */
  6482.  
  6483. var styleWrap = function styleWrap(delim, toStyle, options, classes) {
  6484. var newOptions = options.havingBaseStyle(toStyle);
  6485.  
  6486. var span = _buildCommon2.default.makeSpan((classes || []).concat(newOptions.sizingClasses(options)), [delim], options);
  6487.  
  6488. span.delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;
  6489. span.height *= span.delimSizeMultiplier;
  6490. span.depth *= span.delimSizeMultiplier;
  6491. span.maxFontSize = newOptions.sizeMultiplier;
  6492.  
  6493. return span;
  6494. };
  6495.  
  6496. var centerSpan = function centerSpan(span, options, style) {
  6497. var newOptions = options.havingBaseStyle(style);
  6498. var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight;
  6499.  
  6500. span.classes.push("delimcenter");
  6501. span.style.top = shift + "em";
  6502. span.height -= shift;
  6503. span.depth += shift;
  6504. };
  6505.  
  6506. /**
  6507. * Makes a small delimiter. This is a delimiter that comes in the Main-Regular
  6508. * font, but is restyled to either be in textstyle, scriptstyle, or
  6509. * scriptscriptstyle.
  6510. */
  6511. var makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) {
  6512. var text = _buildCommon2.default.makeSymbol(delim, "Main-Regular", mode, options);
  6513. var span = styleWrap(text, style, options, classes);
  6514. if (center) {
  6515. centerSpan(span, options, style);
  6516. }
  6517. return span;
  6518. };
  6519.  
  6520. /**
  6521. * Builds a symbol in the given font size (note size is an integer)
  6522. */
  6523. var mathrmSize = function mathrmSize(value, size, mode, options) {
  6524. return _buildCommon2.default.makeSymbol(value, "Size" + size + "-Regular", mode, options);
  6525. };
  6526.  
  6527. /**
  6528. * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2,
  6529. * Size3, or Size4 fonts. It is always rendered in textstyle.
  6530. */
  6531. var makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) {
  6532. var inner = mathrmSize(delim, size, mode, options);
  6533. var span = styleWrap(_buildCommon2.default.makeSpan(["delimsizing", "size" + size], [inner], options), _Style2.default.TEXT, options, classes);
  6534. if (center) {
  6535. centerSpan(span, options, _Style2.default.TEXT);
  6536. }
  6537. return span;
  6538. };
  6539.  
  6540. /**
  6541. * Make an inner span with the given offset and in the given font. This is used
  6542. * in `makeStackedDelim` to make the stacking pieces for the delimiter.
  6543. */
  6544. var makeInner = function makeInner(symbol, font, mode) {
  6545. var sizeClass = void 0;
  6546. // Apply the correct CSS class to choose the right font.
  6547. if (font === "Size1-Regular") {
  6548. sizeClass = "delim-size1";
  6549. } else if (font === "Size4-Regular") {
  6550. sizeClass = "delim-size4";
  6551. }
  6552.  
  6553. var inner = _buildCommon2.default.makeSpan(["delimsizinginner", sizeClass], [_buildCommon2.default.makeSpan([], [_buildCommon2.default.makeSymbol(symbol, font, mode)])]);
  6554.  
  6555. // Since this will be passed into `makeVList` in the end, wrap the element
  6556. // in the appropriate tag that VList uses.
  6557. return { type: "elem", elem: inner };
  6558. };
  6559.  
  6560. /**
  6561. * Make a stacked delimiter out of a given delimiter, with the total height at
  6562. * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook.
  6563. */
  6564. var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) {
  6565. // There are four parts, the top, an optional middle, a repeated part, and a
  6566. // bottom.
  6567. var top = void 0;
  6568. var middle = void 0;
  6569. var repeat = void 0;
  6570. var bottom = void 0;
  6571. top = repeat = bottom = delim;
  6572. middle = null;
  6573. // Also keep track of what font the delimiters are in
  6574. var font = "Size1-Regular";
  6575.  
  6576. // We set the parts and font based on the symbol. Note that we use
  6577. // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the
  6578. // repeats of the arrows
  6579. if (delim === "\\uparrow") {
  6580. repeat = bottom = "\u23D0";
  6581. } else if (delim === "\\Uparrow") {
  6582. repeat = bottom = "\u2016";
  6583. } else if (delim === "\\downarrow") {
  6584. top = repeat = "\u23D0";
  6585. } else if (delim === "\\Downarrow") {
  6586. top = repeat = "\u2016";
  6587. } else if (delim === "\\updownarrow") {
  6588. top = "\\uparrow";
  6589. repeat = "\u23D0";
  6590. bottom = "\\downarrow";
  6591. } else if (delim === "\\Updownarrow") {
  6592. top = "\\Uparrow";
  6593. repeat = "\u2016";
  6594. bottom = "\\Downarrow";
  6595. } else if (delim === "[" || delim === "\\lbrack") {
  6596. top = "\u23A1";
  6597. repeat = "\u23A2";
  6598. bottom = "\u23A3";
  6599. font = "Size4-Regular";
  6600. } else if (delim === "]" || delim === "\\rbrack") {
  6601. top = "\u23A4";
  6602. repeat = "\u23A5";
  6603. bottom = "\u23A6";
  6604. font = "Size4-Regular";
  6605. } else if (delim === "\\lfloor") {
  6606. repeat = top = "\u23A2";
  6607. bottom = "\u23A3";
  6608. font = "Size4-Regular";
  6609. } else if (delim === "\\lceil") {
  6610. top = "\u23A1";
  6611. repeat = bottom = "\u23A2";
  6612. font = "Size4-Regular";
  6613. } else if (delim === "\\rfloor") {
  6614. repeat = top = "\u23A5";
  6615. bottom = "\u23A6";
  6616. font = "Size4-Regular";
  6617. } else if (delim === "\\rceil") {
  6618. top = "\u23A4";
  6619. repeat = bottom = "\u23A5";
  6620. font = "Size4-Regular";
  6621. } else if (delim === "(") {
  6622. top = "\u239B";
  6623. repeat = "\u239C";
  6624. bottom = "\u239D";
  6625. font = "Size4-Regular";
  6626. } else if (delim === ")") {
  6627. top = "\u239E";
  6628. repeat = "\u239F";
  6629. bottom = "\u23A0";
  6630. font = "Size4-Regular";
  6631. } else if (delim === "\\{" || delim === "\\lbrace") {
  6632. top = "\u23A7";
  6633. middle = "\u23A8";
  6634. bottom = "\u23A9";
  6635. repeat = "\u23AA";
  6636. font = "Size4-Regular";
  6637. } else if (delim === "\\}" || delim === "\\rbrace") {
  6638. top = "\u23AB";
  6639. middle = "\u23AC";
  6640. bottom = "\u23AD";
  6641. repeat = "\u23AA";
  6642. font = "Size4-Regular";
  6643. } else if (delim === "\\lgroup") {
  6644. top = "\u23A7";
  6645. bottom = "\u23A9";
  6646. repeat = "\u23AA";
  6647. font = "Size4-Regular";
  6648. } else if (delim === "\\rgroup") {
  6649. top = "\u23AB";
  6650. bottom = "\u23AD";
  6651. repeat = "\u23AA";
  6652. font = "Size4-Regular";
  6653. } else if (delim === "\\lmoustache") {
  6654. top = "\u23A7";
  6655. bottom = "\u23AD";
  6656. repeat = "\u23AA";
  6657. font = "Size4-Regular";
  6658. } else if (delim === "\\rmoustache") {
  6659. top = "\u23AB";
  6660. bottom = "\u23A9";
  6661. repeat = "\u23AA";
  6662. font = "Size4-Regular";
  6663. }
  6664.  
  6665. // Get the metrics of the four sections
  6666. var topMetrics = getMetrics(top, font);
  6667. var topHeightTotal = topMetrics.height + topMetrics.depth;
  6668. var repeatMetrics = getMetrics(repeat, font);
  6669. var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth;
  6670. var bottomMetrics = getMetrics(bottom, font);
  6671. var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth;
  6672. var middleHeightTotal = 0;
  6673. var middleFactor = 1;
  6674. if (middle !== null) {
  6675. var middleMetrics = getMetrics(middle, font);
  6676. middleHeightTotal = middleMetrics.height + middleMetrics.depth;
  6677. middleFactor = 2; // repeat symmetrically above and below middle
  6678. }
  6679.  
  6680. // Calcuate the minimal height that the delimiter can have.
  6681. // It is at least the size of the top, bottom, and optional middle combined.
  6682. var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal;
  6683.  
  6684. // Compute the number of copies of the repeat symbol we will need
  6685. var repeatCount = Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal));
  6686.  
  6687. // Compute the total height of the delimiter including all the symbols
  6688. var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal;
  6689.  
  6690. // The center of the delimiter is placed at the center of the axis. Note
  6691. // that in this context, "center" means that the delimiter should be
  6692. // centered around the axis in the current style, while normally it is
  6693. // centered around the axis in textstyle.
  6694. var axisHeight = options.fontMetrics().axisHeight;
  6695. if (center) {
  6696. axisHeight *= options.sizeMultiplier;
  6697. }
  6698. // Calculate the depth
  6699. var depth = realHeightTotal / 2 - axisHeight;
  6700.  
  6701. // Now, we start building the pieces that will go into the vlist
  6702.  
  6703. // Keep a list of the inner pieces
  6704. var inners = [];
  6705.  
  6706. // Add the bottom symbol
  6707. inners.push(makeInner(bottom, font, mode));
  6708.  
  6709. if (middle === null) {
  6710. // Add that many symbols
  6711. for (var i = 0; i < repeatCount; i++) {
  6712. inners.push(makeInner(repeat, font, mode));
  6713. }
  6714. } else {
  6715. // When there is a middle bit, we need the middle part and two repeated
  6716. // sections
  6717. for (var _i = 0; _i < repeatCount; _i++) {
  6718. inners.push(makeInner(repeat, font, mode));
  6719. }
  6720. inners.push(makeInner(middle, font, mode));
  6721. for (var _i2 = 0; _i2 < repeatCount; _i2++) {
  6722. inners.push(makeInner(repeat, font, mode));
  6723. }
  6724. }
  6725.  
  6726. // Add the top symbol
  6727. inners.push(makeInner(top, font, mode));
  6728.  
  6729. // Finally, build the vlist
  6730. var newOptions = options.havingBaseStyle(_Style2.default.TEXT);
  6731. var inner = _buildCommon2.default.makeVList(inners, "bottom", depth, newOptions);
  6732.  
  6733. return styleWrap(_buildCommon2.default.makeSpan(["delimsizing", "mult"], [inner], newOptions), _Style2.default.TEXT, options, classes);
  6734. };
  6735.  
  6736. var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, options) {
  6737. var alternate = void 0;
  6738. if (sqrtName === "sqrtTall") {
  6739. // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular
  6740. // One path edge has a variable length. It runs from the viniculumn
  6741. // to a point near (14 units) the bottom of the surd. The viniculum
  6742. // is 40 units thick. So the length of the line in question is:
  6743. var vertSegment = viewBoxHeight - 54;
  6744. alternate = "M702 0H400000v40H742v" + vertSegment + "l-4 4-4 4c-.667.667\n-2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1h-12l-28-84c-16.667-52-96.667\n-294.333-240-727l-212 -643 -85 170c-4-3.333-8.333-7.667-13 -13l-13-13l77-155\n 77-156c66 199.333 139 419.667 219 661 l218 661zM702 0H400000v40H742z";
  6745. }
  6746. var pathNode = new _domTree2.default.pathNode(sqrtName, alternate);
  6747.  
  6748. // Note: 1000:1 ratio of viewBox to document em width.
  6749. var attributes = [["width", "400em"], ["height", height + "em"]];
  6750. attributes.push(["viewBox", "0 0 400000 " + viewBoxHeight]);
  6751. attributes.push(["preserveAspectRatio", "xMinYMin slice"]);
  6752. var svg = new _domTree2.default.svgNode([pathNode], attributes);
  6753.  
  6754. return _buildCommon2.default.makeSpan(["hide-tail"], [svg], options);
  6755. };
  6756.  
  6757. var sqrtSpan = function sqrtSpan(height, delim, options) {
  6758. // Create a span containing an SVG image of a sqrt symbol.
  6759. var span = void 0;
  6760. var sizeMultiplier = options.sizeMultiplier; // default
  6761. var spanHeight = void 0;
  6762. var viewBoxHeight = void 0;
  6763.  
  6764. if (delim.type === "small") {
  6765. // Get an SVG that is derived from glyph U+221A in font KaTeX-Main.
  6766. viewBoxHeight = 1000; // from font
  6767. var newOptions = options.havingBaseStyle(delim.style);
  6768. sizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;
  6769. spanHeight = 1 * sizeMultiplier;
  6770. span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, options);
  6771. span.style.minWidth = "0.853em";
  6772. span.advanceWidth = 0.833 * sizeMultiplier; // from the font.
  6773. } else if (delim.type === "large") {
  6774. // These SVGs come from fonts: KaTeX_Size1, _Size2, etc.
  6775. viewBoxHeight = 1000 * sizeToMaxHeight[delim.size];
  6776. spanHeight = sizeToMaxHeight[delim.size] / sizeMultiplier;
  6777. span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, options);
  6778. span.style.minWidth = "1.02em";
  6779. span.advanceWidth = 1.0 / sizeMultiplier; // from the font
  6780. } else {
  6781. // Tall sqrt. In TeX, this would be stacked using multiple glyphs.
  6782. // We'll use a single SVG to accomplish the same thing.
  6783. spanHeight = height / sizeMultiplier;
  6784. viewBoxHeight = Math.floor(1000 * height);
  6785. span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, options);
  6786. span.style.minWidth = "0.742em";
  6787. span.advanceWidth = 1.056 / sizeMultiplier;
  6788. }
  6789.  
  6790. span.height = spanHeight;
  6791. span.style.height = spanHeight + "em";
  6792. span.sizeMultiplier = sizeMultiplier;
  6793.  
  6794. return span;
  6795. };
  6796.  
  6797. // There are three kinds of delimiters, delimiters that stack when they become
  6798. // too large
  6799. var stackLargeDelimiters = ["(", ")", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\\lceil", "\\rceil", "\\surd"];
  6800.  
  6801. // delimiters that always stack
  6802. var stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache"];
  6803.  
  6804. // and delimiters that never stack
  6805. var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"];
  6806.  
  6807. // Metrics of the different sizes. Found by looking at TeX's output of
  6808. // $\bigl| // \Bigl| \biggl| \Biggl| \showlists$
  6809. // Used to create stacked delimiters of appropriate sizes in makeSizedDelim.
  6810. var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0];
  6811.  
  6812. /**
  6813. * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4.
  6814. */
  6815. var makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) {
  6816. // < and > turn into \langle and \rangle in delimiters
  6817. if (delim === "<" || delim === "\\lt") {
  6818. delim = "\\langle";
  6819. } else if (delim === ">" || delim === "\\gt") {
  6820. delim = "\\rangle";
  6821. }
  6822.  
  6823. // Sized delimiters are never centered.
  6824. if (_utils2.default.contains(stackLargeDelimiters, delim) || _utils2.default.contains(stackNeverDelimiters, delim)) {
  6825. return makeLargeDelim(delim, size, false, options, mode, classes);
  6826. } else if (_utils2.default.contains(stackAlwaysDelimiters, delim)) {
  6827. return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);
  6828. } else {
  6829. throw new _ParseError2.default("Illegal delimiter: '" + delim + "'");
  6830. }
  6831. };
  6832.  
  6833. /**
  6834. * There are three different sequences of delimiter sizes that the delimiters
  6835. * follow depending on the kind of delimiter. This is used when creating custom
  6836. * sized delimiters to decide whether to create a small, large, or stacked
  6837. * delimiter.
  6838. *
  6839. * In real TeX, these sequences aren't explicitly defined, but are instead
  6840. * defined inside the font metrics. Since there are only three sequences that
  6841. * are possible for the delimiters that TeX defines, it is easier to just encode
  6842. * them explicitly here.
  6843. */
  6844.  
  6845. // Delimiters that never stack try small delimiters and large delimiters only
  6846. var stackNeverDelimiterSequence = [{ type: "small", style: _Style2.default.SCRIPTSCRIPT }, { type: "small", style: _Style2.default.SCRIPT }, { type: "small", style: _Style2.default.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }];
  6847.  
  6848. // Delimiters that always stack try the small delimiters first, then stack
  6849. var stackAlwaysDelimiterSequence = [{ type: "small", style: _Style2.default.SCRIPTSCRIPT }, { type: "small", style: _Style2.default.SCRIPT }, { type: "small", style: _Style2.default.TEXT }, { type: "stack" }];
  6850.  
  6851. // Delimiters that stack when large try the small and then large delimiters, and
  6852. // stack afterwards
  6853. var stackLargeDelimiterSequence = [{ type: "small", style: _Style2.default.SCRIPTSCRIPT }, { type: "small", style: _Style2.default.SCRIPT }, { type: "small", style: _Style2.default.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }, { type: "stack" }];
  6854.  
  6855. /**
  6856. * Get the font used in a delimiter based on what kind of delimiter it is.
  6857. */
  6858. var delimTypeToFont = function delimTypeToFont(type) {
  6859. if (type.type === "small") {
  6860. return "Main-Regular";
  6861. } else if (type.type === "large") {
  6862. return "Size" + type.size + "-Regular";
  6863. } else if (type.type === "stack") {
  6864. return "Size4-Regular";
  6865. }
  6866. };
  6867.  
  6868. /**
  6869. * Traverse a sequence of types of delimiters to decide what kind of delimiter
  6870. * should be used to create a delimiter of the given height+depth.
  6871. */
  6872. var traverseSequence = function traverseSequence(delim, height, sequence, options) {
  6873. // Here, we choose the index we should start at in the sequences. In smaller
  6874. // sizes (which correspond to larger numbers in style.size) we start earlier
  6875. // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts
  6876. // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2
  6877. var start = Math.min(2, 3 - options.style.size);
  6878. for (var i = start; i < sequence.length; i++) {
  6879. if (sequence[i].type === "stack") {
  6880. // This is always the last delimiter, so we just break the loop now.
  6881. break;
  6882. }
  6883.  
  6884. var metrics = getMetrics(delim, delimTypeToFont(sequence[i]));
  6885. var heightDepth = metrics.height + metrics.depth;
  6886.  
  6887. // Small delimiters are scaled down versions of the same font, so we
  6888. // account for the style change size.
  6889.  
  6890. if (sequence[i].type === "small") {
  6891. var newOptions = options.havingBaseStyle(sequence[i].style);
  6892. heightDepth *= newOptions.sizeMultiplier;
  6893. }
  6894.  
  6895. // Check if the delimiter at this size works for the given height.
  6896. if (heightDepth > height) {
  6897. return sequence[i];
  6898. }
  6899. }
  6900.  
  6901. // If we reached the end of the sequence, return the last sequence element.
  6902. return sequence[sequence.length - 1];
  6903. };
  6904.  
  6905. /**
  6906. * Make a delimiter of a given height+depth, with optional centering. Here, we
  6907. * traverse the sequences, and create a delimiter that the sequence tells us to.
  6908. */
  6909. var makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) {
  6910. if (delim === "<" || delim === "\\lt") {
  6911. delim = "\\langle";
  6912. } else if (delim === ">" || delim === "\\gt") {
  6913. delim = "\\rangle";
  6914. }
  6915.  
  6916. // Decide what sequence to use
  6917. var sequence = void 0;
  6918. if (_utils2.default.contains(stackNeverDelimiters, delim)) {
  6919. sequence = stackNeverDelimiterSequence;
  6920. } else if (_utils2.default.contains(stackLargeDelimiters, delim)) {
  6921. sequence = stackLargeDelimiterSequence;
  6922. } else {
  6923. sequence = stackAlwaysDelimiterSequence;
  6924. }
  6925.  
  6926. // Look through the sequence
  6927. var delimType = traverseSequence(delim, height, sequence, options);
  6928.  
  6929. if (delim === "\\surd") {
  6930. // Get an SVG image
  6931. return sqrtSpan(height, delimType, options);
  6932. } else {
  6933. // Get the delimiter from font glyphs.
  6934. // Depending on the sequence element we decided on, call the
  6935. // appropriate function.
  6936. if (delimType.type === "small") {
  6937. return makeSmallDelim(delim, delimType.style, center, options, mode, classes);
  6938. } else if (delimType.type === "large") {
  6939. return makeLargeDelim(delim, delimType.size, center, options, mode, classes);
  6940. } else if (delimType.type === "stack") {
  6941. return makeStackedDelim(delim, height, center, options, mode, classes);
  6942. }
  6943. }
  6944. };
  6945.  
  6946. /**
  6947. * Make a delimiter for use with `\left` and `\right`, given a height and depth
  6948. * of an expression that the delimiters surround.
  6949. */
  6950. var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) {
  6951. // We always center \left/\right delimiters, so the axis is always shifted
  6952. var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier;
  6953.  
  6954. // Taken from TeX source, tex.web, function make_left_right
  6955. var delimiterFactor = 901;
  6956. var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm;
  6957.  
  6958. var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight);
  6959.  
  6960. var totalHeight = Math.max(
  6961. // In real TeX, calculations are done using integral values which are
  6962. // 65536 per pt, or 655360 per em. So, the division here truncates in
  6963. // TeX but doesn't here, producing different results. If we wanted to
  6964. // exactly match TeX's calculation, we could do
  6965. // Math.floor(655360 * maxDistFromAxis / 500) *
  6966. // delimiterFactor / 655360
  6967. // (To see the difference, compare
  6968. // x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
  6969. // in TeX and KaTeX)
  6970. maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend);
  6971.  
  6972. // Finally, we defer to `makeCustomSizedDelim` with our calculated total
  6973. // height
  6974. return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);
  6975. };
  6976.  
  6977. exports.default = {
  6978. sizedDelim: makeSizedDelim,
  6979. customSizedDelim: makeCustomSizedDelim,
  6980. leftRightDelim: makeLeftRightDelim
  6981. };
  6982.  
  6983. },{"./ParseError":84,"./Style":89,"./buildCommon":91,"./domTree":98,"./fontMetrics":101,"./symbols":112,"./utils":115}],98:[function(require,module,exports){
  6984. "use strict";
  6985.  
  6986. Object.defineProperty(exports, "__esModule", {
  6987. value: true
  6988. });
  6989.  
  6990. var _slicedToArray2 = require("babel-runtime/helpers/slicedToArray");
  6991.  
  6992. var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
  6993.  
  6994. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  6995.  
  6996. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  6997.  
  6998. var _createClass2 = require("babel-runtime/helpers/createClass");
  6999.  
  7000. var _createClass3 = _interopRequireDefault(_createClass2);
  7001.  
  7002. var _unicodeRegexes = require("./unicodeRegexes");
  7003.  
  7004. var _utils = require("./utils");
  7005.  
  7006. var _utils2 = _interopRequireDefault(_utils);
  7007.  
  7008. var _svgGeometry = require("./svgGeometry");
  7009.  
  7010. var _svgGeometry2 = _interopRequireDefault(_svgGeometry);
  7011.  
  7012. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7013.  
  7014. /**
  7015. * Create an HTML className based on a list of classes. In addition to joining
  7016. * with spaces, we also remove null or empty classes.
  7017. */
  7018. var createClass = function createClass(classes) {
  7019. classes = classes.slice();
  7020. for (var i = classes.length - 1; i >= 0; i--) {
  7021. if (!classes[i]) {
  7022. classes.splice(i, 1);
  7023. }
  7024. }
  7025.  
  7026. return classes.join(" ");
  7027. };
  7028.  
  7029. /**
  7030. * This node represents a span node, with a className, a list of children, and
  7031. * an inline style. It also contains information about its height, depth, and
  7032. * maxFontSize.
  7033. */
  7034. /**
  7035. * These objects store the data about the DOM nodes we create, as well as some
  7036. * extra data. They can then be transformed into real DOM nodes with the
  7037. * `toNode` function or HTML markup using `toMarkup`. They are useful for both
  7038. * storing extra properties on the nodes, as well as providing a way to easily
  7039. * work with the DOM.
  7040. *
  7041. * Similar functions for working with MathML nodes exist in mathMLTree.js.
  7042. */
  7043.  
  7044. var span = function () {
  7045. function span(classes, children, options) {
  7046. (0, _classCallCheck3.default)(this, span);
  7047.  
  7048. this.classes = classes || [];
  7049. this.children = children || [];
  7050. this.height = 0;
  7051. this.depth = 0;
  7052. this.maxFontSize = 0;
  7053. this.style = {};
  7054. this.attributes = {};
  7055. if (options) {
  7056. if (options.style.isTight()) {
  7057. this.classes.push("mtight");
  7058. }
  7059. if (options.getColor()) {
  7060. this.style.color = options.getColor();
  7061. }
  7062. }
  7063. }
  7064.  
  7065. /**
  7066. * Sets an arbitrary attribute on the span. Warning: use this wisely. Not all
  7067. * browsers support attributes the same, and having too many custom attributes
  7068. * is probably bad.
  7069. */
  7070.  
  7071.  
  7072. (0, _createClass3.default)(span, [{
  7073. key: "setAttribute",
  7074. value: function setAttribute(attribute, value) {
  7075. this.attributes[attribute] = value;
  7076. }
  7077. }, {
  7078. key: "tryCombine",
  7079. value: function tryCombine(sibling) {
  7080. return false;
  7081. }
  7082.  
  7083. /**
  7084. * Convert the span into an HTML node
  7085. */
  7086.  
  7087. }, {
  7088. key: "toNode",
  7089. value: function toNode() {
  7090. var span = document.createElement("span");
  7091.  
  7092. // Apply the class
  7093. span.className = createClass(this.classes);
  7094.  
  7095. // Apply inline styles
  7096. for (var style in this.style) {
  7097. if (Object.prototype.hasOwnProperty.call(this.style, style)) {
  7098. span.style[style] = this.style[style];
  7099. }
  7100. }
  7101.  
  7102. // Apply attributes
  7103. for (var attr in this.attributes) {
  7104. if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
  7105. span.setAttribute(attr, this.attributes[attr]);
  7106. }
  7107. }
  7108.  
  7109. // Append the children, also as HTML nodes
  7110. for (var i = 0; i < this.children.length; i++) {
  7111. span.appendChild(this.children[i].toNode());
  7112. }
  7113.  
  7114. return span;
  7115. }
  7116.  
  7117. /**
  7118. * Convert the span into an HTML markup string
  7119. */
  7120.  
  7121. }, {
  7122. key: "toMarkup",
  7123. value: function toMarkup() {
  7124. var markup = "<span";
  7125.  
  7126. // Add the class
  7127. if (this.classes.length) {
  7128. markup += " class=\"";
  7129. markup += _utils2.default.escape(createClass(this.classes));
  7130. markup += "\"";
  7131. }
  7132.  
  7133. var styles = "";
  7134.  
  7135. // Add the styles, after hyphenation
  7136. for (var style in this.style) {
  7137. if (this.style.hasOwnProperty(style)) {
  7138. styles += _utils2.default.hyphenate(style) + ":" + this.style[style] + ";";
  7139. }
  7140. }
  7141.  
  7142. if (styles) {
  7143. markup += " style=\"" + _utils2.default.escape(styles) + "\"";
  7144. }
  7145.  
  7146. // Add the attributes
  7147. for (var attr in this.attributes) {
  7148. if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
  7149. markup += " " + attr + "=\"";
  7150. markup += _utils2.default.escape(this.attributes[attr]);
  7151. markup += "\"";
  7152. }
  7153. }
  7154.  
  7155. markup += ">";
  7156.  
  7157. // Add the markup of the children, also as markup
  7158. for (var i = 0; i < this.children.length; i++) {
  7159. markup += this.children[i].toMarkup();
  7160. }
  7161.  
  7162. markup += "</span>";
  7163.  
  7164. return markup;
  7165. }
  7166. }]);
  7167. return span;
  7168. }();
  7169.  
  7170. /**
  7171. * This node represents a document fragment, which contains elements, but when
  7172. * placed into the DOM doesn't have any representation itself. Thus, it only
  7173. * contains children and doesn't have any HTML properties. It also keeps track
  7174. * of a height, depth, and maxFontSize.
  7175. */
  7176.  
  7177.  
  7178. var documentFragment = function () {
  7179. function documentFragment(children) {
  7180. (0, _classCallCheck3.default)(this, documentFragment);
  7181.  
  7182. this.children = children || [];
  7183. this.height = 0;
  7184. this.depth = 0;
  7185. this.maxFontSize = 0;
  7186. }
  7187.  
  7188. /**
  7189. * Convert the fragment into a node
  7190. */
  7191.  
  7192.  
  7193. (0, _createClass3.default)(documentFragment, [{
  7194. key: "toNode",
  7195. value: function toNode() {
  7196. // Create a fragment
  7197. var frag = document.createDocumentFragment();
  7198.  
  7199. // Append the children
  7200. for (var i = 0; i < this.children.length; i++) {
  7201. frag.appendChild(this.children[i].toNode());
  7202. }
  7203.  
  7204. return frag;
  7205. }
  7206.  
  7207. /**
  7208. * Convert the fragment into HTML markup
  7209. */
  7210.  
  7211. }, {
  7212. key: "toMarkup",
  7213. value: function toMarkup() {
  7214. var markup = "";
  7215.  
  7216. // Simply concatenate the markup for the children together
  7217. for (var i = 0; i < this.children.length; i++) {
  7218. markup += this.children[i].toMarkup();
  7219. }
  7220.  
  7221. return markup;
  7222. }
  7223. }]);
  7224. return documentFragment;
  7225. }();
  7226.  
  7227. var iCombinations = {
  7228. 'î': "\u0131\u0302",
  7229. 'ï': "\u0131\u0308",
  7230. 'í': "\u0131\u0301",
  7231. // 'ī': '\u0131\u0304', // enable when we add Extended Latin
  7232. 'ì': "\u0131\u0300"
  7233. };
  7234.  
  7235. /**
  7236. * A symbol node contains information about a single symbol. It either renders
  7237. * to a single text node, or a span with a single text node in it, depending on
  7238. * whether it has CSS classes, styles, or needs italic correction.
  7239. */
  7240.  
  7241. var symbolNode = function () {
  7242. function symbolNode(value, height, depth, italic, skew, classes, style) {
  7243. (0, _classCallCheck3.default)(this, symbolNode);
  7244.  
  7245. this.value = value || "";
  7246. this.height = height || 0;
  7247. this.depth = depth || 0;
  7248. this.italic = italic || 0;
  7249. this.skew = skew || 0;
  7250. this.classes = classes || [];
  7251. this.style = style || {};
  7252. this.maxFontSize = 0;
  7253.  
  7254. // Mark CJK characters with specific classes so that we can specify which
  7255. // fonts to use. This allows us to render these characters with a serif
  7256. // font in situations where the browser would either default to a sans serif
  7257. // or render a placeholder character.
  7258. if (_unicodeRegexes.cjkRegex.test(value)) {
  7259. // I couldn't find any fonts that contained Hangul as well as all of
  7260. // the other characters we wanted to test there for it gets its own
  7261. // CSS class.
  7262. if (_unicodeRegexes.hangulRegex.test(value)) {
  7263. this.classes.push('hangul_fallback');
  7264. } else {
  7265. this.classes.push('cjk_fallback');
  7266. }
  7267. }
  7268.  
  7269. if (/[îïíì]/.test(this.value)) {
  7270. // add ī when we add Extended Latin
  7271. this.value = iCombinations[this.value];
  7272. }
  7273. }
  7274.  
  7275. (0, _createClass3.default)(symbolNode, [{
  7276. key: "tryCombine",
  7277. value: function tryCombine(sibling) {
  7278. if (!sibling || !(sibling instanceof symbolNode) || this.italic > 0 || createClass(this.classes) !== createClass(sibling.classes) || this.skew !== sibling.skew || this.maxFontSize !== sibling.maxFontSize) {
  7279. return false;
  7280. }
  7281. for (var style in this.style) {
  7282. if (this.style.hasOwnProperty(style) && this.style[style] !== sibling.style[style]) {
  7283. return false;
  7284. }
  7285. }
  7286. for (var _style in sibling.style) {
  7287. if (sibling.style.hasOwnProperty(_style) && this.style[_style] !== sibling.style[_style]) {
  7288. return false;
  7289. }
  7290. }
  7291. this.value += sibling.value;
  7292. this.height = Math.max(this.height, sibling.height);
  7293. this.depth = Math.max(this.depth, sibling.depth);
  7294. this.italic = sibling.italic;
  7295. return true;
  7296. }
  7297.  
  7298. /**
  7299. * Creates a text node or span from a symbol node. Note that a span is only
  7300. * created if it is needed.
  7301. */
  7302.  
  7303. }, {
  7304. key: "toNode",
  7305. value: function toNode() {
  7306. var node = document.createTextNode(this.value);
  7307. var span = null;
  7308.  
  7309. if (this.italic > 0) {
  7310. span = document.createElement("span");
  7311. span.style.marginRight = this.italic + "em";
  7312. }
  7313.  
  7314. if (this.classes.length > 0) {
  7315. span = span || document.createElement("span");
  7316. span.className = createClass(this.classes);
  7317. }
  7318.  
  7319. for (var style in this.style) {
  7320. if (this.style.hasOwnProperty(style)) {
  7321. span = span || document.createElement("span");
  7322. span.style[style] = this.style[style];
  7323. }
  7324. }
  7325.  
  7326. if (span) {
  7327. span.appendChild(node);
  7328. return span;
  7329. } else {
  7330. return node;
  7331. }
  7332. }
  7333.  
  7334. /**
  7335. * Creates markup for a symbol node.
  7336. */
  7337.  
  7338. }, {
  7339. key: "toMarkup",
  7340. value: function toMarkup() {
  7341. // TODO(alpert): More duplication than I'd like from
  7342. // span.prototype.toMarkup and symbolNode.prototype.toNode...
  7343. var needsSpan = false;
  7344.  
  7345. var markup = "<span";
  7346.  
  7347. if (this.classes.length) {
  7348. needsSpan = true;
  7349. markup += " class=\"";
  7350. markup += _utils2.default.escape(createClass(this.classes));
  7351. markup += "\"";
  7352. }
  7353.  
  7354. var styles = "";
  7355.  
  7356. if (this.italic > 0) {
  7357. styles += "margin-right:" + this.italic + "em;";
  7358. }
  7359. for (var style in this.style) {
  7360. if (this.style.hasOwnProperty(style)) {
  7361. styles += _utils2.default.hyphenate(style) + ":" + this.style[style] + ";";
  7362. }
  7363. }
  7364.  
  7365. if (styles) {
  7366. needsSpan = true;
  7367. markup += " style=\"" + _utils2.default.escape(styles) + "\"";
  7368. }
  7369.  
  7370. var escaped = _utils2.default.escape(this.value);
  7371. if (needsSpan) {
  7372. markup += ">";
  7373. markup += escaped;
  7374. markup += "</span>";
  7375. return markup;
  7376. } else {
  7377. return escaped;
  7378. }
  7379. }
  7380. }]);
  7381. return symbolNode;
  7382. }();
  7383.  
  7384. /**
  7385. * SVG nodes are used to render stretchy wide elements.
  7386. */
  7387.  
  7388.  
  7389. var svgNode = function () {
  7390. function svgNode(children, attributes) {
  7391. (0, _classCallCheck3.default)(this, svgNode);
  7392.  
  7393. this.children = children || [];
  7394. this.attributes = attributes || [];
  7395. }
  7396.  
  7397. (0, _createClass3.default)(svgNode, [{
  7398. key: "toNode",
  7399. value: function toNode() {
  7400. var svgNS = "http://www.w3.org/2000/svg";
  7401. var node = document.createElementNS(svgNS, "svg");
  7402.  
  7403. // Apply attributes
  7404. for (var i = 0; i < this.attributes.length; i++) {
  7405. var _attributes$i = (0, _slicedToArray3.default)(this.attributes[i], 2),
  7406. name = _attributes$i[0],
  7407. value = _attributes$i[1];
  7408.  
  7409. node.setAttribute(name, value);
  7410. }
  7411.  
  7412. for (var _i = 0; _i < this.children.length; _i++) {
  7413. node.appendChild(this.children[_i].toNode());
  7414. }
  7415. return node;
  7416. }
  7417. }, {
  7418. key: "toMarkup",
  7419. value: function toMarkup() {
  7420. var markup = "<svg";
  7421.  
  7422. // Apply attributes
  7423. for (var i = 0; i < this.attributes.length; i++) {
  7424. var _attributes$i2 = (0, _slicedToArray3.default)(this.attributes[i], 2),
  7425. name = _attributes$i2[0],
  7426. value = _attributes$i2[1];
  7427.  
  7428. markup += " " + name + "='" + value + "'";
  7429. }
  7430.  
  7431. markup += ">";
  7432.  
  7433. for (var _i2 = 0; _i2 < this.children.length; _i2++) {
  7434. markup += this.children[_i2].toMarkup();
  7435. }
  7436.  
  7437. markup += "</svg>";
  7438.  
  7439. return markup;
  7440. }
  7441. }]);
  7442. return svgNode;
  7443. }();
  7444.  
  7445. var pathNode = function () {
  7446. function pathNode(pathName, alternate) {
  7447. (0, _classCallCheck3.default)(this, pathNode);
  7448.  
  7449. this.pathName = pathName;
  7450. this.alternate = alternate; // Used only for tall \sqrt
  7451. }
  7452.  
  7453. (0, _createClass3.default)(pathNode, [{
  7454. key: "toNode",
  7455. value: function toNode() {
  7456. var svgNS = "http://www.w3.org/2000/svg";
  7457. var node = document.createElementNS(svgNS, "path");
  7458.  
  7459. if (this.pathName !== "sqrtTall") {
  7460. node.setAttribute("d", _svgGeometry2.default.path[this.pathName]);
  7461. } else {
  7462. node.setAttribute("d", this.alternate);
  7463. }
  7464.  
  7465. return node;
  7466. }
  7467. }, {
  7468. key: "toMarkup",
  7469. value: function toMarkup() {
  7470. if (this.pathName !== "sqrtTall") {
  7471. return "<path d='" + _svgGeometry2.default.path[this.pathName] + "'/>";
  7472. } else {
  7473. return "<path d='" + this.alternate + "'/>";
  7474. }
  7475. }
  7476. }]);
  7477. return pathNode;
  7478. }();
  7479.  
  7480. var lineNode = function () {
  7481. function lineNode(attributes) {
  7482. (0, _classCallCheck3.default)(this, lineNode);
  7483.  
  7484. this.attributes = attributes || [];
  7485. }
  7486.  
  7487. (0, _createClass3.default)(lineNode, [{
  7488. key: "toNode",
  7489. value: function toNode() {
  7490. var svgNS = "http://www.w3.org/2000/svg";
  7491. var node = document.createElementNS(svgNS, "line");
  7492.  
  7493. // Apply attributes
  7494. for (var i = 0; i < this.attributes.length; i++) {
  7495. var _attributes$i3 = (0, _slicedToArray3.default)(this.attributes[i], 2),
  7496. name = _attributes$i3[0],
  7497. value = _attributes$i3[1];
  7498.  
  7499. node.setAttribute(name, value);
  7500. }
  7501.  
  7502. return node;
  7503. }
  7504. }, {
  7505. key: "toMarkup",
  7506. value: function toMarkup() {
  7507. var markup = "<line";
  7508.  
  7509. for (var i = 0; i < this.attributes.length; i++) {
  7510. var _attributes$i4 = (0, _slicedToArray3.default)(this.attributes[i], 2),
  7511. name = _attributes$i4[0],
  7512. value = _attributes$i4[1];
  7513.  
  7514. markup += " " + name + "='" + value + "'";
  7515. }
  7516.  
  7517. markup += "/>";
  7518.  
  7519. return markup;
  7520. }
  7521. }]);
  7522. return lineNode;
  7523. }();
  7524.  
  7525. exports.default = {
  7526. span: span,
  7527. documentFragment: documentFragment,
  7528. symbolNode: symbolNode,
  7529. svgNode: svgNode,
  7530. pathNode: pathNode,
  7531. lineNode: lineNode
  7532. };
  7533.  
  7534. },{"./svgGeometry":111,"./unicodeRegexes":113,"./utils":115,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9,"babel-runtime/helpers/slicedToArray":10}],99:[function(require,module,exports){
  7535. "use strict";
  7536.  
  7537. Object.defineProperty(exports, "__esModule", {
  7538. value: true
  7539. });
  7540.  
  7541. var _defineEnvironment = require("./defineEnvironment");
  7542.  
  7543. require("./environments/array.js");
  7544.  
  7545. var environments = {
  7546. has: function has(envName) {
  7547. return _defineEnvironment._environments.hasOwnProperty(envName);
  7548. },
  7549. get: function get(envName) {
  7550. return _defineEnvironment._environments[envName];
  7551. }
  7552. };
  7553. exports.default = environments;
  7554.  
  7555. // All environment definitions should be imported below
  7556.  
  7557. },{"./defineEnvironment":95,"./environments/array.js":100}],100:[function(require,module,exports){
  7558. "use strict";
  7559.  
  7560. var _buildCommon = require("../buildCommon");
  7561.  
  7562. var _buildCommon2 = _interopRequireDefault(_buildCommon);
  7563.  
  7564. var _defineEnvironment = require("../defineEnvironment");
  7565.  
  7566. var _defineEnvironment2 = _interopRequireDefault(_defineEnvironment);
  7567.  
  7568. var _mathMLTree = require("../mathMLTree");
  7569.  
  7570. var _mathMLTree2 = _interopRequireDefault(_mathMLTree);
  7571.  
  7572. var _ParseError = require("../ParseError");
  7573.  
  7574. var _ParseError2 = _interopRequireDefault(_ParseError);
  7575.  
  7576. var _ParseNode = require("../ParseNode");
  7577.  
  7578. var _ParseNode2 = _interopRequireDefault(_ParseNode);
  7579.  
  7580. var _units = require("../units");
  7581.  
  7582. var _utils = require("../utils");
  7583.  
  7584. var _utils2 = _interopRequireDefault(_utils);
  7585.  
  7586. var _buildHTML = require("../buildHTML");
  7587.  
  7588. var html = _interopRequireWildcard(_buildHTML);
  7589.  
  7590. var _buildMathML = require("../buildMathML");
  7591.  
  7592. var mml = _interopRequireWildcard(_buildMathML);
  7593.  
  7594. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7595.  
  7596. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7597.  
  7598. /**
  7599. * Parse the body of the environment, with rows delimited by \\ and
  7600. * columns delimited by &, and create a nested list in row-major order
  7601. * with one group per cell. If given an optional argument style
  7602. * ("text", "display", etc.), then each cell is cast into that style.
  7603. */
  7604.  
  7605.  
  7606. // Data stored in the ParseNode associated with the environment.
  7607. function parseArray(parser, result, style) {
  7608. var row = [];
  7609. var body = [row];
  7610. var rowGaps = [];
  7611. while (true) {
  7612. // eslint-disable-line no-constant-condition
  7613. var cell = parser.parseExpression(false, null);
  7614. cell = new _ParseNode2.default("ordgroup", cell, parser.mode);
  7615. if (style) {
  7616. cell = new _ParseNode2.default("styling", {
  7617. style: style,
  7618. value: [cell]
  7619. }, parser.mode);
  7620. }
  7621. row.push(cell);
  7622. var next = parser.nextToken.text;
  7623. if (next === "&") {
  7624. parser.consume();
  7625. } else if (next === "\\end") {
  7626. // Arrays terminate newlines with `\crcr` which consumes a `\cr` if
  7627. // the last line is empty.
  7628. var lastRow = body[body.length - 1][0].value;
  7629. if (body.length > 1 && lastRow.value.length === 1 && lastRow.value[0].value.length === 0) {
  7630. body.pop();
  7631. }
  7632. break;
  7633. } else if (next === "\\\\" || next === "\\cr") {
  7634. var cr = parser.parseFunction();
  7635. rowGaps.push(cr.value.size);
  7636. row = [];
  7637. body.push(row);
  7638. } else {
  7639. throw new _ParseError2.default("Expected & or \\\\ or \\end", parser.nextToken);
  7640. }
  7641. }
  7642. result.body = body;
  7643. result.rowGaps = rowGaps;
  7644. return new _ParseNode2.default(result.type, result, parser.mode);
  7645. }
  7646.  
  7647. // Decides on a style for cells in an array according to whether the given
  7648. // environment name starts with the letter 'd'.
  7649.  
  7650. function dCellStyle(envName) {
  7651. if (envName.substr(0, 1) === "d") {
  7652. return "display";
  7653. } else {
  7654. return "text";
  7655. }
  7656. }
  7657.  
  7658. var htmlBuilder = function htmlBuilder(group, options) {
  7659. var r = void 0;
  7660. var c = void 0;
  7661. var nr = group.value.body.length;
  7662. var nc = 0;
  7663. var body = new Array(nr);
  7664.  
  7665. // Horizontal spacing
  7666. var pt = 1 / options.fontMetrics().ptPerEm;
  7667. var arraycolsep = 5 * pt; // \arraycolsep in article.cls
  7668.  
  7669. // Vertical spacing
  7670. var baselineskip = 12 * pt; // see size10.clo
  7671. // Default \jot from ltmath.dtx
  7672. // TODO(edemaine): allow overriding \jot via \setlength (#687)
  7673. var jot = 3 * pt;
  7674. // Default \arraystretch from lttab.dtx
  7675. // TODO(gagern): may get redefined once we have user-defined macros
  7676. var arraystretch = _utils2.default.deflt(group.value.arraystretch, 1);
  7677. var arrayskip = arraystretch * baselineskip;
  7678. var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and
  7679. var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx
  7680.  
  7681. var totalHeight = 0;
  7682. for (r = 0; r < group.value.body.length; ++r) {
  7683. var inrow = group.value.body[r];
  7684. var _height = arstrutHeight; // \@array adds an \@arstrut
  7685. var _depth = arstrutDepth; // to each tow (via the template)
  7686.  
  7687. if (nc < inrow.length) {
  7688. nc = inrow.length;
  7689. }
  7690.  
  7691. var outrow = new Array(inrow.length);
  7692. for (c = 0; c < inrow.length; ++c) {
  7693. var elt = html.buildGroup(inrow[c], options);
  7694. if (_depth < elt.depth) {
  7695. _depth = elt.depth;
  7696. }
  7697. if (_height < elt.height) {
  7698. _height = elt.height;
  7699. }
  7700. outrow[c] = elt;
  7701. }
  7702.  
  7703. var gap = 0;
  7704. if (group.value.rowGaps[r]) {
  7705. gap = (0, _units.calculateSize)(group.value.rowGaps[r].value, options);
  7706. if (gap > 0) {
  7707. // \@argarraycr
  7708. gap += arstrutDepth;
  7709. if (_depth < gap) {
  7710. _depth = gap; // \@xargarraycr
  7711. }
  7712. gap = 0;
  7713. }
  7714. }
  7715. // In AMS multiline environments such as aligned and gathered, rows
  7716. // correspond to lines that have additional \jot added to the
  7717. // \baselineskip via \openup.
  7718. if (group.value.addJot) {
  7719. _depth += jot;
  7720. }
  7721.  
  7722. outrow.height = _height;
  7723. outrow.depth = _depth;
  7724. totalHeight += _height;
  7725. outrow.pos = totalHeight;
  7726. totalHeight += _depth + gap; // \@yargarraycr
  7727. body[r] = outrow;
  7728. }
  7729.  
  7730. var offset = totalHeight / 2 + options.fontMetrics().axisHeight;
  7731. var colDescriptions = group.value.cols || [];
  7732. var cols = [];
  7733. var colSep = void 0;
  7734. var colDescrNum = void 0;
  7735. for (c = 0, colDescrNum = 0;
  7736. // Continue while either there are more columns or more column
  7737. // descriptions, so trailing separators don't get lost.
  7738. c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) {
  7739.  
  7740. var colDescr = colDescriptions[colDescrNum] || {};
  7741.  
  7742. var firstSeparator = true;
  7743. while (colDescr.type === "separator") {
  7744. // If there is more than one separator in a row, add a space
  7745. // between them.
  7746. if (!firstSeparator) {
  7747. colSep = _buildCommon2.default.makeSpan(["arraycolsep"], []);
  7748. colSep.style.width = options.fontMetrics().doubleRuleSep + "em";
  7749. cols.push(colSep);
  7750. }
  7751.  
  7752. if (colDescr.separator === "|") {
  7753. var _separator = _buildCommon2.default.makeSpan(["vertical-separator"], []);
  7754. _separator.style.height = totalHeight + "em";
  7755. _separator.style.verticalAlign = -(totalHeight - offset) + "em";
  7756.  
  7757. cols.push(_separator);
  7758. } else {
  7759. throw new _ParseError2.default("Invalid separator type: " + colDescr.separator);
  7760. }
  7761.  
  7762. colDescrNum++;
  7763. colDescr = colDescriptions[colDescrNum] || {};
  7764. firstSeparator = false;
  7765. }
  7766.  
  7767. if (c >= nc) {
  7768. continue;
  7769. }
  7770.  
  7771. var sepwidth = void 0;
  7772. if (c > 0 || group.value.hskipBeforeAndAfter) {
  7773. sepwidth = _utils2.default.deflt(colDescr.pregap, arraycolsep);
  7774. if (sepwidth !== 0) {
  7775. colSep = _buildCommon2.default.makeSpan(["arraycolsep"], []);
  7776. colSep.style.width = sepwidth + "em";
  7777. cols.push(colSep);
  7778. }
  7779. }
  7780.  
  7781. var col = [];
  7782. for (r = 0; r < nr; ++r) {
  7783. var row = body[r];
  7784. var elem = row[c];
  7785. if (!elem) {
  7786. continue;
  7787. }
  7788. var shift = row.pos - offset;
  7789. elem.depth = row.depth;
  7790. elem.height = row.height;
  7791. col.push({ type: "elem", elem: elem, shift: shift });
  7792. }
  7793.  
  7794. col = _buildCommon2.default.makeVList(col, "individualShift", null, options);
  7795. col = _buildCommon2.default.makeSpan(["col-align-" + (colDescr.align || "c")], [col]);
  7796. cols.push(col);
  7797.  
  7798. if (c < nc - 1 || group.value.hskipBeforeAndAfter) {
  7799. sepwidth = _utils2.default.deflt(colDescr.postgap, arraycolsep);
  7800. if (sepwidth !== 0) {
  7801. colSep = _buildCommon2.default.makeSpan(["arraycolsep"], []);
  7802. colSep.style.width = sepwidth + "em";
  7803. cols.push(colSep);
  7804. }
  7805. }
  7806. }
  7807. body = _buildCommon2.default.makeSpan(["mtable"], cols);
  7808. return _buildCommon2.default.makeSpan(["mord"], [body], options);
  7809. };
  7810.  
  7811. var mathmlBuilder = function mathmlBuilder(group, options) {
  7812. return new _mathMLTree2.default.MathNode("mtable", group.value.body.map(function (row) {
  7813. return new _mathMLTree2.default.MathNode("mtr", row.map(function (cell) {
  7814. return new _mathMLTree2.default.MathNode("mtd", [mml.buildGroup(cell, options)]);
  7815. }));
  7816. }));
  7817. };
  7818.  
  7819. // Arrays are part of LaTeX, defined in lttab.dtx so its documentation
  7820. // is part of the source2e.pdf file of LaTeX2e source documentation.
  7821. // {darray} is an {array} environment where cells are set in \displaystyle,
  7822. // as defined in nccmath.sty.
  7823. (0, _defineEnvironment2.default)({
  7824. type: "array",
  7825. names: ["array", "darray"],
  7826. props: {
  7827. numArgs: 1
  7828. },
  7829. handler: function handler(context, args) {
  7830. var colalign = args[0];
  7831. colalign = colalign.value.map ? colalign.value : [colalign];
  7832. var cols = colalign.map(function (node) {
  7833. var ca = node.value;
  7834. if ("lcr".indexOf(ca) !== -1) {
  7835. return {
  7836. type: "align",
  7837. align: ca
  7838. };
  7839. } else if (ca === "|") {
  7840. return {
  7841. type: "separator",
  7842. separator: "|"
  7843. };
  7844. }
  7845. throw new _ParseError2.default("Unknown column alignment: " + node.value, node);
  7846. });
  7847. var res = {
  7848. type: "array",
  7849. cols: cols,
  7850. hskipBeforeAndAfter: true // \@preamble in lttab.dtx
  7851. };
  7852. res = parseArray(context.parser, res, dCellStyle(context.envName));
  7853. return res;
  7854. },
  7855. htmlBuilder: htmlBuilder,
  7856. mathmlBuilder: mathmlBuilder
  7857. });
  7858.  
  7859. // The matrix environments of amsmath builds on the array environment
  7860. // of LaTeX, which is discussed above.
  7861. (0, _defineEnvironment2.default)({
  7862. type: "array",
  7863. names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"],
  7864. props: {
  7865. numArgs: 0
  7866. },
  7867. handler: function handler(context) {
  7868. var delimiters = {
  7869. "matrix": null,
  7870. "pmatrix": ["(", ")"],
  7871. "bmatrix": ["[", "]"],
  7872. "Bmatrix": ["\\{", "\\}"],
  7873. "vmatrix": ["|", "|"],
  7874. "Vmatrix": ["\\Vert", "\\Vert"]
  7875. }[context.envName];
  7876. var res = {
  7877. type: "array",
  7878. hskipBeforeAndAfter: false // \hskip -\arraycolsep in amsmath
  7879. };
  7880. res = parseArray(context.parser, res, dCellStyle(context.envName));
  7881. if (delimiters) {
  7882. res = new _ParseNode2.default("leftright", {
  7883. body: [res],
  7884. left: delimiters[0],
  7885. right: delimiters[1]
  7886. }, context.mode);
  7887. }
  7888. return res;
  7889. },
  7890. htmlBuilder: htmlBuilder,
  7891. mathmlBuilder: mathmlBuilder
  7892. });
  7893.  
  7894. // A cases environment (in amsmath.sty) is almost equivalent to
  7895. // \def\arraystretch{1.2}%
  7896. // \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right.
  7897. // {dcases} is a {cases} environment where cells are set in \displaystyle,
  7898. // as defined in mathtools.sty.
  7899. (0, _defineEnvironment2.default)({
  7900. type: "array",
  7901. names: ["cases", "dcases"],
  7902. props: {
  7903. numArgs: 0
  7904. },
  7905. handler: function handler(context) {
  7906. var res = {
  7907. type: "array",
  7908. arraystretch: 1.2,
  7909. cols: [{
  7910. type: "align",
  7911. align: "l",
  7912. pregap: 0,
  7913. // TODO(kevinb) get the current style.
  7914. // For now we use the metrics for TEXT style which is what we were
  7915. // doing before. Before attempting to get the current style we
  7916. // should look at TeX's behavior especially for \over and matrices.
  7917. postgap: 1.0 /* 1em quad */
  7918. }, {
  7919. type: "align",
  7920. align: "l",
  7921. pregap: 0,
  7922. postgap: 0
  7923. }]
  7924. };
  7925. res = parseArray(context.parser, res, dCellStyle(context.envName));
  7926. res = new _ParseNode2.default("leftright", {
  7927. body: [res],
  7928. left: "\\{",
  7929. right: "."
  7930. }, context.mode);
  7931. return res;
  7932. },
  7933. htmlBuilder: htmlBuilder,
  7934. mathmlBuilder: mathmlBuilder
  7935. });
  7936.  
  7937. // An aligned environment is like the align* environment
  7938. // except it operates within math mode.
  7939. // Note that we assume \nomallineskiplimit to be zero,
  7940. // so that \strut@ is the same as \strut.
  7941. (0, _defineEnvironment2.default)({
  7942. type: "array",
  7943. names: ["aligned"],
  7944. props: {
  7945. numArgs: 0
  7946. },
  7947. handler: function handler(context) {
  7948. var res = {
  7949. type: "array",
  7950. cols: [],
  7951. addJot: true
  7952. };
  7953. res = parseArray(context.parser, res, "display");
  7954. // Count number of columns = maximum number of cells in each row.
  7955. // At the same time, prepend empty group {} at beginning of every second
  7956. // cell in each row (starting with second cell) so that operators become
  7957. // binary. This behavior is implemented in amsmath's \start@aligned.
  7958. var emptyGroup = new _ParseNode2.default("ordgroup", [], context.mode);
  7959. var numCols = 0;
  7960. res.value.body.forEach(function (row) {
  7961. for (var i = 1; i < row.length; i += 2) {
  7962. // Modify ordgroup node within styling node
  7963. var ordgroup = row[i].value.value[0];
  7964. ordgroup.value.unshift(emptyGroup);
  7965. }
  7966. if (numCols < row.length) {
  7967. numCols = row.length;
  7968. }
  7969. });
  7970. for (var i = 0; i < numCols; ++i) {
  7971. var _align = "r";
  7972. var _pregap = 0;
  7973. if (i % 2 === 1) {
  7974. _align = "l";
  7975. } else if (i > 0) {
  7976. _pregap = 2; // one \qquad between columns
  7977. }
  7978. res.value.cols[i] = {
  7979. type: "align",
  7980. align: _align,
  7981. pregap: _pregap,
  7982. postgap: 0
  7983. };
  7984. }
  7985. return res;
  7986. },
  7987. htmlBuilder: htmlBuilder,
  7988. mathmlBuilder: mathmlBuilder
  7989. });
  7990.  
  7991. // A gathered environment is like an array environment with one centered
  7992. // column, but where rows are considered lines so get \jot line spacing
  7993. // and contents are set in \displaystyle.
  7994. (0, _defineEnvironment2.default)({
  7995. type: "array",
  7996. names: ["gathered"],
  7997. props: {
  7998. numArgs: 0
  7999. },
  8000. handler: function handler(context) {
  8001. var res = {
  8002. type: "array",
  8003. cols: [{
  8004. type: "align",
  8005. align: "c"
  8006. }],
  8007. addJot: true
  8008. };
  8009. res = parseArray(context.parser, res, "display");
  8010. return res;
  8011. },
  8012. htmlBuilder: htmlBuilder,
  8013. mathmlBuilder: mathmlBuilder
  8014. });
  8015.  
  8016. },{"../ParseError":84,"../ParseNode":85,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineEnvironment":95,"../mathMLTree":108,"../units":114,"../utils":115}],101:[function(require,module,exports){
  8017. "use strict";
  8018.  
  8019. Object.defineProperty(exports, "__esModule", {
  8020. value: true
  8021. });
  8022.  
  8023. var _unicodeRegexes = require("./unicodeRegexes");
  8024.  
  8025. var _fontMetricsData = require("./fontMetricsData");
  8026.  
  8027. var _fontMetricsData2 = _interopRequireDefault(_fontMetricsData);
  8028.  
  8029. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8030.  
  8031. /**
  8032. * This file contains metrics regarding fonts and individual symbols. The sigma
  8033. * and xi variables, as well as the metricMap map contain data extracted from
  8034. * TeX, TeX font metrics, and the TTF files. These data are then exposed via the
  8035. * `metrics` variable and the getCharacterMetrics function.
  8036. */
  8037.  
  8038. // In TeX, there are actually three sets of dimensions, one for each of
  8039. // textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:
  8040. // 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are
  8041. // provided in the the arrays below, in that order.
  8042. //
  8043. // The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively.
  8044. // This was determined by running the following script:
  8045. //
  8046. // latex -interaction=nonstopmode \
  8047. // '\documentclass{article}\usepackage{amsmath}\begin{document}' \
  8048. // '$a$ \expandafter\show\the\textfont2' \
  8049. // '\expandafter\show\the\scriptfont2' \
  8050. // '\expandafter\show\the\scriptscriptfont2' \
  8051. // '\stop'
  8052. //
  8053. // The metrics themselves were retreived using the following commands:
  8054. //
  8055. // tftopl cmsy10
  8056. // tftopl cmsy7
  8057. // tftopl cmsy5
  8058. //
  8059. // The output of each of these commands is quite lengthy. The only part we
  8060. // care about is the FONTDIMEN section. Each value is measured in EMs.
  8061. var sigmasAndXis = {
  8062. slant: [0.250, 0.250, 0.250], // sigma1
  8063. space: [0.000, 0.000, 0.000], // sigma2
  8064. stretch: [0.000, 0.000, 0.000], // sigma3
  8065. shrink: [0.000, 0.000, 0.000], // sigma4
  8066. xHeight: [0.431, 0.431, 0.431], // sigma5
  8067. quad: [1.000, 1.171, 1.472], // sigma6
  8068. extraSpace: [0.000, 0.000, 0.000], // sigma7
  8069. num1: [0.677, 0.732, 0.925], // sigma8
  8070. num2: [0.394, 0.384, 0.387], // sigma9
  8071. num3: [0.444, 0.471, 0.504], // sigma10
  8072. denom1: [0.686, 0.752, 1.025], // sigma11
  8073. denom2: [0.345, 0.344, 0.532], // sigma12
  8074. sup1: [0.413, 0.503, 0.504], // sigma13
  8075. sup2: [0.363, 0.431, 0.404], // sigma14
  8076. sup3: [0.289, 0.286, 0.294], // sigma15
  8077. sub1: [0.150, 0.143, 0.200], // sigma16
  8078. sub2: [0.247, 0.286, 0.400], // sigma17
  8079. supDrop: [0.386, 0.353, 0.494], // sigma18
  8080. subDrop: [0.050, 0.071, 0.100], // sigma19
  8081. delim1: [2.390, 1.700, 1.980], // sigma20
  8082. delim2: [1.010, 1.157, 1.420], // sigma21
  8083. axisHeight: [0.250, 0.250, 0.250], // sigma22
  8084.  
  8085. // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
  8086. // they correspond to the font parameters of the extension fonts (family 3).
  8087. // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
  8088. // match cmex7, we'd use cmex7.tfm values for script and scriptscript
  8089. // values.
  8090. defaultRuleThickness: [0.04, 0.049, 0.049], // xi8; cmex7: 0.049
  8091. bigOpSpacing1: [0.111, 0.111, 0.111], // xi9
  8092. bigOpSpacing2: [0.166, 0.166, 0.166], // xi10
  8093. bigOpSpacing3: [0.2, 0.2, 0.2], // xi11
  8094. bigOpSpacing4: [0.6, 0.611, 0.611], // xi12; cmex7: 0.611
  8095. bigOpSpacing5: [0.1, 0.143, 0.143], // xi13; cmex7: 0.143
  8096.  
  8097. // The \sqrt rule width is taken from the height of the surd character.
  8098. // Since we use the same font at all sizes, this thickness doesn't scale.
  8099. sqrtRuleThickness: [0.04, 0.04, 0.04],
  8100.  
  8101. // This value determines how large a pt is, for metrics which are defined
  8102. // in terms of pts.
  8103. // This value is also used in katex.less; if you change it make sure the
  8104. // values match.
  8105. ptPerEm: [10.0, 10.0, 10.0],
  8106.  
  8107. // The space between adjacent `|` columns in an array definition. From
  8108. // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
  8109. doubleRuleSep: [0.2, 0.2, 0.2]
  8110. };
  8111.  
  8112. // This map contains a mapping from font name and character code to character
  8113. // metrics, including height, depth, italic correction, and skew (kern from the
  8114. // character to the corresponding \skewchar)
  8115. // This map is generated via `make metrics`. It should not be changed manually.
  8116.  
  8117.  
  8118. // These are very rough approximations. We default to Times New Roman which
  8119. // should have Latin-1 and Cyrillic characters, but may not depending on the
  8120. // operating system. The metrics do not account for extra height from the
  8121. // accents. In the case of Cyrillic characters which have both ascenders and
  8122. // descenders we prefer approximations with ascenders, primarily to prevent
  8123. // the fraction bar or root line from intersecting the glyph.
  8124. // TODO(kevinb) allow union of multiple glyph metrics for better accuracy.
  8125. var extraCharacterMap = {
  8126. // Latin-1
  8127. 'À': 'A',
  8128. 'Á': 'A',
  8129. 'Â': 'A',
  8130. 'Ã': 'A',
  8131. 'Ä': 'A',
  8132. 'Å': 'A',
  8133. 'Æ': 'A',
  8134. 'Ç': 'C',
  8135. 'È': 'E',
  8136. 'É': 'E',
  8137. 'Ê': 'E',
  8138. 'Ë': 'E',
  8139. 'Ì': 'I',
  8140. 'Í': 'I',
  8141. 'Î': 'I',
  8142. 'Ï': 'I',
  8143. 'Ð': 'D',
  8144. 'Ñ': 'N',
  8145. 'Ò': 'O',
  8146. 'Ó': 'O',
  8147. 'Ô': 'O',
  8148. 'Õ': 'O',
  8149. 'Ö': 'O',
  8150. 'Ø': 'O',
  8151. 'Ù': 'U',
  8152. 'Ú': 'U',
  8153. 'Û': 'U',
  8154. 'Ü': 'U',
  8155. 'Ý': 'Y',
  8156. 'Þ': 'o',
  8157. 'ß': 'B',
  8158. 'à': 'a',
  8159. 'á': 'a',
  8160. 'â': 'a',
  8161. 'ã': 'a',
  8162. 'ä': 'a',
  8163. 'å': 'a',
  8164. 'æ': 'a',
  8165. 'ç': 'c',
  8166. 'è': 'e',
  8167. 'é': 'e',
  8168. 'ê': 'e',
  8169. 'ë': 'e',
  8170. 'ì': 'i',
  8171. 'í': 'i',
  8172. 'î': 'i',
  8173. 'ï': 'i',
  8174. 'ð': 'd',
  8175. 'ñ': 'n',
  8176. 'ò': 'o',
  8177. 'ó': 'o',
  8178. 'ô': 'o',
  8179. 'õ': 'o',
  8180. 'ö': 'o',
  8181. 'ø': 'o',
  8182. 'ù': 'u',
  8183. 'ú': 'u',
  8184. 'û': 'u',
  8185. 'ü': 'u',
  8186. 'ý': 'y',
  8187. 'þ': 'o',
  8188. 'ÿ': 'y',
  8189.  
  8190. // Cyrillic
  8191. 'А': 'A',
  8192. 'Б': 'B',
  8193. 'В': 'B',
  8194. 'Г': 'F',
  8195. 'Д': 'A',
  8196. 'Е': 'E',
  8197. 'Ж': 'K',
  8198. 'З': '3',
  8199. 'И': 'N',
  8200. 'Й': 'N',
  8201. 'К': 'K',
  8202. 'Л': 'N',
  8203. 'М': 'M',
  8204. 'Н': 'H',
  8205. 'О': 'O',
  8206. 'П': 'N',
  8207. 'Р': 'P',
  8208. 'С': 'C',
  8209. 'Т': 'T',
  8210. 'У': 'y',
  8211. 'Ф': 'O',
  8212. 'Х': 'X',
  8213. 'Ц': 'U',
  8214. 'Ч': 'h',
  8215. 'Ш': 'W',
  8216. 'Щ': 'W',
  8217. 'Ъ': 'B',
  8218. 'Ы': 'X',
  8219. 'Ь': 'B',
  8220. 'Э': '3',
  8221. 'Ю': 'X',
  8222. 'Я': 'R',
  8223. 'а': 'a',
  8224. 'б': 'b',
  8225. 'в': 'a',
  8226. 'г': 'r',
  8227. 'д': 'y',
  8228. 'е': 'e',
  8229. 'ж': 'm',
  8230. 'з': 'e',
  8231. 'и': 'n',
  8232. 'й': 'n',
  8233. 'к': 'n',
  8234. 'л': 'n',
  8235. 'м': 'm',
  8236. 'н': 'n',
  8237. 'о': 'o',
  8238. 'п': 'n',
  8239. 'р': 'p',
  8240. 'с': 'c',
  8241. 'т': 'o',
  8242. 'у': 'y',
  8243. 'ф': 'b',
  8244. 'х': 'x',
  8245. 'ц': 'n',
  8246. 'ч': 'n',
  8247. 'ш': 'w',
  8248. 'щ': 'w',
  8249. 'ъ': 'a',
  8250. 'ы': 'm',
  8251. 'ь': 'a',
  8252. 'э': 'e',
  8253. 'ю': 'm',
  8254. 'я': 'r'
  8255. };
  8256.  
  8257. /**
  8258. * This function is a convenience function for looking up information in the
  8259. * metricMap table. It takes a character as a string, and a font.
  8260. *
  8261. * Note: the `width` property may be undefined if fontMetricsData.js wasn't
  8262. * built using `Make extended_metrics`.
  8263. */
  8264. var getCharacterMetrics = function getCharacterMetrics(character, font) {
  8265. var ch = character.charCodeAt(0);
  8266. if (character[0] in extraCharacterMap) {
  8267. ch = extraCharacterMap[character[0]].charCodeAt(0);
  8268. } else if (_unicodeRegexes.cjkRegex.test(character[0])) {
  8269. ch = 'M'.charCodeAt(0);
  8270. }
  8271. var metrics = _fontMetricsData2.default[font]['' + ch];
  8272. if (metrics) {
  8273. return {
  8274. depth: metrics[0],
  8275. height: metrics[1],
  8276. italic: metrics[2],
  8277. skew: metrics[3],
  8278. width: metrics[4]
  8279. };
  8280. }
  8281. };
  8282.  
  8283. var fontMetricsBySizeIndex = {};
  8284.  
  8285. /**
  8286. * Get the font metrics for a given size.
  8287. */
  8288. var getFontMetrics = function getFontMetrics(size) {
  8289. var sizeIndex = void 0;
  8290. if (size >= 5) {
  8291. sizeIndex = 0;
  8292. } else if (size >= 3) {
  8293. sizeIndex = 1;
  8294. } else {
  8295. sizeIndex = 2;
  8296. }
  8297. if (!fontMetricsBySizeIndex[sizeIndex]) {
  8298. var metrics = fontMetricsBySizeIndex[sizeIndex] = {
  8299. cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
  8300. };
  8301. for (var key in sigmasAndXis) {
  8302. if (sigmasAndXis.hasOwnProperty(key)) {
  8303. metrics[key] = sigmasAndXis[key][sizeIndex];
  8304. }
  8305. }
  8306. }
  8307. return fontMetricsBySizeIndex[sizeIndex];
  8308. };
  8309.  
  8310. exports.default = {
  8311. getFontMetrics: getFontMetrics,
  8312. getCharacterMetrics: getCharacterMetrics
  8313. };
  8314.  
  8315. },{"./fontMetricsData":102,"./unicodeRegexes":113}],102:[function(require,module,exports){
  8316. "use strict";
  8317.  
  8318. Object.defineProperty(exports, "__esModule", {
  8319. value: true
  8320. });
  8321. var fontMetricsData = {
  8322. "AMS-Regular": {
  8323. "65": [0, 0.68889, 0, 0],
  8324. "66": [0, 0.68889, 0, 0],
  8325. "67": [0, 0.68889, 0, 0],
  8326. "68": [0, 0.68889, 0, 0],
  8327. "69": [0, 0.68889, 0, 0],
  8328. "70": [0, 0.68889, 0, 0],
  8329. "71": [0, 0.68889, 0, 0],
  8330. "72": [0, 0.68889, 0, 0],
  8331. "73": [0, 0.68889, 0, 0],
  8332. "74": [0.16667, 0.68889, 0, 0],
  8333. "75": [0, 0.68889, 0, 0],
  8334. "76": [0, 0.68889, 0, 0],
  8335. "77": [0, 0.68889, 0, 0],
  8336. "78": [0, 0.68889, 0, 0],
  8337. "79": [0.16667, 0.68889, 0, 0],
  8338. "80": [0, 0.68889, 0, 0],
  8339. "81": [0.16667, 0.68889, 0, 0],
  8340. "82": [0, 0.68889, 0, 0],
  8341. "83": [0, 0.68889, 0, 0],
  8342. "84": [0, 0.68889, 0, 0],
  8343. "85": [0, 0.68889, 0, 0],
  8344. "86": [0, 0.68889, 0, 0],
  8345. "87": [0, 0.68889, 0, 0],
  8346. "88": [0, 0.68889, 0, 0],
  8347. "89": [0, 0.68889, 0, 0],
  8348. "90": [0, 0.68889, 0, 0],
  8349. "107": [0, 0.68889, 0, 0],
  8350. "165": [0, 0.675, 0.025, 0],
  8351. "174": [0.15559, 0.69224, 0, 0],
  8352. "240": [0, 0.68889, 0, 0],
  8353. "295": [0, 0.68889, 0, 0],
  8354. "710": [0, 0.825, 0, 0],
  8355. "732": [0, 0.9, 0, 0],
  8356. "770": [0, 0.825, 0, 0],
  8357. "771": [0, 0.9, 0, 0],
  8358. "989": [0.08167, 0.58167, 0, 0],
  8359. "1008": [0, 0.43056, 0.04028, 0],
  8360. "8245": [0, 0.54986, 0, 0],
  8361. "8463": [0, 0.68889, 0, 0],
  8362. "8487": [0, 0.68889, 0, 0],
  8363. "8498": [0, 0.68889, 0, 0],
  8364. "8502": [0, 0.68889, 0, 0],
  8365. "8503": [0, 0.68889, 0, 0],
  8366. "8504": [0, 0.68889, 0, 0],
  8367. "8513": [0, 0.68889, 0, 0],
  8368. "8592": [-0.03598, 0.46402, 0, 0],
  8369. "8594": [-0.03598, 0.46402, 0, 0],
  8370. "8602": [-0.13313, 0.36687, 0, 0],
  8371. "8603": [-0.13313, 0.36687, 0, 0],
  8372. "8606": [0.01354, 0.52239, 0, 0],
  8373. "8608": [0.01354, 0.52239, 0, 0],
  8374. "8610": [0.01354, 0.52239, 0, 0],
  8375. "8611": [0.01354, 0.52239, 0, 0],
  8376. "8619": [0, 0.54986, 0, 0],
  8377. "8620": [0, 0.54986, 0, 0],
  8378. "8621": [-0.13313, 0.37788, 0, 0],
  8379. "8622": [-0.13313, 0.36687, 0, 0],
  8380. "8624": [0, 0.69224, 0, 0],
  8381. "8625": [0, 0.69224, 0, 0],
  8382. "8630": [0, 0.43056, 0, 0],
  8383. "8631": [0, 0.43056, 0, 0],
  8384. "8634": [0.08198, 0.58198, 0, 0],
  8385. "8635": [0.08198, 0.58198, 0, 0],
  8386. "8638": [0.19444, 0.69224, 0, 0],
  8387. "8639": [0.19444, 0.69224, 0, 0],
  8388. "8642": [0.19444, 0.69224, 0, 0],
  8389. "8643": [0.19444, 0.69224, 0, 0],
  8390. "8644": [0.1808, 0.675, 0, 0],
  8391. "8646": [0.1808, 0.675, 0, 0],
  8392. "8647": [0.1808, 0.675, 0, 0],
  8393. "8648": [0.19444, 0.69224, 0, 0],
  8394. "8649": [0.1808, 0.675, 0, 0],
  8395. "8650": [0.19444, 0.69224, 0, 0],
  8396. "8651": [0.01354, 0.52239, 0, 0],
  8397. "8652": [0.01354, 0.52239, 0, 0],
  8398. "8653": [-0.13313, 0.36687, 0, 0],
  8399. "8654": [-0.13313, 0.36687, 0, 0],
  8400. "8655": [-0.13313, 0.36687, 0, 0],
  8401. "8666": [0.13667, 0.63667, 0, 0],
  8402. "8667": [0.13667, 0.63667, 0, 0],
  8403. "8669": [-0.13313, 0.37788, 0, 0],
  8404. "8672": [-0.064, 0.437, 0, 0],
  8405. "8674": [-0.064, 0.437, 0, 0],
  8406. "8705": [0, 0.825, 0, 0],
  8407. "8708": [0, 0.68889, 0, 0],
  8408. "8709": [0.08167, 0.58167, 0, 0],
  8409. "8717": [0, 0.43056, 0, 0],
  8410. "8722": [-0.03598, 0.46402, 0, 0],
  8411. "8724": [0.08198, 0.69224, 0, 0],
  8412. "8726": [0.08167, 0.58167, 0, 0],
  8413. "8733": [0, 0.69224, 0, 0],
  8414. "8736": [0, 0.69224, 0, 0],
  8415. "8737": [0, 0.69224, 0, 0],
  8416. "8738": [0.03517, 0.52239, 0, 0],
  8417. "8739": [0.08167, 0.58167, 0, 0],
  8418. "8740": [0.25142, 0.74111, 0, 0],
  8419. "8741": [0.08167, 0.58167, 0, 0],
  8420. "8742": [0.25142, 0.74111, 0, 0],
  8421. "8756": [0, 0.69224, 0, 0],
  8422. "8757": [0, 0.69224, 0, 0],
  8423. "8764": [-0.13313, 0.36687, 0, 0],
  8424. "8765": [-0.13313, 0.37788, 0, 0],
  8425. "8769": [-0.13313, 0.36687, 0, 0],
  8426. "8770": [-0.03625, 0.46375, 0, 0],
  8427. "8774": [0.30274, 0.79383, 0, 0],
  8428. "8776": [-0.01688, 0.48312, 0, 0],
  8429. "8778": [0.08167, 0.58167, 0, 0],
  8430. "8782": [0.06062, 0.54986, 0, 0],
  8431. "8783": [0.06062, 0.54986, 0, 0],
  8432. "8785": [0.08198, 0.58198, 0, 0],
  8433. "8786": [0.08198, 0.58198, 0, 0],
  8434. "8787": [0.08198, 0.58198, 0, 0],
  8435. "8790": [0, 0.69224, 0, 0],
  8436. "8791": [0.22958, 0.72958, 0, 0],
  8437. "8796": [0.08198, 0.91667, 0, 0],
  8438. "8806": [0.25583, 0.75583, 0, 0],
  8439. "8807": [0.25583, 0.75583, 0, 0],
  8440. "8808": [0.25142, 0.75726, 0, 0],
  8441. "8809": [0.25142, 0.75726, 0, 0],
  8442. "8812": [0.25583, 0.75583, 0, 0],
  8443. "8814": [0.20576, 0.70576, 0, 0],
  8444. "8815": [0.20576, 0.70576, 0, 0],
  8445. "8816": [0.30274, 0.79383, 0, 0],
  8446. "8817": [0.30274, 0.79383, 0, 0],
  8447. "8818": [0.22958, 0.72958, 0, 0],
  8448. "8819": [0.22958, 0.72958, 0, 0],
  8449. "8822": [0.1808, 0.675, 0, 0],
  8450. "8823": [0.1808, 0.675, 0, 0],
  8451. "8828": [0.13667, 0.63667, 0, 0],
  8452. "8829": [0.13667, 0.63667, 0, 0],
  8453. "8830": [0.22958, 0.72958, 0, 0],
  8454. "8831": [0.22958, 0.72958, 0, 0],
  8455. "8832": [0.20576, 0.70576, 0, 0],
  8456. "8833": [0.20576, 0.70576, 0, 0],
  8457. "8840": [0.30274, 0.79383, 0, 0],
  8458. "8841": [0.30274, 0.79383, 0, 0],
  8459. "8842": [0.13597, 0.63597, 0, 0],
  8460. "8843": [0.13597, 0.63597, 0, 0],
  8461. "8847": [0.03517, 0.54986, 0, 0],
  8462. "8848": [0.03517, 0.54986, 0, 0],
  8463. "8858": [0.08198, 0.58198, 0, 0],
  8464. "8859": [0.08198, 0.58198, 0, 0],
  8465. "8861": [0.08198, 0.58198, 0, 0],
  8466. "8862": [0, 0.675, 0, 0],
  8467. "8863": [0, 0.675, 0, 0],
  8468. "8864": [0, 0.675, 0, 0],
  8469. "8865": [0, 0.675, 0, 0],
  8470. "8872": [0, 0.69224, 0, 0],
  8471. "8873": [0, 0.69224, 0, 0],
  8472. "8874": [0, 0.69224, 0, 0],
  8473. "8876": [0, 0.68889, 0, 0],
  8474. "8877": [0, 0.68889, 0, 0],
  8475. "8878": [0, 0.68889, 0, 0],
  8476. "8879": [0, 0.68889, 0, 0],
  8477. "8882": [0.03517, 0.54986, 0, 0],
  8478. "8883": [0.03517, 0.54986, 0, 0],
  8479. "8884": [0.13667, 0.63667, 0, 0],
  8480. "8885": [0.13667, 0.63667, 0, 0],
  8481. "8888": [0, 0.54986, 0, 0],
  8482. "8890": [0.19444, 0.43056, 0, 0],
  8483. "8891": [0.19444, 0.69224, 0, 0],
  8484. "8892": [0.19444, 0.69224, 0, 0],
  8485. "8901": [0, 0.54986, 0, 0],
  8486. "8903": [0.08167, 0.58167, 0, 0],
  8487. "8905": [0.08167, 0.58167, 0, 0],
  8488. "8906": [0.08167, 0.58167, 0, 0],
  8489. "8907": [0, 0.69224, 0, 0],
  8490. "8908": [0, 0.69224, 0, 0],
  8491. "8909": [-0.03598, 0.46402, 0, 0],
  8492. "8910": [0, 0.54986, 0, 0],
  8493. "8911": [0, 0.54986, 0, 0],
  8494. "8912": [0.03517, 0.54986, 0, 0],
  8495. "8913": [0.03517, 0.54986, 0, 0],
  8496. "8914": [0, 0.54986, 0, 0],
  8497. "8915": [0, 0.54986, 0, 0],
  8498. "8916": [0, 0.69224, 0, 0],
  8499. "8918": [0.0391, 0.5391, 0, 0],
  8500. "8919": [0.0391, 0.5391, 0, 0],
  8501. "8920": [0.03517, 0.54986, 0, 0],
  8502. "8921": [0.03517, 0.54986, 0, 0],
  8503. "8922": [0.38569, 0.88569, 0, 0],
  8504. "8923": [0.38569, 0.88569, 0, 0],
  8505. "8926": [0.13667, 0.63667, 0, 0],
  8506. "8927": [0.13667, 0.63667, 0, 0],
  8507. "8928": [0.30274, 0.79383, 0, 0],
  8508. "8929": [0.30274, 0.79383, 0, 0],
  8509. "8934": [0.23222, 0.74111, 0, 0],
  8510. "8935": [0.23222, 0.74111, 0, 0],
  8511. "8936": [0.23222, 0.74111, 0, 0],
  8512. "8937": [0.23222, 0.74111, 0, 0],
  8513. "8938": [0.20576, 0.70576, 0, 0],
  8514. "8939": [0.20576, 0.70576, 0, 0],
  8515. "8940": [0.30274, 0.79383, 0, 0],
  8516. "8941": [0.30274, 0.79383, 0, 0],
  8517. "8994": [0.19444, 0.69224, 0, 0],
  8518. "8995": [0.19444, 0.69224, 0, 0],
  8519. "9416": [0.15559, 0.69224, 0, 0],
  8520. "9484": [0, 0.69224, 0, 0],
  8521. "9488": [0, 0.69224, 0, 0],
  8522. "9492": [0, 0.37788, 0, 0],
  8523. "9496": [0, 0.37788, 0, 0],
  8524. "9585": [0.19444, 0.68889, 0, 0],
  8525. "9586": [0.19444, 0.74111, 0, 0],
  8526. "9632": [0, 0.675, 0, 0],
  8527. "9633": [0, 0.675, 0, 0],
  8528. "9650": [0, 0.54986, 0, 0],
  8529. "9651": [0, 0.54986, 0, 0],
  8530. "9654": [0.03517, 0.54986, 0, 0],
  8531. "9660": [0, 0.54986, 0, 0],
  8532. "9661": [0, 0.54986, 0, 0],
  8533. "9664": [0.03517, 0.54986, 0, 0],
  8534. "9674": [0.11111, 0.69224, 0, 0],
  8535. "9733": [0.19444, 0.69224, 0, 0],
  8536. "10003": [0, 0.69224, 0, 0],
  8537. "10016": [0, 0.69224, 0, 0],
  8538. "10731": [0.11111, 0.69224, 0, 0],
  8539. "10846": [0.19444, 0.75583, 0, 0],
  8540. "10877": [0.13667, 0.63667, 0, 0],
  8541. "10878": [0.13667, 0.63667, 0, 0],
  8542. "10885": [0.25583, 0.75583, 0, 0],
  8543. "10886": [0.25583, 0.75583, 0, 0],
  8544. "10887": [0.13597, 0.63597, 0, 0],
  8545. "10888": [0.13597, 0.63597, 0, 0],
  8546. "10889": [0.26167, 0.75726, 0, 0],
  8547. "10890": [0.26167, 0.75726, 0, 0],
  8548. "10891": [0.48256, 0.98256, 0, 0],
  8549. "10892": [0.48256, 0.98256, 0, 0],
  8550. "10901": [0.13667, 0.63667, 0, 0],
  8551. "10902": [0.13667, 0.63667, 0, 0],
  8552. "10933": [0.25142, 0.75726, 0, 0],
  8553. "10934": [0.25142, 0.75726, 0, 0],
  8554. "10935": [0.26167, 0.75726, 0, 0],
  8555. "10936": [0.26167, 0.75726, 0, 0],
  8556. "10937": [0.26167, 0.75726, 0, 0],
  8557. "10938": [0.26167, 0.75726, 0, 0],
  8558. "10949": [0.25583, 0.75583, 0, 0],
  8559. "10950": [0.25583, 0.75583, 0, 0],
  8560. "10955": [0.28481, 0.79383, 0, 0],
  8561. "10956": [0.28481, 0.79383, 0, 0],
  8562. "57350": [0.08167, 0.58167, 0, 0],
  8563. "57351": [0.08167, 0.58167, 0, 0],
  8564. "57352": [0.08167, 0.58167, 0, 0],
  8565. "57353": [0, 0.43056, 0.04028, 0],
  8566. "57356": [0.25142, 0.75726, 0, 0],
  8567. "57357": [0.25142, 0.75726, 0, 0],
  8568. "57358": [0.41951, 0.91951, 0, 0],
  8569. "57359": [0.30274, 0.79383, 0, 0],
  8570. "57360": [0.30274, 0.79383, 0, 0],
  8571. "57361": [0.41951, 0.91951, 0, 0],
  8572. "57366": [0.25142, 0.75726, 0, 0],
  8573. "57367": [0.25142, 0.75726, 0, 0],
  8574. "57368": [0.25142, 0.75726, 0, 0],
  8575. "57369": [0.25142, 0.75726, 0, 0],
  8576. "57370": [0.13597, 0.63597, 0, 0],
  8577. "57371": [0.13597, 0.63597, 0, 0]
  8578. },
  8579. "Caligraphic-Regular": {
  8580. "48": [0, 0.43056, 0, 0],
  8581. "49": [0, 0.43056, 0, 0],
  8582. "50": [0, 0.43056, 0, 0],
  8583. "51": [0.19444, 0.43056, 0, 0],
  8584. "52": [0.19444, 0.43056, 0, 0],
  8585. "53": [0.19444, 0.43056, 0, 0],
  8586. "54": [0, 0.64444, 0, 0],
  8587. "55": [0.19444, 0.43056, 0, 0],
  8588. "56": [0, 0.64444, 0, 0],
  8589. "57": [0.19444, 0.43056, 0, 0],
  8590. "65": [0, 0.68333, 0, 0.19445],
  8591. "66": [0, 0.68333, 0.03041, 0.13889],
  8592. "67": [0, 0.68333, 0.05834, 0.13889],
  8593. "68": [0, 0.68333, 0.02778, 0.08334],
  8594. "69": [0, 0.68333, 0.08944, 0.11111],
  8595. "70": [0, 0.68333, 0.09931, 0.11111],
  8596. "71": [0.09722, 0.68333, 0.0593, 0.11111],
  8597. "72": [0, 0.68333, 0.00965, 0.11111],
  8598. "73": [0, 0.68333, 0.07382, 0],
  8599. "74": [0.09722, 0.68333, 0.18472, 0.16667],
  8600. "75": [0, 0.68333, 0.01445, 0.05556],
  8601. "76": [0, 0.68333, 0, 0.13889],
  8602. "77": [0, 0.68333, 0, 0.13889],
  8603. "78": [0, 0.68333, 0.14736, 0.08334],
  8604. "79": [0, 0.68333, 0.02778, 0.11111],
  8605. "80": [0, 0.68333, 0.08222, 0.08334],
  8606. "81": [0.09722, 0.68333, 0, 0.11111],
  8607. "82": [0, 0.68333, 0, 0.08334],
  8608. "83": [0, 0.68333, 0.075, 0.13889],
  8609. "84": [0, 0.68333, 0.25417, 0],
  8610. "85": [0, 0.68333, 0.09931, 0.08334],
  8611. "86": [0, 0.68333, 0.08222, 0],
  8612. "87": [0, 0.68333, 0.08222, 0.08334],
  8613. "88": [0, 0.68333, 0.14643, 0.13889],
  8614. "89": [0.09722, 0.68333, 0.08222, 0.08334],
  8615. "90": [0, 0.68333, 0.07944, 0.13889]
  8616. },
  8617. "Fraktur-Regular": {
  8618. "33": [0, 0.69141, 0, 0],
  8619. "34": [0, 0.69141, 0, 0],
  8620. "38": [0, 0.69141, 0, 0],
  8621. "39": [0, 0.69141, 0, 0],
  8622. "40": [0.24982, 0.74947, 0, 0],
  8623. "41": [0.24982, 0.74947, 0, 0],
  8624. "42": [0, 0.62119, 0, 0],
  8625. "43": [0.08319, 0.58283, 0, 0],
  8626. "44": [0, 0.10803, 0, 0],
  8627. "45": [0.08319, 0.58283, 0, 0],
  8628. "46": [0, 0.10803, 0, 0],
  8629. "47": [0.24982, 0.74947, 0, 0],
  8630. "48": [0, 0.47534, 0, 0],
  8631. "49": [0, 0.47534, 0, 0],
  8632. "50": [0, 0.47534, 0, 0],
  8633. "51": [0.18906, 0.47534, 0, 0],
  8634. "52": [0.18906, 0.47534, 0, 0],
  8635. "53": [0.18906, 0.47534, 0, 0],
  8636. "54": [0, 0.69141, 0, 0],
  8637. "55": [0.18906, 0.47534, 0, 0],
  8638. "56": [0, 0.69141, 0, 0],
  8639. "57": [0.18906, 0.47534, 0, 0],
  8640. "58": [0, 0.47534, 0, 0],
  8641. "59": [0.12604, 0.47534, 0, 0],
  8642. "61": [-0.13099, 0.36866, 0, 0],
  8643. "63": [0, 0.69141, 0, 0],
  8644. "65": [0, 0.69141, 0, 0],
  8645. "66": [0, 0.69141, 0, 0],
  8646. "67": [0, 0.69141, 0, 0],
  8647. "68": [0, 0.69141, 0, 0],
  8648. "69": [0, 0.69141, 0, 0],
  8649. "70": [0.12604, 0.69141, 0, 0],
  8650. "71": [0, 0.69141, 0, 0],
  8651. "72": [0.06302, 0.69141, 0, 0],
  8652. "73": [0, 0.69141, 0, 0],
  8653. "74": [0.12604, 0.69141, 0, 0],
  8654. "75": [0, 0.69141, 0, 0],
  8655. "76": [0, 0.69141, 0, 0],
  8656. "77": [0, 0.69141, 0, 0],
  8657. "78": [0, 0.69141, 0, 0],
  8658. "79": [0, 0.69141, 0, 0],
  8659. "80": [0.18906, 0.69141, 0, 0],
  8660. "81": [0.03781, 0.69141, 0, 0],
  8661. "82": [0, 0.69141, 0, 0],
  8662. "83": [0, 0.69141, 0, 0],
  8663. "84": [0, 0.69141, 0, 0],
  8664. "85": [0, 0.69141, 0, 0],
  8665. "86": [0, 0.69141, 0, 0],
  8666. "87": [0, 0.69141, 0, 0],
  8667. "88": [0, 0.69141, 0, 0],
  8668. "89": [0.18906, 0.69141, 0, 0],
  8669. "90": [0.12604, 0.69141, 0, 0],
  8670. "91": [0.24982, 0.74947, 0, 0],
  8671. "93": [0.24982, 0.74947, 0, 0],
  8672. "94": [0, 0.69141, 0, 0],
  8673. "97": [0, 0.47534, 0, 0],
  8674. "98": [0, 0.69141, 0, 0],
  8675. "99": [0, 0.47534, 0, 0],
  8676. "100": [0, 0.62119, 0, 0],
  8677. "101": [0, 0.47534, 0, 0],
  8678. "102": [0.18906, 0.69141, 0, 0],
  8679. "103": [0.18906, 0.47534, 0, 0],
  8680. "104": [0.18906, 0.69141, 0, 0],
  8681. "105": [0, 0.69141, 0, 0],
  8682. "106": [0, 0.69141, 0, 0],
  8683. "107": [0, 0.69141, 0, 0],
  8684. "108": [0, 0.69141, 0, 0],
  8685. "109": [0, 0.47534, 0, 0],
  8686. "110": [0, 0.47534, 0, 0],
  8687. "111": [0, 0.47534, 0, 0],
  8688. "112": [0.18906, 0.52396, 0, 0],
  8689. "113": [0.18906, 0.47534, 0, 0],
  8690. "114": [0, 0.47534, 0, 0],
  8691. "115": [0, 0.47534, 0, 0],
  8692. "116": [0, 0.62119, 0, 0],
  8693. "117": [0, 0.47534, 0, 0],
  8694. "118": [0, 0.52396, 0, 0],
  8695. "119": [0, 0.52396, 0, 0],
  8696. "120": [0.18906, 0.47534, 0, 0],
  8697. "121": [0.18906, 0.47534, 0, 0],
  8698. "122": [0.18906, 0.47534, 0, 0],
  8699. "8216": [0, 0.69141, 0, 0],
  8700. "8217": [0, 0.69141, 0, 0],
  8701. "58112": [0, 0.62119, 0, 0],
  8702. "58113": [0, 0.62119, 0, 0],
  8703. "58114": [0.18906, 0.69141, 0, 0],
  8704. "58115": [0.18906, 0.69141, 0, 0],
  8705. "58116": [0.18906, 0.47534, 0, 0],
  8706. "58117": [0, 0.69141, 0, 0],
  8707. "58118": [0, 0.62119, 0, 0],
  8708. "58119": [0, 0.47534, 0, 0]
  8709. },
  8710. "Main-Bold": {
  8711. "33": [0, 0.69444, 0, 0],
  8712. "34": [0, 0.69444, 0, 0],
  8713. "35": [0.19444, 0.69444, 0, 0],
  8714. "36": [0.05556, 0.75, 0, 0],
  8715. "37": [0.05556, 0.75, 0, 0],
  8716. "38": [0, 0.69444, 0, 0],
  8717. "39": [0, 0.69444, 0, 0],
  8718. "40": [0.25, 0.75, 0, 0],
  8719. "41": [0.25, 0.75, 0, 0],
  8720. "42": [0, 0.75, 0, 0],
  8721. "43": [0.13333, 0.63333, 0, 0],
  8722. "44": [0.19444, 0.15556, 0, 0],
  8723. "45": [0, 0.44444, 0, 0],
  8724. "46": [0, 0.15556, 0, 0],
  8725. "47": [0.25, 0.75, 0, 0],
  8726. "48": [0, 0.64444, 0, 0],
  8727. "49": [0, 0.64444, 0, 0],
  8728. "50": [0, 0.64444, 0, 0],
  8729. "51": [0, 0.64444, 0, 0],
  8730. "52": [0, 0.64444, 0, 0],
  8731. "53": [0, 0.64444, 0, 0],
  8732. "54": [0, 0.64444, 0, 0],
  8733. "55": [0, 0.64444, 0, 0],
  8734. "56": [0, 0.64444, 0, 0],
  8735. "57": [0, 0.64444, 0, 0],
  8736. "58": [0, 0.44444, 0, 0],
  8737. "59": [0.19444, 0.44444, 0, 0],
  8738. "60": [0.08556, 0.58556, 0, 0],
  8739. "61": [-0.10889, 0.39111, 0, 0],
  8740. "62": [0.08556, 0.58556, 0, 0],
  8741. "63": [0, 0.69444, 0, 0],
  8742. "64": [0, 0.69444, 0, 0],
  8743. "65": [0, 0.68611, 0, 0],
  8744. "66": [0, 0.68611, 0, 0],
  8745. "67": [0, 0.68611, 0, 0],
  8746. "68": [0, 0.68611, 0, 0],
  8747. "69": [0, 0.68611, 0, 0],
  8748. "70": [0, 0.68611, 0, 0],
  8749. "71": [0, 0.68611, 0, 0],
  8750. "72": [0, 0.68611, 0, 0],
  8751. "73": [0, 0.68611, 0, 0],
  8752. "74": [0, 0.68611, 0, 0],
  8753. "75": [0, 0.68611, 0, 0],
  8754. "76": [0, 0.68611, 0, 0],
  8755. "77": [0, 0.68611, 0, 0],
  8756. "78": [0, 0.68611, 0, 0],
  8757. "79": [0, 0.68611, 0, 0],
  8758. "80": [0, 0.68611, 0, 0],
  8759. "81": [0.19444, 0.68611, 0, 0],
  8760. "82": [0, 0.68611, 0, 0],
  8761. "83": [0, 0.68611, 0, 0],
  8762. "84": [0, 0.68611, 0, 0],
  8763. "85": [0, 0.68611, 0, 0],
  8764. "86": [0, 0.68611, 0.01597, 0],
  8765. "87": [0, 0.68611, 0.01597, 0],
  8766. "88": [0, 0.68611, 0, 0],
  8767. "89": [0, 0.68611, 0.02875, 0],
  8768. "90": [0, 0.68611, 0, 0],
  8769. "91": [0.25, 0.75, 0, 0],
  8770. "92": [0.25, 0.75, 0, 0],
  8771. "93": [0.25, 0.75, 0, 0],
  8772. "94": [0, 0.69444, 0, 0],
  8773. "95": [0.31, 0.13444, 0.03194, 0],
  8774. "96": [0, 0.69444, 0, 0],
  8775. "97": [0, 0.44444, 0, 0],
  8776. "98": [0, 0.69444, 0, 0],
  8777. "99": [0, 0.44444, 0, 0],
  8778. "100": [0, 0.69444, 0, 0],
  8779. "101": [0, 0.44444, 0, 0],
  8780. "102": [0, 0.69444, 0.10903, 0],
  8781. "103": [0.19444, 0.44444, 0.01597, 0],
  8782. "104": [0, 0.69444, 0, 0],
  8783. "105": [0, 0.69444, 0, 0],
  8784. "106": [0.19444, 0.69444, 0, 0],
  8785. "107": [0, 0.69444, 0, 0],
  8786. "108": [0, 0.69444, 0, 0],
  8787. "109": [0, 0.44444, 0, 0],
  8788. "110": [0, 0.44444, 0, 0],
  8789. "111": [0, 0.44444, 0, 0],
  8790. "112": [0.19444, 0.44444, 0, 0],
  8791. "113": [0.19444, 0.44444, 0, 0],
  8792. "114": [0, 0.44444, 0, 0],
  8793. "115": [0, 0.44444, 0, 0],
  8794. "116": [0, 0.63492, 0, 0],
  8795. "117": [0, 0.44444, 0, 0],
  8796. "118": [0, 0.44444, 0.01597, 0],
  8797. "119": [0, 0.44444, 0.01597, 0],
  8798. "120": [0, 0.44444, 0, 0],
  8799. "121": [0.19444, 0.44444, 0.01597, 0],
  8800. "122": [0, 0.44444, 0, 0],
  8801. "123": [0.25, 0.75, 0, 0],
  8802. "124": [0.25, 0.75, 0, 0],
  8803. "125": [0.25, 0.75, 0, 0],
  8804. "126": [0.35, 0.34444, 0, 0],
  8805. "168": [0, 0.69444, 0, 0],
  8806. "172": [0, 0.44444, 0, 0],
  8807. "175": [0, 0.59611, 0, 0],
  8808. "176": [0, 0.69444, 0, 0],
  8809. "177": [0.13333, 0.63333, 0, 0],
  8810. "180": [0, 0.69444, 0, 0],
  8811. "215": [0.13333, 0.63333, 0, 0],
  8812. "247": [0.13333, 0.63333, 0, 0],
  8813. "305": [0, 0.44444, 0, 0],
  8814. "567": [0.19444, 0.44444, 0, 0],
  8815. "710": [0, 0.69444, 0, 0],
  8816. "711": [0, 0.63194, 0, 0],
  8817. "713": [0, 0.59611, 0, 0],
  8818. "714": [0, 0.69444, 0, 0],
  8819. "715": [0, 0.69444, 0, 0],
  8820. "728": [0, 0.69444, 0, 0],
  8821. "729": [0, 0.69444, 0, 0],
  8822. "730": [0, 0.69444, 0, 0],
  8823. "732": [0, 0.69444, 0, 0],
  8824. "768": [0, 0.69444, 0, 0],
  8825. "769": [0, 0.69444, 0, 0],
  8826. "770": [0, 0.69444, 0, 0],
  8827. "771": [0, 0.69444, 0, 0],
  8828. "772": [0, 0.59611, 0, 0],
  8829. "774": [0, 0.69444, 0, 0],
  8830. "775": [0, 0.69444, 0, 0],
  8831. "776": [0, 0.69444, 0, 0],
  8832. "778": [0, 0.69444, 0, 0],
  8833. "779": [0, 0.69444, 0, 0],
  8834. "780": [0, 0.63194, 0, 0],
  8835. "824": [0.19444, 0.69444, 0, 0],
  8836. "915": [0, 0.68611, 0, 0],
  8837. "916": [0, 0.68611, 0, 0],
  8838. "920": [0, 0.68611, 0, 0],
  8839. "923": [0, 0.68611, 0, 0],
  8840. "926": [0, 0.68611, 0, 0],
  8841. "928": [0, 0.68611, 0, 0],
  8842. "931": [0, 0.68611, 0, 0],
  8843. "933": [0, 0.68611, 0, 0],
  8844. "934": [0, 0.68611, 0, 0],
  8845. "936": [0, 0.68611, 0, 0],
  8846. "937": [0, 0.68611, 0, 0],
  8847. "8211": [0, 0.44444, 0.03194, 0],
  8848. "8212": [0, 0.44444, 0.03194, 0],
  8849. "8216": [0, 0.69444, 0, 0],
  8850. "8217": [0, 0.69444, 0, 0],
  8851. "8220": [0, 0.69444, 0, 0],
  8852. "8221": [0, 0.69444, 0, 0],
  8853. "8224": [0.19444, 0.69444, 0, 0],
  8854. "8225": [0.19444, 0.69444, 0, 0],
  8855. "8242": [0, 0.55556, 0, 0],
  8856. "8407": [0, 0.72444, 0.15486, 0],
  8857. "8463": [0, 0.69444, 0, 0],
  8858. "8465": [0, 0.69444, 0, 0],
  8859. "8467": [0, 0.69444, 0, 0],
  8860. "8472": [0.19444, 0.44444, 0, 0],
  8861. "8476": [0, 0.69444, 0, 0],
  8862. "8501": [0, 0.69444, 0, 0],
  8863. "8592": [-0.10889, 0.39111, 0, 0],
  8864. "8593": [0.19444, 0.69444, 0, 0],
  8865. "8594": [-0.10889, 0.39111, 0, 0],
  8866. "8595": [0.19444, 0.69444, 0, 0],
  8867. "8596": [-0.10889, 0.39111, 0, 0],
  8868. "8597": [0.25, 0.75, 0, 0],
  8869. "8598": [0.19444, 0.69444, 0, 0],
  8870. "8599": [0.19444, 0.69444, 0, 0],
  8871. "8600": [0.19444, 0.69444, 0, 0],
  8872. "8601": [0.19444, 0.69444, 0, 0],
  8873. "8636": [-0.10889, 0.39111, 0, 0],
  8874. "8637": [-0.10889, 0.39111, 0, 0],
  8875. "8640": [-0.10889, 0.39111, 0, 0],
  8876. "8641": [-0.10889, 0.39111, 0, 0],
  8877. "8656": [-0.10889, 0.39111, 0, 0],
  8878. "8657": [0.19444, 0.69444, 0, 0],
  8879. "8658": [-0.10889, 0.39111, 0, 0],
  8880. "8659": [0.19444, 0.69444, 0, 0],
  8881. "8660": [-0.10889, 0.39111, 0, 0],
  8882. "8661": [0.25, 0.75, 0, 0],
  8883. "8704": [0, 0.69444, 0, 0],
  8884. "8706": [0, 0.69444, 0.06389, 0],
  8885. "8707": [0, 0.69444, 0, 0],
  8886. "8709": [0.05556, 0.75, 0, 0],
  8887. "8711": [0, 0.68611, 0, 0],
  8888. "8712": [0.08556, 0.58556, 0, 0],
  8889. "8715": [0.08556, 0.58556, 0, 0],
  8890. "8722": [0.13333, 0.63333, 0, 0],
  8891. "8723": [0.13333, 0.63333, 0, 0],
  8892. "8725": [0.25, 0.75, 0, 0],
  8893. "8726": [0.25, 0.75, 0, 0],
  8894. "8727": [-0.02778, 0.47222, 0, 0],
  8895. "8728": [-0.02639, 0.47361, 0, 0],
  8896. "8729": [-0.02639, 0.47361, 0, 0],
  8897. "8730": [0.18, 0.82, 0, 0],
  8898. "8733": [0, 0.44444, 0, 0],
  8899. "8734": [0, 0.44444, 0, 0],
  8900. "8736": [0, 0.69224, 0, 0],
  8901. "8739": [0.25, 0.75, 0, 0],
  8902. "8741": [0.25, 0.75, 0, 0],
  8903. "8743": [0, 0.55556, 0, 0],
  8904. "8744": [0, 0.55556, 0, 0],
  8905. "8745": [0, 0.55556, 0, 0],
  8906. "8746": [0, 0.55556, 0, 0],
  8907. "8747": [0.19444, 0.69444, 0.12778, 0],
  8908. "8764": [-0.10889, 0.39111, 0, 0],
  8909. "8768": [0.19444, 0.69444, 0, 0],
  8910. "8771": [0.00222, 0.50222, 0, 0],
  8911. "8776": [0.02444, 0.52444, 0, 0],
  8912. "8781": [0.00222, 0.50222, 0, 0],
  8913. "8801": [0.00222, 0.50222, 0, 0],
  8914. "8804": [0.19667, 0.69667, 0, 0],
  8915. "8805": [0.19667, 0.69667, 0, 0],
  8916. "8810": [0.08556, 0.58556, 0, 0],
  8917. "8811": [0.08556, 0.58556, 0, 0],
  8918. "8826": [0.08556, 0.58556, 0, 0],
  8919. "8827": [0.08556, 0.58556, 0, 0],
  8920. "8834": [0.08556, 0.58556, 0, 0],
  8921. "8835": [0.08556, 0.58556, 0, 0],
  8922. "8838": [0.19667, 0.69667, 0, 0],
  8923. "8839": [0.19667, 0.69667, 0, 0],
  8924. "8846": [0, 0.55556, 0, 0],
  8925. "8849": [0.19667, 0.69667, 0, 0],
  8926. "8850": [0.19667, 0.69667, 0, 0],
  8927. "8851": [0, 0.55556, 0, 0],
  8928. "8852": [0, 0.55556, 0, 0],
  8929. "8853": [0.13333, 0.63333, 0, 0],
  8930. "8854": [0.13333, 0.63333, 0, 0],
  8931. "8855": [0.13333, 0.63333, 0, 0],
  8932. "8856": [0.13333, 0.63333, 0, 0],
  8933. "8857": [0.13333, 0.63333, 0, 0],
  8934. "8866": [0, 0.69444, 0, 0],
  8935. "8867": [0, 0.69444, 0, 0],
  8936. "8868": [0, 0.69444, 0, 0],
  8937. "8869": [0, 0.69444, 0, 0],
  8938. "8900": [-0.02639, 0.47361, 0, 0],
  8939. "8901": [-0.02639, 0.47361, 0, 0],
  8940. "8902": [-0.02778, 0.47222, 0, 0],
  8941. "8968": [0.25, 0.75, 0, 0],
  8942. "8969": [0.25, 0.75, 0, 0],
  8943. "8970": [0.25, 0.75, 0, 0],
  8944. "8971": [0.25, 0.75, 0, 0],
  8945. "8994": [-0.13889, 0.36111, 0, 0],
  8946. "8995": [-0.13889, 0.36111, 0, 0],
  8947. "9651": [0.19444, 0.69444, 0, 0],
  8948. "9657": [-0.02778, 0.47222, 0, 0],
  8949. "9661": [0.19444, 0.69444, 0, 0],
  8950. "9667": [-0.02778, 0.47222, 0, 0],
  8951. "9711": [0.19444, 0.69444, 0, 0],
  8952. "9824": [0.12963, 0.69444, 0, 0],
  8953. "9825": [0.12963, 0.69444, 0, 0],
  8954. "9826": [0.12963, 0.69444, 0, 0],
  8955. "9827": [0.12963, 0.69444, 0, 0],
  8956. "9837": [0, 0.75, 0, 0],
  8957. "9838": [0.19444, 0.69444, 0, 0],
  8958. "9839": [0.19444, 0.69444, 0, 0],
  8959. "10216": [0.25, 0.75, 0, 0],
  8960. "10217": [0.25, 0.75, 0, 0],
  8961. "10815": [0, 0.68611, 0, 0],
  8962. "10927": [0.19667, 0.69667, 0, 0],
  8963. "10928": [0.19667, 0.69667, 0, 0]
  8964. },
  8965. "Main-Italic": {
  8966. "33": [0, 0.69444, 0.12417, 0],
  8967. "34": [0, 0.69444, 0.06961, 0],
  8968. "35": [0.19444, 0.69444, 0.06616, 0],
  8969. "37": [0.05556, 0.75, 0.13639, 0],
  8970. "38": [0, 0.69444, 0.09694, 0],
  8971. "39": [0, 0.69444, 0.12417, 0],
  8972. "40": [0.25, 0.75, 0.16194, 0],
  8973. "41": [0.25, 0.75, 0.03694, 0],
  8974. "42": [0, 0.75, 0.14917, 0],
  8975. "43": [0.05667, 0.56167, 0.03694, 0],
  8976. "44": [0.19444, 0.10556, 0, 0],
  8977. "45": [0, 0.43056, 0.02826, 0],
  8978. "46": [0, 0.10556, 0, 0],
  8979. "47": [0.25, 0.75, 0.16194, 0],
  8980. "48": [0, 0.64444, 0.13556, 0],
  8981. "49": [0, 0.64444, 0.13556, 0],
  8982. "50": [0, 0.64444, 0.13556, 0],
  8983. "51": [0, 0.64444, 0.13556, 0],
  8984. "52": [0.19444, 0.64444, 0.13556, 0],
  8985. "53": [0, 0.64444, 0.13556, 0],
  8986. "54": [0, 0.64444, 0.13556, 0],
  8987. "55": [0.19444, 0.64444, 0.13556, 0],
  8988. "56": [0, 0.64444, 0.13556, 0],
  8989. "57": [0, 0.64444, 0.13556, 0],
  8990. "58": [0, 0.43056, 0.0582, 0],
  8991. "59": [0.19444, 0.43056, 0.0582, 0],
  8992. "61": [-0.13313, 0.36687, 0.06616, 0],
  8993. "63": [0, 0.69444, 0.1225, 0],
  8994. "64": [0, 0.69444, 0.09597, 0],
  8995. "65": [0, 0.68333, 0, 0],
  8996. "66": [0, 0.68333, 0.10257, 0],
  8997. "67": [0, 0.68333, 0.14528, 0],
  8998. "68": [0, 0.68333, 0.09403, 0],
  8999. "69": [0, 0.68333, 0.12028, 0],
  9000. "70": [0, 0.68333, 0.13305, 0],
  9001. "71": [0, 0.68333, 0.08722, 0],
  9002. "72": [0, 0.68333, 0.16389, 0],
  9003. "73": [0, 0.68333, 0.15806, 0],
  9004. "74": [0, 0.68333, 0.14028, 0],
  9005. "75": [0, 0.68333, 0.14528, 0],
  9006. "76": [0, 0.68333, 0, 0],
  9007. "77": [0, 0.68333, 0.16389, 0],
  9008. "78": [0, 0.68333, 0.16389, 0],
  9009. "79": [0, 0.68333, 0.09403, 0],
  9010. "80": [0, 0.68333, 0.10257, 0],
  9011. "81": [0.19444, 0.68333, 0.09403, 0],
  9012. "82": [0, 0.68333, 0.03868, 0],
  9013. "83": [0, 0.68333, 0.11972, 0],
  9014. "84": [0, 0.68333, 0.13305, 0],
  9015. "85": [0, 0.68333, 0.16389, 0],
  9016. "86": [0, 0.68333, 0.18361, 0],
  9017. "87": [0, 0.68333, 0.18361, 0],
  9018. "88": [0, 0.68333, 0.15806, 0],
  9019. "89": [0, 0.68333, 0.19383, 0],
  9020. "90": [0, 0.68333, 0.14528, 0],
  9021. "91": [0.25, 0.75, 0.1875, 0],
  9022. "93": [0.25, 0.75, 0.10528, 0],
  9023. "94": [0, 0.69444, 0.06646, 0],
  9024. "95": [0.31, 0.12056, 0.09208, 0],
  9025. "97": [0, 0.43056, 0.07671, 0],
  9026. "98": [0, 0.69444, 0.06312, 0],
  9027. "99": [0, 0.43056, 0.05653, 0],
  9028. "100": [0, 0.69444, 0.10333, 0],
  9029. "101": [0, 0.43056, 0.07514, 0],
  9030. "102": [0.19444, 0.69444, 0.21194, 0],
  9031. "103": [0.19444, 0.43056, 0.08847, 0],
  9032. "104": [0, 0.69444, 0.07671, 0],
  9033. "105": [0, 0.65536, 0.1019, 0],
  9034. "106": [0.19444, 0.65536, 0.14467, 0],
  9035. "107": [0, 0.69444, 0.10764, 0],
  9036. "108": [0, 0.69444, 0.10333, 0],
  9037. "109": [0, 0.43056, 0.07671, 0],
  9038. "110": [0, 0.43056, 0.07671, 0],
  9039. "111": [0, 0.43056, 0.06312, 0],
  9040. "112": [0.19444, 0.43056, 0.06312, 0],
  9041. "113": [0.19444, 0.43056, 0.08847, 0],
  9042. "114": [0, 0.43056, 0.10764, 0],
  9043. "115": [0, 0.43056, 0.08208, 0],
  9044. "116": [0, 0.61508, 0.09486, 0],
  9045. "117": [0, 0.43056, 0.07671, 0],
  9046. "118": [0, 0.43056, 0.10764, 0],
  9047. "119": [0, 0.43056, 0.10764, 0],
  9048. "120": [0, 0.43056, 0.12042, 0],
  9049. "121": [0.19444, 0.43056, 0.08847, 0],
  9050. "122": [0, 0.43056, 0.12292, 0],
  9051. "126": [0.35, 0.31786, 0.11585, 0],
  9052. "163": [0, 0.69444, 0, 0],
  9053. "305": [0, 0.43056, 0, 0.02778],
  9054. "567": [0.19444, 0.43056, 0, 0.08334],
  9055. "768": [0, 0.69444, 0, 0],
  9056. "769": [0, 0.69444, 0.09694, 0],
  9057. "770": [0, 0.69444, 0.06646, 0],
  9058. "771": [0, 0.66786, 0.11585, 0],
  9059. "772": [0, 0.56167, 0.10333, 0],
  9060. "774": [0, 0.69444, 0.10806, 0],
  9061. "775": [0, 0.66786, 0.11752, 0],
  9062. "776": [0, 0.66786, 0.10474, 0],
  9063. "778": [0, 0.69444, 0, 0],
  9064. "779": [0, 0.69444, 0.1225, 0],
  9065. "780": [0, 0.62847, 0.08295, 0],
  9066. "915": [0, 0.68333, 0.13305, 0],
  9067. "916": [0, 0.68333, 0, 0],
  9068. "920": [0, 0.68333, 0.09403, 0],
  9069. "923": [0, 0.68333, 0, 0],
  9070. "926": [0, 0.68333, 0.15294, 0],
  9071. "928": [0, 0.68333, 0.16389, 0],
  9072. "931": [0, 0.68333, 0.12028, 0],
  9073. "933": [0, 0.68333, 0.11111, 0],
  9074. "934": [0, 0.68333, 0.05986, 0],
  9075. "936": [0, 0.68333, 0.11111, 0],
  9076. "937": [0, 0.68333, 0.10257, 0],
  9077. "8211": [0, 0.43056, 0.09208, 0],
  9078. "8212": [0, 0.43056, 0.09208, 0],
  9079. "8216": [0, 0.69444, 0.12417, 0],
  9080. "8217": [0, 0.69444, 0.12417, 0],
  9081. "8220": [0, 0.69444, 0.1685, 0],
  9082. "8221": [0, 0.69444, 0.06961, 0],
  9083. "8463": [0, 0.68889, 0, 0]
  9084. },
  9085. "Main-Regular": {
  9086. "32": [0, 0, 0, 0],
  9087. "33": [0, 0.69444, 0, 0],
  9088. "34": [0, 0.69444, 0, 0],
  9089. "35": [0.19444, 0.69444, 0, 0],
  9090. "36": [0.05556, 0.75, 0, 0],
  9091. "37": [0.05556, 0.75, 0, 0],
  9092. "38": [0, 0.69444, 0, 0],
  9093. "39": [0, 0.69444, 0, 0],
  9094. "40": [0.25, 0.75, 0, 0],
  9095. "41": [0.25, 0.75, 0, 0],
  9096. "42": [0, 0.75, 0, 0],
  9097. "43": [0.08333, 0.58333, 0, 0],
  9098. "44": [0.19444, 0.10556, 0, 0],
  9099. "45": [0, 0.43056, 0, 0],
  9100. "46": [0, 0.10556, 0, 0],
  9101. "47": [0.25, 0.75, 0, 0],
  9102. "48": [0, 0.64444, 0, 0],
  9103. "49": [0, 0.64444, 0, 0],
  9104. "50": [0, 0.64444, 0, 0],
  9105. "51": [0, 0.64444, 0, 0],
  9106. "52": [0, 0.64444, 0, 0],
  9107. "53": [0, 0.64444, 0, 0],
  9108. "54": [0, 0.64444, 0, 0],
  9109. "55": [0, 0.64444, 0, 0],
  9110. "56": [0, 0.64444, 0, 0],
  9111. "57": [0, 0.64444, 0, 0],
  9112. "58": [0, 0.43056, 0, 0],
  9113. "59": [0.19444, 0.43056, 0, 0],
  9114. "60": [0.0391, 0.5391, 0, 0],
  9115. "61": [-0.13313, 0.36687, 0, 0],
  9116. "62": [0.0391, 0.5391, 0, 0],
  9117. "63": [0, 0.69444, 0, 0],
  9118. "64": [0, 0.69444, 0, 0],
  9119. "65": [0, 0.68333, 0, 0],
  9120. "66": [0, 0.68333, 0, 0],
  9121. "67": [0, 0.68333, 0, 0],
  9122. "68": [0, 0.68333, 0, 0],
  9123. "69": [0, 0.68333, 0, 0],
  9124. "70": [0, 0.68333, 0, 0],
  9125. "71": [0, 0.68333, 0, 0],
  9126. "72": [0, 0.68333, 0, 0],
  9127. "73": [0, 0.68333, 0, 0],
  9128. "74": [0, 0.68333, 0, 0],
  9129. "75": [0, 0.68333, 0, 0],
  9130. "76": [0, 0.68333, 0, 0],
  9131. "77": [0, 0.68333, 0, 0],
  9132. "78": [0, 0.68333, 0, 0],
  9133. "79": [0, 0.68333, 0, 0],
  9134. "80": [0, 0.68333, 0, 0],
  9135. "81": [0.19444, 0.68333, 0, 0],
  9136. "82": [0, 0.68333, 0, 0],
  9137. "83": [0, 0.68333, 0, 0],
  9138. "84": [0, 0.68333, 0, 0],
  9139. "85": [0, 0.68333, 0, 0],
  9140. "86": [0, 0.68333, 0.01389, 0],
  9141. "87": [0, 0.68333, 0.01389, 0],
  9142. "88": [0, 0.68333, 0, 0],
  9143. "89": [0, 0.68333, 0.025, 0],
  9144. "90": [0, 0.68333, 0, 0],
  9145. "91": [0.25, 0.75, 0, 0],
  9146. "92": [0.25, 0.75, 0, 0],
  9147. "93": [0.25, 0.75, 0, 0],
  9148. "94": [0, 0.69444, 0, 0],
  9149. "95": [0.31, 0.12056, 0.02778, 0],
  9150. "96": [0, 0.69444, 0, 0],
  9151. "97": [0, 0.43056, 0, 0],
  9152. "98": [0, 0.69444, 0, 0],
  9153. "99": [0, 0.43056, 0, 0],
  9154. "100": [0, 0.69444, 0, 0],
  9155. "101": [0, 0.43056, 0, 0],
  9156. "102": [0, 0.69444, 0.07778, 0],
  9157. "103": [0.19444, 0.43056, 0.01389, 0],
  9158. "104": [0, 0.69444, 0, 0],
  9159. "105": [0, 0.66786, 0, 0],
  9160. "106": [0.19444, 0.66786, 0, 0],
  9161. "107": [0, 0.69444, 0, 0],
  9162. "108": [0, 0.69444, 0, 0],
  9163. "109": [0, 0.43056, 0, 0],
  9164. "110": [0, 0.43056, 0, 0],
  9165. "111": [0, 0.43056, 0, 0],
  9166. "112": [0.19444, 0.43056, 0, 0],
  9167. "113": [0.19444, 0.43056, 0, 0],
  9168. "114": [0, 0.43056, 0, 0],
  9169. "115": [0, 0.43056, 0, 0],
  9170. "116": [0, 0.61508, 0, 0],
  9171. "117": [0, 0.43056, 0, 0],
  9172. "118": [0, 0.43056, 0.01389, 0],
  9173. "119": [0, 0.43056, 0.01389, 0],
  9174. "120": [0, 0.43056, 0, 0],
  9175. "121": [0.19444, 0.43056, 0.01389, 0],
  9176. "122": [0, 0.43056, 0, 0],
  9177. "123": [0.25, 0.75, 0, 0],
  9178. "124": [0.25, 0.75, 0, 0],
  9179. "125": [0.25, 0.75, 0, 0],
  9180. "126": [0.35, 0.31786, 0, 0],
  9181. "160": [0, 0, 0, 0],
  9182. "168": [0, 0.66786, 0, 0],
  9183. "172": [0, 0.43056, 0, 0],
  9184. "175": [0, 0.56778, 0, 0],
  9185. "176": [0, 0.69444, 0, 0],
  9186. "177": [0.08333, 0.58333, 0, 0],
  9187. "180": [0, 0.69444, 0, 0],
  9188. "215": [0.08333, 0.58333, 0, 0],
  9189. "247": [0.08333, 0.58333, 0, 0],
  9190. "305": [0, 0.43056, 0, 0],
  9191. "567": [0.19444, 0.43056, 0, 0],
  9192. "710": [0, 0.69444, 0, 0],
  9193. "711": [0, 0.62847, 0, 0],
  9194. "713": [0, 0.56778, 0, 0],
  9195. "714": [0, 0.69444, 0, 0],
  9196. "715": [0, 0.69444, 0, 0],
  9197. "728": [0, 0.69444, 0, 0],
  9198. "729": [0, 0.66786, 0, 0],
  9199. "730": [0, 0.69444, 0, 0],
  9200. "732": [0, 0.66786, 0, 0],
  9201. "768": [0, 0.69444, 0, 0],
  9202. "769": [0, 0.69444, 0, 0],
  9203. "770": [0, 0.69444, 0, 0],
  9204. "771": [0, 0.66786, 0, 0],
  9205. "772": [0, 0.56778, 0, 0],
  9206. "774": [0, 0.69444, 0, 0],
  9207. "775": [0, 0.66786, 0, 0],
  9208. "776": [0, 0.66786, 0, 0],
  9209. "778": [0, 0.69444, 0, 0],
  9210. "779": [0, 0.69444, 0, 0],
  9211. "780": [0, 0.62847, 0, 0],
  9212. "824": [0.19444, 0.69444, 0, 0],
  9213. "915": [0, 0.68333, 0, 0],
  9214. "916": [0, 0.68333, 0, 0],
  9215. "920": [0, 0.68333, 0, 0],
  9216. "923": [0, 0.68333, 0, 0],
  9217. "926": [0, 0.68333, 0, 0],
  9218. "928": [0, 0.68333, 0, 0],
  9219. "931": [0, 0.68333, 0, 0],
  9220. "933": [0, 0.68333, 0, 0],
  9221. "934": [0, 0.68333, 0, 0],
  9222. "936": [0, 0.68333, 0, 0],
  9223. "937": [0, 0.68333, 0, 0],
  9224. "8211": [0, 0.43056, 0.02778, 0],
  9225. "8212": [0, 0.43056, 0.02778, 0],
  9226. "8216": [0, 0.69444, 0, 0],
  9227. "8217": [0, 0.69444, 0, 0],
  9228. "8220": [0, 0.69444, 0, 0],
  9229. "8221": [0, 0.69444, 0, 0],
  9230. "8224": [0.19444, 0.69444, 0, 0],
  9231. "8225": [0.19444, 0.69444, 0, 0],
  9232. "8230": [0, 0.12, 0, 0],
  9233. "8242": [0, 0.55556, 0, 0],
  9234. "8407": [0, 0.71444, 0.15382, 0],
  9235. "8463": [0, 0.68889, 0, 0],
  9236. "8465": [0, 0.69444, 0, 0],
  9237. "8467": [0, 0.69444, 0, 0.11111],
  9238. "8472": [0.19444, 0.43056, 0, 0.11111],
  9239. "8476": [0, 0.69444, 0, 0],
  9240. "8501": [0, 0.69444, 0, 0],
  9241. "8592": [-0.13313, 0.36687, 0, 0],
  9242. "8593": [0.19444, 0.69444, 0, 0],
  9243. "8594": [-0.13313, 0.36687, 0, 0],
  9244. "8595": [0.19444, 0.69444, 0, 0],
  9245. "8596": [-0.13313, 0.36687, 0, 0],
  9246. "8597": [0.25, 0.75, 0, 0],
  9247. "8598": [0.19444, 0.69444, 0, 0],
  9248. "8599": [0.19444, 0.69444, 0, 0],
  9249. "8600": [0.19444, 0.69444, 0, 0],
  9250. "8601": [0.19444, 0.69444, 0, 0],
  9251. "8614": [0.011, 0.511, 0, 0],
  9252. "8617": [0.011, 0.511, 0, 0],
  9253. "8618": [0.011, 0.511, 0, 0],
  9254. "8636": [-0.13313, 0.36687, 0, 0],
  9255. "8637": [-0.13313, 0.36687, 0, 0],
  9256. "8640": [-0.13313, 0.36687, 0, 0],
  9257. "8641": [-0.13313, 0.36687, 0, 0],
  9258. "8652": [0.011, 0.671, 0, 0],
  9259. "8656": [-0.13313, 0.36687, 0, 0],
  9260. "8657": [0.19444, 0.69444, 0, 0],
  9261. "8658": [-0.13313, 0.36687, 0, 0],
  9262. "8659": [0.19444, 0.69444, 0, 0],
  9263. "8660": [-0.13313, 0.36687, 0, 0],
  9264. "8661": [0.25, 0.75, 0, 0],
  9265. "8704": [0, 0.69444, 0, 0],
  9266. "8706": [0, 0.69444, 0.05556, 0.08334],
  9267. "8707": [0, 0.69444, 0, 0],
  9268. "8709": [0.05556, 0.75, 0, 0],
  9269. "8711": [0, 0.68333, 0, 0],
  9270. "8712": [0.0391, 0.5391, 0, 0],
  9271. "8715": [0.0391, 0.5391, 0, 0],
  9272. "8722": [0.08333, 0.58333, 0, 0],
  9273. "8723": [0.08333, 0.58333, 0, 0],
  9274. "8725": [0.25, 0.75, 0, 0],
  9275. "8726": [0.25, 0.75, 0, 0],
  9276. "8727": [-0.03472, 0.46528, 0, 0],
  9277. "8728": [-0.05555, 0.44445, 0, 0],
  9278. "8729": [-0.05555, 0.44445, 0, 0],
  9279. "8730": [0.2, 0.8, 0, 0],
  9280. "8733": [0, 0.43056, 0, 0],
  9281. "8734": [0, 0.43056, 0, 0],
  9282. "8736": [0, 0.69224, 0, 0],
  9283. "8739": [0.25, 0.75, 0, 0],
  9284. "8741": [0.25, 0.75, 0, 0],
  9285. "8743": [0, 0.55556, 0, 0],
  9286. "8744": [0, 0.55556, 0, 0],
  9287. "8745": [0, 0.55556, 0, 0],
  9288. "8746": [0, 0.55556, 0, 0],
  9289. "8747": [0.19444, 0.69444, 0.11111, 0],
  9290. "8764": [-0.13313, 0.36687, 0, 0],
  9291. "8768": [0.19444, 0.69444, 0, 0],
  9292. "8771": [-0.03625, 0.46375, 0, 0],
  9293. "8773": [-0.022, 0.589, 0, 0],
  9294. "8776": [-0.01688, 0.48312, 0, 0],
  9295. "8781": [-0.03625, 0.46375, 0, 0],
  9296. "8784": [-0.133, 0.67, 0, 0],
  9297. "8800": [0.215, 0.716, 0, 0],
  9298. "8801": [-0.03625, 0.46375, 0, 0],
  9299. "8804": [0.13597, 0.63597, 0, 0],
  9300. "8805": [0.13597, 0.63597, 0, 0],
  9301. "8810": [0.0391, 0.5391, 0, 0],
  9302. "8811": [0.0391, 0.5391, 0, 0],
  9303. "8826": [0.0391, 0.5391, 0, 0],
  9304. "8827": [0.0391, 0.5391, 0, 0],
  9305. "8834": [0.0391, 0.5391, 0, 0],
  9306. "8835": [0.0391, 0.5391, 0, 0],
  9307. "8838": [0.13597, 0.63597, 0, 0],
  9308. "8839": [0.13597, 0.63597, 0, 0],
  9309. "8846": [0, 0.55556, 0, 0],
  9310. "8849": [0.13597, 0.63597, 0, 0],
  9311. "8850": [0.13597, 0.63597, 0, 0],
  9312. "8851": [0, 0.55556, 0, 0],
  9313. "8852": [0, 0.55556, 0, 0],
  9314. "8853": [0.08333, 0.58333, 0, 0],
  9315. "8854": [0.08333, 0.58333, 0, 0],
  9316. "8855": [0.08333, 0.58333, 0, 0],
  9317. "8856": [0.08333, 0.58333, 0, 0],
  9318. "8857": [0.08333, 0.58333, 0, 0],
  9319. "8866": [0, 0.69444, 0, 0],
  9320. "8867": [0, 0.69444, 0, 0],
  9321. "8868": [0, 0.69444, 0, 0],
  9322. "8869": [0, 0.69444, 0, 0],
  9323. "8872": [0.249, 0.75, 0, 0],
  9324. "8900": [-0.05555, 0.44445, 0, 0],
  9325. "8901": [-0.05555, 0.44445, 0, 0],
  9326. "8902": [-0.03472, 0.46528, 0, 0],
  9327. "8904": [0.005, 0.505, 0, 0],
  9328. "8942": [0.03, 0.9, 0, 0],
  9329. "8943": [-0.19, 0.31, 0, 0],
  9330. "8945": [-0.1, 0.82, 0, 0],
  9331. "8968": [0.25, 0.75, 0, 0],
  9332. "8969": [0.25, 0.75, 0, 0],
  9333. "8970": [0.25, 0.75, 0, 0],
  9334. "8971": [0.25, 0.75, 0, 0],
  9335. "8994": [-0.14236, 0.35764, 0, 0],
  9336. "8995": [-0.14236, 0.35764, 0, 0],
  9337. "9136": [0.244, 0.744, 0, 0],
  9338. "9137": [0.244, 0.744, 0, 0],
  9339. "9651": [0.19444, 0.69444, 0, 0],
  9340. "9657": [-0.03472, 0.46528, 0, 0],
  9341. "9661": [0.19444, 0.69444, 0, 0],
  9342. "9667": [-0.03472, 0.46528, 0, 0],
  9343. "9711": [0.19444, 0.69444, 0, 0],
  9344. "9824": [0.12963, 0.69444, 0, 0],
  9345. "9825": [0.12963, 0.69444, 0, 0],
  9346. "9826": [0.12963, 0.69444, 0, 0],
  9347. "9827": [0.12963, 0.69444, 0, 0],
  9348. "9837": [0, 0.75, 0, 0],
  9349. "9838": [0.19444, 0.69444, 0, 0],
  9350. "9839": [0.19444, 0.69444, 0, 0],
  9351. "10216": [0.25, 0.75, 0, 0],
  9352. "10217": [0.25, 0.75, 0, 0],
  9353. "10222": [0.244, 0.744, 0, 0],
  9354. "10223": [0.244, 0.744, 0, 0],
  9355. "10229": [0.011, 0.511, 0, 0],
  9356. "10230": [0.011, 0.511, 0, 0],
  9357. "10231": [0.011, 0.511, 0, 0],
  9358. "10232": [0.024, 0.525, 0, 0],
  9359. "10233": [0.024, 0.525, 0, 0],
  9360. "10234": [0.024, 0.525, 0, 0],
  9361. "10236": [0.011, 0.511, 0, 0],
  9362. "10815": [0, 0.68333, 0, 0],
  9363. "10927": [0.13597, 0.63597, 0, 0],
  9364. "10928": [0.13597, 0.63597, 0, 0]
  9365. },
  9366. "Math-BoldItalic": {
  9367. "47": [0.19444, 0.69444, 0, 0],
  9368. "65": [0, 0.68611, 0, 0],
  9369. "66": [0, 0.68611, 0.04835, 0],
  9370. "67": [0, 0.68611, 0.06979, 0],
  9371. "68": [0, 0.68611, 0.03194, 0],
  9372. "69": [0, 0.68611, 0.05451, 0],
  9373. "70": [0, 0.68611, 0.15972, 0],
  9374. "71": [0, 0.68611, 0, 0],
  9375. "72": [0, 0.68611, 0.08229, 0],
  9376. "73": [0, 0.68611, 0.07778, 0],
  9377. "74": [0, 0.68611, 0.10069, 0],
  9378. "75": [0, 0.68611, 0.06979, 0],
  9379. "76": [0, 0.68611, 0, 0],
  9380. "77": [0, 0.68611, 0.11424, 0],
  9381. "78": [0, 0.68611, 0.11424, 0],
  9382. "79": [0, 0.68611, 0.03194, 0],
  9383. "80": [0, 0.68611, 0.15972, 0],
  9384. "81": [0.19444, 0.68611, 0, 0],
  9385. "82": [0, 0.68611, 0.00421, 0],
  9386. "83": [0, 0.68611, 0.05382, 0],
  9387. "84": [0, 0.68611, 0.15972, 0],
  9388. "85": [0, 0.68611, 0.11424, 0],
  9389. "86": [0, 0.68611, 0.25555, 0],
  9390. "87": [0, 0.68611, 0.15972, 0],
  9391. "88": [0, 0.68611, 0.07778, 0],
  9392. "89": [0, 0.68611, 0.25555, 0],
  9393. "90": [0, 0.68611, 0.06979, 0],
  9394. "97": [0, 0.44444, 0, 0],
  9395. "98": [0, 0.69444, 0, 0],
  9396. "99": [0, 0.44444, 0, 0],
  9397. "100": [0, 0.69444, 0, 0],
  9398. "101": [0, 0.44444, 0, 0],
  9399. "102": [0.19444, 0.69444, 0.11042, 0],
  9400. "103": [0.19444, 0.44444, 0.03704, 0],
  9401. "104": [0, 0.69444, 0, 0],
  9402. "105": [0, 0.69326, 0, 0],
  9403. "106": [0.19444, 0.69326, 0.0622, 0],
  9404. "107": [0, 0.69444, 0.01852, 0],
  9405. "108": [0, 0.69444, 0.0088, 0],
  9406. "109": [0, 0.44444, 0, 0],
  9407. "110": [0, 0.44444, 0, 0],
  9408. "111": [0, 0.44444, 0, 0],
  9409. "112": [0.19444, 0.44444, 0, 0],
  9410. "113": [0.19444, 0.44444, 0.03704, 0],
  9411. "114": [0, 0.44444, 0.03194, 0],
  9412. "115": [0, 0.44444, 0, 0],
  9413. "116": [0, 0.63492, 0, 0],
  9414. "117": [0, 0.44444, 0, 0],
  9415. "118": [0, 0.44444, 0.03704, 0],
  9416. "119": [0, 0.44444, 0.02778, 0],
  9417. "120": [0, 0.44444, 0, 0],
  9418. "121": [0.19444, 0.44444, 0.03704, 0],
  9419. "122": [0, 0.44444, 0.04213, 0],
  9420. "915": [0, 0.68611, 0.15972, 0],
  9421. "916": [0, 0.68611, 0, 0],
  9422. "920": [0, 0.68611, 0.03194, 0],
  9423. "923": [0, 0.68611, 0, 0],
  9424. "926": [0, 0.68611, 0.07458, 0],
  9425. "928": [0, 0.68611, 0.08229, 0],
  9426. "931": [0, 0.68611, 0.05451, 0],
  9427. "933": [0, 0.68611, 0.15972, 0],
  9428. "934": [0, 0.68611, 0, 0],
  9429. "936": [0, 0.68611, 0.11653, 0],
  9430. "937": [0, 0.68611, 0.04835, 0],
  9431. "945": [0, 0.44444, 0, 0],
  9432. "946": [0.19444, 0.69444, 0.03403, 0],
  9433. "947": [0.19444, 0.44444, 0.06389, 0],
  9434. "948": [0, 0.69444, 0.03819, 0],
  9435. "949": [0, 0.44444, 0, 0],
  9436. "950": [0.19444, 0.69444, 0.06215, 0],
  9437. "951": [0.19444, 0.44444, 0.03704, 0],
  9438. "952": [0, 0.69444, 0.03194, 0],
  9439. "953": [0, 0.44444, 0, 0],
  9440. "954": [0, 0.44444, 0, 0],
  9441. "955": [0, 0.69444, 0, 0],
  9442. "956": [0.19444, 0.44444, 0, 0],
  9443. "957": [0, 0.44444, 0.06898, 0],
  9444. "958": [0.19444, 0.69444, 0.03021, 0],
  9445. "959": [0, 0.44444, 0, 0],
  9446. "960": [0, 0.44444, 0.03704, 0],
  9447. "961": [0.19444, 0.44444, 0, 0],
  9448. "962": [0.09722, 0.44444, 0.07917, 0],
  9449. "963": [0, 0.44444, 0.03704, 0],
  9450. "964": [0, 0.44444, 0.13472, 0],
  9451. "965": [0, 0.44444, 0.03704, 0],
  9452. "966": [0.19444, 0.44444, 0, 0],
  9453. "967": [0.19444, 0.44444, 0, 0],
  9454. "968": [0.19444, 0.69444, 0.03704, 0],
  9455. "969": [0, 0.44444, 0.03704, 0],
  9456. "977": [0, 0.69444, 0, 0],
  9457. "981": [0.19444, 0.69444, 0, 0],
  9458. "982": [0, 0.44444, 0.03194, 0],
  9459. "1009": [0.19444, 0.44444, 0, 0],
  9460. "1013": [0, 0.44444, 0, 0]
  9461. },
  9462. "Math-Italic": {
  9463. "47": [0.19444, 0.69444, 0, 0],
  9464. "65": [0, 0.68333, 0, 0.13889],
  9465. "66": [0, 0.68333, 0.05017, 0.08334],
  9466. "67": [0, 0.68333, 0.07153, 0.08334],
  9467. "68": [0, 0.68333, 0.02778, 0.05556],
  9468. "69": [0, 0.68333, 0.05764, 0.08334],
  9469. "70": [0, 0.68333, 0.13889, 0.08334],
  9470. "71": [0, 0.68333, 0, 0.08334],
  9471. "72": [0, 0.68333, 0.08125, 0.05556],
  9472. "73": [0, 0.68333, 0.07847, 0.11111],
  9473. "74": [0, 0.68333, 0.09618, 0.16667],
  9474. "75": [0, 0.68333, 0.07153, 0.05556],
  9475. "76": [0, 0.68333, 0, 0.02778],
  9476. "77": [0, 0.68333, 0.10903, 0.08334],
  9477. "78": [0, 0.68333, 0.10903, 0.08334],
  9478. "79": [0, 0.68333, 0.02778, 0.08334],
  9479. "80": [0, 0.68333, 0.13889, 0.08334],
  9480. "81": [0.19444, 0.68333, 0, 0.08334],
  9481. "82": [0, 0.68333, 0.00773, 0.08334],
  9482. "83": [0, 0.68333, 0.05764, 0.08334],
  9483. "84": [0, 0.68333, 0.13889, 0.08334],
  9484. "85": [0, 0.68333, 0.10903, 0.02778],
  9485. "86": [0, 0.68333, 0.22222, 0],
  9486. "87": [0, 0.68333, 0.13889, 0],
  9487. "88": [0, 0.68333, 0.07847, 0.08334],
  9488. "89": [0, 0.68333, 0.22222, 0],
  9489. "90": [0, 0.68333, 0.07153, 0.08334],
  9490. "97": [0, 0.43056, 0, 0],
  9491. "98": [0, 0.69444, 0, 0],
  9492. "99": [0, 0.43056, 0, 0.05556],
  9493. "100": [0, 0.69444, 0, 0.16667],
  9494. "101": [0, 0.43056, 0, 0.05556],
  9495. "102": [0.19444, 0.69444, 0.10764, 0.16667],
  9496. "103": [0.19444, 0.43056, 0.03588, 0.02778],
  9497. "104": [0, 0.69444, 0, 0],
  9498. "105": [0, 0.65952, 0, 0],
  9499. "106": [0.19444, 0.65952, 0.05724, 0],
  9500. "107": [0, 0.69444, 0.03148, 0],
  9501. "108": [0, 0.69444, 0.01968, 0.08334],
  9502. "109": [0, 0.43056, 0, 0],
  9503. "110": [0, 0.43056, 0, 0],
  9504. "111": [0, 0.43056, 0, 0.05556],
  9505. "112": [0.19444, 0.43056, 0, 0.08334],
  9506. "113": [0.19444, 0.43056, 0.03588, 0.08334],
  9507. "114": [0, 0.43056, 0.02778, 0.05556],
  9508. "115": [0, 0.43056, 0, 0.05556],
  9509. "116": [0, 0.61508, 0, 0.08334],
  9510. "117": [0, 0.43056, 0, 0.02778],
  9511. "118": [0, 0.43056, 0.03588, 0.02778],
  9512. "119": [0, 0.43056, 0.02691, 0.08334],
  9513. "120": [0, 0.43056, 0, 0.02778],
  9514. "121": [0.19444, 0.43056, 0.03588, 0.05556],
  9515. "122": [0, 0.43056, 0.04398, 0.05556],
  9516. "915": [0, 0.68333, 0.13889, 0.08334],
  9517. "916": [0, 0.68333, 0, 0.16667],
  9518. "920": [0, 0.68333, 0.02778, 0.08334],
  9519. "923": [0, 0.68333, 0, 0.16667],
  9520. "926": [0, 0.68333, 0.07569, 0.08334],
  9521. "928": [0, 0.68333, 0.08125, 0.05556],
  9522. "931": [0, 0.68333, 0.05764, 0.08334],
  9523. "933": [0, 0.68333, 0.13889, 0.05556],
  9524. "934": [0, 0.68333, 0, 0.08334],
  9525. "936": [0, 0.68333, 0.11, 0.05556],
  9526. "937": [0, 0.68333, 0.05017, 0.08334],
  9527. "945": [0, 0.43056, 0.0037, 0.02778],
  9528. "946": [0.19444, 0.69444, 0.05278, 0.08334],
  9529. "947": [0.19444, 0.43056, 0.05556, 0],
  9530. "948": [0, 0.69444, 0.03785, 0.05556],
  9531. "949": [0, 0.43056, 0, 0.08334],
  9532. "950": [0.19444, 0.69444, 0.07378, 0.08334],
  9533. "951": [0.19444, 0.43056, 0.03588, 0.05556],
  9534. "952": [0, 0.69444, 0.02778, 0.08334],
  9535. "953": [0, 0.43056, 0, 0.05556],
  9536. "954": [0, 0.43056, 0, 0],
  9537. "955": [0, 0.69444, 0, 0],
  9538. "956": [0.19444, 0.43056, 0, 0.02778],
  9539. "957": [0, 0.43056, 0.06366, 0.02778],
  9540. "958": [0.19444, 0.69444, 0.04601, 0.11111],
  9541. "959": [0, 0.43056, 0, 0.05556],
  9542. "960": [0, 0.43056, 0.03588, 0],
  9543. "961": [0.19444, 0.43056, 0, 0.08334],
  9544. "962": [0.09722, 0.43056, 0.07986, 0.08334],
  9545. "963": [0, 0.43056, 0.03588, 0],
  9546. "964": [0, 0.43056, 0.1132, 0.02778],
  9547. "965": [0, 0.43056, 0.03588, 0.02778],
  9548. "966": [0.19444, 0.43056, 0, 0.08334],
  9549. "967": [0.19444, 0.43056, 0, 0.05556],
  9550. "968": [0.19444, 0.69444, 0.03588, 0.11111],
  9551. "969": [0, 0.43056, 0.03588, 0],
  9552. "977": [0, 0.69444, 0, 0.08334],
  9553. "981": [0.19444, 0.69444, 0, 0.08334],
  9554. "982": [0, 0.43056, 0.02778, 0],
  9555. "1009": [0.19444, 0.43056, 0, 0.08334],
  9556. "1013": [0, 0.43056, 0, 0.05556]
  9557. },
  9558. "Math-Regular": {
  9559. "65": [0, 0.68333, 0, 0.13889],
  9560. "66": [0, 0.68333, 0.05017, 0.08334],
  9561. "67": [0, 0.68333, 0.07153, 0.08334],
  9562. "68": [0, 0.68333, 0.02778, 0.05556],
  9563. "69": [0, 0.68333, 0.05764, 0.08334],
  9564. "70": [0, 0.68333, 0.13889, 0.08334],
  9565. "71": [0, 0.68333, 0, 0.08334],
  9566. "72": [0, 0.68333, 0.08125, 0.05556],
  9567. "73": [0, 0.68333, 0.07847, 0.11111],
  9568. "74": [0, 0.68333, 0.09618, 0.16667],
  9569. "75": [0, 0.68333, 0.07153, 0.05556],
  9570. "76": [0, 0.68333, 0, 0.02778],
  9571. "77": [0, 0.68333, 0.10903, 0.08334],
  9572. "78": [0, 0.68333, 0.10903, 0.08334],
  9573. "79": [0, 0.68333, 0.02778, 0.08334],
  9574. "80": [0, 0.68333, 0.13889, 0.08334],
  9575. "81": [0.19444, 0.68333, 0, 0.08334],
  9576. "82": [0, 0.68333, 0.00773, 0.08334],
  9577. "83": [0, 0.68333, 0.05764, 0.08334],
  9578. "84": [0, 0.68333, 0.13889, 0.08334],
  9579. "85": [0, 0.68333, 0.10903, 0.02778],
  9580. "86": [0, 0.68333, 0.22222, 0],
  9581. "87": [0, 0.68333, 0.13889, 0],
  9582. "88": [0, 0.68333, 0.07847, 0.08334],
  9583. "89": [0, 0.68333, 0.22222, 0],
  9584. "90": [0, 0.68333, 0.07153, 0.08334],
  9585. "97": [0, 0.43056, 0, 0],
  9586. "98": [0, 0.69444, 0, 0],
  9587. "99": [0, 0.43056, 0, 0.05556],
  9588. "100": [0, 0.69444, 0, 0.16667],
  9589. "101": [0, 0.43056, 0, 0.05556],
  9590. "102": [0.19444, 0.69444, 0.10764, 0.16667],
  9591. "103": [0.19444, 0.43056, 0.03588, 0.02778],
  9592. "104": [0, 0.69444, 0, 0],
  9593. "105": [0, 0.65952, 0, 0],
  9594. "106": [0.19444, 0.65952, 0.05724, 0],
  9595. "107": [0, 0.69444, 0.03148, 0],
  9596. "108": [0, 0.69444, 0.01968, 0.08334],
  9597. "109": [0, 0.43056, 0, 0],
  9598. "110": [0, 0.43056, 0, 0],
  9599. "111": [0, 0.43056, 0, 0.05556],
  9600. "112": [0.19444, 0.43056, 0, 0.08334],
  9601. "113": [0.19444, 0.43056, 0.03588, 0.08334],
  9602. "114": [0, 0.43056, 0.02778, 0.05556],
  9603. "115": [0, 0.43056, 0, 0.05556],
  9604. "116": [0, 0.61508, 0, 0.08334],
  9605. "117": [0, 0.43056, 0, 0.02778],
  9606. "118": [0, 0.43056, 0.03588, 0.02778],
  9607. "119": [0, 0.43056, 0.02691, 0.08334],
  9608. "120": [0, 0.43056, 0, 0.02778],
  9609. "121": [0.19444, 0.43056, 0.03588, 0.05556],
  9610. "122": [0, 0.43056, 0.04398, 0.05556],
  9611. "915": [0, 0.68333, 0.13889, 0.08334],
  9612. "916": [0, 0.68333, 0, 0.16667],
  9613. "920": [0, 0.68333, 0.02778, 0.08334],
  9614. "923": [0, 0.68333, 0, 0.16667],
  9615. "926": [0, 0.68333, 0.07569, 0.08334],
  9616. "928": [0, 0.68333, 0.08125, 0.05556],
  9617. "931": [0, 0.68333, 0.05764, 0.08334],
  9618. "933": [0, 0.68333, 0.13889, 0.05556],
  9619. "934": [0, 0.68333, 0, 0.08334],
  9620. "936": [0, 0.68333, 0.11, 0.05556],
  9621. "937": [0, 0.68333, 0.05017, 0.08334],
  9622. "945": [0, 0.43056, 0.0037, 0.02778],
  9623. "946": [0.19444, 0.69444, 0.05278, 0.08334],
  9624. "947": [0.19444, 0.43056, 0.05556, 0],
  9625. "948": [0, 0.69444, 0.03785, 0.05556],
  9626. "949": [0, 0.43056, 0, 0.08334],
  9627. "950": [0.19444, 0.69444, 0.07378, 0.08334],
  9628. "951": [0.19444, 0.43056, 0.03588, 0.05556],
  9629. "952": [0, 0.69444, 0.02778, 0.08334],
  9630. "953": [0, 0.43056, 0, 0.05556],
  9631. "954": [0, 0.43056, 0, 0],
  9632. "955": [0, 0.69444, 0, 0],
  9633. "956": [0.19444, 0.43056, 0, 0.02778],
  9634. "957": [0, 0.43056, 0.06366, 0.02778],
  9635. "958": [0.19444, 0.69444, 0.04601, 0.11111],
  9636. "959": [0, 0.43056, 0, 0.05556],
  9637. "960": [0, 0.43056, 0.03588, 0],
  9638. "961": [0.19444, 0.43056, 0, 0.08334],
  9639. "962": [0.09722, 0.43056, 0.07986, 0.08334],
  9640. "963": [0, 0.43056, 0.03588, 0],
  9641. "964": [0, 0.43056, 0.1132, 0.02778],
  9642. "965": [0, 0.43056, 0.03588, 0.02778],
  9643. "966": [0.19444, 0.43056, 0, 0.08334],
  9644. "967": [0.19444, 0.43056, 0, 0.05556],
  9645. "968": [0.19444, 0.69444, 0.03588, 0.11111],
  9646. "969": [0, 0.43056, 0.03588, 0],
  9647. "977": [0, 0.69444, 0, 0.08334],
  9648. "981": [0.19444, 0.69444, 0, 0.08334],
  9649. "982": [0, 0.43056, 0.02778, 0],
  9650. "1009": [0.19444, 0.43056, 0, 0.08334],
  9651. "1013": [0, 0.43056, 0, 0.05556]
  9652. },
  9653. "SansSerif-Regular": {
  9654. "33": [0, 0.69444, 0, 0],
  9655. "34": [0, 0.69444, 0, 0],
  9656. "35": [0.19444, 0.69444, 0, 0],
  9657. "36": [0.05556, 0.75, 0, 0],
  9658. "37": [0.05556, 0.75, 0, 0],
  9659. "38": [0, 0.69444, 0, 0],
  9660. "39": [0, 0.69444, 0, 0],
  9661. "40": [0.25, 0.75, 0, 0],
  9662. "41": [0.25, 0.75, 0, 0],
  9663. "42": [0, 0.75, 0, 0],
  9664. "43": [0.08333, 0.58333, 0, 0],
  9665. "44": [0.125, 0.08333, 0, 0],
  9666. "45": [0, 0.44444, 0, 0],
  9667. "46": [0, 0.08333, 0, 0],
  9668. "47": [0.25, 0.75, 0, 0],
  9669. "48": [0, 0.65556, 0, 0],
  9670. "49": [0, 0.65556, 0, 0],
  9671. "50": [0, 0.65556, 0, 0],
  9672. "51": [0, 0.65556, 0, 0],
  9673. "52": [0, 0.65556, 0, 0],
  9674. "53": [0, 0.65556, 0, 0],
  9675. "54": [0, 0.65556, 0, 0],
  9676. "55": [0, 0.65556, 0, 0],
  9677. "56": [0, 0.65556, 0, 0],
  9678. "57": [0, 0.65556, 0, 0],
  9679. "58": [0, 0.44444, 0, 0],
  9680. "59": [0.125, 0.44444, 0, 0],
  9681. "61": [-0.13, 0.37, 0, 0],
  9682. "63": [0, 0.69444, 0, 0],
  9683. "64": [0, 0.69444, 0, 0],
  9684. "65": [0, 0.69444, 0, 0],
  9685. "66": [0, 0.69444, 0, 0],
  9686. "67": [0, 0.69444, 0, 0],
  9687. "68": [0, 0.69444, 0, 0],
  9688. "69": [0, 0.69444, 0, 0],
  9689. "70": [0, 0.69444, 0, 0],
  9690. "71": [0, 0.69444, 0, 0],
  9691. "72": [0, 0.69444, 0, 0],
  9692. "73": [0, 0.69444, 0, 0],
  9693. "74": [0, 0.69444, 0, 0],
  9694. "75": [0, 0.69444, 0, 0],
  9695. "76": [0, 0.69444, 0, 0],
  9696. "77": [0, 0.69444, 0, 0],
  9697. "78": [0, 0.69444, 0, 0],
  9698. "79": [0, 0.69444, 0, 0],
  9699. "80": [0, 0.69444, 0, 0],
  9700. "81": [0.125, 0.69444, 0, 0],
  9701. "82": [0, 0.69444, 0, 0],
  9702. "83": [0, 0.69444, 0, 0],
  9703. "84": [0, 0.69444, 0, 0],
  9704. "85": [0, 0.69444, 0, 0],
  9705. "86": [0, 0.69444, 0.01389, 0],
  9706. "87": [0, 0.69444, 0.01389, 0],
  9707. "88": [0, 0.69444, 0, 0],
  9708. "89": [0, 0.69444, 0.025, 0],
  9709. "90": [0, 0.69444, 0, 0],
  9710. "91": [0.25, 0.75, 0, 0],
  9711. "93": [0.25, 0.75, 0, 0],
  9712. "94": [0, 0.69444, 0, 0],
  9713. "95": [0.35, 0.09444, 0.02778, 0],
  9714. "97": [0, 0.44444, 0, 0],
  9715. "98": [0, 0.69444, 0, 0],
  9716. "99": [0, 0.44444, 0, 0],
  9717. "100": [0, 0.69444, 0, 0],
  9718. "101": [0, 0.44444, 0, 0],
  9719. "102": [0, 0.69444, 0.06944, 0],
  9720. "103": [0.19444, 0.44444, 0.01389, 0],
  9721. "104": [0, 0.69444, 0, 0],
  9722. "105": [0, 0.67937, 0, 0],
  9723. "106": [0.19444, 0.67937, 0, 0],
  9724. "107": [0, 0.69444, 0, 0],
  9725. "108": [0, 0.69444, 0, 0],
  9726. "109": [0, 0.44444, 0, 0],
  9727. "110": [0, 0.44444, 0, 0],
  9728. "111": [0, 0.44444, 0, 0],
  9729. "112": [0.19444, 0.44444, 0, 0],
  9730. "113": [0.19444, 0.44444, 0, 0],
  9731. "114": [0, 0.44444, 0.01389, 0],
  9732. "115": [0, 0.44444, 0, 0],
  9733. "116": [0, 0.57143, 0, 0],
  9734. "117": [0, 0.44444, 0, 0],
  9735. "118": [0, 0.44444, 0.01389, 0],
  9736. "119": [0, 0.44444, 0.01389, 0],
  9737. "120": [0, 0.44444, 0, 0],
  9738. "121": [0.19444, 0.44444, 0.01389, 0],
  9739. "122": [0, 0.44444, 0, 0],
  9740. "126": [0.35, 0.32659, 0, 0],
  9741. "305": [0, 0.44444, 0, 0],
  9742. "567": [0.19444, 0.44444, 0, 0],
  9743. "768": [0, 0.69444, 0, 0],
  9744. "769": [0, 0.69444, 0, 0],
  9745. "770": [0, 0.69444, 0, 0],
  9746. "771": [0, 0.67659, 0, 0],
  9747. "772": [0, 0.60889, 0, 0],
  9748. "774": [0, 0.69444, 0, 0],
  9749. "775": [0, 0.67937, 0, 0],
  9750. "776": [0, 0.67937, 0, 0],
  9751. "778": [0, 0.69444, 0, 0],
  9752. "779": [0, 0.69444, 0, 0],
  9753. "780": [0, 0.63194, 0, 0],
  9754. "915": [0, 0.69444, 0, 0],
  9755. "916": [0, 0.69444, 0, 0],
  9756. "920": [0, 0.69444, 0, 0],
  9757. "923": [0, 0.69444, 0, 0],
  9758. "926": [0, 0.69444, 0, 0],
  9759. "928": [0, 0.69444, 0, 0],
  9760. "931": [0, 0.69444, 0, 0],
  9761. "933": [0, 0.69444, 0, 0],
  9762. "934": [0, 0.69444, 0, 0],
  9763. "936": [0, 0.69444, 0, 0],
  9764. "937": [0, 0.69444, 0, 0],
  9765. "8211": [0, 0.44444, 0.02778, 0],
  9766. "8212": [0, 0.44444, 0.02778, 0],
  9767. "8216": [0, 0.69444, 0, 0],
  9768. "8217": [0, 0.69444, 0, 0],
  9769. "8220": [0, 0.69444, 0, 0],
  9770. "8221": [0, 0.69444, 0, 0]
  9771. },
  9772. "Script-Regular": {
  9773. "65": [0, 0.7, 0.22925, 0],
  9774. "66": [0, 0.7, 0.04087, 0],
  9775. "67": [0, 0.7, 0.1689, 0],
  9776. "68": [0, 0.7, 0.09371, 0],
  9777. "69": [0, 0.7, 0.18583, 0],
  9778. "70": [0, 0.7, 0.13634, 0],
  9779. "71": [0, 0.7, 0.17322, 0],
  9780. "72": [0, 0.7, 0.29694, 0],
  9781. "73": [0, 0.7, 0.19189, 0],
  9782. "74": [0.27778, 0.7, 0.19189, 0],
  9783. "75": [0, 0.7, 0.31259, 0],
  9784. "76": [0, 0.7, 0.19189, 0],
  9785. "77": [0, 0.7, 0.15981, 0],
  9786. "78": [0, 0.7, 0.3525, 0],
  9787. "79": [0, 0.7, 0.08078, 0],
  9788. "80": [0, 0.7, 0.08078, 0],
  9789. "81": [0, 0.7, 0.03305, 0],
  9790. "82": [0, 0.7, 0.06259, 0],
  9791. "83": [0, 0.7, 0.19189, 0],
  9792. "84": [0, 0.7, 0.29087, 0],
  9793. "85": [0, 0.7, 0.25815, 0],
  9794. "86": [0, 0.7, 0.27523, 0],
  9795. "87": [0, 0.7, 0.27523, 0],
  9796. "88": [0, 0.7, 0.26006, 0],
  9797. "89": [0, 0.7, 0.2939, 0],
  9798. "90": [0, 0.7, 0.24037, 0]
  9799. },
  9800. "Size1-Regular": {
  9801. "40": [0.35001, 0.85, 0, 0],
  9802. "41": [0.35001, 0.85, 0, 0],
  9803. "47": [0.35001, 0.85, 0, 0],
  9804. "91": [0.35001, 0.85, 0, 0],
  9805. "92": [0.35001, 0.85, 0, 0],
  9806. "93": [0.35001, 0.85, 0, 0],
  9807. "123": [0.35001, 0.85, 0, 0],
  9808. "125": [0.35001, 0.85, 0, 0],
  9809. "710": [0, 0.72222, 0, 0],
  9810. "732": [0, 0.72222, 0, 0],
  9811. "770": [0, 0.72222, 0, 0],
  9812. "771": [0, 0.72222, 0, 0],
  9813. "8214": [-0.00099, 0.601, 0, 0],
  9814. "8593": [1e-05, 0.6, 0, 0],
  9815. "8595": [1e-05, 0.6, 0, 0],
  9816. "8657": [1e-05, 0.6, 0, 0],
  9817. "8659": [1e-05, 0.6, 0, 0],
  9818. "8719": [0.25001, 0.75, 0, 0],
  9819. "8720": [0.25001, 0.75, 0, 0],
  9820. "8721": [0.25001, 0.75, 0, 0],
  9821. "8730": [0.35001, 0.85, 0, 0],
  9822. "8739": [-0.00599, 0.606, 0, 0],
  9823. "8741": [-0.00599, 0.606, 0, 0],
  9824. "8747": [0.30612, 0.805, 0.19445, 0],
  9825. "8748": [0.306, 0.805, 0.19445, 0],
  9826. "8749": [0.306, 0.805, 0.19445, 0],
  9827. "8750": [0.30612, 0.805, 0.19445, 0],
  9828. "8896": [0.25001, 0.75, 0, 0],
  9829. "8897": [0.25001, 0.75, 0, 0],
  9830. "8898": [0.25001, 0.75, 0, 0],
  9831. "8899": [0.25001, 0.75, 0, 0],
  9832. "8968": [0.35001, 0.85, 0, 0],
  9833. "8969": [0.35001, 0.85, 0, 0],
  9834. "8970": [0.35001, 0.85, 0, 0],
  9835. "8971": [0.35001, 0.85, 0, 0],
  9836. "9168": [-0.00099, 0.601, 0, 0],
  9837. "10216": [0.35001, 0.85, 0, 0],
  9838. "10217": [0.35001, 0.85, 0, 0],
  9839. "10752": [0.25001, 0.75, 0, 0],
  9840. "10753": [0.25001, 0.75, 0, 0],
  9841. "10754": [0.25001, 0.75, 0, 0],
  9842. "10756": [0.25001, 0.75, 0, 0],
  9843. "10758": [0.25001, 0.75, 0, 0]
  9844. },
  9845. "Size2-Regular": {
  9846. "40": [0.65002, 1.15, 0, 0],
  9847. "41": [0.65002, 1.15, 0, 0],
  9848. "47": [0.65002, 1.15, 0, 0],
  9849. "91": [0.65002, 1.15, 0, 0],
  9850. "92": [0.65002, 1.15, 0, 0],
  9851. "93": [0.65002, 1.15, 0, 0],
  9852. "123": [0.65002, 1.15, 0, 0],
  9853. "125": [0.65002, 1.15, 0, 0],
  9854. "710": [0, 0.75, 0, 0],
  9855. "732": [0, 0.75, 0, 0],
  9856. "770": [0, 0.75, 0, 0],
  9857. "771": [0, 0.75, 0, 0],
  9858. "8719": [0.55001, 1.05, 0, 0],
  9859. "8720": [0.55001, 1.05, 0, 0],
  9860. "8721": [0.55001, 1.05, 0, 0],
  9861. "8730": [0.65002, 1.15, 0, 0],
  9862. "8747": [0.86225, 1.36, 0.44445, 0],
  9863. "8748": [0.862, 1.36, 0.44445, 0],
  9864. "8749": [0.862, 1.36, 0.44445, 0],
  9865. "8750": [0.86225, 1.36, 0.44445, 0],
  9866. "8896": [0.55001, 1.05, 0, 0],
  9867. "8897": [0.55001, 1.05, 0, 0],
  9868. "8898": [0.55001, 1.05, 0, 0],
  9869. "8899": [0.55001, 1.05, 0, 0],
  9870. "8968": [0.65002, 1.15, 0, 0],
  9871. "8969": [0.65002, 1.15, 0, 0],
  9872. "8970": [0.65002, 1.15, 0, 0],
  9873. "8971": [0.65002, 1.15, 0, 0],
  9874. "10216": [0.65002, 1.15, 0, 0],
  9875. "10217": [0.65002, 1.15, 0, 0],
  9876. "10752": [0.55001, 1.05, 0, 0],
  9877. "10753": [0.55001, 1.05, 0, 0],
  9878. "10754": [0.55001, 1.05, 0, 0],
  9879. "10756": [0.55001, 1.05, 0, 0],
  9880. "10758": [0.55001, 1.05, 0, 0]
  9881. },
  9882. "Size3-Regular": {
  9883. "40": [0.95003, 1.45, 0, 0],
  9884. "41": [0.95003, 1.45, 0, 0],
  9885. "47": [0.95003, 1.45, 0, 0],
  9886. "91": [0.95003, 1.45, 0, 0],
  9887. "92": [0.95003, 1.45, 0, 0],
  9888. "93": [0.95003, 1.45, 0, 0],
  9889. "123": [0.95003, 1.45, 0, 0],
  9890. "125": [0.95003, 1.45, 0, 0],
  9891. "710": [0, 0.75, 0, 0],
  9892. "732": [0, 0.75, 0, 0],
  9893. "770": [0, 0.75, 0, 0],
  9894. "771": [0, 0.75, 0, 0],
  9895. "8730": [0.95003, 1.45, 0, 0],
  9896. "8968": [0.95003, 1.45, 0, 0],
  9897. "8969": [0.95003, 1.45, 0, 0],
  9898. "8970": [0.95003, 1.45, 0, 0],
  9899. "8971": [0.95003, 1.45, 0, 0],
  9900. "10216": [0.95003, 1.45, 0, 0],
  9901. "10217": [0.95003, 1.45, 0, 0]
  9902. },
  9903. "Size4-Regular": {
  9904. "40": [1.25003, 1.75, 0, 0],
  9905. "41": [1.25003, 1.75, 0, 0],
  9906. "47": [1.25003, 1.75, 0, 0],
  9907. "91": [1.25003, 1.75, 0, 0],
  9908. "92": [1.25003, 1.75, 0, 0],
  9909. "93": [1.25003, 1.75, 0, 0],
  9910. "123": [1.25003, 1.75, 0, 0],
  9911. "125": [1.25003, 1.75, 0, 0],
  9912. "710": [0, 0.825, 0, 0],
  9913. "732": [0, 0.825, 0, 0],
  9914. "770": [0, 0.825, 0, 0],
  9915. "771": [0, 0.825, 0, 0],
  9916. "8730": [1.25003, 1.75, 0, 0],
  9917. "8968": [1.25003, 1.75, 0, 0],
  9918. "8969": [1.25003, 1.75, 0, 0],
  9919. "8970": [1.25003, 1.75, 0, 0],
  9920. "8971": [1.25003, 1.75, 0, 0],
  9921. "9115": [0.64502, 1.155, 0, 0],
  9922. "9116": [1e-05, 0.6, 0, 0],
  9923. "9117": [0.64502, 1.155, 0, 0],
  9924. "9118": [0.64502, 1.155, 0, 0],
  9925. "9119": [1e-05, 0.6, 0, 0],
  9926. "9120": [0.64502, 1.155, 0, 0],
  9927. "9121": [0.64502, 1.155, 0, 0],
  9928. "9122": [-0.00099, 0.601, 0, 0],
  9929. "9123": [0.64502, 1.155, 0, 0],
  9930. "9124": [0.64502, 1.155, 0, 0],
  9931. "9125": [-0.00099, 0.601, 0, 0],
  9932. "9126": [0.64502, 1.155, 0, 0],
  9933. "9127": [1e-05, 0.9, 0, 0],
  9934. "9128": [0.65002, 1.15, 0, 0],
  9935. "9129": [0.90001, 0, 0, 0],
  9936. "9130": [0, 0.3, 0, 0],
  9937. "9131": [1e-05, 0.9, 0, 0],
  9938. "9132": [0.65002, 1.15, 0, 0],
  9939. "9133": [0.90001, 0, 0, 0],
  9940. "9143": [0.88502, 0.915, 0, 0],
  9941. "10216": [1.25003, 1.75, 0, 0],
  9942. "10217": [1.25003, 1.75, 0, 0],
  9943. "57344": [-0.00499, 0.605, 0, 0],
  9944. "57345": [-0.00499, 0.605, 0, 0],
  9945. "57680": [0, 0.12, 0, 0],
  9946. "57681": [0, 0.12, 0, 0],
  9947. "57682": [0, 0.12, 0, 0],
  9948. "57683": [0, 0.12, 0, 0]
  9949. },
  9950. "Typewriter-Regular": {
  9951. "33": [0, 0.61111, 0, 0],
  9952. "34": [0, 0.61111, 0, 0],
  9953. "35": [0, 0.61111, 0, 0],
  9954. "36": [0.08333, 0.69444, 0, 0],
  9955. "37": [0.08333, 0.69444, 0, 0],
  9956. "38": [0, 0.61111, 0, 0],
  9957. "39": [0, 0.61111, 0, 0],
  9958. "40": [0.08333, 0.69444, 0, 0],
  9959. "41": [0.08333, 0.69444, 0, 0],
  9960. "42": [0, 0.52083, 0, 0],
  9961. "43": [-0.08056, 0.53055, 0, 0],
  9962. "44": [0.13889, 0.125, 0, 0],
  9963. "45": [-0.08056, 0.53055, 0, 0],
  9964. "46": [0, 0.125, 0, 0],
  9965. "47": [0.08333, 0.69444, 0, 0],
  9966. "48": [0, 0.61111, 0, 0],
  9967. "49": [0, 0.61111, 0, 0],
  9968. "50": [0, 0.61111, 0, 0],
  9969. "51": [0, 0.61111, 0, 0],
  9970. "52": [0, 0.61111, 0, 0],
  9971. "53": [0, 0.61111, 0, 0],
  9972. "54": [0, 0.61111, 0, 0],
  9973. "55": [0, 0.61111, 0, 0],
  9974. "56": [0, 0.61111, 0, 0],
  9975. "57": [0, 0.61111, 0, 0],
  9976. "58": [0, 0.43056, 0, 0],
  9977. "59": [0.13889, 0.43056, 0, 0],
  9978. "60": [-0.05556, 0.55556, 0, 0],
  9979. "61": [-0.19549, 0.41562, 0, 0],
  9980. "62": [-0.05556, 0.55556, 0, 0],
  9981. "63": [0, 0.61111, 0, 0],
  9982. "64": [0, 0.61111, 0, 0],
  9983. "65": [0, 0.61111, 0, 0],
  9984. "66": [0, 0.61111, 0, 0],
  9985. "67": [0, 0.61111, 0, 0],
  9986. "68": [0, 0.61111, 0, 0],
  9987. "69": [0, 0.61111, 0, 0],
  9988. "70": [0, 0.61111, 0, 0],
  9989. "71": [0, 0.61111, 0, 0],
  9990. "72": [0, 0.61111, 0, 0],
  9991. "73": [0, 0.61111, 0, 0],
  9992. "74": [0, 0.61111, 0, 0],
  9993. "75": [0, 0.61111, 0, 0],
  9994. "76": [0, 0.61111, 0, 0],
  9995. "77": [0, 0.61111, 0, 0],
  9996. "78": [0, 0.61111, 0, 0],
  9997. "79": [0, 0.61111, 0, 0],
  9998. "80": [0, 0.61111, 0, 0],
  9999. "81": [0.13889, 0.61111, 0, 0],
  10000. "82": [0, 0.61111, 0, 0],
  10001. "83": [0, 0.61111, 0, 0],
  10002. "84": [0, 0.61111, 0, 0],
  10003. "85": [0, 0.61111, 0, 0],
  10004. "86": [0, 0.61111, 0, 0],
  10005. "87": [0, 0.61111, 0, 0],
  10006. "88": [0, 0.61111, 0, 0],
  10007. "89": [0, 0.61111, 0, 0],
  10008. "90": [0, 0.61111, 0, 0],
  10009. "91": [0.08333, 0.69444, 0, 0],
  10010. "92": [0.08333, 0.69444, 0, 0],
  10011. "93": [0.08333, 0.69444, 0, 0],
  10012. "94": [0, 0.61111, 0, 0],
  10013. "95": [0.09514, 0, 0, 0],
  10014. "96": [0, 0.61111, 0, 0],
  10015. "97": [0, 0.43056, 0, 0],
  10016. "98": [0, 0.61111, 0, 0],
  10017. "99": [0, 0.43056, 0, 0],
  10018. "100": [0, 0.61111, 0, 0],
  10019. "101": [0, 0.43056, 0, 0],
  10020. "102": [0, 0.61111, 0, 0],
  10021. "103": [0.22222, 0.43056, 0, 0],
  10022. "104": [0, 0.61111, 0, 0],
  10023. "105": [0, 0.61111, 0, 0],
  10024. "106": [0.22222, 0.61111, 0, 0],
  10025. "107": [0, 0.61111, 0, 0],
  10026. "108": [0, 0.61111, 0, 0],
  10027. "109": [0, 0.43056, 0, 0],
  10028. "110": [0, 0.43056, 0, 0],
  10029. "111": [0, 0.43056, 0, 0],
  10030. "112": [0.22222, 0.43056, 0, 0],
  10031. "113": [0.22222, 0.43056, 0, 0],
  10032. "114": [0, 0.43056, 0, 0],
  10033. "115": [0, 0.43056, 0, 0],
  10034. "116": [0, 0.55358, 0, 0],
  10035. "117": [0, 0.43056, 0, 0],
  10036. "118": [0, 0.43056, 0, 0],
  10037. "119": [0, 0.43056, 0, 0],
  10038. "120": [0, 0.43056, 0, 0],
  10039. "121": [0.22222, 0.43056, 0, 0],
  10040. "122": [0, 0.43056, 0, 0],
  10041. "123": [0.08333, 0.69444, 0, 0],
  10042. "124": [0.08333, 0.69444, 0, 0],
  10043. "125": [0.08333, 0.69444, 0, 0],
  10044. "126": [0, 0.61111, 0, 0],
  10045. "127": [0, 0.61111, 0, 0],
  10046. "305": [0, 0.43056, 0, 0],
  10047. "567": [0.22222, 0.43056, 0, 0],
  10048. "768": [0, 0.61111, 0, 0],
  10049. "769": [0, 0.61111, 0, 0],
  10050. "770": [0, 0.61111, 0, 0],
  10051. "771": [0, 0.61111, 0, 0],
  10052. "772": [0, 0.56555, 0, 0],
  10053. "774": [0, 0.61111, 0, 0],
  10054. "776": [0, 0.61111, 0, 0],
  10055. "778": [0, 0.61111, 0, 0],
  10056. "780": [0, 0.56597, 0, 0],
  10057. "915": [0, 0.61111, 0, 0],
  10058. "916": [0, 0.61111, 0, 0],
  10059. "920": [0, 0.61111, 0, 0],
  10060. "923": [0, 0.61111, 0, 0],
  10061. "926": [0, 0.61111, 0, 0],
  10062. "928": [0, 0.61111, 0, 0],
  10063. "931": [0, 0.61111, 0, 0],
  10064. "933": [0, 0.61111, 0, 0],
  10065. "934": [0, 0.61111, 0, 0],
  10066. "936": [0, 0.61111, 0, 0],
  10067. "937": [0, 0.61111, 0, 0],
  10068. "2018": [0, 0.61111, 0, 0],
  10069. "2019": [0, 0.61111, 0, 0],
  10070. "8216": [0, 0.61111, 0, 0],
  10071. "8217": [0, 0.61111, 0, 0],
  10072. "8242": [0, 0.61111, 0, 0],
  10073. "9251": [0.11111, 0.21944, 0, 0]
  10074. }
  10075. };
  10076.  
  10077. exports.default = fontMetricsData;
  10078.  
  10079. },{}],103:[function(require,module,exports){
  10080. "use strict";
  10081.  
  10082. Object.defineProperty(exports, "__esModule", {
  10083. value: true
  10084. });
  10085.  
  10086. var _utils = require("./utils");
  10087.  
  10088. var _utils2 = _interopRequireDefault(_utils);
  10089.  
  10090. var _ParseError = require("./ParseError");
  10091.  
  10092. var _ParseError2 = _interopRequireDefault(_ParseError);
  10093.  
  10094. var _ParseNode = require("./ParseNode");
  10095.  
  10096. var _ParseNode2 = _interopRequireDefault(_ParseNode);
  10097.  
  10098. var _defineFunction2 = require("./defineFunction");
  10099.  
  10100. var _defineFunction3 = _interopRequireDefault(_defineFunction2);
  10101.  
  10102. require("./functions/phantom");
  10103.  
  10104. require("./functions/operators");
  10105.  
  10106. require("./functions/delimsizing");
  10107.  
  10108. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10109.  
  10110. // WARNING: New functions should be added to src/functions and imported here.
  10111.  
  10112. /** Include this to ensure that all functions are defined. */
  10113. var functions = _defineFunction2._functions;
  10114. exports.default = functions;
  10115.  
  10116. // Define a convenience function that mimcs the old semantics of defineFunction
  10117. // to support existing code so that we can migrate it a little bit at a time.
  10118.  
  10119. var defineFunction = function defineFunction(names, props, handler) // null only if handled in parser
  10120. {
  10121. (0, _defineFunction3.default)({ names: names, props: props, handler: handler });
  10122. };
  10123.  
  10124. // A normal square root
  10125. defineFunction(["\\sqrt"], {
  10126. numArgs: 1,
  10127. numOptionalArgs: 1
  10128. }, function (context, args, optArgs) {
  10129. var index = optArgs[0];
  10130. var body = args[0];
  10131. return {
  10132. type: "sqrt",
  10133. body: body,
  10134. index: index
  10135. };
  10136. });
  10137.  
  10138. // Non-mathy text, possibly in a font
  10139. var textFunctionFonts = {
  10140. "\\text": undefined, "\\textrm": "mathrm", "\\textsf": "mathsf",
  10141. "\\texttt": "mathtt", "\\textnormal": "mathrm", "\\textbf": "mathbf",
  10142. "\\textit": "textit"
  10143. };
  10144.  
  10145. defineFunction(["\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", "\\textbf", "\\textit"], {
  10146. numArgs: 1,
  10147. argTypes: ["text"],
  10148. greediness: 2,
  10149. allowedInText: true
  10150. }, function (context, args) {
  10151. var body = args[0];
  10152. return {
  10153. type: "text",
  10154. body: (0, _defineFunction2.ordargument)(body),
  10155. font: textFunctionFonts[context.funcName]
  10156. };
  10157. });
  10158.  
  10159. // A two-argument custom color
  10160. defineFunction(["\\textcolor"], {
  10161. numArgs: 2,
  10162. allowedInText: true,
  10163. greediness: 3,
  10164. argTypes: ["color", "original"]
  10165. }, function (context, args) {
  10166. var color = args[0];
  10167. var body = args[1];
  10168. return {
  10169. type: "color",
  10170. color: color.value,
  10171. value: (0, _defineFunction2.ordargument)(body)
  10172. };
  10173. });
  10174.  
  10175. // \color is handled in Parser.js's parseImplicitGroup
  10176. defineFunction(["\\color"], {
  10177. numArgs: 1,
  10178. allowedInText: true,
  10179. greediness: 3,
  10180. argTypes: ["color"]
  10181. }, null);
  10182.  
  10183. // colorbox
  10184. defineFunction(["\\colorbox"], {
  10185. numArgs: 2,
  10186. allowedInText: true,
  10187. greediness: 3,
  10188. argTypes: ["color", "text"]
  10189. }, function (context, args) {
  10190. var color = args[0];
  10191. var body = args[1];
  10192. return {
  10193. type: "enclose",
  10194. label: context.funcName,
  10195. backgroundColor: color,
  10196. body: body
  10197. };
  10198. });
  10199.  
  10200. // fcolorbox
  10201. defineFunction(["\\fcolorbox"], {
  10202. numArgs: 3,
  10203. allowedInText: true,
  10204. greediness: 3,
  10205. argTypes: ["color", "color", "text"]
  10206. }, function (context, args) {
  10207. var borderColor = args[0];
  10208. var backgroundColor = args[1];
  10209. var body = args[2];
  10210. return {
  10211. type: "enclose",
  10212. label: context.funcName,
  10213. backgroundColor: backgroundColor,
  10214. borderColor: borderColor,
  10215. body: body
  10216. };
  10217. });
  10218.  
  10219. // An overline
  10220. defineFunction(["\\overline"], {
  10221. numArgs: 1
  10222. }, function (context, args) {
  10223. var body = args[0];
  10224. return {
  10225. type: "overline",
  10226. body: body
  10227. };
  10228. });
  10229.  
  10230. // An underline
  10231. defineFunction(["\\underline"], {
  10232. numArgs: 1
  10233. }, function (context, args) {
  10234. var body = args[0];
  10235. return {
  10236. type: "underline",
  10237. body: body
  10238. };
  10239. });
  10240.  
  10241. // A box of the width and height
  10242. defineFunction(["\\rule"], {
  10243. numArgs: 2,
  10244. numOptionalArgs: 1,
  10245. argTypes: ["size", "size", "size"]
  10246. }, function (context, args, optArgs) {
  10247. var shift = optArgs[0];
  10248. var width = args[0];
  10249. var height = args[1];
  10250. return {
  10251. type: "rule",
  10252. shift: shift && shift.value,
  10253. width: width.value,
  10254. height: height.value
  10255. };
  10256. });
  10257.  
  10258. // TODO: In TeX, \mkern only accepts mu-units, and \kern does not accept
  10259. // mu-units. In current KaTeX we relax this; both commands accept any unit.
  10260. defineFunction(["\\kern", "\\mkern"], {
  10261. numArgs: 1,
  10262. argTypes: ["size"]
  10263. }, function (context, args) {
  10264. return {
  10265. type: "kern",
  10266. dimension: args[0].value
  10267. };
  10268. });
  10269.  
  10270. // A KaTeX logo
  10271. defineFunction(["\\KaTeX"], {
  10272. numArgs: 0,
  10273. allowedInText: true
  10274. }, function (context) {
  10275. return {
  10276. type: "katex"
  10277. };
  10278. });
  10279.  
  10280. // Math class commands except \mathop
  10281. defineFunction(["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], {
  10282. numArgs: 1
  10283. }, function (context, args) {
  10284. var body = args[0];
  10285. return {
  10286. type: "mclass",
  10287. mclass: "m" + context.funcName.substr(5),
  10288. value: (0, _defineFunction2.ordargument)(body)
  10289. };
  10290. });
  10291.  
  10292. // Build a relation by placing one symbol on top of another
  10293. defineFunction(["\\stackrel"], {
  10294. numArgs: 2
  10295. }, function (context, args) {
  10296. var top = args[0];
  10297. var bottom = args[1];
  10298.  
  10299. var bottomop = new _ParseNode2.default("op", {
  10300. type: "op",
  10301. limits: true,
  10302. alwaysHandleSupSub: true,
  10303. symbol: false,
  10304. value: (0, _defineFunction2.ordargument)(bottom)
  10305. }, bottom.mode);
  10306.  
  10307. var supsub = new _ParseNode2.default("supsub", {
  10308. base: bottomop,
  10309. sup: top,
  10310. sub: null
  10311. }, top.mode);
  10312.  
  10313. return {
  10314. type: "mclass",
  10315. mclass: "mrel",
  10316. value: [supsub]
  10317. };
  10318. });
  10319.  
  10320. // \mod-type functions
  10321. defineFunction(["\\bmod"], {
  10322. numArgs: 0
  10323. }, function (context, args) {
  10324. return {
  10325. type: "mod",
  10326. modType: "bmod",
  10327. value: null
  10328. };
  10329. });
  10330.  
  10331. defineFunction(["\\pod", "\\pmod", "\\mod"], {
  10332. numArgs: 1
  10333. }, function (context, args) {
  10334. var body = args[0];
  10335. return {
  10336. type: "mod",
  10337. modType: context.funcName.substr(1),
  10338. value: (0, _defineFunction2.ordargument)(body)
  10339. };
  10340. });
  10341.  
  10342. var fontAliases = {
  10343. "\\Bbb": "\\mathbb",
  10344. "\\bold": "\\mathbf",
  10345. "\\frak": "\\mathfrak"
  10346. };
  10347.  
  10348. // Single-argument color functions
  10349. defineFunction(["\\blue", "\\orange", "\\pink", "\\red", "\\green", "\\gray", "\\purple", "\\blueA", "\\blueB", "\\blueC", "\\blueD", "\\blueE", "\\tealA", "\\tealB", "\\tealC", "\\tealD", "\\tealE", "\\greenA", "\\greenB", "\\greenC", "\\greenD", "\\greenE", "\\goldA", "\\goldB", "\\goldC", "\\goldD", "\\goldE", "\\redA", "\\redB", "\\redC", "\\redD", "\\redE", "\\maroonA", "\\maroonB", "\\maroonC", "\\maroonD", "\\maroonE", "\\purpleA", "\\purpleB", "\\purpleC", "\\purpleD", "\\purpleE", "\\mintA", "\\mintB", "\\mintC", "\\grayA", "\\grayB", "\\grayC", "\\grayD", "\\grayE", "\\grayF", "\\grayG", "\\grayH", "\\grayI", "\\kaBlue", "\\kaGreen"], {
  10350. numArgs: 1,
  10351. allowedInText: true,
  10352. greediness: 3
  10353. }, function (context, args) {
  10354. var body = args[0];
  10355. return {
  10356. type: "color",
  10357. color: "katex-" + context.funcName.slice(1),
  10358. value: (0, _defineFunction2.ordargument)(body)
  10359. };
  10360. });
  10361.  
  10362. // There are 2 flags for operators; whether they produce limits in
  10363. // displaystyle, and whether they are symbols and should grow in
  10364. // displaystyle. These four groups cover the four possible choices.
  10365.  
  10366. // No limits, not symbols
  10367. defineFunction(["\\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"], {
  10368. numArgs: 0
  10369. }, function (context) {
  10370. return {
  10371. type: "op",
  10372. limits: false,
  10373. symbol: false,
  10374. body: context.funcName
  10375. };
  10376. });
  10377.  
  10378. // Limits, not symbols
  10379. defineFunction(["\\det", "\\gcd", "\\inf", "\\lim", "\\liminf", "\\limsup", "\\max", "\\min", "\\Pr", "\\sup"], {
  10380. numArgs: 0
  10381. }, function (context) {
  10382. return {
  10383. type: "op",
  10384. limits: true,
  10385. symbol: false,
  10386. body: context.funcName
  10387. };
  10388. });
  10389.  
  10390. // No limits, symbols
  10391. defineFunction(["\\int", "\\iint", "\\iiint", "\\oint"], {
  10392. numArgs: 0
  10393. }, function (context) {
  10394. return {
  10395. type: "op",
  10396. limits: false,
  10397. symbol: true,
  10398. body: context.funcName
  10399. };
  10400. });
  10401.  
  10402. // Limits, symbols
  10403. defineFunction(["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint"], {
  10404. numArgs: 0
  10405. }, function (context) {
  10406. return {
  10407. type: "op",
  10408. limits: true,
  10409. symbol: true,
  10410. body: context.funcName
  10411. };
  10412. });
  10413.  
  10414. // \mathop class command
  10415. defineFunction(["\\mathop"], {
  10416. numArgs: 1
  10417. }, function (context, args) {
  10418. var body = args[0];
  10419. return {
  10420. type: "op",
  10421. limits: false,
  10422. symbol: false,
  10423. value: (0, _defineFunction2.ordargument)(body)
  10424. };
  10425. });
  10426.  
  10427. // Fractions
  10428. defineFunction(["\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac"], {
  10429. numArgs: 2,
  10430. greediness: 2
  10431. }, function (context, args) {
  10432. var numer = args[0];
  10433. var denom = args[1];
  10434. var hasBarLine = void 0;
  10435. var leftDelim = null;
  10436. var rightDelim = null;
  10437. var size = "auto";
  10438.  
  10439. switch (context.funcName) {
  10440. case "\\dfrac":
  10441. case "\\frac":
  10442. case "\\tfrac":
  10443. hasBarLine = true;
  10444. break;
  10445. case "\\\\atopfrac":
  10446. hasBarLine = false;
  10447. break;
  10448. case "\\dbinom":
  10449. case "\\binom":
  10450. case "\\tbinom":
  10451. hasBarLine = false;
  10452. leftDelim = "(";
  10453. rightDelim = ")";
  10454. break;
  10455. default:
  10456. throw new Error("Unrecognized genfrac command");
  10457. }
  10458.  
  10459. switch (context.funcName) {
  10460. case "\\dfrac":
  10461. case "\\dbinom":
  10462. size = "display";
  10463. break;
  10464. case "\\tfrac":
  10465. case "\\tbinom":
  10466. size = "text";
  10467. break;
  10468. }
  10469.  
  10470. return {
  10471. type: "genfrac",
  10472. numer: numer,
  10473. denom: denom,
  10474. hasBarLine: hasBarLine,
  10475. leftDelim: leftDelim,
  10476. rightDelim: rightDelim,
  10477. size: size
  10478. };
  10479. });
  10480.  
  10481. // Horizontal overlap functions
  10482. defineFunction(["\\mathllap", "\\mathrlap", "\\mathclap"], {
  10483. numArgs: 1,
  10484. allowedInText: true
  10485. }, function (context, args) {
  10486. var body = args[0];
  10487. return {
  10488. type: "lap",
  10489. alignment: context.funcName.slice(5),
  10490. body: body
  10491. };
  10492. });
  10493.  
  10494. // smash, with optional [tb], as in AMS
  10495. defineFunction(["\\smash"], {
  10496. numArgs: 1,
  10497. numOptionalArgs: 1,
  10498. allowedInText: true
  10499. }, function (context, args, optArgs) {
  10500. var smashHeight = false;
  10501. var smashDepth = false;
  10502. var tbArg = optArgs[0];
  10503. if (tbArg) {
  10504. // Optional [tb] argument is engaged.
  10505. // ref: amsmath: \renewcommand{\smash}[1][tb]{%
  10506. // def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}%
  10507. var letter = "";
  10508. for (var i = 0; i < tbArg.value.length; ++i) {
  10509. letter = tbArg.value[i].value;
  10510. if (letter === "t") {
  10511. smashHeight = true;
  10512. } else if (letter === "b") {
  10513. smashDepth = true;
  10514. } else {
  10515. smashHeight = false;
  10516. smashDepth = false;
  10517. break;
  10518. }
  10519. }
  10520. } else {
  10521. smashHeight = true;
  10522. smashDepth = true;
  10523. }
  10524.  
  10525. var body = args[0];
  10526. return {
  10527. type: "smash",
  10528. body: body,
  10529. smashHeight: smashHeight,
  10530. smashDepth: smashDepth
  10531. };
  10532. });
  10533.  
  10534. // Sizing functions (handled in Parser.js explicitly, hence no handler)
  10535. defineFunction(["\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"], { numArgs: 0 }, null);
  10536.  
  10537. // Style changing functions (handled in Parser.js explicitly, hence no
  10538. // handler)
  10539. defineFunction(["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], { numArgs: 0 }, null);
  10540.  
  10541. // Old font changing functions
  10542. defineFunction(["\\rm", "\\sf", "\\tt", "\\bf", "\\it"], { numArgs: 0 }, null);
  10543.  
  10544. defineFunction([
  10545. // styles
  10546. "\\mathrm", "\\mathit", "\\mathbf",
  10547.  
  10548. // families
  10549. "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt",
  10550.  
  10551. // aliases
  10552. "\\Bbb", "\\bold", "\\frak"], {
  10553. numArgs: 1,
  10554. greediness: 2
  10555. }, function (context, args) {
  10556. var body = args[0];
  10557. var func = context.funcName;
  10558. if (func in fontAliases) {
  10559. func = fontAliases[func];
  10560. }
  10561. return {
  10562. type: "font",
  10563. font: func.slice(1),
  10564. body: body
  10565. };
  10566. });
  10567.  
  10568. // Accents
  10569. defineFunction(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], {
  10570. numArgs: 1
  10571. }, function (context, args) {
  10572. var base = args[0];
  10573.  
  10574. var isStretchy = !_utils2.default.contains(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot"], context.funcName);
  10575.  
  10576. var isShifty = !isStretchy || _utils2.default.contains(["\\widehat", "\\widetilde"], context.funcName);
  10577.  
  10578. return {
  10579. type: "accent",
  10580. label: context.funcName,
  10581. isStretchy: isStretchy,
  10582. isShifty: isShifty,
  10583. base: base
  10584. };
  10585. });
  10586.  
  10587. // Text-mode accents
  10588. defineFunction(["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v"], {
  10589. numArgs: 1,
  10590. allowedInText: true,
  10591. allowedInMath: false
  10592. }, function (context, args) {
  10593. var base = args[0];
  10594.  
  10595. return {
  10596. type: "accent",
  10597. label: context.funcName,
  10598. isStretchy: false,
  10599. isShifty: true,
  10600. base: base
  10601. };
  10602. });
  10603.  
  10604. // Horizontal stretchy braces
  10605. defineFunction(["\\overbrace", "\\underbrace"], {
  10606. numArgs: 1
  10607. }, function (context, args) {
  10608. var base = args[0];
  10609. return {
  10610. type: "horizBrace",
  10611. label: context.funcName,
  10612. isOver: /^\\over/.test(context.funcName),
  10613. base: base
  10614. };
  10615. });
  10616.  
  10617. // Stretchy accents under the body
  10618. defineFunction(["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\undertilde"], {
  10619. numArgs: 1
  10620. }, function (context, args) {
  10621. var base = args[0];
  10622. return {
  10623. type: "accentUnder",
  10624. label: context.funcName,
  10625. base: base
  10626. };
  10627. });
  10628.  
  10629. // Stretchy arrows with an optional argument
  10630. defineFunction(["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xLongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xLongequal", "\\xtofrom"], {
  10631. numArgs: 1,
  10632. numOptionalArgs: 1
  10633. }, function (context, args, optArgs) {
  10634. var below = optArgs[0];
  10635. var body = args[0];
  10636. return {
  10637. type: "xArrow", // x for extensible
  10638. label: context.funcName,
  10639. body: body,
  10640. below: below
  10641. };
  10642. });
  10643.  
  10644. // enclose
  10645. defineFunction(["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\fbox"], {
  10646. numArgs: 1
  10647. }, function (context, args) {
  10648. var body = args[0];
  10649. return {
  10650. type: "enclose",
  10651. label: context.funcName,
  10652. body: body
  10653. };
  10654. });
  10655.  
  10656. // Infix generalized fractions
  10657. defineFunction(["\\over", "\\choose", "\\atop"], {
  10658. numArgs: 0,
  10659. infix: true
  10660. }, function (context) {
  10661. var replaceWith = void 0;
  10662. switch (context.funcName) {
  10663. case "\\over":
  10664. replaceWith = "\\frac";
  10665. break;
  10666. case "\\choose":
  10667. replaceWith = "\\binom";
  10668. break;
  10669. case "\\atop":
  10670. replaceWith = "\\\\atopfrac";
  10671. break;
  10672. default:
  10673. throw new Error("Unrecognized infix genfrac command");
  10674. }
  10675. return {
  10676. type: "infix",
  10677. replaceWith: replaceWith,
  10678. token: context.token
  10679. };
  10680. });
  10681.  
  10682. // Row breaks for aligned data
  10683. defineFunction(["\\\\", "\\cr"], {
  10684. numArgs: 0,
  10685. numOptionalArgs: 1,
  10686. argTypes: ["size"]
  10687. }, function (context, args, optArgs) {
  10688. var size = optArgs[0];
  10689. return {
  10690. type: "cr",
  10691. size: size
  10692. };
  10693. });
  10694.  
  10695. // Environment delimiters
  10696. defineFunction(["\\begin", "\\end"], {
  10697. numArgs: 1,
  10698. argTypes: ["text"]
  10699. }, function (context, args) {
  10700. var nameGroup = args[0];
  10701. if (nameGroup.type !== "ordgroup") {
  10702. throw new _ParseError2.default("Invalid environment name", nameGroup);
  10703. }
  10704. var name = "";
  10705. for (var i = 0; i < nameGroup.value.length; ++i) {
  10706. name += nameGroup.value[i].value;
  10707. }
  10708. return {
  10709. type: "environment",
  10710. name: name,
  10711. nameGroup: nameGroup
  10712. };
  10713. });
  10714.  
  10715. // Box manipulation
  10716. defineFunction(["\\raisebox"], {
  10717. numArgs: 2,
  10718. argTypes: ["size", "text"],
  10719. allowedInText: true
  10720. }, function (context, args) {
  10721. var amount = args[0];
  10722. var body = args[1];
  10723. return {
  10724. type: "raisebox",
  10725. dy: amount,
  10726. body: body,
  10727. value: (0, _defineFunction2.ordargument)(body)
  10728. };
  10729. });
  10730.  
  10731. // \verb and \verb* are dealt with directly in Parser.js.
  10732. // If we end up here, it's because of a failure to match the two delimiters
  10733. // in the regex in Lexer.js. LaTeX raises the following error when \verb is
  10734. // terminated by end of line (or file).
  10735. defineFunction(["\\verb"], {
  10736. numArgs: 0,
  10737. allowedInText: true
  10738. }, function (context) {
  10739. throw new _ParseError2.default("\\verb ended by end of line instead of matching delimiter");
  10740. });
  10741.  
  10742. },{"./ParseError":84,"./ParseNode":85,"./defineFunction":96,"./functions/delimsizing":104,"./functions/operators":105,"./functions/phantom":106,"./utils":115}],104:[function(require,module,exports){
  10743. "use strict";
  10744.  
  10745. var _buildCommon = require("../buildCommon");
  10746.  
  10747. var _buildCommon2 = _interopRequireDefault(_buildCommon);
  10748.  
  10749. var _defineFunction = require("../defineFunction");
  10750.  
  10751. var _defineFunction2 = _interopRequireDefault(_defineFunction);
  10752.  
  10753. var _delimiter = require("../delimiter");
  10754.  
  10755. var _delimiter2 = _interopRequireDefault(_delimiter);
  10756.  
  10757. var _mathMLTree = require("../mathMLTree");
  10758.  
  10759. var _mathMLTree2 = _interopRequireDefault(_mathMLTree);
  10760.  
  10761. var _ParseError = require("../ParseError");
  10762.  
  10763. var _ParseError2 = _interopRequireDefault(_ParseError);
  10764.  
  10765. var _utils = require("../utils");
  10766.  
  10767. var _utils2 = _interopRequireDefault(_utils);
  10768.  
  10769. var _buildHTML = require("../buildHTML");
  10770.  
  10771. var html = _interopRequireWildcard(_buildHTML);
  10772.  
  10773. var _buildMathML = require("../buildMathML");
  10774.  
  10775. var mml = _interopRequireWildcard(_buildMathML);
  10776.  
  10777. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  10778.  
  10779. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10780.  
  10781. // Extra data needed for the delimiter handler down below
  10782. var delimiterSizes = {
  10783. "\\bigl": { mclass: "mopen", size: 1 },
  10784. "\\Bigl": { mclass: "mopen", size: 2 },
  10785. "\\biggl": { mclass: "mopen", size: 3 },
  10786. "\\Biggl": { mclass: "mopen", size: 4 },
  10787. "\\bigr": { mclass: "mclose", size: 1 },
  10788. "\\Bigr": { mclass: "mclose", size: 2 },
  10789. "\\biggr": { mclass: "mclose", size: 3 },
  10790. "\\Biggr": { mclass: "mclose", size: 4 },
  10791. "\\bigm": { mclass: "mrel", size: 1 },
  10792. "\\Bigm": { mclass: "mrel", size: 2 },
  10793. "\\biggm": { mclass: "mrel", size: 3 },
  10794. "\\Biggm": { mclass: "mrel", size: 4 },
  10795. "\\big": { mclass: "mord", size: 1 },
  10796. "\\Big": { mclass: "mord", size: 2 },
  10797. "\\bigg": { mclass: "mord", size: 3 },
  10798. "\\Bigg": { mclass: "mord", size: 4 }
  10799. };
  10800.  
  10801. var delimiters = ["(", ")", "[", "\\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", "."];
  10802.  
  10803. // Delimiter functions
  10804. function checkDelimiter(delim, context) {
  10805. if (_utils2.default.contains(delimiters, delim.value)) {
  10806. return delim;
  10807. } else {
  10808. throw new _ParseError2.default("Invalid delimiter: '" + delim.value + "' after '" + context.funcName + "'", delim);
  10809. }
  10810. }
  10811.  
  10812. (0, _defineFunction2.default)({
  10813. type: "delimsizing",
  10814. names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
  10815. props: {
  10816. numArgs: 1
  10817. },
  10818. handler: function handler(context, args) {
  10819. var delim = checkDelimiter(args[0], context);
  10820.  
  10821. return {
  10822. type: "delimsizing",
  10823. size: delimiterSizes[context.funcName].size,
  10824. mclass: delimiterSizes[context.funcName].mclass,
  10825. value: delim.value
  10826. };
  10827. },
  10828. htmlBuilder: function htmlBuilder(group, options) {
  10829. var delim = group.value.value;
  10830.  
  10831. if (delim === ".") {
  10832. // Empty delimiters still count as elements, even though they don't
  10833. // show anything.
  10834. return _buildCommon2.default.makeSpan([group.value.mclass]);
  10835. }
  10836.  
  10837. // Use delimiter.sizedDelim to generate the delimiter.
  10838. return _delimiter2.default.sizedDelim(delim, group.value.size, options, group.mode, [group.value.mclass]);
  10839. },
  10840. mathmlBuilder: function mathmlBuilder(group) {
  10841. var children = [];
  10842.  
  10843. if (group.value.value !== ".") {
  10844. children.push(mml.makeText(group.value.value, group.mode));
  10845. }
  10846.  
  10847. var node = new _mathMLTree2.default.MathNode("mo", children);
  10848.  
  10849. if (group.value.mclass === "mopen" || group.value.mclass === "mclose") {
  10850. // Only some of the delimsizing functions act as fences, and they
  10851. // return "mopen" or "mclose" mclass.
  10852. node.setAttribute("fence", "true");
  10853. } else {
  10854. // Explicitly disable fencing if it's not a fence, to override the
  10855. // defaults.
  10856. node.setAttribute("fence", "false");
  10857. }
  10858.  
  10859. return node;
  10860. }
  10861. });
  10862.  
  10863. (0, _defineFunction2.default)({
  10864. type: "leftright",
  10865. names: ["\\left", "\\right"],
  10866. props: {
  10867. numArgs: 1
  10868. },
  10869. handler: function handler(context, args) {
  10870. var delim = checkDelimiter(args[0], context);
  10871.  
  10872. // \left and \right are caught somewhere in Parser.js, which is
  10873. // why this data doesn't match what is in buildHTML.
  10874. return {
  10875. type: "leftright",
  10876. value: delim.value
  10877. };
  10878. },
  10879. htmlBuilder: function htmlBuilder(group, options) {
  10880. // Build the inner expression
  10881. var inner = html.buildExpression(group.value.body, options, true);
  10882.  
  10883. var innerHeight = 0;
  10884. var innerDepth = 0;
  10885. var hadMiddle = false;
  10886.  
  10887. // Calculate its height and depth
  10888. for (var i = 0; i < inner.length; i++) {
  10889. if (inner[i].isMiddle) {
  10890. hadMiddle = true;
  10891. } else {
  10892. innerHeight = Math.max(inner[i].height, innerHeight);
  10893. innerDepth = Math.max(inner[i].depth, innerDepth);
  10894. }
  10895. }
  10896.  
  10897. // The size of delimiters is the same, regardless of what style we are
  10898. // in. Thus, to correctly calculate the size of delimiter we need around
  10899. // a group, we scale down the inner size based on the size.
  10900. innerHeight *= options.sizeMultiplier;
  10901. innerDepth *= options.sizeMultiplier;
  10902.  
  10903. var leftDelim = void 0;
  10904. if (group.value.left === ".") {
  10905. // Empty delimiters in \left and \right make null delimiter spaces.
  10906. leftDelim = html.makeNullDelimiter(options, ["mopen"]);
  10907. } else {
  10908. // Otherwise, use leftRightDelim to generate the correct sized
  10909. // delimiter.
  10910. leftDelim = _delimiter2.default.leftRightDelim(group.value.left, innerHeight, innerDepth, options, group.mode, ["mopen"]);
  10911. }
  10912. // Add it to the beginning of the expression
  10913. inner.unshift(leftDelim);
  10914.  
  10915. // Handle middle delimiters
  10916. if (hadMiddle) {
  10917. for (var _i = 1; _i < inner.length; _i++) {
  10918. var middleDelim = inner[_i];
  10919. if (middleDelim.isMiddle) {
  10920. // Apply the options that were active when \middle was called
  10921. inner[_i] = _delimiter2.default.leftRightDelim(middleDelim.isMiddle.value, innerHeight, innerDepth, middleDelim.isMiddle.options, group.mode, []);
  10922. // Add back spaces shifted into the delimiter
  10923. var spaces = html.spliceSpaces(middleDelim.children, 0);
  10924. if (spaces) {
  10925. _buildCommon2.default.prependChildren(inner[_i], spaces);
  10926. }
  10927. }
  10928. }
  10929. }
  10930.  
  10931. var rightDelim = void 0;
  10932. // Same for the right delimiter
  10933. if (group.value.right === ".") {
  10934. rightDelim = html.makeNullDelimiter(options, ["mclose"]);
  10935. } else {
  10936. rightDelim = _delimiter2.default.leftRightDelim(group.value.right, innerHeight, innerDepth, options, group.mode, ["mclose"]);
  10937. }
  10938. // Add it to the end of the expression.
  10939. inner.push(rightDelim);
  10940.  
  10941. return _buildCommon2.default.makeSpan(["minner"], inner, options);
  10942. },
  10943. mathmlBuilder: function mathmlBuilder(group, options) {
  10944. var inner = mml.buildExpression(group.value.body, options);
  10945.  
  10946. if (group.value.left !== ".") {
  10947. var leftNode = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.left, group.mode)]);
  10948.  
  10949. leftNode.setAttribute("fence", "true");
  10950.  
  10951. inner.unshift(leftNode);
  10952. }
  10953.  
  10954. if (group.value.right !== ".") {
  10955. var rightNode = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.right, group.mode)]);
  10956.  
  10957. rightNode.setAttribute("fence", "true");
  10958.  
  10959. inner.push(rightNode);
  10960. }
  10961.  
  10962. var outerNode = new _mathMLTree2.default.MathNode("mrow", inner);
  10963.  
  10964. return outerNode;
  10965. }
  10966. });
  10967.  
  10968. (0, _defineFunction2.default)({
  10969. type: "middle",
  10970. names: ["\\middle"],
  10971. props: {
  10972. numArgs: 1
  10973. },
  10974. handler: function handler(context, args) {
  10975. var delim = checkDelimiter(args[0], context);
  10976. if (!context.parser.leftrightDepth) {
  10977. throw new _ParseError2.default("\\middle without preceding \\left", delim);
  10978. }
  10979.  
  10980. return {
  10981. type: "middle",
  10982. value: delim.value
  10983. };
  10984. },
  10985. htmlBuilder: function htmlBuilder(group, options) {
  10986. var middleDelim = void 0;
  10987. if (group.value.value === ".") {
  10988. middleDelim = html.makeNullDelimiter(options, []);
  10989. } else {
  10990. middleDelim = _delimiter2.default.sizedDelim(group.value.value, 1, options, group.mode, []);
  10991. middleDelim.isMiddle = { value: group.value.value, options: options };
  10992. }
  10993. return middleDelim;
  10994. },
  10995. mathmlBuilder: function mathmlBuilder(group, options) {
  10996. var middleNode = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.middle, group.mode)]);
  10997. middleNode.setAttribute("fence", "true");
  10998. return middleNode;
  10999. }
  11000. });
  11001.  
  11002. },{"../ParseError":84,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../delimiter":97,"../mathMLTree":108,"../utils":115}],105:[function(require,module,exports){
  11003. "use strict";
  11004.  
  11005. var _defineFunction = require("../defineFunction");
  11006.  
  11007. var _defineFunction2 = _interopRequireDefault(_defineFunction);
  11008.  
  11009. var _buildCommon = require("../buildCommon");
  11010.  
  11011. var _buildCommon2 = _interopRequireDefault(_buildCommon);
  11012.  
  11013. var _mathMLTree = require("../mathMLTree");
  11014.  
  11015. var _mathMLTree2 = _interopRequireDefault(_mathMLTree);
  11016.  
  11017. var _domTree = require("../domTree");
  11018.  
  11019. var _domTree2 = _interopRequireDefault(_domTree);
  11020.  
  11021. var _buildHTML = require("../buildHTML");
  11022.  
  11023. var html = _interopRequireWildcard(_buildHTML);
  11024.  
  11025. var _buildMathML = require("../buildMathML");
  11026.  
  11027. var mml = _interopRequireWildcard(_buildMathML);
  11028.  
  11029. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  11030.  
  11031. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11032.  
  11033. // \operatorname
  11034. // amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@
  11035. (0, _defineFunction2.default)({
  11036. type: "operatorname",
  11037. names: ["\\operatorname"],
  11038. props: {
  11039. numArgs: 1
  11040. },
  11041. handler: function handler(context, args) {
  11042. var body = args[0];
  11043. return {
  11044. type: "operatorname",
  11045. value: (0, _defineFunction.ordargument)(body)
  11046. };
  11047. },
  11048.  
  11049. htmlBuilder: function htmlBuilder(group, options) {
  11050. var output = [];
  11051. if (group.value.value.length > 0) {
  11052. var letter = "";
  11053. var mode = "";
  11054.  
  11055. // Consolidate Greek letter function names into symbol characters.
  11056. var temp = html.buildExpression(group.value.value, options, true);
  11057.  
  11058. // All we want from temp are the letters. With them, we'll
  11059. // create a text operator similar to \tan or \cos.
  11060. for (var i = 0; i < temp.length; i++) {
  11061. letter = temp[i].value;
  11062.  
  11063. // In the amsopn package, \newmcodes@ changes four
  11064. // characters, *-/:’, from math operators back into text.
  11065. // Given what is in temp, we have to address two of them.
  11066. letter = letter.replace(/\u2212/, "-"); // minus => hyphen
  11067. letter = letter.replace(/\u2217/, "*");
  11068.  
  11069. // Use math mode for Greek letters
  11070. mode = /[\u0391-\u03D7]/.test(letter) ? "math" : "text";
  11071. output.push(_buildCommon2.default.mathsym(letter, mode));
  11072. }
  11073. }
  11074. return _buildCommon2.default.makeSpan(["mop"], output, options);
  11075. },
  11076.  
  11077. mathmlBuilder: function mathmlBuilder(group, options) {
  11078. // The steps taken here are similar to the html version.
  11079. var output = [];
  11080. if (group.value.value.length > 0) {
  11081. var temp = mml.buildExpression(group.value.value, options);
  11082.  
  11083. var word = "";
  11084. for (var i = 0; i < temp.length; i++) {
  11085. word += temp[i].children[0].text;
  11086. }
  11087. word = word.replace(/\u2212/g, "-");
  11088. word = word.replace(/\u2217/g, "*");
  11089. output = [new _mathMLTree2.default.TextNode(word)];
  11090. }
  11091. var identifier = new _mathMLTree2.default.MathNode("mi", output);
  11092. identifier.setAttribute("mathvariant", "normal");
  11093.  
  11094. var operator = new _mathMLTree2.default.MathNode("mo", [mml.makeText("&ApplyFunction;", "text")]);
  11095.  
  11096. return new _domTree2.default.documentFragment([identifier, operator]);
  11097. }
  11098. });
  11099.  
  11100. },{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../domTree":98,"../mathMLTree":108}],106:[function(require,module,exports){
  11101. "use strict";
  11102.  
  11103. var _defineFunction = require("../defineFunction");
  11104.  
  11105. var _defineFunction2 = _interopRequireDefault(_defineFunction);
  11106.  
  11107. var _buildCommon = require("../buildCommon");
  11108.  
  11109. var _buildCommon2 = _interopRequireDefault(_buildCommon);
  11110.  
  11111. var _mathMLTree = require("../mathMLTree");
  11112.  
  11113. var _mathMLTree2 = _interopRequireDefault(_mathMLTree);
  11114.  
  11115. var _buildHTML = require("../buildHTML");
  11116.  
  11117. var html = _interopRequireWildcard(_buildHTML);
  11118.  
  11119. var _buildMathML = require("../buildMathML");
  11120.  
  11121. var mml = _interopRequireWildcard(_buildMathML);
  11122.  
  11123. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  11124.  
  11125. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11126.  
  11127. (0, _defineFunction2.default)({
  11128. type: "phantom",
  11129. names: ["\\phantom"],
  11130. props: {
  11131. numArgs: 1
  11132. },
  11133. handler: function handler(context, args) {
  11134. var body = args[0];
  11135. return {
  11136. type: "phantom",
  11137. value: (0, _defineFunction.ordargument)(body)
  11138. };
  11139. },
  11140. htmlBuilder: function htmlBuilder(group, options) {
  11141. var elements = html.buildExpression(group.value.value, options.withPhantom(), false);
  11142.  
  11143. // \phantom isn't supposed to affect the elements it contains.
  11144. // See "color" for more details.
  11145. return new _buildCommon2.default.makeFragment(elements);
  11146. },
  11147. mathmlBuilder: function mathmlBuilder(group, options) {
  11148. var inner = mml.buildExpression(group.value.value, options);
  11149. return new _mathMLTree2.default.MathNode("mphantom", inner);
  11150. }
  11151. });
  11152.  
  11153.  
  11154. (0, _defineFunction2.default)({
  11155. type: "hphantom",
  11156. names: ["\\hphantom"],
  11157. props: {
  11158. numArgs: 1
  11159. },
  11160. handler: function handler(context, args) {
  11161. var body = args[0];
  11162. return {
  11163. type: "hphantom",
  11164. value: (0, _defineFunction.ordargument)(body),
  11165. body: body
  11166. };
  11167. },
  11168. htmlBuilder: function htmlBuilder(group, options) {
  11169. var node = _buildCommon2.default.makeSpan([], [html.buildGroup(group.value.body, options.withPhantom())]);
  11170. node.height = 0;
  11171. node.depth = 0;
  11172. if (node.children) {
  11173. for (var i = 0; i < node.children.length; i++) {
  11174. node.children[i].height = 0;
  11175. node.children[i].depth = 0;
  11176. }
  11177. }
  11178.  
  11179. // See smash for comment re: use of makeVList
  11180. node = _buildCommon2.default.makeVList([{ type: "elem", elem: node }], "firstBaseline", null, options);
  11181.  
  11182. return node;
  11183. },
  11184. mathmlBuilder: function mathmlBuilder(group, options) {
  11185. var inner = mml.buildExpression(group.value.value, options);
  11186. var node = new _mathMLTree2.default.MathNode("mphantom", inner);
  11187. node.setAttribute("height", "0px");
  11188. return node;
  11189. }
  11190. });
  11191.  
  11192. (0, _defineFunction2.default)({
  11193. type: "vphantom",
  11194. names: ["\\vphantom"],
  11195. props: {
  11196. numArgs: 1
  11197. },
  11198. handler: function handler(context, args) {
  11199. var body = args[0];
  11200. return {
  11201. type: "vphantom",
  11202. value: (0, _defineFunction.ordargument)(body),
  11203. body: body
  11204. };
  11205. },
  11206. htmlBuilder: function htmlBuilder(group, options) {
  11207. var inner = _buildCommon2.default.makeSpan(["inner"], [html.buildGroup(group.value.body, options.withPhantom())]);
  11208. var fix = _buildCommon2.default.makeSpan(["fix"], []);
  11209. return _buildCommon2.default.makeSpan(["mord", "rlap"], [inner, fix], options);
  11210. },
  11211. mathmlBuilder: function mathmlBuilder(group, options) {
  11212. var inner = mml.buildExpression(group.value.value, options);
  11213. var node = new _mathMLTree2.default.MathNode("mphantom", inner);
  11214. node.setAttribute("width", "0px");
  11215. return node;
  11216. }
  11217. });
  11218.  
  11219. },{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":108}],107:[function(require,module,exports){
  11220. "use strict";
  11221.  
  11222. Object.defineProperty(exports, "__esModule", {
  11223. value: true
  11224. });
  11225.  
  11226. var _symbols = require("./symbols");
  11227.  
  11228. var _symbols2 = _interopRequireDefault(_symbols);
  11229.  
  11230. var _utils = require("./utils");
  11231.  
  11232. var _utils2 = _interopRequireDefault(_utils);
  11233.  
  11234. var _Token = require("./Token");
  11235.  
  11236. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11237.  
  11238. /**
  11239. * Provides context to macros defined by functions. Implemented by
  11240. * MacroExpander.
  11241. */
  11242.  
  11243.  
  11244. /** Macro tokens (in reverse order). */
  11245. var builtinMacros = {};
  11246. /**
  11247. * Predefined macros for KaTeX.
  11248. * This can be used to define some commands in terms of others.
  11249. */
  11250.  
  11251. exports.default = builtinMacros;
  11252.  
  11253. // This function might one day accept an additional argument and do more things.
  11254.  
  11255. function defineMacro(name, body) {
  11256. builtinMacros[name] = body;
  11257. }
  11258.  
  11259. //////////////////////////////////////////////////////////////////////
  11260. // basics
  11261. defineMacro("\\bgroup", "{");
  11262. defineMacro("\\egroup", "}");
  11263. defineMacro("\\begingroup", "{");
  11264. defineMacro("\\endgroup", "}");
  11265.  
  11266. // We don't distinguish between math and nonmath kerns.
  11267. // (In TeX, the mu unit works only with \mkern.)
  11268. defineMacro("\\mkern", "\\kern");
  11269.  
  11270. // \llap and \rlap render their contents in text mode
  11271. defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
  11272. defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
  11273. defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
  11274.  
  11275. //////////////////////////////////////////////////////////////////////
  11276. // amsmath.sty
  11277. // http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf
  11278.  
  11279. // \def\overset#1#2{\binrel@{#2}\binrel@@{\mathop{\kern\z@#2}\limits^{#1}}}
  11280. defineMacro("\\overset", "\\mathop{#2}\\limits^{#1}");
  11281. defineMacro("\\underset", "\\mathop{#2}\\limits_{#1}");
  11282.  
  11283. // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}}
  11284. defineMacro("\\boxed", "\\fbox{\\displaystyle{#1}}");
  11285.  
  11286. // \def\iff{\DOTSB\;\Longleftrightarrow\;}
  11287. // \def\implies{\DOTSB\;\Longrightarrow\;}
  11288. // \def\impliedby{\DOTSB\;\Longleftarrow\;}
  11289. defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
  11290. defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
  11291. defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;");
  11292.  
  11293. // AMSMath's automatic \dots, based on \mdots@@ macro.
  11294. var dotsByToken = {
  11295. ',': '\\dotsc',
  11296. '\\not': '\\dotsb',
  11297. // \keybin@ checks for the following:
  11298. '+': '\\dotsb',
  11299. '=': '\\dotsb',
  11300. '<': '\\dotsb',
  11301. '>': '\\dotsb',
  11302. '-': '\\dotsb',
  11303. '*': '\\dotsb',
  11304. ':': '\\dotsb',
  11305. // Symbols whose definition starts with \DOTSB:
  11306. '\\DOTSB': '\\dotsb',
  11307. '\\coprod': '\\dotsb',
  11308. '\\bigvee': '\\dotsb',
  11309. '\\bigwedge': '\\dotsb',
  11310. '\\biguplus': '\\dotsb',
  11311. '\\bigcap': '\\dotsb',
  11312. '\\bigcup': '\\dotsb',
  11313. '\\prod': '\\dotsb',
  11314. '\\sum': '\\dotsb',
  11315. '\\bigotimes': '\\dotsb',
  11316. '\\bigoplus': '\\dotsb',
  11317. '\\bigodot': '\\dotsb',
  11318. '\\bigsqcup': '\\dotsb',
  11319. '\\implies': '\\dotsb',
  11320. '\\impliedby': '\\dotsb',
  11321. '\\And': '\\dotsb',
  11322. '\\longrightarrow': '\\dotsb',
  11323. '\\Longrightarrow': '\\dotsb',
  11324. '\\longleftarrow': '\\dotsb',
  11325. '\\Longleftarrow': '\\dotsb',
  11326. '\\longleftrightarrow': '\\dotsb',
  11327. '\\Longleftrightarrow': '\\dotsb',
  11328. '\\mapsto': '\\dotsb',
  11329. '\\longmapsto': '\\dotsb',
  11330. '\\hookrightarrow': '\\dotsb',
  11331. '\\iff': '\\dotsb',
  11332. '\\doteq': '\\dotsb',
  11333. // Symbols whose definition starts with \mathbin:
  11334. '\\mathbin': '\\dotsb',
  11335. '\\bmod': '\\dotsb',
  11336. // Symbols whose definition starts with \mathrel:
  11337. '\\mathrel': '\\dotsb',
  11338. '\\relbar': '\\dotsb',
  11339. '\\Relbar': '\\dotsb',
  11340. '\\xrightarrow': '\\dotsb',
  11341. '\\xleftarrow': '\\dotsb',
  11342. // Symbols whose definition starts with \DOTSI:
  11343. '\\DOTSI': '\\dotsi',
  11344. '\\int': '\\dotsi',
  11345. '\\oint': '\\dotsi',
  11346. '\\iint': '\\dotsi',
  11347. '\\iiint': '\\dotsi',
  11348. '\\iiiint': '\\dotsi',
  11349. '\\idotsint': '\\dotsi',
  11350. // Symbols whose definition starts with \DOTSX:
  11351. '\\DOTSX': '\\dotsx'
  11352. };
  11353.  
  11354. defineMacro("\\dots", function (context) {
  11355. // TODO: If used in text mode, should expand to \textellipsis.
  11356. // However, in KaTeX, \textellipsis and \ldots behave the same
  11357. // (in text mode), and it's unlikely we'd see any of the math commands
  11358. // that affect the behavior of \dots when in text mode. So fine for now
  11359. // (until we support \ifmmode ... \else ... \fi).
  11360. var thedots = '\\dotso';
  11361. var next = context.expandAfterFuture().text;
  11362. if (next in dotsByToken) {
  11363. thedots = dotsByToken[next];
  11364. } else if (next.substr(0, 4) === '\\not') {
  11365. thedots = '\\dotsb';
  11366. } else if (next in _symbols2.default.math) {
  11367. if (_utils2.default.contains(['bin', 'rel'], _symbols2.default.math[next].group)) {
  11368. thedots = '\\dotsb';
  11369. }
  11370. }
  11371. return thedots;
  11372. });
  11373.  
  11374. var spaceAfterDots = {
  11375. // \rightdelim@ checks for the following:
  11376. ')': true,
  11377. ']': true,
  11378. '\\rbrack': true,
  11379. '\\}': true,
  11380. '\\rbrace': true,
  11381. '\\rangle': true,
  11382. '\\rceil': true,
  11383. '\\rfloor': true,
  11384. '\\rgroup': true,
  11385. '\\rmoustache': true,
  11386. '\\right': true,
  11387. '\\bigr': true,
  11388. '\\biggr': true,
  11389. '\\Bigr': true,
  11390. '\\Biggr': true,
  11391. // \extra@ also tests for the following:
  11392. '$': true,
  11393. // \extrap@ checks for the following:
  11394. ';': true,
  11395. '.': true,
  11396. ',': true
  11397. };
  11398.  
  11399. defineMacro("\\dotso", function (context) {
  11400. var next = context.future().text;
  11401. if (next in spaceAfterDots) {
  11402. return "\\ldots\\,";
  11403. } else {
  11404. return "\\ldots";
  11405. }
  11406. });
  11407.  
  11408. defineMacro("\\dotsc", function (context) {
  11409. var next = context.future().text;
  11410. // \dotsc uses \extra@ but not \extrap@, instead specially checking for
  11411. // ';' and '.', but doesn't check for ','.
  11412. if (next in spaceAfterDots && next !== ',') {
  11413. return "\\ldots\\,";
  11414. } else {
  11415. return "\\ldots";
  11416. }
  11417. });
  11418.  
  11419. defineMacro("\\cdots", function (context) {
  11420. var next = context.future().text;
  11421. if (next in spaceAfterDots) {
  11422. return "\\@cdots\\,";
  11423. } else {
  11424. return "\\@cdots";
  11425. }
  11426. });
  11427.  
  11428. defineMacro("\\dotsb", "\\cdots");
  11429. defineMacro("\\dotsm", "\\cdots");
  11430. defineMacro("\\dotsi", "\\!\\cdots");
  11431. // amsmath doesn't actually define \dotsx, but \dots followed by a macro
  11432. // starting with \DOTSX implies \dotso, and then \extra@ detects this case
  11433. // and forces the added `\,`.
  11434. defineMacro("\\dotsx", "\\ldots\\,");
  11435.  
  11436. // \let\DOTSI\relax
  11437. // \let\DOTSB\relax
  11438. // \let\DOTSX\relax
  11439. defineMacro("\\DOTSI", "\\relax");
  11440. defineMacro("\\DOTSB", "\\relax");
  11441. defineMacro("\\DOTSX", "\\relax");
  11442.  
  11443. // http://texdoc.net/texmf-dist/doc/latex/amsmath/amsmath.pdf
  11444. defineMacro("\\thinspace", "\\,"); // \let\thinspace\,
  11445. defineMacro("\\medspace", "\\:"); // \let\medspace\:
  11446. defineMacro("\\thickspace", "\\;"); // \let\thickspace\;
  11447.  
  11448. //////////////////////////////////////////////////////////////////////
  11449. // LaTeX source2e
  11450.  
  11451. // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace}
  11452. // \def\@hspace#1{\hskip #1\relax}
  11453. // KaTeX doesn't do line breaks, so \hspace is the same as \kern
  11454. defineMacro("\\hspace", "\\kern{#1}");
  11455.  
  11456. //////////////////////////////////////////////////////////////////////
  11457. // mathtools.sty
  11458.  
  11459. //\providecommand\ordinarycolon{:}
  11460. defineMacro("\\ordinarycolon", ":");
  11461. //\def\vcentcolon{\mathrel{\mathop\ordinarycolon}}
  11462. //TODO(edemaine): Not yet centered. Fix via \raisebox or #726
  11463. defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}");
  11464. // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon}
  11465. defineMacro("\\dblcolon", "\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon");
  11466. // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
  11467. defineMacro("\\coloneqq", "\\vcentcolon\\mathrel{\\mkern-1.2mu}=");
  11468. // \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=}
  11469. defineMacro("\\Coloneqq", "\\dblcolon\\mathrel{\\mkern-1.2mu}=");
  11470. // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
  11471. defineMacro("\\coloneq", "\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}");
  11472. // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
  11473. defineMacro("\\Coloneq", "\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}");
  11474. // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
  11475. defineMacro("\\eqqcolon", "=\\mathrel{\\mkern-1.2mu}\\vcentcolon");
  11476. // \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
  11477. defineMacro("\\Eqqcolon", "=\\mathrel{\\mkern-1.2mu}\\dblcolon");
  11478. // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
  11479. defineMacro("\\eqcolon", "\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon");
  11480. // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
  11481. defineMacro("\\Eqcolon", "\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon");
  11482. // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
  11483. defineMacro("\\colonapprox", "\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx");
  11484. // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
  11485. defineMacro("\\Colonapprox", "\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx");
  11486. // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
  11487. defineMacro("\\colonsim", "\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim");
  11488. // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}
  11489. defineMacro("\\Colonsim", "\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim");
  11490.  
  11491. //////////////////////////////////////////////////////////////////////
  11492. // colonequals.sty
  11493.  
  11494. // Alternate names for mathtools's macros:
  11495. defineMacro("\\ratio", "\\vcentcolon");
  11496. defineMacro("\\coloncolon", "\\dblcolon");
  11497. defineMacro("\\colonequals", "\\coloneqq");
  11498. defineMacro("\\coloncolonequals", "\\Coloneqq");
  11499. defineMacro("\\equalscolon", "\\eqqcolon");
  11500. defineMacro("\\equalscoloncolon", "\\Eqqcolon");
  11501. defineMacro("\\colonminus", "\\coloneq");
  11502. defineMacro("\\coloncolonminus", "\\Coloneq");
  11503. defineMacro("\\minuscolon", "\\eqcolon");
  11504. defineMacro("\\minuscoloncolon", "\\Eqcolon");
  11505. // \colonapprox name is same in mathtools and colonequals.
  11506. defineMacro("\\coloncolonapprox", "\\Colonapprox");
  11507. // \colonsim name is same in mathtools and colonequals.
  11508. defineMacro("\\coloncolonsim", "\\Colonsim");
  11509.  
  11510. // Additional macros, implemented by analogy with mathtools definitions:
  11511. defineMacro("\\simcolon", "\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon");
  11512. defineMacro("\\simcoloncolon", "\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon");
  11513. defineMacro("\\approxcolon", "\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon");
  11514. defineMacro("\\approxcoloncolon", "\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon");
  11515.  
  11516. },{"./Token":90,"./symbols":112,"./utils":115}],108:[function(require,module,exports){
  11517. "use strict";
  11518.  
  11519. Object.defineProperty(exports, "__esModule", {
  11520. value: true
  11521. });
  11522.  
  11523. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  11524.  
  11525. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  11526.  
  11527. var _createClass2 = require("babel-runtime/helpers/createClass");
  11528.  
  11529. var _createClass3 = _interopRequireDefault(_createClass2);
  11530.  
  11531. var _utils = require("./utils");
  11532.  
  11533. var _utils2 = _interopRequireDefault(_utils);
  11534.  
  11535. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11536.  
  11537. /**
  11538. * This node represents a general purpose MathML node of any type. The
  11539. * constructor requires the type of node to create (for example, `"mo"` or
  11540. * `"mspace"`, corresponding to `<mo>` and `<mspace>` tags).
  11541. */
  11542. var MathNode = function () {
  11543. function MathNode(type, children) {
  11544. (0, _classCallCheck3.default)(this, MathNode);
  11545.  
  11546. this.type = type;
  11547. this.attributes = {};
  11548. this.children = children || [];
  11549. }
  11550.  
  11551. /**
  11552. * Sets an attribute on a MathML node. MathML depends on attributes to convey a
  11553. * semantic content, so this is used heavily.
  11554. */
  11555.  
  11556.  
  11557. (0, _createClass3.default)(MathNode, [{
  11558. key: "setAttribute",
  11559. value: function setAttribute(name, value) {
  11560. this.attributes[name] = value;
  11561. }
  11562.  
  11563. /**
  11564. * Converts the math node into a MathML-namespaced DOM element.
  11565. */
  11566.  
  11567. }, {
  11568. key: "toNode",
  11569. value: function toNode() {
  11570. var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
  11571.  
  11572. for (var attr in this.attributes) {
  11573. if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
  11574. node.setAttribute(attr, this.attributes[attr]);
  11575. }
  11576. }
  11577.  
  11578. for (var i = 0; i < this.children.length; i++) {
  11579. node.appendChild(this.children[i].toNode());
  11580. }
  11581.  
  11582. return node;
  11583. }
  11584.  
  11585. /**
  11586. * Converts the math node into an HTML markup string.
  11587. */
  11588.  
  11589. }, {
  11590. key: "toMarkup",
  11591. value: function toMarkup() {
  11592. var markup = "<" + this.type;
  11593.  
  11594. // Add the attributes
  11595. for (var attr in this.attributes) {
  11596. if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
  11597. markup += " " + attr + "=\"";
  11598. markup += _utils2.default.escape(this.attributes[attr]);
  11599. markup += "\"";
  11600. }
  11601. }
  11602.  
  11603. markup += ">";
  11604.  
  11605. for (var i = 0; i < this.children.length; i++) {
  11606. markup += this.children[i].toMarkup();
  11607. }
  11608.  
  11609. markup += "</" + this.type + ">";
  11610.  
  11611. return markup;
  11612. }
  11613. }]);
  11614. return MathNode;
  11615. }();
  11616.  
  11617. /**
  11618. * This node represents a piece of text.
  11619. */
  11620. /**
  11621. * These objects store data about MathML nodes. This is the MathML equivalent
  11622. * of the types in domTree.js. Since MathML handles its own rendering, and
  11623. * since we're mainly using MathML to improve accessibility, we don't manage
  11624. * any of the styling state that the plain DOM nodes do.
  11625. *
  11626. * The `toNode` and `toMarkup` functions work simlarly to how they do in
  11627. * domTree.js, creating namespaced DOM nodes and HTML text markup respectively.
  11628. */
  11629.  
  11630. var TextNode = function () {
  11631. function TextNode(text) {
  11632. (0, _classCallCheck3.default)(this, TextNode);
  11633.  
  11634. this.text = text;
  11635. }
  11636.  
  11637. /**
  11638. * Converts the text node into a DOM text node.
  11639. */
  11640.  
  11641.  
  11642. (0, _createClass3.default)(TextNode, [{
  11643. key: "toNode",
  11644. value: function toNode() {
  11645. return document.createTextNode(this.text);
  11646. }
  11647.  
  11648. /**
  11649. * Converts the text node into HTML markup (which is just the text itself).
  11650. */
  11651.  
  11652. }, {
  11653. key: "toMarkup",
  11654. value: function toMarkup() {
  11655. return _utils2.default.escape(this.text);
  11656. }
  11657. }]);
  11658. return TextNode;
  11659. }();
  11660.  
  11661. exports.default = {
  11662. MathNode: MathNode,
  11663. TextNode: TextNode
  11664. };
  11665.  
  11666. },{"./utils":115,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],109:[function(require,module,exports){
  11667. 'use strict';
  11668.  
  11669. Object.defineProperty(exports, "__esModule", {
  11670. value: true
  11671. });
  11672.  
  11673. var _Parser = require('./Parser');
  11674.  
  11675. var _Parser2 = _interopRequireDefault(_Parser);
  11676.  
  11677. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11678.  
  11679. /**
  11680. * Parses an expression using a Parser, then returns the parsed result.
  11681. */
  11682. var parseTree = function parseTree(toParse, settings) {
  11683. if (!(typeof toParse === 'string' || toParse instanceof String)) {
  11684. throw new TypeError('KaTeX can only parse string typed expression');
  11685. }
  11686. var parser = new _Parser2.default(toParse, settings);
  11687.  
  11688. return parser.parse();
  11689. }; /**
  11690. * Provides a single function for parsing an expression using a Parser
  11691. * TODO(emily): Remove this
  11692. */
  11693.  
  11694. exports.default = parseTree;
  11695.  
  11696. },{"./Parser":86}],110:[function(require,module,exports){
  11697. "use strict";
  11698.  
  11699. Object.defineProperty(exports, "__esModule", {
  11700. value: true
  11701. });
  11702.  
  11703. var _slicedToArray2 = require("babel-runtime/helpers/slicedToArray");
  11704.  
  11705. var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
  11706.  
  11707. var _domTree = require("./domTree");
  11708.  
  11709. var _domTree2 = _interopRequireDefault(_domTree);
  11710.  
  11711. var _buildCommon = require("./buildCommon");
  11712.  
  11713. var _buildCommon2 = _interopRequireDefault(_buildCommon);
  11714.  
  11715. var _mathMLTree = require("./mathMLTree");
  11716.  
  11717. var _mathMLTree2 = _interopRequireDefault(_mathMLTree);
  11718.  
  11719. var _utils = require("./utils");
  11720.  
  11721. var _utils2 = _interopRequireDefault(_utils);
  11722.  
  11723. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11724.  
  11725. /**
  11726. * This file provides support to buildMathML.js and buildHTML.js
  11727. * for stretchy wide elements rendered from SVG files
  11728. * and other CSS trickery.
  11729. */
  11730.  
  11731. var stretchyCodePoint = {
  11732. widehat: "^",
  11733. widetilde: "~",
  11734. undertilde: "~",
  11735. overleftarrow: "\u2190",
  11736. underleftarrow: "\u2190",
  11737. xleftarrow: "\u2190",
  11738. overrightarrow: "\u2192",
  11739. underrightarrow: "\u2192",
  11740. xrightarrow: "\u2192",
  11741. underbrace: "\u23B5",
  11742. overbrace: "\u23DE",
  11743. overleftrightarrow: "\u2194",
  11744. underleftrightarrow: "\u2194",
  11745. xleftrightarrow: "\u2194",
  11746. Overrightarrow: "\u21D2",
  11747. xRightarrow: "\u21D2",
  11748. overleftharpoon: "\u21BC",
  11749. xleftharpoonup: "\u21BC",
  11750. overrightharpoon: "\u21C0",
  11751. xrightharpoonup: "\u21C0",
  11752. xLeftarrow: "\u21D0",
  11753. xLeftrightarrow: "\u21D4",
  11754. xhookleftarrow: "\u21A9",
  11755. xhookrightarrow: "\u21AA",
  11756. xmapsto: "\u21A6",
  11757. xrightharpoondown: "\u21C1",
  11758. xleftharpoondown: "\u21BD",
  11759. xrightleftharpoons: "\u21CC",
  11760. xleftrightharpoons: "\u21CB",
  11761. xtwoheadleftarrow: "\u219E",
  11762. xtwoheadrightarrow: "\u21A0",
  11763. xLongequal: "=",
  11764. xtofrom: "\u21C4"
  11765. };
  11766.  
  11767. var mathMLnode = function mathMLnode(label) {
  11768. var node = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode(stretchyCodePoint[label.substr(1)])]);
  11769. node.setAttribute("stretchy", "true");
  11770. return node;
  11771. };
  11772.  
  11773. // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts.
  11774. // Copyright (c) 2009-2010, Design Science, Inc. (<www.mathjax.org>)
  11775. // Copyright (c) 2014-2017 Khan Academy (<www.khanacademy.org>)
  11776. // Licensed under the SIL Open Font License, Version 1.1.
  11777. // See \nhttp://scripts.sil.org/OFL
  11778.  
  11779. // Very Long SVGs
  11780. // Many of the KaTeX stretchy wide elements use a long SVG image and an
  11781. // overflow: hidden tactic to achieve a stretchy image while avoiding
  11782. // distortion of arrowheads or brace corners.
  11783.  
  11784. // The SVG typically contains a very long (400 em) arrow.
  11785.  
  11786. // The SVG is in a container span that has overflow: hidden, so the span
  11787. // acts like a window that exposes only part of the SVG.
  11788.  
  11789. // The SVG always has a longer, thinner aspect ratio than the container span.
  11790. // After the SVG fills 100% of the height of the container span,
  11791. // there is a long arrow shaft left over. That left-over shaft is not shown.
  11792. // Instead, it is sliced off because the span's CSS has overflow: hidden.
  11793.  
  11794. // Thus, the reader sees an arrow that matches the subject matter width
  11795. // without distortion.
  11796.  
  11797. // Some functions, such as \cancel, need to vary their aspect ratio. These
  11798. // functions do not get the overflow SVG treatment.
  11799.  
  11800. // Second Brush Stroke
  11801. // Low resolution monitors struggle to display images in fine detail.
  11802. // So browsers apply anti-aliasing. A long straight arrow shaft therefore
  11803. // will sometimes appear as if it has a blurred edge.
  11804.  
  11805. // To mitigate this, these SVG files contain a second "brush-stroke" on the
  11806. // arrow shafts. That is, a second long thin rectangular SVG path has been
  11807. // written directly on top of each arrow shaft. This reinforcement causes
  11808. // some of the screen pixels to display as black instead of the anti-aliased
  11809. // gray pixel that a single path would generate. So we get arrow shafts
  11810. // whose edges appear to be sharper.
  11811.  
  11812. // In the katexImagesData object just below, the dimensions all
  11813. // correspond to path geometry inside the relevant SVG.
  11814. // For example, \overrightarrow uses the same arrowhead as glyph U+2192
  11815. // from the KaTeX Main font. The scaling factor is 1000.
  11816. // That is, inside the font, that arrowhead is 522 units tall, which
  11817. // corresponds to 0.522 em inside the document.
  11818.  
  11819. var katexImagesData = {
  11820. // path(s), minWidth, height, align
  11821. overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
  11822. overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
  11823. underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
  11824. underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
  11825. xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"],
  11826. xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"],
  11827. Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"],
  11828. xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"],
  11829. xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"],
  11830. overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"],
  11831. xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"],
  11832. xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"],
  11833. overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
  11834. xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
  11835. xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"],
  11836. xLongequal: [["longequal"], 0.888, 334, "xMinYMin"],
  11837. xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"],
  11838. xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"],
  11839.  
  11840. overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
  11841. overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548],
  11842. underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548],
  11843. underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
  11844. xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522],
  11845. xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560],
  11846. xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716],
  11847. xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716],
  11848. xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522],
  11849. xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522],
  11850. overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
  11851. underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
  11852. overgroup: [["leftgroup", "rightgroup"], 0.888, 342],
  11853. undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342],
  11854. xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522],
  11855. xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528]
  11856. };
  11857.  
  11858. var groupLength = function groupLength(arg) {
  11859. if (arg.type === "ordgroup") {
  11860. return arg.value.length;
  11861. } else {
  11862. return 1;
  11863. }
  11864. };
  11865.  
  11866. var svgSpan = function svgSpan(group, options) {
  11867. // Create a span with inline SVG for the element.
  11868. var label = group.value.label.substr(1);
  11869. var attributes = [];
  11870. var height = void 0;
  11871. var viewBoxWidth = 400000; // default
  11872. var viewBoxHeight = 0;
  11873. var minWidth = 0;
  11874. var path = void 0;
  11875. var paths = void 0;
  11876. var pathName = void 0;
  11877. var svgNode = void 0;
  11878. var span = void 0;
  11879.  
  11880. if (_utils2.default.contains(["widehat", "widetilde", "undertilde"], label)) {
  11881. // There are four SVG images available for each function.
  11882. // Choose a taller image when there are more characters.
  11883. var numChars = groupLength(group.value.base);
  11884. var _viewBoxHeight = void 0;
  11885.  
  11886. if (numChars > 5) {
  11887. _viewBoxHeight = label === "widehat" ? 420 : 312;
  11888. viewBoxWidth = label === "widehat" ? 2364 : 2340;
  11889. // Next get the span height, in 1000 ems
  11890. height = label === "widehat" ? 0.42 : 0.34;
  11891. pathName = (label === "widehat" ? "widehat" : "tilde") + "4";
  11892. } else {
  11893. var imgIndex = [1, 1, 2, 2, 3, 3][numChars];
  11894. if (label === "widehat") {
  11895. viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex];
  11896. _viewBoxHeight = [0, 239, 300, 360, 420][imgIndex];
  11897. height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex];
  11898. pathName = "widehat" + imgIndex;
  11899. } else {
  11900. viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex];
  11901. _viewBoxHeight = [0, 260, 286, 306, 312][imgIndex];
  11902. height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex];
  11903. pathName = "tilde" + imgIndex;
  11904. }
  11905. }
  11906. path = new _domTree2.default.pathNode(pathName);
  11907. attributes.push(["width", "100%"]);
  11908. attributes.push(["height", height + "em"]);
  11909. attributes.push(["viewBox", "0 0 " + viewBoxWidth + " " + _viewBoxHeight]);
  11910. attributes.push(["preserveAspectRatio", "none"]);
  11911.  
  11912. svgNode = new _domTree2.default.svgNode([path], attributes);
  11913. span = _buildCommon2.default.makeSpan([], [svgNode], options);
  11914. } else {
  11915. var widthClass = void 0;
  11916. var align = void 0;
  11917. var spans = [];
  11918.  
  11919. var _katexImagesData$labe = (0, _slicedToArray3.default)(katexImagesData[label], 4);
  11920.  
  11921. paths = _katexImagesData$labe[0];
  11922. minWidth = _katexImagesData$labe[1];
  11923. viewBoxHeight = _katexImagesData$labe[2];
  11924. align = _katexImagesData$labe[3];
  11925.  
  11926. var numSvgChildren = paths.length;
  11927. height = viewBoxHeight / 1000;
  11928.  
  11929. for (var i = 0; i < numSvgChildren; i++) {
  11930. path = new _domTree2.default.pathNode(paths[i]);
  11931.  
  11932. attributes = [["width", "400em"], ["height", height + "em"]];
  11933. attributes.push(["viewBox", "0 0 " + viewBoxWidth + " " + viewBoxHeight]);
  11934.  
  11935. if (numSvgChildren === 2) {
  11936. widthClass = ["halfarrow-left", "halfarrow-right"][i];
  11937. align = ["xMinYMin", "xMaxYMin"][i];
  11938. } else if (numSvgChildren === 3) {
  11939. widthClass = ["brace-left", "brace-center", "brace-right"][i];
  11940. align = ["xMinYMin", "xMidYMin", "xMaxYMin"][i];
  11941. }
  11942.  
  11943. attributes.push(["preserveAspectRatio", align + " slice"]);
  11944. svgNode = new _domTree2.default.svgNode([path], attributes);
  11945.  
  11946. if (numSvgChildren === 1) {
  11947. span = _buildCommon2.default.makeSpan(["hide-tail"], [svgNode], options);
  11948. } else {
  11949. span = _buildCommon2.default.makeSpan([widthClass], [svgNode], options);
  11950. span.style.height = height + "em";
  11951. spans.push(span);
  11952. }
  11953. }
  11954.  
  11955. if (numSvgChildren > 1) {
  11956. span = _buildCommon2.default.makeSpan(["stretchy"], spans, options);
  11957. }
  11958. }
  11959.  
  11960. // Note that we are returning span.depth = 0.
  11961. // Any adjustments relative to the baseline must be done in buildHTML.
  11962. span.height = height;
  11963. span.style.height = height + "em";
  11964. if (minWidth > 0) {
  11965. span.style.minWidth = minWidth + "em";
  11966. }
  11967.  
  11968. return span;
  11969. };
  11970.  
  11971. var encloseSpan = function encloseSpan(inner, label, pad, options) {
  11972. // Return an image span for \cancel, \bcancel, \xcancel, or \fbox
  11973. var img = void 0;
  11974. var totalHeight = inner.height + inner.depth + 2 * pad;
  11975.  
  11976. if (/(fbox)|(color)/.test(label)) {
  11977. img = _buildCommon2.default.makeSpan(["stretchy", label], [], options);
  11978.  
  11979. if (label === "fbox" && options.color) {
  11980. img.style.borderColor = options.getColor();
  11981. }
  11982. } else {
  11983. // \cancel, \bcancel, or \xcancel
  11984. // Since \cancel's SVG is inline and it omits the viewBox attribute,
  11985. // its stroke-width will not vary with span area.
  11986.  
  11987. var attributes = [["x1", "0"]];
  11988. var lines = [];
  11989.  
  11990. if (label !== "cancel") {
  11991. attributes.push(["y1", "0"]);
  11992. attributes.push(["x2", "100%"]);
  11993. attributes.push(["y2", "100%"]);
  11994. attributes.push(["stroke-width", "0.046em"]);
  11995. lines.push(new _domTree2.default.lineNode(attributes));
  11996. }
  11997.  
  11998. if (label === "xcancel") {
  11999. attributes = [["x1", "0"]]; // start a second line.
  12000. }
  12001.  
  12002. if (label !== "bcancel") {
  12003. attributes.push(["y1", "100%"]);
  12004. attributes.push(["x2", "100%"]);
  12005. attributes.push(["y2", "0"]);
  12006. attributes.push(["stroke-width", "0.046em"]);
  12007. lines.push(new _domTree2.default.lineNode(attributes));
  12008. }
  12009.  
  12010. attributes = [["width", "100%"], ["height", totalHeight + "em"]];
  12011. var svgNode = new _domTree2.default.svgNode(lines, attributes);
  12012.  
  12013. img = _buildCommon2.default.makeSpan([], [svgNode], options);
  12014. }
  12015.  
  12016. img.height = totalHeight;
  12017. img.style.height = totalHeight + "em";
  12018.  
  12019. return img;
  12020. };
  12021.  
  12022. exports.default = {
  12023. encloseSpan: encloseSpan,
  12024. mathMLnode: mathMLnode,
  12025. svgSpan: svgSpan
  12026. };
  12027.  
  12028. },{"./buildCommon":91,"./domTree":98,"./mathMLTree":108,"./utils":115,"babel-runtime/helpers/slicedToArray":10}],111:[function(require,module,exports){
  12029. "use strict";
  12030.  
  12031. Object.defineProperty(exports, "__esModule", {
  12032. value: true
  12033. });
  12034. var path = {
  12035. // sqrtMain path geometry is from glyph U221A in the font KaTeX Main
  12036. sqrtMain: "M95 622c-2.667 0-7.167-2.667-13.5\n-8S72 604 72 600c0-2 .333-3.333 1-4 1.333-2.667 23.833-20.667 67.5-54s\n65.833-50.333 66.5-51c1.333-1.333 3-2 5-2 4.667 0 8.667 3.333 12 10l173\n378c.667 0 35.333-71 104-213s137.5-285 206.5-429S812 17.333 812 14c5.333\n-9.333 12-14 20-14h399166v40H845.272L620 507 385 993c-2.667 4.667-9 7-19\n7-6 0-10-1-12-3L160 575l-65 47zM834 0h399166v40H845z",
  12037.  
  12038. // size1 is from glyph U221A in the font KaTeX_Size1-Regular
  12039. sqrtSize1: "M263 601c.667 0 18 39.667 52 119s68.167\n 158.667 102.5 238 51.833 119.333 52.5 120C810 373.333 980.667 17.667 982 11\nc4.667-7.333 11-11 19-11h398999v40H1012.333L741 607c-38.667 80.667-84 175-136\n 283s-89.167 185.333-111.5 232-33.833 70.333-34.5 71c-4.667 4.667-12.333 7-23\n 7l-12-1-109-253c-72.667-168-109.333-252-110-252-10.667 8-22 16.667-34 26-22\n 17.333-33.333 26-34 26l-26-26 76-59 76-60zM1001 0h398999v40H1012z",
  12040.  
  12041. // size2 is from glyph U221A in the font KaTeX_Size2-Regular
  12042. sqrtSize2: "M1001 0h398999v40H1013.084S929.667 308 749\n 880s-277 876.333-289 913c-4.667 4.667-12.667 7-24 7h-12c-1.333-3.333-3.667\n-11.667-7-25-35.333-125.333-106.667-373.333-214-744-10 12-21 25-33 39l-32 39\nc-6-5.333-15-14-27-26l25-30c26.667-32.667 52-63 76-91l52-60 208 722c56-175.333\n 126.333-397.333 211-666s153.833-488.167 207.5-658.5C944.167 129.167 975 32.667\n 983 10c4-6.667 10-10 18-10zm0 0h398999v40H1013z",
  12043.  
  12044. // size3 is from glyph U221A in the font KaTeX_Size3-Regular
  12045. sqrtSize3: "M424 2398c-1.333-.667-38.5-172-111.5-514 S202.667 1370.667 202\n 1370c0-2-10.667 14.333-32 49-4.667 7.333-9.833 15.667-15.5 25s-9.833 16-12.5\n 20l-5 7c-4-3.333-8.333-7.667-13-13l-13-13 76-122 77-121 209 968c0-2 84.667\n-361.667 254-1079C896.333 373.667 981.667 13.333 983 10c4-6.667 10-10 18-10\nh398999v40H1014.622S927.332 418.667 742 1206c-185.333 787.333-279.333 1182.333\n-282 1185-2 6-10 9-24 9-8 0-12-.667-12-2zM1001 0h398999v40H1014z",
  12046.  
  12047. // size4 is from glyph U221A in the font KaTeX_Size4-Regular
  12048. sqrtSize4: "M473 2713C812.333 913.667 982.333 13 983 11c3.333-7.333 9.333\n-11 18-11h399110v40H1017.698S927.168 518 741.5 1506C555.833 2494 462 2989 460\n 2991c-2 6-10 9-24 9-8 0-12-.667-12-2s-5.333-32-16-92c-50.667-293.333-119.667\n-693.333-207-1200 0-1.333-5.333 8.667-16 30l-32 64-16 33-26-26 76-153 77-151\nc.667.667 35.667 202 105 604 67.333 400.667 102 602.667 104 606z\nM1001 0h398999v40H1017z",
  12049.  
  12050. // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
  12051. 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",
  12052.  
  12053. // doublerightarrow is from glyph U+21D2 in font KaTeX Main
  12054. 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",
  12055.  
  12056. // leftarrow is from glyph U+2190 in font KaTeX Main
  12057. 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",
  12058.  
  12059. // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular
  12060. 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",
  12061.  
  12062. 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",
  12063.  
  12064. // overgroup is from the MnSymbol package (public domain)
  12065. 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",
  12066.  
  12067. 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",
  12068.  
  12069. // Harpoons are from glyph U+21BD in font KaTeX Main
  12070. 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",
  12071.  
  12072. 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",
  12073.  
  12074. 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",
  12075.  
  12076. 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",
  12077.  
  12078. // hook is from glyph U+21A9 in font KaTeX Main
  12079. 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",
  12080.  
  12081. leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",
  12082.  
  12083. leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",
  12084.  
  12085. // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
  12086. 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",
  12087.  
  12088. longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",
  12089.  
  12090. 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",
  12091.  
  12092. 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",
  12093.  
  12094. 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",
  12095.  
  12096. 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",
  12097.  
  12098. 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",
  12099.  
  12100. 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",
  12101.  
  12102. 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",
  12103.  
  12104. 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",
  12105.  
  12106. 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",
  12107.  
  12108. 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",
  12109.  
  12110. 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",
  12111.  
  12112. 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",
  12113.  
  12114. rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",
  12115.  
  12116. 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",
  12117.  
  12118. // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
  12119. 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",
  12120.  
  12121. 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",
  12122.  
  12123. // tilde1 is a modified version of a glyph from the MnSymbol package
  12124. 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",
  12125.  
  12126. // ditto tilde2, tilde3, & tilde4
  12127. 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",
  12128.  
  12129. 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",
  12130.  
  12131. 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",
  12132.  
  12133. // widehat1 is a modified version of a glyph from the MnSymbol package
  12134. 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",
  12135.  
  12136. // ditto widehat2, widehat3, & widehat4
  12137. 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",
  12138.  
  12139. 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",
  12140.  
  12141. 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"
  12142. };
  12143.  
  12144. exports.default = { path: path };
  12145.  
  12146. },{}],112:[function(require,module,exports){
  12147. "use strict";
  12148.  
  12149. Object.defineProperty(exports, "__esModule", {
  12150. value: true
  12151. });
  12152.  
  12153. /**
  12154. * This file holds a list of all no-argument functions and single-character
  12155. * symbols (like 'a' or ';').
  12156. *
  12157. * For each of the symbols, there are three properties they can have:
  12158. * - font (required): the font to be used for this symbol. Either "main" (the
  12159. normal font), or "ams" (the ams fonts).
  12160. * - group (required): the ParseNode group type the symbol should have (i.e.
  12161. "textord", "mathord", etc).
  12162. See https://github.com/Khan/KaTeX/wiki/Examining-TeX#group-types
  12163. * - replace: the character that this symbol or function should be
  12164. * replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi
  12165. * character in the main font).
  12166. *
  12167. * The outermost map in the table indicates what mode the symbols should be
  12168. * accepted in (e.g. "math" or "text").
  12169. */
  12170.  
  12171. var symbols = {
  12172. "math": {},
  12173. "text": {}
  12174. };
  12175. exports.default = symbols;
  12176.  
  12177. /** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
  12178.  
  12179. function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) {
  12180. symbols[mode][name] = { font: font, group: group, replace: replace };
  12181.  
  12182. if (acceptUnicodeChar && replace) {
  12183. symbols[mode][replace] = symbols[mode][name];
  12184. }
  12185. }
  12186.  
  12187. // Some abbreviations for commonly used strings.
  12188. // This helps minify the code, and also spotting typos using jshint.
  12189.  
  12190. // modes:
  12191. var math = "math";
  12192. var text = "text";
  12193.  
  12194. // fonts:
  12195. var main = "main";
  12196. var ams = "ams";
  12197.  
  12198. // groups:
  12199. var accent = "accent";
  12200. var bin = "bin";
  12201. var close = "close";
  12202. var inner = "inner";
  12203. var mathord = "mathord";
  12204. var op = "op";
  12205. var open = "open";
  12206. var punct = "punct";
  12207. var rel = "rel";
  12208. var spacing = "spacing";
  12209. var textord = "textord";
  12210.  
  12211. // Now comes the symbol table
  12212.  
  12213. // Relation Symbols
  12214. defineSymbol(math, main, rel, "\u2261", "\\equiv");
  12215. defineSymbol(math, main, rel, "\u227A", "\\prec");
  12216. defineSymbol(math, main, rel, "\u227B", "\\succ");
  12217. defineSymbol(math, main, rel, "\u223C", "\\sim");
  12218. defineSymbol(math, main, rel, "\u22A5", "\\perp");
  12219. defineSymbol(math, main, rel, "\u2AAF", "\\preceq");
  12220. defineSymbol(math, main, rel, "\u2AB0", "\\succeq");
  12221. defineSymbol(math, main, rel, "\u2243", "\\simeq");
  12222. defineSymbol(math, main, rel, "\u2223", "\\mid");
  12223. defineSymbol(math, main, rel, "\u226A", "\\ll");
  12224. defineSymbol(math, main, rel, "\u226B", "\\gg");
  12225. defineSymbol(math, main, rel, "\u224D", "\\asymp");
  12226. defineSymbol(math, main, rel, "\u2225", "\\parallel");
  12227. defineSymbol(math, main, rel, "\u22C8", "\\bowtie");
  12228. defineSymbol(math, main, rel, "\u2323", "\\smile");
  12229. defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq");
  12230. defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq");
  12231. defineSymbol(math, main, rel, "\u2250", "\\doteq");
  12232. defineSymbol(math, main, rel, "\u2322", "\\frown");
  12233. defineSymbol(math, main, rel, "\u220B", "\\ni");
  12234. defineSymbol(math, main, rel, "\u221D", "\\propto");
  12235. defineSymbol(math, main, rel, "\u22A2", "\\vdash");
  12236. defineSymbol(math, main, rel, "\u22A3", "\\dashv");
  12237. defineSymbol(math, main, rel, "\u220B", "\\owns");
  12238.  
  12239. // Punctuation
  12240. defineSymbol(math, main, punct, ".", "\\ldotp");
  12241. defineSymbol(math, main, punct, "\u22C5", "\\cdotp");
  12242.  
  12243. // Misc Symbols
  12244. defineSymbol(math, main, textord, "#", "\\#");
  12245. defineSymbol(text, main, textord, "#", "\\#");
  12246. defineSymbol(math, main, textord, "&", "\\&");
  12247. defineSymbol(text, main, textord, "&", "\\&");
  12248. defineSymbol(math, main, textord, "\u2135", "\\aleph");
  12249. defineSymbol(math, main, textord, "\u2200", "\\forall");
  12250. defineSymbol(math, main, textord, "\u210F", "\\hbar");
  12251. defineSymbol(math, main, textord, "\u2203", "\\exists");
  12252. defineSymbol(math, main, textord, "\u2207", "\\nabla");
  12253. defineSymbol(math, main, textord, "\u266D", "\\flat");
  12254. defineSymbol(math, main, textord, "\u2113", "\\ell");
  12255. defineSymbol(math, main, textord, "\u266E", "\\natural");
  12256. defineSymbol(math, main, textord, "\u2663", "\\clubsuit");
  12257. defineSymbol(math, main, textord, "\u2118", "\\wp");
  12258. defineSymbol(math, main, textord, "\u266F", "\\sharp");
  12259. defineSymbol(math, main, textord, "\u2662", "\\diamondsuit");
  12260. defineSymbol(math, main, textord, "\u211C", "\\Re");
  12261. defineSymbol(math, main, textord, "\u2661", "\\heartsuit");
  12262. defineSymbol(math, main, textord, "\u2111", "\\Im");
  12263. defineSymbol(math, main, textord, "\u2660", "\\spadesuit");
  12264.  
  12265. // Math and Text
  12266. defineSymbol(math, main, textord, "\u2020", "\\dag");
  12267. defineSymbol(text, main, textord, "\u2020", "\\dag");
  12268. defineSymbol(text, main, textord, "\u2020", "\\textdagger");
  12269. defineSymbol(math, main, textord, "\u2021", "\\ddag");
  12270. defineSymbol(text, main, textord, "\u2021", "\\ddag");
  12271. defineSymbol(text, main, textord, "\u2020", "\\textdaggerdbl");
  12272.  
  12273. // Large Delimiters
  12274. defineSymbol(math, main, close, "\u23B1", "\\rmoustache");
  12275. defineSymbol(math, main, open, "\u23B0", "\\lmoustache");
  12276. defineSymbol(math, main, close, "\u27EF", "\\rgroup");
  12277. defineSymbol(math, main, open, "\u27EE", "\\lgroup");
  12278.  
  12279. // Binary Operators
  12280. defineSymbol(math, main, bin, "\u2213", "\\mp");
  12281. defineSymbol(math, main, bin, "\u2296", "\\ominus");
  12282. defineSymbol(math, main, bin, "\u228E", "\\uplus");
  12283. defineSymbol(math, main, bin, "\u2293", "\\sqcap");
  12284. defineSymbol(math, main, bin, "\u2217", "\\ast");
  12285. defineSymbol(math, main, bin, "\u2294", "\\sqcup");
  12286. defineSymbol(math, main, bin, "\u25EF", "\\bigcirc");
  12287. defineSymbol(math, main, bin, "\u2219", "\\bullet");
  12288. defineSymbol(math, main, bin, "\u2021", "\\ddagger");
  12289. defineSymbol(math, main, bin, "\u2240", "\\wr");
  12290. defineSymbol(math, main, bin, "\u2A3F", "\\amalg");
  12291. defineSymbol(math, main, bin, "&", "\\And"); // from amsmath
  12292.  
  12293. // Arrow Symbols
  12294. defineSymbol(math, main, rel, "\u27F5", "\\longleftarrow");
  12295. defineSymbol(math, main, rel, "\u21D0", "\\Leftarrow");
  12296. defineSymbol(math, main, rel, "\u27F8", "\\Longleftarrow");
  12297. defineSymbol(math, main, rel, "\u27F6", "\\longrightarrow");
  12298. defineSymbol(math, main, rel, "\u21D2", "\\Rightarrow");
  12299. defineSymbol(math, main, rel, "\u27F9", "\\Longrightarrow");
  12300. defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow");
  12301. defineSymbol(math, main, rel, "\u27F7", "\\longleftrightarrow");
  12302. defineSymbol(math, main, rel, "\u21D4", "\\Leftrightarrow");
  12303. defineSymbol(math, main, rel, "\u27FA", "\\Longleftrightarrow");
  12304. defineSymbol(math, main, rel, "\u21A6", "\\mapsto");
  12305. defineSymbol(math, main, rel, "\u27FC", "\\longmapsto");
  12306. defineSymbol(math, main, rel, "\u2197", "\\nearrow");
  12307. defineSymbol(math, main, rel, "\u21A9", "\\hookleftarrow");
  12308. defineSymbol(math, main, rel, "\u21AA", "\\hookrightarrow");
  12309. defineSymbol(math, main, rel, "\u2198", "\\searrow");
  12310. defineSymbol(math, main, rel, "\u21BC", "\\leftharpoonup");
  12311. defineSymbol(math, main, rel, "\u21C0", "\\rightharpoonup");
  12312. defineSymbol(math, main, rel, "\u2199", "\\swarrow");
  12313. defineSymbol(math, main, rel, "\u21BD", "\\leftharpoondown");
  12314. defineSymbol(math, main, rel, "\u21C1", "\\rightharpoondown");
  12315. defineSymbol(math, main, rel, "\u2196", "\\nwarrow");
  12316. defineSymbol(math, main, rel, "\u21CC", "\\rightleftharpoons");
  12317.  
  12318. // AMS Negated Binary Relations
  12319. defineSymbol(math, ams, rel, "\u226E", "\\nless");
  12320. defineSymbol(math, ams, rel, "\uE010", "\\nleqslant");
  12321. defineSymbol(math, ams, rel, "\uE011", "\\nleqq");
  12322. defineSymbol(math, ams, rel, "\u2A87", "\\lneq");
  12323. defineSymbol(math, ams, rel, "\u2268", "\\lneqq");
  12324. defineSymbol(math, ams, rel, "\uE00C", "\\lvertneqq");
  12325. defineSymbol(math, ams, rel, "\u22E6", "\\lnsim");
  12326. defineSymbol(math, ams, rel, "\u2A89", "\\lnapprox");
  12327. defineSymbol(math, ams, rel, "\u2280", "\\nprec");
  12328. defineSymbol(math, ams, rel, "\u22E0", "\\npreceq");
  12329. defineSymbol(math, ams, rel, "\u22E8", "\\precnsim");
  12330. defineSymbol(math, ams, rel, "\u2AB9", "\\precnapprox");
  12331. defineSymbol(math, ams, rel, "\u2241", "\\nsim");
  12332. defineSymbol(math, ams, rel, "\uE006", "\\nshortmid");
  12333. defineSymbol(math, ams, rel, "\u2224", "\\nmid");
  12334. defineSymbol(math, ams, rel, "\u22AC", "\\nvdash");
  12335. defineSymbol(math, ams, rel, "\u22AD", "\\nvDash");
  12336. defineSymbol(math, ams, rel, "\u22EA", "\\ntriangleleft");
  12337. defineSymbol(math, ams, rel, "\u22EC", "\\ntrianglelefteq");
  12338. defineSymbol(math, ams, rel, "\u228A", "\\subsetneq");
  12339. defineSymbol(math, ams, rel, "\uE01A", "\\varsubsetneq");
  12340. defineSymbol(math, ams, rel, "\u2ACB", "\\subsetneqq");
  12341. defineSymbol(math, ams, rel, "\uE017", "\\varsubsetneqq");
  12342. defineSymbol(math, ams, rel, "\u226F", "\\ngtr");
  12343. defineSymbol(math, ams, rel, "\uE00F", "\\ngeqslant");
  12344. defineSymbol(math, ams, rel, "\uE00E", "\\ngeqq");
  12345. defineSymbol(math, ams, rel, "\u2A88", "\\gneq");
  12346. defineSymbol(math, ams, rel, "\u2269", "\\gneqq");
  12347. defineSymbol(math, ams, rel, "\uE00D", "\\gvertneqq");
  12348. defineSymbol(math, ams, rel, "\u22E7", "\\gnsim");
  12349. defineSymbol(math, ams, rel, "\u2A8A", "\\gnapprox");
  12350. defineSymbol(math, ams, rel, "\u2281", "\\nsucc");
  12351. defineSymbol(math, ams, rel, "\u22E1", "\\nsucceq");
  12352. defineSymbol(math, ams, rel, "\u22E9", "\\succnsim");
  12353. defineSymbol(math, ams, rel, "\u2ABA", "\\succnapprox");
  12354. defineSymbol(math, ams, rel, "\u2246", "\\ncong");
  12355. defineSymbol(math, ams, rel, "\uE007", "\\nshortparallel");
  12356. defineSymbol(math, ams, rel, "\u2226", "\\nparallel");
  12357. defineSymbol(math, ams, rel, "\u22AF", "\\nVDash");
  12358. defineSymbol(math, ams, rel, "\u22EB", "\\ntriangleright");
  12359. defineSymbol(math, ams, rel, "\u22ED", "\\ntrianglerighteq");
  12360. defineSymbol(math, ams, rel, "\uE018", "\\nsupseteqq");
  12361. defineSymbol(math, ams, rel, "\u228B", "\\supsetneq");
  12362. defineSymbol(math, ams, rel, "\uE01B", "\\varsupsetneq");
  12363. defineSymbol(math, ams, rel, "\u2ACC", "\\supsetneqq");
  12364. defineSymbol(math, ams, rel, "\uE019", "\\varsupsetneqq");
  12365. defineSymbol(math, ams, rel, "\u22AE", "\\nVdash");
  12366. defineSymbol(math, ams, rel, "\u2AB5", "\\precneqq");
  12367. defineSymbol(math, ams, rel, "\u2AB6", "\\succneqq");
  12368. defineSymbol(math, ams, rel, "\uE016", "\\nsubseteqq");
  12369. defineSymbol(math, ams, bin, "\u22B4", "\\unlhd");
  12370. defineSymbol(math, ams, bin, "\u22B5", "\\unrhd");
  12371.  
  12372. // AMS Negated Arrows
  12373. defineSymbol(math, ams, rel, "\u219A", "\\nleftarrow");
  12374. defineSymbol(math, ams, rel, "\u219B", "\\nrightarrow");
  12375. defineSymbol(math, ams, rel, "\u21CD", "\\nLeftarrow");
  12376. defineSymbol(math, ams, rel, "\u21CF", "\\nRightarrow");
  12377. defineSymbol(math, ams, rel, "\u21AE", "\\nleftrightarrow");
  12378. defineSymbol(math, ams, rel, "\u21CE", "\\nLeftrightarrow");
  12379.  
  12380. // AMS Misc
  12381. defineSymbol(math, ams, rel, "\u25B3", "\\vartriangle");
  12382. defineSymbol(math, ams, textord, "\u210F", "\\hslash");
  12383. defineSymbol(math, ams, textord, "\u25BD", "\\triangledown");
  12384. defineSymbol(math, ams, textord, "\u25CA", "\\lozenge");
  12385. defineSymbol(math, ams, textord, "\u24C8", "\\circledS");
  12386. defineSymbol(math, ams, textord, "\xAE", "\\circledR");
  12387. defineSymbol(text, ams, textord, "\xAE", "\\circledR");
  12388. defineSymbol(math, ams, textord, "\u2221", "\\measuredangle");
  12389. defineSymbol(math, ams, textord, "\u2204", "\\nexists");
  12390. defineSymbol(math, ams, textord, "\u2127", "\\mho");
  12391. defineSymbol(math, ams, textord, "\u2132", "\\Finv");
  12392. defineSymbol(math, ams, textord, "\u2141", "\\Game");
  12393. defineSymbol(math, ams, textord, "k", "\\Bbbk");
  12394. defineSymbol(math, ams, textord, "\u2035", "\\backprime");
  12395. defineSymbol(math, ams, textord, "\u25B2", "\\blacktriangle");
  12396. defineSymbol(math, ams, textord, "\u25BC", "\\blacktriangledown");
  12397. defineSymbol(math, ams, textord, "\u25A0", "\\blacksquare");
  12398. defineSymbol(math, ams, textord, "\u29EB", "\\blacklozenge");
  12399. defineSymbol(math, ams, textord, "\u2605", "\\bigstar");
  12400. defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle");
  12401. defineSymbol(math, ams, textord, "\u2201", "\\complement");
  12402. defineSymbol(math, ams, textord, "\xF0", "\\eth");
  12403. defineSymbol(math, ams, textord, "\u2571", "\\diagup");
  12404. defineSymbol(math, ams, textord, "\u2572", "\\diagdown");
  12405. defineSymbol(math, ams, textord, "\u25A1", "\\square");
  12406. defineSymbol(math, ams, textord, "\u25A1", "\\Box");
  12407. defineSymbol(math, ams, textord, "\u25CA", "\\Diamond");
  12408. defineSymbol(math, ams, textord, "\xA5", "\\yen");
  12409. defineSymbol(math, ams, textord, "\u2713", "\\checkmark");
  12410. defineSymbol(text, ams, textord, "\u2713", "\\checkmark");
  12411.  
  12412. // AMS Hebrew
  12413. defineSymbol(math, ams, textord, "\u2136", "\\beth");
  12414. defineSymbol(math, ams, textord, "\u2138", "\\daleth");
  12415. defineSymbol(math, ams, textord, "\u2137", "\\gimel");
  12416.  
  12417. // AMS Greek
  12418. defineSymbol(math, ams, textord, "\u03DD", "\\digamma");
  12419. defineSymbol(math, ams, textord, "\u03F0", "\\varkappa");
  12420.  
  12421. // AMS Delimiters
  12422. defineSymbol(math, ams, open, "\u250C", "\\ulcorner");
  12423. defineSymbol(math, ams, close, "\u2510", "\\urcorner");
  12424. defineSymbol(math, ams, open, "\u2514", "\\llcorner");
  12425. defineSymbol(math, ams, close, "\u2518", "\\lrcorner");
  12426.  
  12427. // AMS Binary Relations
  12428. defineSymbol(math, ams, rel, "\u2266", "\\leqq");
  12429. defineSymbol(math, ams, rel, "\u2A7D", "\\leqslant");
  12430. defineSymbol(math, ams, rel, "\u2A95", "\\eqslantless");
  12431. defineSymbol(math, ams, rel, "\u2272", "\\lesssim");
  12432. defineSymbol(math, ams, rel, "\u2A85", "\\lessapprox");
  12433. defineSymbol(math, ams, rel, "\u224A", "\\approxeq");
  12434. defineSymbol(math, ams, bin, "\u22D6", "\\lessdot");
  12435. defineSymbol(math, ams, rel, "\u22D8", "\\lll");
  12436. defineSymbol(math, ams, rel, "\u2276", "\\lessgtr");
  12437. defineSymbol(math, ams, rel, "\u22DA", "\\lesseqgtr");
  12438. defineSymbol(math, ams, rel, "\u2A8B", "\\lesseqqgtr");
  12439. defineSymbol(math, ams, rel, "\u2251", "\\doteqdot");
  12440. defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq");
  12441. defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq");
  12442. defineSymbol(math, ams, rel, "\u223D", "\\backsim");
  12443. defineSymbol(math, ams, rel, "\u22CD", "\\backsimeq");
  12444. defineSymbol(math, ams, rel, "\u2AC5", "\\subseteqq");
  12445. defineSymbol(math, ams, rel, "\u22D0", "\\Subset");
  12446. defineSymbol(math, ams, rel, "\u228F", "\\sqsubset");
  12447. defineSymbol(math, ams, rel, "\u227C", "\\preccurlyeq");
  12448. defineSymbol(math, ams, rel, "\u22DE", "\\curlyeqprec");
  12449. defineSymbol(math, ams, rel, "\u227E", "\\precsim");
  12450. defineSymbol(math, ams, rel, "\u2AB7", "\\precapprox");
  12451. defineSymbol(math, ams, rel, "\u22B2", "\\vartriangleleft");
  12452. defineSymbol(math, ams, rel, "\u22B4", "\\trianglelefteq");
  12453. defineSymbol(math, ams, rel, "\u22A8", "\\vDash");
  12454. defineSymbol(math, ams, rel, "\u22AA", "\\Vvdash");
  12455. defineSymbol(math, ams, rel, "\u2323", "\\smallsmile");
  12456. defineSymbol(math, ams, rel, "\u2322", "\\smallfrown");
  12457. defineSymbol(math, ams, rel, "\u224F", "\\bumpeq");
  12458. defineSymbol(math, ams, rel, "\u224E", "\\Bumpeq");
  12459. defineSymbol(math, ams, rel, "\u2267", "\\geqq");
  12460. defineSymbol(math, ams, rel, "\u2A7E", "\\geqslant");
  12461. defineSymbol(math, ams, rel, "\u2A96", "\\eqslantgtr");
  12462. defineSymbol(math, ams, rel, "\u2273", "\\gtrsim");
  12463. defineSymbol(math, ams, rel, "\u2A86", "\\gtrapprox");
  12464. defineSymbol(math, ams, bin, "\u22D7", "\\gtrdot");
  12465. defineSymbol(math, ams, rel, "\u22D9", "\\ggg");
  12466. defineSymbol(math, ams, rel, "\u2277", "\\gtrless");
  12467. defineSymbol(math, ams, rel, "\u22DB", "\\gtreqless");
  12468. defineSymbol(math, ams, rel, "\u2A8C", "\\gtreqqless");
  12469. defineSymbol(math, ams, rel, "\u2256", "\\eqcirc");
  12470. defineSymbol(math, ams, rel, "\u2257", "\\circeq");
  12471. defineSymbol(math, ams, rel, "\u225C", "\\triangleq");
  12472. defineSymbol(math, ams, rel, "\u223C", "\\thicksim");
  12473. defineSymbol(math, ams, rel, "\u2248", "\\thickapprox");
  12474. defineSymbol(math, ams, rel, "\u2AC6", "\\supseteqq");
  12475. defineSymbol(math, ams, rel, "\u22D1", "\\Supset");
  12476. defineSymbol(math, ams, rel, "\u2290", "\\sqsupset");
  12477. defineSymbol(math, ams, rel, "\u227D", "\\succcurlyeq");
  12478. defineSymbol(math, ams, rel, "\u22DF", "\\curlyeqsucc");
  12479. defineSymbol(math, ams, rel, "\u227F", "\\succsim");
  12480. defineSymbol(math, ams, rel, "\u2AB8", "\\succapprox");
  12481. defineSymbol(math, ams, rel, "\u22B3", "\\vartriangleright");
  12482. defineSymbol(math, ams, rel, "\u22B5", "\\trianglerighteq");
  12483. defineSymbol(math, ams, rel, "\u22A9", "\\Vdash");
  12484. defineSymbol(math, ams, rel, "\u2223", "\\shortmid");
  12485. defineSymbol(math, ams, rel, "\u2225", "\\shortparallel");
  12486. defineSymbol(math, ams, rel, "\u226C", "\\between");
  12487. defineSymbol(math, ams, rel, "\u22D4", "\\pitchfork");
  12488. defineSymbol(math, ams, rel, "\u221D", "\\varpropto");
  12489. defineSymbol(math, ams, rel, "\u25C0", "\\blacktriangleleft");
  12490. defineSymbol(math, ams, rel, "\u2234", "\\therefore");
  12491. defineSymbol(math, ams, rel, "\u220D", "\\backepsilon");
  12492. defineSymbol(math, ams, rel, "\u25B6", "\\blacktriangleright");
  12493. defineSymbol(math, ams, rel, "\u2235", "\\because");
  12494. defineSymbol(math, ams, rel, "\u22D8", "\\llless");
  12495. defineSymbol(math, ams, rel, "\u22D9", "\\gggtr");
  12496. defineSymbol(math, ams, bin, "\u22B2", "\\lhd");
  12497. defineSymbol(math, ams, bin, "\u22B3", "\\rhd");
  12498. defineSymbol(math, ams, rel, "\u2242", "\\eqsim");
  12499. defineSymbol(math, main, rel, "\u22C8", "\\Join");
  12500. defineSymbol(math, ams, rel, "\u2251", "\\Doteq");
  12501.  
  12502. // AMS Binary Operators
  12503. defineSymbol(math, ams, bin, "\u2214", "\\dotplus");
  12504. defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus");
  12505. defineSymbol(math, ams, bin, "\u22D2", "\\Cap");
  12506. defineSymbol(math, ams, bin, "\u22D3", "\\Cup");
  12507. defineSymbol(math, ams, bin, "\u2A5E", "\\doublebarwedge");
  12508. defineSymbol(math, ams, bin, "\u229F", "\\boxminus");
  12509. defineSymbol(math, ams, bin, "\u229E", "\\boxplus");
  12510. defineSymbol(math, ams, bin, "\u22C7", "\\divideontimes");
  12511. defineSymbol(math, ams, bin, "\u22C9", "\\ltimes");
  12512. defineSymbol(math, ams, bin, "\u22CA", "\\rtimes");
  12513. defineSymbol(math, ams, bin, "\u22CB", "\\leftthreetimes");
  12514. defineSymbol(math, ams, bin, "\u22CC", "\\rightthreetimes");
  12515. defineSymbol(math, ams, bin, "\u22CF", "\\curlywedge");
  12516. defineSymbol(math, ams, bin, "\u22CE", "\\curlyvee");
  12517. defineSymbol(math, ams, bin, "\u229D", "\\circleddash");
  12518. defineSymbol(math, ams, bin, "\u229B", "\\circledast");
  12519. defineSymbol(math, ams, bin, "\u22C5", "\\centerdot");
  12520. defineSymbol(math, ams, bin, "\u22BA", "\\intercal");
  12521. defineSymbol(math, ams, bin, "\u22D2", "\\doublecap");
  12522. defineSymbol(math, ams, bin, "\u22D3", "\\doublecup");
  12523. defineSymbol(math, ams, bin, "\u22A0", "\\boxtimes");
  12524.  
  12525. // AMS Arrows
  12526. defineSymbol(math, ams, rel, "\u21E2", "\\dashrightarrow");
  12527. defineSymbol(math, ams, rel, "\u21E0", "\\dashleftarrow");
  12528. defineSymbol(math, ams, rel, "\u21C7", "\\leftleftarrows");
  12529. defineSymbol(math, ams, rel, "\u21C6", "\\leftrightarrows");
  12530. defineSymbol(math, ams, rel, "\u21DA", "\\Lleftarrow");
  12531. defineSymbol(math, ams, rel, "\u219E", "\\twoheadleftarrow");
  12532. defineSymbol(math, ams, rel, "\u21A2", "\\leftarrowtail");
  12533. defineSymbol(math, ams, rel, "\u21AB", "\\looparrowleft");
  12534. defineSymbol(math, ams, rel, "\u21CB", "\\leftrightharpoons");
  12535. defineSymbol(math, ams, rel, "\u21B6", "\\curvearrowleft");
  12536. defineSymbol(math, ams, rel, "\u21BA", "\\circlearrowleft");
  12537. defineSymbol(math, ams, rel, "\u21B0", "\\Lsh");
  12538. defineSymbol(math, ams, rel, "\u21C8", "\\upuparrows");
  12539. defineSymbol(math, ams, rel, "\u21BF", "\\upharpoonleft");
  12540. defineSymbol(math, ams, rel, "\u21C3", "\\downharpoonleft");
  12541. defineSymbol(math, ams, rel, "\u22B8", "\\multimap");
  12542. defineSymbol(math, ams, rel, "\u21AD", "\\leftrightsquigarrow");
  12543. defineSymbol(math, ams, rel, "\u21C9", "\\rightrightarrows");
  12544. defineSymbol(math, ams, rel, "\u21C4", "\\rightleftarrows");
  12545. defineSymbol(math, ams, rel, "\u21A0", "\\twoheadrightarrow");
  12546. defineSymbol(math, ams, rel, "\u21A3", "\\rightarrowtail");
  12547. defineSymbol(math, ams, rel, "\u21AC", "\\looparrowright");
  12548. defineSymbol(math, ams, rel, "\u21B7", "\\curvearrowright");
  12549. defineSymbol(math, ams, rel, "\u21BB", "\\circlearrowright");
  12550. defineSymbol(math, ams, rel, "\u21B1", "\\Rsh");
  12551. defineSymbol(math, ams, rel, "\u21CA", "\\downdownarrows");
  12552. defineSymbol(math, ams, rel, "\u21BE", "\\upharpoonright");
  12553. defineSymbol(math, ams, rel, "\u21C2", "\\downharpoonright");
  12554. defineSymbol(math, ams, rel, "\u21DD", "\\rightsquigarrow");
  12555. defineSymbol(math, ams, rel, "\u21DD", "\\leadsto");
  12556. defineSymbol(math, ams, rel, "\u21DB", "\\Rrightarrow");
  12557. defineSymbol(math, ams, rel, "\u21BE", "\\restriction");
  12558.  
  12559. defineSymbol(math, main, textord, "\u2018", "`");
  12560. defineSymbol(math, main, textord, "$", "\\$");
  12561. defineSymbol(text, main, textord, "$", "\\$");
  12562. defineSymbol(text, main, textord, "$", "\\textdollar");
  12563. defineSymbol(math, main, textord, "%", "\\%");
  12564. defineSymbol(text, main, textord, "%", "\\%");
  12565. defineSymbol(math, main, textord, "_", "\\_");
  12566. defineSymbol(text, main, textord, "_", "\\_");
  12567. defineSymbol(text, main, textord, "_", "\\textunderscore");
  12568. defineSymbol(math, main, textord, "\u2220", "\\angle");
  12569. defineSymbol(math, main, textord, "\u221E", "\\infty");
  12570. defineSymbol(math, main, textord, "\u2032", "\\prime");
  12571. defineSymbol(math, main, textord, "\u25B3", "\\triangle");
  12572. defineSymbol(math, main, textord, "\u0393", "\\Gamma", true);
  12573. defineSymbol(math, main, textord, "\u0394", "\\Delta", true);
  12574. defineSymbol(math, main, textord, "\u0398", "\\Theta", true);
  12575. defineSymbol(math, main, textord, "\u039B", "\\Lambda", true);
  12576. defineSymbol(math, main, textord, "\u039E", "\\Xi", true);
  12577. defineSymbol(math, main, textord, "\u03A0", "\\Pi", true);
  12578. defineSymbol(math, main, textord, "\u03A3", "\\Sigma", true);
  12579. defineSymbol(math, main, textord, "\u03A5", "\\Upsilon", true);
  12580. defineSymbol(math, main, textord, "\u03A6", "\\Phi", true);
  12581. defineSymbol(math, main, textord, "\u03A8", "\\Psi", true);
  12582. defineSymbol(math, main, textord, "\u03A9", "\\Omega", true);
  12583. defineSymbol(math, main, textord, "\xAC", "\\neg");
  12584. defineSymbol(math, main, textord, "\xAC", "\\lnot");
  12585. defineSymbol(math, main, textord, "\u22A4", "\\top");
  12586. defineSymbol(math, main, textord, "\u22A5", "\\bot");
  12587. defineSymbol(math, main, textord, "\u2205", "\\emptyset");
  12588. defineSymbol(math, ams, textord, "\u2205", "\\varnothing");
  12589. defineSymbol(math, main, mathord, "\u03B1", "\\alpha", true);
  12590. defineSymbol(math, main, mathord, "\u03B2", "\\beta", true);
  12591. defineSymbol(math, main, mathord, "\u03B3", "\\gamma", true);
  12592. defineSymbol(math, main, mathord, "\u03B4", "\\delta", true);
  12593. defineSymbol(math, main, mathord, "\u03F5", "\\epsilon", true);
  12594. defineSymbol(math, main, mathord, "\u03B6", "\\zeta", true);
  12595. defineSymbol(math, main, mathord, "\u03B7", "\\eta", true);
  12596. defineSymbol(math, main, mathord, "\u03B8", "\\theta", true);
  12597. defineSymbol(math, main, mathord, "\u03B9", "\\iota", true);
  12598. defineSymbol(math, main, mathord, "\u03BA", "\\kappa", true);
  12599. defineSymbol(math, main, mathord, "\u03BB", "\\lambda", true);
  12600. defineSymbol(math, main, mathord, "\u03BC", "\\mu", true);
  12601. defineSymbol(math, main, mathord, "\u03BD", "\\nu", true);
  12602. defineSymbol(math, main, mathord, "\u03BE", "\\xi", true);
  12603. defineSymbol(math, main, mathord, "\u03BF", "\\omicron", true);
  12604. defineSymbol(math, main, mathord, "\u03C0", "\\pi", true);
  12605. defineSymbol(math, main, mathord, "\u03C1", "\\rho", true);
  12606. defineSymbol(math, main, mathord, "\u03C3", "\\sigma", true);
  12607. defineSymbol(math, main, mathord, "\u03C4", "\\tau", true);
  12608. defineSymbol(math, main, mathord, "\u03C5", "\\upsilon", true);
  12609. defineSymbol(math, main, mathord, "\u03D5", "\\phi", true);
  12610. defineSymbol(math, main, mathord, "\u03C7", "\\chi", true);
  12611. defineSymbol(math, main, mathord, "\u03C8", "\\psi", true);
  12612. defineSymbol(math, main, mathord, "\u03C9", "\\omega", true);
  12613. defineSymbol(math, main, mathord, "\u03B5", "\\varepsilon", true);
  12614. defineSymbol(math, main, mathord, "\u03D1", "\\vartheta", true);
  12615. defineSymbol(math, main, mathord, "\u03D6", "\\varpi", true);
  12616. defineSymbol(math, main, mathord, "\u03F1", "\\varrho", true);
  12617. defineSymbol(math, main, mathord, "\u03C2", "\\varsigma", true);
  12618. defineSymbol(math, main, mathord, "\u03C6", "\\varphi", true);
  12619. defineSymbol(math, main, bin, "\u2217", "*");
  12620. defineSymbol(math, main, bin, "+", "+");
  12621. defineSymbol(math, main, bin, "\u2212", "-");
  12622. defineSymbol(math, main, bin, "\u22C5", "\\cdot");
  12623. defineSymbol(math, main, bin, "\u2218", "\\circ");
  12624. defineSymbol(math, main, bin, "\xF7", "\\div");
  12625. defineSymbol(math, main, bin, "\xB1", "\\pm");
  12626. defineSymbol(math, main, bin, "\xD7", "\\times");
  12627. defineSymbol(math, main, bin, "\u2229", "\\cap");
  12628. defineSymbol(math, main, bin, "\u222A", "\\cup");
  12629. defineSymbol(math, main, bin, "\u2216", "\\setminus");
  12630. defineSymbol(math, main, bin, "\u2227", "\\land");
  12631. defineSymbol(math, main, bin, "\u2228", "\\lor");
  12632. defineSymbol(math, main, bin, "\u2227", "\\wedge");
  12633. defineSymbol(math, main, bin, "\u2228", "\\vee");
  12634. defineSymbol(math, main, textord, "\u221A", "\\surd");
  12635. defineSymbol(math, main, open, "(", "(");
  12636. defineSymbol(math, main, open, "[", "[");
  12637. defineSymbol(math, main, open, "\u27E8", "\\langle");
  12638. defineSymbol(math, main, open, "\u2223", "\\lvert");
  12639. defineSymbol(math, main, open, "\u2225", "\\lVert");
  12640. defineSymbol(math, main, close, ")", ")");
  12641. defineSymbol(math, main, close, "]", "]");
  12642. defineSymbol(math, main, close, "?", "?");
  12643. defineSymbol(math, main, close, "!", "!");
  12644. defineSymbol(math, main, close, "\u27E9", "\\rangle");
  12645. defineSymbol(math, main, close, "\u2223", "\\rvert");
  12646. defineSymbol(math, main, close, "\u2225", "\\rVert");
  12647. defineSymbol(math, main, rel, "=", "=");
  12648. defineSymbol(math, main, rel, "<", "<");
  12649. defineSymbol(math, main, rel, ">", ">");
  12650. defineSymbol(math, main, rel, ":", ":");
  12651. defineSymbol(math, main, rel, "\u2248", "\\approx");
  12652. defineSymbol(math, main, rel, "\u2245", "\\cong");
  12653. defineSymbol(math, main, rel, "\u2265", "\\ge");
  12654. defineSymbol(math, main, rel, "\u2265", "\\geq");
  12655. defineSymbol(math, main, rel, "\u2190", "\\gets");
  12656. defineSymbol(math, main, rel, ">", "\\gt");
  12657. defineSymbol(math, main, rel, "\u2208", "\\in");
  12658. defineSymbol(math, main, rel, "\u2209", "\\notin");
  12659. defineSymbol(math, main, rel, "\u0338", "\\not");
  12660. defineSymbol(math, main, rel, "\u2282", "\\subset");
  12661. defineSymbol(math, main, rel, "\u2283", "\\supset");
  12662. defineSymbol(math, main, rel, "\u2286", "\\subseteq");
  12663. defineSymbol(math, main, rel, "\u2287", "\\supseteq");
  12664. defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq");
  12665. defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq");
  12666. defineSymbol(math, main, rel, "\u22A8", "\\models");
  12667. defineSymbol(math, main, rel, "\u2190", "\\leftarrow");
  12668. defineSymbol(math, main, rel, "\u2264", "\\le");
  12669. defineSymbol(math, main, rel, "\u2264", "\\leq");
  12670. defineSymbol(math, main, rel, "<", "\\lt");
  12671. defineSymbol(math, main, rel, "\u2260", "\\ne");
  12672. defineSymbol(math, main, rel, "\u2260", "\\neq");
  12673. defineSymbol(math, main, rel, "\u2192", "\\rightarrow");
  12674. defineSymbol(math, main, rel, "\u2192", "\\to");
  12675. defineSymbol(math, ams, rel, "\u2271", "\\ngeq");
  12676. defineSymbol(math, ams, rel, "\u2270", "\\nleq");
  12677. defineSymbol(math, main, spacing, null, "\\!");
  12678. defineSymbol(math, main, spacing, "\xA0", "\\ ");
  12679. defineSymbol(math, main, spacing, "\xA0", "~");
  12680. defineSymbol(math, main, spacing, null, "\\,");
  12681. defineSymbol(math, main, spacing, null, "\\:");
  12682. defineSymbol(math, main, spacing, null, "\\;");
  12683. defineSymbol(math, main, spacing, null, "\\enspace");
  12684. defineSymbol(math, main, spacing, null, "\\qquad");
  12685. defineSymbol(math, main, spacing, null, "\\quad");
  12686. defineSymbol(math, main, spacing, "\xA0", "\\space");
  12687. defineSymbol(math, main, punct, ",", ",");
  12688. defineSymbol(math, main, punct, ";", ";");
  12689. defineSymbol(math, main, punct, ":", "\\colon");
  12690. defineSymbol(math, ams, bin, "\u22BC", "\\barwedge");
  12691. defineSymbol(math, ams, bin, "\u22BB", "\\veebar");
  12692. defineSymbol(math, main, bin, "\u2299", "\\odot");
  12693. defineSymbol(math, main, bin, "\u2295", "\\oplus");
  12694. defineSymbol(math, main, bin, "\u2297", "\\otimes");
  12695. defineSymbol(math, main, textord, "\u2202", "\\partial");
  12696. defineSymbol(math, main, bin, "\u2298", "\\oslash");
  12697. defineSymbol(math, ams, bin, "\u229A", "\\circledcirc");
  12698. defineSymbol(math, ams, bin, "\u22A1", "\\boxdot");
  12699. defineSymbol(math, main, bin, "\u25B3", "\\bigtriangleup");
  12700. defineSymbol(math, main, bin, "\u25BD", "\\bigtriangledown");
  12701. defineSymbol(math, main, bin, "\u2020", "\\dagger");
  12702. defineSymbol(math, main, bin, "\u22C4", "\\diamond");
  12703. defineSymbol(math, main, bin, "\u22C6", "\\star");
  12704. defineSymbol(math, main, bin, "\u25C3", "\\triangleleft");
  12705. defineSymbol(math, main, bin, "\u25B9", "\\triangleright");
  12706. defineSymbol(math, main, open, "{", "\\{");
  12707. defineSymbol(text, main, textord, "{", "\\{");
  12708. defineSymbol(text, main, textord, "{", "\\textbraceleft");
  12709. defineSymbol(math, main, close, "}", "\\}");
  12710. defineSymbol(text, main, textord, "}", "\\}");
  12711. defineSymbol(text, main, textord, "}", "\\textbraceright");
  12712. defineSymbol(math, main, open, "{", "\\lbrace");
  12713. defineSymbol(math, main, close, "}", "\\rbrace");
  12714. defineSymbol(math, main, open, "[", "\\lbrack");
  12715. defineSymbol(math, main, close, "]", "\\rbrack");
  12716. defineSymbol(text, main, textord, "<", "\\textless"); // in T1 fontenc
  12717. defineSymbol(text, main, textord, ">", "\\textgreater"); // in T1 fontenc
  12718. defineSymbol(math, main, open, "\u230A", "\\lfloor");
  12719. defineSymbol(math, main, close, "\u230B", "\\rfloor");
  12720. defineSymbol(math, main, open, "\u2308", "\\lceil");
  12721. defineSymbol(math, main, close, "\u2309", "\\rceil");
  12722. defineSymbol(math, main, textord, "\\", "\\backslash");
  12723. defineSymbol(math, main, textord, "\u2223", "|");
  12724. defineSymbol(math, main, textord, "\u2223", "\\vert");
  12725. defineSymbol(text, main, textord, "|", "\\textbar"); // in T1 fontenc
  12726. defineSymbol(math, main, textord, "\u2225", "\\|");
  12727. defineSymbol(math, main, textord, "\u2225", "\\Vert");
  12728. defineSymbol(text, main, textord, "\u2225", "\\textbardbl");
  12729. defineSymbol(math, main, rel, "\u2191", "\\uparrow");
  12730. defineSymbol(math, main, rel, "\u21D1", "\\Uparrow");
  12731. defineSymbol(math, main, rel, "\u2193", "\\downarrow");
  12732. defineSymbol(math, main, rel, "\u21D3", "\\Downarrow");
  12733. defineSymbol(math, main, rel, "\u2195", "\\updownarrow");
  12734. defineSymbol(math, main, rel, "\u21D5", "\\Updownarrow");
  12735. defineSymbol(math, main, op, "\u2210", "\\coprod");
  12736. defineSymbol(math, main, op, "\u22C1", "\\bigvee");
  12737. defineSymbol(math, main, op, "\u22C0", "\\bigwedge");
  12738. defineSymbol(math, main, op, "\u2A04", "\\biguplus");
  12739. defineSymbol(math, main, op, "\u22C2", "\\bigcap");
  12740. defineSymbol(math, main, op, "\u22C3", "\\bigcup");
  12741. defineSymbol(math, main, op, "\u222B", "\\int");
  12742. defineSymbol(math, main, op, "\u222B", "\\intop");
  12743. defineSymbol(math, main, op, "\u222C", "\\iint");
  12744. defineSymbol(math, main, op, "\u222D", "\\iiint");
  12745. defineSymbol(math, main, op, "\u220F", "\\prod");
  12746. defineSymbol(math, main, op, "\u2211", "\\sum");
  12747. defineSymbol(math, main, op, "\u2A02", "\\bigotimes");
  12748. defineSymbol(math, main, op, "\u2A01", "\\bigoplus");
  12749. defineSymbol(math, main, op, "\u2A00", "\\bigodot");
  12750. defineSymbol(math, main, op, "\u222E", "\\oint");
  12751. defineSymbol(math, main, op, "\u2A06", "\\bigsqcup");
  12752. defineSymbol(math, main, op, "\u222B", "\\smallint");
  12753. defineSymbol(text, main, inner, "\u2026", "\\textellipsis");
  12754. defineSymbol(math, main, inner, "\u2026", "\\mathellipsis");
  12755. defineSymbol(text, main, inner, "\u2026", "\\ldots", true);
  12756. defineSymbol(math, main, inner, "\u2026", "\\ldots", true);
  12757. defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true);
  12758. defineSymbol(math, main, inner, "\u22F1", "\\ddots", true);
  12759. defineSymbol(math, main, textord, "\u22EE", "\\vdots", true);
  12760. defineSymbol(math, main, accent, "\xB4", "\\acute");
  12761. defineSymbol(math, main, accent, "`", "\\grave");
  12762. defineSymbol(math, main, accent, "\xA8", "\\ddot");
  12763. defineSymbol(math, main, accent, "~", "\\tilde");
  12764. defineSymbol(math, main, accent, "\xAF", "\\bar");
  12765. defineSymbol(math, main, accent, "\u02D8", "\\breve");
  12766. defineSymbol(math, main, accent, "\u02C7", "\\check");
  12767. defineSymbol(math, main, accent, "^", "\\hat");
  12768. defineSymbol(math, main, accent, "\u20D7", "\\vec");
  12769. defineSymbol(math, main, accent, "\u02D9", "\\dot");
  12770. defineSymbol(math, main, mathord, "\u0131", "\\imath");
  12771. defineSymbol(math, main, mathord, "\u0237", "\\jmath");
  12772. defineSymbol(text, main, accent, "\u02CA", "\\'"); // acute
  12773. defineSymbol(text, main, accent, "\u02CB", "\\`"); // grave
  12774. defineSymbol(text, main, accent, "\u02C6", "\\^"); // circumflex
  12775. defineSymbol(text, main, accent, "\u02DC", "\\~"); // tilde
  12776. defineSymbol(text, main, accent, "\u02C9", "\\="); // macron
  12777. defineSymbol(text, main, accent, "\u02D8", "\\u"); // breve
  12778. defineSymbol(text, main, accent, "\u02D9", "\\."); // dot above
  12779. defineSymbol(text, main, accent, "\u02DA", "\\r"); // ring above
  12780. defineSymbol(text, main, accent, "\u02C7", "\\v"); // caron
  12781. defineSymbol(text, main, accent, "\xA8", '\\"'); // diaresis
  12782. defineSymbol(text, main, accent, "\u030B", "\\H"); // double acute
  12783.  
  12784. defineSymbol(text, main, textord, "\u2013", "--");
  12785. defineSymbol(text, main, textord, "\u2013", "\\textendash");
  12786. defineSymbol(text, main, textord, "\u2014", "---");
  12787. defineSymbol(text, main, textord, "\u2014", "\\textemdash");
  12788. defineSymbol(text, main, textord, "\u2018", "`");
  12789. defineSymbol(text, main, textord, "\u2018", "\\textquoteleft");
  12790. defineSymbol(text, main, textord, "\u2019", "'");
  12791. defineSymbol(text, main, textord, "\u2019", "\\textquoteright");
  12792. defineSymbol(text, main, textord, "\u201C", "``");
  12793. defineSymbol(text, main, textord, "\u201C", "\\textquotedblleft");
  12794. defineSymbol(text, main, textord, "\u201D", "''");
  12795. defineSymbol(text, main, textord, "\u201D", "\\textquotedblright");
  12796. defineSymbol(math, main, textord, "\xB0", "\\degree");
  12797. defineSymbol(text, main, textord, "\xB0", "\\degree");
  12798. // TODO: In LaTeX, \pounds can generate a different character in text and math
  12799. // mode, but among our fonts, only Main-Italic defines this character "163".
  12800. defineSymbol(math, main, mathord, "\xA3", "\\pounds");
  12801. defineSymbol(math, main, mathord, "\xA3", "\\mathsterling");
  12802. defineSymbol(text, main, mathord, "\xA3", "\\pounds");
  12803. defineSymbol(text, main, mathord, "\xA3", "\\textsterling");
  12804. defineSymbol(math, ams, textord, "\u2720", "\\maltese");
  12805. defineSymbol(text, ams, textord, "\u2720", "\\maltese");
  12806.  
  12807. defineSymbol(text, main, spacing, "\xA0", "\\ ");
  12808. defineSymbol(text, main, spacing, "\xA0", " ");
  12809. defineSymbol(text, main, spacing, "\xA0", "~");
  12810.  
  12811. // There are lots of symbols which are the same, so we add them in afterwards.
  12812.  
  12813. // All of these are textords in math mode
  12814. var mathTextSymbols = "0123456789/@.\"";
  12815. for (var i = 0; i < mathTextSymbols.length; i++) {
  12816. var ch = mathTextSymbols.charAt(i);
  12817. defineSymbol(math, main, textord, ch, ch);
  12818. }
  12819.  
  12820. // All of these are textords in text mode
  12821. var textSymbols = "0123456789!@*()-=+[]<>|\";:?/.,";
  12822. for (var _i = 0; _i < textSymbols.length; _i++) {
  12823. var _ch = textSymbols.charAt(_i);
  12824. defineSymbol(text, main, textord, _ch, _ch);
  12825. }
  12826.  
  12827. // All of these are textords in text mode, and mathords in math mode
  12828. var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  12829. for (var _i2 = 0; _i2 < letters.length; _i2++) {
  12830. var _ch2 = letters.charAt(_i2);
  12831. defineSymbol(math, main, mathord, _ch2, _ch2);
  12832. defineSymbol(text, main, textord, _ch2, _ch2);
  12833. }
  12834.  
  12835. // Latin-1 letters
  12836. for (var _i3 = 0x00C0; _i3 <= 0x00D6; _i3++) {
  12837. var _ch3 = String.fromCharCode(_i3);
  12838. defineSymbol(math, main, mathord, _ch3, _ch3);
  12839. defineSymbol(text, main, textord, _ch3, _ch3);
  12840. }
  12841.  
  12842. for (var _i4 = 0x00D8; _i4 <= 0x00F6; _i4++) {
  12843. var _ch4 = String.fromCharCode(_i4);
  12844. defineSymbol(math, main, mathord, _ch4, _ch4);
  12845. defineSymbol(text, main, textord, _ch4, _ch4);
  12846. }
  12847.  
  12848. for (var _i5 = 0x00F8; _i5 <= 0x00FF; _i5++) {
  12849. var _ch5 = String.fromCharCode(_i5);
  12850. defineSymbol(math, main, mathord, _ch5, _ch5);
  12851. defineSymbol(text, main, textord, _ch5, _ch5);
  12852. }
  12853.  
  12854. // Cyrillic
  12855. for (var _i6 = 0x0410; _i6 <= 0x044F; _i6++) {
  12856. var _ch6 = String.fromCharCode(_i6);
  12857. defineSymbol(text, main, textord, _ch6, _ch6);
  12858. }
  12859.  
  12860. // Unicode versions of existing characters
  12861. defineSymbol(text, main, textord, "\u2013", "–");
  12862. defineSymbol(text, main, textord, "\u2014", "—");
  12863. defineSymbol(text, main, textord, "\u2018", "‘");
  12864. defineSymbol(text, main, textord, "\u2019", "’");
  12865. defineSymbol(text, main, textord, "\u201C", "“");
  12866. defineSymbol(text, main, textord, "\u201D", "”");
  12867.  
  12868. },{}],113:[function(require,module,exports){
  12869. "use strict";
  12870.  
  12871. Object.defineProperty(exports, "__esModule", {
  12872. value: true
  12873. });
  12874. var hangulRegex = exports.hangulRegex = /[\uAC00-\uD7AF]/;
  12875.  
  12876. // This regex combines
  12877. // - CJK symbols and punctuation: [\u3000-\u303F]
  12878. // - Hiragana: [\u3040-\u309F]
  12879. // - Katakana: [\u30A0-\u30FF]
  12880. // - CJK ideograms: [\u4E00-\u9FAF]
  12881. // - Hangul syllables: [\uAC00-\uD7AF]
  12882. // - Fullwidth punctuation: [\uFF00-\uFF60]
  12883. // Notably missing are halfwidth Katakana and Romanji glyphs.
  12884. var cjkRegex = exports.cjkRegex = /[\u3000-\u30FF\u4E00-\u9FAF\uAC00-\uD7AF\uFF00-\uFF60]/;
  12885.  
  12886. },{}],114:[function(require,module,exports){
  12887. "use strict";
  12888.  
  12889. Object.defineProperty(exports, "__esModule", {
  12890. value: true
  12891. });
  12892. exports.calculateSize = exports.validUnit = undefined;
  12893.  
  12894. var _ParseError = require("./ParseError");
  12895.  
  12896. var _ParseError2 = _interopRequireDefault(_ParseError);
  12897.  
  12898. var _Options = require("./Options");
  12899.  
  12900. var _Options2 = _interopRequireDefault(_Options);
  12901.  
  12902. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12903.  
  12904. // This table gives the number of TeX pts in one of each *absolute* TeX unit.
  12905. // Thus, multiplying a length by this number converts the length from units
  12906. // into pts. Dividing the result by ptPerEm gives the number of ems
  12907. // *assuming* a font size of ptPerEm (normal size, normal style).
  12908.  
  12909.  
  12910. /**
  12911. * This file does conversion between units. In particular, it provides
  12912. * calculateSize to convert other units into ems.
  12913. */
  12914.  
  12915. var ptPerUnit = {
  12916. // https://en.wikibooks.org/wiki/LaTeX/Lengths and
  12917. // https://tex.stackexchange.com/a/8263
  12918. "pt": 1, // TeX point
  12919. "mm": 7227 / 2540, // millimeter
  12920. "cm": 7227 / 254, // centimeter
  12921. "in": 72.27, // inch
  12922. "bp": 803 / 800, // big (PostScript) points
  12923. "pc": 12, // pica
  12924. "dd": 1238 / 1157, // didot
  12925. "cc": 14856 / 1157, // cicero (12 didot)
  12926. "nd": 685 / 642, // new didot
  12927. "nc": 1370 / 107, // new cicero (12 new didot)
  12928. "sp": 1 / 65536, // scaled point (TeX's internal smallest unit)
  12929. // https://tex.stackexchange.com/a/41371
  12930. "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
  12931. };
  12932.  
  12933. // Dictionary of relative units, for fast validity testing.
  12934. var relativeUnit = {
  12935. "ex": true,
  12936. "em": true,
  12937. "mu": true
  12938. };
  12939.  
  12940. /**
  12941. * Determine whether the specified unit (either a string defining the unit
  12942. * or a "size" parse node containing a unit field) is valid.
  12943. */
  12944. var validUnit = exports.validUnit = function validUnit(unit) {
  12945. if (typeof unit !== "string") {
  12946. unit = unit.unit;
  12947. }
  12948. return unit in ptPerUnit || unit in relativeUnit || unit === "ex";
  12949. };
  12950.  
  12951. /*
  12952. * Convert a "size" parse node (with numeric "number" and string "unit" fields,
  12953. * as parsed by functions.js argType "size") into a CSS em value for the
  12954. * current style/scale. `options` gives the current options.
  12955. */
  12956. var calculateSize = exports.calculateSize = function calculateSize(sizeValue, options) {
  12957. var scale = void 0;
  12958. if (sizeValue.unit in ptPerUnit) {
  12959. // Absolute units
  12960. scale = ptPerUnit[sizeValue.unit] // Convert unit to pt
  12961. / options.fontMetrics().ptPerEm // Convert pt to CSS em
  12962. / options.sizeMultiplier; // Unscale to make absolute units
  12963. } else if (sizeValue.unit === "mu") {
  12964. // `mu` units scale with scriptstyle/scriptscriptstyle.
  12965. scale = options.fontMetrics().cssEmPerMu;
  12966. } else {
  12967. // Other relative units always refer to the *textstyle* font
  12968. // in the current size.
  12969. var unitOptions = void 0;
  12970. if (options.style.isTight()) {
  12971. // isTight() means current style is script/scriptscript.
  12972. unitOptions = options.havingStyle(options.style.text());
  12973. } else {
  12974. unitOptions = options;
  12975. }
  12976. // TODO: In TeX these units are relative to the quad of the current
  12977. // *text* font, e.g. cmr10. KaTeX instead uses values from the
  12978. // comparably-sized *Computer Modern symbol* font. At 10pt, these
  12979. // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641;
  12980. // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$.
  12981. // TeX \showlists shows a kern of 1.13889 * fontsize;
  12982. // KaTeX shows a kern of 1.171 * fontsize.
  12983. if (sizeValue.unit === "ex") {
  12984. scale = unitOptions.fontMetrics().xHeight;
  12985. } else if (sizeValue.unit === "em") {
  12986. scale = unitOptions.fontMetrics().quad;
  12987. } else {
  12988. throw new _ParseError2.default("Invalid unit: '" + sizeValue.unit + "'");
  12989. }
  12990. if (unitOptions !== options) {
  12991. scale *= unitOptions.sizeMultiplier / options.sizeMultiplier;
  12992. }
  12993. }
  12994. return Math.min(sizeValue.number * scale, options.maxSize);
  12995. };
  12996.  
  12997. },{"./Options":83,"./ParseError":84}],115:[function(require,module,exports){
  12998. "use strict";
  12999.  
  13000. Object.defineProperty(exports, "__esModule", {
  13001. value: true
  13002. });
  13003.  
  13004. /**
  13005. * This file contains a list of utility functions which are useful in other
  13006. * files.
  13007. */
  13008.  
  13009. /**
  13010. * Provide an `indexOf` function which works in IE8, but defers to native if
  13011. * possible.
  13012. */
  13013. var nativeIndexOf = Array.prototype.indexOf;
  13014. var indexOf = function indexOf(list, elem) {
  13015. if (list == null) {
  13016. return -1;
  13017. }
  13018. if (nativeIndexOf && list.indexOf === nativeIndexOf) {
  13019. return list.indexOf(elem);
  13020. }
  13021. var l = list.length;
  13022. for (var i = 0; i < l; i++) {
  13023. if (list[i] === elem) {
  13024. return i;
  13025. }
  13026. }
  13027. return -1;
  13028. };
  13029.  
  13030. /**
  13031. * Return whether an element is contained in a list
  13032. */
  13033. var contains = function contains(list, elem) {
  13034. return indexOf(list, elem) !== -1;
  13035. };
  13036.  
  13037. /**
  13038. * Provide a default value if a setting is undefined
  13039. * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.
  13040. */
  13041. var deflt = function deflt(setting, defaultIfUndefined) {
  13042. return setting === undefined ? defaultIfUndefined : setting;
  13043. };
  13044.  
  13045. // hyphenate and escape adapted from Facebook's React under Apache 2 license
  13046.  
  13047. var uppercase = /([A-Z])/g;
  13048. var hyphenate = function hyphenate(str) {
  13049. return str.replace(uppercase, "-$1").toLowerCase();
  13050. };
  13051.  
  13052. var ESCAPE_LOOKUP = {
  13053. "&": "&amp;",
  13054. ">": "&gt;",
  13055. "<": "&lt;",
  13056. "\"": "&quot;",
  13057. "'": "&#x27;"
  13058. };
  13059.  
  13060. var ESCAPE_REGEX = /[&><"']/g;
  13061.  
  13062. /**
  13063. * Escapes text to prevent scripting attacks.
  13064. */
  13065. function escape(text) {
  13066. return String(text).replace(ESCAPE_REGEX, function (match) {
  13067. return ESCAPE_LOOKUP[match];
  13068. });
  13069. }
  13070.  
  13071. /**
  13072. * A function to set the text content of a DOM element in all supported
  13073. * browsers. Note that we don't define this if there is no document.
  13074. */
  13075. var setTextContent = void 0;
  13076. if (typeof document !== "undefined") {
  13077. var testNode = document.createElement("span");
  13078. if ("textContent" in testNode) {
  13079. setTextContent = function setTextContent(node, text) {
  13080. node.textContent = text;
  13081. };
  13082. } else {
  13083. setTextContent = function setTextContent(node, text) {
  13084. node.innerText = text;
  13085. };
  13086. }
  13087. }
  13088.  
  13089. /**
  13090. * A function to clear a node.
  13091. */
  13092. function clearNode(node) {
  13093. setTextContent(node, "");
  13094. }
  13095.  
  13096. exports.default = {
  13097. contains: contains,
  13098. deflt: deflt,
  13099. escape: escape,
  13100. hyphenate: hyphenate,
  13101. indexOf: indexOf,
  13102. setTextContent: setTextContent,
  13103. clearNode: clearNode
  13104. };
  13105.  
  13106. },{}]},{},[1])(1)
  13107. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址