diff --git a/static/css/index.css b/static/css/index.css index a860031..bba9622 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -1,68 +1,78 @@ @font-face { - font-family: 'PT Sans'; + font-family: "PT Sans"; src: local("PT Sans"), local("PTSans-Regular"), url("../fonts/PTSans-Regular.woff") format("woff"); font-weight: normal; font-style: normal; } @font-face { - font-family: 'PT Sans'; + font-family: "PT Sans"; src: local("PT Sans Bold"), local("PTSans-Bold"), url("../fonts/PTSans-Bold.woff") format("woff"); font-weight: bold; font-style: normal; } html { - background: #66697c; font-size: 16px; font-size: calc(0.8rem + 0.3vw); - padding: 0 calc(38% - 20em); + background: #66697c; + padding: 0 calc(38% - 21em); } body { + background: #ffffff; + color: #212228; font-family: "PT Sans", -apple-system, "Helvetica Neue", "Segoe UI", "Roboto", sans-serif; font-weight: 400; - background: #ffffff; - color: #1c1d22; - box-shadow: 0 0 0 1px rgba(102, 105, 124, 0.3); - margin: 0; line-height: 1.6; + margin: 0; min-height: 100vh; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } +h1, h2, h3, h4, h5, h6 { + font-weight: 600; +} + b, strong, th { font-weight: 600; } -a { - color: inherit; - text-decoration: inherit; +p { + text-align: justify; } +a { + color: #68f; + text-decoration: inherit; +} a:hover { text-decoration: underline; } -article a { - color: #68f; +header a, footer a, aside a { + color: inherit; } header time { - color: #8e8e91; + color: #909194; } hr { - border: 1px solid rgba(142, 142, 145, 0.3); + border: 1px solid rgba(144, 145, 148, 0.3); margin: 2em 0; } +article:not(:last-of-type) { + border-bottom: 1.5px solid rgba(144, 145, 148, 0.2); +} + blockquote { - background: rgba(142, 142, 145, 0.06); - border-left: 3px solid rgba(142, 142, 145, 0.9); + background: rgba(144, 145, 148, 0.06); + border-left: 3px solid rgba(144, 145, 148, 0.9); padding: 1px 1.5em; - opacity: .75; + opacity: 0.75; } blockquote, figure { @@ -70,7 +80,7 @@ blockquote, figure { } img, li { - margin: .5em 0; + margin: 0.5em 0; } img { @@ -80,47 +90,52 @@ img { } table { - width: 100%; + display: inline-block; + max-width: 100%; + overflow-y: scroll; border-spacing: 1px; - box-shadow: 0 0 0 1px rgba(142, 142, 145, 0.12) inset; + border-radius: 2px; + box-shadow: 0 0 0 1px rgba(144, 145, 148, 0.12) inset; } th, td { - padding: .5em 1em; - box-shadow: 0 0 0 1px rgba(142, 142, 145, 0.12); + padding: 0.5em 1em; + box-shadow: 0 0 0 1px rgba(144, 145, 148, 0.12); } tr:hover, tr:nth-child(odd) td { - background: rgba(142, 142, 145, 0.04); + background: rgba(144, 145, 148, 0.04); } pre { - background: rgba(40, 41, 48, 0.9)!important; - color: #ffffff; + background: rgba(144, 145, 148, 0.12); border-radius: 2px; - font-size: .8em; + font-size: 0.8em; margin: 1.5em 0; - padding: .8em 1.2em; + padding: 0.8em 1.2em; overflow-x: auto; } :not(pre) > code { - font-size: .9em; - background: rgba(142, 142, 145, 0.15); - opacity: .7; + font-size: 0.9em; + background: rgba(144, 145, 148, 0.15); + opacity: 0.7; border-radius: 2px; - margin: 0 .1em; - padding: .2em .4em; + margin: 0 0.1em; + padding: 0.2em 0.4em; } -body > header { +body > header, body > footer { display: flex; flex-wrap: wrap; - justify-content: space-between; align-items: center; + justify-content: space-between; background: #2a2c33; color: #ffffff; - border-bottom: 1px solid rgba(255, 255, 255, 0.08); +} + +body > header, body > article, body > footer { + padding: 1.5em; } article header { @@ -129,41 +144,33 @@ article header { article header h1 { font-size: 1.7em; - margin: 0 0 .1em; + margin: 0 0 0.1em; } nav { - margin: .5em -1em; + margin: 0.5em -1em; } nav a { - margin: .5em 1em; -} - -body > header, body > article { - padding: 1.65em calc(20% - 4em); - padding: 1.65em max(calc(20% - 4em), 1.5em); + margin: 0.5em 1em; } @media (prefers-color-scheme: dark) { - html, body, body > header { - background: #1c1d22; + html, body, body > header, body > footer { + background: #212228; color: #ffffff; + box-shadow: 0 0 0 1px #33353e; + } +} + +@media (min-width: 32em) { + body > header, body > article, body > footer { + padding: 1.65em calc(22% - 6em); } } .title { - font-size: 1.4em; -} - -.archive { - font-size: 1.1em; -} - -.archive time { - display: inline-block; - min-width: 10ch; - margin: 0 .2em; + font-size: 1.3em; } .more { @@ -173,8 +180,8 @@ body > header, body > article { .more a { border-radius: 2px; border: 1.5px solid #68f; - padding: .4em .8em; - transition: .2s background, .2s color; + padding: 0.4em 0.8em; + transition: 0.2s background, 0.2s color; } .more a:hover { @@ -182,3 +189,23 @@ body > header, body > article { background: #68f; text-decoration: inherit; } + +.archive { + font-size: 1.1em; +} + +.archive time { + display: inline-block; + min-width: 10ch; + margin: 0 0.2em; +} + +.highlight pre { + background: rgba(47, 48, 57, 0.9)!important; + color: white!important; +} + +.katex { + overflow-x: auto; + overflow-y: hidden; +} diff --git a/static/css/minimal.css b/static/css/minimal.css index 387dc72..70cf689 100644 --- a/static/css/minimal.css +++ b/static/css/minimal.css @@ -1,11 +1,11 @@ @font-face { - font-family: 'PT Sans'; + font-family: "PT Sans"; src: local("PT Sans"), local("PTSans-Regular"), url("../fonts/PTSans-Regular.woff") format("woff"); font-weight: normal; font-style: normal; } @font-face { - font-family: 'PT Sans'; + font-family: "PT Sans"; src: local("PT Sans Bold"), local("PTSans-Bold"), url("../fonts/PTSans-Bold.woff") format("woff"); font-weight: bold; font-style: normal; @@ -17,12 +17,12 @@ html { } body { + background: #ffffff; + color: #212228; font-family: "PT Sans", -apple-system, "Helvetica Neue", "Segoe UI", "Roboto", sans-serif; font-weight: 400; - background: #ffffff; - color: #1c1d22; - margin: 0; line-height: 1.6; + margin: 0; min-height: 100vh; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; @@ -31,42 +31,53 @@ body { @media (prefers-color-scheme: dark) { body { - background: #1c1d22; + background: #212228; color: #ffffff; } } +h1, h2, h3, h4, h5, h6 { + font-weight: 600; +} + b, strong, th { font-weight: 600; } -a { - color: inherit; - text-decoration: inherit; +p { + text-align: justify; } +a { + color: #68f; + text-decoration: inherit; +} a:hover { text-decoration: underline; } -article a { - color: #68f; +header a, footer a, aside a { + color: inherit; } header time { - color: #8e8e91; + color: #909194; } hr { - border: 1px solid rgba(142, 142, 145, 0.3); + border: 1px solid rgba(144, 145, 148, 0.3); margin: 2em 0; } +article:not(:last-of-type) { + border-bottom: 1.5px solid rgba(144, 145, 148, 0.2); +} + blockquote { - background: rgba(142, 142, 145, 0.06); - border-left: 3px solid rgba(142, 142, 145, 0.9); + background: rgba(144, 145, 148, 0.06); + border-left: 3px solid rgba(144, 145, 148, 0.9); padding: 1px 1.5em; - opacity: .75; + opacity: 0.75; } blockquote, figure { @@ -74,7 +85,7 @@ blockquote, figure { } img, li { - margin: .5em 0; + margin: 0.5em 0; } img { @@ -84,46 +95,50 @@ img { } table { - width: 100%; + display: inline-block; + max-width: 100%; + overflow-y: scroll; border-spacing: 1px; - box-shadow: 0 0 0 1px rgba(142, 142, 145, 0.12) inset; + border-radius: 2px; + box-shadow: 0 0 0 1px rgba(144, 145, 148, 0.12) inset; } th, td { - padding: .5em 1em; - box-shadow: 0 0 0 1px rgba(142, 142, 145, 0.12); + padding: 0.5em 1em; + box-shadow: 0 0 0 1px rgba(144, 145, 148, 0.12); } tr:hover, tr:nth-child(odd) td { - background: rgba(142, 142, 145, 0.04); + background: rgba(144, 145, 148, 0.04); } pre { - background: rgba(40, 41, 48, 0.9)!important; - color: #ffffff; + background: rgba(144, 145, 148, 0.12); border-radius: 2px; - font-size: .8em; + font-size: 0.8em; margin: 1.5em 0; - padding: .8em 1.2em; + padding: 0.8em 1.2em; overflow-x: auto; } :not(pre) > code { - font-size: .9em; - background: rgba(142, 142, 145, 0.15); - opacity: .7; + font-size: 0.9em; + background: rgba(144, 145, 148, 0.15); + opacity: 0.7; border-radius: 2px; - margin: 0 .1em; - padding: .2em .4em; + margin: 0 0.1em; + padding: 0.2em 0.4em; } -body > header { +body > header, body > footer { display: flex; flex-wrap: wrap; - justify-content: space-between; align-items: center; - box-shadow: 0 0 0.6em rgba(28, 29, 34, 0.05); - border-bottom: 1px solid rgba(142, 142, 145, 0.16); + justify-content: space-between; +} + +body > header, body > article, body > footer { + padding: 1.5em; } article header { @@ -132,39 +147,35 @@ article header { article header h1 { font-size: 1.7em; - margin: 0 0 .1em; + margin: 0 0 0.1em; } nav { - margin: .5em -1em; + margin: 0.5em -1em; } nav a { - margin: .5em 1em; + margin: 0.5em 1em; } -body > header, body > article { - padding: 1.5em; +body > header { + box-shadow: 0 0 .6em rgba(33, 34, 40 ,0.04); + border-bottom: 1px solid rgba(144, 145, 148, 0.14); } -@media (min-width: 32em) { - body > header, body > article { - padding: 1.7em calc(38% - 12em); +body > footer { + box-shadow: 0 0 .6em rgba(33, 34, 40 ,0.04) inset; + border-top: 1px solid rgba(144, 145, 148, 0.14); +} + +@media (min-width: 38em) { + body > header, body > article, body > footer { + padding: 1.7em calc(38% - 14em); } } .title { - font-size: 1.4em; -} - -.archive { - font-size: 1.1em; -} - -.archive time { - display: inline-block; - min-width: 10ch; - margin: 0 .2em; + font-size: 1.3em; } .more { @@ -174,8 +185,8 @@ body > header, body > article { .more a { border-radius: 2px; border: 1.5px solid #68f; - padding: .4em .8em; - transition: .2s background, .2s color; + padding: 0.4em 0.8em; + transition: 0.2s background, 0.2s color; } .more a:hover { @@ -183,3 +194,23 @@ body > header, body > article { background: #68f; text-decoration: inherit; } + +.archive { + font-size: 1.1em; +} + +.archive time { + display: inline-block; + min-width: 10ch; + margin: 0 0.2em; +} + +.highlight pre { + background: rgba(47, 48, 57, 0.9)!important; + color: white!important; +} + +.katex { + overflow-x: auto; + overflow-y: hidden; +} diff --git a/static/katex/README.md b/static/katex/README.md index 307fdbf..fdba347 100644 --- a/static/katex/README.md +++ b/static/katex/README.md @@ -1,11 +1,11 @@ # [KaTeX](https://katex.org/) [![npm](https://img.shields.io/npm/v/katex.svg)](https://www.npmjs.com/package/katex) -[![CircleCI](https://circleci.com/gh/KaTeX/KaTeX.svg?style=shield)](https://circleci.com/gh/KaTeX/KaTeX) +[![CI](https://github.com/KaTeX/KaTeX/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI) [![codecov](https://codecov.io/gh/KaTeX/KaTeX/branch/master/graph/badge.svg)](https://codecov.io/gh/KaTeX/KaTeX) -[![Join the chat at https://gitter.im/KaTeX/KaTeX](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/KaTeX/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=KaTeX/KaTeX)](https://dependabot.com) +[![Discussions](https://img.shields.io/badge/Discussions-join-brightgreen)](https://github.com/KaTeX/KaTeX/discussions) [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/katex/badge?style=rounded)](https://www.jsdelivr.com/package/npm/katex) -![](https://img.badgesize.io/KaTeX/KaTeX/v0.12.0/dist/katex.min.js?compression=gzip) +![katex.min.js size](https://img.badgesize.io/https://unpkg.com/katex/dist/katex.min.js?compression=gzip) +[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/KaTeX/KaTeX) KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web. @@ -29,13 +29,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)! - + - + - ... diff --git a/static/katex/contrib/auto-render.js b/static/katex/contrib/auto-render.js index d594434..9e9bb2f 100644 --- a/static/katex/contrib/auto-render.js +++ b/static/katex/contrib/auto-render.js @@ -7,111 +7,87 @@ exports["renderMathInElement"] = factory(require("katex")); else root["renderMathInElement"] = factory(root["katex"]); -})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { -return /******/ (function(modules) { // webpackBootstrap +})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__974__) { +return /******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 974: +/***/ (function(module) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__974__; + +/***/ }) + +/******/ }); +/************************************************************************/ /******/ // The module cache -/******/ var installedModules = {}; -/******/ +/******/ var __webpack_module_cache__ = {}; +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { -/******/ /******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; +/******/ if(__webpack_module_cache__[moduleId]) { +/******/ return __webpack_module_cache__[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed /******/ exports: {} /******/ }; -/******/ +/******/ /******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1); -/******/ }) +/******/ /************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +!function() { -module.exports = __WEBPACK_EXTERNAL_MODULE__0__; - -/***/ }), -/* 1 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "default": function() { return /* binding */ auto_render; } +}); // EXTERNAL MODULE: external "katex" -var external_katex_ = __webpack_require__(0); +var external_katex_ = __webpack_require__(974); var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_); - -// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js +;// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js /* eslint no-constant-condition:0 */ var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) { // Adapted from @@ -139,96 +115,76 @@ var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) { return -1; }; -var splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) { - var finalData = []; - - for (var i = 0; i < startData.length; i++) { - if (startData[i].type === "text") { - var text = startData[i].data; - var lookingForLeft = true; - var currIndex = 0; - var nextIndex = void 0; - nextIndex = text.indexOf(leftDelim); - - if (nextIndex !== -1) { - currIndex = nextIndex; - finalData.push({ - type: "text", - data: text.slice(0, currIndex) - }); - lookingForLeft = false; - } - - while (true) { - if (lookingForLeft) { - nextIndex = text.indexOf(leftDelim, currIndex); - - if (nextIndex === -1) { - break; - } - - finalData.push({ - type: "text", - data: text.slice(currIndex, nextIndex) - }); - currIndex = nextIndex; - } else { - nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length); - - if (nextIndex === -1) { - break; - } - - finalData.push({ - type: "math", - data: text.slice(currIndex + leftDelim.length, nextIndex), - rawData: text.slice(currIndex, nextIndex + rightDelim.length), - display: display - }); - currIndex = nextIndex + rightDelim.length; - } - - lookingForLeft = !lookingForLeft; - } - - finalData.push({ - type: "text", - data: text.slice(currIndex) - }); - } else { - finalData.push(startData[i]); - } - } - - return finalData; +var escapeRegex = function escapeRegex(string) { + return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"); }; -/* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters); -// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js -/* eslint no-console:0 */ +var amsRegex = /^\\begin{/; + +var splitAtDelimiters = function splitAtDelimiters(text, delimiters) { + var index; + var data = []; + var regexLeft = new RegExp("(" + delimiters.map(function (x) { + return escapeRegex(x.left); + }).join("|") + ")"); + + while (true) { + index = text.search(regexLeft); + + if (index === -1) { + break; + } + + if (index > 0) { + data.push({ + type: "text", + data: text.slice(0, index) + }); + text = text.slice(index); // now text starts with delimiter + } // ... so this always succeeds: + var i = delimiters.findIndex(function (delim) { + return text.startsWith(delim.left); + }); + index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length); -var auto_render_splitWithDelimiters = function splitWithDelimiters(text, delimiters) { - var data = [{ - type: "text", - data: text - }]; + if (index === -1) { + break; + } - for (var i = 0; i < delimiters.length; i++) { - var delimiter = delimiters[i]; - data = auto_render_splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false); + var rawData = text.slice(0, index + delimiters[i].right.length); + var math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index); + data.push({ + type: "math", + data: math, + rawData: rawData, + display: delimiters[i].display + }); + text = text.slice(index + delimiters[i].right.length); + } + + if (text !== "") { + data.push({ + type: "text", + data: text + }); } return data; }; + +/* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters); +;// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js +/* eslint no-console:0 */ + + /* Note: optionsCopy is mutated by this method. If it is ever exposed in the * API, we should copy it before mutating. */ - -var auto_render_renderMathInText = function renderMathInText(text, optionsCopy) { - var data = auto_render_splitWithDelimiters(text, optionsCopy.delimiters); +var renderMathInText = function renderMathInText(text, optionsCopy) { + var data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters); if (data.length === 1 && data[0].type === 'text') { // There is no formula in the text. @@ -254,9 +210,9 @@ var auto_render_renderMathInText = function renderMathInText(text, optionsCopy) math = optionsCopy.preProcess(math); } - external_katex_default.a.render(math, span, optionsCopy); + external_katex_default().render(math, span, optionsCopy); } catch (e) { - if (!(e instanceof external_katex_default.a.ParseError)) { + if (!(e instanceof (external_katex_default()).ParseError)) { throw e; } @@ -278,7 +234,7 @@ var renderElem = function renderElem(elem, optionsCopy) { if (childNode.nodeType === 3) { // Text node - var frag = auto_render_renderMathInText(childNode.textContent, optionsCopy); + var frag = renderMathInText(childNode.textContent, optionsCopy); if (frag) { i += frag.childNodes.length - 1; @@ -325,11 +281,29 @@ var renderMathInElement = function renderMathInElement(elem, options) { display: false }, // LaTeX uses $…$, but it ruins the display of normal `$` in text: // {left: "$", right: "$", display: false}, - // \[…\] must come last in this array. Otherwise, renderMathInElement - // will search for \[ before it searches for $$ or \( - // That makes it susceptible to finding a \\[0.3em] row delimiter and - // treating it as if it were the start of a KaTeX math zone. + // $ must come after $$ + // Render AMS environments even if outside $$…$$ delimiters. { + left: "\\begin{equation}", + right: "\\end{equation}", + display: true + }, { + left: "\\begin{align}", + right: "\\end{align}", + display: true + }, { + left: "\\begin{alignat}", + right: "\\end{alignat}", + display: true + }, { + left: "\\begin{gather}", + right: "\\end{gather}", + display: true + }, { + left: "\\begin{CD}", + right: "\\end{CD}", + display: true + }, { left: "\\[", right: "\\]", display: true @@ -343,8 +317,10 @@ var renderMathInElement = function renderMathInElement(elem, options) { renderElem(elem, optionsCopy); }; -/* harmony default export */ var auto_render = __webpack_exports__["default"] = (renderMathInElement); - -/***/ }) -/******/ ])["default"]; +/* harmony default export */ var auto_render = (renderMathInElement); +}(); +__webpack_exports__ = __webpack_exports__.default; +/******/ return __webpack_exports__; +/******/ })() +; }); \ No newline at end of file diff --git a/static/katex/contrib/auto-render.min.js b/static/katex/contrib/auto-render.min.js index 840e74b..1647be8 100644 --- a/static/katex/contrib/auto-render.min.js +++ b/static/katex/contrib/auto-render.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),a=function(e,t,r){for(var n=r,o=0,a=e.length;n0&&(a.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));var l=t.findIndex((function(t){return e.startsWith(t.left)}));if(-1===(n=r(t[l].right,e,t[l].left.length)))break;var d=e.slice(0,n+t[l].right.length),s=i.test(d)?d:e.slice(t[l].left.length,n);a.push({type:"math",data:s,rawData:d,display:t[l].display}),e=e.slice(n+t[l].right.length)}return""!==e&&a.push({type:"text",data:e}),a},l=function(e,r){var n=o(e,r.delimiters);if(1===n.length&&"text"===n[0].type)return null;for(var a=document.createDocumentFragment(),i=0;i escapeRegex(x.left)).join("|") + ")"); - for (let i = 0; i < delimiters.length; i++) { - const delimiter = delimiters[i]; - data = splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false); + while (true) { + index = text.search(regexLeft); + + if (index === -1) { + break; + } + + if (index > 0) { + data.push({ + type: "text", + data: text.slice(0, index) + }); + text = text.slice(index); // now text starts with delimiter + } // ... so this always succeeds: + + + var i = delimiters.findIndex(delim => text.startsWith(delim.left)); + index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length); + + if (index === -1) { + break; + } + + var rawData = text.slice(0, index + delimiters[i].right.length); + var math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index); + data.push({ + type: "math", + data: math, + rawData, + display: delimiters[i].display + }); + text = text.slice(index + delimiters[i].right.length); + } + + if (text !== "") { + data.push({ + type: "text", + data: text + }); } return data; }; + +/* eslint no-console:0 */ /* Note: optionsCopy is mutated by this method. If it is ever exposed in the * API, we should copy it before mutating. */ - -const renderMathInText = function renderMathInText(text, optionsCopy) { - const data = splitWithDelimiters(text, optionsCopy.delimiters); +var renderMathInText = function renderMathInText(text, optionsCopy) { + var data = splitAtDelimiters(text, optionsCopy.delimiters); if (data.length === 1 && data[0].type === 'text') { // There is no formula in the text. @@ -121,14 +97,14 @@ const renderMathInText = function renderMathInText(text, optionsCopy) { return null; } - const fragment = document.createDocumentFragment(); + var fragment = document.createDocumentFragment(); - for (let i = 0; i < data.length; i++) { + for (var i = 0; i < data.length; i++) { if (data[i].type === "text") { fragment.appendChild(document.createTextNode(data[i].data)); } else { - const span = document.createElement("span"); - let math = data[i].data; // Override any display mode defined in the settings with that + var span = document.createElement("span"); + var math = data[i].data; // Override any display mode defined in the settings with that // defined by the text itself optionsCopy.displayMode = data[i].display; @@ -156,39 +132,41 @@ const renderMathInText = function renderMathInText(text, optionsCopy) { return fragment; }; -const renderElem = function renderElem(elem, optionsCopy) { - for (let i = 0; i < elem.childNodes.length; i++) { - const childNode = elem.childNodes[i]; +var renderElem = function renderElem(elem, optionsCopy) { + for (var i = 0; i < elem.childNodes.length; i++) { + var childNode = elem.childNodes[i]; if (childNode.nodeType === 3) { // Text node - const frag = renderMathInText(childNode.textContent, optionsCopy); + var frag = renderMathInText(childNode.textContent, optionsCopy); if (frag) { i += frag.childNodes.length - 1; elem.replaceChild(frag, childNode); } } else if (childNode.nodeType === 1) { - // Element node - const className = ' ' + childNode.className + ' '; - const shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1); + (function () { + // Element node + var className = ' ' + childNode.className + ' '; + var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1); - if (shouldRender) { - renderElem(childNode, optionsCopy); - } + if (shouldRender) { + renderElem(childNode, optionsCopy); + } + })(); } // Otherwise, it's something else, and ignore it. } }; -const renderMathInElement = function renderMathInElement(elem, options) { +var renderMathInElement = function renderMathInElement(elem, options) { if (!elem) { throw new Error("No element provided to render"); } - const optionsCopy = {}; // Object.assign(optionsCopy, option) + var optionsCopy = {}; // Object.assign(optionsCopy, option) - for (const option in options) { + for (var option in options) { if (options.hasOwnProperty(option)) { optionsCopy[option] = options[option]; } @@ -205,11 +183,29 @@ const renderMathInElement = function renderMathInElement(elem, options) { display: false }, // LaTeX uses $…$, but it ruins the display of normal `$` in text: // {left: "$", right: "$", display: false}, - // \[…\] must come last in this array. Otherwise, renderMathInElement - // will search for \[ before it searches for $$ or \( - // That makes it susceptible to finding a \\[0.3em] row delimiter and - // treating it as if it were the start of a KaTeX math zone. + // $ must come after $$ + // Render AMS environments even if outside $$…$$ delimiters. { + left: "\\begin{equation}", + right: "\\end{equation}", + display: true + }, { + left: "\\begin{align}", + right: "\\end{align}", + display: true + }, { + left: "\\begin{alignat}", + right: "\\end{alignat}", + display: true + }, { + left: "\\begin{gather}", + right: "\\end{gather}", + display: true + }, { + left: "\\begin{CD}", + right: "\\end{CD}", + display: true + }, { left: "\\[", right: "\\]", display: true diff --git a/static/katex/contrib/copy-tex.css b/static/katex/contrib/copy-tex.css index 90801d8..f925578 100644 --- a/static/katex/contrib/copy-tex.css +++ b/static/katex/contrib/copy-tex.css @@ -6,9 +6,9 @@ */ .katex, .katex-display { - user-select: all; - -moz-user-select: all; -webkit-user-select: all; - -ms-user-select: all; + -moz-user-select: all; + -ms-user-select: all; + user-select: all; } diff --git a/static/katex/contrib/copy-tex.js b/static/katex/contrib/copy-tex.js index 4649f8f..7e629bd 100644 --- a/static/katex/contrib/copy-tex.js +++ b/static/katex/contrib/copy-tex.js @@ -8,109 +8,11 @@ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })((typeof self !== 'undefined' ? self : this), function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { +return /******/ (function() { // webpackBootstrap +/******/ "use strict"; +var __webpack_exports__ = {}; -// extracted by mini-css-extract-plugin - -/***/ }), -/* 1 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// EXTERNAL MODULE: ./contrib/copy-tex/copy-tex.css -var copy_tex = __webpack_require__(0); - -// CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js +;// CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js // Set these to how you want inline and display math to be delimited. var defaultCopyDelimiters = { inline: ['$', '$'], @@ -171,7 +73,7 @@ var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters) return fragment; }; /* harmony default export */ var katex2tex = (katexReplaceWithTex); -// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js +;// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js // Global copy handler to modify behavior on .katex elements. document.addEventListener('copy', function (event) { @@ -200,14 +102,15 @@ document.addEventListener('copy', function (event) { event.preventDefault(); }); -// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.webpack.js +;// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.webpack.js /** * This is the webpack entry point for KaTeX. As ECMAScript doesn't support * CSS modules natively, a separate entry point is used. */ - -/***/ }) -/******/ ])["default"]; +__webpack_exports__ = __webpack_exports__.default; +/******/ return __webpack_exports__; +/******/ })() +; }); \ No newline at end of file diff --git a/static/katex/contrib/copy-tex.min.css b/static/katex/contrib/copy-tex.min.css index 555ed11..6f97f56 100644 --- a/static/katex/contrib/copy-tex.min.css +++ b/static/katex/contrib/copy-tex.min.css @@ -1 +1 @@ -.katex,.katex-display{user-select:all;-moz-user-select:all;-webkit-user-select:all;-ms-user-select:all} +.katex,.katex-display{-webkit-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all} diff --git a/static/katex/contrib/copy-tex.min.js b/static/katex/contrib/copy-tex.min.js index e0354d6..9e9d26e 100644 --- a/static/katex/contrib/copy-tex.min.js +++ b/static/katex/contrib/copy-tex.min.js @@ -1 +1 @@ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){},function(e,t,n){"use strict";n.r(t);n(0);var r={inline:["$","$"],display:["$$","$$"]},o=function(e,t){void 0===t&&(t=r);for(var n=e.querySelectorAll(".katex-mathml + .katex-html"),o=0;o=0;a--)t[a].loc.start>o&&(n+=" ",o=t[a].loc.start),n+=t[a].text,o+=t[a].text.length;return c.go(i.go(n,e))},i={go:function(t,e){if(!t)return[];void 0===e&&(e="ce");var n,o="0",a={};a.parenthesisLevel=0,t=(t=(t=t.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var r=10,c=[];;){n!==t?(r=10,n=t):r--;var u=i.stateMachines[e],p=u.transitions[o]||u.transitions["*"];t:for(var s=0;s0))return c;if(d.revisit||(t=_.remainder),!d.toContinue)break t}}if(r<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(t,e){if(e)if(Array.isArray(e))for(var n=0;n":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(t){return i.patterns.findObserveGroups(t,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(t){return i.patterns.findObserveGroups(t,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(t){return i.patterns.findObserveGroups(t,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(t){return i.patterns.findObserveGroups(t,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(t){return i.patterns.findObserveGroups(t,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(t){return i.patterns.findObserveGroups(t,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(t){return i.patterns.findObserveGroups(t,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(t){return i.patterns.findObserveGroups(t,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(t){return i.patterns.findObserveGroups(t,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(t){return i.patterns.findObserveGroups(t,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(t){return i.patterns.findObserveGroups(t,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(t){return i.patterns.findObserveGroups(t,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(t){var e;if(e=t.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/))return{match_:e[0],remainder:t.substr(e[0].length)};var n=i.patterns.findObserveGroups(t,"","$","$","");return n&&(e=n.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/))?{match_:e[0],remainder:t.substr(e[0].length)}:null},amount2:function(t){return this.amount(t)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(t){if(t.match(/^\([a-z]+\)$/))return null;var e=t.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return e?{match_:e[0],remainder:t.substr(e[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(t,e,n,o,a,r,i,c,u,p){var s=function(t,e){if("string"==typeof e)return 0!==t.indexOf(e)?null:e;var n=t.match(e);return n?n[0]:null},_=s(t,e);if(null===_)return null;if(t=t.substr(_.length),null===(_=s(t,n)))return null;var d=function(t,e,n){for(var o=0;e":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(t,e){var n;if((t.d||"").match(/^[0-9]+$/)){var o=t.d;t.d=void 0,n=this.output(t),t.b=o}else n=this.output(t);return i.actions["o="](t,e),n},"d= kv":function(t,e){t.d=e,t.dType="kv"},"charge or bond":function(t,e){if(t.beginsWithBond){var n=[];return i.concatArray(n,this.output(t)),i.concatArray(n,i.actions.bond(t,e,"-")),n}t.d=e},"- after o/d":function(t,e,n){var o=i.patterns.match_("orbital",t.o||""),a=i.patterns.match_("one lowercase greek letter $",t.o||""),r=i.patterns.match_("one lowercase latin letter $",t.o||""),c=i.patterns.match_("$one lowercase latin letter$ $",t.o||""),u="-"===e&&(o&&""===o.remainder||a||r||c);!u||t.a||t.b||t.p||t.d||t.q||o||!r||(t.o="$"+t.o+"$");var p=[];return u?(i.concatArray(p,this.output(t)),p.push({type_:"hyphen"})):(o=i.patterns.match_("digits",t.d||""),n&&o&&""===o.remainder?(i.concatArray(p,i.actions["d="](t,e)),i.concatArray(p,this.output(t))):(i.concatArray(p,this.output(t)),i.concatArray(p,i.actions.bond(t,e,"-")))),p},"a to o":function(t){t.o=t.a,t.a=void 0},"sb=true":function(t){t.sb=!0},"sb=false":function(t){t.sb=!1},"beginsWithBond=true":function(t){t.beginsWithBond=!0},"beginsWithBond=false":function(t){t.beginsWithBond=!1},"parenthesisLevel++":function(t){t.parenthesisLevel++},"parenthesisLevel--":function(t){t.parenthesisLevel--},"state of aggregation":function(t,e){return{type_:"state of aggregation",p1:i.go(e,"o")}},comma:function(t,e){var n=e.replace(/\s*$/,"");return n!==e&&0===t.parenthesisLevel?{type_:"comma enumeration L",p1:n}:{type_:"comma enumeration M",p1:n}},output:function(t,e,n){var o,a,r;t.r?(a="M"===t.rdt?i.go(t.rd,"tex-math"):"T"===t.rdt?[{type_:"text",p1:t.rd||""}]:i.go(t.rd),r="M"===t.rqt?i.go(t.rq,"tex-math"):"T"===t.rqt?[{type_:"text",p1:t.rq||""}]:i.go(t.rq),o={type_:"arrow",r:t.r,rd:a,rq:r}):(o=[],(t.a||t.b||t.p||t.o||t.q||t.d||n)&&(t.sb&&o.push({type_:"entitySkip"}),t.o||t.q||t.d||t.b||t.p||2===n?t.o||t.q||t.d||!t.b&&!t.p?t.o&&"kv"===t.dType&&i.patterns.match_("d-oxidation$",t.d||"")?t.dType="oxidation":t.o&&"kv"===t.dType&&!t.q&&(t.dType=void 0):(t.o=t.a,t.d=t.b,t.q=t.p,t.a=t.b=t.p=void 0):(t.o=t.a,t.a=void 0),o.push({type_:"chemfive",a:i.go(t.a,"a"),b:i.go(t.b,"bd"),p:i.go(t.p,"pq"),o:i.go(t.o,"o"),q:i.go(t.q,"pq"),d:i.go(t.d,"oxidation"===t.dType?"oxidation":"bd"),dType:t.dType})));for(var c in t)"parenthesisLevel"!==c&&"beginsWithBond"!==c&&delete t[c];return o},"oxidation-output":function(t,e){var n=["{"];return i.concatArray(n,i.go(e,"oxidation")),n.push("}"),n},"frac-output":function(t,e){return{type_:"frac-ce",p1:i.go(e[0]),p2:i.go(e[1])}},"overset-output":function(t,e){return{type_:"overset",p1:i.go(e[0]),p2:i.go(e[1])}},"underset-output":function(t,e){return{type_:"underset",p1:i.go(e[0]),p2:i.go(e[1])}},"underbrace-output":function(t,e){return{type_:"underbrace",p1:i.go(e[0]),p2:i.go(e[1])}},"color-output":function(t,e){return{type_:"color",color1:e[0],color2:i.go(e[1])}},"r=":function(t,e){t.r=e},"rdt=":function(t,e){t.rdt=e},"rd=":function(t,e){t.rd=e},"rqt=":function(t,e){t.rqt=e},"rq=":function(t,e){t.rq=e},operator:function(t,e,n){return{type_:"operator",kind_:n||e}}}},a:{transitions:i.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:i.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:i.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(t){if(t.text_){var e={type_:"text",p1:t.text_};for(var n in t)delete t[n];return e}}}},pq:{transitions:i.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(t,e){return{type_:"state of aggregation subscript",p1:i.go(e,"o")}},"color-output":function(t,e){return{type_:"color",color1:e[0],color2:i.go(e[1],"pq")}}}},bd:{transitions:i.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(t,e){return{type_:"color",color1:e[0],color2:i.go(e[1],"bd")}}}},oxidation:{transitions:i.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(t,e){return{type_:"roman numeral",p1:e||""}}}},"tex-math":{transitions:i.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(t){if(t.o){var e={type_:"tex-math",p1:t.o};for(var n in t)delete t[n];return e}}}},"tex-math tight":{transitions:i.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(t,e){t.o=(t.o||"")+"{"+e+"}"},output:function(t){if(t.o){var e={type_:"tex-math",p1:t.o};for(var n in t)delete t[n];return e}}}},"9,9":{transitions:i.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:i.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(t,e){var n=[];return"+-"===e[0]||"+/-"===e[0]?n.push("\\pm "):e[0]&&n.push(e[0]),e[1]&&(i.concatArray(n,i.go(e[1],"pu-9,9")),e[2]&&(e[2].match(/[,.]/)?i.concatArray(n,i.go(e[2],"pu-9,9")):n.push(e[2])),e[3]=e[4]||e[3],e[3]&&(e[3]=e[3].trim(),"e"===e[3]||"*"===e[3].substr(0,1)?n.push({type_:"cdot"}):n.push({type_:"times"}))),e[3]&&n.push("10^{"+e[5]+"}"),n},"number^":function(t,e){var n=[];return"+-"===e[0]||"+/-"===e[0]?n.push("\\pm "):e[0]&&n.push(e[0]),i.concatArray(n,i.go(e[1],"pu-9,9")),n.push("^{"+e[2]+"}"),n},operator:function(t,e,n){return{type_:"operator",kind_:n||e}},space:function(){return{type_:"pu-space-1"}},output:function(t){var e,n=i.patterns.match_("{(...)}",t.d||"");n&&""===n.remainder&&(t.d=n.match_);var o=i.patterns.match_("{(...)}",t.q||"");if(o&&""===o.remainder&&(t.q=o.match_),t.d&&(t.d=t.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),t.d=t.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),t.q){t.q=t.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),t.q=t.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var a={d:i.go(t.d,"pu"),q:i.go(t.q,"pu")};"//"===t.o?e={type_:"pu-frac",p1:a.d,p2:a.q}:(e=a.d,a.d.length>1||a.q.length>1?e.push({type_:" / "}):e.push({type_:"/"}),i.concatArray(e,a.q))}else e=i.go(t.d,"pu-2");for(var r in t)delete t[r];return e}}},"pu-2":{transitions:i.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(t,e){t.rm+="^{"+e+"}"},space:function(){return{type_:"pu-space-2"}},output:function(t){var e=[];if(t.rm){var n=i.patterns.match_("{(...)}",t.rm||"");e=n&&""===n.remainder?i.go(n.match_,"pu"):{type_:"rm",p1:t.rm}}for(var o in t)delete t[o];return e}}},"pu-9,9":{transitions:i.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(t){var e=[];if(t.text_=t.text_||"",t.text_.length>4){var n=t.text_.length%3;0===n&&(n=3);for(var o=t.text_.length-3;o>0;o-=3)e.push(t.text_.substr(o,3)),e.push({type_:"1000 separator"});e.push(t.text_.substr(0,n)),e.reverse()}else e.push(t.text_);for(var a in t)delete t[a];return e},"output-o":function(t){var e=[];if(t.text_=t.text_||"",t.text_.length>4){for(var n=t.text_.length-3,o=0;o":case"\u2192":case"\u27f6":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<--\x3e":return"rightleftarrows";case"<=>":case"\u21cc":return"rightleftharpoons";case"<=>>":return"rightequilibrium";case"<<=>":return"leftequilibrium";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(t){switch(t){case"-":case"1":return"{-}";case"=":case"2":return"{=}";case"#":case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";case"~=":case"~--":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";case"-~-":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(t){switch(t){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":case"$\\approx$":return" {}\\approx{} ";case"v":case"(v)":return" \\downarrow{} ";case"^":case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}}}]).default}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],e);else{var n="object"==typeof exports?e(require("katex")):e(t.katex);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}("undefined"!=typeof self?self:this,(function(t){return function(){"use strict";var e={974:function(e){e.exports=t}},n={};function o(t){if(n[t])return n[t].exports;var a=n[t]={exports:{}};return e[t](a,a.exports,o),a.exports}o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,{a:e}),e},o.d=function(t,e){for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var a={};return function(){var t=o(974),e=o.n(t);e().__defineMacro("\\ce",(function(t){return n(t.consumeArgs(1)[0],"ce")})),e().__defineMacro("\\pu",(function(t){return n(t.consumeArgs(1)[0],"pu")})),e().__defineMacro("\\tripledash","{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");var n=function(t,e){for(var n="",o=t[t.length-1].loc.start,i=t.length-1;i>=0;i--)t[i].loc.start>o&&(n+=" ",o=t[i].loc.start),n+=t[i].text,o+=t[i].text.length;return r.go(a.go(n,e))},a={go:function(t,e){if(!t)return[];void 0===e&&(e="ce");var n,o="0",r={};r.parenthesisLevel=0,t=(t=(t=t.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var i=10,c=[];;){n!==t?(i=10,n=t):i--;var u=a.stateMachines[e],p=u.transitions[o]||u.transitions["*"];t:for(var s=0;s0))return c;if(d.revisit||(t=_.remainder),!d.toContinue)break t}}if(i<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(t,e){if(e)if(Array.isArray(e))for(var n=0;n":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(t){return a.patterns.findObserveGroups(t,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(t){return a.patterns.findObserveGroups(t,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(t){return a.patterns.findObserveGroups(t,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(t){return a.patterns.findObserveGroups(t,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(t){return a.patterns.findObserveGroups(t,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(t){return a.patterns.findObserveGroups(t,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(t){return a.patterns.findObserveGroups(t,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(t){return a.patterns.findObserveGroups(t,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(t){return a.patterns.findObserveGroups(t,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(t){return a.patterns.findObserveGroups(t,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(t){return a.patterns.findObserveGroups(t,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(t){return a.patterns.findObserveGroups(t,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(t){var e;if(e=t.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/))return{match_:e[0],remainder:t.substr(e[0].length)};var n=a.patterns.findObserveGroups(t,"","$","$","");return n&&(e=n.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/))?{match_:e[0],remainder:t.substr(e[0].length)}:null},amount2:function(t){return this.amount(t)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(t){if(t.match(/^\([a-z]+\)$/))return null;var e=t.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return e?{match_:e[0],remainder:t.substr(e[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(t,e,n,o,a,r,i,c,u,p){var s=function(t,e){if("string"==typeof e)return 0!==t.indexOf(e)?null:e;var n=t.match(e);return n?n[0]:null},_=s(t,e);if(null===_)return null;if(t=t.substr(_.length),null===(_=s(t,n)))return null;var d=function(t,e,n){for(var o=0;e":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(t,e){var n;if((t.d||"").match(/^[0-9]+$/)){var o=t.d;t.d=void 0,n=this.output(t),t.b=o}else n=this.output(t);return a.actions["o="](t,e),n},"d= kv":function(t,e){t.d=e,t.dType="kv"},"charge or bond":function(t,e){if(t.beginsWithBond){var n=[];return a.concatArray(n,this.output(t)),a.concatArray(n,a.actions.bond(t,e,"-")),n}t.d=e},"- after o/d":function(t,e,n){var o=a.patterns.match_("orbital",t.o||""),r=a.patterns.match_("one lowercase greek letter $",t.o||""),i=a.patterns.match_("one lowercase latin letter $",t.o||""),c=a.patterns.match_("$one lowercase latin letter$ $",t.o||""),u="-"===e&&(o&&""===o.remainder||r||i||c);!u||t.a||t.b||t.p||t.d||t.q||o||!i||(t.o="$"+t.o+"$");var p=[];return u?(a.concatArray(p,this.output(t)),p.push({type_:"hyphen"})):(o=a.patterns.match_("digits",t.d||""),n&&o&&""===o.remainder?(a.concatArray(p,a.actions["d="](t,e)),a.concatArray(p,this.output(t))):(a.concatArray(p,this.output(t)),a.concatArray(p,a.actions.bond(t,e,"-")))),p},"a to o":function(t){t.o=t.a,t.a=void 0},"sb=true":function(t){t.sb=!0},"sb=false":function(t){t.sb=!1},"beginsWithBond=true":function(t){t.beginsWithBond=!0},"beginsWithBond=false":function(t){t.beginsWithBond=!1},"parenthesisLevel++":function(t){t.parenthesisLevel++},"parenthesisLevel--":function(t){t.parenthesisLevel--},"state of aggregation":function(t,e){return{type_:"state of aggregation",p1:a.go(e,"o")}},comma:function(t,e){var n=e.replace(/\s*$/,"");return n!==e&&0===t.parenthesisLevel?{type_:"comma enumeration L",p1:n}:{type_:"comma enumeration M",p1:n}},output:function(t,e,n){var o,r,i;t.r?(r="M"===t.rdt?a.go(t.rd,"tex-math"):"T"===t.rdt?[{type_:"text",p1:t.rd||""}]:a.go(t.rd),i="M"===t.rqt?a.go(t.rq,"tex-math"):"T"===t.rqt?[{type_:"text",p1:t.rq||""}]:a.go(t.rq),o={type_:"arrow",r:t.r,rd:r,rq:i}):(o=[],(t.a||t.b||t.p||t.o||t.q||t.d||n)&&(t.sb&&o.push({type_:"entitySkip"}),t.o||t.q||t.d||t.b||t.p||2===n?t.o||t.q||t.d||!t.b&&!t.p?t.o&&"kv"===t.dType&&a.patterns.match_("d-oxidation$",t.d||"")?t.dType="oxidation":t.o&&"kv"===t.dType&&!t.q&&(t.dType=void 0):(t.o=t.a,t.d=t.b,t.q=t.p,t.a=t.b=t.p=void 0):(t.o=t.a,t.a=void 0),o.push({type_:"chemfive",a:a.go(t.a,"a"),b:a.go(t.b,"bd"),p:a.go(t.p,"pq"),o:a.go(t.o,"o"),q:a.go(t.q,"pq"),d:a.go(t.d,"oxidation"===t.dType?"oxidation":"bd"),dType:t.dType})));for(var c in t)"parenthesisLevel"!==c&&"beginsWithBond"!==c&&delete t[c];return o},"oxidation-output":function(t,e){var n=["{"];return a.concatArray(n,a.go(e,"oxidation")),n.push("}"),n},"frac-output":function(t,e){return{type_:"frac-ce",p1:a.go(e[0]),p2:a.go(e[1])}},"overset-output":function(t,e){return{type_:"overset",p1:a.go(e[0]),p2:a.go(e[1])}},"underset-output":function(t,e){return{type_:"underset",p1:a.go(e[0]),p2:a.go(e[1])}},"underbrace-output":function(t,e){return{type_:"underbrace",p1:a.go(e[0]),p2:a.go(e[1])}},"color-output":function(t,e){return{type_:"color",color1:e[0],color2:a.go(e[1])}},"r=":function(t,e){t.r=e},"rdt=":function(t,e){t.rdt=e},"rd=":function(t,e){t.rd=e},"rqt=":function(t,e){t.rqt=e},"rq=":function(t,e){t.rq=e},operator:function(t,e,n){return{type_:"operator",kind_:n||e}}}},a:{transitions:a.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:a.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:a.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(t){if(t.text_){var e={type_:"text",p1:t.text_};for(var n in t)delete t[n];return e}}}},pq:{transitions:a.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(t,e){return{type_:"state of aggregation subscript",p1:a.go(e,"o")}},"color-output":function(t,e){return{type_:"color",color1:e[0],color2:a.go(e[1],"pq")}}}},bd:{transitions:a.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(t,e){return{type_:"color",color1:e[0],color2:a.go(e[1],"bd")}}}},oxidation:{transitions:a.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(t,e){return{type_:"roman numeral",p1:e||""}}}},"tex-math":{transitions:a.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(t){if(t.o){var e={type_:"tex-math",p1:t.o};for(var n in t)delete t[n];return e}}}},"tex-math tight":{transitions:a.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(t,e){t.o=(t.o||"")+"{"+e+"}"},output:function(t){if(t.o){var e={type_:"tex-math",p1:t.o};for(var n in t)delete t[n];return e}}}},"9,9":{transitions:a.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:a.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(t,e){var n=[];return"+-"===e[0]||"+/-"===e[0]?n.push("\\pm "):e[0]&&n.push(e[0]),e[1]&&(a.concatArray(n,a.go(e[1],"pu-9,9")),e[2]&&(e[2].match(/[,.]/)?a.concatArray(n,a.go(e[2],"pu-9,9")):n.push(e[2])),e[3]=e[4]||e[3],e[3]&&(e[3]=e[3].trim(),"e"===e[3]||"*"===e[3].substr(0,1)?n.push({type_:"cdot"}):n.push({type_:"times"}))),e[3]&&n.push("10^{"+e[5]+"}"),n},"number^":function(t,e){var n=[];return"+-"===e[0]||"+/-"===e[0]?n.push("\\pm "):e[0]&&n.push(e[0]),a.concatArray(n,a.go(e[1],"pu-9,9")),n.push("^{"+e[2]+"}"),n},operator:function(t,e,n){return{type_:"operator",kind_:n||e}},space:function(){return{type_:"pu-space-1"}},output:function(t){var e,n=a.patterns.match_("{(...)}",t.d||"");n&&""===n.remainder&&(t.d=n.match_);var o=a.patterns.match_("{(...)}",t.q||"");if(o&&""===o.remainder&&(t.q=o.match_),t.d&&(t.d=t.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),t.d=t.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),t.q){t.q=t.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),t.q=t.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var r={d:a.go(t.d,"pu"),q:a.go(t.q,"pu")};"//"===t.o?e={type_:"pu-frac",p1:r.d,p2:r.q}:(e=r.d,r.d.length>1||r.q.length>1?e.push({type_:" / "}):e.push({type_:"/"}),a.concatArray(e,r.q))}else e=a.go(t.d,"pu-2");for(var i in t)delete t[i];return e}}},"pu-2":{transitions:a.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(t,e){t.rm+="^{"+e+"}"},space:function(){return{type_:"pu-space-2"}},output:function(t){var e=[];if(t.rm){var n=a.patterns.match_("{(...)}",t.rm||"");e=n&&""===n.remainder?a.go(n.match_,"pu"):{type_:"rm",p1:t.rm}}for(var o in t)delete t[o];return e}}},"pu-9,9":{transitions:a.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(t){var e=[];if(t.text_=t.text_||"",t.text_.length>4){var n=t.text_.length%3;0===n&&(n=3);for(var o=t.text_.length-3;o>0;o-=3)e.push(t.text_.substr(o,3)),e.push({type_:"1000 separator"});e.push(t.text_.substr(0,n)),e.reverse()}else e.push(t.text_);for(var a in t)delete t[a];return e},"output-o":function(t){var e=[];if(t.text_=t.text_||"",t.text_.length>4){for(var n=t.text_.length-3,o=0;o":case"\u2192":case"\u27f6":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<--\x3e":return"rightleftarrows";case"<=>":case"\u21cc":return"rightleftharpoons";case"<=>>":return"rightequilibrium";case"<<=>":return"leftequilibrium";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(t){switch(t){case"-":case"1":return"{-}";case"=":case"2":return"{=}";case"#":case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";case"~=":case"~--":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";case"-~-":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(t){switch(t){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":case"$\\approx$":return" {}\\approx{} ";case"v":case"(v)":return" \\downarrow{} ";case"^":case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}}}(),a=a.default}()})); \ No newline at end of file diff --git a/static/katex/contrib/mhchem.mjs b/static/katex/contrib/mhchem.mjs index 46241b5..55511ad 100644 --- a/static/katex/contrib/mhchem.mjs +++ b/static/katex/contrib/mhchem.mjs @@ -2631,9 +2631,9 @@ mhchemParser.stateMachines = { return ret; } - } //#endregion + } + } //#endregion - } }; // // texify: Take MhchemParser output and convert it to TeX // diff --git a/static/katex/contrib/render-a11y-string.js b/static/katex/contrib/render-a11y-string.js index d8b27c7..cf385fd 100644 --- a/static/katex/contrib/render-a11y-string.js +++ b/static/katex/contrib/render-a11y-string.js @@ -7,106 +7,78 @@ var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } -})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { -return /******/ (function(modules) { // webpackBootstrap +})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__974__) { +return /******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 974: +/***/ (function(module) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__974__; + +/***/ }) + +/******/ }); +/************************************************************************/ /******/ // The module cache -/******/ var installedModules = {}; -/******/ +/******/ var __webpack_module_cache__ = {}; +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { -/******/ /******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; +/******/ if(__webpack_module_cache__[moduleId]) { +/******/ return __webpack_module_cache__[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed /******/ exports: {} /******/ }; -/******/ +/******/ /******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1); -/******/ }) +/******/ /************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE__0__; - -/***/ }), -/* 1 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +!function() { +/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(974); /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__); /** * renderA11yString returns a readable string. @@ -276,7 +248,8 @@ var buildString = function buildString(str, type, a11yStrings) { if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string // I think we might be able to drop the nested arrays, which would make - // this easier to type - $FlowFixMe + // this easier to type + // $FlowFixMe /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) { a11yStrings[a11yStrings.length - 1] += ret; } else if (ret) { @@ -429,6 +402,12 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) { break; } + case "hbox": + { + buildA11yStrings(tree.body, a11yStrings, atomType); + break; + } + case "kern": { // No op: we don't attempt to present kerning information @@ -665,11 +644,24 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) { regionStrings.push("end strikeout"); }); break; + } else if (/phase/.test(tree.label)) { + buildRegion(a11yStrings, function (regionStrings) { + regionStrings.push("start phase angle"); + buildA11yStrings(tree.body, regionStrings, atomType); + regionStrings.push("end phase angle"); + }); + break; } throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet"); } + case "vcenter": + { + buildA11yStrings(tree.body, a11yStrings, atomType); + break; + } + case "vphantom": { throw new Error("KaTeX-a11y: vphantom not implemented yet"); @@ -779,6 +771,16 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) { throw new Error("KaTeX-a11y: xArrow not implemented yet"); } + case "cdlabel": + { + throw new Error("KaTeX-a11y: cdlabel not implemented yet"); + } + + case "cdlabelparent": + { + throw new Error("KaTeX-a11y: cdlabelparent not implemented yet"); + } + case "mclass": { // \neq and \ne are macros so we let "htmlmathml" render the mathmal @@ -857,14 +859,16 @@ var flatten = function flatten(array) { }; var renderA11yString = function renderA11yString(text, settings) { - var tree = katex__WEBPACK_IMPORTED_MODULE_0___default.a.__parse(text, settings); + var tree = katex__WEBPACK_IMPORTED_MODULE_0___default().__parse(text, settings); var a11yStrings = buildA11yStrings(tree, [], "normal"); return flatten(a11yStrings).join(", "); }; /* harmony default export */ __webpack_exports__["default"] = (renderA11yString); - -/***/ }) -/******/ ])["default"]; +}(); +__webpack_exports__ = __webpack_exports__.default; +/******/ return __webpack_exports__; +/******/ })() +; }); \ No newline at end of file diff --git a/static/katex/contrib/render-a11y-string.min.js b/static/katex/contrib/render-a11y-string.min.js index 5d406a6..1c6b8b0 100644 --- a/static/katex/contrib/render-a11y-string.min.js +++ b/static/katex/contrib/render-a11y-string.min.js @@ -1 +1 @@ -!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],r);else{var t="object"==typeof exports?r(require("katex")):r(e.katex);for(var a in t)("object"==typeof exports?exports:e)[a]=t[a]}}("undefined"!=typeof self?self:this,function(e){return function(e){var r={};function t(a){if(r[a])return r[a].exports;var o=r[a]={i:a,l:!1,exports:{}};return e[a].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,a){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:a})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(t.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(a,o,function(r){return e[r]}.bind(null,o));return a},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=1)}([function(r,t){r.exports=e},function(e,r,t){"use strict";t.r(r);var a=t(0),o=t.n(a),n={"(":"left parenthesis",")":"right parenthesis","[":"open bracket","]":"close bracket","\\{":"left brace","\\}":"right brace","\\lvert":"open vertical bar","\\rvert":"close vertical bar","|":"vertical bar","\\uparrow":"up arrow","\\Uparrow":"up arrow","\\downarrow":"down arrow","\\Downarrow":"down arrow","\\updownarrow":"up down arrow","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow","\\langle":"open angle","\\rangle":"close angle","\\lfloor":"open floor","\\rfloor":"close floor","\\int":"integral","\\intop":"integral","\\lim":"limit","\\ln":"natural log","\\log":"log","\\sin":"sine","\\cos":"cosine","\\tan":"tangent","\\cot":"cotangent","\\sum":"sum","/":"slash",",":"comma",".":"point","-":"negative","+":"plus","~":"tilde",":":"colon","?":"question mark","'":"apostrophe","\\%":"percent"," ":"space","\\ ":"space","\\$":"dollar sign","\\angle":"angle","\\degree":"degree","\\circ":"circle","\\vec":"vector","\\triangle":"triangle","\\pi":"pi","\\prime":"prime","\\infty":"infinity","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\omega":"omega","\\theta":"theta","\\sigma":"sigma","\\lambda":"lambda","\\tau":"tau","\\Delta":"delta","\\delta":"delta","\\mu":"mu","\\rho":"rho","\\nabla":"del","\\ell":"ell","\\ldots":"dots","\\hat":"hat","\\acute":"acute"},s={prime:"prime",degree:"degrees",circle:"degrees",2:"squared",3:"cubed"},i={"|":"open vertical bar",".":""},l={"|":"close vertical bar",".":""},c={"+":"plus","-":"minus","\\pm":"plus minus","\\cdot":"dot","*":"times","/":"divided by","\\times":"times","\\div":"divided by","\\circ":"circle","\\bullet":"bullet"},u={"=":"equals","\\approx":"approximately equals","\u2260":"does not equal","\\geq":"is greater than or equal to","\\ge":"is greater than or equal to","\\leq":"is less than or equal to","\\le":"is less than or equal to",">":"is greater than","<":"is less than","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow",":":"colon"},p={"\\underleftarrow":"left arrow","\\underrightarrow":"right arrow","\\underleftrightarrow":"left-right arrow","\\undergroup":"group","\\underlinesegment":"line segment","\\utilde":"tilde"},d=function(e,r,t){var a;e&&(/^\d+$/.test(a="open"===r?e in i?i[e]:n[e]||e:"close"===r?e in l?l[e]:n[e]||e:"bin"===r?c[e]||e:"rel"===r?u[e]||e:n[e]||e)&&t.length>0&&/^\d+$/.test(t[t.length-1])?t[t.length-1]+=a:a&&t.push(a))},b=function(e,r){var t=[];e.push(t),r(t)},h=function(e,r,t){switch(e.type){case"accent":b(r,function(r){f(e.base,r,t),r.push("with"),d(e.label,"normal",r),r.push("on top")});break;case"accentUnder":b(r,function(r){f(e.base,r,t),r.push("with"),d(p[e.label],"normal",r),r.push("underneath")});break;case"accent-token":break;case"atom":var a=e.text;switch(e.family){case"bin":d(a,"bin",r);break;case"close":d(a,"close",r);break;case"inner":d(e.text,"inner",r);break;case"open":d(a,"open",r);break;case"punct":d(a,"punct",r);break;case"rel":d(a,"rel",r);break;default:throw e.family,new Error('"'+e.family+'" is not a valid atom type')}break;case"color":var o=e.color.replace(/katex-/,"");b(r,function(r){r.push("start color "+o),f(e.body,r,t),r.push("end color "+o)});break;case"color-token":break;case"delimsizing":e.delim&&"."!==e.delim&&d(e.delim,"normal",r);break;case"genfrac":b(r,function(r){var a=e.leftDelim,o=e.rightDelim;e.hasBarLine?(r.push("start fraction"),a&&d(a,"open",r),f(e.numer,r,t),r.push("divided by"),f(e.denom,r,t),o&&d(o,"close",r),r.push("end fraction")):(r.push("start binomial"),a&&d(a,"open",r),f(e.numer,r,t),r.push("over"),f(e.denom,r,t),o&&d(o,"close",r),r.push("end binomial"))});break;case"kern":break;case"leftright":b(r,function(r){d(e.left,"open",r),f(e.body,r,t),d(e.right,"close",r)});break;case"leftright-right":break;case"lap":f(e.body,r,t);break;case"mathord":d(e.text,"normal",r);break;case"op":var n=e.body,i=e.name;n?f(n,r,t):i&&d(i,"normal",r);break;case"op-token":d(e.text,t,r);break;case"ordgroup":f(e.body,r,t);break;case"overline":b(r,function(r){r.push("start overline"),f(e.body,r,t),r.push("end overline")});break;case"phantom":r.push("empty space");break;case"raisebox":f(e.body,r,t);break;case"rule":r.push("rectangle");break;case"sizing":f(e.body,r,t);break;case"spacing":r.push("space");break;case"styling":f(e.body,r,t);break;case"sqrt":b(r,function(r){var a=e.body,o=e.index;if(o)return"3"===m(f(o,[],t)).join(",")?(r.push("cube root of"),f(a,r,t),void r.push("end cube root")):(r.push("root"),r.push("start index"),f(o,r,t),void r.push("end index"));r.push("square root of"),f(a,r,t),r.push("end square root")});break;case"supsub":var l=e.base,c=e.sub,u=e.sup,h=!1;if(l&&(f(l,r,t),h="op"===l.type&&"\\log"===l.name),c){var y=h?"base":"subscript";b(r,function(e){e.push("start "+y),f(c,e,t),e.push("end "+y)})}u&&b(r,function(e){var r=m(f(u,[],t)).join(",");r in s?e.push(s[r]):(e.push("start superscript"),f(u,e,t),e.push("end superscript"))});break;case"text":if("\\textbf"===e.font){b(r,function(r){r.push("start bold text"),f(e.body,r,t),r.push("end bold text")});break}b(r,function(r){r.push("start text"),f(e.body,r,t),r.push("end text")});break;case"textord":d(e.text,t,r);break;case"smash":f(e.body,r,t);break;case"enclose":if(/cancel/.test(e.label)){b(r,function(r){r.push("start cancel"),f(e.body,r,t),r.push("end cancel")});break}if(/box/.test(e.label)){b(r,function(r){r.push("start box"),f(e.body,r,t),r.push("end box")});break}if(/sout/.test(e.label)){b(r,function(r){r.push("start strikeout"),f(e.body,r,t),r.push("end strikeout")});break}throw new Error("KaTeX-a11y: enclose node with "+e.label+" not supported yet");case"vphantom":throw new Error("KaTeX-a11y: vphantom not implemented yet");case"hphantom":throw new Error("KaTeX-a11y: hphantom not implemented yet");case"operatorname":f(e.body,r,t);break;case"array":throw new Error("KaTeX-a11y: array not implemented yet");case"raw":throw new Error("KaTeX-a11y: raw not implemented yet");case"size":break;case"url":throw new Error("KaTeX-a11y: url not implemented yet");case"tag":throw new Error("KaTeX-a11y: tag not implemented yet");case"verb":d("start verbatim","normal",r),d(e.body,"normal",r),d("end verbatim","normal",r);break;case"environment":throw new Error("KaTeX-a11y: environment not implemented yet");case"horizBrace":d("start "+e.label.slice(1),"normal",r),f(e.base,r,t),d("end "+e.label.slice(1),"normal",r);break;case"infix":break;case"includegraphics":throw new Error("KaTeX-a11y: includegraphics not implemented yet");case"font":f(e.body,r,t);break;case"href":throw new Error("KaTeX-a11y: href not implemented yet");case"cr":throw new Error("KaTeX-a11y: cr not implemented yet");case"underline":b(r,function(r){r.push("start underline"),f(e.body,r,t),r.push("end underline")});break;case"xArrow":throw new Error("KaTeX-a11y: xArrow not implemented yet");case"mclass":var g=e.mclass.slice(1);f(e.body,r,g);break;case"mathchoice":f(e.text,r,t);break;case"htmlmathml":f(e.mathml,r,t);break;case"middle":d(e.delim,t,r);break;case"internal":break;case"html":f(e.body,r,t);break;default:throw e.type,new Error("KaTeX a11y un-recognized type: "+e.type)}},f=function e(r,t,a){if(void 0===t&&(t=[]),r instanceof Array)for(var o=0;o":"is greater than","<":"is less than","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow",":":"colon"},d={"\\underleftarrow":"left arrow","\\underrightarrow":"right arrow","\\underleftrightarrow":"left-right arrow","\\undergroup":"group","\\underlinesegment":"line segment","\\utilde":"tilde"},b=function(e,r,a){var t;e&&(/^\d+$/.test(t="open"===r?e in l?l[e]:s[e]||e:"close"===r?e in c?c[e]:s[e]||e:"bin"===r?u[e]||e:"rel"===r?p[e]||e:s[e]||e)&&a.length>0&&/^\d+$/.test(a[a.length-1])?a[a.length-1]+=t:t&&a.push(t))},h=function(e,r){var a=[];e.push(a),r(a)},m=function(e,r,a){switch(e.type){case"accent":h(r,(function(r){f(e.base,r,a),r.push("with"),b(e.label,"normal",r),r.push("on top")}));break;case"accentUnder":h(r,(function(r){f(e.base,r,a),r.push("with"),b(d[e.label],"normal",r),r.push("underneath")}));break;case"accent-token":break;case"atom":var t=e.text;switch(e.family){case"bin":b(t,"bin",r);break;case"close":b(t,"close",r);break;case"inner":b(e.text,"inner",r);break;case"open":b(t,"open",r);break;case"punct":b(t,"punct",r);break;case"rel":b(t,"rel",r);break;default:throw e.family,new Error('"'+e.family+'" is not a valid atom type')}break;case"color":var o=e.color.replace(/katex-/,"");h(r,(function(r){r.push("start color "+o),f(e.body,r,a),r.push("end color "+o)}));break;case"color-token":break;case"delimsizing":e.delim&&"."!==e.delim&&b(e.delim,"normal",r);break;case"genfrac":h(r,(function(r){var t=e.leftDelim,o=e.rightDelim;e.hasBarLine?(r.push("start fraction"),t&&b(t,"open",r),f(e.numer,r,a),r.push("divided by"),f(e.denom,r,a),o&&b(o,"close",r),r.push("end fraction")):(r.push("start binomial"),t&&b(t,"open",r),f(e.numer,r,a),r.push("over"),f(e.denom,r,a),o&&b(o,"close",r),r.push("end binomial"))}));break;case"hbox":f(e.body,r,a);break;case"kern":break;case"leftright":h(r,(function(r){b(e.left,"open",r),f(e.body,r,a),b(e.right,"close",r)}));break;case"leftright-right":break;case"lap":f(e.body,r,a);break;case"mathord":b(e.text,"normal",r);break;case"op":var n=e.body,s=e.name;n?f(n,r,a):s&&b(s,"normal",r);break;case"op-token":b(e.text,a,r);break;case"ordgroup":f(e.body,r,a);break;case"overline":h(r,(function(r){r.push("start overline"),f(e.body,r,a),r.push("end overline")}));break;case"phantom":r.push("empty space");break;case"raisebox":f(e.body,r,a);break;case"rule":r.push("rectangle");break;case"sizing":f(e.body,r,a);break;case"spacing":r.push("space");break;case"styling":f(e.body,r,a);break;case"sqrt":h(r,(function(r){var t=e.body,o=e.index;if(o)return"3"===y(f(o,[],a)).join(",")?(r.push("cube root of"),f(t,r,a),void r.push("end cube root")):(r.push("root"),r.push("start index"),f(o,r,a),void r.push("end index"));r.push("square root of"),f(t,r,a),r.push("end square root")}));break;case"supsub":var l=e.base,c=e.sub,u=e.sup,p=!1;if(l&&(f(l,r,a),p="op"===l.type&&"\\log"===l.name),c){var m=p?"base":"subscript";h(r,(function(e){e.push("start "+m),f(c,e,a),e.push("end "+m)}))}u&&h(r,(function(e){var r=y(f(u,[],a)).join(",");r in i?e.push(i[r]):(e.push("start superscript"),f(u,e,a),e.push("end superscript"))}));break;case"text":if("\\textbf"===e.font){h(r,(function(r){r.push("start bold text"),f(e.body,r,a),r.push("end bold text")}));break}h(r,(function(r){r.push("start text"),f(e.body,r,a),r.push("end text")}));break;case"textord":b(e.text,a,r);break;case"smash":f(e.body,r,a);break;case"enclose":if(/cancel/.test(e.label)){h(r,(function(r){r.push("start cancel"),f(e.body,r,a),r.push("end cancel")}));break}if(/box/.test(e.label)){h(r,(function(r){r.push("start box"),f(e.body,r,a),r.push("end box")}));break}if(/sout/.test(e.label)){h(r,(function(r){r.push("start strikeout"),f(e.body,r,a),r.push("end strikeout")}));break}if(/phase/.test(e.label)){h(r,(function(r){r.push("start phase angle"),f(e.body,r,a),r.push("end phase angle")}));break}throw new Error("KaTeX-a11y: enclose node with "+e.label+" not supported yet");case"vcenter":f(e.body,r,a);break;case"vphantom":throw new Error("KaTeX-a11y: vphantom not implemented yet");case"hphantom":throw new Error("KaTeX-a11y: hphantom not implemented yet");case"operatorname":f(e.body,r,a);break;case"array":throw new Error("KaTeX-a11y: array not implemented yet");case"raw":throw new Error("KaTeX-a11y: raw not implemented yet");case"size":break;case"url":throw new Error("KaTeX-a11y: url not implemented yet");case"tag":throw new Error("KaTeX-a11y: tag not implemented yet");case"verb":b("start verbatim","normal",r),b(e.body,"normal",r),b("end verbatim","normal",r);break;case"environment":throw new Error("KaTeX-a11y: environment not implemented yet");case"horizBrace":b("start "+e.label.slice(1),"normal",r),f(e.base,r,a),b("end "+e.label.slice(1),"normal",r);break;case"infix":break;case"includegraphics":throw new Error("KaTeX-a11y: includegraphics not implemented yet");case"font":f(e.body,r,a);break;case"href":throw new Error("KaTeX-a11y: href not implemented yet");case"cr":throw new Error("KaTeX-a11y: cr not implemented yet");case"underline":h(r,(function(r){r.push("start underline"),f(e.body,r,a),r.push("end underline")}));break;case"xArrow":throw new Error("KaTeX-a11y: xArrow not implemented yet");case"cdlabel":throw new Error("KaTeX-a11y: cdlabel not implemented yet");case"cdlabelparent":throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");case"mclass":var w=e.mclass.slice(1);f(e.body,r,w);break;case"mathchoice":f(e.text,r,a);break;case"htmlmathml":f(e.mathml,r,a);break;case"middle":b(e.delim,a,r);break;case"internal":break;case"html":f(e.body,r,a);break;default:throw e.type,new Error("KaTeX a11y un-recognized type: "+e.type)}},f=function e(r,a,t){if(void 0===a&&(a=[]),r instanceof Array)for(var o=0;o { +var buildString = (str, type, a11yStrings) => { if (!str) { return; } - let ret; + var ret; if (type === "open") { ret = str in openMap ? openMap[str] : stringMap[str] || str; @@ -164,7 +164,8 @@ const buildString = (str, type, a11yStrings) => { if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string // I think we might be able to drop the nested arrays, which would make - // this easier to type - $FlowFixMe + // this easier to type + // $FlowFixMe /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) { a11yStrings[a11yStrings.length - 1] += ret; } else if (ret) { @@ -172,13 +173,13 @@ const buildString = (str, type, a11yStrings) => { } }; -const buildRegion = (a11yStrings, callback) => { - const regionStrings = []; +var buildRegion = (a11yStrings, callback) => { + var regionStrings = []; a11yStrings.push(regionStrings); callback(regionStrings); }; -const handleObject = (tree, a11yStrings, atomType) => { +var handleObject = (tree, a11yStrings, atomType) => { // Everything else is assumed to be an object... switch (tree.type) { case "accent": @@ -211,7 +212,9 @@ const handleObject = (tree, a11yStrings, atomType) => { case "atom": { - const text = tree.text; + var { + text + } = tree; switch (tree.family) { case "bin": @@ -254,7 +257,7 @@ const handleObject = (tree, a11yStrings, atomType) => { default: { tree.family; - throw new Error(`"${tree.family}" is not a valid atom type`); + throw new Error("\"" + tree.family + "\" is not a valid atom type"); } } @@ -263,7 +266,7 @@ const handleObject = (tree, a11yStrings, atomType) => { case "color": { - const color = tree.color.replace(/katex-/, ""); + var color = tree.color.replace(/katex-/, ""); buildRegion(a11yStrings, regionStrings => { regionStrings.push("start color " + color); buildA11yStrings(tree.body, regionStrings, atomType); @@ -292,8 +295,10 @@ const handleObject = (tree, a11yStrings, atomType) => { { buildRegion(a11yStrings, regionStrings => { // genfrac can have unbalanced delimiters - const leftDelim = tree.leftDelim, - rightDelim = tree.rightDelim; // NOTE: Not sure if this is a safe assumption + var { + leftDelim, + rightDelim + } = tree; // NOTE: Not sure if this is a safe assumption // hasBarLine true -> fraction, false -> binomial if (tree.hasBarLine) { @@ -317,6 +322,12 @@ const handleObject = (tree, a11yStrings, atomType) => { break; } + case "hbox": + { + buildA11yStrings(tree.body, a11yStrings, atomType); + break; + } + case "kern": { // No op: we don't attempt to present kerning information @@ -354,8 +365,10 @@ const handleObject = (tree, a11yStrings, atomType) => { case "op": { - const body = tree.body, - name = tree.name; + var { + body, + name + } = tree; if (body) { buildA11yStrings(body, a11yStrings, atomType); @@ -429,11 +442,13 @@ const handleObject = (tree, a11yStrings, atomType) => { case "sqrt": { buildRegion(a11yStrings, regionStrings => { - const body = tree.body, - index = tree.index; + var { + body, + index + } = tree; if (index) { - const indexString = flatten(buildA11yStrings(index, [], atomType)).join(","); + var indexString = flatten(buildA11yStrings(index, [], atomType)).join(","); if (indexString === "3") { regionStrings.push("cube root of"); @@ -458,10 +473,12 @@ const handleObject = (tree, a11yStrings, atomType) => { case "supsub": { - const base = tree.base, - sub = tree.sub, - sup = tree.sup; - let isLog = false; + var { + base, + sub, + sup + } = tree; + var isLog = false; if (base) { buildA11yStrings(base, a11yStrings, atomType); @@ -469,17 +486,17 @@ const handleObject = (tree, a11yStrings, atomType) => { } if (sub) { - const regionName = isLog ? "base" : "subscript"; + var regionName = isLog ? "base" : "subscript"; buildRegion(a11yStrings, function (regionStrings) { - regionStrings.push(`start ${regionName}`); + regionStrings.push("start " + regionName); buildA11yStrings(sub, regionStrings, atomType); - regionStrings.push(`end ${regionName}`); + regionStrings.push("end " + regionName); }); } if (sup) { buildRegion(a11yStrings, function (regionStrings) { - const supString = flatten(buildA11yStrings(sup, [], atomType)).join(","); + var supString = flatten(buildA11yStrings(sup, [], atomType)).join(","); if (supString in powerMap) { regionStrings.push(powerMap[supString]); @@ -553,9 +570,22 @@ const handleObject = (tree, a11yStrings, atomType) => { regionStrings.push("end strikeout"); }); break; + } else if (/phase/.test(tree.label)) { + buildRegion(a11yStrings, function (regionStrings) { + regionStrings.push("start phase angle"); + buildA11yStrings(tree.body, regionStrings, atomType); + regionStrings.push("end phase angle"); + }); + break; } - throw new Error(`KaTeX-a11y: enclose node with ${tree.label} not supported yet`); + throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet"); + } + + case "vcenter": + { + buildA11yStrings(tree.body, a11yStrings, atomType); + break; } case "vphantom": @@ -603,9 +633,9 @@ const handleObject = (tree, a11yStrings, atomType) => { case "verb": { - buildString(`start verbatim`, "normal", a11yStrings); + buildString("start verbatim", "normal", a11yStrings); buildString(tree.body, "normal", a11yStrings); - buildString(`end verbatim`, "normal", a11yStrings); + buildString("end verbatim", "normal", a11yStrings); break; } @@ -616,9 +646,9 @@ const handleObject = (tree, a11yStrings, atomType) => { case "horizBrace": { - buildString(`start ${tree.label.slice(1)}`, "normal", a11yStrings); + buildString("start " + tree.label.slice(1), "normal", a11yStrings); buildA11yStrings(tree.base, a11yStrings, atomType); - buildString(`end ${tree.label.slice(1)}`, "normal", a11yStrings); + buildString("end " + tree.label.slice(1), "normal", a11yStrings); break; } @@ -667,13 +697,24 @@ const handleObject = (tree, a11yStrings, atomType) => { throw new Error("KaTeX-a11y: xArrow not implemented yet"); } + case "cdlabel": + { + throw new Error("KaTeX-a11y: cdlabel not implemented yet"); + } + + case "cdlabelparent": + { + throw new Error("KaTeX-a11y: cdlabelparent not implemented yet"); + } + case "mclass": { // \neq and \ne are macros so we let "htmlmathml" render the mathmal // side of things and extract the text from that. - const atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass + var _atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass - buildA11yStrings(tree.body, a11yStrings, atomType); + + buildA11yStrings(tree.body, a11yStrings, _atomType); break; } @@ -715,13 +756,13 @@ const handleObject = (tree, a11yStrings, atomType) => { } }; -const buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) { +var buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) { if (a11yStrings === void 0) { a11yStrings = []; } if (tree instanceof Array) { - for (let i = 0; i < tree.length; i++) { + for (var i = 0; i < tree.length; i++) { buildA11yStrings(tree[i], a11yStrings, atomType); } } else { @@ -731,8 +772,8 @@ const buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) return a11yStrings; }; -const flatten = function flatten(array) { - let result = []; +var flatten = function flatten(array) { + var result = []; array.forEach(function (item) { if (item instanceof Array) { result = result.concat(flatten(item)); @@ -743,10 +784,10 @@ const flatten = function flatten(array) { return result; }; -const renderA11yString = function renderA11yString(text, settings) { - const tree = katex.__parse(text, settings); +var renderA11yString = function renderA11yString(text, settings) { + var tree = katex.__parse(text, settings); - const a11yStrings = buildA11yStrings(tree, [], "normal"); + var a11yStrings = buildA11yStrings(tree, [], "normal"); return flatten(a11yStrings).join(", "); }; diff --git a/static/katex/katex.css b/static/katex/katex.css index ba88758..c7b5364 100644 --- a/static/katex/katex.css +++ b/static/katex/katex.css @@ -130,9 +130,11 @@ -ms-high-contrast-adjust: none !important; } .katex .katex-version::after { - content: "0.12.0"; + content: "0.13.0"; } .katex .katex-mathml { + /* Accessibility hack to only show to screen readers + Found at: http://a11yproject.com/posts/how-to-hide-content/ */ position: absolute; clip: rect(1px, 1px, 1px, 1px); padding: 0; @@ -151,6 +153,8 @@ position: relative; display: inline-block; white-space: nowrap; + width: -webkit-min-content; + width: -moz-min-content; width: min-content; } .katex .strut { @@ -266,16 +270,12 @@ min-width: 2px; } .katex .vbox { - display: -ms-inline-flexbox; display: inline-flex; - -ms-flex-direction: column; flex-direction: column; align-items: baseline; } .katex .hbox { - display: -ms-inline-flexbox; display: inline-flex; - -ms-flex-direction: row; flex-direction: row; width: 100%; } @@ -352,6 +352,8 @@ border-bottom-style: dashed; } .katex .sqrt > .root { + /* These values are taken from the definition of `\r@@t`, + `\mkern 5mu` and `\mkern -10mu`. */ margin-left: 0.27777778em; margin-right: -0.55555556em; } @@ -982,6 +984,9 @@ .katex .x-arrow-pad { padding: 0 0.5em; } +.katex .cd-arrow-pad { + padding: 0 0.55556em 0 0.27778em; +} .katex .x-arrow, .katex .mover, .katex .munder { @@ -1006,6 +1011,42 @@ border-bottom-style: solid; border-bottom-width: 0.08em; } +.katex .angl { + box-sizing: border-content; + border-top: 0.049em solid; + border-right: 0.049em solid; + margin-right: 0.03889em; +} +.katex .anglpad { + padding: 0 0.03889em 0 0.03889em; +} +.katex .eqn-num::before { + counter-increment: katexEqnNo; + content: "(" counter(katexEqnNo) ")"; +} +.katex .mml-eqn-num::before { + counter-increment: mmlEqnNo; + content: "(" counter(mmlEqnNo) ")"; +} +.katex .mtr-glue { + width: 50%; +} +.katex .cd-vert-arrow { + display: inline-block; + position: relative; +} +.katex .cd-label-left { + display: inline-block; + position: absolute; + right: calc(50% + 0.3em); + text-align: left; +} +.katex .cd-label-right { + display: inline-block; + position: absolute; + left: calc(50% + 0.3em); + text-align: right; +} .katex-display { display: block; margin: 1em 0; @@ -1032,4 +1073,7 @@ text-align: left; padding-left: 2em; } +body { + counter-reset: katexEqnNo mmlEqnNo; +} diff --git a/static/katex/katex.js b/static/katex/katex.js index 37fb0fa..48a867e 100644 --- a/static/katex/katex.js +++ b/static/katex/katex.js @@ -8,203 +8,38 @@ else root["katex"] = factory(); })((typeof self !== 'undefined' ? self : this), function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1); -/******/ }) +return /******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ // The require scope +/******/ var __webpack_require__ = {}; +/******/ /************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; -// extracted by mini-css-extract-plugin +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "default": function() { return /* binding */ katex_webpack; } +}); -/***/ }), -/* 1 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// EXTERNAL MODULE: ./src/katex.less -var katex = __webpack_require__(0); - -// CONCATENATED MODULE: ./src/SourceLocation.js -/** - * Lexing or parsing positional information for error reporting. - * This object is immutable. - */ -var SourceLocation = -/*#__PURE__*/ -function () { - // The + prefix indicates that these fields aren't writeable - // Lexer holding the input string. - // Start offset, zero-based inclusive. - // End offset, zero-based exclusive. - function SourceLocation(lexer, start, end) { - this.lexer = void 0; - this.start = void 0; - this.end = void 0; - this.lexer = lexer; - this.start = start; - this.end = end; - } - /** - * Merges two `SourceLocation`s from location providers, given they are - * provided in order of appearance. - * - Returns the first one's location if only the first is provided. - * - Returns a merged range of the first and the last if both are provided - * and their lexers match. - * - Otherwise, returns null. - */ - - - SourceLocation.range = function range(first, second) { - if (!second) { - return first && first.loc; - } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) { - return null; - } else { - return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end); - } - }; - - return SourceLocation; -}(); - - -// CONCATENATED MODULE: ./src/Token.js - -/** - * Interface required to break circular dependency between Token, Lexer, and - * ParseError. - */ - -/** - * The resulting token returned from `lex`. - * - * It consists of the token text plus some position information. - * The position information is essentially a range in an input string, - * but instead of referencing the bare input string, we refer to the lexer. - * That way it is possible to attach extra metadata to the input string, - * like for example a file name or similar. - * - * The position information is optional, so it is OK to construct synthetic - * tokens if appropriate. Not providing available position information may - * lead to degraded error reporting, though. - */ -var Token_Token = -/*#__PURE__*/ -function () { - // don't expand the token - // used in \noexpand - function Token(text, // the text of this token - loc) { - this.text = void 0; - this.loc = void 0; - this.noexpand = void 0; - this.treatAsRelax = void 0; - this.text = text; - this.loc = loc; - } - /** - * Given a pair of tokens (this and endToken), compute a `Token` encompassing - * the whole input range enclosed by these two. - */ - - - var _proto = Token.prototype; - - _proto.range = function range(endToken, // last token of the range, inclusive - text) // the text of the newly constructed token - { - return new Token(text, SourceLocation.range(this, endToken)); - }; - - return Token; -}(); -// CONCATENATED MODULE: ./src/ParseError.js +;// CONCATENATED MODULE: ./src/ParseError.js /** @@ -217,8 +52,7 @@ function () { */ var ParseError = // Error position based on passed-in Token or ParseNode. function ParseError(message, // The error message -token) // An object providing position information -{ +token) { this.position = void 0; var error = "KaTeX parse error: " + message; var start; @@ -274,7 +108,7 @@ token) // An object providing position information ParseError.prototype.__proto__ = Error.prototype; /* harmony default export */ var src_ParseError = (ParseError); -// CONCATENATED MODULE: ./src/utils.js +;// CONCATENATED MODULE: ./src/utils.js /** * This file contains a list of utility functions which are useful in other * files. @@ -353,7 +187,7 @@ var getBaseElem = function getBaseElem(group) { */ -var utils_isCharacterBox = function isCharacterBox(group) { +var isCharacterBox = function isCharacterBox(group) { var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom"; @@ -381,10 +215,10 @@ var protocolFromUrl = function protocolFromUrl(url) { escape: utils_escape, hyphenate: hyphenate, getBaseElem: getBaseElem, - isCharacterBox: utils_isCharacterBox, + isCharacterBox: isCharacterBox, protocolFromUrl: protocolFromUrl }); -// CONCATENATED MODULE: ./src/Settings.js +;// CONCATENATED MODULE: ./src/Settings.js /* eslint no-console:0 */ /** @@ -405,9 +239,7 @@ var protocolFromUrl = function protocolFromUrl(url) { * math (true), meaning that the math starts in \displaystyle * and is placed in a block with vertical margin. */ -var Settings_Settings = -/*#__PURE__*/ -function () { +var Settings = /*#__PURE__*/function () { function Settings(options) { this.displayMode = void 0; this.output = void 0; @@ -529,7 +361,7 @@ function () { }(); -// CONCATENATED MODULE: ./src/Style.js +;// CONCATENATED MODULE: ./src/Style.js /** * This file contains information and classes for the various kinds of styles * used in TeX. It provides a generic `Style` class, which holds information @@ -542,9 +374,7 @@ function () { * The main style class. Contains a unique id for the style, a size (which is * the same for cramped and uncramped version of a style), and a cramped flag. */ -var Style = -/*#__PURE__*/ -function () { +var Style = /*#__PURE__*/function () { function Style(id, size, cramped) { this.id = void 0; this.size = void 0; @@ -561,7 +391,7 @@ function () { var _proto = Style.prototype; _proto.sup = function sup() { - return Style_styles[_sup[this.id]]; + return styles[_sup[this.id]]; } /** * Get the style of a subscript given a base in the current style. @@ -569,7 +399,7 @@ function () { ; _proto.sub = function sub() { - return Style_styles[_sub[this.id]]; + return styles[_sub[this.id]]; } /** * Get the style of a fraction numerator given the fraction in the current @@ -578,7 +408,7 @@ function () { ; _proto.fracNum = function fracNum() { - return Style_styles[_fracNum[this.id]]; + return styles[_fracNum[this.id]]; } /** * Get the style of a fraction denominator given the fraction in the current @@ -587,7 +417,7 @@ function () { ; _proto.fracDen = function fracDen() { - return Style_styles[_fracDen[this.id]]; + return styles[_fracDen[this.id]]; } /** * Get the cramped version of a style (in particular, cramping a cramped style @@ -596,7 +426,7 @@ function () { ; _proto.cramp = function cramp() { - return Style_styles[_cramp[this.id]]; + return styles[_cramp[this.id]]; } /** * Get a text or display version of this style. @@ -604,7 +434,7 @@ function () { ; _proto.text = function text() { - return Style_styles[_text[this.id]]; + return styles[_text[this.id]]; } /** * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) @@ -630,7 +460,7 @@ var Sc = 5; var SS = 6; var SSc = 7; // Instances of the different styles -var Style_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)]; // Lookup tables for switching from one style to another +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)]; // Lookup tables for switching from one style to another var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; @@ -640,12 +470,12 @@ var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; var _text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles. /* harmony default export */ var src_Style = ({ - DISPLAY: Style_styles[D], - TEXT: Style_styles[T], - SCRIPT: Style_styles[S], - SCRIPTSCRIPT: Style_styles[SS] + DISPLAY: styles[D], + TEXT: styles[T], + SCRIPT: styles[S], + SCRIPTSCRIPT: styles[SS] }); -// CONCATENATED MODULE: ./src/unicodeScripts.js +;// CONCATENATED MODULE: ./src/unicodeScripts.js /* * This file defines the Unicode scripts and script families that we * support. To add new scripts or families, just add a new entry to the @@ -668,13 +498,18 @@ var scriptData = [{ // Needed for Czech, Hungarian and Turkish text, for example. name: 'latin', blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B - [0x0300, 0x036f]] + [0x0300, 0x036f] // Combining Diacritical marks + ] }, { // The Cyrillic script used by Russian and related languages. // A Cyrillic subset used to be supported as explicitly defined // symbols in symbols.js name: 'cyrillic', blocks: [[0x0400, 0x04ff]] +}, { + // Armenian + name: 'armenian', + blocks: [[0x0530, 0x058F]] }, { // The Brahmic scripts of South and Southeast Asia // Devanagari (0900–097F) @@ -702,7 +537,9 @@ var scriptData = [{ name: "cjk", blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana [0x4E00, 0x9FAF], // CJK ideograms - [0xFF00, 0xFF60]] + [0xFF00, 0xFF60] // Fullwidth punctuation + // TODO: add halfwidth Katakana and Romanji glyphs + ] }, { // Korean name: 'hangul', @@ -757,7 +594,7 @@ function supportedCodepoint(codepoint) { return false; } -// CONCATENATED MODULE: ./src/svgGeometry.js +;// CONCATENATED MODULE: ./src/svgGeometry.js /** * This file provides support to domTree.js and delimiter.js. * It's a storehouse of path geometry for SVG images. @@ -808,6 +645,12 @@ var sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) { return "M473," + (2713 + extraViniculum + hLinePad) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraViniculum / 5.298 + " -" + extraViniculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraViniculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "H1017.7z"; }; +var phasePath = function phasePath(y) { + var x = y / 2; // x coordinate at top of angle + + return "M400000 " + y + " H0 L" + x + " 0 l65 45 L145 " + (y - 80) + " H400000z"; +}; + var sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) { // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular // One path edge has a variable length. It runs vertically from the viniculumn @@ -849,10 +692,41 @@ var sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) { return path; }; -var svgGeometry_path = { - // Two paths that cover gaps in built-up parentheses. - leftParenInner: "M291 0 H417 V300 H291 z", - rightParenInner: "M457 0 H583 V300 H457 z", +var innerPath = function innerPath(name, height) { + // The inner part of stretchy tall delimiters + switch (name) { + case "\u239C": + return "M291 0 H417 V" + height + " H291z M291 0 H417 V" + height + " H291z"; + + case "\u2223": + return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z"; + + case "\u2225": + return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z" + ("M367 0 H410 V" + height + " H367z M367 0 H410 V" + height + " H367z"); + + case "\u239F": + return "M457 0 H583 V" + height + " H457z M457 0 H583 V" + height + " H457z"; + + case "\u23A2": + return "M319 0 H403 V" + height + " H319z M319 0 H403 V" + height + " H319z"; + + case "\u23A5": + return "M263 0 H347 V" + height + " H263z M263 0 H347 V" + height + " H263z"; + + case "\u23AA": + return "M384 0 H504 V" + height + " H384z M384 0 H504 V" + height + " H384z"; + + case "\u23D0": + return "M312 0 H355 V" + height + " H312z M312 0 H355 V" + height + " H312z"; + + case "\u2016": + return "M257 0 H300 V" + height + " H257z M257 0 H300 V" + height + " H257z" + ("M478 0 H521 V" + height + " H478z M478 0 H521 V" + height + " H478z"); + + default: + return ""; + } +}; +var path = { // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main 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", // doublerightarrow is from glyph U+21D2 in font KaTeX Main @@ -930,7 +804,7 @@ var svgGeometry_path = { shortbaraboveleftharpoon: "M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z", shortrightharpoonabovebar: "M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z" }; -// CONCATENATED MODULE: ./src/tree.js +;// CONCATENATED MODULE: ./src/tree.js /** @@ -938,9 +812,7 @@ var svgGeometry_path = { * placed into the DOM doesn't have any representation itself. It only contains * children and doesn't have any DOM node properties. */ -var tree_DocumentFragment = -/*#__PURE__*/ -function () { +var DocumentFragment = /*#__PURE__*/function () { // HtmlDomNode // Never used; needed for satisfying interface. function DocumentFragment(children) { @@ -1006,7 +878,7 @@ function () { return DocumentFragment; }(); -// CONCATENATED MODULE: ./src/domTree.js +;// CONCATENATED MODULE: ./src/domTree.js /** * These objects store the data about the DOM nodes we create, as well as some * extra data. They can then be transformed into real DOM nodes with the @@ -1142,9 +1014,7 @@ var _toMarkup = function toMarkup(tagName) { * otherwise. This typesafety is important when HTML builders access a span's * children. */ -var domTree_Span = -/*#__PURE__*/ -function () { +var Span = /*#__PURE__*/function () { function Span(classes, children, options, style) { this.children = void 0; this.attributes = void 0; @@ -1189,9 +1059,7 @@ function () { * for further details. */ -var domTree_Anchor = -/*#__PURE__*/ -function () { +var Anchor = /*#__PURE__*/function () { function Anchor(href, classes, children, options) { this.children = void 0; this.attributes = void 0; @@ -1229,9 +1097,7 @@ function () { * This node represents an image embed () element. */ -var domTree_Img = -/*#__PURE__*/ -function () { +var Img = /*#__PURE__*/function () { function Img(src, alt, style) { this.src = void 0; this.alt = void 0; @@ -1302,9 +1168,7 @@ var iCombinations = { * whether it has CSS classes, styles, or needs italic correction. */ -var domTree_SymbolNode = -/*#__PURE__*/ -function () { +var SymbolNode = /*#__PURE__*/function () { function SymbolNode(text, height, depth, italic, skew, width, classes, style) { this.text = void 0; this.height = void 0; @@ -1436,9 +1300,7 @@ function () { * SVG nodes are used to render stretchy wide elements. */ -var SvgNode = -/*#__PURE__*/ -function () { +var SvgNode = /*#__PURE__*/function () { function SvgNode(children, attributes) { this.children = void 0; this.attributes = void 0; @@ -1486,14 +1348,12 @@ function () { return SvgNode; }(); -var domTree_PathNode = -/*#__PURE__*/ -function () { +var PathNode = /*#__PURE__*/function () { function PathNode(pathName, alternate) { this.pathName = void 0; this.alternate = void 0; this.pathName = pathName; - this.alternate = alternate; // Used only for \sqrt + this.alternate = alternate; // Used only for \sqrt, \phase, & tall delims } var _proto6 = PathNode.prototype; @@ -1505,7 +1365,7 @@ function () { if (this.alternate) { node.setAttribute("d", this.alternate); } else { - node.setAttribute("d", svgGeometry_path[this.pathName]); + node.setAttribute("d", path[this.pathName]); } return node; @@ -1515,15 +1375,13 @@ function () { if (this.alternate) { return ""; } else { - return ""; + return ""; } }; return PathNode; }(); -var LineNode = -/*#__PURE__*/ -function () { +var LineNode = /*#__PURE__*/function () { function LineNode(attributes) { this.attributes = void 0; this.attributes = attributes || {}; @@ -1560,20 +1418,20 @@ function () { return LineNode; }(); function assertSymbolDomNode(group) { - if (group instanceof domTree_SymbolNode) { + if (group instanceof SymbolNode) { return group; } else { throw new Error("Expected symbolNode but got " + String(group) + "."); } } function assertSpan(group) { - if (group instanceof domTree_Span) { + if (group instanceof Span) { return group; } else { throw new Error("Expected span but got " + String(group) + "."); } } -// CONCATENATED MODULE: ./submodules/katex-fonts/fontMetricsData.js +;// CONCATENATED MODULE: ./submodules/katex-fonts/fontMetricsData.js // This file is GENERATED by buildMetrics.sh. DO NOT MODIFY. /* harmony default export */ var fontMetricsData = ({ "AMS-Regular": { @@ -3650,7 +3508,7 @@ function assertSpan(group) { "9251": [0.11111, 0.21944, 0, 0, 0.525] } }); -// CONCATENATED MODULE: ./src/fontMetrics.js +;// CONCATENATED MODULE: ./src/fontMetrics.js /** @@ -3935,7 +3793,7 @@ function getGlobalMetrics(size) { return fontMetricsBySizeIndex[sizeIndex]; } -// CONCATENATED MODULE: ./src/symbols.js +;// CONCATENATED MODULE: ./src/symbols.js /** * This file holds a list of all no-argument functions and single-character * symbols (like 'a' or ';'). @@ -3993,638 +3851,644 @@ function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { // This helps minify the code, and also spotting typos using jshint. // modes: -var symbols_math = "math"; +var math = "math"; var symbols_text = "text"; // fonts: var main = "main"; var ams = "ams"; // groups: -var symbols_accent = "accent-token"; +var accent = "accent-token"; var bin = "bin"; var symbols_close = "close"; -var symbols_inner = "inner"; +var inner = "inner"; var mathord = "mathord"; var op = "op-token"; var symbols_open = "open"; var punct = "punct"; var rel = "rel"; -var symbols_spacing = "spacing"; -var symbols_textord = "textord"; // Now comes the symbol table +var spacing = "spacing"; +var textord = "textord"; // Now comes the symbol table // Relation Symbols -defineSymbol(symbols_math, main, rel, "\u2261", "\\equiv", true); -defineSymbol(symbols_math, main, rel, "\u227A", "\\prec", true); -defineSymbol(symbols_math, main, rel, "\u227B", "\\succ", true); -defineSymbol(symbols_math, main, rel, "\u223C", "\\sim", true); -defineSymbol(symbols_math, main, rel, "\u22A5", "\\perp"); -defineSymbol(symbols_math, main, rel, "\u2AAF", "\\preceq", true); -defineSymbol(symbols_math, main, rel, "\u2AB0", "\\succeq", true); -defineSymbol(symbols_math, main, rel, "\u2243", "\\simeq", true); -defineSymbol(symbols_math, main, rel, "\u2223", "\\mid", true); -defineSymbol(symbols_math, main, rel, "\u226A", "\\ll", true); -defineSymbol(symbols_math, main, rel, "\u226B", "\\gg", true); -defineSymbol(symbols_math, main, rel, "\u224D", "\\asymp", true); -defineSymbol(symbols_math, main, rel, "\u2225", "\\parallel"); -defineSymbol(symbols_math, main, rel, "\u22C8", "\\bowtie", true); -defineSymbol(symbols_math, main, rel, "\u2323", "\\smile", true); -defineSymbol(symbols_math, main, rel, "\u2291", "\\sqsubseteq", true); -defineSymbol(symbols_math, main, rel, "\u2292", "\\sqsupseteq", true); -defineSymbol(symbols_math, main, rel, "\u2250", "\\doteq", true); -defineSymbol(symbols_math, main, rel, "\u2322", "\\frown", true); -defineSymbol(symbols_math, main, rel, "\u220B", "\\ni", true); -defineSymbol(symbols_math, main, rel, "\u221D", "\\propto", true); -defineSymbol(symbols_math, main, rel, "\u22A2", "\\vdash", true); -defineSymbol(symbols_math, main, rel, "\u22A3", "\\dashv", true); -defineSymbol(symbols_math, main, rel, "\u220B", "\\owns"); // Punctuation +defineSymbol(math, main, rel, "\u2261", "\\equiv", true); +defineSymbol(math, main, rel, "\u227A", "\\prec", true); +defineSymbol(math, main, rel, "\u227B", "\\succ", true); +defineSymbol(math, main, rel, "\u223C", "\\sim", true); +defineSymbol(math, main, rel, "\u22A5", "\\perp"); +defineSymbol(math, main, rel, "\u2AAF", "\\preceq", true); +defineSymbol(math, main, rel, "\u2AB0", "\\succeq", true); +defineSymbol(math, main, rel, "\u2243", "\\simeq", true); +defineSymbol(math, main, rel, "\u2223", "\\mid", true); +defineSymbol(math, main, rel, "\u226A", "\\ll", true); +defineSymbol(math, main, rel, "\u226B", "\\gg", true); +defineSymbol(math, main, rel, "\u224D", "\\asymp", true); +defineSymbol(math, main, rel, "\u2225", "\\parallel"); +defineSymbol(math, main, rel, "\u22C8", "\\bowtie", true); +defineSymbol(math, main, rel, "\u2323", "\\smile", true); +defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true); +defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true); +defineSymbol(math, main, rel, "\u2250", "\\doteq", true); +defineSymbol(math, main, rel, "\u2322", "\\frown", true); +defineSymbol(math, main, rel, "\u220B", "\\ni", true); +defineSymbol(math, main, rel, "\u221D", "\\propto", true); +defineSymbol(math, main, rel, "\u22A2", "\\vdash", true); +defineSymbol(math, main, rel, "\u22A3", "\\dashv", true); +defineSymbol(math, main, rel, "\u220B", "\\owns"); // Punctuation -defineSymbol(symbols_math, main, punct, ".", "\\ldotp"); -defineSymbol(symbols_math, main, punct, "\u22C5", "\\cdotp"); // Misc Symbols +defineSymbol(math, main, punct, ".", "\\ldotp"); +defineSymbol(math, main, punct, "\u22C5", "\\cdotp"); // Misc Symbols -defineSymbol(symbols_math, main, symbols_textord, "#", "\\#"); -defineSymbol(symbols_text, main, symbols_textord, "#", "\\#"); -defineSymbol(symbols_math, main, symbols_textord, "&", "\\&"); -defineSymbol(symbols_text, main, symbols_textord, "&", "\\&"); -defineSymbol(symbols_math, main, symbols_textord, "\u2135", "\\aleph", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2200", "\\forall", true); -defineSymbol(symbols_math, main, symbols_textord, "\u210F", "\\hbar", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2203", "\\exists", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2207", "\\nabla", true); -defineSymbol(symbols_math, main, symbols_textord, "\u266D", "\\flat", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2113", "\\ell", true); -defineSymbol(symbols_math, main, symbols_textord, "\u266E", "\\natural", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2663", "\\clubsuit", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2118", "\\wp", true); -defineSymbol(symbols_math, main, symbols_textord, "\u266F", "\\sharp", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2662", "\\diamondsuit", true); -defineSymbol(symbols_math, main, symbols_textord, "\u211C", "\\Re", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2661", "\\heartsuit", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2111", "\\Im", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2660", "\\spadesuit", true); -defineSymbol(symbols_text, main, symbols_textord, "\xA7", "\\S", true); -defineSymbol(symbols_text, main, symbols_textord, "\xB6", "\\P", true); // Math and Text +defineSymbol(math, main, textord, "#", "\\#"); +defineSymbol(symbols_text, main, textord, "#", "\\#"); +defineSymbol(math, main, textord, "&", "\\&"); +defineSymbol(symbols_text, main, textord, "&", "\\&"); +defineSymbol(math, main, textord, "\u2135", "\\aleph", true); +defineSymbol(math, main, textord, "\u2200", "\\forall", true); +defineSymbol(math, main, textord, "\u210F", "\\hbar", true); +defineSymbol(math, main, textord, "\u2203", "\\exists", true); +defineSymbol(math, main, textord, "\u2207", "\\nabla", true); +defineSymbol(math, main, textord, "\u266D", "\\flat", true); +defineSymbol(math, main, textord, "\u2113", "\\ell", true); +defineSymbol(math, main, textord, "\u266E", "\\natural", true); +defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true); +defineSymbol(math, main, textord, "\u2118", "\\wp", true); +defineSymbol(math, main, textord, "\u266F", "\\sharp", true); +defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true); +defineSymbol(math, main, textord, "\u211C", "\\Re", true); +defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true); +defineSymbol(math, main, textord, "\u2111", "\\Im", true); +defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true); +defineSymbol(symbols_text, main, textord, "\xA7", "\\S", true); +defineSymbol(symbols_text, main, textord, "\xB6", "\\P", true); // Math and Text -defineSymbol(symbols_math, main, symbols_textord, "\u2020", "\\dag"); -defineSymbol(symbols_text, main, symbols_textord, "\u2020", "\\dag"); -defineSymbol(symbols_text, main, symbols_textord, "\u2020", "\\textdagger"); -defineSymbol(symbols_math, main, symbols_textord, "\u2021", "\\ddag"); -defineSymbol(symbols_text, main, symbols_textord, "\u2021", "\\ddag"); -defineSymbol(symbols_text, main, symbols_textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters +defineSymbol(math, main, textord, "\u2020", "\\dag"); +defineSymbol(symbols_text, main, textord, "\u2020", "\\dag"); +defineSymbol(symbols_text, main, textord, "\u2020", "\\textdagger"); +defineSymbol(math, main, textord, "\u2021", "\\ddag"); +defineSymbol(symbols_text, main, textord, "\u2021", "\\ddag"); +defineSymbol(symbols_text, main, textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters -defineSymbol(symbols_math, main, symbols_close, "\u23B1", "\\rmoustache", true); -defineSymbol(symbols_math, main, symbols_open, "\u23B0", "\\lmoustache", true); -defineSymbol(symbols_math, main, symbols_close, "\u27EF", "\\rgroup", true); -defineSymbol(symbols_math, main, symbols_open, "\u27EE", "\\lgroup", true); // Binary Operators +defineSymbol(math, main, symbols_close, "\u23B1", "\\rmoustache", true); +defineSymbol(math, main, symbols_open, "\u23B0", "\\lmoustache", true); +defineSymbol(math, main, symbols_close, "\u27EF", "\\rgroup", true); +defineSymbol(math, main, symbols_open, "\u27EE", "\\lgroup", true); // Binary Operators -defineSymbol(symbols_math, main, bin, "\u2213", "\\mp", true); -defineSymbol(symbols_math, main, bin, "\u2296", "\\ominus", true); -defineSymbol(symbols_math, main, bin, "\u228E", "\\uplus", true); -defineSymbol(symbols_math, main, bin, "\u2293", "\\sqcap", true); -defineSymbol(symbols_math, main, bin, "\u2217", "\\ast"); -defineSymbol(symbols_math, main, bin, "\u2294", "\\sqcup", true); -defineSymbol(symbols_math, main, bin, "\u25EF", "\\bigcirc"); -defineSymbol(symbols_math, main, bin, "\u2219", "\\bullet"); -defineSymbol(symbols_math, main, bin, "\u2021", "\\ddagger"); -defineSymbol(symbols_math, main, bin, "\u2240", "\\wr", true); -defineSymbol(symbols_math, main, bin, "\u2A3F", "\\amalg"); -defineSymbol(symbols_math, main, bin, "&", "\\And"); // from amsmath +defineSymbol(math, main, bin, "\u2213", "\\mp", true); +defineSymbol(math, main, bin, "\u2296", "\\ominus", true); +defineSymbol(math, main, bin, "\u228E", "\\uplus", true); +defineSymbol(math, main, bin, "\u2293", "\\sqcap", true); +defineSymbol(math, main, bin, "\u2217", "\\ast"); +defineSymbol(math, main, bin, "\u2294", "\\sqcup", true); +defineSymbol(math, main, bin, "\u25EF", "\\bigcirc", true); +defineSymbol(math, main, bin, "\u2219", "\\bullet"); +defineSymbol(math, main, bin, "\u2021", "\\ddagger"); +defineSymbol(math, main, bin, "\u2240", "\\wr", true); +defineSymbol(math, main, bin, "\u2A3F", "\\amalg"); +defineSymbol(math, main, bin, "&", "\\And"); // from amsmath // Arrow Symbols -defineSymbol(symbols_math, main, rel, "\u27F5", "\\longleftarrow", true); -defineSymbol(symbols_math, main, rel, "\u21D0", "\\Leftarrow", true); -defineSymbol(symbols_math, main, rel, "\u27F8", "\\Longleftarrow", true); -defineSymbol(symbols_math, main, rel, "\u27F6", "\\longrightarrow", true); -defineSymbol(symbols_math, main, rel, "\u21D2", "\\Rightarrow", true); -defineSymbol(symbols_math, main, rel, "\u27F9", "\\Longrightarrow", true); -defineSymbol(symbols_math, main, rel, "\u2194", "\\leftrightarrow", true); -defineSymbol(symbols_math, main, rel, "\u27F7", "\\longleftrightarrow", true); -defineSymbol(symbols_math, main, rel, "\u21D4", "\\Leftrightarrow", true); -defineSymbol(symbols_math, main, rel, "\u27FA", "\\Longleftrightarrow", true); -defineSymbol(symbols_math, main, rel, "\u21A6", "\\mapsto", true); -defineSymbol(symbols_math, main, rel, "\u27FC", "\\longmapsto", true); -defineSymbol(symbols_math, main, rel, "\u2197", "\\nearrow", true); -defineSymbol(symbols_math, main, rel, "\u21A9", "\\hookleftarrow", true); -defineSymbol(symbols_math, main, rel, "\u21AA", "\\hookrightarrow", true); -defineSymbol(symbols_math, main, rel, "\u2198", "\\searrow", true); -defineSymbol(symbols_math, main, rel, "\u21BC", "\\leftharpoonup", true); -defineSymbol(symbols_math, main, rel, "\u21C0", "\\rightharpoonup", true); -defineSymbol(symbols_math, main, rel, "\u2199", "\\swarrow", true); -defineSymbol(symbols_math, main, rel, "\u21BD", "\\leftharpoondown", true); -defineSymbol(symbols_math, main, rel, "\u21C1", "\\rightharpoondown", true); -defineSymbol(symbols_math, main, rel, "\u2196", "\\nwarrow", true); -defineSymbol(symbols_math, main, rel, "\u21CC", "\\rightleftharpoons", true); // AMS Negated Binary Relations +defineSymbol(math, main, rel, "\u27F5", "\\longleftarrow", true); +defineSymbol(math, main, rel, "\u21D0", "\\Leftarrow", true); +defineSymbol(math, main, rel, "\u27F8", "\\Longleftarrow", true); +defineSymbol(math, main, rel, "\u27F6", "\\longrightarrow", true); +defineSymbol(math, main, rel, "\u21D2", "\\Rightarrow", true); +defineSymbol(math, main, rel, "\u27F9", "\\Longrightarrow", true); +defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true); +defineSymbol(math, main, rel, "\u27F7", "\\longleftrightarrow", true); +defineSymbol(math, main, rel, "\u21D4", "\\Leftrightarrow", true); +defineSymbol(math, main, rel, "\u27FA", "\\Longleftrightarrow", true); +defineSymbol(math, main, rel, "\u21A6", "\\mapsto", true); +defineSymbol(math, main, rel, "\u27FC", "\\longmapsto", true); +defineSymbol(math, main, rel, "\u2197", "\\nearrow", true); +defineSymbol(math, main, rel, "\u21A9", "\\hookleftarrow", true); +defineSymbol(math, main, rel, "\u21AA", "\\hookrightarrow", true); +defineSymbol(math, main, rel, "\u2198", "\\searrow", true); +defineSymbol(math, main, rel, "\u21BC", "\\leftharpoonup", true); +defineSymbol(math, main, rel, "\u21C0", "\\rightharpoonup", true); +defineSymbol(math, main, rel, "\u2199", "\\swarrow", true); +defineSymbol(math, main, rel, "\u21BD", "\\leftharpoondown", true); +defineSymbol(math, main, rel, "\u21C1", "\\rightharpoondown", true); +defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true); +defineSymbol(math, main, rel, "\u21CC", "\\rightleftharpoons", true); // AMS Negated Binary Relations -defineSymbol(symbols_math, ams, rel, "\u226E", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro. +defineSymbol(math, ams, rel, "\u226E", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro. -defineSymbol(symbols_math, ams, rel, "\uE010", "\\@nleqslant"); -defineSymbol(symbols_math, ams, rel, "\uE011", "\\@nleqq"); -defineSymbol(symbols_math, ams, rel, "\u2A87", "\\lneq", true); -defineSymbol(symbols_math, ams, rel, "\u2268", "\\lneqq", true); -defineSymbol(symbols_math, ams, rel, "\uE00C", "\\@lvertneqq"); -defineSymbol(symbols_math, ams, rel, "\u22E6", "\\lnsim", true); -defineSymbol(symbols_math, ams, rel, "\u2A89", "\\lnapprox", true); -defineSymbol(symbols_math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\uE010", "\\@nleqslant"); +defineSymbol(math, ams, rel, "\uE011", "\\@nleqq"); +defineSymbol(math, ams, rel, "\u2A87", "\\lneq", true); +defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true); +defineSymbol(math, ams, rel, "\uE00C", "\\@lvertneqq"); +defineSymbol(math, ams, rel, "\u22E6", "\\lnsim", true); +defineSymbol(math, ams, rel, "\u2A89", "\\lnapprox", true); +defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym. -defineSymbol(symbols_math, ams, rel, "\u22E0", "\\npreceq", true); -defineSymbol(symbols_math, ams, rel, "\u22E8", "\\precnsim", true); -defineSymbol(symbols_math, ams, rel, "\u2AB9", "\\precnapprox", true); -defineSymbol(symbols_math, ams, rel, "\u2241", "\\nsim", true); -defineSymbol(symbols_math, ams, rel, "\uE006", "\\@nshortmid"); -defineSymbol(symbols_math, ams, rel, "\u2224", "\\nmid", true); -defineSymbol(symbols_math, ams, rel, "\u22AC", "\\nvdash", true); -defineSymbol(symbols_math, ams, rel, "\u22AD", "\\nvDash", true); -defineSymbol(symbols_math, ams, rel, "\u22EA", "\\ntriangleleft"); -defineSymbol(symbols_math, ams, rel, "\u22EC", "\\ntrianglelefteq", true); -defineSymbol(symbols_math, ams, rel, "\u228A", "\\subsetneq", true); -defineSymbol(symbols_math, ams, rel, "\uE01A", "\\@varsubsetneq"); -defineSymbol(symbols_math, ams, rel, "\u2ACB", "\\subsetneqq", true); -defineSymbol(symbols_math, ams, rel, "\uE017", "\\@varsubsetneqq"); -defineSymbol(symbols_math, ams, rel, "\u226F", "\\ngtr", true); -defineSymbol(symbols_math, ams, rel, "\uE00F", "\\@ngeqslant"); -defineSymbol(symbols_math, ams, rel, "\uE00E", "\\@ngeqq"); -defineSymbol(symbols_math, ams, rel, "\u2A88", "\\gneq", true); -defineSymbol(symbols_math, ams, rel, "\u2269", "\\gneqq", true); -defineSymbol(symbols_math, ams, rel, "\uE00D", "\\@gvertneqq"); -defineSymbol(symbols_math, ams, rel, "\u22E7", "\\gnsim", true); -defineSymbol(symbols_math, ams, rel, "\u2A8A", "\\gnapprox", true); -defineSymbol(symbols_math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u22E0", "\\npreceq", true); +defineSymbol(math, ams, rel, "\u22E8", "\\precnsim", true); +defineSymbol(math, ams, rel, "\u2AB9", "\\precnapprox", true); +defineSymbol(math, ams, rel, "\u2241", "\\nsim", true); +defineSymbol(math, ams, rel, "\uE006", "\\@nshortmid"); +defineSymbol(math, ams, rel, "\u2224", "\\nmid", true); +defineSymbol(math, ams, rel, "\u22AC", "\\nvdash", true); +defineSymbol(math, ams, rel, "\u22AD", "\\nvDash", true); +defineSymbol(math, ams, rel, "\u22EA", "\\ntriangleleft"); +defineSymbol(math, ams, rel, "\u22EC", "\\ntrianglelefteq", true); +defineSymbol(math, ams, rel, "\u228A", "\\subsetneq", true); +defineSymbol(math, ams, rel, "\uE01A", "\\@varsubsetneq"); +defineSymbol(math, ams, rel, "\u2ACB", "\\subsetneqq", true); +defineSymbol(math, ams, rel, "\uE017", "\\@varsubsetneqq"); +defineSymbol(math, ams, rel, "\u226F", "\\ngtr", true); +defineSymbol(math, ams, rel, "\uE00F", "\\@ngeqslant"); +defineSymbol(math, ams, rel, "\uE00E", "\\@ngeqq"); +defineSymbol(math, ams, rel, "\u2A88", "\\gneq", true); +defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true); +defineSymbol(math, ams, rel, "\uE00D", "\\@gvertneqq"); +defineSymbol(math, ams, rel, "\u22E7", "\\gnsim", true); +defineSymbol(math, ams, rel, "\u2A8A", "\\gnapprox", true); +defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym. -defineSymbol(symbols_math, ams, rel, "\u22E1", "\\nsucceq", true); -defineSymbol(symbols_math, ams, rel, "\u22E9", "\\succnsim", true); -defineSymbol(symbols_math, ams, rel, "\u2ABA", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u22E1", "\\nsucceq", true); +defineSymbol(math, ams, rel, "\u22E9", "\\succnsim", true); +defineSymbol(math, ams, rel, "\u2ABA", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym. -defineSymbol(symbols_math, ams, rel, "\u2246", "\\ncong", true); -defineSymbol(symbols_math, ams, rel, "\uE007", "\\@nshortparallel"); -defineSymbol(symbols_math, ams, rel, "\u2226", "\\nparallel", true); -defineSymbol(symbols_math, ams, rel, "\u22AF", "\\nVDash", true); -defineSymbol(symbols_math, ams, rel, "\u22EB", "\\ntriangleright"); -defineSymbol(symbols_math, ams, rel, "\u22ED", "\\ntrianglerighteq", true); -defineSymbol(symbols_math, ams, rel, "\uE018", "\\@nsupseteqq"); -defineSymbol(symbols_math, ams, rel, "\u228B", "\\supsetneq", true); -defineSymbol(symbols_math, ams, rel, "\uE01B", "\\@varsupsetneq"); -defineSymbol(symbols_math, ams, rel, "\u2ACC", "\\supsetneqq", true); -defineSymbol(symbols_math, ams, rel, "\uE019", "\\@varsupsetneqq"); -defineSymbol(symbols_math, ams, rel, "\u22AE", "\\nVdash", true); -defineSymbol(symbols_math, ams, rel, "\u2AB5", "\\precneqq", true); -defineSymbol(symbols_math, ams, rel, "\u2AB6", "\\succneqq", true); -defineSymbol(symbols_math, ams, rel, "\uE016", "\\@nsubseteqq"); -defineSymbol(symbols_math, ams, bin, "\u22B4", "\\unlhd"); -defineSymbol(symbols_math, ams, bin, "\u22B5", "\\unrhd"); // AMS Negated Arrows +defineSymbol(math, ams, rel, "\u2246", "\\ncong", true); +defineSymbol(math, ams, rel, "\uE007", "\\@nshortparallel"); +defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true); +defineSymbol(math, ams, rel, "\u22AF", "\\nVDash", true); +defineSymbol(math, ams, rel, "\u22EB", "\\ntriangleright"); +defineSymbol(math, ams, rel, "\u22ED", "\\ntrianglerighteq", true); +defineSymbol(math, ams, rel, "\uE018", "\\@nsupseteqq"); +defineSymbol(math, ams, rel, "\u228B", "\\supsetneq", true); +defineSymbol(math, ams, rel, "\uE01B", "\\@varsupsetneq"); +defineSymbol(math, ams, rel, "\u2ACC", "\\supsetneqq", true); +defineSymbol(math, ams, rel, "\uE019", "\\@varsupsetneqq"); +defineSymbol(math, ams, rel, "\u22AE", "\\nVdash", true); +defineSymbol(math, ams, rel, "\u2AB5", "\\precneqq", true); +defineSymbol(math, ams, rel, "\u2AB6", "\\succneqq", true); +defineSymbol(math, ams, rel, "\uE016", "\\@nsubseteqq"); +defineSymbol(math, ams, bin, "\u22B4", "\\unlhd"); +defineSymbol(math, ams, bin, "\u22B5", "\\unrhd"); // AMS Negated Arrows -defineSymbol(symbols_math, ams, rel, "\u219A", "\\nleftarrow", true); -defineSymbol(symbols_math, ams, rel, "\u219B", "\\nrightarrow", true); -defineSymbol(symbols_math, ams, rel, "\u21CD", "\\nLeftarrow", true); -defineSymbol(symbols_math, ams, rel, "\u21CF", "\\nRightarrow", true); -defineSymbol(symbols_math, ams, rel, "\u21AE", "\\nleftrightarrow", true); -defineSymbol(symbols_math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); // AMS Misc +defineSymbol(math, ams, rel, "\u219A", "\\nleftarrow", true); +defineSymbol(math, ams, rel, "\u219B", "\\nrightarrow", true); +defineSymbol(math, ams, rel, "\u21CD", "\\nLeftarrow", true); +defineSymbol(math, ams, rel, "\u21CF", "\\nRightarrow", true); +defineSymbol(math, ams, rel, "\u21AE", "\\nleftrightarrow", true); +defineSymbol(math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); // AMS Misc -defineSymbol(symbols_math, ams, rel, "\u25B3", "\\vartriangle"); -defineSymbol(symbols_math, ams, symbols_textord, "\u210F", "\\hslash"); -defineSymbol(symbols_math, ams, symbols_textord, "\u25BD", "\\triangledown"); -defineSymbol(symbols_math, ams, symbols_textord, "\u25CA", "\\lozenge"); -defineSymbol(symbols_math, ams, symbols_textord, "\u24C8", "\\circledS"); -defineSymbol(symbols_math, ams, symbols_textord, "\xAE", "\\circledR"); -defineSymbol(symbols_text, ams, symbols_textord, "\xAE", "\\circledR"); -defineSymbol(symbols_math, ams, symbols_textord, "\u2221", "\\measuredangle", true); -defineSymbol(symbols_math, ams, symbols_textord, "\u2204", "\\nexists"); -defineSymbol(symbols_math, ams, symbols_textord, "\u2127", "\\mho"); -defineSymbol(symbols_math, ams, symbols_textord, "\u2132", "\\Finv", true); -defineSymbol(symbols_math, ams, symbols_textord, "\u2141", "\\Game", true); -defineSymbol(symbols_math, ams, symbols_textord, "\u2035", "\\backprime"); -defineSymbol(symbols_math, ams, symbols_textord, "\u25B2", "\\blacktriangle"); -defineSymbol(symbols_math, ams, symbols_textord, "\u25BC", "\\blacktriangledown"); -defineSymbol(symbols_math, ams, symbols_textord, "\u25A0", "\\blacksquare"); -defineSymbol(symbols_math, ams, symbols_textord, "\u29EB", "\\blacklozenge"); -defineSymbol(symbols_math, ams, symbols_textord, "\u2605", "\\bigstar"); -defineSymbol(symbols_math, ams, symbols_textord, "\u2222", "\\sphericalangle", true); -defineSymbol(symbols_math, ams, symbols_textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 to \matheth. We map to AMS function \eth +defineSymbol(math, ams, rel, "\u25B3", "\\vartriangle"); +defineSymbol(math, ams, textord, "\u210F", "\\hslash"); +defineSymbol(math, ams, textord, "\u25BD", "\\triangledown"); +defineSymbol(math, ams, textord, "\u25CA", "\\lozenge"); +defineSymbol(math, ams, textord, "\u24C8", "\\circledS"); +defineSymbol(math, ams, textord, "\xAE", "\\circledR"); +defineSymbol(symbols_text, ams, textord, "\xAE", "\\circledR"); +defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true); +defineSymbol(math, ams, textord, "\u2204", "\\nexists"); +defineSymbol(math, ams, textord, "\u2127", "\\mho"); +defineSymbol(math, ams, textord, "\u2132", "\\Finv", true); +defineSymbol(math, ams, textord, "\u2141", "\\Game", true); +defineSymbol(math, ams, textord, "\u2035", "\\backprime"); +defineSymbol(math, ams, textord, "\u25B2", "\\blacktriangle"); +defineSymbol(math, ams, textord, "\u25BC", "\\blacktriangledown"); +defineSymbol(math, ams, textord, "\u25A0", "\\blacksquare"); +defineSymbol(math, ams, textord, "\u29EB", "\\blacklozenge"); +defineSymbol(math, ams, textord, "\u2605", "\\bigstar"); +defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true); +defineSymbol(math, ams, textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 to \matheth. We map to AMS function \eth -defineSymbol(symbols_math, ams, symbols_textord, "\xF0", "\\eth", true); -defineSymbol(symbols_text, main, symbols_textord, "\xF0", "\xF0"); -defineSymbol(symbols_math, ams, symbols_textord, "\u2571", "\\diagup"); -defineSymbol(symbols_math, ams, symbols_textord, "\u2572", "\\diagdown"); -defineSymbol(symbols_math, ams, symbols_textord, "\u25A1", "\\square"); -defineSymbol(symbols_math, ams, symbols_textord, "\u25A1", "\\Box"); -defineSymbol(symbols_math, ams, symbols_textord, "\u25CA", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen +defineSymbol(math, ams, textord, "\xF0", "\\eth", true); +defineSymbol(symbols_text, main, textord, "\xF0", "\xF0"); +defineSymbol(math, ams, textord, "\u2571", "\\diagup"); +defineSymbol(math, ams, textord, "\u2572", "\\diagdown"); +defineSymbol(math, ams, textord, "\u25A1", "\\square"); +defineSymbol(math, ams, textord, "\u25A1", "\\Box"); +defineSymbol(math, ams, textord, "\u25CA", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen -defineSymbol(symbols_math, ams, symbols_textord, "\xA5", "\\yen", true); -defineSymbol(symbols_text, ams, symbols_textord, "\xA5", "\\yen", true); -defineSymbol(symbols_math, ams, symbols_textord, "\u2713", "\\checkmark", true); -defineSymbol(symbols_text, ams, symbols_textord, "\u2713", "\\checkmark"); // AMS Hebrew +defineSymbol(math, ams, textord, "\xA5", "\\yen", true); +defineSymbol(symbols_text, ams, textord, "\xA5", "\\yen", true); +defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true); +defineSymbol(symbols_text, ams, textord, "\u2713", "\\checkmark"); // AMS Hebrew -defineSymbol(symbols_math, ams, symbols_textord, "\u2136", "\\beth", true); -defineSymbol(symbols_math, ams, symbols_textord, "\u2138", "\\daleth", true); -defineSymbol(symbols_math, ams, symbols_textord, "\u2137", "\\gimel", true); // AMS Greek +defineSymbol(math, ams, textord, "\u2136", "\\beth", true); +defineSymbol(math, ams, textord, "\u2138", "\\daleth", true); +defineSymbol(math, ams, textord, "\u2137", "\\gimel", true); // AMS Greek -defineSymbol(symbols_math, ams, symbols_textord, "\u03DD", "\\digamma", true); -defineSymbol(symbols_math, ams, symbols_textord, "\u03F0", "\\varkappa"); // AMS Delimiters +defineSymbol(math, ams, textord, "\u03DD", "\\digamma", true); +defineSymbol(math, ams, textord, "\u03F0", "\\varkappa"); // AMS Delimiters -defineSymbol(symbols_math, ams, symbols_open, "\u250C", "\\@ulcorner", true); -defineSymbol(symbols_math, ams, symbols_close, "\u2510", "\\@urcorner", true); -defineSymbol(symbols_math, ams, symbols_open, "\u2514", "\\@llcorner", true); -defineSymbol(symbols_math, ams, symbols_close, "\u2518", "\\@lrcorner", true); // AMS Binary Relations +defineSymbol(math, ams, symbols_open, "\u250C", "\\@ulcorner", true); +defineSymbol(math, ams, symbols_close, "\u2510", "\\@urcorner", true); +defineSymbol(math, ams, symbols_open, "\u2514", "\\@llcorner", true); +defineSymbol(math, ams, symbols_close, "\u2518", "\\@lrcorner", true); // AMS Binary Relations -defineSymbol(symbols_math, ams, rel, "\u2266", "\\leqq", true); -defineSymbol(symbols_math, ams, rel, "\u2A7D", "\\leqslant", true); -defineSymbol(symbols_math, ams, rel, "\u2A95", "\\eqslantless", true); -defineSymbol(symbols_math, ams, rel, "\u2272", "\\lesssim", true); -defineSymbol(symbols_math, ams, rel, "\u2A85", "\\lessapprox", true); -defineSymbol(symbols_math, ams, rel, "\u224A", "\\approxeq", true); -defineSymbol(symbols_math, ams, bin, "\u22D6", "\\lessdot"); -defineSymbol(symbols_math, ams, rel, "\u22D8", "\\lll", true); -defineSymbol(symbols_math, ams, rel, "\u2276", "\\lessgtr", true); -defineSymbol(symbols_math, ams, rel, "\u22DA", "\\lesseqgtr", true); -defineSymbol(symbols_math, ams, rel, "\u2A8B", "\\lesseqqgtr", true); -defineSymbol(symbols_math, ams, rel, "\u2251", "\\doteqdot"); -defineSymbol(symbols_math, ams, rel, "\u2253", "\\risingdotseq", true); -defineSymbol(symbols_math, ams, rel, "\u2252", "\\fallingdotseq", true); -defineSymbol(symbols_math, ams, rel, "\u223D", "\\backsim", true); -defineSymbol(symbols_math, ams, rel, "\u22CD", "\\backsimeq", true); -defineSymbol(symbols_math, ams, rel, "\u2AC5", "\\subseteqq", true); -defineSymbol(symbols_math, ams, rel, "\u22D0", "\\Subset", true); -defineSymbol(symbols_math, ams, rel, "\u228F", "\\sqsubset", true); -defineSymbol(symbols_math, ams, rel, "\u227C", "\\preccurlyeq", true); -defineSymbol(symbols_math, ams, rel, "\u22DE", "\\curlyeqprec", true); -defineSymbol(symbols_math, ams, rel, "\u227E", "\\precsim", true); -defineSymbol(symbols_math, ams, rel, "\u2AB7", "\\precapprox", true); -defineSymbol(symbols_math, ams, rel, "\u22B2", "\\vartriangleleft"); -defineSymbol(symbols_math, ams, rel, "\u22B4", "\\trianglelefteq"); -defineSymbol(symbols_math, ams, rel, "\u22A8", "\\vDash", true); -defineSymbol(symbols_math, ams, rel, "\u22AA", "\\Vvdash", true); -defineSymbol(symbols_math, ams, rel, "\u2323", "\\smallsmile"); -defineSymbol(symbols_math, ams, rel, "\u2322", "\\smallfrown"); -defineSymbol(symbols_math, ams, rel, "\u224F", "\\bumpeq", true); -defineSymbol(symbols_math, ams, rel, "\u224E", "\\Bumpeq", true); -defineSymbol(symbols_math, ams, rel, "\u2267", "\\geqq", true); -defineSymbol(symbols_math, ams, rel, "\u2A7E", "\\geqslant", true); -defineSymbol(symbols_math, ams, rel, "\u2A96", "\\eqslantgtr", true); -defineSymbol(symbols_math, ams, rel, "\u2273", "\\gtrsim", true); -defineSymbol(symbols_math, ams, rel, "\u2A86", "\\gtrapprox", true); -defineSymbol(symbols_math, ams, bin, "\u22D7", "\\gtrdot"); -defineSymbol(symbols_math, ams, rel, "\u22D9", "\\ggg", true); -defineSymbol(symbols_math, ams, rel, "\u2277", "\\gtrless", true); -defineSymbol(symbols_math, ams, rel, "\u22DB", "\\gtreqless", true); -defineSymbol(symbols_math, ams, rel, "\u2A8C", "\\gtreqqless", true); -defineSymbol(symbols_math, ams, rel, "\u2256", "\\eqcirc", true); -defineSymbol(symbols_math, ams, rel, "\u2257", "\\circeq", true); -defineSymbol(symbols_math, ams, rel, "\u225C", "\\triangleq", true); -defineSymbol(symbols_math, ams, rel, "\u223C", "\\thicksim"); -defineSymbol(symbols_math, ams, rel, "\u2248", "\\thickapprox"); -defineSymbol(symbols_math, ams, rel, "\u2AC6", "\\supseteqq", true); -defineSymbol(symbols_math, ams, rel, "\u22D1", "\\Supset", true); -defineSymbol(symbols_math, ams, rel, "\u2290", "\\sqsupset", true); -defineSymbol(symbols_math, ams, rel, "\u227D", "\\succcurlyeq", true); -defineSymbol(symbols_math, ams, rel, "\u22DF", "\\curlyeqsucc", true); -defineSymbol(symbols_math, ams, rel, "\u227F", "\\succsim", true); -defineSymbol(symbols_math, ams, rel, "\u2AB8", "\\succapprox", true); -defineSymbol(symbols_math, ams, rel, "\u22B3", "\\vartriangleright"); -defineSymbol(symbols_math, ams, rel, "\u22B5", "\\trianglerighteq"); -defineSymbol(symbols_math, ams, rel, "\u22A9", "\\Vdash", true); -defineSymbol(symbols_math, ams, rel, "\u2223", "\\shortmid"); -defineSymbol(symbols_math, ams, rel, "\u2225", "\\shortparallel"); -defineSymbol(symbols_math, ams, rel, "\u226C", "\\between", true); -defineSymbol(symbols_math, ams, rel, "\u22D4", "\\pitchfork", true); -defineSymbol(symbols_math, ams, rel, "\u221D", "\\varpropto"); -defineSymbol(symbols_math, ams, rel, "\u25C0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom. +defineSymbol(math, ams, rel, "\u2266", "\\leqq", true); +defineSymbol(math, ams, rel, "\u2A7D", "\\leqslant", true); +defineSymbol(math, ams, rel, "\u2A95", "\\eqslantless", true); +defineSymbol(math, ams, rel, "\u2272", "\\lesssim", true); +defineSymbol(math, ams, rel, "\u2A85", "\\lessapprox", true); +defineSymbol(math, ams, rel, "\u224A", "\\approxeq", true); +defineSymbol(math, ams, bin, "\u22D6", "\\lessdot"); +defineSymbol(math, ams, rel, "\u22D8", "\\lll", true); +defineSymbol(math, ams, rel, "\u2276", "\\lessgtr", true); +defineSymbol(math, ams, rel, "\u22DA", "\\lesseqgtr", true); +defineSymbol(math, ams, rel, "\u2A8B", "\\lesseqqgtr", true); +defineSymbol(math, ams, rel, "\u2251", "\\doteqdot"); +defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true); +defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true); +defineSymbol(math, ams, rel, "\u223D", "\\backsim", true); +defineSymbol(math, ams, rel, "\u22CD", "\\backsimeq", true); +defineSymbol(math, ams, rel, "\u2AC5", "\\subseteqq", true); +defineSymbol(math, ams, rel, "\u22D0", "\\Subset", true); +defineSymbol(math, ams, rel, "\u228F", "\\sqsubset", true); +defineSymbol(math, ams, rel, "\u227C", "\\preccurlyeq", true); +defineSymbol(math, ams, rel, "\u22DE", "\\curlyeqprec", true); +defineSymbol(math, ams, rel, "\u227E", "\\precsim", true); +defineSymbol(math, ams, rel, "\u2AB7", "\\precapprox", true); +defineSymbol(math, ams, rel, "\u22B2", "\\vartriangleleft"); +defineSymbol(math, ams, rel, "\u22B4", "\\trianglelefteq"); +defineSymbol(math, ams, rel, "\u22A8", "\\vDash", true); +defineSymbol(math, ams, rel, "\u22AA", "\\Vvdash", true); +defineSymbol(math, ams, rel, "\u2323", "\\smallsmile"); +defineSymbol(math, ams, rel, "\u2322", "\\smallfrown"); +defineSymbol(math, ams, rel, "\u224F", "\\bumpeq", true); +defineSymbol(math, ams, rel, "\u224E", "\\Bumpeq", true); +defineSymbol(math, ams, rel, "\u2267", "\\geqq", true); +defineSymbol(math, ams, rel, "\u2A7E", "\\geqslant", true); +defineSymbol(math, ams, rel, "\u2A96", "\\eqslantgtr", true); +defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true); +defineSymbol(math, ams, rel, "\u2A86", "\\gtrapprox", true); +defineSymbol(math, ams, bin, "\u22D7", "\\gtrdot"); +defineSymbol(math, ams, rel, "\u22D9", "\\ggg", true); +defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true); +defineSymbol(math, ams, rel, "\u22DB", "\\gtreqless", true); +defineSymbol(math, ams, rel, "\u2A8C", "\\gtreqqless", true); +defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true); +defineSymbol(math, ams, rel, "\u2257", "\\circeq", true); +defineSymbol(math, ams, rel, "\u225C", "\\triangleq", true); +defineSymbol(math, ams, rel, "\u223C", "\\thicksim"); +defineSymbol(math, ams, rel, "\u2248", "\\thickapprox"); +defineSymbol(math, ams, rel, "\u2AC6", "\\supseteqq", true); +defineSymbol(math, ams, rel, "\u22D1", "\\Supset", true); +defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true); +defineSymbol(math, ams, rel, "\u227D", "\\succcurlyeq", true); +defineSymbol(math, ams, rel, "\u22DF", "\\curlyeqsucc", true); +defineSymbol(math, ams, rel, "\u227F", "\\succsim", true); +defineSymbol(math, ams, rel, "\u2AB8", "\\succapprox", true); +defineSymbol(math, ams, rel, "\u22B3", "\\vartriangleright"); +defineSymbol(math, ams, rel, "\u22B5", "\\trianglerighteq"); +defineSymbol(math, ams, rel, "\u22A9", "\\Vdash", true); +defineSymbol(math, ams, rel, "\u2223", "\\shortmid"); +defineSymbol(math, ams, rel, "\u2225", "\\shortparallel"); +defineSymbol(math, ams, rel, "\u226C", "\\between", true); +defineSymbol(math, ams, rel, "\u22D4", "\\pitchfork", true); +defineSymbol(math, ams, rel, "\u221D", "\\varpropto"); +defineSymbol(math, ams, rel, "\u25C0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom. // We kept the amssymb atom type, which is rel. -defineSymbol(symbols_math, ams, rel, "\u2234", "\\therefore", true); -defineSymbol(symbols_math, ams, rel, "\u220D", "\\backepsilon"); -defineSymbol(symbols_math, ams, rel, "\u25B6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom. +defineSymbol(math, ams, rel, "\u2234", "\\therefore", true); +defineSymbol(math, ams, rel, "\u220D", "\\backepsilon"); +defineSymbol(math, ams, rel, "\u25B6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom. // We kept the amssymb atom type, which is rel. -defineSymbol(symbols_math, ams, rel, "\u2235", "\\because", true); -defineSymbol(symbols_math, ams, rel, "\u22D8", "\\llless"); -defineSymbol(symbols_math, ams, rel, "\u22D9", "\\gggtr"); -defineSymbol(symbols_math, ams, bin, "\u22B2", "\\lhd"); -defineSymbol(symbols_math, ams, bin, "\u22B3", "\\rhd"); -defineSymbol(symbols_math, ams, rel, "\u2242", "\\eqsim", true); -defineSymbol(symbols_math, main, rel, "\u22C8", "\\Join"); -defineSymbol(symbols_math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators +defineSymbol(math, ams, rel, "\u2235", "\\because", true); +defineSymbol(math, ams, rel, "\u22D8", "\\llless"); +defineSymbol(math, ams, rel, "\u22D9", "\\gggtr"); +defineSymbol(math, ams, bin, "\u22B2", "\\lhd"); +defineSymbol(math, ams, bin, "\u22B3", "\\rhd"); +defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true); +defineSymbol(math, main, rel, "\u22C8", "\\Join"); +defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators -defineSymbol(symbols_math, ams, bin, "\u2214", "\\dotplus", true); -defineSymbol(symbols_math, ams, bin, "\u2216", "\\smallsetminus"); -defineSymbol(symbols_math, ams, bin, "\u22D2", "\\Cap", true); -defineSymbol(symbols_math, ams, bin, "\u22D3", "\\Cup", true); -defineSymbol(symbols_math, ams, bin, "\u2A5E", "\\doublebarwedge", true); -defineSymbol(symbols_math, ams, bin, "\u229F", "\\boxminus", true); -defineSymbol(symbols_math, ams, bin, "\u229E", "\\boxplus", true); -defineSymbol(symbols_math, ams, bin, "\u22C7", "\\divideontimes", true); -defineSymbol(symbols_math, ams, bin, "\u22C9", "\\ltimes", true); -defineSymbol(symbols_math, ams, bin, "\u22CA", "\\rtimes", true); -defineSymbol(symbols_math, ams, bin, "\u22CB", "\\leftthreetimes", true); -defineSymbol(symbols_math, ams, bin, "\u22CC", "\\rightthreetimes", true); -defineSymbol(symbols_math, ams, bin, "\u22CF", "\\curlywedge", true); -defineSymbol(symbols_math, ams, bin, "\u22CE", "\\curlyvee", true); -defineSymbol(symbols_math, ams, bin, "\u229D", "\\circleddash", true); -defineSymbol(symbols_math, ams, bin, "\u229B", "\\circledast", true); -defineSymbol(symbols_math, ams, bin, "\u22C5", "\\centerdot"); -defineSymbol(symbols_math, ams, bin, "\u22BA", "\\intercal", true); -defineSymbol(symbols_math, ams, bin, "\u22D2", "\\doublecap"); -defineSymbol(symbols_math, ams, bin, "\u22D3", "\\doublecup"); -defineSymbol(symbols_math, ams, bin, "\u22A0", "\\boxtimes", true); // AMS Arrows +defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true); +defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus"); +defineSymbol(math, ams, bin, "\u22D2", "\\Cap", true); +defineSymbol(math, ams, bin, "\u22D3", "\\Cup", true); +defineSymbol(math, ams, bin, "\u2A5E", "\\doublebarwedge", true); +defineSymbol(math, ams, bin, "\u229F", "\\boxminus", true); +defineSymbol(math, ams, bin, "\u229E", "\\boxplus", true); +defineSymbol(math, ams, bin, "\u22C7", "\\divideontimes", true); +defineSymbol(math, ams, bin, "\u22C9", "\\ltimes", true); +defineSymbol(math, ams, bin, "\u22CA", "\\rtimes", true); +defineSymbol(math, ams, bin, "\u22CB", "\\leftthreetimes", true); +defineSymbol(math, ams, bin, "\u22CC", "\\rightthreetimes", true); +defineSymbol(math, ams, bin, "\u22CF", "\\curlywedge", true); +defineSymbol(math, ams, bin, "\u22CE", "\\curlyvee", true); +defineSymbol(math, ams, bin, "\u229D", "\\circleddash", true); +defineSymbol(math, ams, bin, "\u229B", "\\circledast", true); +defineSymbol(math, ams, bin, "\u22C5", "\\centerdot"); +defineSymbol(math, ams, bin, "\u22BA", "\\intercal", true); +defineSymbol(math, ams, bin, "\u22D2", "\\doublecap"); +defineSymbol(math, ams, bin, "\u22D3", "\\doublecup"); +defineSymbol(math, ams, bin, "\u22A0", "\\boxtimes", true); // AMS Arrows // Note: unicode-math maps \u21e2 to their own function \rightdasharrow. // We'll map it to AMS function \dashrightarrow. It produces the same atom. -defineSymbol(symbols_math, ams, rel, "\u21E2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u21E2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym. -defineSymbol(symbols_math, ams, rel, "\u21E0", "\\dashleftarrow", true); -defineSymbol(symbols_math, ams, rel, "\u21C7", "\\leftleftarrows", true); -defineSymbol(symbols_math, ams, rel, "\u21C6", "\\leftrightarrows", true); -defineSymbol(symbols_math, ams, rel, "\u21DA", "\\Lleftarrow", true); -defineSymbol(symbols_math, ams, rel, "\u219E", "\\twoheadleftarrow", true); -defineSymbol(symbols_math, ams, rel, "\u21A2", "\\leftarrowtail", true); -defineSymbol(symbols_math, ams, rel, "\u21AB", "\\looparrowleft", true); -defineSymbol(symbols_math, ams, rel, "\u21CB", "\\leftrightharpoons", true); -defineSymbol(symbols_math, ams, rel, "\u21B6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u21E0", "\\dashleftarrow", true); +defineSymbol(math, ams, rel, "\u21C7", "\\leftleftarrows", true); +defineSymbol(math, ams, rel, "\u21C6", "\\leftrightarrows", true); +defineSymbol(math, ams, rel, "\u21DA", "\\Lleftarrow", true); +defineSymbol(math, ams, rel, "\u219E", "\\twoheadleftarrow", true); +defineSymbol(math, ams, rel, "\u21A2", "\\leftarrowtail", true); +defineSymbol(math, ams, rel, "\u21AB", "\\looparrowleft", true); +defineSymbol(math, ams, rel, "\u21CB", "\\leftrightharpoons", true); +defineSymbol(math, ams, rel, "\u21B6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym. -defineSymbol(symbols_math, ams, rel, "\u21BA", "\\circlearrowleft", true); -defineSymbol(symbols_math, ams, rel, "\u21B0", "\\Lsh", true); -defineSymbol(symbols_math, ams, rel, "\u21C8", "\\upuparrows", true); -defineSymbol(symbols_math, ams, rel, "\u21BF", "\\upharpoonleft", true); -defineSymbol(symbols_math, ams, rel, "\u21C3", "\\downharpoonleft", true); -defineSymbol(symbols_math, ams, rel, "\u22B8", "\\multimap", true); -defineSymbol(symbols_math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true); -defineSymbol(symbols_math, ams, rel, "\u21C9", "\\rightrightarrows", true); -defineSymbol(symbols_math, ams, rel, "\u21C4", "\\rightleftarrows", true); -defineSymbol(symbols_math, ams, rel, "\u21A0", "\\twoheadrightarrow", true); -defineSymbol(symbols_math, ams, rel, "\u21A3", "\\rightarrowtail", true); -defineSymbol(symbols_math, ams, rel, "\u21AC", "\\looparrowright", true); -defineSymbol(symbols_math, ams, rel, "\u21B7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u21BA", "\\circlearrowleft", true); +defineSymbol(math, ams, rel, "\u21B0", "\\Lsh", true); +defineSymbol(math, ams, rel, "\u21C8", "\\upuparrows", true); +defineSymbol(math, ams, rel, "\u21BF", "\\upharpoonleft", true); +defineSymbol(math, ams, rel, "\u21C3", "\\downharpoonleft", true); +defineSymbol(math, main, rel, "\u22B6", "\\origof", true); // not in font -defineSymbol(symbols_math, ams, rel, "\u21BB", "\\circlearrowright", true); -defineSymbol(symbols_math, ams, rel, "\u21B1", "\\Rsh", true); -defineSymbol(symbols_math, ams, rel, "\u21CA", "\\downdownarrows", true); -defineSymbol(symbols_math, ams, rel, "\u21BE", "\\upharpoonright", true); -defineSymbol(symbols_math, ams, rel, "\u21C2", "\\downharpoonright", true); -defineSymbol(symbols_math, ams, rel, "\u21DD", "\\rightsquigarrow", true); -defineSymbol(symbols_math, ams, rel, "\u21DD", "\\leadsto"); -defineSymbol(symbols_math, ams, rel, "\u21DB", "\\Rrightarrow", true); -defineSymbol(symbols_math, ams, rel, "\u21BE", "\\restriction"); -defineSymbol(symbols_math, main, symbols_textord, "\u2018", "`"); -defineSymbol(symbols_math, main, symbols_textord, "$", "\\$"); -defineSymbol(symbols_text, main, symbols_textord, "$", "\\$"); -defineSymbol(symbols_text, main, symbols_textord, "$", "\\textdollar"); -defineSymbol(symbols_math, main, symbols_textord, "%", "\\%"); -defineSymbol(symbols_text, main, symbols_textord, "%", "\\%"); -defineSymbol(symbols_math, main, symbols_textord, "_", "\\_"); -defineSymbol(symbols_text, main, symbols_textord, "_", "\\_"); -defineSymbol(symbols_text, main, symbols_textord, "_", "\\textunderscore"); -defineSymbol(symbols_math, main, symbols_textord, "\u2220", "\\angle", true); -defineSymbol(symbols_math, main, symbols_textord, "\u221E", "\\infty", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2032", "\\prime"); -defineSymbol(symbols_math, main, symbols_textord, "\u25B3", "\\triangle"); -defineSymbol(symbols_math, main, symbols_textord, "\u0393", "\\Gamma", true); -defineSymbol(symbols_math, main, symbols_textord, "\u0394", "\\Delta", true); -defineSymbol(symbols_math, main, symbols_textord, "\u0398", "\\Theta", true); -defineSymbol(symbols_math, main, symbols_textord, "\u039B", "\\Lambda", true); -defineSymbol(symbols_math, main, symbols_textord, "\u039E", "\\Xi", true); -defineSymbol(symbols_math, main, symbols_textord, "\u03A0", "\\Pi", true); -defineSymbol(symbols_math, main, symbols_textord, "\u03A3", "\\Sigma", true); -defineSymbol(symbols_math, main, symbols_textord, "\u03A5", "\\Upsilon", true); -defineSymbol(symbols_math, main, symbols_textord, "\u03A6", "\\Phi", true); -defineSymbol(symbols_math, main, symbols_textord, "\u03A8", "\\Psi", true); -defineSymbol(symbols_math, main, symbols_textord, "\u03A9", "\\Omega", true); -defineSymbol(symbols_math, main, symbols_textord, "A", "\u0391"); -defineSymbol(symbols_math, main, symbols_textord, "B", "\u0392"); -defineSymbol(symbols_math, main, symbols_textord, "E", "\u0395"); -defineSymbol(symbols_math, main, symbols_textord, "Z", "\u0396"); -defineSymbol(symbols_math, main, symbols_textord, "H", "\u0397"); -defineSymbol(symbols_math, main, symbols_textord, "I", "\u0399"); -defineSymbol(symbols_math, main, symbols_textord, "K", "\u039A"); -defineSymbol(symbols_math, main, symbols_textord, "M", "\u039C"); -defineSymbol(symbols_math, main, symbols_textord, "N", "\u039D"); -defineSymbol(symbols_math, main, symbols_textord, "O", "\u039F"); -defineSymbol(symbols_math, main, symbols_textord, "P", "\u03A1"); -defineSymbol(symbols_math, main, symbols_textord, "T", "\u03A4"); -defineSymbol(symbols_math, main, symbols_textord, "X", "\u03A7"); -defineSymbol(symbols_math, main, symbols_textord, "\xAC", "\\neg", true); -defineSymbol(symbols_math, main, symbols_textord, "\xAC", "\\lnot"); -defineSymbol(symbols_math, main, symbols_textord, "\u22A4", "\\top"); -defineSymbol(symbols_math, main, symbols_textord, "\u22A5", "\\bot"); -defineSymbol(symbols_math, main, symbols_textord, "\u2205", "\\emptyset"); -defineSymbol(symbols_math, ams, symbols_textord, "\u2205", "\\varnothing"); -defineSymbol(symbols_math, main, mathord, "\u03B1", "\\alpha", true); -defineSymbol(symbols_math, main, mathord, "\u03B2", "\\beta", true); -defineSymbol(symbols_math, main, mathord, "\u03B3", "\\gamma", true); -defineSymbol(symbols_math, main, mathord, "\u03B4", "\\delta", true); -defineSymbol(symbols_math, main, mathord, "\u03F5", "\\epsilon", true); -defineSymbol(symbols_math, main, mathord, "\u03B6", "\\zeta", true); -defineSymbol(symbols_math, main, mathord, "\u03B7", "\\eta", true); -defineSymbol(symbols_math, main, mathord, "\u03B8", "\\theta", true); -defineSymbol(symbols_math, main, mathord, "\u03B9", "\\iota", true); -defineSymbol(symbols_math, main, mathord, "\u03BA", "\\kappa", true); -defineSymbol(symbols_math, main, mathord, "\u03BB", "\\lambda", true); -defineSymbol(symbols_math, main, mathord, "\u03BC", "\\mu", true); -defineSymbol(symbols_math, main, mathord, "\u03BD", "\\nu", true); -defineSymbol(symbols_math, main, mathord, "\u03BE", "\\xi", true); -defineSymbol(symbols_math, main, mathord, "\u03BF", "\\omicron", true); -defineSymbol(symbols_math, main, mathord, "\u03C0", "\\pi", true); -defineSymbol(symbols_math, main, mathord, "\u03C1", "\\rho", true); -defineSymbol(symbols_math, main, mathord, "\u03C3", "\\sigma", true); -defineSymbol(symbols_math, main, mathord, "\u03C4", "\\tau", true); -defineSymbol(symbols_math, main, mathord, "\u03C5", "\\upsilon", true); -defineSymbol(symbols_math, main, mathord, "\u03D5", "\\phi", true); -defineSymbol(symbols_math, main, mathord, "\u03C7", "\\chi", true); -defineSymbol(symbols_math, main, mathord, "\u03C8", "\\psi", true); -defineSymbol(symbols_math, main, mathord, "\u03C9", "\\omega", true); -defineSymbol(symbols_math, main, mathord, "\u03B5", "\\varepsilon", true); -defineSymbol(symbols_math, main, mathord, "\u03D1", "\\vartheta", true); -defineSymbol(symbols_math, main, mathord, "\u03D6", "\\varpi", true); -defineSymbol(symbols_math, main, mathord, "\u03F1", "\\varrho", true); -defineSymbol(symbols_math, main, mathord, "\u03C2", "\\varsigma", true); -defineSymbol(symbols_math, main, mathord, "\u03C6", "\\varphi", true); -defineSymbol(symbols_math, main, bin, "\u2217", "*"); -defineSymbol(symbols_math, main, bin, "+", "+"); -defineSymbol(symbols_math, main, bin, "\u2212", "-"); -defineSymbol(symbols_math, main, bin, "\u22C5", "\\cdot", true); -defineSymbol(symbols_math, main, bin, "\u2218", "\\circ"); -defineSymbol(symbols_math, main, bin, "\xF7", "\\div", true); -defineSymbol(symbols_math, main, bin, "\xB1", "\\pm", true); -defineSymbol(symbols_math, main, bin, "\xD7", "\\times", true); -defineSymbol(symbols_math, main, bin, "\u2229", "\\cap", true); -defineSymbol(symbols_math, main, bin, "\u222A", "\\cup", true); -defineSymbol(symbols_math, main, bin, "\u2216", "\\setminus"); -defineSymbol(symbols_math, main, bin, "\u2227", "\\land"); -defineSymbol(symbols_math, main, bin, "\u2228", "\\lor"); -defineSymbol(symbols_math, main, bin, "\u2227", "\\wedge", true); -defineSymbol(symbols_math, main, bin, "\u2228", "\\vee", true); -defineSymbol(symbols_math, main, symbols_textord, "\u221A", "\\surd"); -defineSymbol(symbols_math, main, symbols_open, "\u27E8", "\\langle", true); -defineSymbol(symbols_math, main, symbols_open, "\u2223", "\\lvert"); -defineSymbol(symbols_math, main, symbols_open, "\u2225", "\\lVert"); -defineSymbol(symbols_math, main, symbols_close, "?", "?"); -defineSymbol(symbols_math, main, symbols_close, "!", "!"); -defineSymbol(symbols_math, main, symbols_close, "\u27E9", "\\rangle", true); -defineSymbol(symbols_math, main, symbols_close, "\u2223", "\\rvert"); -defineSymbol(symbols_math, main, symbols_close, "\u2225", "\\rVert"); -defineSymbol(symbols_math, main, rel, "=", "="); -defineSymbol(symbols_math, main, rel, ":", ":"); -defineSymbol(symbols_math, main, rel, "\u2248", "\\approx", true); -defineSymbol(symbols_math, main, rel, "\u2245", "\\cong", true); -defineSymbol(symbols_math, main, rel, "\u2265", "\\ge"); -defineSymbol(symbols_math, main, rel, "\u2265", "\\geq", true); -defineSymbol(symbols_math, main, rel, "\u2190", "\\gets"); -defineSymbol(symbols_math, main, rel, ">", "\\gt", true); -defineSymbol(symbols_math, main, rel, "\u2208", "\\in", true); -defineSymbol(symbols_math, main, rel, "\uE020", "\\@not"); -defineSymbol(symbols_math, main, rel, "\u2282", "\\subset", true); -defineSymbol(symbols_math, main, rel, "\u2283", "\\supset", true); -defineSymbol(symbols_math, main, rel, "\u2286", "\\subseteq", true); -defineSymbol(symbols_math, main, rel, "\u2287", "\\supseteq", true); -defineSymbol(symbols_math, ams, rel, "\u2288", "\\nsubseteq", true); -defineSymbol(symbols_math, ams, rel, "\u2289", "\\nsupseteq", true); -defineSymbol(symbols_math, main, rel, "\u22A8", "\\models"); -defineSymbol(symbols_math, main, rel, "\u2190", "\\leftarrow", true); -defineSymbol(symbols_math, main, rel, "\u2264", "\\le"); -defineSymbol(symbols_math, main, rel, "\u2264", "\\leq", true); -defineSymbol(symbols_math, main, rel, "<", "\\lt", true); -defineSymbol(symbols_math, main, rel, "\u2192", "\\rightarrow", true); -defineSymbol(symbols_math, main, rel, "\u2192", "\\to"); -defineSymbol(symbols_math, ams, rel, "\u2271", "\\ngeq", true); -defineSymbol(symbols_math, ams, rel, "\u2270", "\\nleq", true); -defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\ "); -defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "~"); -defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{% +defineSymbol(math, main, rel, "\u22B7", "\\imageof", true); // not in font -defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\nobreakspace"); -defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\ "); -defineSymbol(symbols_text, main, symbols_spacing, "\xA0", " "); -defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "~"); -defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\space"); -defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\nobreakspace"); -defineSymbol(symbols_math, main, symbols_spacing, null, "\\nobreak"); -defineSymbol(symbols_math, main, symbols_spacing, null, "\\allowbreak"); -defineSymbol(symbols_math, main, punct, ",", ","); -defineSymbol(symbols_math, main, punct, ";", ";"); -defineSymbol(symbols_math, ams, bin, "\u22BC", "\\barwedge", true); -defineSymbol(symbols_math, ams, bin, "\u22BB", "\\veebar", true); -defineSymbol(symbols_math, main, bin, "\u2299", "\\odot", true); -defineSymbol(symbols_math, main, bin, "\u2295", "\\oplus", true); -defineSymbol(symbols_math, main, bin, "\u2297", "\\otimes", true); -defineSymbol(symbols_math, main, symbols_textord, "\u2202", "\\partial", true); -defineSymbol(symbols_math, main, bin, "\u2298", "\\oslash", true); -defineSymbol(symbols_math, ams, bin, "\u229A", "\\circledcirc", true); -defineSymbol(symbols_math, ams, bin, "\u22A1", "\\boxdot", true); -defineSymbol(symbols_math, main, bin, "\u25B3", "\\bigtriangleup"); -defineSymbol(symbols_math, main, bin, "\u25BD", "\\bigtriangledown"); -defineSymbol(symbols_math, main, bin, "\u2020", "\\dagger"); -defineSymbol(symbols_math, main, bin, "\u22C4", "\\diamond"); -defineSymbol(symbols_math, main, bin, "\u22C6", "\\star"); -defineSymbol(symbols_math, main, bin, "\u25C3", "\\triangleleft"); -defineSymbol(symbols_math, main, bin, "\u25B9", "\\triangleright"); -defineSymbol(symbols_math, main, symbols_open, "{", "\\{"); -defineSymbol(symbols_text, main, symbols_textord, "{", "\\{"); -defineSymbol(symbols_text, main, symbols_textord, "{", "\\textbraceleft"); -defineSymbol(symbols_math, main, symbols_close, "}", "\\}"); -defineSymbol(symbols_text, main, symbols_textord, "}", "\\}"); -defineSymbol(symbols_text, main, symbols_textord, "}", "\\textbraceright"); -defineSymbol(symbols_math, main, symbols_open, "{", "\\lbrace"); -defineSymbol(symbols_math, main, symbols_close, "}", "\\rbrace"); -defineSymbol(symbols_math, main, symbols_open, "[", "\\lbrack", true); -defineSymbol(symbols_text, main, symbols_textord, "[", "\\lbrack", true); -defineSymbol(symbols_math, main, symbols_close, "]", "\\rbrack", true); -defineSymbol(symbols_text, main, symbols_textord, "]", "\\rbrack", true); -defineSymbol(symbols_math, main, symbols_open, "(", "\\lparen", true); -defineSymbol(symbols_math, main, symbols_close, ")", "\\rparen", true); -defineSymbol(symbols_text, main, symbols_textord, "<", "\\textless", true); // in T1 fontenc +defineSymbol(math, ams, rel, "\u22B8", "\\multimap", true); +defineSymbol(math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true); +defineSymbol(math, ams, rel, "\u21C9", "\\rightrightarrows", true); +defineSymbol(math, ams, rel, "\u21C4", "\\rightleftarrows", true); +defineSymbol(math, ams, rel, "\u21A0", "\\twoheadrightarrow", true); +defineSymbol(math, ams, rel, "\u21A3", "\\rightarrowtail", true); +defineSymbol(math, ams, rel, "\u21AC", "\\looparrowright", true); +defineSymbol(math, ams, rel, "\u21B7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym. -defineSymbol(symbols_text, main, symbols_textord, ">", "\\textgreater", true); // in T1 fontenc +defineSymbol(math, ams, rel, "\u21BB", "\\circlearrowright", true); +defineSymbol(math, ams, rel, "\u21B1", "\\Rsh", true); +defineSymbol(math, ams, rel, "\u21CA", "\\downdownarrows", true); +defineSymbol(math, ams, rel, "\u21BE", "\\upharpoonright", true); +defineSymbol(math, ams, rel, "\u21C2", "\\downharpoonright", true); +defineSymbol(math, ams, rel, "\u21DD", "\\rightsquigarrow", true); +defineSymbol(math, ams, rel, "\u21DD", "\\leadsto"); +defineSymbol(math, ams, rel, "\u21DB", "\\Rrightarrow", true); +defineSymbol(math, ams, rel, "\u21BE", "\\restriction"); +defineSymbol(math, main, textord, "\u2018", "`"); +defineSymbol(math, main, textord, "$", "\\$"); +defineSymbol(symbols_text, main, textord, "$", "\\$"); +defineSymbol(symbols_text, main, textord, "$", "\\textdollar"); +defineSymbol(math, main, textord, "%", "\\%"); +defineSymbol(symbols_text, main, textord, "%", "\\%"); +defineSymbol(math, main, textord, "_", "\\_"); +defineSymbol(symbols_text, main, textord, "_", "\\_"); +defineSymbol(symbols_text, main, textord, "_", "\\textunderscore"); +defineSymbol(math, main, textord, "\u2220", "\\angle", true); +defineSymbol(math, main, textord, "\u221E", "\\infty", true); +defineSymbol(math, main, textord, "\u2032", "\\prime"); +defineSymbol(math, main, textord, "\u25B3", "\\triangle"); +defineSymbol(math, main, textord, "\u0393", "\\Gamma", true); +defineSymbol(math, main, textord, "\u0394", "\\Delta", true); +defineSymbol(math, main, textord, "\u0398", "\\Theta", true); +defineSymbol(math, main, textord, "\u039B", "\\Lambda", true); +defineSymbol(math, main, textord, "\u039E", "\\Xi", true); +defineSymbol(math, main, textord, "\u03A0", "\\Pi", true); +defineSymbol(math, main, textord, "\u03A3", "\\Sigma", true); +defineSymbol(math, main, textord, "\u03A5", "\\Upsilon", true); +defineSymbol(math, main, textord, "\u03A6", "\\Phi", true); +defineSymbol(math, main, textord, "\u03A8", "\\Psi", true); +defineSymbol(math, main, textord, "\u03A9", "\\Omega", true); +defineSymbol(math, main, textord, "A", "\u0391"); +defineSymbol(math, main, textord, "B", "\u0392"); +defineSymbol(math, main, textord, "E", "\u0395"); +defineSymbol(math, main, textord, "Z", "\u0396"); +defineSymbol(math, main, textord, "H", "\u0397"); +defineSymbol(math, main, textord, "I", "\u0399"); +defineSymbol(math, main, textord, "K", "\u039A"); +defineSymbol(math, main, textord, "M", "\u039C"); +defineSymbol(math, main, textord, "N", "\u039D"); +defineSymbol(math, main, textord, "O", "\u039F"); +defineSymbol(math, main, textord, "P", "\u03A1"); +defineSymbol(math, main, textord, "T", "\u03A4"); +defineSymbol(math, main, textord, "X", "\u03A7"); +defineSymbol(math, main, textord, "\xAC", "\\neg", true); +defineSymbol(math, main, textord, "\xAC", "\\lnot"); +defineSymbol(math, main, textord, "\u22A4", "\\top"); +defineSymbol(math, main, textord, "\u22A5", "\\bot"); +defineSymbol(math, main, textord, "\u2205", "\\emptyset"); +defineSymbol(math, ams, textord, "\u2205", "\\varnothing"); +defineSymbol(math, main, mathord, "\u03B1", "\\alpha", true); +defineSymbol(math, main, mathord, "\u03B2", "\\beta", true); +defineSymbol(math, main, mathord, "\u03B3", "\\gamma", true); +defineSymbol(math, main, mathord, "\u03B4", "\\delta", true); +defineSymbol(math, main, mathord, "\u03F5", "\\epsilon", true); +defineSymbol(math, main, mathord, "\u03B6", "\\zeta", true); +defineSymbol(math, main, mathord, "\u03B7", "\\eta", true); +defineSymbol(math, main, mathord, "\u03B8", "\\theta", true); +defineSymbol(math, main, mathord, "\u03B9", "\\iota", true); +defineSymbol(math, main, mathord, "\u03BA", "\\kappa", true); +defineSymbol(math, main, mathord, "\u03BB", "\\lambda", true); +defineSymbol(math, main, mathord, "\u03BC", "\\mu", true); +defineSymbol(math, main, mathord, "\u03BD", "\\nu", true); +defineSymbol(math, main, mathord, "\u03BE", "\\xi", true); +defineSymbol(math, main, mathord, "\u03BF", "\\omicron", true); +defineSymbol(math, main, mathord, "\u03C0", "\\pi", true); +defineSymbol(math, main, mathord, "\u03C1", "\\rho", true); +defineSymbol(math, main, mathord, "\u03C3", "\\sigma", true); +defineSymbol(math, main, mathord, "\u03C4", "\\tau", true); +defineSymbol(math, main, mathord, "\u03C5", "\\upsilon", true); +defineSymbol(math, main, mathord, "\u03D5", "\\phi", true); +defineSymbol(math, main, mathord, "\u03C7", "\\chi", true); +defineSymbol(math, main, mathord, "\u03C8", "\\psi", true); +defineSymbol(math, main, mathord, "\u03C9", "\\omega", true); +defineSymbol(math, main, mathord, "\u03B5", "\\varepsilon", true); +defineSymbol(math, main, mathord, "\u03D1", "\\vartheta", true); +defineSymbol(math, main, mathord, "\u03D6", "\\varpi", true); +defineSymbol(math, main, mathord, "\u03F1", "\\varrho", true); +defineSymbol(math, main, mathord, "\u03C2", "\\varsigma", true); +defineSymbol(math, main, mathord, "\u03C6", "\\varphi", true); +defineSymbol(math, main, bin, "\u2217", "*"); +defineSymbol(math, main, bin, "+", "+"); +defineSymbol(math, main, bin, "\u2212", "-"); +defineSymbol(math, main, bin, "\u22C5", "\\cdot", true); +defineSymbol(math, main, bin, "\u2218", "\\circ"); +defineSymbol(math, main, bin, "\xF7", "\\div", true); +defineSymbol(math, main, bin, "\xB1", "\\pm", true); +defineSymbol(math, main, bin, "\xD7", "\\times", true); +defineSymbol(math, main, bin, "\u2229", "\\cap", true); +defineSymbol(math, main, bin, "\u222A", "\\cup", true); +defineSymbol(math, main, bin, "\u2216", "\\setminus"); +defineSymbol(math, main, bin, "\u2227", "\\land"); +defineSymbol(math, main, bin, "\u2228", "\\lor"); +defineSymbol(math, main, bin, "\u2227", "\\wedge", true); +defineSymbol(math, main, bin, "\u2228", "\\vee", true); +defineSymbol(math, main, textord, "\u221A", "\\surd"); +defineSymbol(math, main, symbols_open, "\u27E8", "\\langle", true); +defineSymbol(math, main, symbols_open, "\u2223", "\\lvert"); +defineSymbol(math, main, symbols_open, "\u2225", "\\lVert"); +defineSymbol(math, main, symbols_close, "?", "?"); +defineSymbol(math, main, symbols_close, "!", "!"); +defineSymbol(math, main, symbols_close, "\u27E9", "\\rangle", true); +defineSymbol(math, main, symbols_close, "\u2223", "\\rvert"); +defineSymbol(math, main, symbols_close, "\u2225", "\\rVert"); +defineSymbol(math, main, rel, "=", "="); +defineSymbol(math, main, rel, ":", ":"); +defineSymbol(math, main, rel, "\u2248", "\\approx", true); +defineSymbol(math, main, rel, "\u2245", "\\cong", true); +defineSymbol(math, main, rel, "\u2265", "\\ge"); +defineSymbol(math, main, rel, "\u2265", "\\geq", true); +defineSymbol(math, main, rel, "\u2190", "\\gets"); +defineSymbol(math, main, rel, ">", "\\gt", true); +defineSymbol(math, main, rel, "\u2208", "\\in", true); +defineSymbol(math, main, rel, "\uE020", "\\@not"); +defineSymbol(math, main, rel, "\u2282", "\\subset", true); +defineSymbol(math, main, rel, "\u2283", "\\supset", true); +defineSymbol(math, main, rel, "\u2286", "\\subseteq", true); +defineSymbol(math, main, rel, "\u2287", "\\supseteq", true); +defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true); +defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true); +defineSymbol(math, main, rel, "\u22A8", "\\models"); +defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true); +defineSymbol(math, main, rel, "\u2264", "\\le"); +defineSymbol(math, main, rel, "\u2264", "\\leq", true); +defineSymbol(math, main, rel, "<", "\\lt", true); +defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true); +defineSymbol(math, main, rel, "\u2192", "\\to"); +defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true); +defineSymbol(math, ams, rel, "\u2270", "\\nleq", true); +defineSymbol(math, main, spacing, "\xA0", "\\ "); +defineSymbol(math, main, spacing, "\xA0", "~"); +defineSymbol(math, main, spacing, "\xA0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{% -defineSymbol(symbols_math, main, symbols_open, "\u230A", "\\lfloor", true); -defineSymbol(symbols_math, main, symbols_close, "\u230B", "\\rfloor", true); -defineSymbol(symbols_math, main, symbols_open, "\u2308", "\\lceil", true); -defineSymbol(symbols_math, main, symbols_close, "\u2309", "\\rceil", true); -defineSymbol(symbols_math, main, symbols_textord, "\\", "\\backslash"); -defineSymbol(symbols_math, main, symbols_textord, "\u2223", "|"); -defineSymbol(symbols_math, main, symbols_textord, "\u2223", "\\vert"); -defineSymbol(symbols_text, main, symbols_textord, "|", "\\textbar", true); // in T1 fontenc +defineSymbol(math, main, spacing, "\xA0", "\\nobreakspace"); +defineSymbol(symbols_text, main, spacing, "\xA0", "\\ "); +defineSymbol(symbols_text, main, spacing, "\xA0", " "); +defineSymbol(symbols_text, main, spacing, "\xA0", "~"); +defineSymbol(symbols_text, main, spacing, "\xA0", "\\space"); +defineSymbol(symbols_text, main, spacing, "\xA0", "\\nobreakspace"); +defineSymbol(math, main, spacing, null, "\\nobreak"); +defineSymbol(math, main, spacing, null, "\\allowbreak"); +defineSymbol(math, main, punct, ",", ","); +defineSymbol(math, main, punct, ";", ";"); +defineSymbol(math, ams, bin, "\u22BC", "\\barwedge", true); +defineSymbol(math, ams, bin, "\u22BB", "\\veebar", true); +defineSymbol(math, main, bin, "\u2299", "\\odot", true); +defineSymbol(math, main, bin, "\u2295", "\\oplus", true); +defineSymbol(math, main, bin, "\u2297", "\\otimes", true); +defineSymbol(math, main, textord, "\u2202", "\\partial", true); +defineSymbol(math, main, bin, "\u2298", "\\oslash", true); +defineSymbol(math, ams, bin, "\u229A", "\\circledcirc", true); +defineSymbol(math, ams, bin, "\u22A1", "\\boxdot", true); +defineSymbol(math, main, bin, "\u25B3", "\\bigtriangleup"); +defineSymbol(math, main, bin, "\u25BD", "\\bigtriangledown"); +defineSymbol(math, main, bin, "\u2020", "\\dagger"); +defineSymbol(math, main, bin, "\u22C4", "\\diamond"); +defineSymbol(math, main, bin, "\u22C6", "\\star"); +defineSymbol(math, main, bin, "\u25C3", "\\triangleleft"); +defineSymbol(math, main, bin, "\u25B9", "\\triangleright"); +defineSymbol(math, main, symbols_open, "{", "\\{"); +defineSymbol(symbols_text, main, textord, "{", "\\{"); +defineSymbol(symbols_text, main, textord, "{", "\\textbraceleft"); +defineSymbol(math, main, symbols_close, "}", "\\}"); +defineSymbol(symbols_text, main, textord, "}", "\\}"); +defineSymbol(symbols_text, main, textord, "}", "\\textbraceright"); +defineSymbol(math, main, symbols_open, "{", "\\lbrace"); +defineSymbol(math, main, symbols_close, "}", "\\rbrace"); +defineSymbol(math, main, symbols_open, "[", "\\lbrack", true); +defineSymbol(symbols_text, main, textord, "[", "\\lbrack", true); +defineSymbol(math, main, symbols_close, "]", "\\rbrack", true); +defineSymbol(symbols_text, main, textord, "]", "\\rbrack", true); +defineSymbol(math, main, symbols_open, "(", "\\lparen", true); +defineSymbol(math, main, symbols_close, ")", "\\rparen", true); +defineSymbol(symbols_text, main, textord, "<", "\\textless", true); // in T1 fontenc -defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\|"); -defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\Vert"); -defineSymbol(symbols_text, main, symbols_textord, "\u2225", "\\textbardbl"); -defineSymbol(symbols_text, main, symbols_textord, "~", "\\textasciitilde"); -defineSymbol(symbols_text, main, symbols_textord, "\\", "\\textbackslash"); -defineSymbol(symbols_text, main, symbols_textord, "^", "\\textasciicircum"); -defineSymbol(symbols_math, main, rel, "\u2191", "\\uparrow", true); -defineSymbol(symbols_math, main, rel, "\u21D1", "\\Uparrow", true); -defineSymbol(symbols_math, main, rel, "\u2193", "\\downarrow", true); -defineSymbol(symbols_math, main, rel, "\u21D3", "\\Downarrow", true); -defineSymbol(symbols_math, main, rel, "\u2195", "\\updownarrow", true); -defineSymbol(symbols_math, main, rel, "\u21D5", "\\Updownarrow", true); -defineSymbol(symbols_math, main, op, "\u2210", "\\coprod"); -defineSymbol(symbols_math, main, op, "\u22C1", "\\bigvee"); -defineSymbol(symbols_math, main, op, "\u22C0", "\\bigwedge"); -defineSymbol(symbols_math, main, op, "\u2A04", "\\biguplus"); -defineSymbol(symbols_math, main, op, "\u22C2", "\\bigcap"); -defineSymbol(symbols_math, main, op, "\u22C3", "\\bigcup"); -defineSymbol(symbols_math, main, op, "\u222B", "\\int"); -defineSymbol(symbols_math, main, op, "\u222B", "\\intop"); -defineSymbol(symbols_math, main, op, "\u222C", "\\iint"); -defineSymbol(symbols_math, main, op, "\u222D", "\\iiint"); -defineSymbol(symbols_math, main, op, "\u220F", "\\prod"); -defineSymbol(symbols_math, main, op, "\u2211", "\\sum"); -defineSymbol(symbols_math, main, op, "\u2A02", "\\bigotimes"); -defineSymbol(symbols_math, main, op, "\u2A01", "\\bigoplus"); -defineSymbol(symbols_math, main, op, "\u2A00", "\\bigodot"); -defineSymbol(symbols_math, main, op, "\u222E", "\\oint"); -defineSymbol(symbols_math, main, op, "\u2A06", "\\bigsqcup"); -defineSymbol(symbols_math, main, op, "\u222B", "\\smallint"); -defineSymbol(symbols_text, main, symbols_inner, "\u2026", "\\textellipsis"); -defineSymbol(symbols_math, main, symbols_inner, "\u2026", "\\mathellipsis"); -defineSymbol(symbols_text, main, symbols_inner, "\u2026", "\\ldots", true); -defineSymbol(symbols_math, main, symbols_inner, "\u2026", "\\ldots", true); -defineSymbol(symbols_math, main, symbols_inner, "\u22EF", "\\@cdots", true); -defineSymbol(symbols_math, main, symbols_inner, "\u22F1", "\\ddots", true); -defineSymbol(symbols_math, main, symbols_textord, "\u22EE", "\\varvdots"); // \vdots is a macro +defineSymbol(symbols_text, main, textord, ">", "\\textgreater", true); // in T1 fontenc -defineSymbol(symbols_math, main, symbols_accent, "\u02CA", "\\acute"); -defineSymbol(symbols_math, main, symbols_accent, "\u02CB", "\\grave"); -defineSymbol(symbols_math, main, symbols_accent, "\xA8", "\\ddot"); -defineSymbol(symbols_math, main, symbols_accent, "~", "\\tilde"); -defineSymbol(symbols_math, main, symbols_accent, "\u02C9", "\\bar"); -defineSymbol(symbols_math, main, symbols_accent, "\u02D8", "\\breve"); -defineSymbol(symbols_math, main, symbols_accent, "\u02C7", "\\check"); -defineSymbol(symbols_math, main, symbols_accent, "^", "\\hat"); -defineSymbol(symbols_math, main, symbols_accent, "\u20D7", "\\vec"); -defineSymbol(symbols_math, main, symbols_accent, "\u02D9", "\\dot"); -defineSymbol(symbols_math, main, symbols_accent, "\u02DA", "\\mathring"); // \imath and \jmath should be invariant to \mathrm, \mathbf, etc., so use PUA +defineSymbol(math, main, symbols_open, "\u230A", "\\lfloor", true); +defineSymbol(math, main, symbols_close, "\u230B", "\\rfloor", true); +defineSymbol(math, main, symbols_open, "\u2308", "\\lceil", true); +defineSymbol(math, main, symbols_close, "\u2309", "\\rceil", true); +defineSymbol(math, main, textord, "\\", "\\backslash"); +defineSymbol(math, main, textord, "\u2223", "|"); +defineSymbol(math, main, textord, "\u2223", "\\vert"); +defineSymbol(symbols_text, main, textord, "|", "\\textbar", true); // in T1 fontenc -defineSymbol(symbols_math, main, mathord, "\uE131", "\\@imath"); -defineSymbol(symbols_math, main, mathord, "\uE237", "\\@jmath"); -defineSymbol(symbols_math, main, symbols_textord, "\u0131", "\u0131"); -defineSymbol(symbols_math, main, symbols_textord, "\u0237", "\u0237"); -defineSymbol(symbols_text, main, symbols_textord, "\u0131", "\\i", true); -defineSymbol(symbols_text, main, symbols_textord, "\u0237", "\\j", true); -defineSymbol(symbols_text, main, symbols_textord, "\xDF", "\\ss", true); -defineSymbol(symbols_text, main, symbols_textord, "\xE6", "\\ae", true); -defineSymbol(symbols_text, main, symbols_textord, "\u0153", "\\oe", true); -defineSymbol(symbols_text, main, symbols_textord, "\xF8", "\\o", true); -defineSymbol(symbols_text, main, symbols_textord, "\xC6", "\\AE", true); -defineSymbol(symbols_text, main, symbols_textord, "\u0152", "\\OE", true); -defineSymbol(symbols_text, main, symbols_textord, "\xD8", "\\O", true); -defineSymbol(symbols_text, main, symbols_accent, "\u02CA", "\\'"); // acute +defineSymbol(math, main, textord, "\u2225", "\\|"); +defineSymbol(math, main, textord, "\u2225", "\\Vert"); +defineSymbol(symbols_text, main, textord, "\u2225", "\\textbardbl"); +defineSymbol(symbols_text, main, textord, "~", "\\textasciitilde"); +defineSymbol(symbols_text, main, textord, "\\", "\\textbackslash"); +defineSymbol(symbols_text, main, textord, "^", "\\textasciicircum"); +defineSymbol(math, main, rel, "\u2191", "\\uparrow", true); +defineSymbol(math, main, rel, "\u21D1", "\\Uparrow", true); +defineSymbol(math, main, rel, "\u2193", "\\downarrow", true); +defineSymbol(math, main, rel, "\u21D3", "\\Downarrow", true); +defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true); +defineSymbol(math, main, rel, "\u21D5", "\\Updownarrow", true); +defineSymbol(math, main, op, "\u2210", "\\coprod"); +defineSymbol(math, main, op, "\u22C1", "\\bigvee"); +defineSymbol(math, main, op, "\u22C0", "\\bigwedge"); +defineSymbol(math, main, op, "\u2A04", "\\biguplus"); +defineSymbol(math, main, op, "\u22C2", "\\bigcap"); +defineSymbol(math, main, op, "\u22C3", "\\bigcup"); +defineSymbol(math, main, op, "\u222B", "\\int"); +defineSymbol(math, main, op, "\u222B", "\\intop"); +defineSymbol(math, main, op, "\u222C", "\\iint"); +defineSymbol(math, main, op, "\u222D", "\\iiint"); +defineSymbol(math, main, op, "\u220F", "\\prod"); +defineSymbol(math, main, op, "\u2211", "\\sum"); +defineSymbol(math, main, op, "\u2A02", "\\bigotimes"); +defineSymbol(math, main, op, "\u2A01", "\\bigoplus"); +defineSymbol(math, main, op, "\u2A00", "\\bigodot"); +defineSymbol(math, main, op, "\u222E", "\\oint"); +defineSymbol(math, main, op, "\u222F", "\\oiint"); +defineSymbol(math, main, op, "\u2230", "\\oiiint"); +defineSymbol(math, main, op, "\u2A06", "\\bigsqcup"); +defineSymbol(math, main, op, "\u222B", "\\smallint"); +defineSymbol(symbols_text, main, inner, "\u2026", "\\textellipsis"); +defineSymbol(math, main, inner, "\u2026", "\\mathellipsis"); +defineSymbol(symbols_text, main, inner, "\u2026", "\\ldots", true); +defineSymbol(math, main, inner, "\u2026", "\\ldots", true); +defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true); +defineSymbol(math, main, inner, "\u22F1", "\\ddots", true); +defineSymbol(math, main, textord, "\u22EE", "\\varvdots"); // \vdots is a macro -defineSymbol(symbols_text, main, symbols_accent, "\u02CB", "\\`"); // grave +defineSymbol(math, main, accent, "\u02CA", "\\acute"); +defineSymbol(math, main, accent, "\u02CB", "\\grave"); +defineSymbol(math, main, accent, "\xA8", "\\ddot"); +defineSymbol(math, main, accent, "~", "\\tilde"); +defineSymbol(math, main, accent, "\u02C9", "\\bar"); +defineSymbol(math, main, accent, "\u02D8", "\\breve"); +defineSymbol(math, main, accent, "\u02C7", "\\check"); +defineSymbol(math, main, accent, "^", "\\hat"); +defineSymbol(math, main, accent, "\u20D7", "\\vec"); +defineSymbol(math, main, accent, "\u02D9", "\\dot"); +defineSymbol(math, main, accent, "\u02DA", "\\mathring"); // \imath and \jmath should be invariant to \mathrm, \mathbf, etc., so use PUA -defineSymbol(symbols_text, main, symbols_accent, "\u02C6", "\\^"); // circumflex +defineSymbol(math, main, mathord, "\uE131", "\\@imath"); +defineSymbol(math, main, mathord, "\uE237", "\\@jmath"); +defineSymbol(math, main, textord, "\u0131", "\u0131"); +defineSymbol(math, main, textord, "\u0237", "\u0237"); +defineSymbol(symbols_text, main, textord, "\u0131", "\\i", true); +defineSymbol(symbols_text, main, textord, "\u0237", "\\j", true); +defineSymbol(symbols_text, main, textord, "\xDF", "\\ss", true); +defineSymbol(symbols_text, main, textord, "\xE6", "\\ae", true); +defineSymbol(symbols_text, main, textord, "\u0153", "\\oe", true); +defineSymbol(symbols_text, main, textord, "\xF8", "\\o", true); +defineSymbol(symbols_text, main, textord, "\xC6", "\\AE", true); +defineSymbol(symbols_text, main, textord, "\u0152", "\\OE", true); +defineSymbol(symbols_text, main, textord, "\xD8", "\\O", true); +defineSymbol(symbols_text, main, accent, "\u02CA", "\\'"); // acute -defineSymbol(symbols_text, main, symbols_accent, "\u02DC", "\\~"); // tilde +defineSymbol(symbols_text, main, accent, "\u02CB", "\\`"); // grave -defineSymbol(symbols_text, main, symbols_accent, "\u02C9", "\\="); // macron +defineSymbol(symbols_text, main, accent, "\u02C6", "\\^"); // circumflex -defineSymbol(symbols_text, main, symbols_accent, "\u02D8", "\\u"); // breve +defineSymbol(symbols_text, main, accent, "\u02DC", "\\~"); // tilde -defineSymbol(symbols_text, main, symbols_accent, "\u02D9", "\\."); // dot above +defineSymbol(symbols_text, main, accent, "\u02C9", "\\="); // macron -defineSymbol(symbols_text, main, symbols_accent, "\u02DA", "\\r"); // ring above +defineSymbol(symbols_text, main, accent, "\u02D8", "\\u"); // breve -defineSymbol(symbols_text, main, symbols_accent, "\u02C7", "\\v"); // caron +defineSymbol(symbols_text, main, accent, "\u02D9", "\\."); // dot above -defineSymbol(symbols_text, main, symbols_accent, "\xA8", '\\"'); // diaresis +defineSymbol(symbols_text, main, accent, "\u02DA", "\\r"); // ring above -defineSymbol(symbols_text, main, symbols_accent, "\u02DD", "\\H"); // double acute +defineSymbol(symbols_text, main, accent, "\u02C7", "\\v"); // caron -defineSymbol(symbols_text, main, symbols_accent, "\u25EF", "\\textcircled"); // \bigcirc glyph +defineSymbol(symbols_text, main, accent, "\xA8", '\\"'); // diaresis + +defineSymbol(symbols_text, main, accent, "\u02DD", "\\H"); // double acute + +defineSymbol(symbols_text, main, accent, "\u25EF", "\\textcircled"); // \bigcirc glyph // These ligatures are detected and created in Parser.js's `formLigatures`. var ligatures = { @@ -4633,76 +4497,76 @@ var ligatures = { "``": true, "''": true }; -defineSymbol(symbols_text, main, symbols_textord, "\u2013", "--", true); -defineSymbol(symbols_text, main, symbols_textord, "\u2013", "\\textendash"); -defineSymbol(symbols_text, main, symbols_textord, "\u2014", "---", true); -defineSymbol(symbols_text, main, symbols_textord, "\u2014", "\\textemdash"); -defineSymbol(symbols_text, main, symbols_textord, "\u2018", "`", true); -defineSymbol(symbols_text, main, symbols_textord, "\u2018", "\\textquoteleft"); -defineSymbol(symbols_text, main, symbols_textord, "\u2019", "'", true); -defineSymbol(symbols_text, main, symbols_textord, "\u2019", "\\textquoteright"); -defineSymbol(symbols_text, main, symbols_textord, "\u201C", "``", true); -defineSymbol(symbols_text, main, symbols_textord, "\u201C", "\\textquotedblleft"); -defineSymbol(symbols_text, main, symbols_textord, "\u201D", "''", true); -defineSymbol(symbols_text, main, symbols_textord, "\u201D", "\\textquotedblright"); // \degree from gensymb package +defineSymbol(symbols_text, main, textord, "\u2013", "--", true); +defineSymbol(symbols_text, main, textord, "\u2013", "\\textendash"); +defineSymbol(symbols_text, main, textord, "\u2014", "---", true); +defineSymbol(symbols_text, main, textord, "\u2014", "\\textemdash"); +defineSymbol(symbols_text, main, textord, "\u2018", "`", true); +defineSymbol(symbols_text, main, textord, "\u2018", "\\textquoteleft"); +defineSymbol(symbols_text, main, textord, "\u2019", "'", true); +defineSymbol(symbols_text, main, textord, "\u2019", "\\textquoteright"); +defineSymbol(symbols_text, main, textord, "\u201C", "``", true); +defineSymbol(symbols_text, main, textord, "\u201C", "\\textquotedblleft"); +defineSymbol(symbols_text, main, textord, "\u201D", "''", true); +defineSymbol(symbols_text, main, textord, "\u201D", "\\textquotedblright"); // \degree from gensymb package -defineSymbol(symbols_math, main, symbols_textord, "\xB0", "\\degree", true); -defineSymbol(symbols_text, main, symbols_textord, "\xB0", "\\degree"); // \textdegree from inputenc package +defineSymbol(math, main, textord, "\xB0", "\\degree", true); +defineSymbol(symbols_text, main, textord, "\xB0", "\\degree"); // \textdegree from inputenc package -defineSymbol(symbols_text, main, symbols_textord, "\xB0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math +defineSymbol(symbols_text, main, textord, "\xB0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math // mode, but among our fonts, only Main-Regular defines this character "163". -defineSymbol(symbols_math, main, symbols_textord, "\xA3", "\\pounds"); -defineSymbol(symbols_math, main, symbols_textord, "\xA3", "\\mathsterling", true); -defineSymbol(symbols_text, main, symbols_textord, "\xA3", "\\pounds"); -defineSymbol(symbols_text, main, symbols_textord, "\xA3", "\\textsterling", true); -defineSymbol(symbols_math, ams, symbols_textord, "\u2720", "\\maltese"); -defineSymbol(symbols_text, ams, symbols_textord, "\u2720", "\\maltese"); // There are lots of symbols which are the same, so we add them in afterwards. +defineSymbol(math, main, textord, "\xA3", "\\pounds"); +defineSymbol(math, main, textord, "\xA3", "\\mathsterling", true); +defineSymbol(symbols_text, main, textord, "\xA3", "\\pounds"); +defineSymbol(symbols_text, main, textord, "\xA3", "\\textsterling", true); +defineSymbol(math, ams, textord, "\u2720", "\\maltese"); +defineSymbol(symbols_text, ams, textord, "\u2720", "\\maltese"); // There are lots of symbols which are the same, so we add them in afterwards. // All of these are textords in math mode var mathTextSymbols = "0123456789/@.\""; -for (var symbols_i = 0; symbols_i < mathTextSymbols.length; symbols_i++) { - var symbols_ch = mathTextSymbols.charAt(symbols_i); - defineSymbol(symbols_math, main, symbols_textord, symbols_ch, symbols_ch); +for (var i = 0; i < mathTextSymbols.length; i++) { + var ch = mathTextSymbols.charAt(i); + defineSymbol(math, main, textord, ch, ch); } // All of these are textords in text mode var textSymbols = "0123456789!@*()-=+\";:?/.,"; -for (var src_symbols_i = 0; src_symbols_i < textSymbols.length; src_symbols_i++) { - var _ch = textSymbols.charAt(src_symbols_i); +for (var _i = 0; _i < textSymbols.length; _i++) { + var _ch = textSymbols.charAt(_i); - defineSymbol(symbols_text, main, symbols_textord, _ch, _ch); + defineSymbol(symbols_text, main, textord, _ch, _ch); } // All of these are textords in text mode, and mathords in math mode var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -for (var symbols_i2 = 0; symbols_i2 < letters.length; symbols_i2++) { - var _ch2 = letters.charAt(symbols_i2); +for (var _i2 = 0; _i2 < letters.length; _i2++) { + var _ch2 = letters.charAt(_i2); - defineSymbol(symbols_math, main, mathord, _ch2, _ch2); - defineSymbol(symbols_text, main, symbols_textord, _ch2, _ch2); + defineSymbol(math, main, mathord, _ch2, _ch2); + defineSymbol(symbols_text, main, textord, _ch2, _ch2); } // Blackboard bold and script letters in Unicode range -defineSymbol(symbols_math, ams, symbols_textord, "C", "\u2102"); // blackboard bold +defineSymbol(math, ams, textord, "C", "\u2102"); // blackboard bold -defineSymbol(symbols_text, ams, symbols_textord, "C", "\u2102"); -defineSymbol(symbols_math, ams, symbols_textord, "H", "\u210D"); -defineSymbol(symbols_text, ams, symbols_textord, "H", "\u210D"); -defineSymbol(symbols_math, ams, symbols_textord, "N", "\u2115"); -defineSymbol(symbols_text, ams, symbols_textord, "N", "\u2115"); -defineSymbol(symbols_math, ams, symbols_textord, "P", "\u2119"); -defineSymbol(symbols_text, ams, symbols_textord, "P", "\u2119"); -defineSymbol(symbols_math, ams, symbols_textord, "Q", "\u211A"); -defineSymbol(symbols_text, ams, symbols_textord, "Q", "\u211A"); -defineSymbol(symbols_math, ams, symbols_textord, "R", "\u211D"); -defineSymbol(symbols_text, ams, symbols_textord, "R", "\u211D"); -defineSymbol(symbols_math, ams, symbols_textord, "Z", "\u2124"); -defineSymbol(symbols_text, ams, symbols_textord, "Z", "\u2124"); -defineSymbol(symbols_math, main, mathord, "h", "\u210E"); // italic h, Planck constant +defineSymbol(symbols_text, ams, textord, "C", "\u2102"); +defineSymbol(math, ams, textord, "H", "\u210D"); +defineSymbol(symbols_text, ams, textord, "H", "\u210D"); +defineSymbol(math, ams, textord, "N", "\u2115"); +defineSymbol(symbols_text, ams, textord, "N", "\u2115"); +defineSymbol(math, ams, textord, "P", "\u2119"); +defineSymbol(symbols_text, ams, textord, "P", "\u2119"); +defineSymbol(math, ams, textord, "Q", "\u211A"); +defineSymbol(symbols_text, ams, textord, "Q", "\u211A"); +defineSymbol(math, ams, textord, "R", "\u211D"); +defineSymbol(symbols_text, ams, textord, "R", "\u211D"); +defineSymbol(math, ams, textord, "Z", "\u2124"); +defineSymbol(symbols_text, ams, textord, "Z", "\u2124"); +defineSymbol(math, main, mathord, "h", "\u210E"); // italic h, Planck constant defineSymbol(symbols_text, main, mathord, "h", "\u210E"); // The next loop loads wide (surrogate pair) characters. // We support some letters in the Unicode range U+1D400 to U+1D7FF, @@ -4710,87 +4574,87 @@ defineSymbol(symbols_text, main, mathord, "h", "\u210E"); // The next loop loads // Some editors do not deal well with wide characters. So don't write the // string into this file. Instead, create the string from the surrogate pair. -var symbols_wideChar = ""; +var wideChar = ""; -for (var symbols_i3 = 0; symbols_i3 < letters.length; symbols_i3++) { - var _ch3 = letters.charAt(symbols_i3); // The hex numbers in the next line are a surrogate pair. +for (var _i3 = 0; _i3 < letters.length; _i3++) { + var _ch3 = letters.charAt(_i3); // The hex numbers in the next line are a surrogate pair. // 0xD835 is the high surrogate for all letters in the range we support. // 0xDC00 is the low surrogate for bold A. - symbols_wideChar = String.fromCharCode(0xD835, 0xDC00 + symbols_i3); // A-Z a-z bold + wideChar = String.fromCharCode(0xD835, 0xDC00 + _i3); // A-Z a-z bold - defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDC34 + symbols_i3); // A-Z a-z italic + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(symbols_text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDC34 + _i3); // A-Z a-z italic - defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDC68 + symbols_i3); // A-Z a-z bold italic + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(symbols_text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDC68 + _i3); // A-Z a-z bold italic - defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDD04 + symbols_i3); // A-Z a-z Fractur + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(symbols_text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fractur - defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDDA0 + symbols_i3); // A-Z a-z sans-serif + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(symbols_text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDDA0 + _i3); // A-Z a-z sans-serif - defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDDD4 + symbols_i3); // A-Z a-z sans bold + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(symbols_text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDDD4 + _i3); // A-Z a-z sans bold - defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDE08 + symbols_i3); // A-Z a-z sans italic + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(symbols_text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDE08 + _i3); // A-Z a-z sans italic - defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDE70 + symbols_i3); // A-Z a-z monospace + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(symbols_text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDE70 + _i3); // A-Z a-z monospace - defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(symbols_text, main, textord, _ch3, wideChar); - if (symbols_i3 < 26) { + if (_i3 < 26) { // KaTeX fonts have only capital letters for blackboard bold and script. // See exception for k below. - symbols_wideChar = String.fromCharCode(0xD835, 0xDD38 + symbols_i3); // A-Z double struck + wideChar = String.fromCharCode(0xD835, 0xDD38 + _i3); // A-Z double struck - defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDC9C + symbols_i3); // A-Z script + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(symbols_text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDC9C + _i3); // A-Z script - defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(symbols_text, main, textord, _ch3, wideChar); } // TODO: Add bold script when it is supported by a KaTeX font. } // "k" is the only double struck lower case letter in the KaTeX fonts. -symbols_wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck +wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck -defineSymbol(symbols_math, main, mathord, "k", symbols_wideChar); -defineSymbol(symbols_text, main, symbols_textord, "k", symbols_wideChar); // Next, some wide character numerals +defineSymbol(math, main, mathord, "k", wideChar); +defineSymbol(symbols_text, main, textord, "k", wideChar); // Next, some wide character numerals -for (var symbols_i4 = 0; symbols_i4 < 10; symbols_i4++) { - var _ch4 = symbols_i4.toString(); +for (var _i4 = 0; _i4 < 10; _i4++) { + var _ch4 = _i4.toString(); - symbols_wideChar = String.fromCharCode(0xD835, 0xDFCE + symbols_i4); // 0-9 bold + wideChar = String.fromCharCode(0xD835, 0xDFCE + _i4); // 0-9 bold - defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDFE2 + symbols_i4); // 0-9 sans serif + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(symbols_text, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDFE2 + _i4); // 0-9 sans serif - defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDFEC + symbols_i4); // 0-9 bold sans + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(symbols_text, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDFEC + _i4); // 0-9 bold sans - defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); - symbols_wideChar = String.fromCharCode(0xD835, 0xDFF6 + symbols_i4); // 0-9 monospace + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(symbols_text, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDFF6 + _i4); // 0-9 monospace - defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); - defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(symbols_text, main, textord, _ch4, wideChar); } // We add these Latin-1 letters as symbols for backwards-compatibility, // but they are not actually in the font, nor are they supported by the // Unicode accent mechanism, so they fall back to Times font and look ugly. @@ -4802,10 +4666,10 @@ var extraLatin = "\xC7\xD0\xDE\xE7\xFE"; for (var _i5 = 0; _i5 < extraLatin.length; _i5++) { var _ch5 = extraLatin.charAt(_i5); - defineSymbol(symbols_math, main, mathord, _ch5, _ch5); - defineSymbol(symbols_text, main, symbols_textord, _ch5, _ch5); + defineSymbol(math, main, mathord, _ch5, _ch5); + defineSymbol(symbols_text, main, textord, _ch5, _ch5); } -// CONCATENATED MODULE: ./src/wide-character.js +;// CONCATENATED MODULE: ./src/wide-character.js /** * This file provides support for Unicode range U+1D400 to U+1D7FF, * Mathematical Alphanumeric Symbols. @@ -4851,13 +4715,15 @@ var wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold uprigh ["", "", ""], // A-Z bold italic sans. No font ["", "", ""], // a-z bold italic sans. No font ["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace -["mathtt", "texttt", "Typewriter-Regular"]]; +["mathtt", "texttt", "Typewriter-Regular"] // a-z monospace +]; var wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold ["", "", ""], // 0-9 double-struck. No KaTeX font. ["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif -["mathtt", "texttt", "Typewriter-Regular"]]; -var wide_character_wideCharacterFont = function wideCharacterFont(wideChar, mode) { +["mathtt", "texttt", "Typewriter-Regular"] // 0-9 monospace +]; +var wideCharacterFont = function wideCharacterFont(wideChar, mode) { // IE doesn't support codePointAt(). So work with the surrogate pair. var H = wideChar.charCodeAt(0); // high surrogate @@ -4887,7 +4753,7 @@ var wide_character_wideCharacterFont = function wideCharacterFont(wideChar, mode throw new src_ParseError("Unsupported character: " + wideChar); } }; -// CONCATENATED MODULE: ./src/Options.js +;// CONCATENATED MODULE: ./src/Options.js /** * This file contains information about the options that the Parser carries * around with it while parsing. Data is held in an `Options` object, and when @@ -4907,7 +4773,8 @@ var sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscript [8, 6, 3], // size8: [14.4, 10, 7] \Large [9, 7, 6], // size9: [17.28, 12, 10] \LARGE [10, 8, 7], // size10: [20.74, 14.4, 12] \huge -[11, 10, 9]]; +[11, 10, 9] // size11: [24.88, 20.74, 17.28] \HUGE +]; var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if // you change size indexes, change that function. 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488]; @@ -4924,9 +4791,7 @@ var sizeAtStyle = function sizeAtStyle(size, style) { * Options objects should not be modified. To create a new Options with * different properties, call a `.having*` method. */ -var Options_Options = -/*#__PURE__*/ -function () { +var Options = /*#__PURE__*/function () { // A font family applies to a group of fonts (i.e. SansSerif), while a font // represents a specific font (i.e. SansSerif Bold). // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm @@ -5205,9 +5070,9 @@ function () { return Options; }(); -Options_Options.BASESIZE = 6; -/* harmony default export */ var src_Options = (Options_Options); -// CONCATENATED MODULE: ./src/units.js +Options.BASESIZE = 6; +/* harmony default export */ var src_Options = (Options); +;// CONCATENATED MODULE: ./src/units.js /** * This file does conversion between units. In particular, it provides * calculateSize to convert other units into ems. @@ -5271,7 +5136,7 @@ var validUnit = function validUnit(unit) { * current style/scale. `options` gives the current options. */ -var units_calculateSize = function calculateSize(sizeValue, options) { +var calculateSize = function calculateSize(sizeValue, options) { var scale; if (sizeValue.unit in ptPerUnit) { @@ -5316,7 +5181,7 @@ var units_calculateSize = function calculateSize(sizeValue, options) { return Math.min(sizeValue.number * scale, options.maxSize); }; -// CONCATENATED MODULE: ./src/buildCommon.js +;// CONCATENATED MODULE: ./src/buildCommon.js /* eslint no-console:0 */ /** @@ -5334,7 +5199,7 @@ var units_calculateSize = function calculateSize(sizeValue, options) { * Looks up the given symbol in fontMetrics, after applying any symbol * replacements defined in symbol.js */ -var buildCommon_lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this. +var lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this. fontName, mode) { // Replace the value with its replaced value from symbol.js if (src_symbols[mode][value] && src_symbols[mode][value].replace) { @@ -5358,8 +5223,8 @@ fontName, mode) { */ -var buildCommon_makeSymbol = function makeSymbol(value, fontName, mode, options, classes) { - var lookup = buildCommon_lookupSymbol(value, fontName, mode); +var makeSymbol = function makeSymbol(value, fontName, mode, options, classes) { + var lookup = lookupSymbol(value, fontName, mode); var metrics = lookup.metrics; value = lookup.value; var symbolNode; @@ -5371,11 +5236,11 @@ var buildCommon_makeSymbol = function makeSymbol(value, fontName, mode, options, italic = 0; } - symbolNode = new domTree_SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes); + symbolNode = new SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes); } else { // TODO(emily): Figure out a good way to only print this in development typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'")); - symbolNode = new domTree_SymbolNode(value, 0, 0, 0, 0, 0, classes); + symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes); } if (options) { @@ -5400,7 +5265,7 @@ var buildCommon_makeSymbol = function makeSymbol(value, fontName, mode, options, */ -var buildCommon_mathsym = function mathsym(value, mode, options, classes) { +var mathsym = function mathsym(value, mode, options, classes) { if (classes === void 0) { classes = []; } @@ -5412,12 +5277,12 @@ var buildCommon_mathsym = function mathsym(value, mode, options, classes) { // text ordinal and is therefore not present as a symbol in the symbols // table for text, as well as a special case for boldsymbol because it // can be used for bold + and - - if (options.font === "boldsymbol" && buildCommon_lookupSymbol(value, "Main-Bold", mode).metrics) { - return buildCommon_makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"])); + if (options.font === "boldsymbol" && lookupSymbol(value, "Main-Bold", mode).metrics) { + return makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"])); } else if (value === "\\" || src_symbols[mode][value].font === "main") { - return buildCommon_makeSymbol(value, "Main-Regular", mode, options, classes); + return makeSymbol(value, "Main-Regular", mode, options, classes); } else { - return buildCommon_makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); + return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); } }; /** @@ -5429,7 +5294,7 @@ var buildCommon_mathsym = function mathsym(value, mode, options, classes) { var boldsymbol = function boldsymbol(value, mode, options, classes, type) { - if (type !== "textord" && buildCommon_lookupSymbol(value, "Math-BoldItalic", mode).metrics) { + if (type !== "textord" && lookupSymbol(value, "Math-BoldItalic", mode).metrics) { return { fontName: "Math-BoldItalic", fontClass: "boldsymbol" @@ -5448,7 +5313,7 @@ var boldsymbol = function boldsymbol(value, mode, options, classes, type) { */ -var buildCommon_makeOrd = function makeOrd(group, options, type) { +var makeOrd = function makeOrd(group, options, type) { var mode = group.mode; var text = group.text; var classes = ["mord"]; // Math mode or Old font (i.e. \rm) @@ -5458,11 +5323,11 @@ var buildCommon_makeOrd = function makeOrd(group, options, type) { if (text.charCodeAt(0) === 0xD835) { // surrogate pairs get special treatment - var _wideCharacterFont = wide_character_wideCharacterFont(text, mode), + var _wideCharacterFont = wideCharacterFont(text, mode), wideFontName = _wideCharacterFont[0], wideFontClass = _wideCharacterFont[1]; - return buildCommon_makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass)); + return makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass)); } else if (fontOrFamily) { var fontName; var fontClasses; @@ -5479,40 +5344,40 @@ var buildCommon_makeOrd = function makeOrd(group, options, type) { fontClasses = [fontOrFamily, options.fontWeight, options.fontShape]; } - if (buildCommon_lookupSymbol(text, fontName, mode).metrics) { - return buildCommon_makeSymbol(text, fontName, mode, options, classes.concat(fontClasses)); + if (lookupSymbol(text, fontName, mode).metrics) { + return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses)); } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") { // Deconstruct ligatures in monospace fonts (\texttt, \tt). var parts = []; for (var i = 0; i < text.length; i++) { - parts.push(buildCommon_makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses))); + parts.push(makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses))); } - return buildCommon_makeFragment(parts); + return makeFragment(parts); } } // Makes a symbol in the default font for mathords and textords. if (type === "mathord") { - return buildCommon_makeSymbol(text, "Math-Italic", mode, options, classes.concat(["mathnormal"])); + return makeSymbol(text, "Math-Italic", mode, options, classes.concat(["mathnormal"])); } else if (type === "textord") { var font = src_symbols[mode][text] && src_symbols[mode][text].font; if (font === "ams") { var _fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape); - return buildCommon_makeSymbol(text, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape)); + return makeSymbol(text, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape)); } else if (font === "main" || !font) { var _fontName2 = retrieveTextFontName("textrm", options.fontWeight, options.fontShape); - return buildCommon_makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape)); + return makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape)); } else { // fonts added by plugins var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class - return buildCommon_makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape)); + return makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape)); } } else { throw new Error("unexpected type: " + type + " in makeOrd"); @@ -5524,9 +5389,19 @@ var buildCommon_makeOrd = function makeOrd(group, options, type) { */ -var buildCommon_canCombine = function canCombine(prev, next) { +var canCombine = function canCombine(prev, next) { if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) { return false; + } // If prev and next both are just "mbin"s or "mord"s we don't combine them + // so that the proper spacing can be preserved. + + + if (prev.classes.length === 1) { + var cls = prev.classes[0]; + + if (cls === "mbin" || cls === "mord") { + return false; + } } for (var style in prev.style) { @@ -5544,17 +5419,17 @@ var buildCommon_canCombine = function canCombine(prev, next) { return true; }; /** - * Combine consequetive domTree.symbolNodes into a single symbolNode. + * Combine consecutive domTree.symbolNodes into a single symbolNode. * Note: this function mutates the argument. */ -var buildCommon_tryCombineChars = function tryCombineChars(chars) { +var tryCombineChars = function tryCombineChars(chars) { for (var i = 0; i < chars.length - 1; i++) { var prev = chars[i]; var next = chars[i + 1]; - if (prev instanceof domTree_SymbolNode && next instanceof domTree_SymbolNode && buildCommon_canCombine(prev, next)) { + if (prev instanceof SymbolNode && next instanceof SymbolNode && canCombine(prev, next)) { prev.text += next.text; prev.height = Math.max(prev.height, next.height); prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use @@ -5610,20 +5485,20 @@ var sizeElementFromChildren = function sizeElementFromChildren(elem) { */ -var buildCommon_makeSpan = function makeSpan(classes, children, options, style) { - var span = new domTree_Span(classes, children, options, style); +var makeSpan = function makeSpan(classes, children, options, style) { + var span = new Span(classes, children, options, style); sizeElementFromChildren(span); return span; }; // SVG one is simpler -- doesn't require height, depth, max-font setting. // This is also a separate method for typesafety. -var buildCommon_makeSvgSpan = function makeSvgSpan(classes, children, options, style) { - return new domTree_Span(classes, children, options, style); +var makeSvgSpan = function makeSvgSpan(classes, children, options, style) { + return new Span(classes, children, options, style); }; var makeLineSpan = function makeLineSpan(className, options, thickness) { - var line = buildCommon_makeSpan([className], [], options); + var line = makeSpan([className], [], options); line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness); line.style.borderBottomWidth = line.height + "em"; line.maxFontSize = 1.0; @@ -5635,8 +5510,8 @@ var makeLineSpan = function makeLineSpan(className, options, thickness) { */ -var buildCommon_makeAnchor = function makeAnchor(href, classes, children, options) { - var anchor = new domTree_Anchor(href, classes, children, options); +var makeAnchor = function makeAnchor(href, classes, children, options) { + var anchor = new Anchor(href, classes, children, options); sizeElementFromChildren(anchor); return anchor; }; @@ -5645,8 +5520,8 @@ var buildCommon_makeAnchor = function makeAnchor(href, classes, children, option */ -var buildCommon_makeFragment = function makeFragment(children) { - var fragment = new tree_DocumentFragment(children); +var makeFragment = function makeFragment(children) { + var fragment = new DocumentFragment(children); sizeElementFromChildren(fragment); return fragment; }; @@ -5656,9 +5531,9 @@ var buildCommon_makeFragment = function makeFragment(children) { */ -var buildCommon_wrapFragment = function wrapFragment(group, options) { - if (group instanceof tree_DocumentFragment) { - return buildCommon_makeSpan([], [group], options); +var wrapFragment = function wrapFragment(group, options) { + if (group instanceof DocumentFragment) { + return makeSpan([], [group], options); } return group; @@ -5740,7 +5615,7 @@ var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { */ -var buildCommon_makeVList = function makeVList(params, options) { +var makeVList = function makeVList(params, options) { var _getVListChildrenAndD = getVListChildrenAndDepth(params), children = _getVListChildrenAndD.children, depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to @@ -5764,7 +5639,7 @@ var buildCommon_makeVList = function makeVList(params, options) { } pstrutSize += 2; - var pstrut = buildCommon_makeSpan(["pstrut"], []); + var pstrut = makeSpan(["pstrut"], []); pstrut.style.height = pstrutSize + "em"; // Create a new list of actual children at the correct offsets var realChildren = []; @@ -5781,7 +5656,7 @@ var buildCommon_makeVList = function makeVList(params, options) { var _elem = _child.elem; var classes = _child.wrapperClasses || []; var style = _child.wrapperStyle || {}; - var childWrap = buildCommon_makeSpan(classes, [pstrut, _elem], undefined, style); + var childWrap = makeSpan(classes, [pstrut, _elem], undefined, style); childWrap.style.top = -pstrutSize - currPos - _elem.depth + "em"; if (_child.marginLeft) { @@ -5803,7 +5678,7 @@ var buildCommon_makeVList = function makeVList(params, options) { // without overly expanding the containing line-box. - var vlist = buildCommon_makeSpan(["vlist"], realChildren); + var vlist = makeSpan(["vlist"], realChildren); vlist.style.height = maxPos + "em"; // A second row is used if necessary to represent the vlist's depth. var rows; @@ -5814,18 +5689,18 @@ var buildCommon_makeVList = function makeVList(params, options) { // contenteditable mode only, treats that span as if it contains some // text content. And that min-height over-rides our desired height. // So we put another empty span inside the depth strut span. - var emptySpan = buildCommon_makeSpan([], []); - var depthStrut = buildCommon_makeSpan(["vlist"], [emptySpan]); + var emptySpan = makeSpan([], []); + var depthStrut = makeSpan(["vlist"], [emptySpan]); depthStrut.style.height = -minPos + "em"; // Safari wants the first row to have inline content; otherwise it // puts the bottom of the *second* row on the baseline. - var topStrut = buildCommon_makeSpan(["vlist-s"], [new domTree_SymbolNode("\u200B")]); - rows = [buildCommon_makeSpan(["vlist-r"], [vlist, topStrut]), buildCommon_makeSpan(["vlist-r"], [depthStrut])]; + var topStrut = makeSpan(["vlist-s"], [new SymbolNode("\u200B")]); + rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])]; } else { - rows = [buildCommon_makeSpan(["vlist-r"], [vlist])]; + rows = [makeSpan(["vlist-r"], [vlist])]; } - var vtable = buildCommon_makeSpan(["vlist-t"], rows); + var vtable = makeSpan(["vlist-t"], rows); if (rows.length === 2) { vtable.classes.push("vlist-t2"); @@ -5839,10 +5714,10 @@ var buildCommon_makeVList = function makeVList(params, options) { // static space between elements in a horizontal layout. -var buildCommon_makeGlue = function makeGlue(measurement, options) { +var makeGlue = function makeGlue(measurement, options) { // Make an empty span for the space - var rule = buildCommon_makeSpan(["mspace"], [], options); - var size = units_calculateSize(measurement, options); + var rule = makeSpan(["mspace"], [], options); + var size = calculateSize(measurement, options); rule.style.marginRight = size + "em"; return rule; }; // Takes font options, and returns the appropriate fontLookup name @@ -5954,18 +5829,16 @@ var svgData = { // oval to overlay the integrand oiintSize2: ["oiintSize2", 1.472, 0.659], oiiintSize1: ["oiiintSize1", 1.304, 0.499], - oiiintSize2: ["oiiintSize2", 1.98, 0.659], - leftParenInner: ["leftParenInner", 0.875, 0.3], - rightParenInner: ["rightParenInner", 0.875, 0.3] + oiiintSize2: ["oiiintSize2", 1.98, 0.659] }; -var buildCommon_staticSvg = function staticSvg(value, options) { +var staticSvg = function staticSvg(value, options) { // Create a span with inline SVG for the element. var _svgData$value = svgData[value], pathName = _svgData$value[0], width = _svgData$value[1], height = _svgData$value[2]; - var path = new domTree_PathNode(pathName); + var path = new PathNode(pathName); var svgNode = new SvgNode([path], { "width": width + "em", "height": height + "em", @@ -5974,7 +5847,7 @@ var buildCommon_staticSvg = function staticSvg(value, options) { "viewBox": "0 0 " + 1000 * width + " " + 1000 * height, "preserveAspectRatio": "xMinYMin" }); - var span = buildCommon_makeSvgSpan(["overlay"], [svgNode], options); + var span = makeSvgSpan(["overlay"], [svgNode], options); span.height = height; span.style.height = height + "em"; span.style.width = width + "em"; @@ -5983,22 +5856,22 @@ var buildCommon_staticSvg = function staticSvg(value, options) { /* harmony default export */ var buildCommon = ({ fontMap: fontMap, - makeSymbol: buildCommon_makeSymbol, - mathsym: buildCommon_mathsym, - makeSpan: buildCommon_makeSpan, - makeSvgSpan: buildCommon_makeSvgSpan, + makeSymbol: makeSymbol, + mathsym: mathsym, + makeSpan: makeSpan, + makeSvgSpan: makeSvgSpan, makeLineSpan: makeLineSpan, - makeAnchor: buildCommon_makeAnchor, - makeFragment: buildCommon_makeFragment, - wrapFragment: buildCommon_wrapFragment, - makeVList: buildCommon_makeVList, - makeOrd: buildCommon_makeOrd, - makeGlue: buildCommon_makeGlue, - staticSvg: buildCommon_staticSvg, + makeAnchor: makeAnchor, + makeFragment: makeFragment, + wrapFragment: wrapFragment, + makeVList: makeVList, + makeOrd: makeOrd, + makeGlue: makeGlue, + staticSvg: staticSvg, svgData: svgData, - tryCombineChars: buildCommon_tryCombineChars + tryCombineChars: tryCombineChars }); -// CONCATENATED MODULE: ./src/spacingData.js +;// CONCATENATED MODULE: ./src/spacingData.js /** * Describes spaces between different classes of atoms. */ @@ -6091,7 +5964,7 @@ var tightSpacings = { mop: thinspace } }; -// CONCATENATED MODULE: ./src/defineFunction.js +;// CONCATENATED MODULE: ./src/defineFunction.js /** Context provided to function handlers for error messages. */ // Note: reverse the order of the return type union will cause a flow error. // See https://github.com/facebook/flow/issues/3663. @@ -6137,11 +6010,12 @@ function defineFunction(_ref) { type: type, numArgs: props.numArgs, argTypes: props.argTypes, - greediness: props.greediness === undefined ? 1 : props.greediness, + allowedInArgument: !!props.allowedInArgument, allowedInText: !!props.allowedInText, allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath, numOptionalArgs: props.numOptionalArgs || 0, infix: !!props.infix, + primitive: !!props.primitive, handler: handler }; @@ -6181,13 +6055,16 @@ function defineFunctionBuilders(_ref2) { htmlBuilder: htmlBuilder, mathmlBuilder: mathmlBuilder }); -} // Since the corresponding buildHTML/buildMathML function expects a +} +var normalizeArgument = function normalizeArgument(arg) { + return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg; +}; // Since the corresponding buildHTML/buildMathML function expects a // list of elements, we normalize for different kinds of arguments var ordargument = function ordargument(arg) { return arg.type === "ordgroup" ? arg.body : [arg]; }; -// CONCATENATED MODULE: ./src/buildHTML.js +;// CONCATENATED MODULE: ./src/buildHTML.js /** * This file does the main work of building a domTree structure from a parse * tree. The entry point is the `buildHTML` function, which takes a parse tree. @@ -6233,7 +6110,7 @@ var DomEnum = { * a partial group (e.g. one created by \color). `surrounding` is an array * consisting type of nodes that will be added to the left and right. */ -var buildHTML_buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) { +var buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) { if (surrounding === void 0) { surrounding = [null, null]; } @@ -6242,18 +6119,20 @@ var buildHTML_buildExpression = function buildExpression(expression, options, is var groups = []; for (var i = 0; i < expression.length; i++) { - var output = buildHTML_buildGroup(expression[i], options); + var output = buildGroup(expression[i], options); - if (output instanceof tree_DocumentFragment) { + if (output instanceof DocumentFragment) { var children = output.children; groups.push.apply(groups, children); } else { groups.push(output); } - } // If `expression` is a partial group, let the parent handle spacings - // to avoid processing groups multiple times. + } // Combine consecutive domTree.symbolNodes into a single symbolNode. + buildCommon.tryCombineChars(groups); // If `expression` is a partial group, let the parent handle spacings + // to avoid processing groups multiple times. + if (!isRealGroup) { return groups; } @@ -6323,7 +6202,7 @@ var traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev for (; i < nodes.length; i++) { var node = nodes[i]; - var partialGroup = buildHTML_checkPartialGroup(node); + var partialGroup = checkPartialGroup(node); if (partialGroup) { // Recursive DFS @@ -6370,8 +6249,8 @@ var traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev }; // Check if given node is a partial group, i.e., does not affect spacing around. -var buildHTML_checkPartialGroup = function checkPartialGroup(node) { - if (node instanceof tree_DocumentFragment || node instanceof domTree_Anchor || node instanceof domTree_Span && node.hasClass("enclosing")) { +var checkPartialGroup = function checkPartialGroup(node) { + if (node instanceof DocumentFragment || node instanceof Anchor || node instanceof Span && node.hasClass("enclosing")) { return node; } @@ -6380,7 +6259,7 @@ var buildHTML_checkPartialGroup = function checkPartialGroup(node) { var getOutermostNode = function getOutermostNode(node, side) { - var partialGroup = buildHTML_checkPartialGroup(node); + var partialGroup = checkPartialGroup(node); if (partialGroup) { var children = partialGroup.children; @@ -6422,13 +6301,14 @@ var makeNullDelimiter = function makeNullDelimiter(options, classes) { * between parents and children. */ -var buildHTML_buildGroup = function buildGroup(group, options, baseOptions) { +var buildGroup = function buildGroup(group, options, baseOptions) { if (!group) { return buildHTML_makeSpan(); } if (_htmlGroupBuilders[group.type]) { // Call the groupBuilders function + // $FlowFixMe var groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account // for that size difference. @@ -6479,7 +6359,14 @@ function buildHTML(tree, options) { } // Build the expression contained in the tree - var expression = buildHTML_buildExpression(tree, options, "root"); + var expression = buildExpression(tree, options, "root"); + var eqnNum; + + if (expression.length === 2 && expression[1].hasClass("tag")) { + // An environment with automatic equation numbers, e.g. {gather}. + eqnNum = expression.pop(); + } + var children = []; // Create one base node for each chunk between potential line breaks. // The TeXBook [p.173] says "A formula will be broken only after a // relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary @@ -6533,9 +6420,11 @@ function buildHTML(tree, options) { var tagChild; if (tag) { - tagChild = buildHTMLUnbreakable(buildHTML_buildExpression(tag, options, true)); + tagChild = buildHTMLUnbreakable(buildExpression(tag, options, true)); tagChild.classes = ["tag"]; children.push(tagChild); + } else if (eqnNum) { + children.push(eqnNum); } var htmlNode = buildHTML_makeSpan(["katex-html"], children); @@ -6550,7 +6439,7 @@ function buildHTML(tree, options) { return htmlNode; } -// CONCATENATED MODULE: ./src/mathMLTree.js +;// CONCATENATED MODULE: ./src/mathMLTree.js /** * These objects store data about MathML nodes. This is the MathML equivalent * of the types in domTree.js. Since MathML handles its own rendering, and @@ -6562,8 +6451,9 @@ function buildHTML(tree, options) { */ + function newDocumentFragment(children) { - return new tree_DocumentFragment(children); + return new DocumentFragment(children); } /** * This node represents a general purpose MathML node of any type. The @@ -6571,16 +6461,16 @@ function newDocumentFragment(children) { * `"mspace"`, corresponding to `` and `` tags). */ -var mathMLTree_MathNode = -/*#__PURE__*/ -function () { - function MathNode(type, children) { +var MathNode = /*#__PURE__*/function () { + function MathNode(type, children, classes) { this.type = void 0; this.attributes = void 0; this.children = void 0; + this.classes = void 0; this.type = type; this.attributes = {}; this.children = children || []; + this.classes = classes || []; } /** * Sets an attribute on a MathML node. MathML depends on attributes to convey a @@ -6615,6 +6505,10 @@ function () { } } + if (this.classes.length > 0) { + node.className = createClass(this.classes); + } + for (var i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } @@ -6637,6 +6531,10 @@ function () { } } + if (this.classes.length > 0) { + markup += " class =\"" + utils.escape(createClass(this.classes)) + "\""; + } + markup += ">"; for (var i = 0; i < this.children.length; i++) { @@ -6663,9 +6561,7 @@ function () { * This node represents a piece of text. */ -var mathMLTree_TextNode = -/*#__PURE__*/ -function () { +var TextNode = /*#__PURE__*/function () { function TextNode(text) { this.text = void 0; this.text = text; @@ -6706,9 +6602,7 @@ function () { * depending on the width. */ -var SpaceNode = -/*#__PURE__*/ -function () { +var SpaceNode = /*#__PURE__*/function () { /** * Create a Space node with width given in CSS ems. */ @@ -6785,12 +6679,12 @@ function () { }(); /* harmony default export */ var mathMLTree = ({ - MathNode: mathMLTree_MathNode, - TextNode: mathMLTree_TextNode, + MathNode: MathNode, + TextNode: TextNode, SpaceNode: SpaceNode, newDocumentFragment: newDocumentFragment }); -// CONCATENATED MODULE: ./src/buildMathML.js +;// CONCATENATED MODULE: ./src/buildMathML.js /** * This file converts a parse tree into a cooresponding MathML tree. The main * entry point is the `buildMathML` function, which takes a parse tree from the @@ -6809,7 +6703,7 @@ function () { * Takes a symbol and converts it into a MathML text node after performing * optional replacement from symbols.js. */ -var buildMathML_makeText = function makeText(text, mode, options) { +var makeText = function makeText(text, mode, options) { if (src_symbols[mode][text] && src_symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === "tt" || options.font && options.font.substr(4, 2) === "tt"))) { text = src_symbols[mode][text].replace; } @@ -6821,7 +6715,7 @@ var buildMathML_makeText = function makeText(text, mode, options) { * unless the array has length 1. Always returns a single node. */ -var buildMathML_makeRow = function makeRow(body) { +var makeRow = function makeRow(body) { if (body.length === 1) { return body[0]; } else { @@ -6832,7 +6726,7 @@ var buildMathML_makeRow = function makeRow(body) { * Returns the math variant as a string or null if none is required. */ -var buildMathML_getVariant = function getVariant(group, options) { +var getVariant = function getVariant(group, options) { // Handle \text... font specifiers as best we can. // MathML has a limited list of allowable mathvariant specifiers; see // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt @@ -6911,7 +6805,7 @@ var buildMathML_buildExpression = function buildExpression(expression, options, if (expression.length === 1) { var group = buildMathML_buildGroup(expression[0], options); - if (isOrdgroup && group instanceof mathMLTree_MathNode && group.type === "mo") { + if (isOrdgroup && group instanceof MathNode && group.type === "mo") { // When TeX writers want to suppress spacing on an operator, // they often put the operator by itself inside braces. group.setAttribute("lspace", "0em"); @@ -6927,7 +6821,7 @@ var buildMathML_buildExpression = function buildExpression(expression, options, for (var i = 0; i < expression.length; i++) { var _group = buildMathML_buildGroup(expression[i], options); - if (_group instanceof mathMLTree_MathNode && lastGroup instanceof mathMLTree_MathNode) { + if (_group instanceof MathNode && lastGroup instanceof MathNode) { // Concatenate adjacent s if (_group.type === 'mtext' && lastGroup.type === 'mtext' && _group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) { var _lastGroup$children; @@ -6944,7 +6838,7 @@ var buildMathML_buildExpression = function buildExpression(expression, options, } else if (_group.type === 'mi' && _group.children.length === 1 && lastGroup.type === 'mn') { var child = _group.children[0]; - if (child instanceof mathMLTree_TextNode && child.text === '.') { + if (child instanceof TextNode && child.text === '.') { var _lastGroup$children3; (_lastGroup$children3 = lastGroup.children).push.apply(_lastGroup$children3, _group.children); @@ -6954,10 +6848,10 @@ var buildMathML_buildExpression = function buildExpression(expression, options, } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) { var lastChild = lastGroup.children[0]; - if (lastChild instanceof mathMLTree_TextNode && lastChild.text === "\u0338" && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) { + if (lastChild instanceof TextNode && lastChild.text === "\u0338" && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) { var _child = _group.children[0]; - if (_child instanceof mathMLTree_TextNode && _child.text.length > 0) { + if (_child instanceof TextNode && _child.text.length > 0) { // Overlay with combining character long solidus _child.text = _child.text.slice(0, 1) + "\u0338" + _child.text.slice(1); groups.pop(); @@ -6978,7 +6872,7 @@ var buildMathML_buildExpression = function buildExpression(expression, options, */ var buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) { - return buildMathML_makeRow(buildMathML_buildExpression(expression, options, isOrdgroup)); + return makeRow(buildMathML_buildExpression(expression, options, isOrdgroup)); }; /** * Takes a group from the parser and calls the appropriate groupBuilders function @@ -6992,7 +6886,9 @@ var buildMathML_buildGroup = function buildGroup(group, options) { if (_mathmlGroupBuilders[group.type]) { // Call the groupBuilders function - var result = _mathmlGroupBuilders[group.type](group, options); + // $FlowFixMe + var result = _mathmlGroupBuilders[group.type](group, options); // $FlowFixMe + return result; } else { throw new src_ParseError("Got group of unknown type: '" + group.type + "'"); @@ -7008,12 +6904,16 @@ var buildMathML_buildGroup = function buildGroup(group, options) { */ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) { - var expression = buildMathML_buildExpression(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics + var expression = buildMathML_buildExpression(tree, options); // TODO: Make a pass thru the MathML similar to buildHTML.traverseNonSpaceNodes + // and add spacing nodes. This is necessary only adjacent to math operators + // like \sin or \lim or to subsup elements that contain math operators. + // MathML takes care of the other spacing issues. + // Wrap up the expression in an mrow so it is presented in the semantics // tag correctly, unless it's a single or . var wrapper; - if (expression.length === 1 && expression[0] instanceof mathMLTree_MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) { + if (expression.length === 1 && expression[0] instanceof MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) { wrapper = expression[0]; } else { wrapper = new mathMLTree.MathNode("mrow", expression); @@ -7038,7 +6938,7 @@ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) return buildCommon.makeSpan([wrapperClass], [math]); } -// CONCATENATED MODULE: ./src/buildTree.js +;// CONCATENATED MODULE: ./src/buildTree.js @@ -7046,7 +6946,7 @@ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) -var buildTree_optionsFromSettings = function optionsFromSettings(settings) { +var optionsFromSettings = function optionsFromSettings(settings) { return new src_Options({ style: settings.displayMode ? src_Style.DISPLAY : src_Style.TEXT, maxSize: settings.maxSize, @@ -7054,7 +6954,7 @@ var buildTree_optionsFromSettings = function optionsFromSettings(settings) { }); }; -var buildTree_displayWrap = function displayWrap(node, settings) { +var displayWrap = function displayWrap(node, settings) { if (settings.displayMode) { var classes = ["katex-display"]; @@ -7072,8 +6972,8 @@ var buildTree_displayWrap = function displayWrap(node, settings) { return node; }; -var buildTree_buildTree = function buildTree(tree, expression, settings) { - var options = buildTree_optionsFromSettings(settings); +var buildTree = function buildTree(tree, expression, settings) { + var options = optionsFromSettings(settings); var katexNode; if (settings.output === "mathml") { @@ -7089,16 +6989,16 @@ var buildTree_buildTree = function buildTree(tree, expression, settings) { katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]); } - return buildTree_displayWrap(katexNode, settings); + return displayWrap(katexNode, settings); }; -var buildTree_buildHTMLTree = function buildHTMLTree(tree, expression, settings) { - var options = buildTree_optionsFromSettings(settings); +var buildHTMLTree = function buildHTMLTree(tree, expression, settings) { + var options = optionsFromSettings(settings); var htmlNode = buildHTML(tree, options); var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); - return buildTree_displayWrap(katexNode, settings); + return displayWrap(katexNode, settings); }; -/* harmony default export */ var src_buildTree = (buildTree_buildTree); -// CONCATENATED MODULE: ./src/stretchy.js +/* harmony default export */ var src_buildTree = ((/* unused pure expression or super */ null && (buildTree))); +;// CONCATENATED MODULE: ./src/stretchy.js /** * This file provides support to buildMathML.js and buildHTML.js * for stretchy wide elements rendered from SVG files @@ -7148,12 +7048,15 @@ var stretchyCodePoint = { xrightleftarrows: "\u21C4", xrightequilibrium: "\u21CC", // Not a perfect match. - xleftequilibrium: "\u21CB" // None better available. - + xleftequilibrium: "\u21CB", + // None better available. + "\\\\cdrightarrow": "\u2192", + "\\\\cdleftarrow": "\u2190", + "\\\\cdlongequal": "=" }; -var stretchy_mathMLnode = function mathMLnode(label) { - var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.substr(1)])]); +var mathMLnode = function mathMLnode(label) { + var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label])]); node.setAttribute("stretchy", "true"); return node; }; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts. @@ -7201,7 +7104,10 @@ var katexImagesData = { underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], + "\\cdrightarrow": [["rightarrow"], 3.0, 522, "xMaxYMin"], + // CD minwwidth2.5pc xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], + "\\cdleftarrow": [["leftarrow"], 3.0, 522, "xMinYMin"], Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], @@ -7212,6 +7118,7 @@ var katexImagesData = { xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], + "\\cdlongequal": [["longequal"], 3.0, 334, "xMinYMin"], xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], @@ -7247,7 +7154,7 @@ var groupLength = function groupLength(arg) { } }; -var stretchy_svgSpan = function svgSpan(group, options) { +var svgSpan = function svgSpan(group, options) { // Create a span with inline SVG for the element. function buildSvgSpan_() { var viewBoxWidth = 400000; // default @@ -7257,6 +7164,7 @@ var stretchy_svgSpan = function svgSpan(group, options) { if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) { // Each type in the `if` statement corresponds to one of the ParseNode // types below. This narrowing is required to access `grp.base`. + // $FlowFixMe var grp = group; // There are four SVG images available for each function. // Choose a taller image when there are more characters. @@ -7294,7 +7202,7 @@ var stretchy_svgSpan = function svgSpan(group, options) { } } - var path = new domTree_PathNode(pathName); + var path = new PathNode(pathName); var svgNode = new SvgNode([path], { "width": "100%", "height": _height + "em", @@ -7335,7 +7243,7 @@ var stretchy_svgSpan = function svgSpan(group, options) { } for (var i = 0; i < numSvgChildren; i++) { - var _path = new domTree_PathNode(paths[i]); + var _path = new PathNode(paths[i]); var _svgNode = new SvgNode([_path], { "width": "400em", @@ -7384,12 +7292,12 @@ var stretchy_svgSpan = function svgSpan(group, options) { return span; }; -var stretchy_encloseSpan = function encloseSpan(inner, label, pad, options) { - // Return an image span for \cancel, \bcancel, \xcancel, or \fbox +var encloseSpan = function encloseSpan(inner, label, topPad, bottomPad, options) { + // Return an image span for \cancel, \bcancel, \xcancel, \fbox, or \angl var img; - var totalHeight = inner.height + inner.depth + 2 * pad; + var totalHeight = inner.height + inner.depth + topPad + bottomPad; - if (/fbox|color/.test(label)) { + if (/fbox|color|angl/.test(label)) { img = buildCommon.makeSpan(["stretchy", label], [], options); if (label === "fbox") { @@ -7438,11 +7346,11 @@ var stretchy_encloseSpan = function encloseSpan(inner, label, pad, options) { }; /* harmony default export */ var stretchy = ({ - encloseSpan: stretchy_encloseSpan, - mathMLnode: stretchy_mathMLnode, - svgSpan: stretchy_svgSpan + encloseSpan: encloseSpan, + mathMLnode: mathMLnode, + svgSpan: svgSpan }); -// CONCATENATED MODULE: ./src/parseNode.js +;// CONCATENATED MODULE: ./src/parseNode.js /** @@ -7452,7 +7360,8 @@ var stretchy_encloseSpan = function encloseSpan(inner, label, pad, options) { function assertNodeType(node, type) { if (!node || node.type !== type) { throw new Error("Expected node of type " + type + ", but got " + (node ? "node of type " + node.type : String(node))); - } + } // $FlowFixMe, >=0.125 + return node; } @@ -7483,7 +7392,7 @@ function checkSymbolNodeType(node) { return null; } -// CONCATENATED MODULE: ./src/functions/accent.js +;// CONCATENATED MODULE: ./src/functions/accent.js @@ -7494,7 +7403,8 @@ function checkSymbolNodeType(node) { // NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but -var accent_htmlBuilder = function htmlBuilder(grp, options) { +// also "supsub" since an accent can affect super/subscripting. +var htmlBuilder = function htmlBuilder(grp, options) { // Accents are handled in the TeXbook pg. 443, rule 12. var base; var group; @@ -7516,7 +7426,7 @@ var accent_htmlBuilder = function htmlBuilder(grp, options) { grp.base = base; // Rerender the supsub group with its new base, and store that // result. - supSubGroup = assertSpan(buildHTML_buildGroup(grp, options)); // reset original base + supSubGroup = assertSpan(buildGroup(grp, options)); // reset original base grp.base = group; } else { @@ -7525,7 +7435,7 @@ var accent_htmlBuilder = function htmlBuilder(grp, options) { } // Build the base group - var body = buildHTML_buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character? + var body = buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character? var mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the // nucleus is not a single character, let s = 0; otherwise set s to the @@ -7540,7 +7450,7 @@ var accent_htmlBuilder = function htmlBuilder(grp, options) { // innermost character. To do that, we find the innermost character: var baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it - var baseGroup = buildHTML_buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol. + var baseGroup = buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol. skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we // removed with getBaseElem might contain things like \color which @@ -7654,8 +7564,8 @@ var accent_htmlBuilder = function htmlBuilder(grp, options) { } }; -var accent_mathmlBuilder = function mathmlBuilder(group, options) { - var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [buildMathML_makeText(group.label, group.mode)]); +var mathmlBuilder = function mathmlBuilder(group, options) { + var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]); var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.base, options), accentNode]); node.setAttribute("accent", "true"); return node; @@ -7672,7 +7582,7 @@ defineFunction({ numArgs: 1 }, handler: function handler(context, args) { - var base = args[0]; + var base = normalizeArgument(args[0]); var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck"; return { @@ -7684,8 +7594,8 @@ defineFunction({ base: base }; }, - htmlBuilder: accent_htmlBuilder, - mathmlBuilder: accent_mathmlBuilder + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder }); // Text-mode accents defineFunction({ @@ -7694,7 +7604,8 @@ defineFunction({ props: { numArgs: 1, allowedInText: true, - allowedInMath: false + allowedInMath: false, + argTypes: ["primitive"] }, handler: function handler(context, args) { var base = args[0]; @@ -7707,10 +7618,10 @@ defineFunction({ base: base }; }, - htmlBuilder: accent_htmlBuilder, - mathmlBuilder: accent_mathmlBuilder + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder }); -// CONCATENATED MODULE: ./src/functions/accentunder.js +;// CONCATENATED MODULE: ./src/functions/accentunder.js // Horizontal overlap functions @@ -7737,7 +7648,7 @@ defineFunction({ }, htmlBuilder: function htmlBuilder(group, options) { // Treat under accents much like underlines. - var innerGroup = buildHTML_buildGroup(group.base, options); + var innerGroup = buildGroup(group.base, options); var accentBody = stretchy.svgSpan(group, options); var kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns @@ -7765,7 +7676,7 @@ defineFunction({ return node; } }); -// CONCATENATED MODULE: ./src/functions/arrow.js +;// CONCATENATED MODULE: ./src/functions/arrow.js @@ -7774,7 +7685,7 @@ defineFunction({ // Helper function -var arrow_paddedNode = function paddedNode(group) { +var paddedNode = function paddedNode(group) { var node = new mathMLTree.MathNode("mpadded", group ? [group] : []); node.setAttribute("width", "+0.6em"); node.setAttribute("lspace", "0.3em"); @@ -7786,7 +7697,8 @@ defineFunction({ type: "xArrow", names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension. // Direct use of these functions is discouraged and may break someday. - "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium"], + "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium", // The next 3 functions are here only to support the {CD} environment. + "\\\\cdrightarrow", "\\\\cdleftarrow", "\\\\cdlongequal"], props: { numArgs: 1, numOptionalArgs: 1 @@ -7811,15 +7723,16 @@ defineFunction({ // them in a span. var newOptions = options.havingStyle(style.sup()); - var upperGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, newOptions, options), options); - upperGroup.classes.push("x-arrow-pad"); + var upperGroup = buildCommon.wrapFragment(buildGroup(group.body, newOptions, options), options); + var arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd"; + upperGroup.classes.push(arrowPrefix + "-arrow-pad"); var lowerGroup; if (group.below) { // Build the lower group newOptions = options.havingStyle(style.sub()); - lowerGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.below, newOptions, options), options); - lowerGroup.classes.push("x-arrow-pad"); + lowerGroup = buildCommon.wrapFragment(buildGroup(group.below, newOptions, options), options); + lowerGroup.classes.push(arrowPrefix + "-arrow-pad"); } var arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0. @@ -7875,32 +7788,354 @@ defineFunction({ }, mathmlBuilder: function mathmlBuilder(group, options) { var arrowNode = stretchy.mathMLnode(group.label); + arrowNode.setAttribute("minsize", group.label.charAt(0) === "x" ? "1.75em" : "3.0em"); var node; if (group.body) { - var upperNode = arrow_paddedNode(buildMathML_buildGroup(group.body, options)); + var upperNode = paddedNode(buildMathML_buildGroup(group.body, options)); if (group.below) { - var lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options)); + var lowerNode = paddedNode(buildMathML_buildGroup(group.below, options)); node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]); } else { node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]); } } else if (group.below) { - var _lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options)); + var _lowerNode = paddedNode(buildMathML_buildGroup(group.below, options)); node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]); } else { // This should never happen. // Parser.js throws an error if there is no argument. - node = arrow_paddedNode(); + node = paddedNode(); node = new mathMLTree.MathNode("mover", [arrowNode, node]); } return node; } }); -// CONCATENATED MODULE: ./src/functions/char.js +;// CONCATENATED MODULE: ./src/environments/cd.js + + + + + + + +var cdArrowFunctionName = { + ">": "\\\\cdrightarrow", + "<": "\\\\cdleftarrow", + "=": "\\\\cdlongequal", + "A": "\\uparrow", + "V": "\\downarrow", + "|": "\\Vert", + ".": "no arrow" +}; + +var newCell = function newCell() { + // Create an empty cell, to be filled below with parse nodes. + // The parseTree from this module must be constructed like the + // one created by parseArray(), so an empty CD cell must + // be a ParseNode<"styling">. And CD is always displaystyle. + // So these values are fixed and flow can do implicit typing. + return { + type: "styling", + body: [], + mode: "math", + style: "display" + }; +}; + +var isStartOfArrow = function isStartOfArrow(node) { + return node.type === "textord" && node.text === "@"; +}; + +var isLabelEnd = function isLabelEnd(node, endChar) { + return (node.type === "mathord" || node.type === "atom") && node.text === endChar; +}; + +function cdArrow(arrowChar, labels, parser) { + // Return a parse tree of an arrow and its labels. + // This acts in a way similar to a macro expansion. + var funcName = cdArrowFunctionName[arrowChar]; + + switch (funcName) { + case "\\\\cdrightarrow": + case "\\\\cdleftarrow": + return parser.callFunction(funcName, [labels[0]], [labels[1]]); + + case "\\uparrow": + case "\\downarrow": + { + var leftLabel = parser.callFunction("\\\\cdleft", [labels[0]], []); + var bareArrow = { + type: "atom", + text: funcName, + mode: "math", + family: "rel" + }; + var sizedArrow = parser.callFunction("\\Big", [bareArrow], []); + var rightLabel = parser.callFunction("\\\\cdright", [labels[1]], []); + var arrowGroup = { + type: "ordgroup", + mode: "math", + body: [leftLabel, sizedArrow, rightLabel] + }; + return parser.callFunction("\\\\cdparent", [arrowGroup], []); + } + + case "\\\\cdlongequal": + return parser.callFunction("\\\\cdlongequal", [], []); + + case "\\Vert": + { + var arrow = { + type: "textord", + text: "\\Vert", + mode: "math" + }; + return parser.callFunction("\\Big", [arrow], []); + } + + default: + return { + type: "textord", + text: " ", + mode: "math" + }; + } +} + +function parseCD(parser) { + // Get the array's parse nodes with \\ temporarily mapped to \cr. + var parsedRows = []; + parser.gullet.beginGroup(); + parser.gullet.macros.set("\\cr", "\\\\\\relax"); + parser.gullet.beginGroup(); + + while (true) { + // eslint-disable-line no-constant-condition + // Get the parse nodes for the next row. + parsedRows.push(parser.parseExpression(false, "\\\\")); + parser.gullet.endGroup(); + parser.gullet.beginGroup(); + var next = parser.fetch().text; + + if (next === "&" || next === "\\\\") { + parser.consume(); + } else if (next === "\\end") { + if (parsedRows[parsedRows.length - 1].length === 0) { + parsedRows.pop(); // final row ended in \\ + } + + break; + } else { + throw new src_ParseError("Expected \\\\ or \\cr or \\end", parser.nextToken); + } + } + + var row = []; + var body = [row]; // Loop thru the parse nodes. Collect them into cells and arrows. + + for (var i = 0; i < parsedRows.length; i++) { + // Start a new row. + var rowNodes = parsedRows[i]; // Create the first cell. + + var cell = newCell(); + + for (var j = 0; j < rowNodes.length; j++) { + if (!isStartOfArrow(rowNodes[j])) { + // If a parseNode is not an arrow, it goes into a cell. + cell.body.push(rowNodes[j]); + } else { + // Parse node j is an "@", the start of an arrow. + // Before starting on the arrow, push the cell into `row`. + row.push(cell); // Now collect parseNodes into an arrow. + // The character after "@" defines the arrow type. + + j += 1; + var arrowChar = assertSymbolNodeType(rowNodes[j]).text; // Create two empty label nodes. We may or may not use them. + + var labels = new Array(2); + labels[0] = { + type: "ordgroup", + mode: "math", + body: [] + }; + labels[1] = { + type: "ordgroup", + mode: "math", + body: [] + }; // Process the arrow. + + if ("=|.".indexOf(arrowChar) > -1) {// Three "arrows", ``@=`, `@|`, and `@.`, do not take labels. + // Do nothing here. + } else if ("<>AV".indexOf(arrowChar) > -1) { + // Four arrows, `@>>>`, `@<<<`, `@AAA`, and `@VVV`, each take + // two optional labels. E.g. the right-point arrow syntax is + // really: @>{optional label}>{optional label}> + // Collect parseNodes into labels. + for (var labelNum = 0; labelNum < 2; labelNum++) { + var inLabel = true; + + for (var k = j + 1; k < rowNodes.length; k++) { + if (isLabelEnd(rowNodes[k], arrowChar)) { + inLabel = false; + j = k; + break; + } + + if (isStartOfArrow(rowNodes[k])) { + throw new src_ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[k]); + } + + labels[labelNum].body.push(rowNodes[k]); + } + + if (inLabel) { + // isLabelEnd never returned a true. + throw new src_ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[j]); + } + } + } else { + throw new src_ParseError("Expected one of \"<>AV=|.\" after @", rowNodes[j]); + } // Now join the arrow to its labels. + + + var arrow = cdArrow(arrowChar, labels, parser); // Wrap the arrow in ParseNode<"styling">. + // This is done to match parseArray() behavior. + + var wrappedArrow = { + type: "styling", + body: [arrow], + mode: "math", + style: "display" // CD is always displaystyle. + + }; + row.push(wrappedArrow); // In CD's syntax, cells are implicit. That is, everything that + // is not an arrow gets collected into a cell. So create an empty + // cell now. It will collect upcoming parseNodes. + + cell = newCell(); + } + } + + if (i % 2 === 0) { + // Even-numbered rows consist of: cell, arrow, cell, arrow, ... cell + // The last cell is not yet pushed into `row`, so: + row.push(cell); + } else { + // Odd-numbered rows consist of: vert arrow, empty cell, ... vert arrow + // Remove the empty cell that was placed at the beginning of `row`. + row.shift(); + } + + row = []; + body.push(row); + } // End row group + + + parser.gullet.endGroup(); // End array group defining \\ + + parser.gullet.endGroup(); // define column separation. + + var cols = new Array(body[0].length).fill({ + type: "align", + align: "c", + pregap: 0.25, + // CD package sets \enskip between columns. + postgap: 0.25 // So pre and post each get half an \enskip, i.e. 0.25em. + + }); + return { + type: "array", + mode: "math", + body: body, + arraystretch: 1, + addJot: true, + rowGaps: [null], + cols: cols, + colSeparationType: "CD", + hLinesBeforeRow: new Array(body.length + 1).fill([]) + }; +} // The functions below are not available for general use. +// They are here only for internal use by the {CD} environment in placing labels +// next to vertical arrows. +// We don't need any such functions for horizontal arrows because we can reuse +// the functionality that already exists for extensible arrows. + +defineFunction({ + type: "cdlabel", + names: ["\\\\cdleft", "\\\\cdright"], + props: { + numArgs: 1 + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + return { + type: "cdlabel", + mode: parser.mode, + side: funcName.slice(4), + label: args[0] + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var newOptions = options.havingStyle(options.style.sup()); + var label = buildCommon.wrapFragment(buildGroup(group.label, newOptions, options), options); + label.classes.push("cd-label-" + group.side); + label.style.bottom = 0.8 - label.depth + "em"; // Zero out label height & depth, so vertical align of arrow is set + // by the arrow height, not by the label. + + label.height = 0; + label.depth = 0; + return label; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var label = new mathMLTree.MathNode("mrow", [buildMathML_buildGroup(group.label, options)]); + label = new mathMLTree.MathNode("mpadded", [label]); + label.setAttribute("width", "0"); + + if (group.side === "left") { + label.setAttribute("lspace", "-1width"); + } // We have to guess at vertical alignment. We know the arrow is 1.8em tall, + // But we don't know the height or depth of the label. + + + label.setAttribute("voffset", "0.7em"); + label = new mathMLTree.MathNode("mstyle", [label]); + label.setAttribute("displaystyle", "false"); + label.setAttribute("scriptlevel", "1"); + return label; + } +}); +defineFunction({ + type: "cdlabelparent", + names: ["\\\\cdparent"], + props: { + numArgs: 1 + }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + return { + type: "cdlabelparent", + mode: parser.mode, + fragment: args[0] + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Wrap the vertical arrow and its labels. + // The parent gets position: relative. The child gets position: absolute. + // So CSS can locate the label correctly. + var parent = buildCommon.wrapFragment(buildGroup(group.fragment, options), options); + parent.classes.push("cd-vert-arrow"); + return parent; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + return new mathMLTree.MathNode("mrow", [buildMathML_buildGroup(group.fragment, options)]); + } +}); +;// CONCATENATED MODULE: ./src/functions/char.js // \@char is an internal function that takes a grouped decimal argument like @@ -7938,7 +8173,7 @@ defineFunction({ }; } }); -// CONCATENATED MODULE: ./src/functions/color.js +;// CONCATENATED MODULE: ./src/functions/color.js @@ -7947,7 +8182,7 @@ defineFunction({ var color_htmlBuilder = function htmlBuilder(group, options) { - var elements = buildHTML_buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains. + var elements = buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains. // To accomplish this, we wrap the results in a fragment, so the inner // elements will be able to directly interact with their neighbors. For // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` @@ -7968,7 +8203,6 @@ defineFunction({ props: { numArgs: 2, allowedInText: true, - greediness: 3, argTypes: ["color", "original"] }, handler: function handler(_ref, args) { @@ -7991,7 +8225,6 @@ defineFunction({ props: { numArgs: 1, allowedInText: true, - greediness: 3, argTypes: ["color"] }, handler: function handler(_ref2, args) { @@ -8015,21 +8248,17 @@ defineFunction({ htmlBuilder: color_htmlBuilder, mathmlBuilder: color_mathmlBuilder }); -// CONCATENATED MODULE: ./src/functions/cr.js +;// CONCATENATED MODULE: ./src/functions/cr.js // Row breaks within tabular environments, and line breaks at top level - - // \\ is a macro mapping to either \cr or \newline. Because they have the -// same signature, we implement them as one megafunction, with newRow -// indicating whether we're in the \cr case, and newLine indicating whether -// to break the line in the \newline case. + // \DeclareRobustCommand\\{...\@xnewline} defineFunction({ type: "cr", - names: ["\\cr", "\\newline"], + names: ["\\\\"], props: { numArgs: 0, numOptionalArgs: 1, @@ -8037,42 +8266,26 @@ defineFunction({ allowedInText: true }, handler: function handler(_ref, args, optArgs) { - var parser = _ref.parser, - funcName = _ref.funcName; + var parser = _ref.parser; var size = optArgs[0]; - var newRow = funcName === "\\cr"; - var newLine = false; - - if (!newRow) { - if (parser.settings.displayMode && parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode")) { - newLine = false; - } else { - newLine = true; - } - } - + var newLine = !parser.settings.displayMode || !parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode"); return { type: "cr", mode: parser.mode, newLine: newLine, - newRow: newRow, size: size && assertNodeType(size, "size").value }; }, // The following builders are called only at the top level, // not within tabular/array environments. htmlBuilder: function htmlBuilder(group, options) { - if (group.newRow) { - throw new src_ParseError("\\cr valid only within a tabular/array environment"); - } - var span = buildCommon.makeSpan(["mspace"], [], options); if (group.newLine) { span.classes.push("newline"); if (group.size) { - span.style.marginTop = units_calculateSize(group.size, options) + "em"; + span.style.marginTop = calculateSize(group.size, options) + "em"; } } @@ -8085,14 +8298,14 @@ defineFunction({ node.setAttribute("linebreak", "newline"); if (group.size) { - node.setAttribute("height", units_calculateSize(group.size, options) + "em"); + node.setAttribute("height", calculateSize(group.size, options) + "em"); } } return node; } }); -// CONCATENATED MODULE: ./src/functions/def.js +;// CONCATENATED MODULE: ./src/functions/def.js @@ -8108,7 +8321,7 @@ var globalMap = { "\\futurelet": "\\\\globalfuture" }; -var def_checkControlSequence = function checkControlSequence(tok) { +var checkControlSequence = function checkControlSequence(tok) { var name = tok.text; if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { @@ -8158,7 +8371,8 @@ var letCommand = function letCommand(parser, name, tok, global) { defineFunction({ type: "internal", - names: ["\\global", "\\long", "\\\\globallong"], + names: ["\\global", "\\long", "\\\\globallong" // can’t be entered directly + ], props: { numArgs: 0, allowedInText: true @@ -8190,51 +8404,76 @@ defineFunction({ names: ["\\def", "\\gdef", "\\edef", "\\xdef"], props: { numArgs: 0, - allowedInText: true + allowedInText: true, + primitive: true }, handler: function handler(_ref2) { var parser = _ref2.parser, funcName = _ref2.funcName; - var arg = parser.gullet.consumeArgs(1)[0]; + var tok = parser.gullet.popToken(); + var name = tok.text; - if (arg.length !== 1) { - throw new src_ParseError("\\gdef's first argument must be a macro name"); + if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { + throw new src_ParseError("Expected a control sequence", tok); } - var name = arg[0].text; // Count argument specifiers, and check they are in the order #1 #2 ... - var numArgs = 0; - arg = parser.gullet.consumeArgs(1)[0]; + var insert; + var delimiters = [[]]; // contains no braces - while (arg.length === 1 && arg[0].text === "#") { - arg = parser.gullet.consumeArgs(1)[0]; + while (parser.gullet.future().text !== "{") { + tok = parser.gullet.popToken(); - if (arg.length !== 1) { - throw new src_ParseError("Invalid argument number length \"" + arg.length + "\""); + if (tok.text === "#") { + // If the very last character of the is #, so that + // this # is immediately followed by {, TeX will behave as if the { + // had been inserted at the right end of both the parameter text + // and the replacement text. + if (parser.gullet.future().text === "{") { + insert = parser.gullet.future(); + delimiters[numArgs].push("{"); + break; + } // A parameter, the first appearance of # must be followed by 1, + // the next by 2, and so on; up to nine #’s are allowed + + + tok = parser.gullet.popToken(); + + if (!/^[1-9]$/.test(tok.text)) { + throw new src_ParseError("Invalid argument number \"" + tok.text + "\""); + } + + if (parseInt(tok.text) !== numArgs + 1) { + throw new src_ParseError("Argument number \"" + tok.text + "\" out of order"); + } + + numArgs++; + delimiters.push([]); + } else if (tok.text === "EOF") { + throw new src_ParseError("Expected a macro definition"); + } else { + delimiters[numArgs].push(tok.text); } + } // replacement text, enclosed in '{' and '}' and properly nested - if (!/^[1-9]$/.test(arg[0].text)) { - throw new src_ParseError("Invalid argument number \"" + arg[0].text + "\""); - } - numArgs++; + var _parser$gullet$consum = parser.gullet.consumeArg(), + tokens = _parser$gullet$consum.tokens; - if (parseInt(arg[0].text) !== numArgs) { - throw new src_ParseError("Argument number \"" + arg[0].text + "\" out of order"); - } - - arg = parser.gullet.consumeArgs(1)[0]; + if (insert) { + tokens.unshift(insert); } if (funcName === "\\edef" || funcName === "\\xdef") { - arg = parser.gullet.expandTokens(arg); - arg.reverse(); // to fit in with stack order + tokens = parser.gullet.expandTokens(tokens); + tokens.reverse(); // to fit in with stack order } // Final arg is the expansion of the macro parser.gullet.macros.set(name, { - tokens: arg, - numArgs: numArgs + tokens: tokens, + numArgs: numArgs, + delimiters: delimiters }, funcName === globalMap[funcName]); return { type: "internal", @@ -8248,15 +8487,17 @@ defineFunction({ defineFunction({ type: "internal", - names: ["\\let", "\\\\globallet"], + names: ["\\let", "\\\\globallet" // can’t be entered directly + ], props: { numArgs: 0, - allowedInText: true + allowedInText: true, + primitive: true }, handler: function handler(_ref3) { var parser = _ref3.parser, funcName = _ref3.funcName; - var name = def_checkControlSequence(parser.gullet.popToken()); + var name = checkControlSequence(parser.gullet.popToken()); parser.gullet.consumeSpaces(); var tok = getRHS(parser); letCommand(parser, name, tok, funcName === "\\\\globallet"); @@ -8269,15 +8510,17 @@ defineFunction({ defineFunction({ type: "internal", - names: ["\\futurelet", "\\\\globalfuture"], + names: ["\\futurelet", "\\\\globalfuture" // can’t be entered directly + ], props: { numArgs: 0, - allowedInText: true + allowedInText: true, + primitive: true }, handler: function handler(_ref4) { var parser = _ref4.parser, funcName = _ref4.funcName; - var name = def_checkControlSequence(parser.gullet.popToken()); + var name = checkControlSequence(parser.gullet.popToken()); var middle = parser.gullet.popToken(); var tok = parser.gullet.popToken(); letCommand(parser, name, tok, funcName === "\\\\globalfuture"); @@ -8289,7 +8532,7 @@ defineFunction({ }; } }); -// CONCATENATED MODULE: ./src/delimiter.js +;// CONCATENATED MODULE: ./src/delimiter.js /** * This file deals with creating delimiters of various sizes. The TeXbook * discusses these routines on page 441-442, in the "Another subroutine sets box @@ -8320,11 +8563,12 @@ defineFunction({ + /** * Get the metrics for a given symbol and font, after transformation (i.e. * after following replacement from symbols.js) */ -var delimiter_getMetrics = function getMetrics(symbol, font, mode) { +var getMetrics = function getMetrics(symbol, font, mode) { var replace = src_symbols.math[symbol] && src_symbols.math[symbol].replace; var metrics = getCharacterMetrics(replace || symbol, font, mode); @@ -8340,7 +8584,7 @@ var delimiter_getMetrics = function getMetrics(symbol, font, mode) { */ -var delimiter_styleWrap = function styleWrap(delim, toStyle, options, classes) { +var styleWrap = function styleWrap(delim, toStyle, options, classes) { var newOptions = options.havingBaseStyle(toStyle); var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options); var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; @@ -8365,9 +8609,9 @@ var centerSpan = function centerSpan(span, options, style) { */ -var delimiter_makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { +var makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); - var span = delimiter_styleWrap(text, style, options, classes); + var span = styleWrap(text, style, options, classes); if (center) { centerSpan(span, options, style); @@ -8380,7 +8624,7 @@ var delimiter_makeSmallDelim = function makeSmallDelim(delim, style, center, opt */ -var delimiter_mathrmSize = function mathrmSize(value, size, mode, options) { +var mathrmSize = function mathrmSize(value, size, mode, options) { return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options); }; /** @@ -8389,9 +8633,9 @@ var delimiter_mathrmSize = function mathrmSize(value, size, mode, options) { */ -var delimiter_makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { - var inner = delimiter_mathrmSize(delim, size, mode, options); - var span = delimiter_styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), src_Style.TEXT, options, classes); +var makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { + var inner = mathrmSize(delim, size, mode, options); + var span = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), src_Style.TEXT, options, classes); if (center) { centerSpan(span, options, src_Style.TEXT); @@ -8400,12 +8644,12 @@ var delimiter_makeLargeDelim = function makeLargeDelim(delim, size, center, opti return span; }; /** - * Make an inner span with the given offset and in the given font. This is used - * in `makeStackedDelim` to make the stacking pieces for the delimiter. + * Make a span from a font glyph with the given offset and in the given font. + * This is used in makeStackedDelim to make the stacking pieces for the delimiter. */ -var delimiter_makeInner = function makeInner(symbol, font, mode) { +var makeGlyphSpan = function makeGlyphSpan(symbol, font, mode) { var sizeClass; // Apply the correct CSS class to choose the right font. if (font === "Size1-Regular") { @@ -8416,26 +8660,51 @@ var delimiter_makeInner = function makeInner(symbol, font, mode) { sizeClass = "delim-size4"; } - var inner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element + var corner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element // in the appropriate tag that VList uses. return { type: "elem", - elem: inner + elem: corner }; -}; // Helper for makeStackedDelim +}; + +var makeInner = function makeInner(ch, height, options) { + // Create a span with inline SVG for the inner part of a tall stacked delimiter. + var width = fontMetricsData["Size4-Regular"][ch.charCodeAt(0)] ? fontMetricsData["Size4-Regular"][ch.charCodeAt(0)][4].toFixed(3) : fontMetricsData["Size1-Regular"][ch.charCodeAt(0)][4].toFixed(3); + var path = new PathNode("inner", innerPath(ch, Math.round(1000 * height))); + var svgNode = new SvgNode([path], { + "width": width + "em", + "height": height + "em", + // Override CSS rule `.katex svg { width: 100% }` + "style": "width:" + width + "em", + "viewBox": "0 0 " + 1000 * width + " " + Math.round(1000 * height), + "preserveAspectRatio": "xMinYMin" + }); + var span = buildCommon.makeSvgSpan([], [svgNode], options); + span.height = height; + span.style.height = height + "em"; + span.style.width = width + "em"; + return { + type: "elem", + elem: span + }; +}; // Helpers for makeStackedDelim +var lapInEms = 0.008; var lap = { type: "kern", - size: -0.005 + size: -1 * lapInEms }; +var verts = ["|", "\\lvert", "\\rvert", "\\vert"]; +var doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"]; /** * Make a stacked delimiter out of a given delimiter, with the total height at * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook. */ -var delimiter_makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { +var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { // There are four parts, the top, an optional middle, a repeated part, and a // bottom. var top; @@ -8465,6 +8734,10 @@ var delimiter_makeStackedDelim = function makeStackedDelim(delim, heightTotal, c top = "\\Uparrow"; repeat = "\u2016"; bottom = "\\Downarrow"; + } else if (utils.contains(verts, delim)) { + repeat = "\u2223"; + } else if (utils.contains(doubleVerts, delim)) { + repeat = "\u2225"; } else if (delim === "[" || delim === "\\lbrack") { top = "\u23A1"; repeat = "\u23A2"; @@ -8536,17 +8809,17 @@ var delimiter_makeStackedDelim = function makeStackedDelim(delim, heightTotal, c } // Get the metrics of the four sections - var topMetrics = delimiter_getMetrics(top, font, mode); + var topMetrics = getMetrics(top, font, mode); var topHeightTotal = topMetrics.height + topMetrics.depth; - var repeatMetrics = delimiter_getMetrics(repeat, font, mode); + var repeatMetrics = getMetrics(repeat, font, mode); var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; - var bottomMetrics = delimiter_getMetrics(bottom, font, mode); + var bottomMetrics = getMetrics(bottom, font, mode); var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; var middleHeightTotal = 0; var middleFactor = 1; if (middle !== null) { - var middleMetrics = delimiter_getMetrics(middle, font, mode); + var middleMetrics = getMetrics(middle, font, mode); middleHeightTotal = middleMetrics.height + middleMetrics.depth; middleFactor = 2; // repeat symmetrically above and below middle } // Calcuate the minimal height that the delimiter can have. @@ -8569,91 +8842,43 @@ var delimiter_makeStackedDelim = function makeStackedDelim(delim, heightTotal, c } // Calculate the depth - var depth = realHeightTotal / 2 - axisHeight; // This function differs from the TeX procedure in one way. - // We shift each repeat element downwards by 0.005em, to prevent a gap - // due to browser floating point rounding error. - // Then, at the last element-to element joint, we add one extra repeat - // element to cover the gap created by the shifts. - // Find the shift needed to align the upper end of the extra element at a point - // 0.005em above the lower end of the top element. + var depth = realHeightTotal / 2 - axisHeight; // Now, we start building the pieces that will go into the vlist + // Keep a list of the pieces of the stacked delimiter - var shiftOfExtraElement = (repeatCount + 1) * 0.005 - repeatHeightTotal; // Now, we start building the pieces that will go into the vlist - // Keep a list of the inner pieces + var stack = []; // Add the bottom symbol - var inners = []; // Add the bottom symbol - - inners.push(delimiter_makeInner(bottom, font, mode)); + stack.push(makeGlyphSpan(bottom, font, mode)); + stack.push(lap); // overlap if (middle === null) { - // Add that many symbols - for (var i = 0; i < repeatCount; i++) { - inners.push(lap); // overlap - - inners.push(delimiter_makeInner(repeat, font, mode)); - } + // The middle section will be an SVG. Make it an extra 0.016em tall. + // We'll overlap by 0.008em at top and bottom. + var innerHeight = realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms; + stack.push(makeInner(repeat, innerHeight, options)); } else { // When there is a middle bit, we need the middle part and two repeated // sections - for (var _i = 0; _i < repeatCount; _i++) { - inners.push(lap); - inners.push(delimiter_makeInner(repeat, font, mode)); - } // Insert one extra repeat element. + var _innerHeight = (realHeightTotal - topHeightTotal - bottomHeightTotal - middleHeightTotal) / 2 + 2 * lapInEms; + stack.push(makeInner(repeat, _innerHeight, options)); // Now insert the middle of the brace. - inners.push({ - type: "kern", - size: shiftOfExtraElement - }); - inners.push(delimiter_makeInner(repeat, font, mode)); - inners.push(lap); // Now insert the middle of the brace. - - inners.push(delimiter_makeInner(middle, font, mode)); - - for (var _i2 = 0; _i2 < repeatCount; _i2++) { - inners.push(lap); - inners.push(delimiter_makeInner(repeat, font, mode)); - } - } // To cover the gap create by the overlaps, insert one more repeat element, - // at a position that juts 0.005 above the bottom of the top element. - - - if ((repeat === "\u239C" || repeat === "\u239F") && repeatCount === 0) { - // Parentheses need a short repeat element in order to avoid an overrun. - // We'll make a 0.3em tall element from a SVG. - var overlap = buildCommon.svgData.leftParenInner[2] / 2; - inners.push({ - type: "kern", - size: -overlap - }); - var pathName = repeat === "\u239C" ? "leftParenInner" : "rightParenInner"; - var innerSpan = buildCommon.staticSvg(pathName, options); - inners.push({ - type: "elem", - elem: innerSpan - }); - inners.push({ - type: "kern", - size: -overlap - }); - } else { - inners.push({ - type: "kern", - size: shiftOfExtraElement - }); - inners.push(delimiter_makeInner(repeat, font, mode)); - inners.push(lap); + stack.push(lap); + stack.push(makeGlyphSpan(middle, font, mode)); + stack.push(lap); + stack.push(makeInner(repeat, _innerHeight, options)); } // Add the top symbol - inners.push(delimiter_makeInner(top, font, mode)); // Finally, build the vlist + stack.push(lap); + stack.push(makeGlyphSpan(top, font, mode)); // Finally, build the vlist var newOptions = options.havingBaseStyle(src_Style.TEXT); var inner = buildCommon.makeVList({ positionType: "bottom", positionData: depth, - children: inners + children: stack }, newOptions); - return delimiter_styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), src_Style.TEXT, options, classes); + return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), src_Style.TEXT, options, classes); }; // All surds have 0.08em padding above the viniculum inside the SVG. // That keeps browser span height rounding error from pinching the line. @@ -8662,9 +8887,9 @@ var vbPad = 80; // padding above the surd, measured inside the viewBox. var emPad = 0.08; // padding, in ems, measured in the document. -var delimiter_sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) { +var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) { var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight); - var pathNode = new domTree_PathNode(sqrtName, path); + var pathNode = new PathNode(sqrtName, path); var svg = new SvgNode([pathNode], { // Note: 1000:1 ratio of viewBox to document em width. "width": "400em", @@ -8714,7 +8939,7 @@ var makeSqrtImage = function makeSqrtImage(height, options) { spanHeight = (1.0 + extraViniculum + emPad) / sizeMultiplier; texHeight = (1.00 + extraViniculum) / sizeMultiplier; - span = delimiter_sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraViniculum, options); + span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "0.853em"; advanceWidth = 0.833 / sizeMultiplier; // from the font. } else if (delim.type === "large") { @@ -8722,7 +8947,7 @@ var makeSqrtImage = function makeSqrtImage(height, options) { viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size]; texHeight = (sizeToMaxHeight[delim.size] + extraViniculum) / sizeMultiplier; spanHeight = (sizeToMaxHeight[delim.size] + extraViniculum + emPad) / sizeMultiplier; - span = delimiter_sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraViniculum, options); + span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "1.02em"; advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font. } else { @@ -8731,7 +8956,7 @@ var makeSqrtImage = function makeSqrtImage(height, options) { spanHeight = height + extraViniculum + emPad; texHeight = height + extraViniculum; viewBoxHeight = Math.floor(1000 * height + extraViniculum) + vbPad; - span = delimiter_sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraViniculum, options); + span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "0.742em"; advanceWidth = 1.056; } @@ -8764,7 +8989,7 @@ var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4. */ -var delimiter_makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { +var makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { // < and > turn into \langle and \rangle in delimiters if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { delim = "\\langle"; @@ -8774,9 +8999,9 @@ var delimiter_makeSizedDelim = function makeSizedDelim(delim, size, options, mod if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) { - return delimiter_makeLargeDelim(delim, size, false, options, mode, classes); + return makeLargeDelim(delim, size, false, options, mode, classes); } else if (utils.contains(stackAlwaysDelimiters, delim)) { - return delimiter_makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes); + return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes); } else { throw new src_ParseError("Illegal delimiter: '" + delim + "'"); } @@ -8891,7 +9116,7 @@ var traverseSequence = function traverseSequence(delim, height, sequence, option break; } - var metrics = delimiter_getMetrics(delim, delimTypeToFont(sequence[i]), "math"); + var metrics = getMetrics(delim, delimTypeToFont(sequence[i]), "math"); var heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we // account for the style change size. @@ -8915,7 +9140,7 @@ var traverseSequence = function traverseSequence(delim, height, sequence, option */ -var delimiter_makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { +var makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { delim = "\\langle"; } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { @@ -8939,13 +9164,13 @@ var delimiter_makeCustomSizedDelim = function makeCustomSizedDelim(delim, height // appropriate function. if (delimType.type === "small") { - return delimiter_makeSmallDelim(delim, delimType.style, center, options, mode, classes); + return makeSmallDelim(delim, delimType.style, center, options, mode, classes); } else if (delimType.type === "large") { - return delimiter_makeLargeDelim(delim, delimType.size, center, options, mode, classes); + return makeLargeDelim(delim, delimType.size, center, options, mode, classes); } else /* if (delimType.type === "stack") */ { - return delimiter_makeStackedDelim(delim, height, center, options, mode, classes); + return makeStackedDelim(delim, height, center, options, mode, classes); } }; /** @@ -8973,16 +9198,17 @@ var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, optio maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total // height - return delimiter_makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes); + return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes); }; /* harmony default export */ var delimiter = ({ sqrtImage: makeSqrtImage, - sizedDelim: delimiter_makeSizedDelim, - customSizedDelim: delimiter_makeCustomSizedDelim, + sizedDelim: makeSizedDelim, + sizeToMaxHeight: sizeToMaxHeight, + customSizedDelim: makeCustomSizedDelim, leftRightDelim: makeLeftRightDelim }); -// CONCATENATED MODULE: ./src/functions/delimsizing.js +;// CONCATENATED MODULE: ./src/functions/delimsizing.js @@ -9078,7 +9304,8 @@ defineFunction({ type: "delimsizing", names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], props: { - numArgs: 1 + numArgs: 1, + argTypes: ["primitive"] }, handler: function handler(context, args) { var delim = checkDelimiter(args[0], context); @@ -9104,7 +9331,7 @@ defineFunction({ var children = []; if (group.delim !== ".") { - children.push(buildMathML_makeText(group.delim, group.mode)); + children.push(makeText(group.delim, group.mode)); } var node = new mathMLTree.MathNode("mo", children); @@ -9119,6 +9346,9 @@ defineFunction({ node.setAttribute("fence", "false"); } + node.setAttribute("stretchy", "true"); + node.setAttribute("minsize", delimiter.sizeToMaxHeight[group.size] + "em"); + node.setAttribute("maxsize", delimiter.sizeToMaxHeight[group.size] + "em"); return node; } }); @@ -9133,7 +9363,8 @@ defineFunction({ type: "leftright-right", names: ["\\right"], props: { - numArgs: 1 + numArgs: 1, + primitive: true }, handler: function handler(context, args) { // \left case below triggers parsing of \right in @@ -9158,7 +9389,8 @@ defineFunction({ type: "leftright", names: ["\\left"], props: { - numArgs: 1 + numArgs: 1, + primitive: true }, handler: function handler(context, args) { var delim = checkDelimiter(args[0], context); @@ -9183,7 +9415,7 @@ defineFunction({ htmlBuilder: function htmlBuilder(group, options) { assertParsed(group); // Build the inner expression - var inner = buildHTML_buildExpression(group.body, options, true, ["mopen", "mclose"]); + var inner = buildExpression(group.body, options, true, ["mopen", "mclose"]); var innerHeight = 0; var innerDepth = 0; var hadMiddle = false; // Calculate its height and depth @@ -9252,13 +9484,13 @@ defineFunction({ var inner = buildMathML_buildExpression(group.body, options); if (group.left !== ".") { - var leftNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.left, group.mode)]); + var leftNode = new mathMLTree.MathNode("mo", [makeText(group.left, group.mode)]); leftNode.setAttribute("fence", "true"); inner.unshift(leftNode); } if (group.right !== ".") { - var rightNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.right, group.mode)]); + var rightNode = new mathMLTree.MathNode("mo", [makeText(group.right, group.mode)]); rightNode.setAttribute("fence", "true"); if (group.rightColor) { @@ -9268,14 +9500,15 @@ defineFunction({ inner.push(rightNode); } - return buildMathML_makeRow(inner); + return makeRow(inner); } }); defineFunction({ type: "middle", names: ["\\middle"], props: { - numArgs: 1 + numArgs: 1, + primitive: true }, handler: function handler(context, args) { var delim = checkDelimiter(args[0], context); @@ -9316,7 +9549,7 @@ defineFunction({ // is in the fence part of the operator dictionary at: // https://www.w3.org/TR/MathML3/appendixc.html. // So we need to avoid U+2223 and use plain "|" instead. - var textNode = group.delim === "\\vert" || group.delim === "|" ? buildMathML_makeText("|", "text") : buildMathML_makeText(group.delim, group.mode); + var textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode); var middleNode = new mathMLTree.MathNode("mo", [textNode]); middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each element. // \middle should get delimiter spacing instead. @@ -9326,7 +9559,10 @@ defineFunction({ return middleNode; } }); -// CONCATENATED MODULE: ./src/functions/enclose.js +;// CONCATENATED MODULE: ./src/functions/enclose.js + + + @@ -9337,10 +9573,10 @@ defineFunction({ var enclose_htmlBuilder = function htmlBuilder(group, options) { - // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox + // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox, \phase // Some groups can return document fragments. Handle those by wrapping // them in a span. - var inner = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, options), options); + var inner = buildCommon.wrapFragment(buildGroup(group.body, options), options); var label = group.label.substr(1); var scale = options.sizeMultiplier; var img; @@ -9356,37 +9592,79 @@ var enclose_htmlBuilder = function htmlBuilder(group, options) { img = buildCommon.makeSpan(["stretchy", "sout"]); img.height = options.fontMetrics().defaultRuleThickness / scale; imgShift = -0.5 * options.fontMetrics().xHeight; + } else if (label === "phase") { + // Set a couple of dimensions from the steinmetz package. + var lineWeight = calculateSize({ + number: 0.6, + unit: "pt" + }, options); + var clearance = calculateSize({ + number: 0.35, + unit: "ex" + }, options); // Prevent size changes like \Huge from affecting line thickness + + var newOptions = options.havingBaseSizing(); + scale = scale / newOptions.sizeMultiplier; + var angleHeight = inner.height + inner.depth + lineWeight + clearance; // Reserve a left pad for the angle. + + inner.style.paddingLeft = angleHeight / 2 + lineWeight + "em"; // Create an SVG + + var viewBoxHeight = Math.floor(1000 * angleHeight * scale); + var path = phasePath(viewBoxHeight); + var svgNode = new SvgNode([new PathNode("phase", path)], { + "width": "400em", + "height": viewBoxHeight / 1000 + "em", + "viewBox": "0 0 400000 " + viewBoxHeight, + "preserveAspectRatio": "xMinYMin slice" + }); // Wrap it in a span with overflow: hidden. + + img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode], options); + img.style.height = angleHeight + "em"; + imgShift = inner.depth + lineWeight + clearance; } else { // Add horizontal padding if (/cancel/.test(label)) { if (!isSingleChar) { inner.classes.push("cancel-pad"); } + } else if (label === "angl") { + inner.classes.push("anglpad"); } else { inner.classes.push("boxpad"); } // Add vertical padding - var vertPad = 0; + var topPad = 0; + var bottomPad = 0; var ruleThickness = 0; // ref: cancel package: \advance\totalheight2\p@ % "+2" if (/box/.test(label)) { ruleThickness = Math.max(options.fontMetrics().fboxrule, // default options.minRuleThickness // User override. ); - vertPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness); + topPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness); + bottomPad = topPad; + } else if (label === "angl") { + ruleThickness = Math.max(options.fontMetrics().defaultRuleThickness, options.minRuleThickness); + topPad = 4 * ruleThickness; // gap = 3 × line, plus the line itself. + + bottomPad = Math.max(0, 0.25 - inner.depth); } else { - vertPad = isSingleChar ? 0.2 : 0; + topPad = isSingleChar ? 0.2 : 0; + bottomPad = topPad; } - img = stretchy.encloseSpan(inner, label, vertPad, options); + img = stretchy.encloseSpan(inner, label, topPad, bottomPad, options); if (/fbox|boxed|fcolorbox/.test(label)) { img.style.borderStyle = "solid"; img.style.borderWidth = ruleThickness + "em"; + } else if (label === "angl" && ruleThickness !== 0.049) { + img.style.borderTopWidth = ruleThickness + "em"; + img.style.borderRightWidth = ruleThickness + "em"; } - imgShift = inner.depth + vertPad; + imgShift = inner.depth + bottomPad; if (group.backgroundColor) { img.style.backgroundColor = group.backgroundColor; @@ -9414,6 +9692,7 @@ var enclose_htmlBuilder = function htmlBuilder(group, options) { }] }, options); } else { + var classes = /cancel|phase/.test(label) ? ["svg-align"] : []; vlist = buildCommon.makeVList({ positionType: "individualShift", children: [// Write the \cancel stroke on top of inner. @@ -9425,7 +9704,7 @@ var enclose_htmlBuilder = function htmlBuilder(group, options) { type: "elem", elem: img, shift: imgShift, - wrapperClasses: /cancel/.test(label) ? ["svg-align"] : [] + wrapperClasses: classes }] }, options); } @@ -9458,6 +9737,10 @@ var enclose_mathmlBuilder = function mathmlBuilder(group, options) { node.setAttribute("notation", "downdiagonalstrike"); break; + case "\\phase": + node.setAttribute("notation", "phasorangle"); + break; + case "\\sout": node.setAttribute("notation", "horizontalstrike"); break; @@ -9466,6 +9749,10 @@ var enclose_mathmlBuilder = function mathmlBuilder(group, options) { node.setAttribute("notation", "box"); break; + case "\\angl": + node.setAttribute("notation", "actuarial"); + break; + case "\\fcolorbox": case "\\colorbox": // doesn't have a good notation option. So use @@ -9504,7 +9791,6 @@ defineFunction({ props: { numArgs: 2, allowedInText: true, - greediness: 3, argTypes: ["color", "text"] }, handler: function handler(_ref, args, optArgs) { @@ -9529,7 +9815,6 @@ defineFunction({ props: { numArgs: 3, allowedInText: true, - greediness: 3, argTypes: ["color", "color", "text"] }, handler: function handler(_ref2, args, optArgs) { @@ -9570,11 +9855,11 @@ defineFunction({ }); defineFunction({ type: "enclose", - names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout"], + names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"], props: { numArgs: 1 }, - handler: function handler(_ref4, args, optArgs) { + handler: function handler(_ref4, args) { var parser = _ref4.parser, funcName = _ref4.funcName; var body = args[0]; @@ -9588,7 +9873,25 @@ defineFunction({ htmlBuilder: enclose_htmlBuilder, mathmlBuilder: enclose_mathmlBuilder }); -// CONCATENATED MODULE: ./src/defineEnvironment.js +defineFunction({ + type: "enclose", + names: ["\\angl"], + props: { + numArgs: 1, + argTypes: ["hbox"], + allowedInText: false + }, + handler: function handler(_ref5, args) { + var parser = _ref5.parser; + return { + type: "enclose", + mode: parser.mode, + label: "\\angl", + body: args[0] + }; + } +}); +;// CONCATENATED MODULE: ./src/defineEnvironment.js /** @@ -9608,7 +9911,6 @@ function defineEnvironment(_ref) { var data = { type: type, numArgs: props.numArgs || 0, - greediness: 1, allowedInText: false, numOptionalArgs: 0, handler: handler @@ -9618,7 +9920,6 @@ function defineEnvironment(_ref) { // TODO: The value type of _environments should be a type union of all // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is // an existential type. - // $FlowFixMe _environments[names[i]] = data; } @@ -9630,7 +9931,7 @@ function defineEnvironment(_ref) { _mathmlGroupBuilders[type] = mathmlBuilder; } } -// CONCATENATED MODULE: ./src/environments/array.js +;// CONCATENATED MODULE: ./src/environments/array.js @@ -9644,6 +9945,8 @@ function defineEnvironment(_ref) { + +// Helper functions function getHLines(parser) { // Return an array. The array length = number of hlines. // Each element in the array tells if the line is dashed. @@ -9660,6 +9963,14 @@ function getHLines(parser) { return hlineInfo; } + +var validateAmsEnvironmentContext = function validateAmsEnvironmentContext(context) { + var settings = context.parser.settings; + + if (!settings.displayMode) { + throw new src_ParseError("{" + context.envName + "} can be used only in" + " display mode."); + } +}; /** * Parse the body of the environment, with rows delimited by \\ and * columns delimited by &, and create a nested list in row-major order @@ -9673,10 +9984,19 @@ function parseArray(parser, _ref, style) { addJot = _ref.addJot, cols = _ref.cols, arraystretch = _ref.arraystretch, - colSeparationType = _ref.colSeparationType; - // Parse body of array with \\ temporarily mapped to \cr + colSeparationType = _ref.colSeparationType, + addEqnNum = _ref.addEqnNum, + singleRow = _ref.singleRow, + maxNumCols = _ref.maxNumCols, + leqno = _ref.leqno; parser.gullet.beginGroup(); - parser.gullet.macros.set("\\\\", "\\cr"); // Get current arraystretch if it's not set by the environment + + if (!singleRow) { + // \cr is equivalent to \\ without the optional size argument (see below) + // TODO: provide helpful error when \cr is used outside array environment + parser.gullet.macros.set("\\cr", "\\\\\\relax"); + } // Get current arraystretch if it's not set by the environment + if (!arraystretch) { var stretch = parser.gullet.expandMacroAsText("\\arraystretch"); @@ -9705,7 +10025,7 @@ function parseArray(parser, _ref, style) { while (true) { // eslint-disable-line no-constant-condition // Parse each cell in its own group (namespace) - var cell = parser.parseExpression(false, "\\cr"); + var cell = parser.parseExpression(false, singleRow ? "\\end" : "\\\\"); parser.gullet.endGroup(); parser.gullet.beginGroup(); cell = { @@ -9727,6 +10047,16 @@ function parseArray(parser, _ref, style) { var next = parser.fetch().text; if (next === "&") { + if (maxNumCols && row.length === maxNumCols) { + if (singleRow || colSeparationType) { + // {equation} or {split} + throw new src_ParseError("Too many tab characters: &", parser.nextToken); + } else { + // {array} environment + parser.settings.reportNonstrict("textEnv", "Too few columns " + "specified in the {array} column argument."); + } + } + parser.consume(); } else if (next === "\\end") { // Arrays terminate newlines with `\crcr` which consumes a `\cr` if @@ -9741,9 +10071,19 @@ function parseArray(parser, _ref, style) { } break; - } else if (next === "\\cr") { - var cr = assertNodeType(parser.parseFunction(), "cr"); - rowGaps.push(cr.size); // check for \hline(s) following the row separator + } else if (next === "\\\\") { + parser.consume(); + var size = void 0; // \def\Let@{\let\\\math@cr} + // \def\math@cr{...\math@cr@} + // \def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}} + // \def\math@cr@@[#1]{...\math@cr@@@...} + // \def\math@cr@@@{\cr} + + if (parser.gullet.future().text !== " ") { + size = parser.parseSizeGroup(true); + } + + rowGaps.push(size ? size.value : null); // check for \hline(s) following the row separator hLinesBeforeRow.push(getHLines(parser)); row = []; @@ -9754,7 +10094,7 @@ function parseArray(parser, _ref, style) { } // End cell group - parser.gullet.endGroup(); // End array group defining \\ + parser.gullet.endGroup(); // End array group defining \cr parser.gullet.endGroup(); return { @@ -9767,7 +10107,9 @@ function parseArray(parser, _ref, style) { rowGaps: rowGaps, hskipBeforeAndAfter: hskipBeforeAndAfter, hLinesBeforeRow: hLinesBeforeRow, - colSeparationType: colSeparationType + colSeparationType: colSeparationType, + addEqnNum: addEqnNum, + leqno: leqno }; } // Decides on a style for cells in an array according to whether the given // environment name starts with the letter 'd'. @@ -9807,7 +10149,10 @@ var array_htmlBuilder = function htmlBuilder(group, options) { } // Vertical spacing - var baselineskip = 12 * pt; // see size10.clo + var baselineskip = group.colSeparationType === "CD" ? calculateSize({ + number: 3, + unit: "ex" + }, options) : 12 * pt; // see size10.clo // Default \jot from ltmath.dtx // TODO(edemaine): allow overriding \jot via \setlength (#687) @@ -9847,7 +10192,7 @@ var array_htmlBuilder = function htmlBuilder(group, options) { var outrow = new Array(inrow.length); for (c = 0; c < inrow.length; ++c) { - var elt = buildHTML_buildGroup(inrow[c], options); + var elt = buildGroup(inrow[c], options); if (depth < elt.depth) { depth = elt.depth; @@ -9864,7 +10209,7 @@ var array_htmlBuilder = function htmlBuilder(group, options) { var gap = 0; if (rowGap) { - gap = units_calculateSize(rowGap, options); + gap = calculateSize(rowGap, options); if (gap > 0) { // \@argarraycr @@ -9901,6 +10246,24 @@ var array_htmlBuilder = function htmlBuilder(group, options) { var cols = []; var colSep; var colDescrNum; + var eqnNumSpans = []; + + if (group.addEqnNum) { + // An environment with automatic equation numbers. + // Create node(s) that will trigger CSS counter increment. + for (r = 0; r < nr; ++r) { + var rw = body[r]; + var shift = rw.pos - offset; + var eqnTag = buildCommon.makeSpan(["eqn-num"], [], options); + eqnTag.depth = rw.depth; + eqnTag.height = rw.height; + eqnNumSpans.push({ + type: "elem", + elem: eqnTag, + shift: shift + }); + } + } for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column // descriptions, so trailing separators don't get lost. @@ -9961,13 +10324,14 @@ var array_htmlBuilder = function htmlBuilder(group, options) { continue; } - var shift = row.pos - offset; + var _shift = row.pos - offset; + elem.depth = row.depth; elem.height = row.height; col.push({ type: "elem", elem: elem, - shift: shift + shift: _shift }); } @@ -10025,7 +10389,16 @@ var array_htmlBuilder = function htmlBuilder(group, options) { }, options); } - return buildCommon.makeSpan(["mord"], [body], options); + if (!group.addEqnNum) { + return buildCommon.makeSpan(["mord"], [body], options); + } else { + var eqnNumCol = buildCommon.makeVList({ + positionType: "individualShift", + children: eqnNumSpans + }, options); + eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options); + return buildCommon.makeFragment([body, eqnNumCol]); + } }; var alignMap = { @@ -10035,11 +10408,33 @@ var alignMap = { }; var array_mathmlBuilder = function mathmlBuilder(group, options) { - var table = new mathMLTree.MathNode("mtable", group.body.map(function (row) { - return new mathMLTree.MathNode("mtr", row.map(function (cell) { - return new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(cell, options)]); - })); - })); // Set column alignment, row spacing, column spacing, and + var tbl = []; + var glue = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]); + var tag = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]); + + for (var i = 0; i < group.body.length; i++) { + var rw = group.body[i]; + var row = []; + + for (var j = 0; j < rw.length; j++) { + row.push(new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(rw[j], options)])); + } + + if (group.addEqnNum) { + row.unshift(glue); + row.push(glue); + + if (group.leqno) { + row.unshift(tag); + } else { + row.push(tag); + } + } + + tbl.push(new mathMLTree.MathNode("mtr", row)); + } + + var table = new mathMLTree.MathNode("mtable", tbl); // Set column alignment, row spacing, column spacing, and // array lines by setting attributes on the table element. // Set the row spacing. In MathML, we specify a gap distance. // We do not use rowGap[] because MathML automatically increases @@ -10052,7 +10447,7 @@ var array_mathmlBuilder = function mathmlBuilder(group, options) { var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray} : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0); - table.setAttribute("rowspacing", gap + "em"); // MathML table lines go only between cells. + table.setAttribute("rowspacing", gap.toFixed(4) + "em"); // MathML table lines go only between cells. // To place a line on an edge we'll use , if necessary. var menclose = ""; @@ -10076,20 +10471,20 @@ var array_mathmlBuilder = function mathmlBuilder(group, options) { iEnd -= 1; } - for (var i = iStart; i < iEnd; i++) { - if (cols[i].type === "align") { - align += alignMap[cols[i].align]; + for (var _i = iStart; _i < iEnd; _i++) { + if (cols[_i].type === "align") { + align += alignMap[cols[_i].align]; if (prevTypeWasAlign) { columnLines += "none "; } prevTypeWasAlign = true; - } else if (cols[i].type === "separator") { + } else if (cols[_i].type === "separator") { // MathML accepts only single lines between cells. // So we read only the first of consecutive separators. if (prevTypeWasAlign) { - columnLines += cols[i].separator === "|" ? "solid " : "dashed "; + columnLines += cols[_i].separator === "|" ? "solid " : "dashed "; prevTypeWasAlign = false; } } @@ -10108,15 +10503,17 @@ var array_mathmlBuilder = function mathmlBuilder(group, options) { var spacing = ""; - for (var _i = 1; _i < _cols.length; _i++) { - spacing += _i % 2 ? "0em " : "1em "; + for (var _i2 = 1; _i2 < _cols.length; _i2++) { + spacing += _i2 % 2 ? "0em " : "1em "; } table.setAttribute("columnspacing", spacing.trim()); - } else if (group.colSeparationType === "alignat") { + } else if (group.colSeparationType === "alignat" || group.colSeparationType === "gather") { table.setAttribute("columnspacing", "0em"); } else if (group.colSeparationType === "small") { table.setAttribute("columnspacing", "0.2778em"); + } else if (group.colSeparationType === "CD") { + table.setAttribute("columnspacing", "0.5em"); } else { table.setAttribute("columnspacing", "1em"); } // Address \hline and \hdashline @@ -10127,9 +10524,9 @@ var array_mathmlBuilder = function mathmlBuilder(group, options) { menclose += hlines[0].length > 0 ? "left " : ""; menclose += hlines[hlines.length - 1].length > 0 ? "right " : ""; - for (var _i2 = 1; _i2 < hlines.length - 1; _i2++) { - rowLines += hlines[_i2].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element. - : hlines[_i2][0] ? "dashed " : "solid "; + for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) { + rowLines += hlines[_i3].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element. + : hlines[_i3][0] ? "dashed " : "solid "; } if (/[sd]/.test(rowLines)) { @@ -10148,14 +10545,23 @@ var array_mathmlBuilder = function mathmlBuilder(group, options) { } return table; -}; // Convenience function for aligned and alignedat environments. +}; // Convenience function for align, align*, aligned, alignat, alignat*, alignedat. -var array_alignedHandler = function alignedHandler(context, args) { +var alignedHandler = function alignedHandler(context, args) { + if (context.envName.indexOf("ed") === -1) { + validateAmsEnvironmentContext(context); + } + var cols = []; + var separationType = context.envName.indexOf("at") > -1 ? "alignat" : "align"; var res = parseArray(context.parser, { cols: cols, - addJot: true + addJot: true, + addEqnNum: context.envName === "align" || context.envName === "alignat", + colSeparationType: separationType, + maxNumCols: context.envName === "split" ? 2 : undefined, + leqno: context.parser.settings.leqno }, "display"); // Determining number of columns. // 1. If the first argument is given, we use it as a number of columns, // and makes sure that each row doesn't exceed that number. @@ -10188,9 +10594,9 @@ var array_alignedHandler = function alignedHandler(context, args) { var isAligned = !numCols; res.body.forEach(function (row) { - for (var _i3 = 1; _i3 < row.length; _i3 += 2) { + for (var _i4 = 1; _i4 < row.length; _i4 += 2) { // Modify ordgroup node within styling node - var styling = assertNodeType(row[_i3], "styling"); + var styling = assertNodeType(row[_i4], "styling"); var ordgroup = assertNodeType(styling.body[0], "ordgroup"); ordgroup.body.unshift(emptyGroup); } @@ -10210,18 +10616,18 @@ var array_alignedHandler = function alignedHandler(context, args) { // In aligned mode, we add one \qquad between columns; // otherwise we add nothing. - for (var _i4 = 0; _i4 < numCols; ++_i4) { + for (var _i5 = 0; _i5 < numCols; ++_i5) { var align = "r"; var pregap = 0; - if (_i4 % 2 === 1) { + if (_i5 % 2 === 1) { align = "l"; - } else if (_i4 > 0 && isAligned) { + } else if (_i5 > 0 && isAligned) { // "aligned" mode. pregap = 1; // add one \quad } - cols[_i4] = { + cols[_i5] = { type: "align", align: align, pregap: pregap, @@ -10275,8 +10681,9 @@ defineEnvironment({ }); var res = { cols: cols, - hskipBeforeAndAfter: true // \@preamble in lttab.dtx - + hskipBeforeAndAfter: true, + // \@preamble in lttab.dtx + maxNumCols: cols.length }; return parseArray(context.parser, res, dCellStyle(context.envName)); }, @@ -10284,10 +10691,12 @@ defineEnvironment({ mathmlBuilder: array_mathmlBuilder }); // The matrix environments of amsmath builds on the array environment // of LaTeX, which is discussed above. +// The mathtools package adds starred versions of the same environments. +// These have an optional argument to choose left|center|right justification. defineEnvironment({ type: "array", - names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"], + names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"], props: { numArgs: 0 }, @@ -10299,12 +10708,49 @@ defineEnvironment({ "Bmatrix": ["\\{", "\\}"], "vmatrix": ["|", "|"], "Vmatrix": ["\\Vert", "\\Vert"] - }[context.envName]; // \hskip -\arraycolsep in amsmath + }[context.envName.replace("*", "")]; // \hskip -\arraycolsep in amsmath + var colAlign = "c"; var payload = { - hskipBeforeAndAfter: false + hskipBeforeAndAfter: false, + cols: [{ + type: "align", + align: colAlign + }] }; - var res = parseArray(context.parser, payload, dCellStyle(context.envName)); + + if (context.envName.charAt(context.envName.length - 1) === "*") { + // It's one of the mathtools starred functions. + // Parse the optional alignment argument. + var parser = context.parser; + parser.consumeSpaces(); + + if (parser.fetch().text === "[") { + parser.consume(); + parser.consumeSpaces(); + colAlign = parser.fetch().text; + + if ("lcr".indexOf(colAlign) === -1) { + throw new src_ParseError("Expected l or c or r", parser.nextToken); + } + + parser.consume(); + parser.consumeSpaces(); + parser.expect("]"); + parser.consume(); + payload.cols = [{ + type: "align", + align: colAlign + }]; + } + } + + var res = parseArray(context.parser, payload, dCellStyle(context.envName)); // Populate cols with the correct number of column alignment specs. + + res.cols = new Array(res.body[0].length).fill({ + type: "align", + align: colAlign + }); return delimiters ? { type: "leftright", mode: context.mode, @@ -10424,18 +10870,20 @@ defineEnvironment({ }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder -}); // An aligned environment is like the align* environment -// except it operates within math mode. +}); // In the align environment, one uses ampersands, &, to specify number of +// columns in each row, and to locate spacing between each column. +// align gets automatic numbering. align* and aligned do not. +// The alignedat environment can be used in math mode. // Note that we assume \nomallineskiplimit to be zero, // so that \strut@ is the same as \strut. defineEnvironment({ type: "array", - names: ["aligned"], + names: ["align", "align*", "aligned", "split"], props: { numArgs: 0 }, - handler: array_alignedHandler, + handler: alignedHandler, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // A gathered environment is like an array environment with one centered @@ -10444,17 +10892,24 @@ defineEnvironment({ defineEnvironment({ type: "array", - names: ["gathered"], + names: ["gathered", "gather", "gather*"], props: { numArgs: 0 }, handler: function handler(context) { + if (utils.contains(["gather", "gather*"], context.envName)) { + validateAmsEnvironmentContext(context); + } + var res = { cols: [{ type: "align", align: "c" }], - addJot: true + addJot: true, + colSeparationType: "gather", + addEqnNum: context.envName === "gather", + leqno: context.parser.settings.leqno }; return parseArray(context.parser, res, "display"); }, @@ -10466,14 +10921,43 @@ defineEnvironment({ defineEnvironment({ type: "array", - names: ["alignedat"], - // One for numbered and for unnumbered; - // but, KaTeX doesn't supports math numbering yet, - // they make no difference for now. + names: ["alignat", "alignat*", "alignedat"], props: { numArgs: 1 }, - handler: array_alignedHandler, + handler: alignedHandler, + htmlBuilder: array_htmlBuilder, + mathmlBuilder: array_mathmlBuilder +}); +defineEnvironment({ + type: "array", + names: ["equation", "equation*"], + props: { + numArgs: 0 + }, + handler: function handler(context) { + validateAmsEnvironmentContext(context); + var res = { + addEqnNum: context.envName === "equation", + singleRow: true, + maxNumCols: 1, + leqno: context.parser.settings.leqno + }; + return parseArray(context.parser, res, "display"); + }, + htmlBuilder: array_htmlBuilder, + mathmlBuilder: array_mathmlBuilder +}); +defineEnvironment({ + type: "array", + names: ["CD"], + props: { + numArgs: 0 + }, + handler: function handler(context) { + validateAmsEnvironmentContext(context); + return parseCD(context.parser); + }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // Catch \hline outside array environment @@ -10491,19 +10975,18 @@ defineFunction({ throw new src_ParseError(context.funcName + " valid only within array environment"); } }); -// CONCATENATED MODULE: ./src/environments.js +;// CONCATENATED MODULE: ./src/environments.js var environments = _environments; /* harmony default export */ var src_environments = (environments); // All environment definitions should be imported below -// CONCATENATED MODULE: ./src/functions/environment.js +;// CONCATENATED MODULE: ./src/functions/environment.js // Environment delimiters. HTML/MathML rendering is defined in the corresponding // defineEnvironment definitions. -// $FlowFixMe, "environment" handler returns an environment ParseNode defineFunction({ type: "environment", @@ -10553,7 +11036,8 @@ defineFunction({ if (end.name !== envName) { throw new src_ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end.name + "}", endNameToken); - } + } // $FlowFixMe, "environment" handler returns an environment ParseNode + return result; } @@ -10566,7 +11050,7 @@ defineFunction({ }; } }); -// CONCATENATED MODULE: ./src/functions/mclass.js +;// CONCATENATED MODULE: ./src/functions/mclass.js @@ -10576,7 +11060,7 @@ defineFunction({ var mclass_makeSpan = buildCommon.makeSpan; function mclass_htmlBuilder(group, options) { - var elements = buildHTML_buildExpression(group.body, options, true); + var elements = buildExpression(group.body, options, true); return mclass_makeSpan([group.mclass], elements, options); } @@ -10626,7 +11110,8 @@ defineFunction({ type: "mclass", names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], props: { - numArgs: 1 + numArgs: 1, + primitive: true }, handler: function handler(_ref, args) { var parser = _ref.parser, @@ -10671,7 +11156,7 @@ defineFunction({ type: "mclass", mode: parser.mode, mclass: binrelClass(args[0]), - body: [args[1]], + body: ordargument(args[1]), isCharacterBox: utils.isCharacterBox(args[1]) }; } @@ -10725,7 +11210,7 @@ defineFunction({ htmlBuilder: mclass_htmlBuilder, mathmlBuilder: mclass_mathmlBuilder }); -// CONCATENATED MODULE: ./src/functions/font.js +;// CONCATENATED MODULE: ./src/functions/font.js // TODO(kevinb): implement \\sl and \\sc @@ -10736,7 +11221,7 @@ defineFunction({ var font_htmlBuilder = function htmlBuilder(group, options) { var font = group.font; var newOptions = options.withFont(font); - return buildHTML_buildGroup(group.body, newOptions); + return buildGroup(group.body, newOptions); }; var font_mathmlBuilder = function mathmlBuilder(group, options) { @@ -10759,12 +11244,12 @@ defineFunction({ "\\Bbb", "\\bold", "\\frak"], props: { numArgs: 1, - greediness: 2 + allowedInArgument: true }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; - var body = args[0]; + var body = normalizeArgument(args[0]); var func = funcName; if (func in fontAliases) { @@ -10785,8 +11270,7 @@ defineFunction({ type: "mclass", names: ["\\boldsymbol", "\\bm"], props: { - numArgs: 1, - greediness: 2 + numArgs: 1 }, handler: function handler(_ref2, args) { var parser = _ref2.parser; @@ -10837,7 +11321,7 @@ defineFunction({ htmlBuilder: font_htmlBuilder, mathmlBuilder: font_mathmlBuilder }); -// CONCATENATED MODULE: ./src/functions/genfrac.js +;// CONCATENATED MODULE: ./src/functions/genfrac.js @@ -10849,7 +11333,7 @@ defineFunction({ -var genfrac_adjustStyle = function adjustStyle(size, originalStyle) { +var adjustStyle = function adjustStyle(size, originalStyle) { // Figure out what style this fraction should be in based on the // function used var style = originalStyle; @@ -10872,12 +11356,12 @@ var genfrac_adjustStyle = function adjustStyle(size, originalStyle) { var genfrac_htmlBuilder = function htmlBuilder(group, options) { // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). - var style = genfrac_adjustStyle(group.size, options.style); + var style = adjustStyle(group.size, options.style); var nstyle = style.fracNum(); var dstyle = style.fracDen(); var newOptions; newOptions = options.havingStyle(nstyle); - var numerm = buildHTML_buildGroup(group.numer, newOptions, options); + var numerm = buildGroup(group.numer, newOptions, options); if (group.continued) { // \cfrac inserts a \strut into the numerator. @@ -10889,14 +11373,14 @@ var genfrac_htmlBuilder = function htmlBuilder(group, options) { } newOptions = options.havingStyle(dstyle); - var denomm = buildHTML_buildGroup(group.denom, newOptions, options); + var denomm = buildGroup(group.denom, newOptions, options); var rule; var ruleWidth; var ruleSpacing; if (group.hasBarLine) { if (group.barSize) { - ruleWidth = units_calculateSize(group.barSize, options); + ruleWidth = calculateSize(group.barSize, options); rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth); } else { rule = buildCommon.makeLineSpan("frac-line", options); @@ -11031,11 +11515,11 @@ var genfrac_mathmlBuilder = function mathmlBuilder(group, options) { if (!group.hasBarLine) { node.setAttribute("linethickness", "0px"); } else if (group.barSize) { - var ruleWidth = units_calculateSize(group.barSize, options); + var ruleWidth = calculateSize(group.barSize, options); node.setAttribute("linethickness", ruleWidth + "em"); } - var style = genfrac_adjustStyle(group.size, options.style); + var style = adjustStyle(group.size, options.style); if (style.size !== options.style.size) { node = new mathMLTree.MathNode("mstyle", [node]); @@ -11061,7 +11545,7 @@ var genfrac_mathmlBuilder = function mathmlBuilder(group, options) { withDelims.push(rightOp); } - return buildMathML_makeRow(withDelims); + return makeRow(withDelims); } return node; @@ -11069,11 +11553,12 @@ var genfrac_mathmlBuilder = function mathmlBuilder(group, options) { defineFunction({ type: "genfrac", - names: ["\\cfrac", "\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly - "\\\\bracefrac", "\\\\brackfrac"], + names: ["\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly + "\\\\bracefrac", "\\\\brackfrac" // ditto + ], props: { numArgs: 2, - greediness: 2 + allowedInArgument: true }, handler: function handler(_ref, args) { var parser = _ref.parser, @@ -11086,7 +11571,6 @@ defineFunction({ var size = "auto"; switch (funcName) { - case "\\cfrac": case "\\dfrac": case "\\frac": case "\\tfrac": @@ -11122,7 +11606,6 @@ defineFunction({ } switch (funcName) { - case "\\cfrac": case "\\dfrac": case "\\dbinom": size = "display"; @@ -11137,7 +11620,7 @@ defineFunction({ return { type: "genfrac", mode: parser.mode, - continued: funcName === "\\cfrac", + continued: false, numer: numer, denom: denom, hasBarLine: hasBarLine, @@ -11149,6 +11632,31 @@ defineFunction({ }, htmlBuilder: genfrac_htmlBuilder, mathmlBuilder: genfrac_mathmlBuilder +}); +defineFunction({ + type: "genfrac", + names: ["\\cfrac"], + props: { + numArgs: 2 + }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser, + funcName = _ref2.funcName; + var numer = args[0]; + var denom = args[1]; + return { + type: "genfrac", + mode: parser.mode, + continued: true, + numer: numer, + denom: denom, + hasBarLine: true, + leftDelim: null, + rightDelim: null, + size: "display", + barSize: null + }; + } }); // Infix generalized fractions -- these are not rendered directly, but replaced // immediately by one of the variants above. @@ -11159,10 +11667,10 @@ defineFunction({ numArgs: 0, infix: true }, - handler: function handler(_ref2) { - var parser = _ref2.parser, - funcName = _ref2.funcName, - token = _ref2.token; + handler: function handler(_ref3) { + var parser = _ref3.parser, + funcName = _ref3.funcName, + token = _ref3.token; var replaceWith; switch (funcName) { @@ -11216,16 +11724,18 @@ defineFunction({ names: ["\\genfrac"], props: { numArgs: 6, - greediness: 6, + allowedInArgument: true, argTypes: ["math", "math", "size", "text", "math", "math"] }, - handler: function handler(_ref3, args) { - var parser = _ref3.parser; + handler: function handler(_ref4, args) { + var parser = _ref4.parser; var numer = args[4]; var denom = args[5]; // Look into the parse nodes to get the desired delimiters. - var leftDelim = args[0].type === "atom" && args[0].family === "open" ? delimFromValue(args[0].text) : null; - var rightDelim = args[1].type === "atom" && args[1].family === "close" ? delimFromValue(args[1].text) : null; + var leftNode = normalizeArgument(args[0]); + var leftDelim = leftNode.type === "atom" && leftNode.family === "open" ? delimFromValue(leftNode.text) : null; + var rightNode = normalizeArgument(args[1]); + var rightDelim = rightNode.type === "atom" && rightNode.family === "close" ? delimFromValue(rightNode.text) : null; var barNode = assertNodeType(args[2], "size"); var hasBarLine; var barSize = null; @@ -11279,10 +11789,10 @@ defineFunction({ argTypes: ["size"], infix: true }, - handler: function handler(_ref4, args) { - var parser = _ref4.parser, - funcName = _ref4.funcName, - token = _ref4.token; + handler: function handler(_ref5, args) { + var parser = _ref5.parser, + funcName = _ref5.funcName, + token = _ref5.token; return { type: "infix", mode: parser.mode, @@ -11299,9 +11809,9 @@ defineFunction({ numArgs: 3, argTypes: ["math", "size", "math"] }, - handler: function handler(_ref5, args) { - var parser = _ref5.parser, - funcName = _ref5.funcName; + handler: function handler(_ref6, args) { + var parser = _ref6.parser, + funcName = _ref6.funcName; var numer = args[0]; var barSize = assert(assertNodeType(args[1], "infix").size); var denom = args[2]; @@ -11322,7 +11832,7 @@ defineFunction({ htmlBuilder: genfrac_htmlBuilder, mathmlBuilder: genfrac_mathmlBuilder }); -// CONCATENATED MODULE: ./src/functions/horizBrace.js +;// CONCATENATED MODULE: ./src/functions/horizBrace.js @@ -11332,6 +11842,7 @@ defineFunction({ // NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but +// also "supsub" since an over/underbrace can affect super/subscripting. var horizBrace_htmlBuilder = function htmlBuilder(grp, options) { var style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node. @@ -11342,14 +11853,14 @@ var horizBrace_htmlBuilder = function htmlBuilder(grp, options) { // Ref: LaTeX source2e: }}}}\limits} // i.e. LaTeX treats the brace similar to an op and passes it // with \limits, so we need to assign supsub style. - supSubGroup = grp.sup ? buildHTML_buildGroup(grp.sup, options.havingStyle(style.sup()), options) : buildHTML_buildGroup(grp.sub, options.havingStyle(style.sub()), options); + supSubGroup = grp.sup ? buildGroup(grp.sup, options.havingStyle(style.sup()), options) : buildGroup(grp.sub, options.havingStyle(style.sub()), options); group = assertNodeType(grp.base, "horizBrace"); } else { group = assertNodeType(grp, "horizBrace"); } // Build the base group - var body = buildHTML_buildGroup(group.base, options.havingBaseStyle(src_Style.DISPLAY)); // Create the stretchy element + var body = buildGroup(group.base, options.havingBaseStyle(src_Style.DISPLAY)); // Create the stretchy element var braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓ // This first vlist contains the content and the brace: equation @@ -11462,7 +11973,7 @@ defineFunction({ htmlBuilder: horizBrace_htmlBuilder, mathmlBuilder: horizBrace_mathmlBuilder }); -// CONCATENATED MODULE: ./src/functions/href.js +;// CONCATENATED MODULE: ./src/functions/href.js @@ -11497,14 +12008,14 @@ defineFunction({ }; }, htmlBuilder: function htmlBuilder(group, options) { - var elements = buildHTML_buildExpression(group.body, options, false); + var elements = buildExpression(group.body, options, false); return buildCommon.makeAnchor(group.href, [], elements, options); }, mathmlBuilder: function mathmlBuilder(group, options) { var math = buildExpressionRow(group.body, options); - if (!(math instanceof mathMLTree_MathNode)) { - math = new mathMLTree_MathNode("mrow", [math]); + if (!(math instanceof MathNode)) { + math = new MathNode("mrow", [math]); } math.setAttribute("href", group.href); @@ -11560,7 +12071,42 @@ defineFunction({ }; } }); -// CONCATENATED MODULE: ./src/functions/html.js +;// CONCATENATED MODULE: ./src/functions/hbox.js + + + + + // \hbox is provided for compatibility with LaTeX \vcenter. +// In LaTeX, \vcenter can act only on a box, as in +// \vcenter{\hbox{$\frac{a+b}{\dfrac{c}{d}}$}} +// This function by itself doesn't do anything but prevent a soft line break. + +defineFunction({ + type: "hbox", + names: ["\\hbox"], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInText: true, + primitive: true + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { + type: "hbox", + mode: parser.mode, + body: ordargument(args[0]) + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = buildExpression(group.body, options, false); + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + return new mathMLTree.MathNode("mrow", buildMathML_buildExpression(group.body, options)); + } +}); +;// CONCATENATED MODULE: ./src/functions/html.js @@ -11651,7 +12197,7 @@ defineFunction({ }; }, htmlBuilder: function htmlBuilder(group, options) { - var elements = buildHTML_buildExpression(group.body, options, false); + var elements = buildExpression(group.body, options, false); var classes = ["enclosing"]; if (group.attributes.class) { @@ -11672,7 +12218,7 @@ defineFunction({ return buildExpressionRow(group.body, options); } }); -// CONCATENATED MODULE: ./src/functions/htmlmathml.js +;// CONCATENATED MODULE: ./src/functions/htmlmathml.js @@ -11694,14 +12240,14 @@ defineFunction({ }; }, htmlBuilder: function htmlBuilder(group, options) { - var elements = buildHTML_buildExpression(group.html, options, false); + var elements = buildExpression(group.html, options, false); return buildCommon.makeFragment(elements); }, mathmlBuilder: function mathmlBuilder(group, options) { return buildExpressionRow(group.mathml, options); } }); -// CONCATENATED MODULE: ./src/functions/includegraphics.js +;// CONCATENATED MODULE: ./src/functions/includegraphics.js @@ -11709,7 +12255,7 @@ defineFunction({ -var includegraphics_sizeData = function sizeData(str) { +var sizeData = function sizeData(str) { if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) { // str is a number with no unit specified. // default unit is bp, per graphix package. @@ -11781,15 +12327,15 @@ defineFunction({ break; case "width": - width = includegraphics_sizeData(str); + width = sizeData(str); break; case "height": - height = includegraphics_sizeData(str); + height = sizeData(str); break; case "totalheight": - totalheight = includegraphics_sizeData(str); + totalheight = sizeData(str); break; default: @@ -11826,18 +12372,18 @@ defineFunction({ }; }, htmlBuilder: function htmlBuilder(group, options) { - var height = units_calculateSize(group.height, options); + var height = calculateSize(group.height, options); var depth = 0; if (group.totalheight.number > 0) { - depth = units_calculateSize(group.totalheight, options) - height; + depth = calculateSize(group.totalheight, options) - height; depth = Number(depth.toFixed(2)); } var width = 0; if (group.width.number > 0) { - width = units_calculateSize(group.width, options); + width = calculateSize(group.width, options); } var style = { @@ -11852,7 +12398,7 @@ defineFunction({ style.verticalAlign = -depth + "em"; } - var node = new domTree_Img(group.src, group.alt, style); + var node = new Img(group.src, group.alt, style); node.height = height; node.depth = depth; return node; @@ -11860,11 +12406,11 @@ defineFunction({ mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mglyph", []); node.setAttribute("alt", group.alt); - var height = units_calculateSize(group.height, options); + var height = calculateSize(group.height, options); var depth = 0; if (group.totalheight.number > 0) { - depth = units_calculateSize(group.totalheight, options) - height; + depth = calculateSize(group.totalheight, options) - height; depth = depth.toFixed(2); node.setAttribute("valign", "-" + depth + "em"); } @@ -11872,7 +12418,7 @@ defineFunction({ node.setAttribute("height", height + depth + "em"); if (group.width.number > 0) { - var width = units_calculateSize(group.width, options); + var width = calculateSize(group.width, options); node.setAttribute("width", width + "em"); } @@ -11880,7 +12426,7 @@ defineFunction({ return node; } }); -// CONCATENATED MODULE: ./src/functions/kern.js +;// CONCATENATED MODULE: ./src/functions/kern.js // Horizontal spacing commands @@ -11894,6 +12440,7 @@ defineFunction({ props: { numArgs: 1, argTypes: ["size"], + primitive: true, allowedInText: true }, handler: function handler(_ref, args) { @@ -11932,11 +12479,11 @@ defineFunction({ return buildCommon.makeGlue(group.dimension, options); }, mathmlBuilder: function mathmlBuilder(group, options) { - var dimension = units_calculateSize(group.dimension, options); + var dimension = calculateSize(group.dimension, options); return new mathMLTree.SpaceNode(dimension); } }); -// CONCATENATED MODULE: ./src/functions/lap.js +;// CONCATENATED MODULE: ./src/functions/lap.js // Horizontal overlap functions @@ -11967,11 +12514,11 @@ defineFunction({ if (group.alignment === "clap") { // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/ - inner = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span + inner = buildCommon.makeSpan([], [buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span inner = buildCommon.makeSpan(["inner"], [inner], options); } else { - inner = buildCommon.makeSpan(["inner"], [buildHTML_buildGroup(group.body, options)]); + inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options)]); } var fix = buildCommon.makeSpan(["fix"], []); @@ -12003,7 +12550,7 @@ defineFunction({ return node; } }); -// CONCATENATED MODULE: ./src/functions/math.js +;// CONCATENATED MODULE: ./src/functions/math.js // Switching from text mode back to math mode @@ -12046,14 +12593,14 @@ defineFunction({ throw new src_ParseError("Mismatched " + context.funcName); } }); -// CONCATENATED MODULE: ./src/functions/mathchoice.js +;// CONCATENATED MODULE: ./src/functions/mathchoice.js -var mathchoice_chooseMathStyle = function chooseMathStyle(group, options) { +var chooseMathStyle = function chooseMathStyle(group, options) { switch (options.style.size) { case src_Style.DISPLAY.size: return group.display; @@ -12076,7 +12623,8 @@ defineFunction({ type: "mathchoice", names: ["\\mathchoice"], props: { - numArgs: 4 + numArgs: 4, + primitive: true }, handler: function handler(_ref, args) { var parser = _ref.parser; @@ -12090,27 +12638,27 @@ defineFunction({ }; }, htmlBuilder: function htmlBuilder(group, options) { - var body = mathchoice_chooseMathStyle(group, options); - var elements = buildHTML_buildExpression(body, options, false); + var body = chooseMathStyle(group, options); + var elements = buildExpression(body, options, false); return buildCommon.makeFragment(elements); }, mathmlBuilder: function mathmlBuilder(group, options) { - var body = mathchoice_chooseMathStyle(group, options); + var body = chooseMathStyle(group, options); return buildExpressionRow(body, options); } }); -// CONCATENATED MODULE: ./src/functions/utils/assembleSupSub.js +;// CONCATENATED MODULE: ./src/functions/utils/assembleSupSub.js // For an operator with limits, assemble the base, sup, and sub into a span. -var assembleSupSub_assembleSupSub = function assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift) { +var assembleSupSub = function assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift) { base = buildCommon.makeSpan([], [base]); var sub; var sup; // We manually have to handle the superscripts and subscripts. This, // aside from the kern calculations, is copied from supsub. if (supGroup) { - var elem = buildHTML_buildGroup(supGroup, options.havingStyle(style.sup()), options); + var elem = buildGroup(supGroup, options.havingStyle(style.sup()), options); sup = { elem: elem, kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth) @@ -12118,7 +12666,7 @@ var assembleSupSub_assembleSupSub = function assembleSupSub(base, supGroup, subG } if (subGroup) { - var _elem = buildHTML_buildGroup(subGroup, options.havingStyle(style.sub()), options); + var _elem = buildGroup(subGroup, options.havingStyle(style.sub()), options); sub = { elem: _elem, @@ -12214,7 +12762,7 @@ var assembleSupSub_assembleSupSub = function assembleSupSub(base, supGroup, subG return buildCommon.makeSpan(["mop", "op-limits"], [finalGroup], options); }; -// CONCATENATED MODULE: ./src/functions/op.js +;// CONCATENATED MODULE: ./src/functions/op.js // Limits, symbols @@ -12267,8 +12815,7 @@ var op_htmlBuilder = function htmlBuilder(grp, options) { if (group.name === "\\oiint" || group.name === "\\oiiint") { // No font glyphs yet, so use a glyph w/o the oval. // TODO: When font glyphs are available, delete this code. - stash = group.name.substr(1); // $FlowFixMe - + stash = group.name.substr(1); group.name = stash === "oiint" ? "\\iint" : "\\iiint"; } @@ -12290,8 +12837,7 @@ var op_htmlBuilder = function htmlBuilder(grp, options) { elem: oval, shift: large ? 0.08 : 0 }] - }, options); // $FlowFixMe - + }, options); group.name = "\\" + stash; base.classes.unshift("mop"); // $FlowFixMe @@ -12299,19 +12845,17 @@ var op_htmlBuilder = function htmlBuilder(grp, options) { } } else if (group.body) { // If this is a list, compose that list. - var inner = buildHTML_buildExpression(group.body, options, true); + var inner = buildExpression(group.body, options, true); - if (inner.length === 1 && inner[0] instanceof domTree_SymbolNode) { + if (inner.length === 1 && inner[0] instanceof SymbolNode) { base = inner[0]; base.classes[0] = "mop"; // replace old mclass } else { - base = buildCommon.makeSpan(["mop"], buildCommon.tryCombineChars(inner), options); + base = buildCommon.makeSpan(["mop"], inner, options); } } else { // Otherwise, this is a text operator. Build the text from the // operator's name. - // TODO(emily): Add a space in the middle of some of these - // operators, like \limsup var output = []; for (var i = 1; i < group.name.length; i++) { @@ -12325,7 +12869,7 @@ var op_htmlBuilder = function htmlBuilder(grp, options) { var baseShift = 0; var slant = 0; - if ((base instanceof domTree_SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) { + if ((base instanceof SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) { // We suppress the shift of the base of \overset and \underset. Otherwise, // shift the symbol so its center lies on the axis (rule 13). It // appears that our fonts have the centers of the symbols already @@ -12339,7 +12883,7 @@ var op_htmlBuilder = function htmlBuilder(grp, options) { } if (hasLimits) { - return assembleSupSub_assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift); + return assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift); } else { if (baseShift) { base.style.position = "relative"; @@ -12355,24 +12899,24 @@ var op_mathmlBuilder = function mathmlBuilder(group, options) { if (group.symbol) { // This is a symbol. Just add the symbol. - node = new mathMLTree_MathNode("mo", [buildMathML_makeText(group.name, group.mode)]); + node = new MathNode("mo", [makeText(group.name, group.mode)]); if (utils.contains(noSuccessor, group.name)) { node.setAttribute("largeop", "false"); } } else if (group.body) { // This is an operator with children. Add them. - node = new mathMLTree_MathNode("mo", buildMathML_buildExpression(group.body, options)); + node = new MathNode("mo", buildMathML_buildExpression(group.body, options)); } else { // This is a text operator. Add all of the characters from the // operator's name. - node = new mathMLTree_MathNode("mi", [new mathMLTree_TextNode(group.name.slice(1))]); // Append an . + node = new MathNode("mi", [new TextNode(group.name.slice(1))]); // Append an . // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 - var operator = new mathMLTree_MathNode("mo", [buildMathML_makeText("\u2061", "text")]); + var operator = new MathNode("mo", [makeText("\u2061", "text")]); if (group.parentIsSupSub) { - node = new mathMLTree_MathNode("mo", [node, operator]); + node = new MathNode("mrow", [node, operator]); } else { node = newDocumentFragment([node, operator]); } @@ -12428,7 +12972,8 @@ defineFunction({ type: "op", names: ["\\mathop"], props: { - numArgs: 1 + numArgs: 1, + primitive: true }, handler: function handler(_ref2, args) { var parser = _ref2.parser; @@ -12528,7 +13073,7 @@ defineFunction({ htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); -// CONCATENATED MODULE: ./src/functions/operatorname.js +;// CONCATENATED MODULE: ./src/functions/operatorname.js @@ -12539,6 +13084,7 @@ defineFunction({ // NOTE: Unlike most `htmlBuilder`s, this one handles not only // "operatorname", but also "supsub" since \operatorname* can +// affect super/subscripting. var operatorname_htmlBuilder = function htmlBuilder(grp, options) { // Operators are handled in the TeXbook pg. 443-444, rule 13(a). var supGroup; @@ -12576,12 +13122,12 @@ var operatorname_htmlBuilder = function htmlBuilder(grp, options) { } }); // Consolidate function names into symbol characters. - var expression = buildHTML_buildExpression(body, options.withFont("mathrm"), true); + var expression = buildExpression(body, options.withFont("mathrm"), true); for (var i = 0; i < expression.length; i++) { var child = expression[i]; - if (child instanceof domTree_SymbolNode) { + if (child instanceof SymbolNode) { // Per amsopn package, // change minus to hyphen and \ast to asterisk child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); @@ -12594,7 +13140,7 @@ var operatorname_htmlBuilder = function htmlBuilder(grp, options) { } if (hasLimits) { - return assembleSupSub_assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0); + return assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0); } else { return base; } @@ -12653,10 +13199,10 @@ var operatorname_mathmlBuilder = function mathmlBuilder(group, options) { identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as ⁡ // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp - var operator = new mathMLTree.MathNode("mo", [buildMathML_makeText("\u2061", "text")]); + var operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]); if (group.parentIsSupSub) { - return new mathMLTree.MathNode("mo", [identifier, operator]); + return new mathMLTree.MathNode("mrow", [identifier, operator]); } else { return mathMLTree.newDocumentFragment([identifier, operator]); } @@ -12686,7 +13232,7 @@ defineFunction({ htmlBuilder: operatorname_htmlBuilder, mathmlBuilder: operatorname_mathmlBuilder }); -// CONCATENATED MODULE: ./src/functions/ordgroup.js +;// CONCATENATED MODULE: ./src/functions/ordgroup.js @@ -12695,16 +13241,16 @@ defineFunctionBuilders({ type: "ordgroup", htmlBuilder: function htmlBuilder(group, options) { if (group.semisimple) { - return buildCommon.makeFragment(buildHTML_buildExpression(group.body, options, false)); + return buildCommon.makeFragment(buildExpression(group.body, options, false)); } - return buildCommon.makeSpan(["mord"], buildHTML_buildExpression(group.body, options, true), options); + return buildCommon.makeSpan(["mord"], buildExpression(group.body, options, true), options); }, mathmlBuilder: function mathmlBuilder(group, options) { return buildExpressionRow(group.body, options, true); } }); -// CONCATENATED MODULE: ./src/functions/overline.js +;// CONCATENATED MODULE: ./src/functions/overline.js @@ -12728,7 +13274,7 @@ defineFunction({ htmlBuilder: function htmlBuilder(group, options) { // Overlines are handled in the TeXbook pg 443, Rule 9. // Build the inner group in the cramped style. - var innerGroup = buildHTML_buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body + var innerGroup = buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body var line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns @@ -12759,7 +13305,7 @@ defineFunction({ return node; } }); -// CONCATENATED MODULE: ./src/functions/phantom.js +;// CONCATENATED MODULE: ./src/functions/phantom.js @@ -12782,7 +13328,7 @@ defineFunction({ }; }, htmlBuilder: function htmlBuilder(group, options) { - var elements = buildHTML_buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains. + var elements = buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains. // See "color" for more details. return buildCommon.makeFragment(elements); @@ -12809,7 +13355,7 @@ defineFunction({ }; }, htmlBuilder: function htmlBuilder(group, options) { - var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options.withPhantom())]); + var node = buildCommon.makeSpan([], [buildGroup(group.body, options.withPhantom())]); node.height = 0; node.depth = 0; @@ -12857,7 +13403,7 @@ defineFunction({ }; }, htmlBuilder: function htmlBuilder(group, options) { - var inner = buildCommon.makeSpan(["inner"], [buildHTML_buildGroup(group.body, options.withPhantom())]); + var inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options.withPhantom())]); var fix = buildCommon.makeSpan(["fix"], []); return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options); }, @@ -12869,7 +13415,7 @@ defineFunction({ return node; } }); -// CONCATENATED MODULE: ./src/functions/raisebox.js +;// CONCATENATED MODULE: ./src/functions/raisebox.js @@ -12898,8 +13444,8 @@ defineFunction({ }; }, htmlBuilder: function htmlBuilder(group, options) { - var body = buildHTML_buildGroup(group.body, options); - var dy = units_calculateSize(group.dy, options); + var body = buildGroup(group.body, options); + var dy = calculateSize(group.dy, options); return buildCommon.makeVList({ positionType: "shift", positionData: -dy, @@ -12916,7 +13462,7 @@ defineFunction({ return node; } }); -// CONCATENATED MODULE: ./src/functions/rule.js +;// CONCATENATED MODULE: ./src/functions/rule.js @@ -12947,9 +13493,9 @@ defineFunction({ // Make an empty span for the rule var rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units - var width = units_calculateSize(group.width, options); - var height = units_calculateSize(group.height, options); - var shift = group.shift ? units_calculateSize(group.shift, options) : 0; // Style the rule to the right size + var width = calculateSize(group.width, options); + var height = calculateSize(group.height, options); + var shift = group.shift ? calculateSize(group.shift, options) : 0; // Style the rule to the right size rule.style.borderRightWidth = width + "em"; rule.style.borderTopWidth = height + "em"; @@ -12965,9 +13511,9 @@ defineFunction({ return rule; }, mathmlBuilder: function mathmlBuilder(group, options) { - var width = units_calculateSize(group.width, options); - var height = units_calculateSize(group.height, options); - var shift = group.shift ? units_calculateSize(group.shift, options) : 0; + var width = calculateSize(group.width, options); + var height = calculateSize(group.height, options); + var shift = group.shift ? calculateSize(group.shift, options) : 0; var color = options.color && options.getColor() || "black"; var rule = new mathMLTree.MathNode("mspace"); rule.setAttribute("mathbackground", color); @@ -12986,14 +13532,14 @@ defineFunction({ return wrapper; } }); -// CONCATENATED MODULE: ./src/functions/sizing.js +;// CONCATENATED MODULE: ./src/functions/sizing.js function sizingGroup(value, options, baseOptions) { - var inner = buildHTML_buildExpression(value, options, false); + var inner = buildExpression(value, options, false); var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize // manually. Handle nested size changes. @@ -13057,7 +13603,7 @@ defineFunction({ return node; } }); -// CONCATENATED MODULE: ./src/functions/smash.js +;// CONCATENATED MODULE: ./src/functions/smash.js // smash, with optional [tb], as in AMS @@ -13115,7 +13661,7 @@ defineFunction({ }; }, htmlBuilder: function htmlBuilder(group, options) { - var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]); + var node = buildCommon.makeSpan([], [buildGroup(group.body, options)]); if (!group.smashHeight && !group.smashDepth) { return node; @@ -13169,7 +13715,7 @@ defineFunction({ return node; } }); -// CONCATENATED MODULE: ./src/functions/sqrt.js +;// CONCATENATED MODULE: ./src/functions/sqrt.js @@ -13199,7 +13745,7 @@ defineFunction({ // Square roots are handled in the TeXbook pg. 443, Rule 11. // First, we do the same steps as in overline to build the inner group // and line - var inner = buildHTML_buildGroup(group.body, options.havingCrampedStyle()); + var inner = buildGroup(group.body, options.havingCrampedStyle()); if (inner.height === 0) { // Render a small surd. @@ -13261,7 +13807,7 @@ defineFunction({ // Handle the optional root index // The index is always in scriptscript style var newOptions = options.havingStyle(src_Style.SCRIPTSCRIPT); - var rootm = buildHTML_buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX + var rootm = buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX // source, in the definition of `\r@@t`. var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly @@ -13286,7 +13832,7 @@ defineFunction({ return index ? new mathMLTree.MathNode("mroot", [buildMathML_buildGroup(body, options), buildMathML_buildGroup(index, options)]) : new mathMLTree.MathNode("msqrt", [buildMathML_buildGroup(body, options)]); } }); -// CONCATENATED MODULE: ./src/functions/styling.js +;// CONCATENATED MODULE: ./src/functions/styling.js @@ -13303,7 +13849,8 @@ defineFunction({ names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], props: { numArgs: 0, - allowedInText: true + allowedInText: true, + primitive: true }, handler: function handler(_ref, args) { var breakOnTokenText = _ref.breakOnTokenText, @@ -13348,7 +13895,7 @@ defineFunction({ return node; } }); -// CONCATENATED MODULE: ./src/functions/supsub.js +;// CONCATENATED MODULE: ./src/functions/supsub.js @@ -13369,7 +13916,7 @@ defineFunction({ * its inner element should handle the superscripts and subscripts instead of * handling them itself. */ -var supsub_htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { +var htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { var base = group.base; if (!base) { @@ -13384,7 +13931,7 @@ var supsub_htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { return _delegate ? operatorname_htmlBuilder : null; } else if (base.type === "accent") { - return utils.isCharacterBox(base.base) ? accent_htmlBuilder : null; + return utils.isCharacterBox(base.base) ? htmlBuilder : null; } else if (base.type === "horizBrace") { var isSup = !group.sub; return isSup === base.isOver ? horizBrace_htmlBuilder : null; @@ -13402,7 +13949,7 @@ defineFunctionBuilders({ // 445-446, rules 18(a-f). // Here is where we defer to the inner group if it should handle // superscripts and subscripts itself. - var builderDelegate = supsub_htmlBuilderDelegate(group, options); + var builderDelegate = htmlBuilderDelegate(group, options); if (builderDelegate) { return builderDelegate(group, options); @@ -13411,7 +13958,7 @@ defineFunctionBuilders({ var valueBase = group.base, valueSup = group.sup, valueSub = group.sub; - var base = buildHTML_buildGroup(valueBase, options); + var base = buildGroup(valueBase, options); var supm; var subm; var metrics = options.fontMetrics(); // Rule 18a @@ -13422,7 +13969,7 @@ defineFunctionBuilders({ if (valueSup) { var newOptions = options.havingStyle(options.style.sup()); - supm = buildHTML_buildGroup(valueSup, newOptions, options); + supm = buildGroup(valueSup, newOptions, options); if (!isCharacterBox) { supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier; @@ -13432,7 +13979,7 @@ defineFunctionBuilders({ if (valueSub) { var _newOptions = options.havingStyle(options.style.sub()); - subm = buildHTML_buildGroup(valueSub, _newOptions, options); + subm = buildGroup(valueSub, _newOptions, options); if (!isCharacterBox) { subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier; @@ -13462,7 +14009,7 @@ defineFunctionBuilders({ // amount. Note we only do this when the base is a single symbol. var isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint"); - if (base instanceof domTree_SymbolNode || isOiint) { + if (base instanceof SymbolNode || isOiint) { // $FlowFixMe marginLeft = -base.italic + "em"; } @@ -13602,11 +14149,10 @@ defineFunctionBuilders({ } } - var node = new mathMLTree.MathNode(nodeType, children); - return node; + return new mathMLTree.MathNode(nodeType, children); } }); -// CONCATENATED MODULE: ./src/functions/symbolsOp.js +;// CONCATENATED MODULE: ./src/functions/symbolsOp.js @@ -13618,10 +14164,10 @@ defineFunctionBuilders({ return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]); }, mathmlBuilder: function mathmlBuilder(group, options) { - var node = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.text, group.mode)]); + var node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]); if (group.family === "bin") { - var variant = buildMathML_getVariant(group, options); + var variant = getVariant(group, options); if (variant === "bold-italic") { node.setAttribute("mathvariant", variant); @@ -13637,12 +14183,13 @@ defineFunctionBuilders({ return node; } }); -// CONCATENATED MODULE: ./src/functions/symbolsOrd.js +;// CONCATENATED MODULE: ./src/functions/symbolsOrd.js // "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in +// src/symbols.js. var defaultVariant = { "mi": "italic", "mn": "normal", @@ -13654,8 +14201,8 @@ defineFunctionBuilders({ return buildCommon.makeOrd(group, options, "mathord"); }, mathmlBuilder: function mathmlBuilder(group, options) { - var node = new mathMLTree.MathNode("mi", [buildMathML_makeText(group.text, group.mode, options)]); - var variant = buildMathML_getVariant(group, options) || "italic"; + var node = new mathMLTree.MathNode("mi", [makeText(group.text, group.mode, options)]); + var variant = getVariant(group, options) || "italic"; if (variant !== defaultVariant[node.type]) { node.setAttribute("mathvariant", variant); @@ -13670,15 +14217,13 @@ defineFunctionBuilders({ return buildCommon.makeOrd(group, options, "textord"); }, mathmlBuilder: function mathmlBuilder(group, options) { - var text = buildMathML_makeText(group.text, group.mode, options); - var variant = buildMathML_getVariant(group, options) || "normal"; + var text = makeText(group.text, group.mode, options); + var variant = getVariant(group, options) || "normal"; var node; if (group.mode === 'text') { node = new mathMLTree.MathNode("mtext", [text]); } else if (/[0-9]/.test(group.text)) { - // TODO(kevinb) merge adjacent nodes - // do it as a post processing step node = new mathMLTree.MathNode("mn", [text]); } else if (group.text === "\\prime") { node = new mathMLTree.MathNode("mo", [text]); @@ -13693,7 +14238,7 @@ defineFunctionBuilders({ return node; } }); -// CONCATENATED MODULE: ./src/functions/symbolsSpacing.js +;// CONCATENATED MODULE: ./src/functions/symbolsSpacing.js @@ -13758,12 +14303,12 @@ defineFunctionBuilders({ return node; } }); -// CONCATENATED MODULE: ./src/functions/tag.js +;// CONCATENATED MODULE: ./src/functions/tag.js -var tag_pad = function pad() { +var pad = function pad() { var padNode = new mathMLTree.MathNode("mtd", []); padNode.setAttribute("width", "50%"); return padNode; @@ -13772,7 +14317,7 @@ var tag_pad = function pad() { defineFunctionBuilders({ type: "tag", mathmlBuilder: function mathmlBuilder(group, options) { - var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [tag_pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), tag_pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]); + var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]); table.setAttribute("width", "100%"); return table; // TODO: Left-aligned tags. // Currently, the group and options passed here do not contain @@ -13783,7 +14328,7 @@ defineFunctionBuilders({ // need to rewrite the way this function is called. } }); -// CONCATENATED MODULE: ./src/functions/text.js +;// CONCATENATED MODULE: ./src/functions/text.js @@ -13828,7 +14373,7 @@ defineFunction({ props: { numArgs: 1, argTypes: ["text"], - greediness: 2, + allowedInArgument: true, allowedInText: true }, handler: function handler(_ref, args) { @@ -13844,15 +14389,15 @@ defineFunction({ }, htmlBuilder: function htmlBuilder(group, options) { var newOptions = optionsWithFont(group, options); - var inner = buildHTML_buildExpression(group.body, newOptions, true); - return buildCommon.makeSpan(["mord", "text"], buildCommon.tryCombineChars(inner), newOptions); + var inner = buildExpression(group.body, newOptions, true); + return buildCommon.makeSpan(["mord", "text"], inner, newOptions); }, mathmlBuilder: function mathmlBuilder(group, options) { var newOptions = optionsWithFont(group, options); return buildExpressionRow(group.body, newOptions); } }); -// CONCATENATED MODULE: ./src/functions/underline.js +;// CONCATENATED MODULE: ./src/functions/underline.js @@ -13876,7 +14421,7 @@ defineFunction({ htmlBuilder: function htmlBuilder(group, options) { // Underlines are handled in the TeXbook pg 443, Rule 10. // Build the inner group. - var innerGroup = buildHTML_buildGroup(group.body, options); // Create the line to go below the body + var innerGroup = buildGroup(group.body, options); // Create the line to go below the body var line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns @@ -13908,7 +14453,51 @@ defineFunction({ return node; } }); -// CONCATENATED MODULE: ./src/functions/verb.js +;// CONCATENATED MODULE: ./src/functions/vcenter.js + + + + + // \vcenter: Vertically center the argument group on the math axis. + +defineFunction({ + type: "vcenter", + names: ["\\vcenter"], + props: { + numArgs: 1, + argTypes: ["original"], + // In LaTeX, \vcenter can act only on a box. + allowedInText: false + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { + type: "vcenter", + mode: parser.mode, + body: args[0] + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var body = buildGroup(group.body, options); + var axisHeight = options.fontMetrics().axisHeight; + var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight)); + return buildCommon.makeVList({ + positionType: "shift", + positionData: dy, + children: [{ + type: "elem", + elem: body + }] + }, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + // There is no way to do this in MathML. + // Write a class as a breadcrumb in case some post-processor wants + // to perform a vcenter adjustment. + return new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)], ["vcenter"]); + } +}); +;// CONCATENATED MODULE: ./src/functions/verb.js @@ -13962,7 +14551,7 @@ defineFunction({ var makeVerb = function makeVerb(group) { return group.body.replace(/ /g, group.star ? "\u2423" : '\xA0'); }; -// CONCATENATED MODULE: ./src/functions.js +;// CONCATENATED MODULE: ./src/functions.js /** Include this to ensure that all functions are defined. */ var functions = _functions; @@ -14010,7 +14599,99 @@ var functions = _functions; -// CONCATENATED MODULE: ./src/Lexer.js + + + +;// CONCATENATED MODULE: ./src/SourceLocation.js +/** + * Lexing or parsing positional information for error reporting. + * This object is immutable. + */ +var SourceLocation = /*#__PURE__*/function () { + // The + prefix indicates that these fields aren't writeable + // Lexer holding the input string. + // Start offset, zero-based inclusive. + // End offset, zero-based exclusive. + function SourceLocation(lexer, start, end) { + this.lexer = void 0; + this.start = void 0; + this.end = void 0; + this.lexer = lexer; + this.start = start; + this.end = end; + } + /** + * Merges two `SourceLocation`s from location providers, given they are + * provided in order of appearance. + * - Returns the first one's location if only the first is provided. + * - Returns a merged range of the first and the last if both are provided + * and their lexers match. + * - Otherwise, returns null. + */ + + + SourceLocation.range = function range(first, second) { + if (!second) { + return first && first.loc; + } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) { + return null; + } else { + return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end); + } + }; + + return SourceLocation; +}(); + + +;// CONCATENATED MODULE: ./src/Token.js + +/** + * Interface required to break circular dependency between Token, Lexer, and + * ParseError. + */ + +/** + * The resulting token returned from `lex`. + * + * It consists of the token text plus some position information. + * The position information is essentially a range in an input string, + * but instead of referencing the bare input string, we refer to the lexer. + * That way it is possible to attach extra metadata to the input string, + * like for example a file name or similar. + * + * The position information is optional, so it is OK to construct synthetic + * tokens if appropriate. Not providing available position information may + * lead to degraded error reporting, though. + */ +var Token = /*#__PURE__*/function () { + // don't expand the token + // used in \noexpand + function Token(text, // the text of this token + loc) { + this.text = void 0; + this.loc = void 0; + this.noexpand = void 0; + this.treatAsRelax = void 0; + this.text = text; + this.loc = loc; + } + /** + * Given a pair of tokens (this and endToken), compute a `Token` encompassing + * the whole input range enclosed by these two. + */ + + + var _proto = Token.prototype; + + _proto.range = function range(endToken, // last token of the range, inclusive + text) { + return new Token(text, SourceLocation.range(this, endToken)); + }; + + return Token; +}(); +;// CONCATENATED MODULE: ./src/Lexer.js /** * The Lexer class handles tokenizing the input in various ways. Since our * parser expects us to be able to backtrack, the lexer allows lexing from any @@ -14062,9 +14743,7 @@ combiningDiacriticalMarkString + "*") + // ...plus accents /** Main Lexer class */ -var Lexer_Lexer = -/*#__PURE__*/ -function () { +var Lexer = /*#__PURE__*/function () { // category codes, only supports comment characters (14) for now function Lexer(input, settings) { this.input = void 0; @@ -14096,13 +14775,13 @@ function () { var pos = this.tokenRegex.lastIndex; if (pos === input.length) { - return new Token_Token("EOF", new SourceLocation(this, pos, pos)); + return new Token("EOF", new SourceLocation(this, pos, pos)); } var match = this.tokenRegex.exec(input); if (match === null || match.index !== pos) { - throw new src_ParseError("Unexpected character: '" + input[pos] + "'", new Token_Token(input[pos], new SourceLocation(this, pos, pos + 1))); + throw new src_ParseError("Unexpected character: '" + input[pos] + "'", new Token(input[pos], new SourceLocation(this, pos, pos + 1))); } var text = match[2] || " "; @@ -14129,14 +14808,14 @@ function () { text = controlMatch[1]; } - return new Token_Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex)); + return new Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex)); }; return Lexer; }(); -// CONCATENATED MODULE: ./src/Namespace.js +;// CONCATENATED MODULE: ./src/Namespace.js /** * A `Namespace` refers to a space of nameable things like macros or lengths, * which can be `set` either globally or local to a nested group, using an @@ -14146,9 +14825,7 @@ function () { */ -var Namespace_Namespace = -/*#__PURE__*/ -function () { +var Namespace = /*#__PURE__*/function () { /** * Both arguments are optional. The first argument is an object of * built-in mappings which never change. The second argument is an object @@ -14272,7 +14949,7 @@ function () { }(); -// CONCATENATED MODULE: ./src/macros.js +;// CONCATENATED MODULE: ./src/macros.js /** * Predefined macros for KaTeX. * This can be used to define some commands in terms of others. @@ -14463,8 +15140,8 @@ defineMacro("\\char", function (context) { // \renewcommand{\macro}[args]{definition} // TODO: Optional arguments: \newcommand{\macro}[args][default]{definition} -var macros_newcommand = function newcommand(context, existsOK, nonexistsOK) { - var arg = context.consumeArgs(1)[0]; +var newcommand = function newcommand(context, existsOK, nonexistsOK) { + var arg = context.consumeArg().tokens; if (arg.length !== 1) { throw new src_ParseError("\\newcommand's first argument must be a macro name"); @@ -14482,7 +15159,7 @@ var macros_newcommand = function newcommand(context, existsOK, nonexistsOK) { } var numArgs = 0; - arg = context.consumeArgs(1)[0]; + arg = context.consumeArg().tokens; if (arg.length === 1 && arg[0].text === "[") { var argText = ''; @@ -14499,7 +15176,7 @@ var macros_newcommand = function newcommand(context, existsOK, nonexistsOK) { } numArgs = parseInt(argText); - arg = context.consumeArgs(1)[0]; + arg = context.consumeArg().tokens; } // Final arg is the expansion of the macro @@ -14511,13 +15188,13 @@ var macros_newcommand = function newcommand(context, existsOK, nonexistsOK) { }; defineMacro("\\newcommand", function (context) { - return macros_newcommand(context, false, true); + return newcommand(context, false, true); }); defineMacro("\\renewcommand", function (context) { - return macros_newcommand(context, true, false); + return newcommand(context, true, false); }); defineMacro("\\providecommand", function (context) { - return macros_newcommand(context, true, true); + return newcommand(context, true, true); }); // terminal (console) tools defineMacro("\\message", function (context) { @@ -14589,7 +15266,11 @@ defineMacro("\xB7", "\\cdotp"); // \llap and \rlap render their contents in text defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); -defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \not is defined by base/fontmath.ltx via +defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \mathstrut from the TeXbook, p 360 + +defineMacro("\\mathstrut", "\\vphantom{(}"); // \underbar from TeXbook p 353 + +defineMacro("\\underbar", "\\underline{\\text{#1}}"); // \not is defined by base/fontmath.ltx via // \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36} // It's thus treated like a \mathrel, but defined by a symbol that has zero // width but extends to the right. We use \rlap to get that spacing. @@ -14879,9 +15560,11 @@ defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\ defineMacro("\\pmb", "\\html@mathml{" + "\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}" + "{\\mathbf{#1}}"); ////////////////////////////////////////////////////////////////////// // LaTeX source2e -// \\ defaults to \newline, but changes to \cr within array environment +// \expandafter\let\expandafter\@normalcr +// \csname\expandafter\@gobble\string\\ \endcsname +// \DeclareRobustCommand\newline{\@normalcr\relax} -defineMacro("\\\\", "\\newline"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} +defineMacro("\\newline", "\\\\\\relax"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} // TODO: Doesn't normally work in math mode because \@ fails. KaTeX doesn't // support \@ yet, so that's omitted, and we add \text so that the result // doesn't look funny in math mode. @@ -14901,7 +15584,7 @@ defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5e // We compute the corresponding \raisebox when A is rendered in \normalsize // \scriptstyle, which has a scale factor of 0.7 (see Options.js). -var latexRaiseA = fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1] + "em"; +var latexRaiseA = fontMetricsData["Main-Regular"]["T".charCodeAt(0)][1] - 0.7 * fontMetricsData["Main-Regular"]["A".charCodeAt(0)][1] + "em"; defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} @@ -14984,6 +15667,14 @@ defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\d defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}"); defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}"); defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); ////////////////////////////////////////////////////////////////////// +// From amsopn.sty + +defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}"); +defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}"); +defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}"); +defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}"); +defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}"); +defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}"); ////////////////////////////////////////////////////////////////////// // MathML alternates for KaTeX glyphs in the Unicode private area defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}"); @@ -15107,7 +15798,10 @@ defineMacro("\\bra", "\\mathinner{\\langle{#1}|}"); defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}"); defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}"); defineMacro("\\Bra", "\\left\\langle#1\\right|"); -defineMacro("\\Ket", "\\left|#1\\right\\rangle"); // Custom Khan Academy colors, should be moved to an optional package +defineMacro("\\Ket", "\\left|#1\\right\\rangle"); ////////////////////////////////////////////////////////////////////// +// actuarialangle.dtx + +defineMacro("\\angln", "{\\angl n}"); // Custom Khan Academy colors, should be moved to an optional package defineMacro("\\blue", "\\textcolor{##6495ed}{#1}"); defineMacro("\\orange", "\\textcolor{##ffa500}{#1}"); @@ -15165,7 +15859,7 @@ defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}"); defineMacro("\\grayI", "\\textcolor{##21242c}{#1}"); defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}"); defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}"); -// CONCATENATED MODULE: ./src/MacroExpander.js +;// CONCATENATED MODULE: ./src/MacroExpander.js /** * This file contains the “gullet” where macros are expanded * until only non-macro tokens remain. @@ -15192,9 +15886,7 @@ var implicitCommands = { }; -var MacroExpander_MacroExpander = -/*#__PURE__*/ -function () { +var MacroExpander = /*#__PURE__*/function () { function MacroExpander(input, settings, mode) { this.settings = void 0; this.expansionCount = void 0; @@ -15206,7 +15898,7 @@ function () { this.expansionCount = 0; this.feed(input); // Make new global namespace - this.macros = new Namespace_Namespace(macros, settings.macros); + this.macros = new Namespace(macros, settings.macros); this.mode = mode; this.stack = []; // contains tokens in REVERSE order } @@ -15219,7 +15911,7 @@ function () { var _proto = MacroExpander.prototype; _proto.feed = function feed(input) { - this.lexer = new Lexer_Lexer(input, this.settings); + this.lexer = new Lexer(input, this.settings); } /** * Switches between "text" and "math" modes. @@ -15287,6 +15979,43 @@ function () { (_this$stack = this.stack).push.apply(_this$stack, tokens); } + /** + * Find an macro argument without expanding tokens and append the array of + * tokens to the token stack. Uses Token as a container for the result. + */ + ; + + _proto.scanArgument = function scanArgument(isOptional) { + var start; + var end; + var tokens; + + if (isOptional) { + this.consumeSpaces(); // \@ifnextchar gobbles any space following it + + if (this.future().text !== "[") { + return null; + } + + start = this.popToken(); // don't include [ in tokens + + var _this$consumeArg = this.consumeArg(["]"]); + + tokens = _this$consumeArg.tokens; + end = _this$consumeArg.end; + } else { + var _this$consumeArg2 = this.consumeArg(); + + tokens = _this$consumeArg2.tokens; + start = _this$consumeArg2.start; + end = _this$consumeArg2.end; + } // indicate the end of an argument + + + this.pushToken(new Token("EOF", end.loc)); + this.pushTokens(tokens); + return start.range(end, ""); + } /** * Consume all following space tokens, without expansion. */ @@ -15304,46 +16033,107 @@ function () { } } /** - * Consume the specified number of arguments from the token stream, - * and return the resulting array of arguments. + * Consume an argument from the token stream, and return the resulting array + * of tokens and start/end token. */ ; - _proto.consumeArgs = function consumeArgs(numArgs) { - var args = []; // obtain arguments, either single token or balanced {…} group + _proto.consumeArg = function consumeArg(delims) { + // The argument for a delimited parameter is the shortest (possibly + // empty) sequence of tokens with properly nested {...} groups that is + // followed ... by this particular list of non-parameter tokens. + // The argument for an undelimited parameter is the next nonblank + // token, unless that token is ‘{’, when the argument will be the + // entire {...} group that follows. + var tokens = []; + var isDelimited = delims && delims.length > 0; - for (var i = 0; i < numArgs; ++i) { - this.consumeSpaces(); // ignore spaces before each argument + if (!isDelimited) { + // Ignore spaces between arguments. As the TeXbook says: + // "After you have said ‘\def\row#1#2{...}’, you are allowed to + // put spaces between the arguments (e.g., ‘\row x n’), because + // TeX doesn’t use single spaces as undelimited arguments." + this.consumeSpaces(); + } - var startOfArg = this.popToken(); + var start = this.future(); + var tok; + var depth = 0; + var match = 0; - if (startOfArg.text === "{") { - var arg = []; - var depth = 1; + do { + tok = this.popToken(); + tokens.push(tok); - while (depth !== 0) { - var tok = this.popToken(); - arg.push(tok); + if (tok.text === "{") { + ++depth; + } else if (tok.text === "}") { + --depth; - if (tok.text === "{") { - ++depth; - } else if (tok.text === "}") { - --depth; - } else if (tok.text === "EOF") { - throw new src_ParseError("End of input in macro argument", startOfArg); - } + if (depth === -1) { + throw new src_ParseError("Extra }", tok); } - - arg.pop(); // remove last } - - arg.reverse(); // like above, to fit in with stack order - - args[i] = arg; - } else if (startOfArg.text === "EOF") { - throw new src_ParseError("End of input expecting macro argument"); - } else { - args[i] = [startOfArg]; + } else if (tok.text === "EOF") { + throw new src_ParseError("Unexpected end of input in a macro argument" + ", expected '" + (delims && isDelimited ? delims[match] : "}") + "'", tok); } + + if (delims && isDelimited) { + if ((depth === 0 || depth === 1 && delims[match] === "{") && tok.text === delims[match]) { + ++match; + + if (match === delims.length) { + // don't include delims in tokens + tokens.splice(-match, match); + break; + } + } else { + match = 0; + } + } + } while (depth !== 0 || isDelimited); // If the argument found ... has the form ‘{}’, + // ... the outermost braces enclosing the argument are removed + + + if (start.text === "{" && tokens[tokens.length - 1].text === "}") { + tokens.pop(); + tokens.shift(); + } + + tokens.reverse(); // to fit in with stack order + + return { + tokens: tokens, + start: start, + end: tok + }; + } + /** + * Consume the specified number of (delimited) arguments from the token + * stream and return the resulting array of arguments. + */ + ; + + _proto.consumeArgs = function consumeArgs(numArgs, delimiters) { + if (delimiters) { + if (delimiters.length !== numArgs + 1) { + throw new src_ParseError("The length of delimiters doesn't match the number of args!"); + } + + var delims = delimiters[0]; + + for (var i = 0; i < delims.length; i++) { + var tok = this.popToken(); + + if (delims[i] !== tok.text) { + throw new src_ParseError("Use of the macro doesn't match its definition", tok); + } + } + } + + var args = []; + + for (var _i = 0; _i < numArgs; _i++) { + args.push(this.consumeArg(delimiters && delimiters[_i + 1]).tokens); } return args; @@ -15364,10 +16154,6 @@ function () { * * Used to implement `expandAfterFuture` and `expandNextToken`. * - * At the moment, macro expansion doesn't handle delimited macros, - * i.e. things like those defined by \def\foo#1\end{…}. - * See the TeX book page 202ff. for details on how those should behave. - * * If expandableOnly, only expandable tokens are expanded and * an undefined control sequence results in an error. */ @@ -15394,10 +16180,10 @@ function () { } var tokens = expansion.tokens; + var args = this.consumeArgs(expansion.numArgs, expansion.delimiters); if (expansion.numArgs) { - var args = this.consumeArgs(expansion.numArgs); // paste arguments in place of the placeholders - + // paste arguments in place of the placeholders tokens = tokens.slice(); // make a shallow copy for (var i = tokens.length - 1; i >= 0; --i) { @@ -15450,7 +16236,7 @@ function () { for (;;) { var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded. - if (expanded instanceof Token_Token) { + if (expanded instanceof Token) { // \relax stops the expansion, but shouldn't get returned (a // null return value couldn't get implemented as a function). // the token after \noexpand is interpreted as if its meaning @@ -15474,7 +16260,7 @@ function () { ; _proto.expandMacro = function expandMacro(name) { - return this.macros.has(name) ? this.expandTokens([new Token_Token(name)]) : undefined; + return this.macros.has(name) ? this.expandTokens([new Token(name)]) : undefined; } /** * Fully expand the given token stream and return the resulting list of tokens @@ -15490,7 +16276,7 @@ function () { var expanded = this.expandOnce(true); // expand only expandable tokens // expandOnce returns Token if and only if it's fully expanded. - if (expanded instanceof Token_Token) { + if (expanded instanceof Token) { if (expanded.treatAsRelax) { // the expansion of \noexpand is the token itself expanded.noexpand = false; @@ -15547,7 +16333,7 @@ function () { } } - var bodyLexer = new Lexer_Lexer(expansion, this.settings); + var bodyLexer = new Lexer(expansion, this.settings); var tokens = []; var tok = bodyLexer.lex(); @@ -15585,17 +16371,14 @@ function () { _proto.isExpandable = function isExpandable(name) { var macro = this.macros.get(name); - return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable // TODO(ylem): #2085 - : src_functions.hasOwnProperty(name) - /* && !functions[name].primitive*/ - ; + return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable : src_functions.hasOwnProperty(name) && !src_functions[name].primitive; }; return MacroExpander; }(); -// CONCATENATED MODULE: ./src/Parser.js +;// CONCATENATED MODULE: ./src/Parser.js /* eslint no-constant-condition:0 */ @@ -16003,9 +16786,7 @@ var unicodeSymbols = { * * The functions return ParseNodes. */ -var Parser_Parser = -/*#__PURE__*/ -function () { +var Parser = /*#__PURE__*/function () { function Parser(input, settings) { this.mode = void 0; this.gullet = void 0; @@ -16016,7 +16797,7 @@ function () { this.mode = "math"; // Create a new macro expander (gullet) and (indirectly via that) also a // new lexer (mouth) for this parser (stomach, in the language of TeX) - this.gullet = new MacroExpander_MacroExpander(input, settings, this.mode); // Store the settings for use in parsing + this.gullet = new MacroExpander(input, settings, this.mode); // Store the settings for use in parsing this.settings = settings; // Count leftright depth (for \middle errors) @@ -16105,6 +16886,17 @@ function () { return parse; }; + /** + * Parses an "expression", which is a list of atoms. + * + * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This + * happens when functions have higher precendence han infix + * nodes in implicit parses. + * + * `breakOnTokenText`: The text of the token that the expression should end + * with, or `null` if something else should end the + * expression. + */ _proto.parseExpression = function parseExpression(breakOnInfix, breakOnTokenText) { var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either // we reached the end, a }, or a \right) @@ -16208,17 +17000,19 @@ function () { } else { return body; } - } // The greediness of a superscript or subscript - ; - + } /** * Handle a subscript or superscript with nice errors. */ + ; + _proto.handleSupSubscript = function handleSupSubscript(name) { var symbolToken = this.fetch(); var symbol = symbolToken.text; this.consume(); - var group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS, undefined, undefined, true); // ignore spaces before sup/subscript argument + this.consumeSpaces(); // ignore spaces before sup/subscript argument + + var group = this.parseGroup(name); if (!group) { throw new src_ParseError("Expected group after '" + symbol + "'", symbolToken); @@ -16264,7 +17058,7 @@ function () { _proto.parseAtom = function parseAtom(breakOnTokenText) { // The body of an atom is an implicit group, so that things like // \left(x\right)^2 work correctly. - var base = this.parseGroup("atom", false, null, breakOnTokenText); // In text mode, we don't have superscripts or subscripts + var base = this.parseGroup("atom", breakOnTokenText); // In text mode, we don't have superscripts or subscripts if (this.mode === "text") { return base; @@ -16369,8 +17163,7 @@ function () { */ ; - _proto.parseFunction = function parseFunction(breakOnTokenText, name, // For error reporting. - greediness) { + _proto.parseFunction = function parseFunction(breakOnTokenText, name) { var token = this.fetch(); var func = token.text; var funcData = src_functions[func]; @@ -16381,7 +17174,7 @@ function () { this.consume(); // consume command token - if (greediness != null && funcData.greediness <= greediness) { + if (name && name !== "atom" && !funcData.allowedInArgument) { throw new src_ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token); } else if (this.mode === "text" && !funcData.allowedInText) { throw new src_ParseError("Can't use function '" + func + "' in text mode", token); @@ -16431,36 +17224,28 @@ function () { }; } - var baseGreediness = funcData.greediness; var args = []; var optArgs = []; for (var i = 0; i < totalArgs; i++) { var argType = funcData.argTypes && funcData.argTypes[i]; - var isOptional = i < funcData.numOptionalArgs; // Ignore spaces between arguments. As the TeXbook says: - // "After you have said ‘\def\row#1#2{...}’, you are allowed to - // put spaces between the arguments (e.g., ‘\row x n’), because - // TeX doesn’t use single spaces as undelimited arguments." + var isOptional = i < funcData.numOptionalArgs; - var consumeSpaces = i > 0 && !isOptional || // Also consume leading spaces in math mode, as parseSymbol - // won't know what to do with them. This can only happen with - // macros, e.g. \frac\foo\foo where \foo expands to a space symbol. - // In LaTeX, the \foo's get treated as (blank) arguments. - // In KaTeX, for now, both spaces will get consumed. - // TODO(edemaine) - i === 0 && !isOptional && this.mode === "math"; - var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional, baseGreediness, consumeSpaces); - - if (!arg) { - if (isOptional) { - optArgs.push(null); - continue; - } - - throw new src_ParseError("Expected group after '" + func + "'", this.fetch()); + if (funcData.primitive && argType == null || // \sqrt expands into primitive if optional argument doesn't exist + funcData.type === "sqrt" && i === 1 && optArgs[0] == null) { + argType = "primitive"; } - (isOptional ? optArgs : args).push(arg); + var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional); + + if (isOptional) { + optArgs.push(arg); + } else if (arg != null) { + args.push(arg); + } else { + // should be unreachable + throw new src_ParseError("Null argument, please report this as a bug"); + } } return { @@ -16473,76 +17258,64 @@ function () { */ ; - _proto.parseGroupOfType = function parseGroupOfType(name, type, optional, greediness, consumeSpaces) { + _proto.parseGroupOfType = function parseGroupOfType(name, type, optional) { switch (type) { case "color": - if (consumeSpaces) { - this.consumeSpaces(); - } - return this.parseColorGroup(optional); case "size": - if (consumeSpaces) { - this.consumeSpaces(); - } - return this.parseSizeGroup(optional); case "url": - return this.parseUrlGroup(optional, consumeSpaces); + return this.parseUrlGroup(optional); case "math": case "text": - return this.parseGroup(name, optional, greediness, undefined, type, consumeSpaces); + return this.parseArgumentGroup(optional, type); case "hbox": { // hbox argument type wraps the argument in the equivalent of // \hbox, which is like \text but switching to \textstyle size. - var group = this.parseGroup(name, optional, greediness, undefined, "text", consumeSpaces); - - if (!group) { - return group; - } - - var styledGroup = { + var group = this.parseArgumentGroup(optional, "text"); + return group != null ? { type: "styling", mode: group.mode, body: [group], style: "text" // simulate \textstyle - }; - return styledGroup; + } : null; } case "raw": { - if (consumeSpaces) { - this.consumeSpaces(); + var token = this.parseStringGroup("raw", optional); + return token != null ? { + type: "raw", + mode: "text", + string: token.text + } : null; + } + + case "primitive": + { + if (optional) { + throw new src_ParseError("A primitive argument cannot be optional"); } - if (optional && this.fetch().text === "{") { - return null; + var _group = this.parseGroup(name); + + if (_group == null) { + throw new src_ParseError("Expected group as " + name, this.fetch()); } - var token = this.parseStringGroup("raw", optional, true); - - if (token) { - return { - type: "raw", - mode: "text", - string: token.text - }; - } else { - throw new src_ParseError("Expected raw group", this.fetch()); - } + return _group; } case "original": case null: case undefined: - return this.parseGroup(name, optional, greediness, undefined, undefined, consumeSpaces); + return this.parseArgumentGroup(optional); default: throw new src_ParseError("Unknown group type as " + name, this.fetch()); @@ -16565,52 +17338,25 @@ function () { ; _proto.parseStringGroup = function parseStringGroup(modeName, // Used to describe the mode in error messages. - optional, raw) { - var groupBegin = optional ? "[" : "{"; - var groupEnd = optional ? "]" : "}"; - var beginToken = this.fetch(); + optional) { + var argToken = this.gullet.scanArgument(optional); - if (beginToken.text !== groupBegin) { - if (optional) { - return null; - } else if (raw && beginToken.text !== "EOF" && /[^{}[\]]/.test(beginToken.text)) { - this.consume(); - return beginToken; - } + if (argToken == null) { + return null; } - var outerMode = this.mode; - this.mode = "text"; - this.expect(groupBegin); var str = ""; - var firstToken = this.fetch(); - var nested = 0; // allow nested braces in raw string group - - var lastToken = firstToken; var nextToken; - while ((nextToken = this.fetch()).text !== groupEnd || raw && nested > 0) { - switch (nextToken.text) { - case "EOF": - throw new src_ParseError("Unexpected end of input in " + modeName, firstToken.range(lastToken, str)); - - case groupBegin: - nested++; - break; - - case groupEnd: - nested--; - break; - } - - lastToken = nextToken; - str += lastToken.text; + while ((nextToken = this.fetch()).text !== "EOF") { + str += nextToken.text; this.consume(); } - this.expect(groupEnd); - this.mode = outerMode; - return firstToken.range(lastToken, str); + this.consume(); // consume the end of the argument + + argToken.text = str; + return argToken; } /** * Parses a regex-delimited group: the largest sequence of tokens @@ -16620,8 +17366,6 @@ function () { ; _proto.parseRegexGroup = function parseRegexGroup(regex, modeName) { - var outerMode = this.mode; - this.mode = "text"; var firstToken = this.fetch(); var lastToken = firstToken; var str = ""; @@ -16637,7 +17381,6 @@ function () { throw new src_ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken); } - this.mode = outerMode; return firstToken.range(lastToken, str); } /** @@ -16648,7 +17391,7 @@ function () { _proto.parseColorGroup = function parseColorGroup(optional) { var res = this.parseStringGroup("color", optional); - if (!res) { + if (res == null) { return null; } @@ -16680,9 +17423,11 @@ function () { _proto.parseSizeGroup = function parseSizeGroup(optional) { var res; - var isBlank = false; + var isBlank = false; // don't expand before parseStringGroup - if (!optional && this.fetch().text !== "{") { + this.gullet.consumeSpaces(); + + if (!optional && this.gullet.future().text !== "{") { res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size"); } else { res = this.parseStringGroup("size", optional); @@ -16730,14 +17475,13 @@ function () { */ ; - _proto.parseUrlGroup = function parseUrlGroup(optional, consumeSpaces) { + _proto.parseUrlGroup = function parseUrlGroup(optional) { this.gullet.lexer.setCatcode("%", 13); // active character - var res = this.parseStringGroup("url", optional, true); // get raw string - + var res = this.parseStringGroup("url", optional); this.gullet.lexer.setCatcode("%", 14); // comment character - if (!res) { + if (res == null) { return null; } // hyperref package allows backslashes alone in href, but doesn't // generate valid links in such cases; we interpret this as @@ -16753,49 +17497,66 @@ function () { }; } /** - * If `optional` is false or absent, this parses an ordinary group, - * which is either a single nucleus (like "x") or an expression - * in braces (like "{x+y}") or an implicit group, a group that starts - * at the current position, and ends right before a higher explicit + * Parses an argument with the mode specified. + */ + ; + + _proto.parseArgumentGroup = function parseArgumentGroup(optional, mode) { + var argToken = this.gullet.scanArgument(optional); + + if (argToken == null) { + return null; + } + + var outerMode = this.mode; + + if (mode) { + // Switch to specified mode + this.switchMode(mode); + } + + this.gullet.beginGroup(); + var expression = this.parseExpression(false, "EOF"); // TODO: find an alternative way to denote the end + + this.expect("EOF"); // expect the end of the argument + + this.gullet.endGroup(); + var result = { + type: "ordgroup", + mode: this.mode, + loc: argToken.loc, + body: expression + }; + + if (mode) { + // Switch mode back + this.switchMode(outerMode); + } + + return result; + } + /** + * Parses an ordinary group, which is either a single nucleus (like "x") + * or an expression in braces (like "{x+y}") or an implicit group, a group + * that starts at the current position, and ends right before a higher explicit * group ends, or at EOF. - * If `optional` is true, it parses either a bracket-delimited expression - * (like "[x+y]") or returns null to indicate the absence of a - * bracket-enclosed group. - * If `mode` is present, switches to that mode while parsing the group, - * and switches back after. */ ; _proto.parseGroup = function parseGroup(name, // For error reporting. - optional, greediness, breakOnTokenText, mode, consumeSpaces) { - // Switch to specified mode - var outerMode = this.mode; - - if (mode) { - this.switchMode(mode); - } // Consume spaces if requested, crucially *after* we switch modes, - // so that the next non-space token is parsed in the correct mode. - - - if (consumeSpaces) { - this.consumeSpaces(); - } // Get first token - - + breakOnTokenText) { var firstToken = this.fetch(); var text = firstToken.text; var result; // Try to parse an open brace or \begingroup - if (optional ? text === "[" : text === "{" || text === "\\begingroup") { + if (text === "{" || text === "\\begingroup") { this.consume(); - var groupEnd = Parser.endOfGroup[text]; // Start a new group namespace - + var groupEnd = text === "{" ? "}" : "\\endgroup"; this.gullet.beginGroup(); // If we get a brace, parse an expression var expression = this.parseExpression(false, groupEnd); - var lastToken = this.fetch(); // Check that we got a matching closing brace - - this.expect(groupEnd); // End group namespace + var lastToken = this.fetch(); + this.expect(groupEnd); // Check that we got a matching closing brace this.gullet.endGroup(); result = { @@ -16809,13 +17570,10 @@ function () { // use-begingroup-instead-of-bgroup semisimple: text === "\\begingroup" || undefined }; - } else if (optional) { - // Return nothing for an optional group - result = null; } else { // If there exists a function with this name, parse the function. // Otherwise, just return a nucleus - result = this.parseFunction(breakOnTokenText, name, greediness) || this.parseSymbol(); + result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol(); if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) { if (this.settings.throwOnError) { @@ -16825,11 +17583,6 @@ function () { result = this.formatUnsupportedCmd(text); this.consume(); } - } // Switch mode back - - - if (mode) { - this.switchMode(outerMode); } return result; @@ -16972,7 +17725,8 @@ function () { loc: loc, text: text }; - } + } // $FlowFixMe + symbol = s; } else if (text.charCodeAt(0) >= 0x80) { @@ -17025,10 +17779,12 @@ function () { label: command, isStretchy: false, isShifty: true, + // $FlowFixMe base: symbol }; } - } + } // $FlowFixMe + return symbol; }; @@ -17036,27 +17792,9 @@ function () { return Parser; }(); -Parser_Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"]; -Parser_Parser.endOfGroup = { - "[": "]", - "{": "}", - "\\begingroup": "\\endgroup" - /** - * Parses an "expression", which is a list of atoms. - * - * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This - * happens when functions have higher precendence han infix - * nodes in implicit parses. - * - * `breakOnTokenText`: The text of the token that the expression should end - * with, or `null` if something else should end the - * expression. - */ +Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"]; -}; -Parser_Parser.SUPSUB_GREEDINESS = 1; - -// CONCATENATED MODULE: ./src/parseTree.js +;// CONCATENATED MODULE: ./src/parseTree.js /** * Provides a single function for parsing an expression using a Parser * TODO(emily): Remove this @@ -17067,15 +17805,18 @@ Parser_Parser.SUPSUB_GREEDINESS = 1; /** * Parses an expression using a Parser, then returns the parsed result. */ -var parseTree_parseTree = function parseTree(toParse, settings) { +var parseTree = function parseTree(toParse, settings) { if (!(typeof toParse === 'string' || toParse instanceof String)) { throw new TypeError('KaTeX can only parse string typed expression'); } - var parser = new Parser_Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors + var parser = new Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors delete parser.gullet.macros.current["\\df@tag"]; - var tree = parser.parse(); // If the input used \tag, it will set the \df@tag macro to the tag. + var tree = parser.parse(); // Prevent a color definition from persisting between calls to katex.render(). + + delete parser.gullet.macros.current["\\current@color"]; + delete parser.gullet.macros.current["\\color"]; // If the input used \tag, it will set the \df@tag macro to the tag. // In this case, we separately parse the tag and wrap the tree. if (parser.gullet.macros.get("\\df@tag")) { @@ -17095,8 +17836,8 @@ var parseTree_parseTree = function parseTree(toParse, settings) { return tree; }; -/* harmony default export */ var src_parseTree = (parseTree_parseTree); -// CONCATENATED MODULE: ./katex.js +/* harmony default export */ var src_parseTree = (parseTree); +;// CONCATENATED MODULE: ./katex.js /* eslint no-console:0 */ /** @@ -17120,9 +17861,9 @@ var parseTree_parseTree = function parseTree(toParse, settings) { * Parse and build an expression, and place that expression in the DOM node * given. */ -var katex_render = function render(expression, baseNode, options) { +var render = function render(expression, baseNode, options) { baseNode.textContent = ""; - var node = katex_renderToDomTree(expression, options).toNode(); + var node = renderToDomTree(expression, options).toNode(); baseNode.appendChild(node); }; // KaTeX's styles don't work properly in quirks mode. Print out an error, and // disable rendering. @@ -17132,7 +17873,7 @@ if (typeof document !== "undefined") { if (document.compatMode !== "CSS1Compat") { typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your " + "website has a suitable doctype."); - katex_render = function render() { + render = function render() { throw new src_ParseError("KaTeX doesn't work in quirks mode."); }; } @@ -17143,7 +17884,7 @@ if (typeof document !== "undefined") { var renderToString = function renderToString(expression, options) { - var markup = katex_renderToDomTree(expression, options).toMarkup(); + var markup = renderToDomTree(expression, options).toMarkup(); return markup; }; /** @@ -17151,8 +17892,8 @@ var renderToString = function renderToString(expression, options) { */ -var katex_generateParseTree = function generateParseTree(expression, options) { - var settings = new Settings_Settings(options); +var generateParseTree = function generateParseTree(expression, options) { + var settings = new Settings(options); return src_parseTree(expression, settings); }; /** @@ -17162,12 +17903,12 @@ var katex_generateParseTree = function generateParseTree(expression, options) { */ -var katex_renderError = function renderError(error, expression, options) { +var renderError = function renderError(error, expression, options) { if (options.throwOnError || !(error instanceof src_ParseError)) { throw error; } - var node = buildCommon.makeSpan(["katex-error"], [new domTree_SymbolNode(expression)]); + var node = buildCommon.makeSpan(["katex-error"], [new SymbolNode(expression)]); node.setAttribute("title", error.toString()); node.setAttribute("style", "color:" + options.errorColor); return node; @@ -17178,14 +17919,14 @@ var katex_renderError = function renderError(error, expression, options) { */ -var katex_renderToDomTree = function renderToDomTree(expression, options) { - var settings = new Settings_Settings(options); +var renderToDomTree = function renderToDomTree(expression, options) { + var settings = new Settings(options); try { var tree = src_parseTree(expression, settings); - return buildTree_buildTree(tree, expression, settings); + return buildTree(tree, expression, settings); } catch (error) { - return katex_renderError(error, expression, settings); + return renderError(error, expression, settings); } }; /** @@ -17194,28 +17935,28 @@ var katex_renderToDomTree = function renderToDomTree(expression, options) { */ -var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) { - var settings = new Settings_Settings(options); +var renderToHTMLTree = function renderToHTMLTree(expression, options) { + var settings = new Settings(options); try { var tree = src_parseTree(expression, settings); - return buildTree_buildHTMLTree(tree, expression, settings); + return buildHTMLTree(tree, expression, settings); } catch (error) { - return katex_renderError(error, expression, settings); + return renderError(error, expression, settings); } }; -/* harmony default export */ var katex_0 = ({ +/* harmony default export */ var katex = ({ /** * Current KaTeX version */ - version: "0.12.0", + version: "0.13.0", /** * Renders the given LaTeX into an HTML+MathML combination, and adds * it as a child to the specified DOM node. */ - render: katex_render, + render: render, /** * Renders the given LaTeX into an HTML+MathML combination string, @@ -17236,7 +17977,7 @@ var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) { * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ - __parse: katex_generateParseTree, + __parse: generateParseTree, /** * Renders the given LaTeX into an HTML+MathML internal DOM tree @@ -17246,7 +17987,7 @@ var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) { * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ - __renderToDomTree: katex_renderToDomTree, + __renderToDomTree: renderToDomTree, /** * Renders the given LaTeX into an HTML internal DOM tree representation, @@ -17256,7 +17997,7 @@ var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) { * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ - __renderToHTMLTree: katex_renderToHTMLTree, + __renderToHTMLTree: renderToHTMLTree, /** * extends internal font metrics object with a new object @@ -17282,15 +18023,15 @@ var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) { * to change. Use at your own risk. */ __domTree: { - Span: domTree_Span, - Anchor: domTree_Anchor, - SymbolNode: domTree_SymbolNode, + Span: Span, + Anchor: Anchor, + SymbolNode: SymbolNode, SvgNode: SvgNode, - PathNode: domTree_PathNode, + PathNode: PathNode, LineNode: LineNode } }); -// CONCATENATED MODULE: ./katex.webpack.js +;// CONCATENATED MODULE: ./katex.webpack.js /** * This is the webpack entry point for KaTeX. As ECMAScript, flow[1] and jest[2] * doesn't support CSS modules natively, a separate entry point is used and @@ -17301,8 +18042,9 @@ var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) { */ -/* harmony default export */ var katex_webpack = __webpack_exports__["default"] = (katex_0); - -/***/ }) -/******/ ])["default"]; +/* harmony default export */ var katex_webpack = (katex); +__webpack_exports__ = __webpack_exports__.default; +/******/ return __webpack_exports__; +/******/ })() +; }); \ No newline at end of file diff --git a/static/katex/katex.min.css b/static/katex/katex.min.css index 98b7c7b..9bbcd77 100644 --- a/static/katex/katex.min.css +++ b/static/katex/katex.min.css @@ -1 +1 @@ -@font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.woff2) format("woff2"),url(fonts/KaTeX_AMS-Regular.woff) format("woff"),url(fonts/KaTeX_AMS-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Bold.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Regular.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Bold.woff) format("woff"),url(fonts/KaTeX_Fraktur-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Regular.woff) format("woff"),url(fonts/KaTeX_Fraktur-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.woff2) format("woff2"),url(fonts/KaTeX_Main-Bold.woff) format("woff"),url(fonts/KaTeX_Main-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Main-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Main-BoldItalic.ttf) format("truetype");font-weight:700;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.woff2) format("woff2"),url(fonts/KaTeX_Main-Italic.woff) format("woff"),url(fonts/KaTeX_Main-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.woff2) format("woff2"),url(fonts/KaTeX_Main-Regular.woff) format("woff"),url(fonts/KaTeX_Main-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Math-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Math-BoldItalic.ttf) format("truetype");font-weight:700;font-style:italic}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.woff2) format("woff2"),url(fonts/KaTeX_Math-Italic.woff) format("woff"),url(fonts/KaTeX_Math-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Bold.woff) format("woff"),url(fonts/KaTeX_SansSerif-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Italic.woff) format("woff"),url(fonts/KaTeX_SansSerif-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Regular.woff) format("woff"),url(fonts/KaTeX_SansSerif-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.woff2) format("woff2"),url(fonts/KaTeX_Script-Regular.woff) format("woff"),url(fonts/KaTeX_Script-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size1-Regular.woff) format("woff"),url(fonts/KaTeX_Size1-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size2-Regular.woff) format("woff"),url(fonts/KaTeX_Size2-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size3-Regular.woff) format("woff"),url(fonts/KaTeX_Size3-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size4-Regular.woff) format("woff"),url(fonts/KaTeX_Size4-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2"),url(fonts/KaTeX_Typewriter-Regular.woff) format("woff"),url(fonts/KaTeX_Typewriter-Regular.ttf) format("truetype");font-weight:400;font-style:normal}.katex{font:normal 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto;border-color:currentColor}.katex *{-ms-high-contrast-adjust:none!important}.katex .katex-version:after{content:"0.12.0"}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-weight:700;font-style:italic}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{display:inline-table;table-layout:fixed;border-collapse:collapse}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;vertical-align:bottom;position:relative}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;vertical-align:bottom;font-size:1px;width:2px;min-width:2px}.katex .vbox{-ms-flex-direction:column;flex-direction:column;align-items:baseline}.katex .hbox,.katex .vbox{display:-ms-inline-flexbox;display:inline-flex}.katex .hbox{-ms-flex-direction:row;flex-direction:row;width:100%}.katex .thinbox{display:inline-flex;flex-direction:row;width:0;max-width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{width:0;position:relative}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{display:inline-block;border:0 solid;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline{display:inline-block;width:100%;border-bottom-style:dashed}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.83333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.85714286em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857143em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96285714em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55428571em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.66666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.77777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.88888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.58333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.66666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.41666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.48611111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.55555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44027778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.28935185em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.34722222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.40509259em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.46296296em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.52083333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023148em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981481em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108004em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.28929605em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.33751205em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.38572806em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.43394407em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216008em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57859209em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69431051em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.83317261em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961427em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.20096463em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.24115756em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.28135048em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.32154341em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.36173633em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.40192926em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.48231511em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.57877814em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.69453376em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.83360129em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .op-limits>.vlist-t{text-align:center}.katex .accent>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{display:block;position:absolute;width:100%;height:inherit;fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex svg path{stroke:none}.katex img{border-style:none;min-width:0;min-height:0;max-width:none;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{position:absolute;left:0;width:50.2%;overflow:hidden}.katex .halfarrow-right{position:absolute;right:0;width:50.2%;overflow:hidden}.katex .brace-left{position:absolute;left:0;width:25.1%;overflow:hidden}.katex .brace-center{position:absolute;left:25%;width:50%;overflow:hidden}.katex .brace-right{position:absolute;right:0;width:25.1%;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em} +@font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.woff2) format("woff2"),url(fonts/KaTeX_AMS-Regular.woff) format("woff"),url(fonts/KaTeX_AMS-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Bold.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Regular.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Bold.woff) format("woff"),url(fonts/KaTeX_Fraktur-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Regular.woff) format("woff"),url(fonts/KaTeX_Fraktur-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.woff2) format("woff2"),url(fonts/KaTeX_Main-Bold.woff) format("woff"),url(fonts/KaTeX_Main-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Main-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Main-BoldItalic.ttf) format("truetype");font-weight:700;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.woff2) format("woff2"),url(fonts/KaTeX_Main-Italic.woff) format("woff"),url(fonts/KaTeX_Main-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.woff2) format("woff2"),url(fonts/KaTeX_Main-Regular.woff) format("woff"),url(fonts/KaTeX_Main-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Math-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Math-BoldItalic.ttf) format("truetype");font-weight:700;font-style:italic}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.woff2) format("woff2"),url(fonts/KaTeX_Math-Italic.woff) format("woff"),url(fonts/KaTeX_Math-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Bold.woff) format("woff"),url(fonts/KaTeX_SansSerif-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Italic.woff) format("woff"),url(fonts/KaTeX_SansSerif-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Regular.woff) format("woff"),url(fonts/KaTeX_SansSerif-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.woff2) format("woff2"),url(fonts/KaTeX_Script-Regular.woff) format("woff"),url(fonts/KaTeX_Script-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size1-Regular.woff) format("woff"),url(fonts/KaTeX_Size1-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size2-Regular.woff) format("woff"),url(fonts/KaTeX_Size2-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size3-Regular.woff) format("woff"),url(fonts/KaTeX_Size3-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size4-Regular.woff) format("woff"),url(fonts/KaTeX_Size4-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2"),url(fonts/KaTeX_Typewriter-Regular.woff) format("woff"),url(fonts/KaTeX_Typewriter-Regular.ttf) format("truetype");font-weight:400;font-style:normal}.katex{font:normal 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto;border-color:currentColor}.katex *{-ms-high-contrast-adjust:none!important}.katex .katex-version:after{content:"0.13.0"}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-webkit-min-content;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-weight:700;font-style:italic}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{display:inline-table;table-layout:fixed;border-collapse:collapse}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;vertical-align:bottom;position:relative}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;vertical-align:bottom;font-size:1px;width:2px;min-width:2px}.katex .vbox{display:inline-flex;flex-direction:column;align-items:baseline}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{width:0;max-width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{width:0;position:relative}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{display:inline-block;border:0 solid;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline{display:inline-block;width:100%;border-bottom-style:dashed}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.83333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.85714286em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857143em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96285714em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55428571em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.66666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.77777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.88888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.58333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.66666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.41666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.48611111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.55555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44027778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.28935185em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.34722222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.40509259em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.46296296em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.52083333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023148em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981481em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108004em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.28929605em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.33751205em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.38572806em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.43394407em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216008em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57859209em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69431051em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.83317261em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961427em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.20096463em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.24115756em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.28135048em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.32154341em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.36173633em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.40192926em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.48231511em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.57877814em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.69453376em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.83360129em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{display:block;position:absolute;width:100%;height:inherit;fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex svg path{stroke:none}.katex img{border-style:none;min-width:0;min-height:0;max-width:none;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{position:absolute;left:0;width:50.2%;overflow:hidden}.katex .halfarrow-right{position:absolute;right:0;width:50.2%;overflow:hidden}.katex .brace-left{position:absolute;left:0;width:25.1%;overflow:hidden}.katex .brace-center{position:absolute;left:25%;width:50%;overflow:hidden}.katex .brace-right{position:absolute;right:0;width:25.1%;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{box-sizing:border-content;border-top:.049em solid;border-right:.049em solid;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{counter-increment:katexEqnNo;content:"(" counter(katexEqnNo) ")"}.katex .mml-eqn-num:before{counter-increment:mmlEqnNo;content:"(" counter(mmlEqnNo) ")"}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;position:absolute;left:calc(50% + .3em);text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em}body{counter-reset:katexEqnNo mmlEqnNo} diff --git a/static/katex/katex.min.js b/static/katex/katex.min.js index 4df7e17..6b1f525 100644 --- a/static/katex/katex.min.js +++ b/static/katex/katex.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.katex=e():t.katex=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(a,n,function(e){return t[e]}.bind(null,n));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e,r){},function(t,e,r){"use strict";r.r(e);r(0);var a=function(){function t(t,e,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=e,this.end=r}return t.range=function(e,r){return r?e&&e.loc&&r.loc&&e.loc.lexer===r.loc.lexer?new t(e.loc.lexer,e.loc.start,r.loc.end):null:e&&e.loc},t}(),n=function(){function t(t,e){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=e}return t.prototype.range=function(e,r){return new t(r,a.range(this,e))},t}(),i=function t(e,r){this.position=void 0;var a,n="KaTeX parse error: "+e,i=r&&r.loc;if(i&&i.start<=i.end){var o=i.lexer.input;a=i.start;var s=i.end;a===o.length?n+=" at end of input: ":n+=" at position "+(a+1)+": ";var l=o.slice(a,s).replace(/[^]/g,"$&\u0332");n+=(a>15?"\u2026"+o.slice(a-15,a):o.slice(0,a))+l+(s+15":">","<":"<",'"':""","'":"'"},h=/[&><"']/g;var m=function t(e){return"ordgroup"===e.type?1===e.body.length?t(e.body[0]):e:"color"===e.type?1===e.body.length?t(e.body[0]):e:"font"===e.type?t(e.body):e},c={contains:function(t,e){return-1!==t.indexOf(e)},deflt:function(t,e){return void 0===t?e:t},escape:function(t){return String(t).replace(h,function(t){return l[t]})},hyphenate:function(t){return t.replace(s,"-$1").toLowerCase()},getBaseElem:m,isCharacterBox:function(t){var e=m(t);return"mathord"===e.type||"textord"===e.type||"atom"===e.type},protocolFromUrl:function(t){var e=/^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(t);return null!=e?e[1]:"_relative"}},u=function(){function t(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{},this.displayMode=c.deflt(t.displayMode,!1),this.output=c.deflt(t.output,"htmlAndMathml"),this.leqno=c.deflt(t.leqno,!1),this.fleqn=c.deflt(t.fleqn,!1),this.throwOnError=c.deflt(t.throwOnError,!0),this.errorColor=c.deflt(t.errorColor,"#cc0000"),this.macros=t.macros||{},this.minRuleThickness=Math.max(0,c.deflt(t.minRuleThickness,0)),this.colorIsTextColor=c.deflt(t.colorIsTextColor,!1),this.strict=c.deflt(t.strict,"warn"),this.trust=c.deflt(t.trust,!1),this.maxSize=Math.max(0,c.deflt(t.maxSize,1/0)),this.maxExpand=Math.max(0,c.deflt(t.maxExpand,1e3)),this.globalGroup=c.deflt(t.globalGroup,!1)}var e=t.prototype;return e.reportNonstrict=function(t,e,r){var a=this.strict;if("function"==typeof a&&(a=a(t,e,r)),a&&"ignore"!==a){if(!0===a||"error"===a)throw new o("LaTeX-incompatible input and strict mode is set to 'error': "+e+" ["+t+"]",r);"warn"===a?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+e+" ["+t+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+a+"': "+e+" ["+t+"]")}},e.useStrictBehavior=function(t,e,r){var a=this.strict;if("function"==typeof a)try{a=a(t,e,r)}catch(t){a="error"}return!(!a||"ignore"===a)&&(!0===a||"error"===a||("warn"===a?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+e+" ["+t+"]"),!1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+a+"': "+e+" ["+t+"]"),!1)))},e.isTrusted=function(t){t.url&&!t.protocol&&(t.protocol=c.protocolFromUrl(t.url));var e="function"==typeof this.trust?this.trust(t):this.trust;return Boolean(e)},t}(),p=function(){function t(t,e,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=e,this.cramped=r}var e=t.prototype;return e.sup=function(){return d[f[this.id]]},e.sub=function(){return d[g[this.id]]},e.fracNum=function(){return d[x[this.id]]},e.fracDen=function(){return d[v[this.id]]},e.cramp=function(){return d[b[this.id]]},e.text=function(){return d[y[this.id]]},e.isTight=function(){return this.size>=2},t}(),d=[new p(0,0,!1),new p(1,0,!0),new p(2,1,!1),new p(3,1,!0),new p(4,2,!1),new p(5,2,!0),new p(6,3,!1),new p(7,3,!0)],f=[4,5,4,5,6,7,6,7],g=[5,5,5,5,7,7,7,7],x=[2,3,4,5,6,7,6,7],v=[3,3,5,5,7,7,7,7],b=[1,1,3,3,5,5,7,7],y=[0,1,2,3,2,3,2,3],w={DISPLAY:d[0],TEXT:d[2],SCRIPT:d[4],SCRIPTSCRIPT:d[6]},k=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var S=[];function M(t){for(var e=0;e=S[e]&&t<=S[e+1])return!0;return!1}k.forEach(function(t){return t.blocks.forEach(function(t){return S.push.apply(S,t)})});var z={leftParenInner:"M291 0 H417 V300 H291 z",rightParenInner:"M457 0 H583 V300 H457 z",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",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",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",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",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",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",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",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",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",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",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",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",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",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",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",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",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",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",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",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",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",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",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",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",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",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",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",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",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",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",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",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",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",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",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",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",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",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",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",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",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",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"},A=function(){function t(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}var e=t.prototype;return e.hasClass=function(t){return c.contains(this.classes,t)},e.toNode=function(){for(var t=document.createDocumentFragment(),e=0;e"},N=function(){function t(t,e,r,a){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,B.call(this,t,r,a),this.children=e||[]}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.hasClass=function(t){return c.contains(this.classes,t)},e.toNode=function(){return C.call(this,"span")},e.toMarkup=function(){return q.call(this,"span")},t}(),I=function(){function t(t,e,r,a){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,B.call(this,e,a),this.children=r||[],this.setAttribute("href",t)}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.hasClass=function(t){return c.contains(this.classes,t)},e.toNode=function(){return C.call(this,"a")},e.toMarkup=function(){return q.call(this,"a")},t}(),O=function(){function t(t,e,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=e,this.src=t,this.classes=["mord"],this.style=r}var e=t.prototype;return e.hasClass=function(t){return c.contains(this.classes,t)},e.toNode=function(){var t=document.createElement("img");for(var e in t.src=this.src,t.alt=this.alt,t.className="mord",this.style)this.style.hasOwnProperty(e)&&(t.style[e]=this.style[e]);return t},e.toMarkup=function(){var t=""+this.alt+"=n[0]&&t<=n[1])return r.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[\xee\xef\xed\xec]/.test(this.text)&&(this.text=R[this.text])}var e=t.prototype;return e.hasClass=function(t){return c.contains(this.classes,t)},e.toNode=function(){var t=document.createTextNode(this.text),e=null;for(var r in this.italic>0&&((e=document.createElement("span")).style.marginRight=this.italic+"em"),this.classes.length>0&&((e=e||document.createElement("span")).className=T(this.classes)),this.style)this.style.hasOwnProperty(r)&&((e=e||document.createElement("span")).style[r]=this.style[r]);return e?(e.appendChild(t),e):t},e.toMarkup=function(){var t=!1,e="0&&(r+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(a)&&(r+=c.hyphenate(a)+":"+this.style[a]+";");r&&(t=!0,e+=' style="'+c.escape(r)+'"');var n=c.escape(this.text);return t?(e+=">",e+=n,e+=""):n},t}(),L=function(){function t(t,e){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=e||{}}var e=t.prototype;return e.toNode=function(){var t=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(var r=0;r":""},t}(),D=function(){function t(t){this.attributes=void 0,this.attributes=t||{}}var e=t.prototype;return e.toNode=function(){var t=document.createElementNS("http://www.w3.org/2000/svg","line");for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);return t},e.toMarkup=function(){var t="","\\gt",!0),$("math",Z,et,"\u2208","\\in",!0),$("math",Z,et,"\ue020","\\@not"),$("math",Z,et,"\u2282","\\subset",!0),$("math",Z,et,"\u2283","\\supset",!0),$("math",Z,et,"\u2286","\\subseteq",!0),$("math",Z,et,"\u2287","\\supseteq",!0),$("math",K,et,"\u2288","\\nsubseteq",!0),$("math",K,et,"\u2289","\\nsupseteq",!0),$("math",Z,et,"\u22a8","\\models"),$("math",Z,et,"\u2190","\\leftarrow",!0),$("math",Z,et,"\u2264","\\le"),$("math",Z,et,"\u2264","\\leq",!0),$("math",Z,et,"<","\\lt",!0),$("math",Z,et,"\u2192","\\rightarrow",!0),$("math",Z,et,"\u2192","\\to"),$("math",K,et,"\u2271","\\ngeq",!0),$("math",K,et,"\u2270","\\nleq",!0),$("math",Z,"spacing","\xa0","\\ "),$("math",Z,"spacing","\xa0","~"),$("math",Z,"spacing","\xa0","\\space"),$("math",Z,"spacing","\xa0","\\nobreakspace"),$("text",Z,"spacing","\xa0","\\ "),$("text",Z,"spacing","\xa0"," "),$("text",Z,"spacing","\xa0","~"),$("text",Z,"spacing","\xa0","\\space"),$("text",Z,"spacing","\xa0","\\nobreakspace"),$("math",Z,"spacing",null,"\\nobreak"),$("math",Z,"spacing",null,"\\allowbreak"),$("math",Z,"punct",",",","),$("math",Z,"punct",";",";"),$("math",K,J,"\u22bc","\\barwedge",!0),$("math",K,J,"\u22bb","\\veebar",!0),$("math",Z,J,"\u2299","\\odot",!0),$("math",Z,J,"\u2295","\\oplus",!0),$("math",Z,J,"\u2297","\\otimes",!0),$("math",Z,"textord","\u2202","\\partial",!0),$("math",Z,J,"\u2298","\\oslash",!0),$("math",K,J,"\u229a","\\circledcirc",!0),$("math",K,J,"\u22a1","\\boxdot",!0),$("math",Z,J,"\u25b3","\\bigtriangleup"),$("math",Z,J,"\u25bd","\\bigtriangledown"),$("math",Z,J,"\u2020","\\dagger"),$("math",Z,J,"\u22c4","\\diamond"),$("math",Z,J,"\u22c6","\\star"),$("math",Z,J,"\u25c3","\\triangleleft"),$("math",Z,J,"\u25b9","\\triangleright"),$("math",Z,"open","{","\\{"),$("text",Z,"textord","{","\\{"),$("text",Z,"textord","{","\\textbraceleft"),$("math",Z,"close","}","\\}"),$("text",Z,"textord","}","\\}"),$("text",Z,"textord","}","\\textbraceright"),$("math",Z,"open","{","\\lbrace"),$("math",Z,"close","}","\\rbrace"),$("math",Z,"open","[","\\lbrack",!0),$("text",Z,"textord","[","\\lbrack",!0),$("math",Z,"close","]","\\rbrack",!0),$("text",Z,"textord","]","\\rbrack",!0),$("math",Z,"open","(","\\lparen",!0),$("math",Z,"close",")","\\rparen",!0),$("text",Z,"textord","<","\\textless",!0),$("text",Z,"textord",">","\\textgreater",!0),$("math",Z,"open","\u230a","\\lfloor",!0),$("math",Z,"close","\u230b","\\rfloor",!0),$("math",Z,"open","\u2308","\\lceil",!0),$("math",Z,"close","\u2309","\\rceil",!0),$("math",Z,"textord","\\","\\backslash"),$("math",Z,"textord","\u2223","|"),$("math",Z,"textord","\u2223","\\vert"),$("text",Z,"textord","|","\\textbar",!0),$("math",Z,"textord","\u2225","\\|"),$("math",Z,"textord","\u2225","\\Vert"),$("text",Z,"textord","\u2225","\\textbardbl"),$("text",Z,"textord","~","\\textasciitilde"),$("text",Z,"textord","\\","\\textbackslash"),$("text",Z,"textord","^","\\textasciicircum"),$("math",Z,et,"\u2191","\\uparrow",!0),$("math",Z,et,"\u21d1","\\Uparrow",!0),$("math",Z,et,"\u2193","\\downarrow",!0),$("math",Z,et,"\u21d3","\\Downarrow",!0),$("math",Z,et,"\u2195","\\updownarrow",!0),$("math",Z,et,"\u21d5","\\Updownarrow",!0),$("math",Z,tt,"\u2210","\\coprod"),$("math",Z,tt,"\u22c1","\\bigvee"),$("math",Z,tt,"\u22c0","\\bigwedge"),$("math",Z,tt,"\u2a04","\\biguplus"),$("math",Z,tt,"\u22c2","\\bigcap"),$("math",Z,tt,"\u22c3","\\bigcup"),$("math",Z,tt,"\u222b","\\int"),$("math",Z,tt,"\u222b","\\intop"),$("math",Z,tt,"\u222c","\\iint"),$("math",Z,tt,"\u222d","\\iiint"),$("math",Z,tt,"\u220f","\\prod"),$("math",Z,tt,"\u2211","\\sum"),$("math",Z,tt,"\u2a02","\\bigotimes"),$("math",Z,tt,"\u2a01","\\bigoplus"),$("math",Z,tt,"\u2a00","\\bigodot"),$("math",Z,tt,"\u222e","\\oint"),$("math",Z,tt,"\u2a06","\\bigsqcup"),$("math",Z,tt,"\u222b","\\smallint"),$("text",Z,"inner","\u2026","\\textellipsis"),$("math",Z,"inner","\u2026","\\mathellipsis"),$("text",Z,"inner","\u2026","\\ldots",!0),$("math",Z,"inner","\u2026","\\ldots",!0),$("math",Z,"inner","\u22ef","\\@cdots",!0),$("math",Z,"inner","\u22f1","\\ddots",!0),$("math",Z,"textord","\u22ee","\\varvdots"),$("math",Z,"accent-token","\u02ca","\\acute"),$("math",Z,"accent-token","\u02cb","\\grave"),$("math",Z,"accent-token","\xa8","\\ddot"),$("math",Z,"accent-token","~","\\tilde"),$("math",Z,"accent-token","\u02c9","\\bar"),$("math",Z,"accent-token","\u02d8","\\breve"),$("math",Z,"accent-token","\u02c7","\\check"),$("math",Z,"accent-token","^","\\hat"),$("math",Z,"accent-token","\u20d7","\\vec"),$("math",Z,"accent-token","\u02d9","\\dot"),$("math",Z,"accent-token","\u02da","\\mathring"),$("math",Z,Q,"\ue131","\\@imath"),$("math",Z,Q,"\ue237","\\@jmath"),$("math",Z,"textord","\u0131","\u0131"),$("math",Z,"textord","\u0237","\u0237"),$("text",Z,"textord","\u0131","\\i",!0),$("text",Z,"textord","\u0237","\\j",!0),$("text",Z,"textord","\xdf","\\ss",!0),$("text",Z,"textord","\xe6","\\ae",!0),$("text",Z,"textord","\u0153","\\oe",!0),$("text",Z,"textord","\xf8","\\o",!0),$("text",Z,"textord","\xc6","\\AE",!0),$("text",Z,"textord","\u0152","\\OE",!0),$("text",Z,"textord","\xd8","\\O",!0),$("text",Z,"accent-token","\u02ca","\\'"),$("text",Z,"accent-token","\u02cb","\\`"),$("text",Z,"accent-token","\u02c6","\\^"),$("text",Z,"accent-token","\u02dc","\\~"),$("text",Z,"accent-token","\u02c9","\\="),$("text",Z,"accent-token","\u02d8","\\u"),$("text",Z,"accent-token","\u02d9","\\."),$("text",Z,"accent-token","\u02da","\\r"),$("text",Z,"accent-token","\u02c7","\\v"),$("text",Z,"accent-token","\xa8",'\\"'),$("text",Z,"accent-token","\u02dd","\\H"),$("text",Z,"accent-token","\u25ef","\\textcircled");var rt={"--":!0,"---":!0,"``":!0,"''":!0};$("text",Z,"textord","\u2013","--",!0),$("text",Z,"textord","\u2013","\\textendash"),$("text",Z,"textord","\u2014","---",!0),$("text",Z,"textord","\u2014","\\textemdash"),$("text",Z,"textord","\u2018","`",!0),$("text",Z,"textord","\u2018","\\textquoteleft"),$("text",Z,"textord","\u2019","'",!0),$("text",Z,"textord","\u2019","\\textquoteright"),$("text",Z,"textord","\u201c","``",!0),$("text",Z,"textord","\u201c","\\textquotedblleft"),$("text",Z,"textord","\u201d","''",!0),$("text",Z,"textord","\u201d","\\textquotedblright"),$("math",Z,"textord","\xb0","\\degree",!0),$("text",Z,"textord","\xb0","\\degree"),$("text",Z,"textord","\xb0","\\textdegree",!0),$("math",Z,"textord","\xa3","\\pounds"),$("math",Z,"textord","\xa3","\\mathsterling",!0),$("text",Z,"textord","\xa3","\\pounds"),$("text",Z,"textord","\xa3","\\textsterling",!0),$("math",K,"textord","\u2720","\\maltese"),$("text",K,"textord","\u2720","\\maltese");for(var at=0;at<'0123456789/@."'.length;at++){var nt='0123456789/@."'.charAt(at);$("math",Z,"textord",nt,nt)}for(var it=0;it<'0123456789!@*()-=+";:?/.,'.length;it++){var ot='0123456789!@*()-=+";:?/.,'.charAt(it);$("text",Z,"textord",ot,ot)}for(var st="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",lt=0;lt=5?0:t>=3?1:2]){var r=Y[e]={cssEmPerMu:V.quad[e]/18};for(var a in V)V.hasOwnProperty(a)&&(r[a]=V[a][e])}return Y[e]}(this.size)),this._fontMetrics},e.getColor=function(){return this.phantom?"transparent":this.color},t}();kt.BASESIZE=6;var St=kt,Mt={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},zt={ex:!0,em:!0,mu:!0},At=function(t){return"string"!=typeof t&&(t=t.unit),t in Mt||t in zt||"ex"===t},Tt=function(t,e){var r;if(t.unit in Mt)r=Mt[t.unit]/e.fontMetrics().ptPerEm/e.sizeMultiplier;else if("mu"===t.unit)r=e.fontMetrics().cssEmPerMu;else{var a;if(a=e.style.isTight()?e.havingStyle(e.style.text()):e,"ex"===t.unit)r=a.fontMetrics().xHeight;else{if("em"!==t.unit)throw new o("Invalid unit: '"+t.unit+"'");r=a.fontMetrics().quad}a!==e&&(r*=a.sizeMultiplier/e.sizeMultiplier)}return Math.min(t.number*r,e.maxSize)},Bt=function(t,e,r){return j[r][t]&&j[r][t].replace&&(t=j[r][t].replace),{value:t,metrics:G(t,e,r)}},Ct=function(t,e,r,a,n){var i,o=Bt(t,e,r),s=o.metrics;if(t=o.value,s){var l=s.italic;("text"===r||a&&"mathit"===a.font)&&(l=0),i=new E(t,s.height,s.depth,l,s.skew,s.width,n)}else"undefined"!=typeof console&&console.warn("No character metrics for '"+t+"' in style '"+e+"' and mode '"+r+"'"),i=new E(t,0,0,0,0,0,n);if(a){i.maxFontSize=a.sizeMultiplier,a.style.isTight()&&i.classes.push("mtight");var h=a.getColor();h&&(i.style.color=h)}return i},qt=function(t,e){if(T(t.classes)!==T(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var a in e.style)if(e.style.hasOwnProperty(a)&&t.style[a]!==e.style[a])return!1;return!0},Nt=function(t){for(var e=0,r=0,a=0,n=0;ne&&(e=i.height),i.depth>r&&(r=i.depth),i.maxFontSize>a&&(a=i.maxFontSize)}t.height=e,t.depth=r,t.maxFontSize=a},It=function(t,e,r,a){var n=new N(t,e,r,a);return Nt(n),n},Ot=function(t,e,r,a){return new N(t,e,r,a)},Rt=function(t){var e=new A(t);return Nt(e),e},Et=function(t,e,r){var a="";switch(t){case"amsrm":a="AMS";break;case"textrm":a="Main";break;case"textsf":a="SansSerif";break;case"texttt":a="Typewriter";break;default:a=t}return a+"-"+("textbf"===e&&"textit"===r?"BoldItalic":"textbf"===e?"Bold":"textit"===e?"Italic":"Regular")},Lt={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Pt={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659],leftParenInner:["leftParenInner",.875,.3],rightParenInner:["rightParenInner",.875,.3]},Dt={fontMap:Lt,makeSymbol:Ct,mathsym:function(t,e,r,a){return void 0===a&&(a=[]),"boldsymbol"===r.font&&Bt(t,"Main-Bold",e).metrics?Ct(t,"Main-Bold",e,r,a.concat(["mathbf"])):"\\"===t||"main"===j[e][t].font?Ct(t,"Main-Regular",e,r,a):Ct(t,"AMS-Regular",e,r,a.concat(["amsrm"]))},makeSpan:It,makeSvgSpan:Ot,makeLineSpan:function(t,e,r){var a=It([t],[],e);return a.height=Math.max(r||e.fontMetrics().defaultRuleThickness,e.minRuleThickness),a.style.borderBottomWidth=a.height+"em",a.maxFontSize=1,a},makeAnchor:function(t,e,r,a){var n=new I(t,e,r,a);return Nt(n),n},makeFragment:Rt,wrapFragment:function(t,e){return t instanceof A?It([],[t],e):t},makeVList:function(t,e){for(var r=function(t){if("individualShift"===t.positionType){for(var e=t.children,r=[e[0]],a=-e[0].shift-e[0].elem.depth,n=a,i=1;i0&&(i.push(se(o,e)),o=[]),i.push(n[s]));o.length>0&&i.push(se(o,e)),r&&((a=se(ee(r,e,!0))).classes=["tag"],i.push(a));var h=Zt(["katex-html"],i);if(h.setAttribute("aria-hidden","true"),a){var m=a.children[0];m.style.height=h.height+h.depth+"em",m.style.verticalAlign=-h.depth+"em"}return h}function he(t){return new A(t)}var me=function(){function t(t,e){this.type=void 0,this.attributes=void 0,this.children=void 0,this.type=t,this.attributes={},this.children=e||[]}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.getAttribute=function(t){return this.attributes[t]},e.toNode=function(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(var r=0;r"},e.toText=function(){return this.children.map(function(t){return t.toText()}).join("")},t}(),ce=function(){function t(t){this.text=void 0,this.text=t}var e=t.prototype;return e.toNode=function(){return document.createTextNode(this.text)},e.toMarkup=function(){return c.escape(this.toText())},e.toText=function(){return this.text},t}(),ue={MathNode:me,TextNode:ce,SpaceNode:function(){function t(t){this.width=void 0,this.character=void 0,this.width=t,this.character=t>=.05555&&t<=.05556?"\u200a":t>=.1666&&t<=.1667?"\u2009":t>=.2222&&t<=.2223?"\u2005":t>=.2777&&t<=.2778?"\u2005\u200a":t>=-.05556&&t<=-.05555?"\u200a\u2063":t>=-.1667&&t<=-.1666?"\u2009\u2063":t>=-.2223&&t<=-.2222?"\u205f\u2063":t>=-.2778&&t<=-.2777?"\u2005\u2063":null}var e=t.prototype;return e.toNode=function(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",this.width+"em"),t},e.toMarkup=function(){return this.character?""+this.character+"":''},e.toText=function(){return this.character?this.character:" "},t}(),newDocumentFragment:he},pe=function(t,e,r){return!j[e][t]||!j[e][t].replace||55349===t.charCodeAt(0)||rt.hasOwnProperty(t)&&r&&(r.fontFamily&&"tt"===r.fontFamily.substr(4,2)||r.font&&"tt"===r.font.substr(4,2))||(t=j[e][t].replace),new ue.TextNode(t)},de=function(t){return 1===t.length?t[0]:new ue.MathNode("mrow",t)},fe=function(t,e){if("texttt"===e.fontFamily)return"monospace";if("textsf"===e.fontFamily)return"textit"===e.fontShape&&"textbf"===e.fontWeight?"sans-serif-bold-italic":"textit"===e.fontShape?"sans-serif-italic":"textbf"===e.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===e.fontShape&&"textbf"===e.fontWeight)return"bold-italic";if("textit"===e.fontShape)return"italic";if("textbf"===e.fontWeight)return"bold";var r=e.font;if(!r||"mathnormal"===r)return null;var a=t.mode;if("mathit"===r)return"italic";if("boldsymbol"===r)return"textord"===t.type?"bold":"bold-italic";if("mathbf"===r)return"bold";if("mathbb"===r)return"double-struck";if("mathfrak"===r)return"fraktur";if("mathscr"===r||"mathcal"===r)return"script";if("mathsf"===r)return"sans-serif";if("mathtt"===r)return"monospace";var n=t.text;return c.contains(["\\imath","\\jmath"],n)?null:(j[a][n]&&j[a][n].replace&&(n=j[a][n].replace),G(n,Dt.fontMap[r].fontName,a)?Dt.fontMap[r].variant:null)},ge=function(t,e,r){if(1===t.length){var a=ve(t[0],e);return r&&a instanceof me&&"mo"===a.type&&(a.setAttribute("lspace","0em"),a.setAttribute("rspace","0em")),[a]}for(var n,i=[],o=0;o0&&(p.text=p.text.slice(0,1)+"\u0338"+p.text.slice(1),i.pop())}}}i.push(s),n=s}return i},xe=function(t,e,r){return de(ge(t,e,r))},ve=function(t,e){if(!t)return new ue.MathNode("mrow");if(Xt[t.type])return Xt[t.type](t,e);throw new o("Got group of unknown type: '"+t.type+"'")};function be(t,e,r,a,n){var i,o=ge(t,r);i=1===o.length&&o[0]instanceof me&&c.contains(["mrow","mtable"],o[0].type)?o[0]:new ue.MathNode("mrow",o);var s=new ue.MathNode("annotation",[new ue.TextNode(e)]);s.setAttribute("encoding","application/x-tex");var l=new ue.MathNode("semantics",[i,s]),h=new ue.MathNode("math",[l]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),a&&h.setAttribute("display","block");var m=n?"katex":"katex-mathml";return Dt.makeSpan([m],[h])}var ye=function(t){return new St({style:t.displayMode?w.DISPLAY:w.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},we=function(t,e){if(e.displayMode){var r=["katex-display"];e.leqno&&r.push("leqno"),e.fleqn&&r.push("fleqn"),t=Dt.makeSpan(r,[t])}return t},ke=function(t,e,r){var a,n=ye(r);if("mathml"===r.output)return be(t,e,n,r.displayMode,!0);if("html"===r.output){var i=le(t,n);a=Dt.makeSpan(["katex"],[i])}else{var o=be(t,e,n,r.displayMode,!1),s=le(t,n);a=Dt.makeSpan(["katex"],[o,s])}return we(a,r)},Se={widehat:"^",widecheck:"\u02c7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23df",overbrace:"\u23de",overgroup:"\u23e0",undergroup:"\u23e1",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21d2",xRightarrow:"\u21d2",overleftharpoon:"\u21bc",xleftharpoonup:"\u21bc",overrightharpoon:"\u21c0",xrightharpoonup:"\u21c0",xLeftarrow:"\u21d0",xLeftrightarrow:"\u21d4",xhookleftarrow:"\u21a9",xhookrightarrow:"\u21aa",xmapsto:"\u21a6",xrightharpoondown:"\u21c1",xleftharpoondown:"\u21bd",xrightleftharpoons:"\u21cc",xleftrightharpoons:"\u21cb",xtwoheadleftarrow:"\u219e",xtwoheadrightarrow:"\u21a0",xlongequal:"=",xtofrom:"\u21c4",xrightleftarrows:"\u21c4",xrightequilibrium:"\u21cc",xleftequilibrium:"\u21cb"},Me={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},ze=function(t){return"ordgroup"===t.type?t.body.length:1},Ae=function(t,e,r,a){var n,i=t.height+t.depth+2*r;if(/fbox|color/.test(e)){if(n=Dt.makeSpan(["stretchy",e],[],a),"fbox"===e){var o=a.color&&a.getColor();o&&(n.style.borderColor=o)}}else{var s=[];/^[bx]cancel$/.test(e)&&s.push(new D({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(e)&&s.push(new D({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var l=new L(s,{width:"100%",height:i+"em"});n=Dt.makeSvgSpan([],[l],a)}return n.height=i,n.style.height=i+"em",n},Te=function(t){var e=new ue.MathNode("mo",[new ue.TextNode(Se[t.substr(1)])]);return e.setAttribute("stretchy","true"),e},Be=function(t,e){var r=function(){var r=4e5,a=t.label.substr(1);if(c.contains(["widehat","widecheck","widetilde","utilde"],a)){var n,i,o,s=ze(t.base);if(s>5)"widehat"===a||"widecheck"===a?(n=420,r=2364,o=.42,i=a+"4"):(n=312,r=2340,o=.34,i="tilde4");else{var l=[1,1,2,2,3,3][s];"widehat"===a||"widecheck"===a?(r=[0,1062,2364,2364,2364][l],n=[0,239,300,360,420][l],o=[0,.24,.3,.3,.36,.42][l],i=a+l):(r=[0,600,1033,2339,2340][l],n=[0,260,286,306,312][l],o=[0,.26,.286,.3,.306,.34][l],i="tilde"+l)}var h=new P(i),m=new L([h],{width:"100%",height:o+"em",viewBox:"0 0 "+r+" "+n,preserveAspectRatio:"none"});return{span:Dt.makeSvgSpan([],[m],e),minWidth:0,height:o}}var u,p,d=[],f=Me[a],g=f[0],x=f[1],v=f[2],b=v/1e3,y=g.length;if(1===y)u=["hide-tail"],p=[f[3]];else if(2===y)u=["halfarrow-left","halfarrow-right"],p=["xMinYMin","xMaxYMin"];else{if(3!==y)throw new Error("Correct katexImagesData or update code here to support\n "+y+" children.");u=["brace-left","brace-center","brace-right"],p=["xMinYMin","xMidYMin","xMaxYMin"]}for(var w=0;w0&&(a.style.minWidth=n+"em"),a};function Ce(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function qe(t){var e=Ne(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Ne(t){return t&&("atom"===t.type||X.hasOwnProperty(t.type))?t:null}var Ie=function(t,e){var r,a,n;t&&"supsub"===t.type?(r=(a=Ce(t.base,"accent")).base,t.base=r,n=function(t){if(t instanceof N)return t;throw new Error("Expected span but got "+String(t)+".")}(oe(t,e)),t.base=a):r=(a=Ce(t,"accent")).base;var i=oe(r,e.havingCrampedStyle()),o=0;if(a.isShifty&&c.isCharacterBox(r)){var s=c.getBaseElem(r);o=H(oe(s,e.havingCrampedStyle())).skew}var l,h=Math.min(i.height,e.fontMetrics().xHeight);if(a.isStretchy)l=Be(a,e),l=Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:l,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+2*o+"em)",marginLeft:2*o+"em"}:void 0}]},e);else{var m,u;"\\vec"===a.label?(m=Dt.staticSvg("vec",e),u=Dt.svgData.vec[1]):((m=H(m=Dt.makeOrd({mode:a.mode,text:a.label},e,"textord"))).italic=0,u=m.width),l=Dt.makeSpan(["accent-body"],[m]);var p="\\textcircled"===a.label;p&&(l.classes.push("accent-full"),h=i.height);var d=o;p||(d-=u/2),l.style.left=d+"em","\\textcircled"===a.label&&(l.style.top=".2em"),l=Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-h},{type:"elem",elem:l}]},e)}var f=Dt.makeSpan(["mord","accent"],[l],e);return n?(n.children[0]=f,n.height=Math.max(f.height,n.height),n.classes[0]="mord",n):f},Oe=function(t,e){var r=t.isStretchy?Te(t.label):new ue.MathNode("mo",[pe(t.label,t.mode)]),a=new ue.MathNode("mover",[ve(t.base,e),r]);return a.setAttribute("accent","true"),a},Re=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(function(t){return"\\"+t}).join("|"));_t({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:function(t,e){var r=e[0],a=!Re.test(t.funcName),n=!a||"\\widehat"===t.funcName||"\\widetilde"===t.funcName||"\\widecheck"===t.funcName;return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:a,isShifty:n,base:r}},htmlBuilder:Ie,mathmlBuilder:Oe}),_t({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!1},handler:function(t,e){var r=e[0];return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:Ie,mathmlBuilder:Oe}),_t({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:function(t,e){var r=t.parser,a=t.funcName,n=e[0];return{type:"accentUnder",mode:r.mode,label:a,base:n}},htmlBuilder:function(t,e){var r=oe(t.base,e),a=Be(t,e),n="\\utilde"===t.label?.12:0,i=Dt.makeVList({positionType:"top",positionData:r.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:n},{type:"elem",elem:r}]},e);return Dt.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:function(t,e){var r=Te(t.label),a=new ue.MathNode("munder",[ve(t.base,e),r]);return a.setAttribute("accentunder","true"),a}});var Ee=function(t){var e=new ue.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};_t({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium"],props:{numArgs:1,numOptionalArgs:1},handler:function(t,e,r){var a=t.parser,n=t.funcName;return{type:"xArrow",mode:a.mode,label:n,body:e[0],below:r[0]}},htmlBuilder:function(t,e){var r,a=e.style,n=e.havingStyle(a.sup()),i=Dt.wrapFragment(oe(t.body,n,e),e);i.classes.push("x-arrow-pad"),t.below&&(n=e.havingStyle(a.sub()),(r=Dt.wrapFragment(oe(t.below,n,e),e)).classes.push("x-arrow-pad"));var o,s=Be(t,e),l=-e.fontMetrics().axisHeight+.5*s.height,h=-e.fontMetrics().axisHeight-.5*s.height-.111;if((i.depth>.25||"\\xleftequilibrium"===t.label)&&(h-=i.depth),r){var m=-e.fontMetrics().axisHeight+r.height+.5*s.height+.111;o=Dt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:h},{type:"elem",elem:s,shift:l},{type:"elem",elem:r,shift:m}]},e)}else o=Dt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:h},{type:"elem",elem:s,shift:l}]},e);return o.children[0].children[0].children[1].classes.push("svg-align"),Dt.makeSpan(["mrel","x-arrow"],[o],e)},mathmlBuilder:function(t,e){var r,a=Te(t.label);if(t.body){var n=Ee(ve(t.body,e));if(t.below){var i=Ee(ve(t.below,e));r=new ue.MathNode("munderover",[a,i,n])}else r=new ue.MathNode("mover",[a,n])}else if(t.below){var o=Ee(ve(t.below,e));r=new ue.MathNode("munder",[a,o])}else r=Ee(),r=new ue.MathNode("mover",[a,r]);return r}}),_t({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){for(var r=t.parser,a=Ce(e[0],"ordgroup").body,n="",i=0;i","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Je=[0,1.2,1.8,2.4,3],Qe=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],tr=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"stack"}],er=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],rr=function(t){if("small"===t.type)return"Main-Regular";if("large"===t.type)return"Size"+t.size+"-Regular";if("stack"===t.type)return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},ar=function(t,e,r,a){for(var n=Math.min(2,3-a.style.size);ne)return r[n]}return r[r.length-1]},nr=function(t,e,r,a,n,i){var o;"<"===t||"\\lt"===t||"\u27e8"===t?t="\\langle":">"!==t&&"\\gt"!==t&&"\u27e9"!==t||(t="\\rangle"),o=c.contains(Ke,t)?Qe:c.contains($e,t)?er:tr;var s=ar(t,e,o,a);return"small"===s.type?function(t,e,r,a,n,i){var o=Dt.makeSymbol(t,"Main-Regular",n,a),s=Ue(o,e,a,i);return r&&Ge(s,a,e),s}(t,s.style,r,a,n,i):"large"===s.type?Ye(t,s.size,r,a,n,i):_e(t,e,r,a,n,i)},ir=function(t,e){var r,a,n=e.havingBaseSizing(),i=ar("\\surd",t*n.sizeMultiplier,er,n),o=n.sizeMultiplier,s=Math.max(0,e.minRuleThickness-e.fontMetrics().sqrtRuleThickness),l=0,h=0,m=0;return"small"===i.type?(t<1?o=1:t<1.4&&(o=.7),h=(1+s)/o,(r=je("sqrtMain",l=(1+s+.08)/o,m=1e3+1e3*s+80,s,e)).style.minWidth="0.853em",a=.833/o):"large"===i.type?(m=1080*Je[i.size],h=(Je[i.size]+s)/o,l=(Je[i.size]+s+.08)/o,(r=je("sqrtSize"+i.size,l,m,s,e)).style.minWidth="1.02em",a=1/o):(l=t+s+.08,h=t+s,m=Math.floor(1e3*t+s)+80,(r=je("sqrtTall",l,m,s,e)).style.minWidth="0.742em",a=1.056),r.height=h,r.style.height=l+"em",{span:r,advanceWidth:a,ruleWidth:(e.fontMetrics().sqrtRuleThickness+s)*o}},or=function(t,e,r,a,n){if("<"===t||"\\lt"===t||"\u27e8"===t?t="\\langle":">"!==t&&"\\gt"!==t&&"\u27e9"!==t||(t="\\rangle"),c.contains($e,t)||c.contains(Ke,t))return Ye(t,e,!1,r,a,n);if(c.contains(Ze,t))return _e(t,Je[e],!1,r,a,n);throw new o("Illegal delimiter: '"+t+"'")},sr=nr,lr=function(t,e,r,a,n,i){var o=a.fontMetrics().axisHeight*a.sizeMultiplier,s=5/a.fontMetrics().ptPerEm,l=Math.max(e-o,r+o),h=Math.max(l/500*901,2*l-s);return nr(t,h,!0,a,n,i)},hr={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},mr=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230a","\u230b","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27e8","\\rangle","\u27e9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27ee","\u27ef","\\lmoustache","\\rmoustache","\u23b0","\u23b1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function cr(t,e){var r=Ne(t);if(r&&c.contains(mr,r.text))return r;throw new o(r?"Invalid delimiter '"+r.text+"' after '"+e.funcName+"'":"Invalid delimiter type '"+t.type+"'",t)}function ur(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}_t({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1},handler:function(t,e){var r=cr(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:hr[t.funcName].size,mclass:hr[t.funcName].mclass,delim:r.text}},htmlBuilder:function(t,e){return"."===t.delim?Dt.makeSpan([t.mclass]):or(t.delim,t.size,e,t.mode,[t.mclass])},mathmlBuilder:function(t){var e=[];"."!==t.delim&&e.push(pe(t.delim,t.mode));var r=new ue.MathNode("mo",e);return"mopen"===t.mclass||"mclose"===t.mclass?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r}}),_t({type:"leftright-right",names:["\\right"],props:{numArgs:1},handler:function(t,e){var r=t.parser.gullet.macros.get("\\current@color");if(r&&"string"!=typeof r)throw new o("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:cr(e[0],t).text,color:r}}}),_t({type:"leftright",names:["\\left"],props:{numArgs:1},handler:function(t,e){var r=cr(e[0],t),a=t.parser;++a.leftrightDepth;var n=a.parseExpression(!1);--a.leftrightDepth,a.expect("\\right",!1);var i=Ce(a.parseFunction(),"leftright-right");return{type:"leftright",mode:a.mode,body:n,left:r.text,right:i.delim,rightColor:i.color}},htmlBuilder:function(t,e){ur(t);for(var r,a,n=ee(t.body,e,!0,["mopen","mclose"]),i=0,o=0,s=!1,l=0;l-1?"mpadded":"menclose",[ve(t.body,e)]);switch(t.label){case"\\cancel":a.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":a.setAttribute("notation","downdiagonalstrike");break;case"\\sout":a.setAttribute("notation","horizontalstrike");break;case"\\fbox":a.setAttribute("notation","box");break;case"\\fcolorbox":case"\\colorbox":if(r=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,a.setAttribute("width","+"+2*r+"pt"),a.setAttribute("height","+"+2*r+"pt"),a.setAttribute("lspace",r+"pt"),a.setAttribute("voffset",r+"pt"),"\\fcolorbox"===t.label){var n=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);a.setAttribute("style","border: "+n+"em solid "+String(t.borderColor))}break;case"\\xcancel":a.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return t.backgroundColor&&a.setAttribute("mathbackground",t.backgroundColor),a};_t({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,greediness:3,argTypes:["color","text"]},handler:function(t,e,r){var a=t.parser,n=t.funcName,i=Ce(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:a.mode,label:n,backgroundColor:i,body:o}},htmlBuilder:pr,mathmlBuilder:dr}),_t({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,greediness:3,argTypes:["color","color","text"]},handler:function(t,e,r){var a=t.parser,n=t.funcName,i=Ce(e[0],"color-token").color,o=Ce(e[1],"color-token").color,s=e[2];return{type:"enclose",mode:a.mode,label:n,backgroundColor:o,borderColor:i,body:s}},htmlBuilder:pr,mathmlBuilder:dr}),_t({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:function(t,e){return{type:"enclose",mode:t.parser.mode,label:"\\fbox",body:e[0]}}}),_t({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout"],props:{numArgs:1},handler:function(t,e,r){var a=t.parser,n=t.funcName,i=e[0];return{type:"enclose",mode:a.mode,label:n,body:i}},htmlBuilder:pr,mathmlBuilder:dr});var fr={};function gr(t){for(var e=t.type,r=t.names,a=t.props,n=t.handler,i=t.htmlBuilder,o=t.mathmlBuilder,s={type:e,numArgs:a.numArgs||0,greediness:1,allowedInText:!1,numOptionalArgs:0,handler:n},l=0;l0&&(b+=.25),h.push({pos:b,isDashed:t[e]})}for(y(i[0]),r=0;r0&&(M<(B+=v)&&(M=B),B=0),t.addJot&&(M+=f),z.height=S,z.depth=M,b+=S,z.pos=b,b+=M+B,l[r]=z,y(i[r+1])}var C,q,N=b/2+e.fontMetrics().axisHeight,I=t.cols||[],O=[];for(a=0,q=0;a=s)){var D=void 0;(a>0||t.hskipBeforeAndAfter)&&0!==(D=c.deflt(R.pregap,p))&&((C=Dt.makeSpan(["arraycolsep"],[])).style.width=D+"em",O.push(C));var H=[];for(r=0;r0){for(var G=Dt.makeLineSpan("hline",e,m),Y=Dt.makeLineSpan("hdashline",e,m),W=[{type:"elem",elem:l,shift:0}];h.length>0;){var X=h.pop(),_=X.pos-N;X.isDashed?W.push({type:"elem",elem:Y,shift:_}):W.push({type:"elem",elem:G,shift:_})}l=Dt.makeVList({positionType:"individualShift",children:W},e)}return Dt.makeSpan(["mord"],[l],e)},wr={c:"center ",l:"left ",r:"right "},kr=function(t,e){var r=new ue.MathNode("mtable",t.body.map(function(t){return new ue.MathNode("mtr",t.map(function(t){return new ue.MathNode("mtd",[ve(t,e)])}))})),a=.5===t.arraystretch?.1:.16+t.arraystretch-1+(t.addJot?.09:0);r.setAttribute("rowspacing",a+"em");var n="",i="";if(t.cols&&t.cols.length>0){var o=t.cols,s="",l=!1,h=0,m=o.length;"separator"===o[0].type&&(n+="top ",h=1),"separator"===o[o.length-1].type&&(n+="bottom ",m-=1);for(var c=h;c0?"left ":"",n+=g[g.length-1].length>0?"right ":"";for(var x=1;x0&&m&&(p=1),a[c]={type:"align",align:u,pregap:p,postgap:0}}return n.colSeparationType=m?"align":"alignat",n};gr({type:"array",names:["array","darray"],props:{numArgs:1},handler:function(t,e){var r={cols:(Ne(e[0])?[e[0]]:Ce(e[0],"ordgroup").body).map(function(t){var e=qe(t).text;if(-1!=="lcr".indexOf(e))return{type:"align",align:e};if("|"===e)return{type:"separator",separator:"|"};if(":"===e)return{type:"separator",separator:":"};throw new o("Unknown column alignment: "+e,t)}),hskipBeforeAndAfter:!0};return vr(t.parser,r,br(t.envName))},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix"],props:{numArgs:0},handler:function(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName],r=vr(t.parser,{hskipBeforeAndAfter:!1},br(t.envName));return e?{type:"leftright",mode:t.mode,body:[r],left:e[0],right:e[1],rightColor:void 0}:r},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:function(t){var e=vr(t.parser,{arraystretch:.5},"script");return e.colSeparationType="small",e},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["subarray"],props:{numArgs:1},handler:function(t,e){var r=(Ne(e[0])?[e[0]]:Ce(e[0],"ordgroup").body).map(function(t){var e=qe(t).text;if(-1!=="lc".indexOf(e))return{type:"align",align:e};throw new o("Unknown column alignment: "+e,t)});if(r.length>1)throw new o("{subarray} can contain only one column");var a={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5};if((a=vr(t.parser,a,"script")).body.length>0&&a.body[0].length>1)throw new o("{subarray} can contain only one column");return a},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler:function(t){var e=vr(t.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},br(t.envName));return{type:"leftright",mode:t.mode,body:[e],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["aligned"],props:{numArgs:0},handler:Sr,htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["gathered"],props:{numArgs:0},handler:function(t){return vr(t.parser,{cols:[{type:"align",align:"c"}],addJot:!0},"display")},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["alignedat"],props:{numArgs:1},handler:Sr,htmlBuilder:yr,mathmlBuilder:kr}),_t({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler:function(t,e){throw new o(t.funcName+" valid only within array environment")}});var Mr=fr;_t({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler:function(t,e){var r=t.parser,a=t.funcName,n=e[0];if("ordgroup"!==n.type)throw new o("Invalid environment name",n);for(var i="",s=0;s=w.SCRIPT.id?r.text():w.DISPLAY:"text"===t&&r.size===w.DISPLAY.size?r=w.TEXT:"script"===t?r=w.SCRIPT:"scriptscript"===t&&(r=w.SCRIPTSCRIPT),r},Or=function(t,e){var r,a=Ir(t.size,e.style),n=a.fracNum(),i=a.fracDen();r=e.havingStyle(n);var o=oe(t.numer,r,e);if(t.continued){var s=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height0?3*c:7*c,d=e.fontMetrics().denom1):(m>0?(u=e.fontMetrics().num2,p=c):(u=e.fontMetrics().num3,p=3*c),d=e.fontMetrics().denom2),h){var y=e.fontMetrics().axisHeight;u-o.depth-(y+.5*m)0&&(e="."===(e=t)?null:e),e};_t({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,greediness:6,argTypes:["math","math","size","text","math","math"]},handler:function(t,e){var r,a=t.parser,n=e[4],i=e[5],o="atom"===e[0].type&&"open"===e[0].family?Lr(e[0].text):null,s="atom"===e[1].type&&"close"===e[1].family?Lr(e[1].text):null,l=Ce(e[2],"size"),h=null;r=!!l.isBlank||(h=l.value).number>0;var m="auto",c=e[3];if("ordgroup"===c.type){if(c.body.length>0){var u=Ce(c.body[0],"textord");m=Er[Number(u.text)]}}else c=Ce(c,"textord"),m=Er[Number(c.text)];return{type:"genfrac",mode:a.mode,numer:n,denom:i,continued:!1,hasBarLine:r,barSize:h,leftDelim:o,rightDelim:s,size:m}},htmlBuilder:Or,mathmlBuilder:Rr}),_t({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:function(t,e){var r=t.parser,a=(t.funcName,t.token);return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:Ce(e[0],"size").value,token:a}}}),_t({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:function(t,e){var r=t.parser,a=(t.funcName,e[0]),n=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t}(Ce(e[1],"infix").size),i=e[2],o=n.number>0;return{type:"genfrac",mode:r.mode,numer:a,denom:i,continued:!1,hasBarLine:o,barSize:n,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:Or,mathmlBuilder:Rr});var Pr=function(t,e){var r,a,n=e.style;"supsub"===t.type?(r=t.sup?oe(t.sup,e.havingStyle(n.sup()),e):oe(t.sub,e.havingStyle(n.sub()),e),a=Ce(t.base,"horizBrace")):a=Ce(t,"horizBrace");var i,o=oe(a.base,e.havingBaseStyle(w.DISPLAY)),s=Be(a,e);if(a.isOver?(i=Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]},e)).children[0].children[0].children[1].classes.push("svg-align"):(i=Dt.makeVList({positionType:"bottom",positionData:o.depth+.1+s.height,children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]},e)).children[0].children[0].children[0].classes.push("svg-align"),r){var l=Dt.makeSpan(["mord",a.isOver?"mover":"munder"],[i],e);i=a.isOver?Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]},e):Dt.makeVList({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]},e)}return Dt.makeSpan(["mord",a.isOver?"mover":"munder"],[i],e)};_t({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler:function(t,e){var r=t.parser,a=t.funcName;return{type:"horizBrace",mode:r.mode,label:a,isOver:/^\\over/.test(a),base:e[0]}},htmlBuilder:Pr,mathmlBuilder:function(t,e){var r=Te(t.label);return new ue.MathNode(t.isOver?"mover":"munder",[ve(t.base,e),r])}}),_t({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:function(t,e){var r=t.parser,a=e[1],n=Ce(e[0],"url").url;return r.settings.isTrusted({command:"\\href",url:n})?{type:"href",mode:r.mode,href:n,body:$t(a)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:function(t,e){var r=ee(t.body,e,!1);return Dt.makeAnchor(t.href,[],r,e)},mathmlBuilder:function(t,e){var r=xe(t.body,e);return r instanceof me||(r=new me("mrow",[r])),r.setAttribute("href",t.href),r}}),_t({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:function(t,e){var r=t.parser,a=Ce(e[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:a}))return r.formatUnsupportedCmd("\\url");for(var n=[],i=0;i0&&(a=Tt(t.totalheight,e)-r,a=Number(a.toFixed(2)));var n=0;t.width.number>0&&(n=Tt(t.width,e));var i={height:r+a+"em"};n>0&&(i.width=n+"em"),a>0&&(i.verticalAlign=-a+"em");var o=new O(t.src,t.alt,i);return o.height=r,o.depth=a,o},mathmlBuilder:function(t,e){var r=new ue.MathNode("mglyph",[]);r.setAttribute("alt",t.alt);var a=Tt(t.height,e),n=0;if(t.totalheight.number>0&&(n=(n=Tt(t.totalheight,e)-a).toFixed(2),r.setAttribute("valign","-"+n+"em")),r.setAttribute("height",a+n+"em"),t.width.number>0){var i=Tt(t.width,e);r.setAttribute("width",i+"em")}return r.setAttribute("src",t.src),r}}),_t({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],allowedInText:!0},handler:function(t,e){var r=t.parser,a=t.funcName,n=Ce(e[0],"size");if(r.settings.strict){var i="m"===a[1],o="mu"===n.value.unit;i?(o||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" supports only mu units, not "+n.value.unit+" units"),"math"!==r.mode&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" works only in math mode")):o&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:n.value}},htmlBuilder:function(t,e){return Dt.makeGlue(t.dimension,e)},mathmlBuilder:function(t,e){var r=Tt(t.dimension,e);return new ue.SpaceNode(r)}}),_t({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){var r=t.parser,a=t.funcName,n=e[0];return{type:"lap",mode:r.mode,alignment:a.slice(5),body:n}},htmlBuilder:function(t,e){var r;"clap"===t.alignment?(r=Dt.makeSpan([],[oe(t.body,e)]),r=Dt.makeSpan(["inner"],[r],e)):r=Dt.makeSpan(["inner"],[oe(t.body,e)]);var a=Dt.makeSpan(["fix"],[]),n=Dt.makeSpan([t.alignment],[r,a],e),i=Dt.makeSpan(["strut"]);return i.style.height=n.height+n.depth+"em",i.style.verticalAlign=-n.depth+"em",n.children.unshift(i),n=Dt.makeSpan(["thinbox"],[n],e),Dt.makeSpan(["mord","vbox"],[n],e)},mathmlBuilder:function(t,e){var r=new ue.MathNode("mpadded",[ve(t.body,e)]);if("rlap"!==t.alignment){var a="llap"===t.alignment?"-1":"-0.5";r.setAttribute("lspace",a+"width")}return r.setAttribute("width","0px"),r}}),_t({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(t,e){var r=t.funcName,a=t.parser,n=a.mode;a.switchMode("math");var i="\\("===r?"\\)":"$",o=a.parseExpression(!1,i);return a.expect(i),a.switchMode(n),{type:"styling",mode:a.mode,style:"text",body:o}}}),_t({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(t,e){throw new o("Mismatched "+t.funcName)}});var Hr=function(t,e){switch(e.style.size){case w.DISPLAY.size:return t.display;case w.TEXT.size:return t.text;case w.SCRIPT.size:return t.script;case w.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};_t({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4},handler:function(t,e){return{type:"mathchoice",mode:t.parser.mode,display:$t(e[0]),text:$t(e[1]),script:$t(e[2]),scriptscript:$t(e[3])}},htmlBuilder:function(t,e){var r=Hr(t,e),a=ee(r,e,!1);return Dt.makeFragment(a)},mathmlBuilder:function(t,e){var r=Hr(t,e);return xe(r,e)}});var Fr=function(t,e,r,a,n,i,o){var s,l,h;if(t=Dt.makeSpan([],[t]),e){var m=oe(e,a.havingStyle(n.sup()),a);l={elem:m,kern:Math.max(a.fontMetrics().bigOpSpacing1,a.fontMetrics().bigOpSpacing3-m.depth)}}if(r){var c=oe(r,a.havingStyle(n.sub()),a);s={elem:c,kern:Math.max(a.fontMetrics().bigOpSpacing2,a.fontMetrics().bigOpSpacing4-c.height)}}if(l&&s){var u=a.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+t.depth+o;h=Dt.makeVList({positionType:"bottom",positionData:u,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:-i+"em"},{type:"kern",size:s.kern},{type:"elem",elem:t},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:i+"em"},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else if(s){var p=t.height-o;h=Dt.makeVList({positionType:"top",positionData:p,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:-i+"em"},{type:"kern",size:s.kern},{type:"elem",elem:t}]},a)}else{if(!l)return t;var d=t.depth+o;h=Dt.makeVList({positionType:"bottom",positionData:d,children:[{type:"elem",elem:t},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:i+"em"},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}return Dt.makeSpan(["mop","op-limits"],[h],a)},Vr=["\\smallint"],Ur=function(t,e){var r,a,n,i=!1;"supsub"===t.type?(r=t.sup,a=t.sub,n=Ce(t.base,"op"),i=!0):n=Ce(t,"op");var o,s=e.style,l=!1;if(s.size===w.DISPLAY.size&&n.symbol&&!c.contains(Vr,n.name)&&(l=!0),n.symbol){var h=l?"Size2-Regular":"Size1-Regular",m="";if("\\oiint"!==n.name&&"\\oiiint"!==n.name||(m=n.name.substr(1),n.name="oiint"===m?"\\iint":"\\iiint"),o=Dt.makeSymbol(n.name,h,"math",e,["mop","op-symbol",l?"large-op":"small-op"]),m.length>0){var u=o.italic,p=Dt.staticSvg(m+"Size"+(l?"2":"1"),e);o=Dt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:p,shift:l?.08:0}]},e),n.name="\\"+m,o.classes.unshift("mop"),o.italic=u}}else if(n.body){var d=ee(n.body,e,!0);1===d.length&&d[0]instanceof E?(o=d[0]).classes[0]="mop":o=Dt.makeSpan(["mop"],Dt.tryCombineChars(d),e)}else{for(var f=[],g=1;g0){for(var s=n.body.map(function(t){var e=t.text;return"string"==typeof e?{type:"textord",mode:t.mode,text:e}:t}),l=ee(s,e.withFont("mathrm"),!0),h=0;h=0?s.setAttribute("height","+"+n+"em"):(s.setAttribute("height",n+"em"),s.setAttribute("depth","+"+-n+"em")),s.setAttribute("voffset",n+"em"),s}});var jr=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];_t({type:"sizing",names:jr,props:{numArgs:0,allowedInText:!0},handler:function(t,e){var r=t.breakOnTokenText,a=t.funcName,n=t.parser,i=n.parseExpression(!1,r);return{type:"sizing",mode:n.mode,size:jr.indexOf(a)+1,body:i}},htmlBuilder:function(t,e){var r=e.havingSize(t.size);return _r(t.body,r,e)},mathmlBuilder:function(t,e){var r=e.havingSize(t.size),a=ge(t.body,r),n=new ue.MathNode("mstyle",a);return n.setAttribute("mathsize",r.sizeMultiplier+"em"),n}}),_t({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:function(t,e,r){var a=t.parser,n=!1,i=!1,o=r[0]&&Ce(r[0],"ordgroup");if(o)for(var s="",l=0;lr.height+r.depth+i&&(i=(i+c-r.height-r.depth)/2);var u=l.height-r.height-i-h;r.style.paddingLeft=m+"em";var p=Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+u)},{type:"elem",elem:l},{type:"kern",size:h}]},e);if(t.index){var d=e.havingStyle(w.SCRIPTSCRIPT),f=oe(t.index,d,e),g=.6*(p.height-p.depth),x=Dt.makeVList({positionType:"shift",positionData:-g,children:[{type:"elem",elem:f}]},e),v=Dt.makeSpan(["root"],[x]);return Dt.makeSpan(["mord","sqrt"],[v,p],e)}return Dt.makeSpan(["mord","sqrt"],[p],e)},mathmlBuilder:function(t,e){var r=t.body,a=t.index;return a?new ue.MathNode("mroot",[ve(r,e),ve(a,e)]):new ue.MathNode("msqrt",[ve(r,e)])}});var $r={display:w.DISPLAY,text:w.TEXT,script:w.SCRIPT,scriptscript:w.SCRIPTSCRIPT};_t({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0},handler:function(t,e){var r=t.breakOnTokenText,a=t.funcName,n=t.parser,i=n.parseExpression(!0,r),o=a.slice(1,a.length-5);return{type:"styling",mode:n.mode,style:o,body:i}},htmlBuilder:function(t,e){var r=$r[t.style],a=e.havingStyle(r).withFont("");return _r(t.body,a,e)},mathmlBuilder:function(t,e){var r=$r[t.style],a=e.havingStyle(r),n=ge(t.body,a),i=new ue.MathNode("mstyle",n),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[t.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});jt({type:"supsub",htmlBuilder:function(t,e){var r=function(t,e){var r=t.base;return r?"op"===r.type?r.limits&&(e.style.size===w.DISPLAY.size||r.alwaysHandleSupSub)?Ur:null:"operatorname"===r.type?r.alwaysHandleSupSub&&(e.style.size===w.DISPLAY.size||r.limits)?Xr:null:"accent"===r.type?c.isCharacterBox(r.base)?Ie:null:"horizBrace"===r.type&&!t.sub===r.isOver?Pr:null:null}(t,e);if(r)return r(t,e);var a,n,i,o=t.base,s=t.sup,l=t.sub,h=oe(o,e),m=e.fontMetrics(),u=0,p=0,d=o&&c.isCharacterBox(o);if(s){var f=e.havingStyle(e.style.sup());a=oe(s,f,e),d||(u=h.height-f.fontMetrics().supDrop*f.sizeMultiplier/e.sizeMultiplier)}if(l){var g=e.havingStyle(e.style.sub());n=oe(l,g,e),d||(p=h.depth+g.fontMetrics().subDrop*g.sizeMultiplier/e.sizeMultiplier)}i=e.style===w.DISPLAY?m.sup1:e.style.cramped?m.sup3:m.sup2;var x,v=e.sizeMultiplier,b=.5/m.ptPerEm/v+"em",y=null;if(n){var k=t.base&&"op"===t.base.type&&t.base.name&&("\\oiint"===t.base.name||"\\oiiint"===t.base.name);(h instanceof E||k)&&(y=-h.italic+"em")}if(a&&n){u=Math.max(u,i,a.depth+.25*m.xHeight),p=Math.max(p,m.sub2);var S=4*m.defaultRuleThickness;if(u-a.depth-(n.height-p)0&&(u+=M,p-=M)}var z=[{type:"elem",elem:n,shift:p,marginRight:b,marginLeft:y},{type:"elem",elem:a,shift:-u,marginRight:b}];x=Dt.makeVList({positionType:"individualShift",children:z},e)}else if(n){p=Math.max(p,m.sub1,n.height-.8*m.xHeight);var A=[{type:"elem",elem:n,marginLeft:y,marginRight:b}];x=Dt.makeVList({positionType:"shift",positionData:p,children:A},e)}else{if(!a)throw new Error("supsub must have either sup or sub.");u=Math.max(u,i,a.depth+.25*m.xHeight),x=Dt.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:b}]},e)}var T=ne(h,"right")||"mord";return Dt.makeSpan([T],[h,Dt.makeSpan(["msupsub"],[x])],e)},mathmlBuilder:function(t,e){var r,a=!1;t.base&&"horizBrace"===t.base.type&&!!t.sup===t.base.isOver&&(a=!0,r=t.base.isOver),!t.base||"op"!==t.base.type&&"operatorname"!==t.base.type||(t.base.parentIsSupSub=!0);var n,i=[ve(t.base,e)];if(t.sub&&i.push(ve(t.sub,e)),t.sup&&i.push(ve(t.sup,e)),a)n=r?"mover":"munder";else if(t.sub)if(t.sup){var o=t.base;n=o&&"op"===o.type&&o.limits&&e.style===w.DISPLAY?"munderover":o&&"operatorname"===o.type&&o.alwaysHandleSupSub&&(e.style===w.DISPLAY||o.limits)?"munderover":"msubsup"}else{var s=t.base;n=s&&"op"===s.type&&s.limits&&(e.style===w.DISPLAY||s.alwaysHandleSupSub)?"munder":s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(s.limits||e.style===w.DISPLAY)?"munder":"msub"}else{var l=t.base;n=l&&"op"===l.type&&l.limits&&(e.style===w.DISPLAY||l.alwaysHandleSupSub)?"mover":l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||e.style===w.DISPLAY)?"mover":"msup"}return new ue.MathNode(n,i)}}),jt({type:"atom",htmlBuilder:function(t,e){return Dt.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder:function(t,e){var r=new ue.MathNode("mo",[pe(t.text,t.mode)]);if("bin"===t.family){var a=fe(t,e);"bold-italic"===a&&r.setAttribute("mathvariant",a)}else"punct"===t.family?r.setAttribute("separator","true"):"open"!==t.family&&"close"!==t.family||r.setAttribute("stretchy","false");return r}});var Zr={mi:"italic",mn:"normal",mtext:"normal"};jt({type:"mathord",htmlBuilder:function(t,e){return Dt.makeOrd(t,e,"mathord")},mathmlBuilder:function(t,e){var r=new ue.MathNode("mi",[pe(t.text,t.mode,e)]),a=fe(t,e)||"italic";return a!==Zr[r.type]&&r.setAttribute("mathvariant",a),r}}),jt({type:"textord",htmlBuilder:function(t,e){return Dt.makeOrd(t,e,"textord")},mathmlBuilder:function(t,e){var r,a=pe(t.text,t.mode,e),n=fe(t,e)||"normal";return r="text"===t.mode?new ue.MathNode("mtext",[a]):/[0-9]/.test(t.text)?new ue.MathNode("mn",[a]):"\\prime"===t.text?new ue.MathNode("mo",[a]):new ue.MathNode("mi",[a]),n!==Zr[r.type]&&r.setAttribute("mathvariant",n),r}});var Kr={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Jr={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};jt({type:"spacing",htmlBuilder:function(t,e){if(Jr.hasOwnProperty(t.text)){var r=Jr[t.text].className||"";if("text"===t.mode){var a=Dt.makeOrd(t,e,"textord");return a.classes.push(r),a}return Dt.makeSpan(["mspace",r],[Dt.mathsym(t.text,t.mode,e)],e)}if(Kr.hasOwnProperty(t.text))return Dt.makeSpan(["mspace",Kr[t.text]],[],e);throw new o('Unknown type of space "'+t.text+'"')},mathmlBuilder:function(t,e){if(!Jr.hasOwnProperty(t.text)){if(Kr.hasOwnProperty(t.text))return new ue.MathNode("mspace");throw new o('Unknown type of space "'+t.text+'"')}return new ue.MathNode("mtext",[new ue.TextNode("\xa0")])}});var Qr=function(){var t=new ue.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};jt({type:"tag",mathmlBuilder:function(t,e){var r=new ue.MathNode("mtable",[new ue.MathNode("mtr",[Qr(),new ue.MathNode("mtd",[xe(t.body,e)]),Qr(),new ue.MathNode("mtd",[xe(t.tag,e)])])]);return r.setAttribute("width","100%"),r}});var ta={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},ea={"\\textbf":"textbf","\\textmd":"textmd"},ra={"\\textit":"textit","\\textup":"textup"},aa=function(t,e){var r=t.font;return r?ta[r]?e.withTextFontFamily(ta[r]):ea[r]?e.withTextFontWeight(ea[r]):e.withTextFontShape(ra[r]):e};_t({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup"],props:{numArgs:1,argTypes:["text"],greediness:2,allowedInText:!0},handler:function(t,e){var r=t.parser,a=t.funcName,n=e[0];return{type:"text",mode:r.mode,body:$t(n),font:a}},htmlBuilder:function(t,e){var r=aa(t,e),a=ee(t.body,r,!0);return Dt.makeSpan(["mord","text"],Dt.tryCombineChars(a),r)},mathmlBuilder:function(t,e){var r=aa(t,e);return xe(t.body,r)}}),_t({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){return{type:"underline",mode:t.parser.mode,body:e[0]}},htmlBuilder:function(t,e){var r=oe(t.body,e),a=Dt.makeLineSpan("underline-line",e),n=e.fontMetrics().defaultRuleThickness,i=Dt.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:n},{type:"elem",elem:a},{type:"kern",size:3*n},{type:"elem",elem:r}]},e);return Dt.makeSpan(["mord","underline"],[i],e)},mathmlBuilder:function(t,e){var r=new ue.MathNode("mo",[new ue.TextNode("\u203e")]);r.setAttribute("stretchy","true");var a=new ue.MathNode("munder",[ve(t.body,e),r]);return a.setAttribute("accentunder","true"),a}}),_t({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler:function(t,e,r){throw new o("\\verb ended by end of line instead of matching delimiter")},htmlBuilder:function(t,e){for(var r=na(t),a=[],n=e.havingStyle(e.style.text()),i=0;i0&&(this.undefStack[this.undefStack.length-1][t]=e)}else{var n=this.undefStack[this.undefStack.length-1];n&&!n.hasOwnProperty(t)&&(n[t]=this.current[t])}this.current[t]=e},t}(),ca={},ua=ca;function pa(t,e){ca[t]=e}pa("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}}),pa("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}}),pa("\\@firstoftwo",function(t){return{tokens:t.consumeArgs(2)[0],numArgs:0}}),pa("\\@secondoftwo",function(t){return{tokens:t.consumeArgs(2)[1],numArgs:0}}),pa("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var r=t.future();return 1===e[0].length&&e[0][0].text===r.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}}),pa("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),pa("\\TextOrMath",function(t){var e=t.consumeArgs(2);return"text"===t.mode?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var da={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};pa("\\char",function(t){var e,r=t.popToken(),a="";if("'"===r.text)e=8,r=t.popToken();else if('"'===r.text)e=16,r=t.popToken();else if("`"===r.text)if("\\"===(r=t.popToken()).text[0])a=r.text.charCodeAt(1);else{if("EOF"===r.text)throw new o("\\char` missing argument");a=r.text.charCodeAt(0)}else e=10;if(e){if(null==(a=da[r.text])||a>=e)throw new o("Invalid base-"+e+" digit "+r.text);for(var n;null!=(n=da[t.future().text])&&n":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};pa("\\dots",function(t){var e="\\dotso",r=t.expandAfterFuture().text;return r in ga?e=ga[r]:"\\not"===r.substr(0,4)?e="\\dotsb":r in j.math&&c.contains(["bin","rel"],j.math[r].group)&&(e="\\dotsb"),e});var xa={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};pa("\\dotso",function(t){return t.future().text in xa?"\\ldots\\,":"\\ldots"}),pa("\\dotsc",function(t){var e=t.future().text;return e in xa&&","!==e?"\\ldots\\,":"\\ldots"}),pa("\\cdots",function(t){return t.future().text in xa?"\\@cdots\\,":"\\@cdots"}),pa("\\dotsb","\\cdots"),pa("\\dotsm","\\cdots"),pa("\\dotsi","\\!\\cdots"),pa("\\dotsx","\\ldots\\,"),pa("\\DOTSI","\\relax"),pa("\\DOTSB","\\relax"),pa("\\DOTSX","\\relax"),pa("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),pa("\\,","\\tmspace+{3mu}{.1667em}"),pa("\\thinspace","\\,"),pa("\\>","\\mskip{4mu}"),pa("\\:","\\tmspace+{4mu}{.2222em}"),pa("\\medspace","\\:"),pa("\\;","\\tmspace+{5mu}{.2777em}"),pa("\\thickspace","\\;"),pa("\\!","\\tmspace-{3mu}{.1667em}"),pa("\\negthinspace","\\!"),pa("\\negmedspace","\\tmspace-{4mu}{.2222em}"),pa("\\negthickspace","\\tmspace-{5mu}{.277em}"),pa("\\enspace","\\kern.5em "),pa("\\enskip","\\hskip.5em\\relax"),pa("\\quad","\\hskip1em\\relax"),pa("\\qquad","\\hskip2em\\relax"),pa("\\tag","\\@ifstar\\tag@literal\\tag@paren"),pa("\\tag@paren","\\tag@literal{({#1})}"),pa("\\tag@literal",function(t){if(t.macros.get("\\df@tag"))throw new o("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),pa("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),pa("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),pa("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),pa("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),pa("\\pmb","\\html@mathml{\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}{\\mathbf{#1}}"),pa("\\\\","\\newline"),pa("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var va=F["Main-Regular"]["T".charCodeAt(0)][1]-.7*F["Main-Regular"]["A".charCodeAt(0)][1]+"em";pa("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+va+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),pa("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+va+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),pa("\\hspace","\\@ifstar\\@hspacer\\@hspace"),pa("\\@hspace","\\hskip #1\\relax"),pa("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),pa("\\ordinarycolon",":"),pa("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),pa("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),pa("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),pa("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),pa("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),pa("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),pa("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),pa("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),pa("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),pa("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),pa("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),pa("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),pa("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),pa("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),pa("\u2237","\\dblcolon"),pa("\u2239","\\eqcolon"),pa("\u2254","\\coloneqq"),pa("\u2255","\\eqqcolon"),pa("\u2a74","\\Coloneqq"),pa("\\ratio","\\vcentcolon"),pa("\\coloncolon","\\dblcolon"),pa("\\colonequals","\\coloneqq"),pa("\\coloncolonequals","\\Coloneqq"),pa("\\equalscolon","\\eqqcolon"),pa("\\equalscoloncolon","\\Eqqcolon"),pa("\\colonminus","\\coloneq"),pa("\\coloncolonminus","\\Coloneq"),pa("\\minuscolon","\\eqcolon"),pa("\\minuscoloncolon","\\Eqcolon"),pa("\\coloncolonapprox","\\Colonapprox"),pa("\\coloncolonsim","\\Colonsim"),pa("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),pa("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),pa("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),pa("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),pa("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220c}}"),pa("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),pa("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),pa("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}"),pa("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}"),pa("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}"),pa("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}"),pa("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}"),pa("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}"),pa("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}"),pa("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}"),pa("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}"),pa("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}"),pa("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228a}"),pa("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2acb}"),pa("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228b}"),pa("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2acc}"),pa("\\imath","\\html@mathml{\\@imath}{\u0131}"),pa("\\jmath","\\html@mathml{\\@jmath}{\u0237}"),pa("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27e6}}"),pa("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27e7}}"),pa("\u27e6","\\llbracket"),pa("\u27e7","\\rrbracket"),pa("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}"),pa("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}"),pa("\u2983","\\lBrace"),pa("\u2984","\\rBrace"),pa("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29b5}}"),pa("\u29b5","\\minuso"),pa("\\darr","\\downarrow"),pa("\\dArr","\\Downarrow"),pa("\\Darr","\\Downarrow"),pa("\\lang","\\langle"),pa("\\rang","\\rangle"),pa("\\uarr","\\uparrow"),pa("\\uArr","\\Uparrow"),pa("\\Uarr","\\Uparrow"),pa("\\N","\\mathbb{N}"),pa("\\R","\\mathbb{R}"),pa("\\Z","\\mathbb{Z}"),pa("\\alef","\\aleph"),pa("\\alefsym","\\aleph"),pa("\\Alpha","\\mathrm{A}"),pa("\\Beta","\\mathrm{B}"),pa("\\bull","\\bullet"),pa("\\Chi","\\mathrm{X}"),pa("\\clubs","\\clubsuit"),pa("\\cnums","\\mathbb{C}"),pa("\\Complex","\\mathbb{C}"),pa("\\Dagger","\\ddagger"),pa("\\diamonds","\\diamondsuit"),pa("\\empty","\\emptyset"),pa("\\Epsilon","\\mathrm{E}"),pa("\\Eta","\\mathrm{H}"),pa("\\exist","\\exists"),pa("\\harr","\\leftrightarrow"),pa("\\hArr","\\Leftrightarrow"),pa("\\Harr","\\Leftrightarrow"),pa("\\hearts","\\heartsuit"),pa("\\image","\\Im"),pa("\\infin","\\infty"),pa("\\Iota","\\mathrm{I}"),pa("\\isin","\\in"),pa("\\Kappa","\\mathrm{K}"),pa("\\larr","\\leftarrow"),pa("\\lArr","\\Leftarrow"),pa("\\Larr","\\Leftarrow"),pa("\\lrarr","\\leftrightarrow"),pa("\\lrArr","\\Leftrightarrow"),pa("\\Lrarr","\\Leftrightarrow"),pa("\\Mu","\\mathrm{M}"),pa("\\natnums","\\mathbb{N}"),pa("\\Nu","\\mathrm{N}"),pa("\\Omicron","\\mathrm{O}"),pa("\\plusmn","\\pm"),pa("\\rarr","\\rightarrow"),pa("\\rArr","\\Rightarrow"),pa("\\Rarr","\\Rightarrow"),pa("\\real","\\Re"),pa("\\reals","\\mathbb{R}"),pa("\\Reals","\\mathbb{R}"),pa("\\Rho","\\mathrm{P}"),pa("\\sdot","\\cdot"),pa("\\sect","\\S"),pa("\\spades","\\spadesuit"),pa("\\sub","\\subset"),pa("\\sube","\\subseteq"),pa("\\supe","\\supseteq"),pa("\\Tau","\\mathrm{T}"),pa("\\thetasym","\\vartheta"),pa("\\weierp","\\wp"),pa("\\Zeta","\\mathrm{Z}"),pa("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),pa("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),pa("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),pa("\\bra","\\mathinner{\\langle{#1}|}"),pa("\\ket","\\mathinner{|{#1}\\rangle}"),pa("\\braket","\\mathinner{\\langle{#1}\\rangle}"),pa("\\Bra","\\left\\langle#1\\right|"),pa("\\Ket","\\left|#1\\right\\rangle"),pa("\\blue","\\textcolor{##6495ed}{#1}"),pa("\\orange","\\textcolor{##ffa500}{#1}"),pa("\\pink","\\textcolor{##ff00af}{#1}"),pa("\\red","\\textcolor{##df0030}{#1}"),pa("\\green","\\textcolor{##28ae7b}{#1}"),pa("\\gray","\\textcolor{gray}{#1}"),pa("\\purple","\\textcolor{##9d38bd}{#1}"),pa("\\blueA","\\textcolor{##ccfaff}{#1}"),pa("\\blueB","\\textcolor{##80f6ff}{#1}"),pa("\\blueC","\\textcolor{##63d9ea}{#1}"),pa("\\blueD","\\textcolor{##11accd}{#1}"),pa("\\blueE","\\textcolor{##0c7f99}{#1}"),pa("\\tealA","\\textcolor{##94fff5}{#1}"),pa("\\tealB","\\textcolor{##26edd5}{#1}"),pa("\\tealC","\\textcolor{##01d1c1}{#1}"),pa("\\tealD","\\textcolor{##01a995}{#1}"),pa("\\tealE","\\textcolor{##208170}{#1}"),pa("\\greenA","\\textcolor{##b6ffb0}{#1}"),pa("\\greenB","\\textcolor{##8af281}{#1}"),pa("\\greenC","\\textcolor{##74cf70}{#1}"),pa("\\greenD","\\textcolor{##1fab54}{#1}"),pa("\\greenE","\\textcolor{##0d923f}{#1}"),pa("\\goldA","\\textcolor{##ffd0a9}{#1}"),pa("\\goldB","\\textcolor{##ffbb71}{#1}"),pa("\\goldC","\\textcolor{##ff9c39}{#1}"),pa("\\goldD","\\textcolor{##e07d10}{#1}"),pa("\\goldE","\\textcolor{##a75a05}{#1}"),pa("\\redA","\\textcolor{##fca9a9}{#1}"),pa("\\redB","\\textcolor{##ff8482}{#1}"),pa("\\redC","\\textcolor{##f9685d}{#1}"),pa("\\redD","\\textcolor{##e84d39}{#1}"),pa("\\redE","\\textcolor{##bc2612}{#1}"),pa("\\maroonA","\\textcolor{##ffbde0}{#1}"),pa("\\maroonB","\\textcolor{##ff92c6}{#1}"),pa("\\maroonC","\\textcolor{##ed5fa6}{#1}"),pa("\\maroonD","\\textcolor{##ca337c}{#1}"),pa("\\maroonE","\\textcolor{##9e034e}{#1}"),pa("\\purpleA","\\textcolor{##ddd7ff}{#1}"),pa("\\purpleB","\\textcolor{##c6b9fc}{#1}"),pa("\\purpleC","\\textcolor{##aa87ff}{#1}"),pa("\\purpleD","\\textcolor{##7854ab}{#1}"),pa("\\purpleE","\\textcolor{##543b78}{#1}"),pa("\\mintA","\\textcolor{##f5f9e8}{#1}"),pa("\\mintB","\\textcolor{##edf2df}{#1}"),pa("\\mintC","\\textcolor{##e0e5cc}{#1}"),pa("\\grayA","\\textcolor{##f6f7f7}{#1}"),pa("\\grayB","\\textcolor{##f0f1f2}{#1}"),pa("\\grayC","\\textcolor{##e3e5e6}{#1}"),pa("\\grayD","\\textcolor{##d6d8da}{#1}"),pa("\\grayE","\\textcolor{##babec2}{#1}"),pa("\\grayF","\\textcolor{##888d93}{#1}"),pa("\\grayG","\\textcolor{##626569}{#1}"),pa("\\grayH","\\textcolor{##3b3e40}{#1}"),pa("\\grayI","\\textcolor{##21242c}{#1}"),pa("\\kaBlue","\\textcolor{##314453}{#1}"),pa("\\kaGreen","\\textcolor{##71B307}{#1}");var ba={"\\relax":!0,"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},ya=function(){function t(t,e,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=e,this.expansionCount=0,this.feed(t),this.macros=new ma(ua,e.macros),this.mode=r,this.stack=[]}var e=t.prototype;return e.feed=function(t){this.lexer=new ha(t,this.settings)},e.switchMode=function(t){this.mode=t},e.beginGroup=function(){this.macros.beginGroup()},e.endGroup=function(){this.macros.endGroup()},e.future=function(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]},e.popToken=function(){return this.future(),this.stack.pop()},e.pushToken=function(t){this.stack.push(t)},e.pushTokens=function(t){var e;(e=this.stack).push.apply(e,t)},e.consumeSpaces=function(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}},e.consumeArgs=function(t){for(var e=[],r=0;rthis.settings.maxExpand)throw new o("Too many expansions: infinite loop or need to increase maxExpand setting");var n=a.tokens;if(a.numArgs)for(var i=this.consumeArgs(a.numArgs),s=(n=n.slice()).length-1;s>=0;--s){var l=n[s];if("#"===l.text){if(0===s)throw new o("Incomplete placeholder at end of macro body",l);if("#"===(l=n[--s]).text)n.splice(s+1,1);else{if(!/^[1-9]$/.test(l.text))throw new o("Not a valid argument number",l);var h;(h=n).splice.apply(h,[s,2].concat(i[+l.text-1]))}}}return this.pushTokens(n),n},e.expandAfterFuture=function(){return this.expandOnce(),this.future()},e.expandNextToken=function(){for(;;){var t=this.expandOnce();if(t instanceof n){if("\\relax"!==t.text&&!t.treatAsRelax)return this.stack.pop();this.stack.pop()}}throw new Error},e.expandMacro=function(t){return this.macros.has(t)?this.expandTokens([new n(t)]):void 0},e.expandTokens=function(t){var e=[],r=this.stack.length;for(this.pushTokens(t);this.stack.length>r;){var a=this.expandOnce(!0);a instanceof n&&(a.treatAsRelax&&(a.noexpand=!1,a.treatAsRelax=!1),e.push(this.stack.pop()))}return e},e.expandMacroAsText=function(t){var e=this.expandMacro(t);return e?e.map(function(t){return t.text}).join(""):e},e._getExpansion=function(t){var e=this.macros.get(t);if(null==e)return e;var r="function"==typeof e?e(this):e;if("string"==typeof r){var a=0;if(-1!==r.indexOf("#"))for(var n=r.replace(/##/g,"");-1!==n.indexOf("#"+(a+1));)++a;for(var i=new ha(r,this.settings),o=[],s=i.lex();"EOF"!==s.text;)o.push(s),s=i.lex();return o.reverse(),{tokens:o,numArgs:a}}return r},e.isDefined=function(t){return this.macros.has(t)||ia.hasOwnProperty(t)||j.math.hasOwnProperty(t)||j.text.hasOwnProperty(t)||ba.hasOwnProperty(t)},e.isExpandable=function(t){var e=this.macros.get(t);return null!=e?"string"==typeof e||"function"==typeof e||!e.unexpandable:ia.hasOwnProperty(t)},t}(),wa={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030c":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030a":{text:"\\r",math:"\\mathring"},"\u030b":{text:"\\H"}},ka={"\xe1":"a\u0301","\xe0":"a\u0300","\xe4":"a\u0308","\u01df":"a\u0308\u0304","\xe3":"a\u0303","\u0101":"a\u0304","\u0103":"a\u0306","\u1eaf":"a\u0306\u0301","\u1eb1":"a\u0306\u0300","\u1eb5":"a\u0306\u0303","\u01ce":"a\u030c","\xe2":"a\u0302","\u1ea5":"a\u0302\u0301","\u1ea7":"a\u0302\u0300","\u1eab":"a\u0302\u0303","\u0227":"a\u0307","\u01e1":"a\u0307\u0304","\xe5":"a\u030a","\u01fb":"a\u030a\u0301","\u1e03":"b\u0307","\u0107":"c\u0301","\u010d":"c\u030c","\u0109":"c\u0302","\u010b":"c\u0307","\u010f":"d\u030c","\u1e0b":"d\u0307","\xe9":"e\u0301","\xe8":"e\u0300","\xeb":"e\u0308","\u1ebd":"e\u0303","\u0113":"e\u0304","\u1e17":"e\u0304\u0301","\u1e15":"e\u0304\u0300","\u0115":"e\u0306","\u011b":"e\u030c","\xea":"e\u0302","\u1ebf":"e\u0302\u0301","\u1ec1":"e\u0302\u0300","\u1ec5":"e\u0302\u0303","\u0117":"e\u0307","\u1e1f":"f\u0307","\u01f5":"g\u0301","\u1e21":"g\u0304","\u011f":"g\u0306","\u01e7":"g\u030c","\u011d":"g\u0302","\u0121":"g\u0307","\u1e27":"h\u0308","\u021f":"h\u030c","\u0125":"h\u0302","\u1e23":"h\u0307","\xed":"i\u0301","\xec":"i\u0300","\xef":"i\u0308","\u1e2f":"i\u0308\u0301","\u0129":"i\u0303","\u012b":"i\u0304","\u012d":"i\u0306","\u01d0":"i\u030c","\xee":"i\u0302","\u01f0":"j\u030c","\u0135":"j\u0302","\u1e31":"k\u0301","\u01e9":"k\u030c","\u013a":"l\u0301","\u013e":"l\u030c","\u1e3f":"m\u0301","\u1e41":"m\u0307","\u0144":"n\u0301","\u01f9":"n\u0300","\xf1":"n\u0303","\u0148":"n\u030c","\u1e45":"n\u0307","\xf3":"o\u0301","\xf2":"o\u0300","\xf6":"o\u0308","\u022b":"o\u0308\u0304","\xf5":"o\u0303","\u1e4d":"o\u0303\u0301","\u1e4f":"o\u0303\u0308","\u022d":"o\u0303\u0304","\u014d":"o\u0304","\u1e53":"o\u0304\u0301","\u1e51":"o\u0304\u0300","\u014f":"o\u0306","\u01d2":"o\u030c","\xf4":"o\u0302","\u1ed1":"o\u0302\u0301","\u1ed3":"o\u0302\u0300","\u1ed7":"o\u0302\u0303","\u022f":"o\u0307","\u0231":"o\u0307\u0304","\u0151":"o\u030b","\u1e55":"p\u0301","\u1e57":"p\u0307","\u0155":"r\u0301","\u0159":"r\u030c","\u1e59":"r\u0307","\u015b":"s\u0301","\u1e65":"s\u0301\u0307","\u0161":"s\u030c","\u1e67":"s\u030c\u0307","\u015d":"s\u0302","\u1e61":"s\u0307","\u1e97":"t\u0308","\u0165":"t\u030c","\u1e6b":"t\u0307","\xfa":"u\u0301","\xf9":"u\u0300","\xfc":"u\u0308","\u01d8":"u\u0308\u0301","\u01dc":"u\u0308\u0300","\u01d6":"u\u0308\u0304","\u01da":"u\u0308\u030c","\u0169":"u\u0303","\u1e79":"u\u0303\u0301","\u016b":"u\u0304","\u1e7b":"u\u0304\u0308","\u016d":"u\u0306","\u01d4":"u\u030c","\xfb":"u\u0302","\u016f":"u\u030a","\u0171":"u\u030b","\u1e7d":"v\u0303","\u1e83":"w\u0301","\u1e81":"w\u0300","\u1e85":"w\u0308","\u0175":"w\u0302","\u1e87":"w\u0307","\u1e98":"w\u030a","\u1e8d":"x\u0308","\u1e8b":"x\u0307","\xfd":"y\u0301","\u1ef3":"y\u0300","\xff":"y\u0308","\u1ef9":"y\u0303","\u0233":"y\u0304","\u0177":"y\u0302","\u1e8f":"y\u0307","\u1e99":"y\u030a","\u017a":"z\u0301","\u017e":"z\u030c","\u1e91":"z\u0302","\u017c":"z\u0307","\xc1":"A\u0301","\xc0":"A\u0300","\xc4":"A\u0308","\u01de":"A\u0308\u0304","\xc3":"A\u0303","\u0100":"A\u0304","\u0102":"A\u0306","\u1eae":"A\u0306\u0301","\u1eb0":"A\u0306\u0300","\u1eb4":"A\u0306\u0303","\u01cd":"A\u030c","\xc2":"A\u0302","\u1ea4":"A\u0302\u0301","\u1ea6":"A\u0302\u0300","\u1eaa":"A\u0302\u0303","\u0226":"A\u0307","\u01e0":"A\u0307\u0304","\xc5":"A\u030a","\u01fa":"A\u030a\u0301","\u1e02":"B\u0307","\u0106":"C\u0301","\u010c":"C\u030c","\u0108":"C\u0302","\u010a":"C\u0307","\u010e":"D\u030c","\u1e0a":"D\u0307","\xc9":"E\u0301","\xc8":"E\u0300","\xcb":"E\u0308","\u1ebc":"E\u0303","\u0112":"E\u0304","\u1e16":"E\u0304\u0301","\u1e14":"E\u0304\u0300","\u0114":"E\u0306","\u011a":"E\u030c","\xca":"E\u0302","\u1ebe":"E\u0302\u0301","\u1ec0":"E\u0302\u0300","\u1ec4":"E\u0302\u0303","\u0116":"E\u0307","\u1e1e":"F\u0307","\u01f4":"G\u0301","\u1e20":"G\u0304","\u011e":"G\u0306","\u01e6":"G\u030c","\u011c":"G\u0302","\u0120":"G\u0307","\u1e26":"H\u0308","\u021e":"H\u030c","\u0124":"H\u0302","\u1e22":"H\u0307","\xcd":"I\u0301","\xcc":"I\u0300","\xcf":"I\u0308","\u1e2e":"I\u0308\u0301","\u0128":"I\u0303","\u012a":"I\u0304","\u012c":"I\u0306","\u01cf":"I\u030c","\xce":"I\u0302","\u0130":"I\u0307","\u0134":"J\u0302","\u1e30":"K\u0301","\u01e8":"K\u030c","\u0139":"L\u0301","\u013d":"L\u030c","\u1e3e":"M\u0301","\u1e40":"M\u0307","\u0143":"N\u0301","\u01f8":"N\u0300","\xd1":"N\u0303","\u0147":"N\u030c","\u1e44":"N\u0307","\xd3":"O\u0301","\xd2":"O\u0300","\xd6":"O\u0308","\u022a":"O\u0308\u0304","\xd5":"O\u0303","\u1e4c":"O\u0303\u0301","\u1e4e":"O\u0303\u0308","\u022c":"O\u0303\u0304","\u014c":"O\u0304","\u1e52":"O\u0304\u0301","\u1e50":"O\u0304\u0300","\u014e":"O\u0306","\u01d1":"O\u030c","\xd4":"O\u0302","\u1ed0":"O\u0302\u0301","\u1ed2":"O\u0302\u0300","\u1ed6":"O\u0302\u0303","\u022e":"O\u0307","\u0230":"O\u0307\u0304","\u0150":"O\u030b","\u1e54":"P\u0301","\u1e56":"P\u0307","\u0154":"R\u0301","\u0158":"R\u030c","\u1e58":"R\u0307","\u015a":"S\u0301","\u1e64":"S\u0301\u0307","\u0160":"S\u030c","\u1e66":"S\u030c\u0307","\u015c":"S\u0302","\u1e60":"S\u0307","\u0164":"T\u030c","\u1e6a":"T\u0307","\xda":"U\u0301","\xd9":"U\u0300","\xdc":"U\u0308","\u01d7":"U\u0308\u0301","\u01db":"U\u0308\u0300","\u01d5":"U\u0308\u0304","\u01d9":"U\u0308\u030c","\u0168":"U\u0303","\u1e78":"U\u0303\u0301","\u016a":"U\u0304","\u1e7a":"U\u0304\u0308","\u016c":"U\u0306","\u01d3":"U\u030c","\xdb":"U\u0302","\u016e":"U\u030a","\u0170":"U\u030b","\u1e7c":"V\u0303","\u1e82":"W\u0301","\u1e80":"W\u0300","\u1e84":"W\u0308","\u0174":"W\u0302","\u1e86":"W\u0307","\u1e8c":"X\u0308","\u1e8a":"X\u0307","\xdd":"Y\u0301","\u1ef2":"Y\u0300","\u0178":"Y\u0308","\u1ef8":"Y\u0303","\u0232":"Y\u0304","\u0176":"Y\u0302","\u1e8e":"Y\u0307","\u0179":"Z\u0301","\u017d":"Z\u030c","\u1e90":"Z\u0302","\u017b":"Z\u0307","\u03ac":"\u03b1\u0301","\u1f70":"\u03b1\u0300","\u1fb1":"\u03b1\u0304","\u1fb0":"\u03b1\u0306","\u03ad":"\u03b5\u0301","\u1f72":"\u03b5\u0300","\u03ae":"\u03b7\u0301","\u1f74":"\u03b7\u0300","\u03af":"\u03b9\u0301","\u1f76":"\u03b9\u0300","\u03ca":"\u03b9\u0308","\u0390":"\u03b9\u0308\u0301","\u1fd2":"\u03b9\u0308\u0300","\u1fd1":"\u03b9\u0304","\u1fd0":"\u03b9\u0306","\u03cc":"\u03bf\u0301","\u1f78":"\u03bf\u0300","\u03cd":"\u03c5\u0301","\u1f7a":"\u03c5\u0300","\u03cb":"\u03c5\u0308","\u03b0":"\u03c5\u0308\u0301","\u1fe2":"\u03c5\u0308\u0300","\u1fe1":"\u03c5\u0304","\u1fe0":"\u03c5\u0306","\u03ce":"\u03c9\u0301","\u1f7c":"\u03c9\u0300","\u038e":"\u03a5\u0301","\u1fea":"\u03a5\u0300","\u03ab":"\u03a5\u0308","\u1fe9":"\u03a5\u0304","\u1fe8":"\u03a5\u0306","\u038f":"\u03a9\u0301","\u1ffa":"\u03a9\u0300"},Sa=function(){function t(t,e){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new ya(t,e,this.mode),this.settings=e,this.leftrightDepth=0}var e=t.prototype;return e.expect=function(t,e){if(void 0===e&&(e=!0),this.fetch().text!==t)throw new o("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());e&&this.consume()},e.consume=function(){this.nextToken=null},e.fetch=function(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken},e.switchMode=function(t){this.mode=t,this.gullet.switchMode(t)},e.parse=function(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t},e.parseExpression=function(e,r){for(var a=[];;){"math"===this.mode&&this.consumeSpaces();var n=this.fetch();if(-1!==t.endOfExpression.indexOf(n.text))break;if(r&&n.text===r)break;if(e&&ia[n.text]&&ia[n.text].infix)break;var i=this.parseAtom(r);if(!i)break;"internal"!==i.type&&a.push(i)}return"text"===this.mode&&this.formLigatures(a),this.handleInfixNodes(a)},e.handleInfixNodes=function(t){for(var e,r=-1,a=0;a0&&!h||0===s&&!h&&"math"===this.mode,c=this.parseGroupOfType("argument to '"+t+"'",l,h,a,m);if(!c){if(h){i.push(null);continue}throw new o("Expected group after '"+t+"'",this.fetch())}(h?i:n).push(c)}return{args:n,optArgs:i}},e.parseGroupOfType=function(t,e,r,a,n){switch(e){case"color":return n&&this.consumeSpaces(),this.parseColorGroup(r);case"size":return n&&this.consumeSpaces(),this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r,n);case"math":case"text":return this.parseGroup(t,r,a,void 0,e,n);case"hbox":var i=this.parseGroup(t,r,a,void 0,"text",n);return i?{type:"styling",mode:i.mode,body:[i],style:"text"}:i;case"raw":if(n&&this.consumeSpaces(),r&&"{"===this.fetch().text)return null;var s=this.parseStringGroup("raw",r,!0);if(s)return{type:"raw",mode:"text",string:s.text};throw new o("Expected raw group",this.fetch());case"original":case null:case void 0:return this.parseGroup(t,r,a,void 0,void 0,n);default:throw new o("Unknown group type as "+t,this.fetch())}},e.consumeSpaces=function(){for(;" "===this.fetch().text;)this.consume()},e.parseStringGroup=function(t,e,r){var a=e?"[":"{",n=e?"]":"}",i=this.fetch();if(i.text!==a){if(e)return null;if(r&&"EOF"!==i.text&&/[^{}[\]]/.test(i.text))return this.consume(),i}var s=this.mode;this.mode="text",this.expect(a);for(var l,h="",m=this.fetch(),c=0,u=m;(l=this.fetch()).text!==n||r&&c>0;){switch(l.text){case"EOF":throw new o("Unexpected end of input in "+t,m.range(u,h));case a:c++;break;case n:c--}h+=(u=l).text,this.consume()}return this.expect(n),this.mode=s,m.range(u,h)},e.parseRegexGroup=function(t,e){var r=this.mode;this.mode="text";for(var a,n=this.fetch(),i=n,s="";"EOF"!==(a=this.fetch()).text&&t.test(s+a.text);)s+=(i=a).text,this.consume();if(""===s)throw new o("Invalid "+e+": '"+n.text+"'",n);return this.mode=r,n.range(i,s)},e.parseColorGroup=function(t){var e=this.parseStringGroup("color",t);if(!e)return null;var r=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(e.text);if(!r)throw new o("Invalid color: '"+e.text+"'",e);var a=r[0];return/^[0-9a-f]{6}$/i.test(a)&&(a="#"+a),{type:"color-token",mode:this.mode,color:a}},e.parseSizeGroup=function(t){var e,r=!1;if(!(e=t||"{"===this.fetch().text?this.parseStringGroup("size",t):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;t||0!==e.text.length||(e.text="0pt",r=!0);var a=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e.text);if(!a)throw new o("Invalid size: '"+e.text+"'",e);var n={number:+(a[1]+a[2]),unit:a[3]};if(!At(n))throw new o("Invalid unit: '"+n.unit+"'",e);return{type:"size",mode:this.mode,value:n,isBlank:r}},e.parseUrlGroup=function(t,e){this.gullet.lexer.setCatcode("%",13);var r=this.parseStringGroup("url",t,!0);if(this.gullet.lexer.setCatcode("%",14),!r)return null;var a=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:a}},e.parseGroup=function(e,r,n,i,s,l){var h=this.mode;s&&this.switchMode(s),l&&this.consumeSpaces();var m,c=this.fetch(),u=c.text;if(r?"["===u:"{"===u||"\\begingroup"===u){this.consume();var p=t.endOfGroup[u];this.gullet.beginGroup();var d=this.parseExpression(!1,p),f=this.fetch();this.expect(p),this.gullet.endGroup(),m={type:"ordgroup",mode:this.mode,loc:a.range(c,f),body:d,semisimple:"\\begingroup"===u||void 0}}else if(r)m=null;else if(null==(m=this.parseFunction(i,e,n)||this.parseSymbol())&&"\\"===u[0]&&!ba.hasOwnProperty(u)){if(this.settings.throwOnError)throw new o("Undefined control sequence: "+u,c);m=this.formatUnsupportedCmd(u),this.consume()}return s&&this.switchMode(h),m},e.formLigatures=function(t){for(var e=t.length-1,r=0;r=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+e[0]+'" used in math mode',t);var l,h=j[this.mode][e].group,m=a.range(t);if(W.hasOwnProperty(h)){var c=h;l={type:"atom",mode:this.mode,family:c,loc:m,text:e}}else l={type:h,mode:this.mode,loc:m,text:e};i=l}else{if(!(e.charCodeAt(0)>=128))return null;this.settings.strict&&(M(e.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+e[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+e[0]+'" ('+e.charCodeAt(0)+")",t)),i={type:"textord",mode:"text",loc:a.range(t),text:e}}if(this.consume(),s)for(var u=0;u15?"\u2026"+o.slice(n-15,n):o.slice(0,n))+l+(s+15":">","<":"<",'"':""","'":"'"},o=/[&><"']/g;var s=function e(t){return"ordgroup"===t.type||"color"===t.type?1===t.body.length?e(t.body[0]):t:"font"===t.type?e(t.body):t},l={contains:function(e,t){return-1!==e.indexOf(t)},deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(o,(function(e){return i[e]}))},hyphenate:function(e){return e.replace(a,"-$1").toLowerCase()},getBaseElem:s,isCharacterBox:function(e){var t=s(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){var t=/^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(e);return null!=t?t[1]:"_relative"}},h=function(){function e(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{},this.displayMode=l.deflt(e.displayMode,!1),this.output=l.deflt(e.output,"htmlAndMathml"),this.leqno=l.deflt(e.leqno,!1),this.fleqn=l.deflt(e.fleqn,!1),this.throwOnError=l.deflt(e.throwOnError,!0),this.errorColor=l.deflt(e.errorColor,"#cc0000"),this.macros=e.macros||{},this.minRuleThickness=Math.max(0,l.deflt(e.minRuleThickness,0)),this.colorIsTextColor=l.deflt(e.colorIsTextColor,!1),this.strict=l.deflt(e.strict,"warn"),this.trust=l.deflt(e.trust,!1),this.maxSize=Math.max(0,l.deflt(e.maxSize,1/0)),this.maxExpand=Math.max(0,l.deflt(e.maxExpand,1e3)),this.globalGroup=l.deflt(e.globalGroup,!1)}var t=e.prototype;return t.reportNonstrict=function(e,t,r){var a=this.strict;if("function"==typeof a&&(a=a(e,t,r)),a&&"ignore"!==a){if(!0===a||"error"===a)throw new n("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",r);"warn"===a?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+a+"': "+t+" ["+e+"]")}},t.useStrictBehavior=function(e,t,r){var n=this.strict;if("function"==typeof n)try{n=n(e,t,r)}catch(e){n="error"}return!(!n||"ignore"===n)&&(!0===n||"error"===n||("warn"===n?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"),!1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+n+"': "+t+" ["+e+"]"),!1)))},t.isTrusted=function(e){e.url&&!e.protocol&&(e.protocol=l.protocolFromUrl(e.url));var t="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(t)},e}(),m=function(){function e(e,t,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=r}var t=e.prototype;return t.sup=function(){return c[u[this.id]]},t.sub=function(){return c[p[this.id]]},t.fracNum=function(){return c[d[this.id]]},t.fracDen=function(){return c[f[this.id]]},t.cramp=function(){return c[g[this.id]]},t.text=function(){return c[v[this.id]]},t.isTight=function(){return this.size>=2},e}(),c=[new m(0,0,!1),new m(1,0,!0),new m(2,1,!1),new m(3,1,!0),new m(4,2,!1),new m(5,2,!0),new m(6,3,!1),new m(7,3,!0)],u=[4,5,4,5,6,7,6,7],p=[5,5,5,5,7,7,7,7],d=[2,3,4,5,6,7,6,7],f=[3,3,5,5,7,7,7,7],g=[1,1,3,3,5,5,7,7],v=[0,1,2,3,2,3,2,3],b={DISPLAY:c[0],TEXT:c[2],SCRIPT:c[4],SCRIPTSCRIPT:c[6]},y=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var x=[];function w(e){for(var t=0;t=x[t]&&e<=x[t+1])return!0;return!1}y.forEach((function(e){return e.blocks.forEach((function(e){return x.push.apply(x,e)}))}));var k=80,S={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",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",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",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",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",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",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",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",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",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",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",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",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",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",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",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",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",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",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",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",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",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",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",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",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",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",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",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",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",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",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",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",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",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",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",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",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",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",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",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",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",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"},M=function(){function e(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}var t=e.prototype;return t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){for(var e=document.createDocumentFragment(),t=0;t"},q=function(){function e(e,t,r,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,A.call(this,e,r,n),this.children=t||[]}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){return T.call(this,"span")},t.toMarkup=function(){return B.call(this,"span")},e}(),N=function(){function e(e,t,r,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,A.call(this,t,n),this.children=r||[],this.setAttribute("href",e)}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){return T.call(this,"a")},t.toMarkup=function(){return B.call(this,"a")},e}(),C=function(){function e(e,t,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=r}var t=e.prototype;return t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){var e=document.createElement("img");for(var t in e.src=this.src,e.alt=this.alt,e.className="mord",this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e},t.toMarkup=function(){var e=""+this.alt+"=a[0]&&e<=a[1])return r.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[\xee\xef\xed\xec]/.test(this.text)&&(this.text=I[this.text])}var t=e.prototype;return t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){var e=document.createTextNode(this.text),t=null;for(var r in this.italic>0&&((t=document.createElement("span")).style.marginRight=this.italic+"em"),this.classes.length>0&&((t=t||document.createElement("span")).className=z(this.classes)),this.style)this.style.hasOwnProperty(r)&&((t=t||document.createElement("span")).style[r]=this.style[r]);return t?(t.appendChild(e),t):e},t.toMarkup=function(){var e=!1,t="0&&(r+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(n)&&(r+=l.hyphenate(n)+":"+this.style[n]+";");r&&(e=!0,t+=' style="'+l.escape(r)+'"');var a=l.escape(this.text);return e?(t+=">",t+=a,t+=""):a},e}(),R=function(){function e(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}var t=e.prototype;return t.toNode=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);for(var r=0;r":""},e}(),H=function(){function e(e){this.attributes=void 0,this.attributes=e||{}}var t=e.prototype;return t.toNode=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);return e},t.toMarkup=function(){var e="","\\gt",!0),_(j,Z,oe,"\u2208","\\in",!0),_(j,Z,oe,"\ue020","\\@not"),_(j,Z,oe,"\u2282","\\subset",!0),_(j,Z,oe,"\u2283","\\supset",!0),_(j,Z,oe,"\u2286","\\subseteq",!0),_(j,Z,oe,"\u2287","\\supseteq",!0),_(j,K,oe,"\u2288","\\nsubseteq",!0),_(j,K,oe,"\u2289","\\nsupseteq",!0),_(j,Z,oe,"\u22a8","\\models"),_(j,Z,oe,"\u2190","\\leftarrow",!0),_(j,Z,oe,"\u2264","\\le"),_(j,Z,oe,"\u2264","\\leq",!0),_(j,Z,oe,"<","\\lt",!0),_(j,Z,oe,"\u2192","\\rightarrow",!0),_(j,Z,oe,"\u2192","\\to"),_(j,K,oe,"\u2271","\\ngeq",!0),_(j,K,oe,"\u2270","\\nleq",!0),_(j,Z,se,"\xa0","\\ "),_(j,Z,se,"\xa0","~"),_(j,Z,se,"\xa0","\\space"),_(j,Z,se,"\xa0","\\nobreakspace"),_($,Z,se,"\xa0","\\ "),_($,Z,se,"\xa0"," "),_($,Z,se,"\xa0","~"),_($,Z,se,"\xa0","\\space"),_($,Z,se,"\xa0","\\nobreakspace"),_(j,Z,se,null,"\\nobreak"),_(j,Z,se,null,"\\allowbreak"),_(j,Z,ie,",",","),_(j,Z,ie,";",";"),_(j,K,Q,"\u22bc","\\barwedge",!0),_(j,K,Q,"\u22bb","\\veebar",!0),_(j,Z,Q,"\u2299","\\odot",!0),_(j,Z,Q,"\u2295","\\oplus",!0),_(j,Z,Q,"\u2297","\\otimes",!0),_(j,Z,le,"\u2202","\\partial",!0),_(j,Z,Q,"\u2298","\\oslash",!0),_(j,K,Q,"\u229a","\\circledcirc",!0),_(j,K,Q,"\u22a1","\\boxdot",!0),_(j,Z,Q,"\u25b3","\\bigtriangleup"),_(j,Z,Q,"\u25bd","\\bigtriangledown"),_(j,Z,Q,"\u2020","\\dagger"),_(j,Z,Q,"\u22c4","\\diamond"),_(j,Z,Q,"\u22c6","\\star"),_(j,Z,Q,"\u25c3","\\triangleleft"),_(j,Z,Q,"\u25b9","\\triangleright"),_(j,Z,ae,"{","\\{"),_($,Z,le,"{","\\{"),_($,Z,le,"{","\\textbraceleft"),_(j,Z,ee,"}","\\}"),_($,Z,le,"}","\\}"),_($,Z,le,"}","\\textbraceright"),_(j,Z,ae,"{","\\lbrace"),_(j,Z,ee,"}","\\rbrace"),_(j,Z,ae,"[","\\lbrack",!0),_($,Z,le,"[","\\lbrack",!0),_(j,Z,ee,"]","\\rbrack",!0),_($,Z,le,"]","\\rbrack",!0),_(j,Z,ae,"(","\\lparen",!0),_(j,Z,ee,")","\\rparen",!0),_($,Z,le,"<","\\textless",!0),_($,Z,le,">","\\textgreater",!0),_(j,Z,ae,"\u230a","\\lfloor",!0),_(j,Z,ee,"\u230b","\\rfloor",!0),_(j,Z,ae,"\u2308","\\lceil",!0),_(j,Z,ee,"\u2309","\\rceil",!0),_(j,Z,le,"\\","\\backslash"),_(j,Z,le,"\u2223","|"),_(j,Z,le,"\u2223","\\vert"),_($,Z,le,"|","\\textbar",!0),_(j,Z,le,"\u2225","\\|"),_(j,Z,le,"\u2225","\\Vert"),_($,Z,le,"\u2225","\\textbardbl"),_($,Z,le,"~","\\textasciitilde"),_($,Z,le,"\\","\\textbackslash"),_($,Z,le,"^","\\textasciicircum"),_(j,Z,oe,"\u2191","\\uparrow",!0),_(j,Z,oe,"\u21d1","\\Uparrow",!0),_(j,Z,oe,"\u2193","\\downarrow",!0),_(j,Z,oe,"\u21d3","\\Downarrow",!0),_(j,Z,oe,"\u2195","\\updownarrow",!0),_(j,Z,oe,"\u21d5","\\Updownarrow",!0),_(j,Z,ne,"\u2210","\\coprod"),_(j,Z,ne,"\u22c1","\\bigvee"),_(j,Z,ne,"\u22c0","\\bigwedge"),_(j,Z,ne,"\u2a04","\\biguplus"),_(j,Z,ne,"\u22c2","\\bigcap"),_(j,Z,ne,"\u22c3","\\bigcup"),_(j,Z,ne,"\u222b","\\int"),_(j,Z,ne,"\u222b","\\intop"),_(j,Z,ne,"\u222c","\\iint"),_(j,Z,ne,"\u222d","\\iiint"),_(j,Z,ne,"\u220f","\\prod"),_(j,Z,ne,"\u2211","\\sum"),_(j,Z,ne,"\u2a02","\\bigotimes"),_(j,Z,ne,"\u2a01","\\bigoplus"),_(j,Z,ne,"\u2a00","\\bigodot"),_(j,Z,ne,"\u222e","\\oint"),_(j,Z,ne,"\u222f","\\oiint"),_(j,Z,ne,"\u2230","\\oiiint"),_(j,Z,ne,"\u2a06","\\bigsqcup"),_(j,Z,ne,"\u222b","\\smallint"),_($,Z,te,"\u2026","\\textellipsis"),_(j,Z,te,"\u2026","\\mathellipsis"),_($,Z,te,"\u2026","\\ldots",!0),_(j,Z,te,"\u2026","\\ldots",!0),_(j,Z,te,"\u22ef","\\@cdots",!0),_(j,Z,te,"\u22f1","\\ddots",!0),_(j,Z,le,"\u22ee","\\varvdots"),_(j,Z,J,"\u02ca","\\acute"),_(j,Z,J,"\u02cb","\\grave"),_(j,Z,J,"\xa8","\\ddot"),_(j,Z,J,"~","\\tilde"),_(j,Z,J,"\u02c9","\\bar"),_(j,Z,J,"\u02d8","\\breve"),_(j,Z,J,"\u02c7","\\check"),_(j,Z,J,"^","\\hat"),_(j,Z,J,"\u20d7","\\vec"),_(j,Z,J,"\u02d9","\\dot"),_(j,Z,J,"\u02da","\\mathring"),_(j,Z,re,"\ue131","\\@imath"),_(j,Z,re,"\ue237","\\@jmath"),_(j,Z,le,"\u0131","\u0131"),_(j,Z,le,"\u0237","\u0237"),_($,Z,le,"\u0131","\\i",!0),_($,Z,le,"\u0237","\\j",!0),_($,Z,le,"\xdf","\\ss",!0),_($,Z,le,"\xe6","\\ae",!0),_($,Z,le,"\u0153","\\oe",!0),_($,Z,le,"\xf8","\\o",!0),_($,Z,le,"\xc6","\\AE",!0),_($,Z,le,"\u0152","\\OE",!0),_($,Z,le,"\xd8","\\O",!0),_($,Z,J,"\u02ca","\\'"),_($,Z,J,"\u02cb","\\`"),_($,Z,J,"\u02c6","\\^"),_($,Z,J,"\u02dc","\\~"),_($,Z,J,"\u02c9","\\="),_($,Z,J,"\u02d8","\\u"),_($,Z,J,"\u02d9","\\."),_($,Z,J,"\u02da","\\r"),_($,Z,J,"\u02c7","\\v"),_($,Z,J,"\xa8",'\\"'),_($,Z,J,"\u02dd","\\H"),_($,Z,J,"\u25ef","\\textcircled");var he={"--":!0,"---":!0,"``":!0,"''":!0};_($,Z,le,"\u2013","--",!0),_($,Z,le,"\u2013","\\textendash"),_($,Z,le,"\u2014","---",!0),_($,Z,le,"\u2014","\\textemdash"),_($,Z,le,"\u2018","`",!0),_($,Z,le,"\u2018","\\textquoteleft"),_($,Z,le,"\u2019","'",!0),_($,Z,le,"\u2019","\\textquoteright"),_($,Z,le,"\u201c","``",!0),_($,Z,le,"\u201c","\\textquotedblleft"),_($,Z,le,"\u201d","''",!0),_($,Z,le,"\u201d","\\textquotedblright"),_(j,Z,le,"\xb0","\\degree",!0),_($,Z,le,"\xb0","\\degree"),_($,Z,le,"\xb0","\\textdegree",!0),_(j,Z,le,"\xa3","\\pounds"),_(j,Z,le,"\xa3","\\mathsterling",!0),_($,Z,le,"\xa3","\\pounds"),_($,Z,le,"\xa3","\\textsterling",!0),_(j,K,le,"\u2720","\\maltese"),_($,K,le,"\u2720","\\maltese");for(var me='0123456789/@."',ce=0;ce=5?0:e>=3?1:2]){var r=G[t]={cssEmPerMu:P.quad[t]/18};for(var n in P)P.hasOwnProperty(n)&&(r[n]=P[n][t])}return G[t]}(this.size)),this._fontMetrics},t.getColor=function(){return this.phantom?"transparent":this.color},e}();Ie.BASESIZE=6;var Oe=Ie,Re={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},Ee={ex:!0,em:!0,mu:!0},He=function(e){return"string"!=typeof e&&(e=e.unit),e in Re||e in Ee||"ex"===e},Le=function(e,t){var r;if(e.unit in Re)r=Re[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if("mu"===e.unit)r=t.fontMetrics().cssEmPerMu;else{var a;if(a=t.style.isTight()?t.havingStyle(t.style.text()):t,"ex"===e.unit)r=a.fontMetrics().xHeight;else{if("em"!==e.unit)throw new n("Invalid unit: '"+e.unit+"'");r=a.fontMetrics().quad}a!==t&&(r*=a.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*r,t.maxSize)},De=function(e,t,r){return X[r][e]&&X[r][e].replace&&(e=X[r][e].replace),{value:e,metrics:V(e,t,r)}},Pe=function(e,t,r,n,a){var i,o=De(e,t,r),s=o.metrics;if(e=o.value,s){var l=s.italic;("text"===r||n&&"mathit"===n.font)&&(l=0),i=new O(e,s.height,s.depth,l,s.skew,s.width,a)}else"undefined"!=typeof console&&console.warn("No character metrics for '"+e+"' in style '"+t+"' and mode '"+r+"'"),i=new O(e,0,0,0,0,0,a);if(n){i.maxFontSize=n.sizeMultiplier,n.style.isTight()&&i.classes.push("mtight");var h=n.getColor();h&&(i.style.color=h)}return i},Fe=function(e,t){if(z(e.classes)!==z(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(1===e.classes.length){var r=e.classes[0];if("mbin"===r||"mord"===r)return!1}for(var n in e.style)if(e.style.hasOwnProperty(n)&&e.style[n]!==t.style[n])return!1;for(var a in t.style)if(t.style.hasOwnProperty(a)&&e.style[a]!==t.style[a])return!1;return!0},Ve=function(e){for(var t=0,r=0,n=0,a=0;at&&(t=i.height),i.depth>r&&(r=i.depth),i.maxFontSize>n&&(n=i.maxFontSize)}e.height=t,e.depth=r,e.maxFontSize=n},Ge=function(e,t,r,n){var a=new q(e,t,r,n);return Ve(a),a},Ue=function(e,t,r,n){return new q(e,t,r,n)},Ye=function(e){var t=new M(e);return Ve(t),t},We=function(e,t,r){var n="";switch(e){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=e}return n+"-"+("textbf"===t&&"textit"===r?"BoldItalic":"textbf"===t?"Bold":"textit"===t?"Italic":"Regular")},Xe={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},_e={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},je={fontMap:Xe,makeSymbol:Pe,mathsym:function(e,t,r,n){return void 0===n&&(n=[]),"boldsymbol"===r.font&&De(e,"Main-Bold",t).metrics?Pe(e,"Main-Bold",t,r,n.concat(["mathbf"])):"\\"===e||"main"===X[t][e].font?Pe(e,"Main-Regular",t,r,n):Pe(e,"AMS-Regular",t,r,n.concat(["amsrm"]))},makeSpan:Ge,makeSvgSpan:Ue,makeLineSpan:function(e,t,r){var n=Ge([e],[],t);return n.height=Math.max(r||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),n.style.borderBottomWidth=n.height+"em",n.maxFontSize=1,n},makeAnchor:function(e,t,r,n){var a=new N(e,t,r,n);return Ve(a),a},makeFragment:Ye,wrapFragment:function(e,t){return e instanceof M?Ge([],[e],t):e},makeVList:function(e,t){for(var r=function(e){if("individualShift"===e.positionType){for(var t=e.children,r=[t[0]],n=-t[0].shift-t[0].elem.depth,a=n,i=1;i0&&(o.push(yt(s,t)),s=[]),o.push(a[l]));s.length>0&&o.push(yt(s,t)),r?((i=yt(ut(r,t,!0))).classes=["tag"],o.push(i)):n&&o.push(n);var m=st(["katex-html"],o);if(m.setAttribute("aria-hidden","true"),i){var c=i.children[0];c.style.height=m.height+m.depth+"em",c.style.verticalAlign=-m.depth+"em"}return m}function wt(e){return new M(e)}var kt=function(){function e(e,t,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=r||[]}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.getAttribute=function(e){return this.attributes[e]},t.toNode=function(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=z(this.classes));for(var r=0;r0&&(e+=' class ="'+l.escape(z(this.classes))+'"'),e+=">";for(var r=0;r"},t.toText=function(){return this.children.map((function(e){return e.toText()})).join("")},e}(),St=function(){function e(e){this.text=void 0,this.text=e}var t=e.prototype;return t.toNode=function(){return document.createTextNode(this.text)},t.toMarkup=function(){return l.escape(this.toText())},t.toText=function(){return this.text},e}(),Mt={MathNode:kt,TextNode:St,SpaceNode:function(){function e(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?"\u200a":e>=.1666&&e<=.1667?"\u2009":e>=.2222&&e<=.2223?"\u2005":e>=.2777&&e<=.2778?"\u2005\u200a":e>=-.05556&&e<=-.05555?"\u200a\u2063":e>=-.1667&&e<=-.1666?"\u2009\u2063":e>=-.2223&&e<=-.2222?"\u205f\u2063":e>=-.2778&&e<=-.2777?"\u2005\u2063":null}var t=e.prototype;return t.toNode=function(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",this.width+"em"),e},t.toMarkup=function(){return this.character?""+this.character+"":''},t.toText=function(){return this.character?this.character:" "},e}(),newDocumentFragment:wt},zt=function(e,t,r){return!X[t][e]||!X[t][e].replace||55349===e.charCodeAt(0)||he.hasOwnProperty(e)&&r&&(r.fontFamily&&"tt"===r.fontFamily.substr(4,2)||r.font&&"tt"===r.font.substr(4,2))||(e=X[t][e].replace),new Mt.TextNode(e)},At=function(e){return 1===e.length?e[0]:new Mt.MathNode("mrow",e)},Tt=function(e,t){if("texttt"===t.fontFamily)return"monospace";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";var r=t.font;if(!r||"mathnormal"===r)return null;var n=e.mode;if("mathit"===r)return"italic";if("boldsymbol"===r)return"textord"===e.type?"bold":"bold-italic";if("mathbf"===r)return"bold";if("mathbb"===r)return"double-struck";if("mathfrak"===r)return"fraktur";if("mathscr"===r||"mathcal"===r)return"script";if("mathsf"===r)return"sans-serif";if("mathtt"===r)return"monospace";var a=e.text;return l.contains(["\\imath","\\jmath"],a)?null:(X[n][a]&&X[n][a].replace&&(a=X[n][a].replace),V(a,je.fontMap[r].fontName,n)?je.fontMap[r].variant:null)},Bt=function(e,t,r){if(1===e.length){var n=Nt(e[0],t);return r&&n instanceof kt&&"mo"===n.type&&(n.setAttribute("lspace","0em"),n.setAttribute("rspace","0em")),[n]}for(var a,i=[],o=0;o0&&(p.text=p.text.slice(0,1)+"\u0338"+p.text.slice(1),i.pop())}}}i.push(s),a=s}return i},qt=function(e,t,r){return At(Bt(e,t,r))},Nt=function(e,t){if(!e)return new Mt.MathNode("mrow");if(rt[e.type])return rt[e.type](e,t);throw new n("Got group of unknown type: '"+e.type+"'")};function Ct(e,t,r,n,a){var i,o=Bt(e,r);i=1===o.length&&o[0]instanceof kt&&l.contains(["mrow","mtable"],o[0].type)?o[0]:new Mt.MathNode("mrow",o);var s=new Mt.MathNode("annotation",[new Mt.TextNode(t)]);s.setAttribute("encoding","application/x-tex");var h=new Mt.MathNode("semantics",[i,s]),m=new Mt.MathNode("math",[h]);m.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&m.setAttribute("display","block");var c=a?"katex":"katex-mathml";return je.makeSpan([c],[m])}var It=function(e){return new Oe({style:e.displayMode?b.DISPLAY:b.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Ot=function(e,t){if(t.displayMode){var r=["katex-display"];t.leqno&&r.push("leqno"),t.fleqn&&r.push("fleqn"),e=je.makeSpan(r,[e])}return e},Rt=function(e,t,r){var n,a=It(r);if("mathml"===r.output)return Ct(e,t,a,r.displayMode,!0);if("html"===r.output){var i=xt(e,a);n=je.makeSpan(["katex"],[i])}else{var o=Ct(e,t,a,r.displayMode,!1),s=xt(e,a);n=je.makeSpan(["katex"],[o,s])}return Ot(n,r)},Et={widehat:"^",widecheck:"\u02c7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23df",overbrace:"\u23de",overgroup:"\u23e0",undergroup:"\u23e1",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21d2",xRightarrow:"\u21d2",overleftharpoon:"\u21bc",xleftharpoonup:"\u21bc",overrightharpoon:"\u21c0",xrightharpoonup:"\u21c0",xLeftarrow:"\u21d0",xLeftrightarrow:"\u21d4",xhookleftarrow:"\u21a9",xhookrightarrow:"\u21aa",xmapsto:"\u21a6",xrightharpoondown:"\u21c1",xleftharpoondown:"\u21bd",xrightleftharpoons:"\u21cc",xleftrightharpoons:"\u21cb",xtwoheadleftarrow:"\u219e",xtwoheadrightarrow:"\u21a0",xlongequal:"=",xtofrom:"\u21c4",xrightleftarrows:"\u21c4",xrightequilibrium:"\u21cc",xleftequilibrium:"\u21cb","\\\\cdrightarrow":"\u2192","\\\\cdleftarrow":"\u2190","\\\\cdlongequal":"="},Ht={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Lt=function(e,t,r,n,a){var i,o=e.height+e.depth+r+n;if(/fbox|color|angl/.test(t)){if(i=je.makeSpan(["stretchy",t],[],a),"fbox"===t){var s=a.color&&a.getColor();s&&(i.style.borderColor=s)}}else{var l=[];/^[bx]cancel$/.test(t)&&l.push(new H({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new H({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new R(l,{width:"100%",height:o+"em"});i=je.makeSvgSpan([],[h],a)}return i.height=o,i.style.height=o+"em",i},Dt=function(e){var t=new Mt.MathNode("mo",[new Mt.TextNode(Et[e])]);return t.setAttribute("stretchy","true"),t},Pt=function(e,t){var r=function(){var r=4e5,n=e.label.substr(1);if(l.contains(["widehat","widecheck","widetilde","utilde"],n)){var a,i,o,s="ordgroup"===(d=e.base).type?d.body.length:1;if(s>5)"widehat"===n||"widecheck"===n?(a=420,r=2364,o=.42,i=n+"4"):(a=312,r=2340,o=.34,i="tilde4");else{var h=[1,1,2,2,3,3][s];"widehat"===n||"widecheck"===n?(r=[0,1062,2364,2364,2364][h],a=[0,239,300,360,420][h],o=[0,.24,.3,.3,.36,.42][h],i=n+h):(r=[0,600,1033,2339,2340][h],a=[0,260,286,306,312][h],o=[0,.26,.286,.3,.306,.34][h],i="tilde"+h)}var m=new E(i),c=new R([m],{width:"100%",height:o+"em",viewBox:"0 0 "+r+" "+a,preserveAspectRatio:"none"});return{span:je.makeSvgSpan([],[c],t),minWidth:0,height:o}}var u,p,d,f=[],g=Ht[n],v=g[0],b=g[1],y=g[2],x=y/1e3,w=v.length;if(1===w)u=["hide-tail"],p=[g[3]];else if(2===w)u=["halfarrow-left","halfarrow-right"],p=["xMinYMin","xMaxYMin"];else{if(3!==w)throw new Error("Correct katexImagesData or update code here to support\n "+w+" children.");u=["brace-left","brace-center","brace-right"],p=["xMinYMin","xMidYMin","xMaxYMin"]}for(var k=0;k0&&(n.style.minWidth=a+"em"),n};function Ft(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function Vt(e){var t=Gt(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Gt(e){return e&&("atom"===e.type||Y.hasOwnProperty(e.type))?e:null}var Ut=function(e,t){var r,n,a;e&&"supsub"===e.type?(r=(n=Ft(e.base,"accent")).base,e.base=r,a=function(e){if(e instanceof q)return e;throw new Error("Expected span but got "+String(e)+".")}(bt(e,t)),e.base=n):r=(n=Ft(e,"accent")).base;var i=bt(r,t.havingCrampedStyle()),o=0;if(n.isShifty&&l.isCharacterBox(r)){var s=l.getBaseElem(r);o=L(bt(s,t.havingCrampedStyle())).skew}var h,m=Math.min(i.height,t.fontMetrics().xHeight);if(n.isStretchy)h=Pt(n,t),h=je.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+2*o+"em)",marginLeft:2*o+"em"}:void 0}]},t);else{var c,u;"\\vec"===n.label?(c=je.staticSvg("vec",t),u=je.svgData.vec[1]):((c=L(c=je.makeOrd({mode:n.mode,text:n.label},t,"textord"))).italic=0,u=c.width),h=je.makeSpan(["accent-body"],[c]);var p="\\textcircled"===n.label;p&&(h.classes.push("accent-full"),m=i.height);var d=o;p||(d-=u/2),h.style.left=d+"em","\\textcircled"===n.label&&(h.style.top=".2em"),h=je.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:h}]},t)}var f=je.makeSpan(["mord","accent"],[h],t);return a?(a.children[0]=f,a.height=Math.max(f.height,a.height),a.classes[0]="mord",a):f},Yt=function(e,t){var r=e.isStretchy?Dt(e.label):new Mt.MathNode("mo",[zt(e.label,e.mode)]),n=new Mt.MathNode("mover",[Nt(e.base,t),r]);return n.setAttribute("accent","true"),n},Wt=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map((function(e){return"\\"+e})).join("|"));nt({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:function(e,t){var r=it(t[0]),n=!Wt.test(e.funcName),a=!n||"\\widehat"===e.funcName||"\\widetilde"===e.funcName||"\\widecheck"===e.funcName;return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:a,base:r}},htmlBuilder:Ut,mathmlBuilder:Yt}),nt({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!1,argTypes:["primitive"]},handler:function(e,t){var r=t[0];return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:Ut,mathmlBuilder:Yt}),nt({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:a}},htmlBuilder:function(e,t){var r=bt(e.base,t),n=Pt(e,t),a="\\utilde"===e.label?.12:0,i=je.makeVList({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:a},{type:"elem",elem:r}]},t);return je.makeSpan(["mord","accentunder"],[i],t)},mathmlBuilder:function(e,t){var r=Dt(e.label),n=new Mt.MathNode("munder",[Nt(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});var Xt=function(e){var t=new Mt.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};nt({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler:function(e,t,r){var n=e.parser,a=e.funcName;return{type:"xArrow",mode:n.mode,label:a,body:t[0],below:r[0]}},htmlBuilder:function(e,t){var r,n=t.style,a=t.havingStyle(n.sup()),i=je.wrapFragment(bt(e.body,a,t),t),o="\\x"===e.label.slice(0,2)?"x":"cd";i.classes.push(o+"-arrow-pad"),e.below&&(a=t.havingStyle(n.sub()),(r=je.wrapFragment(bt(e.below,a,t),t)).classes.push(o+"-arrow-pad"));var s,l=Pt(e,t),h=-t.fontMetrics().axisHeight+.5*l.height,m=-t.fontMetrics().axisHeight-.5*l.height-.111;if((i.depth>.25||"\\xleftequilibrium"===e.label)&&(m-=i.depth),r){var c=-t.fontMetrics().axisHeight+r.height+.5*l.height+.111;s=je.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:m},{type:"elem",elem:l,shift:h},{type:"elem",elem:r,shift:c}]},t)}else s=je.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:m},{type:"elem",elem:l,shift:h}]},t);return s.children[0].children[0].children[1].classes.push("svg-align"),je.makeSpan(["mrel","x-arrow"],[s],t)},mathmlBuilder:function(e,t){var r,n=Dt(e.label);if(n.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var a=Xt(Nt(e.body,t));if(e.below){var i=Xt(Nt(e.below,t));r=new Mt.MathNode("munderover",[n,i,a])}else r=new Mt.MathNode("mover",[n,a])}else if(e.below){var o=Xt(Nt(e.below,t));r=new Mt.MathNode("munder",[n,o])}else r=Xt(),r=new Mt.MathNode("mover",[n,r]);return r}});var _t={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},jt=function(e){return"textord"===e.type&&"@"===e.text};function $t(e,t,r){var n=_t[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":var a={type:"atom",text:n,mode:"math",family:"rel"},i={type:"ordgroup",mode:"math",body:[r.callFunction("\\\\cdleft",[t[0]],[]),r.callFunction("\\Big",[a],[]),r.callFunction("\\\\cdright",[t[1]],[])]};return r.callFunction("\\\\cdparent",[i],[]);case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":return r.callFunction("\\Big",[{type:"textord",text:"\\Vert",mode:"math"}],[]);default:return{type:"textord",text:" ",mode:"math"}}}nt({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder:function(e,t){var r=t.havingStyle(t.style.sup()),n=je.wrapFragment(bt(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=.8-n.depth+"em",n.height=0,n.depth=0,n},mathmlBuilder:function(e,t){var r=new Mt.MathNode("mrow",[Nt(e.label,t)]);return(r=new Mt.MathNode("mpadded",[r])).setAttribute("width","0"),"left"===e.side&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),(r=new Mt.MathNode("mstyle",[r])).setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}}),nt({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:function(e,t){return{type:"cdlabelparent",mode:e.parser.mode,fragment:t[0]}},htmlBuilder:function(e,t){var r=je.wrapFragment(bt(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder:function(e,t){return new Mt.MathNode("mrow",[Nt(e.fragment,t)])}}),nt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){for(var r=e.parser,a=Ft(t[0],"ordgroup").body,i="",o=0;o","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],gr=[0,1.2,1.8,2.4,3],vr=[{type:"small",style:b.SCRIPTSCRIPT},{type:"small",style:b.SCRIPT},{type:"small",style:b.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],br=[{type:"small",style:b.SCRIPTSCRIPT},{type:"small",style:b.SCRIPT},{type:"small",style:b.TEXT},{type:"stack"}],yr=[{type:"small",style:b.SCRIPTSCRIPT},{type:"small",style:b.SCRIPT},{type:"small",style:b.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],xr=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},wr=function(e,t,r,n){for(var a=Math.min(2,3-n.style.size);at)return r[a]}return r[r.length-1]},kr=function(e,t,r,n,a,i){var o;"<"===e||"\\lt"===e||"\u27e8"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"\u27e9"!==e||(e="\\rangle"),o=l.contains(fr,e)?vr:l.contains(pr,e)?yr:br;var s=wr(e,t,o,n);return"small"===s.type?function(e,t,r,n,a,i){var o=je.makeSymbol(e,"Main-Regular",a,n),s=rr(o,t,n,i);return r&&nr(s,n,t),s}(e,s.style,r,n,a,i):"large"===s.type?ar(e,s.size,r,n,a,i):mr(e,t,r,n,a,i)},Sr=function(e,t){var r,n,a=t.havingBaseSizing(),i=wr("\\surd",e*a.sizeMultiplier,yr,a),o=a.sizeMultiplier,s=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),l=0,h=0,m=0;return"small"===i.type?(e<1?o=1:e<1.4&&(o=.7),h=(1+s)/o,(r=ur("sqrtMain",l=(1+s+cr)/o,m=1e3+1e3*s+80,s,t)).style.minWidth="0.853em",n=.833/o):"large"===i.type?(m=1080*gr[i.size],h=(gr[i.size]+s)/o,l=(gr[i.size]+s+cr)/o,(r=ur("sqrtSize"+i.size,l,m,s,t)).style.minWidth="1.02em",n=1/o):(l=e+s+cr,h=e+s,m=Math.floor(1e3*e+s)+80,(r=ur("sqrtTall",l,m,s,t)).style.minWidth="0.742em",n=1.056),r.height=h,r.style.height=l+"em",{span:r,advanceWidth:n,ruleWidth:(t.fontMetrics().sqrtRuleThickness+s)*o}},Mr=function(e,t,r,a,i){if("<"===e||"\\lt"===e||"\u27e8"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"\u27e9"!==e||(e="\\rangle"),l.contains(pr,e)||l.contains(fr,e))return ar(e,t,!1,r,a,i);if(l.contains(dr,e))return mr(e,gr[t],!1,r,a,i);throw new n("Illegal delimiter: '"+e+"'")},zr=gr,Ar=kr,Tr=function(e,t,r,n,a,i){var o=n.fontMetrics().axisHeight*n.sizeMultiplier,s=5/n.fontMetrics().ptPerEm,l=Math.max(t-o,r+o),h=Math.max(l/500*901,2*l-s);return kr(e,h,!0,n,a,i)},Br={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},qr=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230a","\u230b","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27e8","\\rangle","\u27e9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27ee","\u27ef","\\lmoustache","\\rmoustache","\u23b0","\u23b1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Nr(e,t){var r=Gt(e);if(r&&l.contains(qr,r.text))return r;throw new n(r?"Invalid delimiter '"+r.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function Cr(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}nt({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:function(e,t){var r=Nr(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:Br[e.funcName].size,mclass:Br[e.funcName].mclass,delim:r.text}},htmlBuilder:function(e,t){return"."===e.delim?je.makeSpan([e.mclass]):Mr(e.delim,e.size,t,e.mode,[e.mclass])},mathmlBuilder:function(e){var t=[];"."!==e.delim&&t.push(zt(e.delim,e.mode));var r=new Mt.MathNode("mo",t);return"mopen"===e.mclass||"mclose"===e.mclass?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true"),r.setAttribute("minsize",zr[e.size]+"em"),r.setAttribute("maxsize",zr[e.size]+"em"),r}}),nt({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:function(e,t){var r=e.parser.gullet.macros.get("\\current@color");if(r&&"string"!=typeof r)throw new n("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Nr(t[0],e).text,color:r}}}),nt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:function(e,t){var r=Nr(t[0],e),n=e.parser;++n.leftrightDepth;var a=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var i=Ft(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:a,left:r.text,right:i.delim,rightColor:i.color}},htmlBuilder:function(e,t){Cr(e);for(var r,n,a=ut(e.body,t,!0,["mopen","mclose"]),i=0,o=0,s=!1,l=0;l-1?"mpadded":"menclose",[Nt(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),"\\fcolorbox"===e.label){var a=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+a+"em solid "+String(e.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n};nt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler:function(e,t,r){var n=e.parser,a=e.funcName,i=Ft(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:n.mode,label:a,backgroundColor:i,body:o}},htmlBuilder:Ir,mathmlBuilder:Or}),nt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler:function(e,t,r){var n=e.parser,a=e.funcName,i=Ft(t[0],"color-token").color,o=Ft(t[1],"color-token").color,s=t[2];return{type:"enclose",mode:n.mode,label:a,backgroundColor:o,borderColor:i,body:s}},htmlBuilder:Ir,mathmlBuilder:Or}),nt({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:function(e,t){return{type:"enclose",mode:e.parser.mode,label:"\\fbox",body:t[0]}}}),nt({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"enclose",mode:r.mode,label:n,body:a}},htmlBuilder:Ir,mathmlBuilder:Or}),nt({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler:function(e,t){return{type:"enclose",mode:e.parser.mode,label:"\\angl",body:t[0]}}});var Rr={};function Er(e){for(var t=e.type,r=e.names,n=e.props,a=e.handler,i=e.htmlBuilder,o=e.mathmlBuilder,s={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:a},l=0;l0&&(x+=.25),m.push({pos:x,isDashed:e[t]})}for(w(o[0]),r=0;r0&&(M<(B+=y)&&(M=B),B=0),e.addJot&&(M+=f),z.height=S,z.depth=M,x+=S,z.pos=x,x+=M+B,h[r]=z,w(o[r+1])}var q,N,C=x/2+t.fontMetrics().axisHeight,I=e.cols||[],O=[],R=[];if(e.addEqnNum)for(r=0;r=s)){var G=void 0;(a>0||e.hskipBeforeAndAfter)&&0!==(G=l.deflt(D.pregap,p))&&((q=je.makeSpan(["arraycolsep"],[])).style.width=G+"em",O.push(q));var U=[];for(r=0;r0){for(var _=je.makeLineSpan("hline",t,c),j=je.makeLineSpan("hdashline",t,c),$=[{type:"elem",elem:h,shift:0}];m.length>0;){var Z=m.pop(),K=Z.pos-C;Z.isDashed?$.push({type:"elem",elem:j,shift:K}):$.push({type:"elem",elem:_,shift:K})}h=je.makeVList({positionType:"individualShift",children:$},t)}if(e.addEqnNum){var J=je.makeVList({positionType:"individualShift",children:R},t);return J=je.makeSpan(["tag"],[J],t),je.makeFragment([h,J])}return je.makeSpan(["mord"],[h],t)},Vr={c:"center ",l:"left ",r:"right "},Gr=function(e,t){for(var r=[],n=new Mt.MathNode("mtd",[],["mtr-glue"]),a=new Mt.MathNode("mtd",[],["mml-eqn-num"]),i=0;i0){var p=e.cols,d="",f=!1,g=0,v=p.length;"separator"===p[0].type&&(c+="top ",g=1),"separator"===p[p.length-1].type&&(c+="bottom ",v-=1);for(var b=g;b0?"left ":"",c+=S[S.length-1].length>0?"right ":"";for(var M=1;M-1?"alignat":"align",o=Dr(e.parser,{cols:a,addJot:!0,addEqnNum:"align"===e.envName||"alignat"===e.envName,colSeparationType:i,maxNumCols:"split"===e.envName?2:void 0,leqno:e.parser.settings.leqno},"display"),s=0,l={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){for(var h="",m=0;m0&&c&&(d=1),a[u]={type:"align",align:p,pregap:d,postgap:0}}return o.colSeparationType=c?"align":"alignat",o};Er({type:"array",names:["array","darray"],props:{numArgs:1},handler:function(e,t){var r=(Gt(t[0])?[t[0]]:Ft(t[0],"ordgroup").body).map((function(e){var t=Vt(e).text;if(-1!=="lcr".indexOf(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"};throw new n("Unknown column alignment: "+t,e)})),a={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return Dr(e.parser,a,Pr(e.envName))},htmlBuilder:Fr,mathmlBuilder:Gr}),Er({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler:function(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",a={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if("*"===e.envName.charAt(e.envName.length-1)){var i=e.parser;if(i.consumeSpaces(),"["===i.fetch().text){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,-1==="lcr".indexOf(r))throw new n("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),a.cols=[{type:"align",align:r}]}}var o=Dr(e.parser,a,Pr(e.envName));return o.cols=new Array(o.body[0].length).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[o],left:t[0],right:t[1],rightColor:void 0}:o},htmlBuilder:Fr,mathmlBuilder:Gr}),Er({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:function(e){var t=Dr(e.parser,{arraystretch:.5},"script");return t.colSeparationType="small",t},htmlBuilder:Fr,mathmlBuilder:Gr}),Er({type:"array",names:["subarray"],props:{numArgs:1},handler:function(e,t){var r=(Gt(t[0])?[t[0]]:Ft(t[0],"ordgroup").body).map((function(e){var t=Vt(e).text;if(-1!=="lc".indexOf(t))return{type:"align",align:t};throw new n("Unknown column alignment: "+t,e)}));if(r.length>1)throw new n("{subarray} can contain only one column");var a={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5};if((a=Dr(e.parser,a,"script")).body.length>0&&a.body[0].length>1)throw new n("{subarray} can contain only one column");return a},htmlBuilder:Fr,mathmlBuilder:Gr}),Er({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler:function(e){var t=Dr(e.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},Pr(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Fr,mathmlBuilder:Gr}),Er({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Ur,htmlBuilder:Fr,mathmlBuilder:Gr}),Er({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler:function(e){l.contains(["gather","gather*"],e.envName)&&Lr(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",addEqnNum:"gather"===e.envName,leqno:e.parser.settings.leqno};return Dr(e.parser,t,"display")},htmlBuilder:Fr,mathmlBuilder:Gr}),Er({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Ur,htmlBuilder:Fr,mathmlBuilder:Gr}),Er({type:"array",names:["equation","equation*"],props:{numArgs:0},handler:function(e){Lr(e);var t={addEqnNum:"equation"===e.envName,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Dr(e.parser,t,"display")},htmlBuilder:Fr,mathmlBuilder:Gr}),Er({type:"array",names:["CD"],props:{numArgs:0},handler:function(e){return Lr(e),function(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if("&"!==r&&"\\\\"!==r){if("\\end"===r){0===t[t.length-1].length&&t.pop();break}throw new n("Expected \\\\ or \\cr or \\end",e.nextToken)}e.consume()}for(var a,i,o=[],s=[o],l=0;l-1);else{if(!("<>AV".indexOf(u)>-1))throw new n('Expected one of "<>AV=|." after @',h[c]);for(var d=0;d<2;d++){for(var f=!0,g=c+1;g=b.SCRIPT.id?r.text():b.DISPLAY:"text"===e&&r.size===b.DISPLAY.size?r=b.TEXT:"script"===e?r=b.SCRIPT:"scriptscript"===e&&(r=b.SCRIPTSCRIPT),r},Qr=function(e,t){var r,n=Jr(e.size,t.style),a=n.fracNum(),i=n.fracDen();r=t.havingStyle(a);var o=bt(e.numer,r,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;o.height=o.height0?3*c:7*c,d=t.fontMetrics().denom1):(m>0?(u=t.fontMetrics().num2,p=c):(u=t.fontMetrics().num3,p=3*c),d=t.fontMetrics().denom2),h){var w=t.fontMetrics().axisHeight;u-o.depth-(w+.5*m)0&&(t="."===(t=e)?null:t),t};nt({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler:function(e,t){var r,n=e.parser,a=t[4],i=t[5],o=it(t[0]),s="atom"===o.type&&"open"===o.family?rn(o.text):null,l=it(t[1]),h="atom"===l.type&&"close"===l.family?rn(l.text):null,m=Ft(t[2],"size"),c=null;r=!!m.isBlank||(c=m.value).number>0;var u="auto",p=t[3];if("ordgroup"===p.type){if(p.body.length>0){var d=Ft(p.body[0],"textord");u=tn[Number(d.text)]}}else p=Ft(p,"textord"),u=tn[Number(p.text)];return{type:"genfrac",mode:n.mode,numer:a,denom:i,continued:!1,hasBarLine:r,barSize:c,leftDelim:s,rightDelim:h,size:u}},htmlBuilder:Qr,mathmlBuilder:en}),nt({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:function(e,t){var r=e.parser,n=(e.funcName,e.token);return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:Ft(t[0],"size").value,token:n}}}),nt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:function(e,t){var r=e.parser,n=(e.funcName,t[0]),a=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}(Ft(t[1],"infix").size),i=t[2],o=a.number>0;return{type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:o,barSize:a,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:Qr,mathmlBuilder:en});var nn=function(e,t){var r,n,a=t.style;"supsub"===e.type?(r=e.sup?bt(e.sup,t.havingStyle(a.sup()),t):bt(e.sub,t.havingStyle(a.sub()),t),n=Ft(e.base,"horizBrace")):n=Ft(e,"horizBrace");var i,o=bt(n.base,t.havingBaseStyle(b.DISPLAY)),s=Pt(n,t);if(n.isOver?(i=je.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]},t)).children[0].children[0].children[1].classes.push("svg-align"):(i=je.makeVList({positionType:"bottom",positionData:o.depth+.1+s.height,children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]},t)).children[0].children[0].children[0].classes.push("svg-align"),r){var l=je.makeSpan(["mord",n.isOver?"mover":"munder"],[i],t);i=n.isOver?je.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]},t):je.makeVList({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]},t)}return je.makeSpan(["mord",n.isOver?"mover":"munder"],[i],t)};nt({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName;return{type:"horizBrace",mode:r.mode,label:n,isOver:/^\\over/.test(n),base:t[0]}},htmlBuilder:nn,mathmlBuilder:function(e,t){var r=Dt(e.label);return new Mt.MathNode(e.isOver?"mover":"munder",[Nt(e.base,t),r])}}),nt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:function(e,t){var r=e.parser,n=t[1],a=Ft(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:a})?{type:"href",mode:r.mode,href:a,body:ot(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:function(e,t){var r=ut(e.body,t,!1);return je.makeAnchor(e.href,[],r,t)},mathmlBuilder:function(e,t){var r=qt(e.body,t);return r instanceof kt||(r=new kt("mrow",[r])),r.setAttribute("href",e.href),r}}),nt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:function(e,t){var r=e.parser,n=Ft(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var a=[],i=0;i0&&(n=Le(e.totalheight,t)-r,n=Number(n.toFixed(2)));var a=0;e.width.number>0&&(a=Le(e.width,t));var i={height:r+n+"em"};a>0&&(i.width=a+"em"),n>0&&(i.verticalAlign=-n+"em");var o=new C(e.src,e.alt,i);return o.height=r,o.depth=n,o},mathmlBuilder:function(e,t){var r=new Mt.MathNode("mglyph",[]);r.setAttribute("alt",e.alt);var n=Le(e.height,t),a=0;if(e.totalheight.number>0&&(a=(a=Le(e.totalheight,t)-n).toFixed(2),r.setAttribute("valign","-"+a+"em")),r.setAttribute("height",n+a+"em"),e.width.number>0){var i=Le(e.width,t);r.setAttribute("width",i+"em")}return r.setAttribute("src",e.src),r}}),nt({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=Ft(t[0],"size");if(r.settings.strict){var i="m"===n[1],o="mu"===a.value.unit;i?(o||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, not "+a.value.unit+" units"),"math"!==r.mode&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):o&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:a.value}},htmlBuilder:function(e,t){return je.makeGlue(e.dimension,t)},mathmlBuilder:function(e,t){var r=Le(e.dimension,t);return new Mt.SpaceNode(r)}}),nt({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:a}},htmlBuilder:function(e,t){var r;"clap"===e.alignment?(r=je.makeSpan([],[bt(e.body,t)]),r=je.makeSpan(["inner"],[r],t)):r=je.makeSpan(["inner"],[bt(e.body,t)]);var n=je.makeSpan(["fix"],[]),a=je.makeSpan([e.alignment],[r,n],t),i=je.makeSpan(["strut"]);return i.style.height=a.height+a.depth+"em",i.style.verticalAlign=-a.depth+"em",a.children.unshift(i),a=je.makeSpan(["thinbox"],[a],t),je.makeSpan(["mord","vbox"],[a],t)},mathmlBuilder:function(e,t){var r=new Mt.MathNode("mpadded",[Nt(e.body,t)]);if("rlap"!==e.alignment){var n="llap"===e.alignment?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}}),nt({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(e,t){var r=e.funcName,n=e.parser,a=n.mode;n.switchMode("math");var i="\\("===r?"\\)":"$",o=n.parseExpression(!1,i);return n.expect(i),n.switchMode(a),{type:"styling",mode:n.mode,style:"text",body:o}}}),nt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(e,t){throw new n("Mismatched "+e.funcName)}});var on=function(e,t){switch(t.style.size){case b.DISPLAY.size:return e.display;case b.TEXT.size:return e.text;case b.SCRIPT.size:return e.script;case b.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};nt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:function(e,t){return{type:"mathchoice",mode:e.parser.mode,display:ot(t[0]),text:ot(t[1]),script:ot(t[2]),scriptscript:ot(t[3])}},htmlBuilder:function(e,t){var r=on(e,t),n=ut(r,t,!1);return je.makeFragment(n)},mathmlBuilder:function(e,t){var r=on(e,t);return qt(r,t)}});var sn=function(e,t,r,n,a,i,o){var s,l,h;if(e=je.makeSpan([],[e]),t){var m=bt(t,n.havingStyle(a.sup()),n);l={elem:m,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-m.depth)}}if(r){var c=bt(r,n.havingStyle(a.sub()),n);s={elem:c,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-c.height)}}if(l&&s){var u=n.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+e.depth+o;h=je.makeVList({positionType:"bottom",positionData:u,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:-i+"em"},{type:"kern",size:s.kern},{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:i+"em"},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(s){var p=e.height-o;h=je.makeVList({positionType:"top",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:-i+"em"},{type:"kern",size:s.kern},{type:"elem",elem:e}]},n)}else{if(!l)return e;var d=e.depth+o;h=je.makeVList({positionType:"bottom",positionData:d,children:[{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:i+"em"},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}return je.makeSpan(["mop","op-limits"],[h],n)},ln=["\\smallint"],hn=function(e,t){var r,n,a,i=!1;"supsub"===e.type?(r=e.sup,n=e.sub,a=Ft(e.base,"op"),i=!0):a=Ft(e,"op");var o,s=t.style,h=!1;if(s.size===b.DISPLAY.size&&a.symbol&&!l.contains(ln,a.name)&&(h=!0),a.symbol){var m=h?"Size2-Regular":"Size1-Regular",c="";if("\\oiint"!==a.name&&"\\oiiint"!==a.name||(c=a.name.substr(1),a.name="oiint"===c?"\\iint":"\\iiint"),o=je.makeSymbol(a.name,m,"math",t,["mop","op-symbol",h?"large-op":"small-op"]),c.length>0){var u=o.italic,p=je.staticSvg(c+"Size"+(h?"2":"1"),t);o=je.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:p,shift:h?.08:0}]},t),a.name="\\"+c,o.classes.unshift("mop"),o.italic=u}}else if(a.body){var d=ut(a.body,t,!0);1===d.length&&d[0]instanceof O?(o=d[0]).classes[0]="mop":o=je.makeSpan(["mop"],d,t)}else{for(var f=[],g=1;g0){for(var s=a.body.map((function(e){var t=e.text;return"string"==typeof t?{type:"textord",mode:e.mode,text:t}:e})),l=ut(s,t.withFont("mathrm"),!0),h=0;h=0?s.setAttribute("height","+"+a+"em"):(s.setAttribute("height",a+"em"),s.setAttribute("depth","+"+-a+"em")),s.setAttribute("voffset",a+"em"),s}});var fn=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];nt({type:"sizing",names:fn,props:{numArgs:0,allowedInText:!0},handler:function(e,t){var r=e.breakOnTokenText,n=e.funcName,a=e.parser,i=a.parseExpression(!1,r);return{type:"sizing",mode:a.mode,size:fn.indexOf(n)+1,body:i}},htmlBuilder:function(e,t){var r=t.havingSize(e.size);return dn(e.body,r,t)},mathmlBuilder:function(e,t){var r=t.havingSize(e.size),n=Bt(e.body,r),a=new Mt.MathNode("mstyle",n);return a.setAttribute("mathsize",r.sizeMultiplier+"em"),a}}),nt({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:function(e,t,r){var n=e.parser,a=!1,i=!1,o=r[0]&&Ft(r[0],"ordgroup");if(o)for(var s="",l=0;lr.height+r.depth+i&&(i=(i+c-r.height-r.depth)/2);var u=l.height-r.height-i-h;r.style.paddingLeft=m+"em";var p=je.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+u)},{type:"elem",elem:l},{type:"kern",size:h}]},t);if(e.index){var d=t.havingStyle(b.SCRIPTSCRIPT),f=bt(e.index,d,t),g=.6*(p.height-p.depth),v=je.makeVList({positionType:"shift",positionData:-g,children:[{type:"elem",elem:f}]},t),y=je.makeSpan(["root"],[v]);return je.makeSpan(["mord","sqrt"],[y,p],t)}return je.makeSpan(["mord","sqrt"],[p],t)},mathmlBuilder:function(e,t){var r=e.body,n=e.index;return n?new Mt.MathNode("mroot",[Nt(r,t),Nt(n,t)]):new Mt.MathNode("msqrt",[Nt(r,t)])}});var gn={display:b.DISPLAY,text:b.TEXT,script:b.SCRIPT,scriptscript:b.SCRIPTSCRIPT};nt({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler:function(e,t){var r=e.breakOnTokenText,n=e.funcName,a=e.parser,i=a.parseExpression(!0,r),o=n.slice(1,n.length-5);return{type:"styling",mode:a.mode,style:o,body:i}},htmlBuilder:function(e,t){var r=gn[e.style],n=t.havingStyle(r).withFont("");return dn(e.body,n,t)},mathmlBuilder:function(e,t){var r=gn[e.style],n=t.havingStyle(r),a=Bt(e.body,n),i=new Mt.MathNode("mstyle",a),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});var vn=function(e,t){var r=e.base;return r?"op"===r.type?r.limits&&(t.style.size===b.DISPLAY.size||r.alwaysHandleSupSub)?hn:null:"operatorname"===r.type?r.alwaysHandleSupSub&&(t.style.size===b.DISPLAY.size||r.limits)?pn:null:"accent"===r.type?l.isCharacterBox(r.base)?Ut:null:"horizBrace"===r.type&&!e.sub===r.isOver?nn:null:null};at({type:"supsub",htmlBuilder:function(e,t){var r=vn(e,t);if(r)return r(e,t);var n,a,i,o=e.base,s=e.sup,h=e.sub,m=bt(o,t),c=t.fontMetrics(),u=0,p=0,d=o&&l.isCharacterBox(o);if(s){var f=t.havingStyle(t.style.sup());n=bt(s,f,t),d||(u=m.height-f.fontMetrics().supDrop*f.sizeMultiplier/t.sizeMultiplier)}if(h){var g=t.havingStyle(t.style.sub());a=bt(h,g,t),d||(p=m.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}i=t.style===b.DISPLAY?c.sup1:t.style.cramped?c.sup3:c.sup2;var v,y=t.sizeMultiplier,x=.5/c.ptPerEm/y+"em",w=null;if(a){var k=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);(m instanceof O||k)&&(w=-m.italic+"em")}if(n&&a){u=Math.max(u,i,n.depth+.25*c.xHeight),p=Math.max(p,c.sub2);var S=4*c.defaultRuleThickness;if(u-n.depth-(a.height-p)0&&(u+=M,p-=M)}var z=[{type:"elem",elem:a,shift:p,marginRight:x,marginLeft:w},{type:"elem",elem:n,shift:-u,marginRight:x}];v=je.makeVList({positionType:"individualShift",children:z},t)}else if(a){p=Math.max(p,c.sub1,a.height-.8*c.xHeight);var A=[{type:"elem",elem:a,marginLeft:w,marginRight:x}];v=je.makeVList({positionType:"shift",positionData:p,children:A},t)}else{if(!n)throw new Error("supsub must have either sup or sub.");u=Math.max(u,i,n.depth+.25*c.xHeight),v=je.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:n,marginRight:x}]},t)}var T=gt(m,"right")||"mord";return je.makeSpan([T],[m,je.makeSpan(["msupsub"],[v])],t)},mathmlBuilder:function(e,t){var r,n=!1;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(n=!0,r=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var a,i=[Nt(e.base,t)];if(e.sub&&i.push(Nt(e.sub,t)),e.sup&&i.push(Nt(e.sup,t)),n)a=r?"mover":"munder";else if(e.sub)if(e.sup){var o=e.base;a=o&&"op"===o.type&&o.limits&&t.style===b.DISPLAY||o&&"operatorname"===o.type&&o.alwaysHandleSupSub&&(t.style===b.DISPLAY||o.limits)?"munderover":"msubsup"}else{var s=e.base;a=s&&"op"===s.type&&s.limits&&(t.style===b.DISPLAY||s.alwaysHandleSupSub)||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(s.limits||t.style===b.DISPLAY)?"munder":"msub"}else{var l=e.base;a=l&&"op"===l.type&&l.limits&&(t.style===b.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===b.DISPLAY)?"mover":"msup"}return new Mt.MathNode(a,i)}}),at({type:"atom",htmlBuilder:function(e,t){return je.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder:function(e,t){var r=new Mt.MathNode("mo",[zt(e.text,e.mode)]);if("bin"===e.family){var n=Tt(e,t);"bold-italic"===n&&r.setAttribute("mathvariant",n)}else"punct"===e.family?r.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||r.setAttribute("stretchy","false");return r}});var bn={mi:"italic",mn:"normal",mtext:"normal"};at({type:"mathord",htmlBuilder:function(e,t){return je.makeOrd(e,t,"mathord")},mathmlBuilder:function(e,t){var r=new Mt.MathNode("mi",[zt(e.text,e.mode,t)]),n=Tt(e,t)||"italic";return n!==bn[r.type]&&r.setAttribute("mathvariant",n),r}}),at({type:"textord",htmlBuilder:function(e,t){return je.makeOrd(e,t,"textord")},mathmlBuilder:function(e,t){var r,n=zt(e.text,e.mode,t),a=Tt(e,t)||"normal";return r="text"===e.mode?new Mt.MathNode("mtext",[n]):/[0-9]/.test(e.text)?new Mt.MathNode("mn",[n]):"\\prime"===e.text?new Mt.MathNode("mo",[n]):new Mt.MathNode("mi",[n]),a!==bn[r.type]&&r.setAttribute("mathvariant",a),r}});var yn={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},xn={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};at({type:"spacing",htmlBuilder:function(e,t){if(xn.hasOwnProperty(e.text)){var r=xn[e.text].className||"";if("text"===e.mode){var a=je.makeOrd(e,t,"textord");return a.classes.push(r),a}return je.makeSpan(["mspace",r],[je.mathsym(e.text,e.mode,t)],t)}if(yn.hasOwnProperty(e.text))return je.makeSpan(["mspace",yn[e.text]],[],t);throw new n('Unknown type of space "'+e.text+'"')},mathmlBuilder:function(e,t){if(!xn.hasOwnProperty(e.text)){if(yn.hasOwnProperty(e.text))return new Mt.MathNode("mspace");throw new n('Unknown type of space "'+e.text+'"')}return new Mt.MathNode("mtext",[new Mt.TextNode("\xa0")])}});var wn=function(){var e=new Mt.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};at({type:"tag",mathmlBuilder:function(e,t){var r=new Mt.MathNode("mtable",[new Mt.MathNode("mtr",[wn(),new Mt.MathNode("mtd",[qt(e.body,t)]),wn(),new Mt.MathNode("mtd",[qt(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});var kn={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Sn={"\\textbf":"textbf","\\textmd":"textmd"},Mn={"\\textit":"textit","\\textup":"textup"},zn=function(e,t){var r=e.font;return r?kn[r]?t.withTextFontFamily(kn[r]):Sn[r]?t.withTextFontWeight(Sn[r]):t.withTextFontShape(Mn[r]):t};nt({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"text",mode:r.mode,body:ot(a),font:n}},htmlBuilder:function(e,t){var r=zn(e,t),n=ut(e.body,r,!0);return je.makeSpan(["mord","text"],n,r)},mathmlBuilder:function(e,t){var r=zn(e,t);return qt(e.body,r)}}),nt({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){return{type:"underline",mode:e.parser.mode,body:t[0]}},htmlBuilder:function(e,t){var r=bt(e.body,t),n=je.makeLineSpan("underline-line",t),a=t.fontMetrics().defaultRuleThickness,i=je.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:a},{type:"elem",elem:n},{type:"kern",size:3*a},{type:"elem",elem:r}]},t);return je.makeSpan(["mord","underline"],[i],t)},mathmlBuilder:function(e,t){var r=new Mt.MathNode("mo",[new Mt.TextNode("\u203e")]);r.setAttribute("stretchy","true");var n=new Mt.MathNode("munder",[Nt(e.body,t),r]);return n.setAttribute("accentunder","true"),n}}),nt({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:function(e,t){return{type:"vcenter",mode:e.parser.mode,body:t[0]}},htmlBuilder:function(e,t){var r=bt(e.body,t),n=t.fontMetrics().axisHeight,a=.5*(r.height-n-(r.depth+n));return je.makeVList({positionType:"shift",positionData:a,children:[{type:"elem",elem:r}]},t)},mathmlBuilder:function(e,t){return new Mt.MathNode("mpadded",[Nt(e.body,t)],["vcenter"])}}),nt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler:function(e,t,r){throw new n("\\verb ended by end of line instead of matching delimiter")},htmlBuilder:function(e,t){for(var r=An(e),n=[],a=t.havingStyle(t.style.text()),i=0;i0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(e)&&(a[e]=this.current[e])}this.current[e]=t},e}(),Rn={},En=Rn;function Hn(e,t){Rn[e]=t}Hn("\\noexpand",(function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}})),Hn("\\expandafter",(function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}})),Hn("\\@firstoftwo",(function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}})),Hn("\\@secondoftwo",(function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}})),Hn("\\@ifnextchar",(function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return 1===t[0].length&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}})),Hn("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),Hn("\\TextOrMath",(function(e){var t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}}));var Ln={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Hn("\\char",(function(e){var t,r=e.popToken(),a="";if("'"===r.text)t=8,r=e.popToken();else if('"'===r.text)t=16,r=e.popToken();else if("`"===r.text)if("\\"===(r=e.popToken()).text[0])a=r.text.charCodeAt(1);else{if("EOF"===r.text)throw new n("\\char` missing argument");a=r.text.charCodeAt(0)}else t=10;if(t){if(null==(a=Ln[r.text])||a>=t)throw new n("Invalid base-"+t+" digit "+r.text);for(var i;null!=(i=Ln[e.future().text])&&i":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Hn("\\dots",(function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in Pn?t=Pn[r]:("\\not"===r.substr(0,4)||r in X.math&&l.contains(["bin","rel"],X.math[r].group))&&(t="\\dotsb"),t}));var Fn={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Hn("\\dotso",(function(e){return e.future().text in Fn?"\\ldots\\,":"\\ldots"})),Hn("\\dotsc",(function(e){var t=e.future().text;return t in Fn&&","!==t?"\\ldots\\,":"\\ldots"})),Hn("\\cdots",(function(e){return e.future().text in Fn?"\\@cdots\\,":"\\@cdots"})),Hn("\\dotsb","\\cdots"),Hn("\\dotsm","\\cdots"),Hn("\\dotsi","\\!\\cdots"),Hn("\\dotsx","\\ldots\\,"),Hn("\\DOTSI","\\relax"),Hn("\\DOTSB","\\relax"),Hn("\\DOTSX","\\relax"),Hn("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),Hn("\\,","\\tmspace+{3mu}{.1667em}"),Hn("\\thinspace","\\,"),Hn("\\>","\\mskip{4mu}"),Hn("\\:","\\tmspace+{4mu}{.2222em}"),Hn("\\medspace","\\:"),Hn("\\;","\\tmspace+{5mu}{.2777em}"),Hn("\\thickspace","\\;"),Hn("\\!","\\tmspace-{3mu}{.1667em}"),Hn("\\negthinspace","\\!"),Hn("\\negmedspace","\\tmspace-{4mu}{.2222em}"),Hn("\\negthickspace","\\tmspace-{5mu}{.277em}"),Hn("\\enspace","\\kern.5em "),Hn("\\enskip","\\hskip.5em\\relax"),Hn("\\quad","\\hskip1em\\relax"),Hn("\\qquad","\\hskip2em\\relax"),Hn("\\tag","\\@ifstar\\tag@literal\\tag@paren"),Hn("\\tag@paren","\\tag@literal{({#1})}"),Hn("\\tag@literal",(function(e){if(e.macros.get("\\df@tag"))throw new n("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"})),Hn("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),Hn("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),Hn("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),Hn("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),Hn("\\pmb","\\html@mathml{\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}{\\mathbf{#1}}"),Hn("\\newline","\\\\\\relax"),Hn("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Vn=D["Main-Regular"]["T".charCodeAt(0)][1]-.7*D["Main-Regular"]["A".charCodeAt(0)][1]+"em";Hn("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+Vn+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),Hn("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+Vn+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),Hn("\\hspace","\\@ifstar\\@hspacer\\@hspace"),Hn("\\@hspace","\\hskip #1\\relax"),Hn("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),Hn("\\ordinarycolon",":"),Hn("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),Hn("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),Hn("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),Hn("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),Hn("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),Hn("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),Hn("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),Hn("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),Hn("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),Hn("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),Hn("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),Hn("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),Hn("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),Hn("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),Hn("\u2237","\\dblcolon"),Hn("\u2239","\\eqcolon"),Hn("\u2254","\\coloneqq"),Hn("\u2255","\\eqqcolon"),Hn("\u2a74","\\Coloneqq"),Hn("\\ratio","\\vcentcolon"),Hn("\\coloncolon","\\dblcolon"),Hn("\\colonequals","\\coloneqq"),Hn("\\coloncolonequals","\\Coloneqq"),Hn("\\equalscolon","\\eqqcolon"),Hn("\\equalscoloncolon","\\Eqqcolon"),Hn("\\colonminus","\\coloneq"),Hn("\\coloncolonminus","\\Coloneq"),Hn("\\minuscolon","\\eqcolon"),Hn("\\minuscoloncolon","\\Eqcolon"),Hn("\\coloncolonapprox","\\Colonapprox"),Hn("\\coloncolonsim","\\Colonsim"),Hn("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Hn("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Hn("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Hn("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Hn("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220c}}"),Hn("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),Hn("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),Hn("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),Hn("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),Hn("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),Hn("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),Hn("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),Hn("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),Hn("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}"),Hn("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}"),Hn("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}"),Hn("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}"),Hn("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}"),Hn("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}"),Hn("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}"),Hn("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}"),Hn("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}"),Hn("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}"),Hn("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228a}"),Hn("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2acb}"),Hn("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228b}"),Hn("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2acc}"),Hn("\\imath","\\html@mathml{\\@imath}{\u0131}"),Hn("\\jmath","\\html@mathml{\\@jmath}{\u0237}"),Hn("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27e6}}"),Hn("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27e7}}"),Hn("\u27e6","\\llbracket"),Hn("\u27e7","\\rrbracket"),Hn("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}"),Hn("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}"),Hn("\u2983","\\lBrace"),Hn("\u2984","\\rBrace"),Hn("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29b5}}"),Hn("\u29b5","\\minuso"),Hn("\\darr","\\downarrow"),Hn("\\dArr","\\Downarrow"),Hn("\\Darr","\\Downarrow"),Hn("\\lang","\\langle"),Hn("\\rang","\\rangle"),Hn("\\uarr","\\uparrow"),Hn("\\uArr","\\Uparrow"),Hn("\\Uarr","\\Uparrow"),Hn("\\N","\\mathbb{N}"),Hn("\\R","\\mathbb{R}"),Hn("\\Z","\\mathbb{Z}"),Hn("\\alef","\\aleph"),Hn("\\alefsym","\\aleph"),Hn("\\Alpha","\\mathrm{A}"),Hn("\\Beta","\\mathrm{B}"),Hn("\\bull","\\bullet"),Hn("\\Chi","\\mathrm{X}"),Hn("\\clubs","\\clubsuit"),Hn("\\cnums","\\mathbb{C}"),Hn("\\Complex","\\mathbb{C}"),Hn("\\Dagger","\\ddagger"),Hn("\\diamonds","\\diamondsuit"),Hn("\\empty","\\emptyset"),Hn("\\Epsilon","\\mathrm{E}"),Hn("\\Eta","\\mathrm{H}"),Hn("\\exist","\\exists"),Hn("\\harr","\\leftrightarrow"),Hn("\\hArr","\\Leftrightarrow"),Hn("\\Harr","\\Leftrightarrow"),Hn("\\hearts","\\heartsuit"),Hn("\\image","\\Im"),Hn("\\infin","\\infty"),Hn("\\Iota","\\mathrm{I}"),Hn("\\isin","\\in"),Hn("\\Kappa","\\mathrm{K}"),Hn("\\larr","\\leftarrow"),Hn("\\lArr","\\Leftarrow"),Hn("\\Larr","\\Leftarrow"),Hn("\\lrarr","\\leftrightarrow"),Hn("\\lrArr","\\Leftrightarrow"),Hn("\\Lrarr","\\Leftrightarrow"),Hn("\\Mu","\\mathrm{M}"),Hn("\\natnums","\\mathbb{N}"),Hn("\\Nu","\\mathrm{N}"),Hn("\\Omicron","\\mathrm{O}"),Hn("\\plusmn","\\pm"),Hn("\\rarr","\\rightarrow"),Hn("\\rArr","\\Rightarrow"),Hn("\\Rarr","\\Rightarrow"),Hn("\\real","\\Re"),Hn("\\reals","\\mathbb{R}"),Hn("\\Reals","\\mathbb{R}"),Hn("\\Rho","\\mathrm{P}"),Hn("\\sdot","\\cdot"),Hn("\\sect","\\S"),Hn("\\spades","\\spadesuit"),Hn("\\sub","\\subset"),Hn("\\sube","\\subseteq"),Hn("\\supe","\\supseteq"),Hn("\\Tau","\\mathrm{T}"),Hn("\\thetasym","\\vartheta"),Hn("\\weierp","\\wp"),Hn("\\Zeta","\\mathrm{Z}"),Hn("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),Hn("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),Hn("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),Hn("\\bra","\\mathinner{\\langle{#1}|}"),Hn("\\ket","\\mathinner{|{#1}\\rangle}"),Hn("\\braket","\\mathinner{\\langle{#1}\\rangle}"),Hn("\\Bra","\\left\\langle#1\\right|"),Hn("\\Ket","\\left|#1\\right\\rangle"),Hn("\\angln","{\\angl n}"),Hn("\\blue","\\textcolor{##6495ed}{#1}"),Hn("\\orange","\\textcolor{##ffa500}{#1}"),Hn("\\pink","\\textcolor{##ff00af}{#1}"),Hn("\\red","\\textcolor{##df0030}{#1}"),Hn("\\green","\\textcolor{##28ae7b}{#1}"),Hn("\\gray","\\textcolor{gray}{#1}"),Hn("\\purple","\\textcolor{##9d38bd}{#1}"),Hn("\\blueA","\\textcolor{##ccfaff}{#1}"),Hn("\\blueB","\\textcolor{##80f6ff}{#1}"),Hn("\\blueC","\\textcolor{##63d9ea}{#1}"),Hn("\\blueD","\\textcolor{##11accd}{#1}"),Hn("\\blueE","\\textcolor{##0c7f99}{#1}"),Hn("\\tealA","\\textcolor{##94fff5}{#1}"),Hn("\\tealB","\\textcolor{##26edd5}{#1}"),Hn("\\tealC","\\textcolor{##01d1c1}{#1}"),Hn("\\tealD","\\textcolor{##01a995}{#1}"),Hn("\\tealE","\\textcolor{##208170}{#1}"),Hn("\\greenA","\\textcolor{##b6ffb0}{#1}"),Hn("\\greenB","\\textcolor{##8af281}{#1}"),Hn("\\greenC","\\textcolor{##74cf70}{#1}"),Hn("\\greenD","\\textcolor{##1fab54}{#1}"),Hn("\\greenE","\\textcolor{##0d923f}{#1}"),Hn("\\goldA","\\textcolor{##ffd0a9}{#1}"),Hn("\\goldB","\\textcolor{##ffbb71}{#1}"),Hn("\\goldC","\\textcolor{##ff9c39}{#1}"),Hn("\\goldD","\\textcolor{##e07d10}{#1}"),Hn("\\goldE","\\textcolor{##a75a05}{#1}"),Hn("\\redA","\\textcolor{##fca9a9}{#1}"),Hn("\\redB","\\textcolor{##ff8482}{#1}"),Hn("\\redC","\\textcolor{##f9685d}{#1}"),Hn("\\redD","\\textcolor{##e84d39}{#1}"),Hn("\\redE","\\textcolor{##bc2612}{#1}"),Hn("\\maroonA","\\textcolor{##ffbde0}{#1}"),Hn("\\maroonB","\\textcolor{##ff92c6}{#1}"),Hn("\\maroonC","\\textcolor{##ed5fa6}{#1}"),Hn("\\maroonD","\\textcolor{##ca337c}{#1}"),Hn("\\maroonE","\\textcolor{##9e034e}{#1}"),Hn("\\purpleA","\\textcolor{##ddd7ff}{#1}"),Hn("\\purpleB","\\textcolor{##c6b9fc}{#1}"),Hn("\\purpleC","\\textcolor{##aa87ff}{#1}"),Hn("\\purpleD","\\textcolor{##7854ab}{#1}"),Hn("\\purpleE","\\textcolor{##543b78}{#1}"),Hn("\\mintA","\\textcolor{##f5f9e8}{#1}"),Hn("\\mintB","\\textcolor{##edf2df}{#1}"),Hn("\\mintC","\\textcolor{##e0e5cc}{#1}"),Hn("\\grayA","\\textcolor{##f6f7f7}{#1}"),Hn("\\grayB","\\textcolor{##f0f1f2}{#1}"),Hn("\\grayC","\\textcolor{##e3e5e6}{#1}"),Hn("\\grayD","\\textcolor{##d6d8da}{#1}"),Hn("\\grayE","\\textcolor{##babec2}{#1}"),Hn("\\grayF","\\textcolor{##888d93}{#1}"),Hn("\\grayG","\\textcolor{##626569}{#1}"),Hn("\\grayH","\\textcolor{##3b3e40}{#1}"),Hn("\\grayI","\\textcolor{##21242c}{#1}"),Hn("\\kaBlue","\\textcolor{##314453}{#1}"),Hn("\\kaGreen","\\textcolor{##71B307}{#1}");var Gn={"\\relax":!0,"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},Un=function(){function e(e,t,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new On(En,t.macros),this.mode=r,this.stack=[]}var t=e.prototype;return t.feed=function(e){this.lexer=new In(e,this.settings)},t.switchMode=function(e){this.mode=e},t.beginGroup=function(){this.macros.beginGroup()},t.endGroup=function(){this.macros.endGroup()},t.future=function(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]},t.popToken=function(){return this.future(),this.stack.pop()},t.pushToken=function(e){this.stack.push(e)},t.pushTokens=function(e){var t;(t=this.stack).push.apply(t,e)},t.scanArgument=function(e){var t,r,n;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken();var a=this.consumeArg(["]"]);n=a.tokens,r=a.end}else{var i=this.consumeArg();n=i.tokens,t=i.start,r=i.end}return this.pushToken(new qn("EOF",r.loc)),this.pushTokens(n),t.range(r,"")},t.consumeSpaces=function(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}},t.consumeArg=function(e){var t=[],r=e&&e.length>0;r||this.consumeSpaces();var a,i=this.future(),o=0,s=0;do{if(a=this.popToken(),t.push(a),"{"===a.text)++o;else if("}"===a.text){if(-1===--o)throw new n("Extra }",a)}else if("EOF"===a.text)throw new n("Unexpected end of input in a macro argument, expected '"+(e&&r?e[s]:"}")+"'",a);if(e&&r)if((0===o||1===o&&"{"===e[s])&&a.text===e[s]){if(++s===e.length){t.splice(-s,s);break}}else s=0}while(0!==o||r);return"{"===i.text&&"}"===t[t.length-1].text&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:a}},t.consumeArgs=function(e,t){if(t){if(t.length!==e+1)throw new n("The length of delimiters doesn't match the number of args!");for(var r=t[0],a=0;athis.settings.maxExpand)throw new n("Too many expansions: infinite loop or need to increase maxExpand setting");var i=a.tokens,o=this.consumeArgs(a.numArgs,a.delimiters);if(a.numArgs)for(var s=(i=i.slice()).length-1;s>=0;--s){var l=i[s];if("#"===l.text){if(0===s)throw new n("Incomplete placeholder at end of macro body",l);if("#"===(l=i[--s]).text)i.splice(s+1,1);else{if(!/^[1-9]$/.test(l.text))throw new n("Not a valid argument number",l);var h;(h=i).splice.apply(h,[s,2].concat(o[+l.text-1]))}}}return this.pushTokens(i),i},t.expandAfterFuture=function(){return this.expandOnce(),this.future()},t.expandNextToken=function(){for(;;){var e=this.expandOnce();if(e instanceof qn){if("\\relax"!==e.text&&!e.treatAsRelax)return this.stack.pop();this.stack.pop()}}throw new Error},t.expandMacro=function(e){return this.macros.has(e)?this.expandTokens([new qn(e)]):void 0},t.expandTokens=function(e){var t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;){var n=this.expandOnce(!0);n instanceof qn&&(n.treatAsRelax&&(n.noexpand=!1,n.treatAsRelax=!1),t.push(this.stack.pop()))}return t},t.expandMacroAsText=function(e){var t=this.expandMacro(e);return t?t.map((function(e){return e.text})).join(""):t},t._getExpansion=function(e){var t=this.macros.get(e);if(null==t)return t;var r="function"==typeof t?t(this):t;if("string"==typeof r){var n=0;if(-1!==r.indexOf("#"))for(var a=r.replace(/##/g,"");-1!==a.indexOf("#"+(n+1));)++n;for(var i=new In(r,this.settings),o=[],s=i.lex();"EOF"!==s.text;)o.push(s),s=i.lex();return o.reverse(),{tokens:o,numArgs:n}}return r},t.isDefined=function(e){return this.macros.has(e)||Tn.hasOwnProperty(e)||X.math.hasOwnProperty(e)||X.text.hasOwnProperty(e)||Gn.hasOwnProperty(e)},t.isExpandable=function(e){var t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:Tn.hasOwnProperty(e)&&!Tn[e].primitive},e}(),Yn={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030c":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030a":{text:"\\r",math:"\\mathring"},"\u030b":{text:"\\H"}},Wn={"\xe1":"a\u0301","\xe0":"a\u0300","\xe4":"a\u0308","\u01df":"a\u0308\u0304","\xe3":"a\u0303","\u0101":"a\u0304","\u0103":"a\u0306","\u1eaf":"a\u0306\u0301","\u1eb1":"a\u0306\u0300","\u1eb5":"a\u0306\u0303","\u01ce":"a\u030c","\xe2":"a\u0302","\u1ea5":"a\u0302\u0301","\u1ea7":"a\u0302\u0300","\u1eab":"a\u0302\u0303","\u0227":"a\u0307","\u01e1":"a\u0307\u0304","\xe5":"a\u030a","\u01fb":"a\u030a\u0301","\u1e03":"b\u0307","\u0107":"c\u0301","\u010d":"c\u030c","\u0109":"c\u0302","\u010b":"c\u0307","\u010f":"d\u030c","\u1e0b":"d\u0307","\xe9":"e\u0301","\xe8":"e\u0300","\xeb":"e\u0308","\u1ebd":"e\u0303","\u0113":"e\u0304","\u1e17":"e\u0304\u0301","\u1e15":"e\u0304\u0300","\u0115":"e\u0306","\u011b":"e\u030c","\xea":"e\u0302","\u1ebf":"e\u0302\u0301","\u1ec1":"e\u0302\u0300","\u1ec5":"e\u0302\u0303","\u0117":"e\u0307","\u1e1f":"f\u0307","\u01f5":"g\u0301","\u1e21":"g\u0304","\u011f":"g\u0306","\u01e7":"g\u030c","\u011d":"g\u0302","\u0121":"g\u0307","\u1e27":"h\u0308","\u021f":"h\u030c","\u0125":"h\u0302","\u1e23":"h\u0307","\xed":"i\u0301","\xec":"i\u0300","\xef":"i\u0308","\u1e2f":"i\u0308\u0301","\u0129":"i\u0303","\u012b":"i\u0304","\u012d":"i\u0306","\u01d0":"i\u030c","\xee":"i\u0302","\u01f0":"j\u030c","\u0135":"j\u0302","\u1e31":"k\u0301","\u01e9":"k\u030c","\u013a":"l\u0301","\u013e":"l\u030c","\u1e3f":"m\u0301","\u1e41":"m\u0307","\u0144":"n\u0301","\u01f9":"n\u0300","\xf1":"n\u0303","\u0148":"n\u030c","\u1e45":"n\u0307","\xf3":"o\u0301","\xf2":"o\u0300","\xf6":"o\u0308","\u022b":"o\u0308\u0304","\xf5":"o\u0303","\u1e4d":"o\u0303\u0301","\u1e4f":"o\u0303\u0308","\u022d":"o\u0303\u0304","\u014d":"o\u0304","\u1e53":"o\u0304\u0301","\u1e51":"o\u0304\u0300","\u014f":"o\u0306","\u01d2":"o\u030c","\xf4":"o\u0302","\u1ed1":"o\u0302\u0301","\u1ed3":"o\u0302\u0300","\u1ed7":"o\u0302\u0303","\u022f":"o\u0307","\u0231":"o\u0307\u0304","\u0151":"o\u030b","\u1e55":"p\u0301","\u1e57":"p\u0307","\u0155":"r\u0301","\u0159":"r\u030c","\u1e59":"r\u0307","\u015b":"s\u0301","\u1e65":"s\u0301\u0307","\u0161":"s\u030c","\u1e67":"s\u030c\u0307","\u015d":"s\u0302","\u1e61":"s\u0307","\u1e97":"t\u0308","\u0165":"t\u030c","\u1e6b":"t\u0307","\xfa":"u\u0301","\xf9":"u\u0300","\xfc":"u\u0308","\u01d8":"u\u0308\u0301","\u01dc":"u\u0308\u0300","\u01d6":"u\u0308\u0304","\u01da":"u\u0308\u030c","\u0169":"u\u0303","\u1e79":"u\u0303\u0301","\u016b":"u\u0304","\u1e7b":"u\u0304\u0308","\u016d":"u\u0306","\u01d4":"u\u030c","\xfb":"u\u0302","\u016f":"u\u030a","\u0171":"u\u030b","\u1e7d":"v\u0303","\u1e83":"w\u0301","\u1e81":"w\u0300","\u1e85":"w\u0308","\u0175":"w\u0302","\u1e87":"w\u0307","\u1e98":"w\u030a","\u1e8d":"x\u0308","\u1e8b":"x\u0307","\xfd":"y\u0301","\u1ef3":"y\u0300","\xff":"y\u0308","\u1ef9":"y\u0303","\u0233":"y\u0304","\u0177":"y\u0302","\u1e8f":"y\u0307","\u1e99":"y\u030a","\u017a":"z\u0301","\u017e":"z\u030c","\u1e91":"z\u0302","\u017c":"z\u0307","\xc1":"A\u0301","\xc0":"A\u0300","\xc4":"A\u0308","\u01de":"A\u0308\u0304","\xc3":"A\u0303","\u0100":"A\u0304","\u0102":"A\u0306","\u1eae":"A\u0306\u0301","\u1eb0":"A\u0306\u0300","\u1eb4":"A\u0306\u0303","\u01cd":"A\u030c","\xc2":"A\u0302","\u1ea4":"A\u0302\u0301","\u1ea6":"A\u0302\u0300","\u1eaa":"A\u0302\u0303","\u0226":"A\u0307","\u01e0":"A\u0307\u0304","\xc5":"A\u030a","\u01fa":"A\u030a\u0301","\u1e02":"B\u0307","\u0106":"C\u0301","\u010c":"C\u030c","\u0108":"C\u0302","\u010a":"C\u0307","\u010e":"D\u030c","\u1e0a":"D\u0307","\xc9":"E\u0301","\xc8":"E\u0300","\xcb":"E\u0308","\u1ebc":"E\u0303","\u0112":"E\u0304","\u1e16":"E\u0304\u0301","\u1e14":"E\u0304\u0300","\u0114":"E\u0306","\u011a":"E\u030c","\xca":"E\u0302","\u1ebe":"E\u0302\u0301","\u1ec0":"E\u0302\u0300","\u1ec4":"E\u0302\u0303","\u0116":"E\u0307","\u1e1e":"F\u0307","\u01f4":"G\u0301","\u1e20":"G\u0304","\u011e":"G\u0306","\u01e6":"G\u030c","\u011c":"G\u0302","\u0120":"G\u0307","\u1e26":"H\u0308","\u021e":"H\u030c","\u0124":"H\u0302","\u1e22":"H\u0307","\xcd":"I\u0301","\xcc":"I\u0300","\xcf":"I\u0308","\u1e2e":"I\u0308\u0301","\u0128":"I\u0303","\u012a":"I\u0304","\u012c":"I\u0306","\u01cf":"I\u030c","\xce":"I\u0302","\u0130":"I\u0307","\u0134":"J\u0302","\u1e30":"K\u0301","\u01e8":"K\u030c","\u0139":"L\u0301","\u013d":"L\u030c","\u1e3e":"M\u0301","\u1e40":"M\u0307","\u0143":"N\u0301","\u01f8":"N\u0300","\xd1":"N\u0303","\u0147":"N\u030c","\u1e44":"N\u0307","\xd3":"O\u0301","\xd2":"O\u0300","\xd6":"O\u0308","\u022a":"O\u0308\u0304","\xd5":"O\u0303","\u1e4c":"O\u0303\u0301","\u1e4e":"O\u0303\u0308","\u022c":"O\u0303\u0304","\u014c":"O\u0304","\u1e52":"O\u0304\u0301","\u1e50":"O\u0304\u0300","\u014e":"O\u0306","\u01d1":"O\u030c","\xd4":"O\u0302","\u1ed0":"O\u0302\u0301","\u1ed2":"O\u0302\u0300","\u1ed6":"O\u0302\u0303","\u022e":"O\u0307","\u0230":"O\u0307\u0304","\u0150":"O\u030b","\u1e54":"P\u0301","\u1e56":"P\u0307","\u0154":"R\u0301","\u0158":"R\u030c","\u1e58":"R\u0307","\u015a":"S\u0301","\u1e64":"S\u0301\u0307","\u0160":"S\u030c","\u1e66":"S\u030c\u0307","\u015c":"S\u0302","\u1e60":"S\u0307","\u0164":"T\u030c","\u1e6a":"T\u0307","\xda":"U\u0301","\xd9":"U\u0300","\xdc":"U\u0308","\u01d7":"U\u0308\u0301","\u01db":"U\u0308\u0300","\u01d5":"U\u0308\u0304","\u01d9":"U\u0308\u030c","\u0168":"U\u0303","\u1e78":"U\u0303\u0301","\u016a":"U\u0304","\u1e7a":"U\u0304\u0308","\u016c":"U\u0306","\u01d3":"U\u030c","\xdb":"U\u0302","\u016e":"U\u030a","\u0170":"U\u030b","\u1e7c":"V\u0303","\u1e82":"W\u0301","\u1e80":"W\u0300","\u1e84":"W\u0308","\u0174":"W\u0302","\u1e86":"W\u0307","\u1e8c":"X\u0308","\u1e8a":"X\u0307","\xdd":"Y\u0301","\u1ef2":"Y\u0300","\u0178":"Y\u0308","\u1ef8":"Y\u0303","\u0232":"Y\u0304","\u0176":"Y\u0302","\u1e8e":"Y\u0307","\u0179":"Z\u0301","\u017d":"Z\u030c","\u1e90":"Z\u0302","\u017b":"Z\u0307","\u03ac":"\u03b1\u0301","\u1f70":"\u03b1\u0300","\u1fb1":"\u03b1\u0304","\u1fb0":"\u03b1\u0306","\u03ad":"\u03b5\u0301","\u1f72":"\u03b5\u0300","\u03ae":"\u03b7\u0301","\u1f74":"\u03b7\u0300","\u03af":"\u03b9\u0301","\u1f76":"\u03b9\u0300","\u03ca":"\u03b9\u0308","\u0390":"\u03b9\u0308\u0301","\u1fd2":"\u03b9\u0308\u0300","\u1fd1":"\u03b9\u0304","\u1fd0":"\u03b9\u0306","\u03cc":"\u03bf\u0301","\u1f78":"\u03bf\u0300","\u03cd":"\u03c5\u0301","\u1f7a":"\u03c5\u0300","\u03cb":"\u03c5\u0308","\u03b0":"\u03c5\u0308\u0301","\u1fe2":"\u03c5\u0308\u0300","\u1fe1":"\u03c5\u0304","\u1fe0":"\u03c5\u0306","\u03ce":"\u03c9\u0301","\u1f7c":"\u03c9\u0300","\u038e":"\u03a5\u0301","\u1fea":"\u03a5\u0300","\u03ab":"\u03a5\u0308","\u1fe9":"\u03a5\u0304","\u1fe8":"\u03a5\u0306","\u038f":"\u03a9\u0301","\u1ffa":"\u03a9\u0300"},Xn=function(){function e(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Un(e,t,this.mode),this.settings=t,this.leftrightDepth=0}var t=e.prototype;return t.expect=function(e,t){if(void 0===t&&(t=!0),this.fetch().text!==e)throw new n("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()},t.consume=function(){this.nextToken=null},t.fetch=function(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken},t.switchMode=function(e){this.mode=e,this.gullet.switchMode(e)},t.parse=function(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e},t.parseExpression=function(t,r){for(var n=[];;){"math"===this.mode&&this.consumeSpaces();var a=this.fetch();if(-1!==e.endOfExpression.indexOf(a.text))break;if(r&&a.text===r)break;if(t&&Tn[a.text]&&Tn[a.text].infix)break;var i=this.parseAtom(r);if(!i)break;"internal"!==i.type&&n.push(i)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)},t.handleInfixNodes=function(e){for(var t,r=-1,a=0;a=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var s,l=X[this.mode][t].group,h=Bn.range(e);if(U.hasOwnProperty(l)){var m=l;s={type:"atom",mode:this.mode,family:m,loc:h,text:t}}else s={type:l,mode:this.mode,loc:h,text:t};i=s}else{if(!(t.charCodeAt(0)>=128))return null;this.settings.strict&&(w(t.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'" ('+t.charCodeAt(0)+")",e)),i={type:"textord",mode:"text",loc:Bn.range(e),text:t}}if(this.consume(),o)for(var c=0;c 15) { left = "…" + input.slice(start - 15, start); @@ -124,7 +122,7 @@ class ParseError { left = input.slice(0, start); } - let right; + var right; if (end + 15 < input.length) { right = input.slice(end, end + 15) + "…"; @@ -137,7 +135,7 @@ class ParseError { // See http://stackoverflow.com/a/8460753 - const self = new Error(error); + var self = new Error(error); self.name = "ParseError"; // $FlowFixMe self.__proto__ = ParseError.prototype; // $FlowFixMe @@ -159,7 +157,7 @@ ParseError.prototype.__proto__ = Error.prototype; /** * Return whether an element is contained in a list */ -const contains = function contains(list, elem) { +var contains = function contains(list, elem) { return list.indexOf(elem) !== -1; }; /** @@ -168,25 +166,25 @@ const contains = function contains(list, elem) { */ -const deflt = function deflt(setting, defaultIfUndefined) { +var deflt = function deflt(setting, defaultIfUndefined) { return setting === undefined ? defaultIfUndefined : setting; }; // hyphenate and escape adapted from Facebook's React under Apache 2 license -const uppercase = /([A-Z])/g; +var uppercase = /([A-Z])/g; -const hyphenate = function hyphenate(str) { +var hyphenate = function hyphenate(str) { return str.replace(uppercase, "-$1").toLowerCase(); }; -const ESCAPE_LOOKUP = { +var ESCAPE_LOOKUP = { "&": "&", ">": ">", "<": "<", "\"": """, "'": "'" }; -const ESCAPE_REGEX = /[&><"']/g; +var ESCAPE_REGEX = /[&><"']/g; /** * Escapes text to prevent scripting attacks. */ @@ -201,7 +199,7 @@ function escape(text) { */ -const getBaseElem = function getBaseElem(group) { +var getBaseElem = function getBaseElem(group) { if (group.type === "ordgroup") { if (group.body.length === 1) { return getBaseElem(group.body[0]); @@ -227,13 +225,13 @@ const getBaseElem = function getBaseElem(group) { */ -const isCharacterBox = function isCharacterBox(group) { - const baseElem = getBaseElem(group); // These are all they types of groups which hold single characters +var isCharacterBox = function isCharacterBox(group) { + var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom"; }; -const assert = function assert(value) { +var assert = function assert(value) { if (!value) { throw new Error('Expected non-null, but got ' + String(value)); } @@ -245,8 +243,8 @@ const assert = function assert(value) { * protocol (and thus is relative). */ -const protocolFromUrl = function protocolFromUrl(url) { - const protocol = /^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(url); +var protocolFromUrl = function protocolFromUrl(url) { + var protocol = /^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(url); return protocol != null ? protocol[1] : "_relative"; }; var utils = { @@ -311,7 +309,7 @@ class Settings { reportNonstrict(errorCode, errorMsg, token) { - let strict = this.strict; + var strict = this.strict; if (typeof strict === "function") { // Allow return value of strict function to be boolean or string @@ -322,12 +320,12 @@ class Settings { if (!strict || strict === "ignore") { return; } else if (strict === true || strict === "error") { - throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + `${errorMsg} [${errorCode}]`, token); + throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token); } else if (strict === "warn") { - typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + `${errorMsg} [${errorCode}]`); + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]")); } else { // won't happen in type-safe code - typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + `unrecognized '${strict}': ${errorMsg} [${errorCode}]`); + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]")); } } /** @@ -341,7 +339,7 @@ class Settings { useStrictBehavior(errorCode, errorMsg, token) { - let strict = this.strict; + var strict = this.strict; if (typeof strict === "function") { // Allow return value of strict function to be boolean or string @@ -360,11 +358,11 @@ class Settings { } else if (strict === true || strict === "error") { return true; } else if (strict === "warn") { - typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + `${errorMsg} [${errorCode}]`); + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]")); return false; } else { // won't happen in type-safe code - typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + `unrecognized '${strict}': ${errorMsg} [${errorCode}]`); + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]")); return false; } } @@ -383,7 +381,7 @@ class Settings { context.protocol = utils.protocolFromUrl(context.url); } - const trust = typeof this.trust === "function" ? this.trust(context) : this.trust; + var trust = typeof this.trust === "function" ? this.trust(context) : this.trust; return Boolean(trust); } @@ -475,23 +473,23 @@ class Style { // IDs of the different styles -const D = 0; -const Dc = 1; -const T = 2; -const Tc = 3; -const S = 4; -const Sc = 5; -const SS = 6; -const SSc = 7; // Instances of the different styles +var D = 0; +var Dc = 1; +var T = 2; +var Tc = 3; +var S = 4; +var Sc = 5; +var SS = 6; +var SSc = 7; // Instances of the different styles -const 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)]; // Lookup tables for switching from one style to another +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)]; // Lookup tables for switching from one style to another -const sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; -const sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; -const fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; -const fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; -const cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; -const text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles. +var sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; +var sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; +var fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; +var fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; +var cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; +var text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles. var Style$1 = { DISPLAY: styles[D], @@ -517,18 +515,23 @@ var Style$1 = { * Unicode block data for the families of scripts we support in \text{}. * Scripts only need to appear here if they do not have font metrics. */ -const scriptData = [{ +var scriptData = [{ // Latin characters beyond the Latin-1 characters we have metrics for. // Needed for Czech, Hungarian and Turkish text, for example. name: 'latin', blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B - [0x0300, 0x036f]] + [0x0300, 0x036f] // Combining Diacritical marks + ] }, { // The Cyrillic script used by Russian and related languages. // A Cyrillic subset used to be supported as explicitly defined // symbols in symbols.js name: 'cyrillic', blocks: [[0x0400, 0x04ff]] +}, { + // Armenian + name: 'armenian', + blocks: [[0x0530, 0x058F]] }, { // The Brahmic scripts of South and Southeast Asia // Devanagari (0900–097F) @@ -556,7 +559,9 @@ const scriptData = [{ name: "cjk", blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana [0x4E00, 0x9FAF], // CJK ideograms - [0xFF00, 0xFF60]] + [0xFF00, 0xFF60] // Fullwidth punctuation + // TODO: add halfwidth Katakana and Romanji glyphs + ] }, { // Korean name: 'hangul', @@ -568,11 +573,11 @@ const scriptData = [{ */ function scriptFromCodepoint(codepoint) { - for (let i = 0; i < scriptData.length; i++) { - const script = scriptData[i]; + for (var i = 0; i < scriptData.length; i++) { + var script = scriptData[i]; - for (let i = 0; i < script.blocks.length; i++) { - const block = script.blocks[i]; + for (var _i = 0; _i < script.blocks.length; _i++) { + var block = script.blocks[_i]; if (codepoint >= block[0] && codepoint <= block[1]) { return script.name; @@ -587,7 +592,7 @@ function scriptFromCodepoint(codepoint) { * This is an optimization to make supportedCodepoint() fast. */ -const allBlocks = []; +var allBlocks = []; scriptData.forEach(s => s.blocks.forEach(b => allBlocks.push(...b))); /** * Given a codepoint, return true if it falls within one of the @@ -599,7 +604,7 @@ scriptData.forEach(s => s.blocks.forEach(b => allBlocks.push(...b))); */ function supportedCodepoint(codepoint) { - for (let i = 0; i < allBlocks.length; i += 2) { + for (var i = 0; i < allBlocks.length; i += 2) { if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) { return true; } @@ -613,7 +618,7 @@ function supportedCodepoint(codepoint) { * It's a storehouse of path geometry for SVG images. */ // In all paths below, the viewBox-to-em scale is 1000:1. -const hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping. +var hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping. // The viniculum of a \sqrt can be made thicker by a KaTeX rendering option. // Think of variable extraViniculum as two detours in the SVG path. // The detour begins at the lower left of the area labeled extraViniculum below. @@ -633,95 +638,50 @@ const hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping. / / surd */ -const sqrtMain = function sqrtMain(extraViniculum, hLinePad) { +var sqrtMain = function sqrtMain(extraViniculum, hLinePad) { // sqrtMain path geometry is from glyph U221A in the font KaTeX Main - return `M95,${622 + extraViniculum + hLinePad} -c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 -c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 -c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 -s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 -c69,-144,104.5,-217.7,106.5,-221 -l${extraViniculum / 2.075} -${extraViniculum} -c5.3,-9.3,12,-14,20,-14 -H400000v${40 + extraViniculum}H845.2724 -s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 -c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z -M${834 + extraViniculum} ${hLinePad}h400000v${40 + extraViniculum}h-400000z`; + return "M95," + (622 + extraViniculum + hLinePad) + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + extraViniculum / 2.075 + " -" + extraViniculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraViniculum) + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + (834 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z"; }; -const sqrtSize1 = function sqrtSize1(extraViniculum, hLinePad) { +var sqrtSize1 = function sqrtSize1(extraViniculum, hLinePad) { // size1 is from glyph U221A in the font KaTeX_Size1-Regular - return `M263,${601 + extraViniculum + hLinePad}c0.7,0,18,39.7,52,119 -c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 -c340,-704.7,510.7,-1060.3,512,-1067 -l${extraViniculum / 2.084} -${extraViniculum} -c4.7,-7.3,11,-11,19,-11 -H40000v${40 + extraViniculum}H1012.3 -s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 -c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 -s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 -c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z -M${1001 + extraViniculum} ${hLinePad}h400000v${40 + extraViniculum}h-400000z`; + return "M263," + (601 + extraViniculum + hLinePad) + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + extraViniculum / 2.084 + " -" + extraViniculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraViniculum) + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z"; }; -const sqrtSize2 = function sqrtSize2(extraViniculum, hLinePad) { +var sqrtSize2 = function sqrtSize2(extraViniculum, hLinePad) { // size2 is from glyph U221A in the font KaTeX_Size2-Regular - return `M983 ${10 + extraViniculum + hLinePad} -l${extraViniculum / 3.13} -${extraViniculum} -c4,-6.7,10,-10,18,-10 H400000v${40 + extraViniculum} -H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 -s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 -c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 -c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 -c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 -c53.7,-170.3,84.5,-266.8,92.5,-289.5z -M${1001 + extraViniculum} ${hLinePad}h400000v${40 + extraViniculum}h-400000z`; + return "M983 " + (10 + extraViniculum + hLinePad) + "\nl" + extraViniculum / 3.13 + " -" + extraViniculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraViniculum) + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z"; }; -const sqrtSize3 = function sqrtSize3(extraViniculum, hLinePad) { +var sqrtSize3 = function sqrtSize3(extraViniculum, hLinePad) { // size3 is from glyph U221A in the font KaTeX_Size3-Regular - return `M424,${2398 + extraViniculum + hLinePad} -c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 -c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 -s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 -s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 -l${extraViniculum / 4.223} -${extraViniculum}c4,-6.7,10,-10,18,-10 H400000 -v${40 + extraViniculum}H1014.6 -s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 -c-2,6,-10,9,-24,9 -c-8,0,-12,-0.7,-12,-2z M${1001 + extraViniculum} ${hLinePad} -h400000v${40 + extraViniculum}h-400000z`; + return "M424," + (2398 + extraViniculum + hLinePad) + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + extraViniculum / 4.223 + " -" + extraViniculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraViniculum) + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + (1001 + extraViniculum) + " " + hLinePad + "\nh400000v" + (40 + extraViniculum) + "h-400000z"; }; -const sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) { +var sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) { // size4 is from glyph U221A in the font KaTeX_Size4-Regular - return `M473,${2713 + extraViniculum + hLinePad} -c339.3,-1799.3,509.3,-2700,510,-2702 l${extraViniculum / 5.298} -${extraViniculum} -c3.3,-7.3,9.3,-11,18,-11 H400000v${40 + extraViniculum}H1017.7 -s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 -c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 -c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 -s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, -606zM${1001 + extraViniculum} ${hLinePad}h400000v${40 + extraViniculum}H1017.7z`; + return "M473," + (2713 + extraViniculum + hLinePad) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraViniculum / 5.298 + " -" + extraViniculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraViniculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "H1017.7z"; }; -const sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) { +var phasePath = function phasePath(y) { + var x = y / 2; // x coordinate at top of angle + + return "M400000 " + y + " H0 L" + x + " 0 l65 45 L145 " + (y - 80) + " H400000z"; +}; + +var sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) { // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular // One path edge has a variable length. It runs vertically from the viniculumn // to a point near (14 units) the bottom of the surd. The viniculum // is normally 40 units thick. So the length of the line in question is: - const vertSegment = viewBoxHeight - 54 - hLinePad - extraViniculum; - return `M702 ${extraViniculum + hLinePad}H400000${40 + extraViniculum} -H742v${vertSegment}l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 -h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 -c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 ${hLinePad}H400000v${40 + extraViniculum}H742z`; + var vertSegment = viewBoxHeight - 54 - hLinePad - extraViniculum; + return "M702 " + (extraViniculum + hLinePad) + "H400000" + (40 + extraViniculum) + "\nH742v" + vertSegment + "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + hLinePad + "H400000v" + (40 + extraViniculum) + "H742z"; }; -const sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) { +var sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) { extraViniculum = 1000 * extraViniculum; // Convert from document ems to viewBox. - let path = ""; + var path = ""; switch (size) { case "sqrtMain": @@ -750,261 +710,117 @@ const sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) { return path; }; -const path = { - // Two paths that cover gaps in built-up parentheses. - leftParenInner: `M291 0 H417 V300 H291 z`, - rightParenInner: `M457 0 H583 V300 H457 z`, +var innerPath = function innerPath(name, height) { + // The inner part of stretchy tall delimiters + switch (name) { + case "\u239c": + return "M291 0 H417 V" + height + " H291z M291 0 H417 V" + height + " H291z"; + + case "\u2223": + return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z"; + + case "\u2225": + return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z" + ("M367 0 H410 V" + height + " H367z M367 0 H410 V" + height + " H367z"); + + case "\u239f": + return "M457 0 H583 V" + height + " H457z M457 0 H583 V" + height + " H457z"; + + case "\u23a2": + return "M319 0 H403 V" + height + " H319z M319 0 H403 V" + height + " H319z"; + + case "\u23a5": + return "M263 0 H347 V" + height + " H263z M263 0 H347 V" + height + " H263z"; + + case "\u23aa": + return "M384 0 H504 V" + height + " H384z M384 0 H504 V" + height + " H384z"; + + case "\u23d0": + return "M312 0 H355 V" + height + " H312z M312 0 H355 V" + height + " H312z"; + + case "\u2016": + return "M257 0 H300 V" + height + " H257z M257 0 H300 V" + height + " H257z" + ("M478 0 H521 V" + height + " H478z M478 0 H521 V" + height + " H478z"); + + default: + return ""; + } +}; +var path = { // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main - doubleleftarrow: `M262 157 -l10-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 - 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 - 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 -c2 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 - 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 --86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 --2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z -m8 0v40h399730v-40zm0 194v40h399730v-40z`, + 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", // doublerightarrow is from glyph U+21D2 in font KaTeX Main - doublerightarrow: `M399738 392l --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 - 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 --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 --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 --13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 -c-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 --107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`, + 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", // leftarrow is from glyph U+2190 in font KaTeX Main - leftarrow: `M400000 241H110l3-3c68.7-52.7 113.7-120 - 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 --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 -c-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 - 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 - 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 - l-3-3h399890zM100 241v40h399900v-40z`, + 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", // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular - leftbrace: `M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 --45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 - 5-6 9-10 13-.7 1-7.3 1-20 1H6z`, - leftbraceunder: `M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 - 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 - 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 --331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`, + 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", + 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", // overgroup is from the MnSymbol package (public domain) - leftgroup: `M400000 80 -H435C64 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 - 435 0h399565z`, - leftgroupunder: `M400000 262 -H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 - 435 219h399565z`, + 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", + 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", // Harpoons are from glyph U+21BD in font KaTeX Main - leftharpoon: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 --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 --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 --196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`, - leftharpoonplus: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-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-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-196 228-6.7 4.7 --10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z -m0 0v40h400000v-40z`, - leftharpoondown: `M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 - 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 - 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 --152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`, - leftharpoondownplus: `M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 - 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 --2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 -v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`, + 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", + 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", + 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", + 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", // hook is from glyph U+21A9 in font KaTeX Main - lefthook: `M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 --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 --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 - 71.5 23h399859zM103 281v-40h399897v40z`, - leftlinesegment: `M40 281 V428 H0 V94 H40 V241 H400000 v40z -M40 281 V428 H0 V94 H40 V241 H400000 v40z`, - leftmapsto: `M40 281 V448H0V74H40V241H400000v40z -M40 281 V448H0V74H40V241H400000v40z`, + 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", + leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z", + leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z", // tofrom is from glyph U+21C4 in font KaTeX AMS Regular - leftToFrom: `M0 147h400000v40H0zm0 214c68 40 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-70-101l-7-8h399905v-40H95l7-8 -c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 - 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`, - longequal: `M0 50 h400000 v40H0z m0 194h40000v40H0z -M0 50 h400000 v40H0z m0 194h40000v40H0z`, - midbrace: `M200428 334 -c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 --53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 - 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 - 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`, - midbraceunder: `M199572 214 -c100.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 - 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 - 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 --5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`, - oiintSize1: `M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 --320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z -m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 -60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`, - oiintSize2: `M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 --451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z -m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 -c0 110 84 276 504 276s502.4-166 502.4-276z`, - oiiintSize1: `M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 --480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z -m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 -85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`, - oiiintSize2: `M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 --707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z -m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 -c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`, - rightarrow: `M0 241v40h399891c-47.3 35.3-84 78-110 128 --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 - 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 - 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 --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 --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 - 151.7 139 205zm0 0v40h399900v-40z`, - rightbrace: `M400000 542l --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 -s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 -c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`, - rightbraceunder: `M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 - 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 --174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`, - rightgroup: `M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 - 3-1 3-3v-38c-76-158-257-219-435-219H0z`, - rightgroupunder: `M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 - 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`, - rightharpoon: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 --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 --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 - 69.2 92 94.5zm0 0v40h399900v-40z`, - rightharpoonplus: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-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-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 69.2 92 94.5z -m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`, - rightharpoondown: `M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 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 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-64.7 57-92 95 --27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`, - rightharpoondownplus: `M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 - 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 - 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 --64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z -m0-194v40h400000v-40zm0 0v40h400000v-40z`, - righthook: `M399859 241c-764 0 0 0 0 0 40-3.3 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-71.5-23-17.3-1.3-26-8-26-20 0 --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 - 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`, - rightlinesegment: `M399960 241 V94 h40 V428 h-40 V281 H0 v-40z -M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`, - rightToFrom: `M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 - 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 --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 --167z M100 147v40h399900v-40zM0 341v40h399900v-40z`, + 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", + longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z", + 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", + 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", + oiintSize1: "M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z", + oiintSize2: "M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z", + oiiintSize1: "M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z", + oiiintSize2: "M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z", + 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", + 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", + 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", + 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", + 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", + 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", + 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", + 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", + 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", + 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", + rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z", + 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", // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular - twoheadleftarrow: `M0 167c68 40 - 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 --70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 --40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 --37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 - 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`, - twoheadrightarrow: `M400000 167 -c-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 - 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 - 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 --19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 - 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`, + 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", + 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", // tilde1 is a modified version of a glyph from the MnSymbol package - tilde1: `M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 --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 - 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 - 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 --68.267.847-113-73.952-191-73.952z`, + 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", // ditto tilde2, tilde3, & tilde4 - tilde2: `M344 55.266c-142 0-300.638 81.316-311.5 86.418 --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 - 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 -c1 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 - 181.476 676 181.476c-149 0-189-126.21-332-126.21z`, - tilde3: `M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 --11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 - 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 - 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 - -338 0-409-156.573-744-156.573z`, - tilde4: `M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 --11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 - 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 - 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 - -175.236-744-175.236z`, + 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", + 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", + 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", // vec is from glyph U+20D7 in font KaTeX Main - vec: `M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 -3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 -10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 --1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 --7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 -H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 -c-16-25.333-24-45-24-59z`, + vec: "M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z", // widehat1 is a modified version of a glyph from the MnSymbol package - widehat1: `M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 -c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`, + 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", // ditto widehat2, widehat3, & widehat4 - widehat2: `M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, - widehat3: `M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, - widehat4: `M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, + 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", + 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", + 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", // widecheck paths are all inverted versions of widehat - widecheck1: `M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, --5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`, - widecheck2: `M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, - widecheck3: `M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, - widecheck4: `M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, + widecheck1: "M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z", + widecheck2: "M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", + widecheck3: "M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", + widecheck4: "M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", // The next ten paths support reaction arrows from the mhchem package. // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main - baraboveleftarrow: `M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 -c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 -c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 -s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 -121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 -s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 -c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z -M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`, + baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z", // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main - rightarrowabovebar: `M0 241v40h399891c-47.3 35.3-84 78-110 128-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 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 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-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 --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 -151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`, + rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z", // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end. // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em - baraboveshortleftharpoon: `M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 -c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 -c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 -c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 -c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z -M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`, - rightharpoonaboveshortbar: `M0,241 l0,40c399126,0,399993,0,399993,0 -c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, --231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 -c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`, - shortbaraboveleftharpoon: `M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 -c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, -1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, --152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z -M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`, - shortrightharpoonabovebar: `M53,241l0,40c398570,0,399437,0,399437,0 -c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, --231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 -c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z` + baraboveshortleftharpoon: "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z", + rightharpoonaboveshortbar: "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z", + shortbaraboveleftharpoon: "M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z", + shortrightharpoonabovebar: "M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z" }; /** @@ -1037,9 +853,9 @@ class DocumentFragment { toNode() { - const frag = document.createDocumentFragment(); + var frag = document.createDocumentFragment(); - for (let i = 0; i < this.children.length; i++) { + for (var i = 0; i < this.children.length; i++) { frag.appendChild(this.children[i].toNode()); } @@ -1049,9 +865,9 @@ class DocumentFragment { toMarkup() { - let markup = ""; // Simply concatenate the markup for the children together. + var markup = ""; // Simply concatenate the markup for the children together. - for (let i = 0; i < this.children.length; i++) { + for (var i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } @@ -1067,7 +883,7 @@ class DocumentFragment { // To avoid this, we would subclass documentFragment separately for // MathML, but polyfills for subclassing is expensive per PR 1469. // $FlowFixMe: Only works for ChildType = MathDomNode. - const toText = child => child.toText(); + var toText = child => child.toText(); return this.children.map(toText).join(""); } @@ -1091,11 +907,11 @@ class DocumentFragment { * Create an HTML className based on a list of classes. In addition to joining * with spaces, we also remove empty classes. */ -const createClass = function createClass(classes) { +var createClass = function createClass(classes) { return classes.filter(cls => cls).join(" "); }; -const initNode = function initNode(classes, options, style) { +var initNode = function initNode(classes, options, style) { this.classes = classes || []; this.attributes = {}; this.height = 0; @@ -1108,7 +924,7 @@ const initNode = function initNode(classes, options, style) { this.classes.push("mtight"); } - const color = options.getColor(); + var color = options.getColor(); if (color) { this.style.color = color; @@ -1120,12 +936,12 @@ const initNode = function initNode(classes, options, style) { */ -const toNode = function toNode(tagName) { - const node = document.createElement(tagName); // Apply the class +var toNode = function toNode(tagName) { + var node = document.createElement(tagName); // Apply the class node.className = createClass(this.classes); // Apply inline styles - for (const style in this.style) { + for (var style in this.style) { if (this.style.hasOwnProperty(style)) { // $FlowFixMe Flow doesn't seem to understand span.style's type. node.style[style] = this.style[style]; @@ -1133,14 +949,14 @@ const toNode = function toNode(tagName) { } // Apply attributes - for (const attr in this.attributes) { + for (var attr in this.attributes) { if (this.attributes.hasOwnProperty(attr)) { node.setAttribute(attr, this.attributes[attr]); } } // Append the children, also as HTML nodes - for (let i = 0; i < this.children.length; i++) { + for (var i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } @@ -1151,39 +967,39 @@ const toNode = function toNode(tagName) { */ -const toMarkup = function toMarkup(tagName) { - let markup = `<${tagName}`; // Add the class +var toMarkup = function toMarkup(tagName) { + var markup = "<" + tagName; // Add the class if (this.classes.length) { - markup += ` class="${utils.escape(createClass(this.classes))}"`; + markup += " class=\"" + utils.escape(createClass(this.classes)) + "\""; } - let styles = ""; // Add the styles, after hyphenation + var styles = ""; // Add the styles, after hyphenation - for (const style in this.style) { + for (var style in this.style) { if (this.style.hasOwnProperty(style)) { - styles += `${utils.hyphenate(style)}:${this.style[style]};`; + styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; } } if (styles) { - markup += ` style="${utils.escape(styles)}"`; + markup += " style=\"" + utils.escape(styles) + "\""; } // Add the attributes - for (const attr in this.attributes) { + for (var attr in this.attributes) { if (this.attributes.hasOwnProperty(attr)) { - markup += ` ${attr}="${utils.escape(this.attributes[attr])}"`; + markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\""; } } markup += ">"; // Add the markup of the children, also as markup - for (let i = 0; i < this.children.length; i++) { + for (var i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } - markup += ``; + markup += ""; return markup; }; // Making the type below exact with all optional fields doesn't work due to // - https://github.com/facebook/flow/issues/4582 @@ -1300,12 +1116,12 @@ class Img { } toNode() { - const node = document.createElement("img"); + var node = document.createElement("img"); node.src = this.src; node.alt = this.alt; node.className = "mord"; // Apply inline styles - for (const style in this.style) { + for (var style in this.style) { if (this.style.hasOwnProperty(style)) { // $FlowFixMe node.style[style] = this.style[style]; @@ -1316,18 +1132,18 @@ class Img { } toMarkup() { - let markup = `${this.alt} 0) { span = document.createElement("span"); @@ -1410,7 +1226,7 @@ class SymbolNode { span.className = createClass(this.classes); } - for (const style in this.style) { + for (var style in this.style) { if (this.style.hasOwnProperty(style)) { span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type. @@ -1433,8 +1249,8 @@ class SymbolNode { toMarkup() { // TODO(alpert): More duplication than I'd like from // span.prototype.toMarkup and symbolNode.prototype.toNode... - let needsSpan = false; - let markup = " 0) { styles += "margin-right:" + this.italic + "em;"; } - for (const style in this.style) { + for (var style in this.style) { if (this.style.hasOwnProperty(style)) { styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; } @@ -1460,7 +1276,7 @@ class SymbolNode { markup += " style=\"" + utils.escape(styles) + "\""; } - const escaped = utils.escape(this.text); + var escaped = utils.escape(this.text); if (needsSpan) { markup += ">"; @@ -1486,16 +1302,16 @@ class SvgNode { } toNode() { - const svgNS = "http://www.w3.org/2000/svg"; - const node = document.createElementNS(svgNS, "svg"); // Apply attributes + var svgNS = "http://www.w3.org/2000/svg"; + var node = document.createElementNS(svgNS, "svg"); // Apply attributes - for (const attr in this.attributes) { + for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } - for (let i = 0; i < this.children.length; i++) { + for (var i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } @@ -1503,17 +1319,17 @@ class SvgNode { } toMarkup() { - let markup = "`; + return ""; } else { - return ``; + return ""; } } @@ -1559,10 +1375,10 @@ class LineNode { } toNode() { - const svgNS = "http://www.w3.org/2000/svg"; - const node = document.createElementNS(svgNS, "line"); // Apply attributes + var svgNS = "http://www.w3.org/2000/svg"; + var node = document.createElementNS(svgNS, "line"); // Apply attributes - for (const attr in this.attributes) { + for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } @@ -1572,11 +1388,11 @@ class LineNode { } toMarkup() { - let markup = " but got ${String(group)}.`); + throw new Error("Expected span but got " + String(group) + "."); } } // This file is GENERATED by buildMetrics.sh. DO NOT MODIFY. -var metricMap = { +var fontMetricsData = { "AMS-Regular": { "32": [0, 0, 0, 0, 0.25], "65": [0, 0.68889, 0, 0, 0.72222], @@ -3706,7 +3522,7 @@ var metricMap = { // // The output of each of these commands is quite lengthy. The only part we // care about is the FONTDIMEN section. Each value is measured in EMs. -const sigmasAndXis = { +var sigmasAndXis = { slant: [0.250, 0.250, 0.250], // sigma1 space: [0.000, 0.000, 0.000], @@ -3795,7 +3611,7 @@ const sigmasAndXis = { // the fraction bar or root line from intersecting the glyph. // TODO(kevinb) allow union of multiple glyph metrics for better accuracy. -const extraCharacterMap = { +var extraCharacterMap = { // Latin-1 'Å': 'A', 'Ç': 'C', @@ -3877,7 +3693,7 @@ const extraCharacterMap = { * It can also override existing metrics */ function setFontMetrics(fontName, metrics) { - metricMap[fontName] = metrics; + fontMetricsData[fontName] = metrics; } /** * This function is a convenience function for looking up information in the @@ -3888,16 +3704,16 @@ function setFontMetrics(fontName, metrics) { */ function getCharacterMetrics(character, font, mode) { - if (!metricMap[font]) { - throw new Error(`Font metrics not found for font: ${font}.`); + if (!fontMetricsData[font]) { + throw new Error("Font metrics not found for font: " + font + "."); } - let ch = character.charCodeAt(0); - let metrics = metricMap[font][ch]; + var ch = character.charCodeAt(0); + var metrics = fontMetricsData[font][ch]; if (!metrics && character[0] in extraCharacterMap) { ch = extraCharacterMap[character[0]].charCodeAt(0); - metrics = metricMap[font][ch]; + metrics = fontMetricsData[font][ch]; } if (!metrics && mode === 'text') { @@ -3910,7 +3726,7 @@ function getCharacterMetrics(character, font, mode) { // we (currently) only care about the height of the glpyh // not its width. if (supportedCodepoint(ch)) { - metrics = metricMap[font][77]; // 77 is the charcode for 'M' + metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M' } } @@ -3924,13 +3740,13 @@ function getCharacterMetrics(character, font, mode) { }; } } -const fontMetricsBySizeIndex = {}; +var fontMetricsBySizeIndex = {}; /** * Get the font metrics for a given size. */ function getGlobalMetrics(size) { - let sizeIndex; + var sizeIndex; if (size >= 5) { sizeIndex = 0; @@ -3941,11 +3757,11 @@ function getGlobalMetrics(size) { } if (!fontMetricsBySizeIndex[sizeIndex]) { - const metrics = fontMetricsBySizeIndex[sizeIndex] = { + var metrics = fontMetricsBySizeIndex[sizeIndex] = { cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18 }; - for (const key in sigmasAndXis) { + for (var key in sigmasAndXis) { if (sigmasAndXis.hasOwnProperty(key)) { metrics[key] = sigmasAndXis[key][sizeIndex]; } @@ -3976,7 +3792,7 @@ function getGlobalMetrics(size) { // types for raw text tokens, and we want to avoid conflicts with higher-level // `ParseNode` types. These `ParseNode`s are constructed within `Parser` by // looking up the `symbols` map. -const ATOMS = { +var ATOMS = { "bin": 1, "close": 1, "inner": 1, @@ -3984,14 +3800,14 @@ const ATOMS = { "punct": 1, "rel": 1 }; -const NON_ATOMS = { +var NON_ATOMS = { "accent-token": 1, "mathord": 1, "op-token": 1, "spacing": 1, "textord": 1 }; -const symbols = { +var symbols = { "math": {}, "text": {} }; @@ -4011,23 +3827,23 @@ function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { // This helps minify the code, and also spotting typos using jshint. // modes: -const math = "math"; -const text$1 = "text"; // fonts: +var math = "math"; +var text$1 = "text"; // fonts: -const main = "main"; -const ams = "ams"; // groups: +var main = "main"; +var ams = "ams"; // groups: -const accent = "accent-token"; -const bin = "bin"; -const close = "close"; -const inner = "inner"; -const mathord = "mathord"; -const op = "op-token"; -const open = "open"; -const punct = "punct"; -const rel = "rel"; -const spacing = "spacing"; -const textord = "textord"; // Now comes the symbol table +var accent = "accent-token"; +var bin = "bin"; +var close = "close"; +var inner = "inner"; +var mathord = "mathord"; +var op = "op-token"; +var open = "open"; +var punct = "punct"; +var rel = "rel"; +var spacing = "spacing"; +var textord = "textord"; // Now comes the symbol table // Relation Symbols defineSymbol(math, main, rel, "\u2261", "\\equiv", true); @@ -4099,7 +3915,7 @@ defineSymbol(math, main, bin, "\u228e", "\\uplus", true); defineSymbol(math, main, bin, "\u2293", "\\sqcap", true); defineSymbol(math, main, bin, "\u2217", "\\ast"); defineSymbol(math, main, bin, "\u2294", "\\sqcup", true); -defineSymbol(math, main, bin, "\u25ef", "\\bigcirc"); +defineSymbol(math, main, bin, "\u25ef", "\\bigcirc", true); defineSymbol(math, main, bin, "\u2219", "\\bullet"); defineSymbol(math, main, bin, "\u2021", "\\ddagger"); defineSymbol(math, main, bin, "\u2240", "\\wr", true); @@ -4360,6 +4176,10 @@ defineSymbol(math, ams, rel, "\u21b0", "\\Lsh", true); defineSymbol(math, ams, rel, "\u21c8", "\\upuparrows", true); defineSymbol(math, ams, rel, "\u21bf", "\\upharpoonleft", true); defineSymbol(math, ams, rel, "\u21c3", "\\downharpoonleft", true); +defineSymbol(math, main, rel, "\u22b6", "\\origof", true); // not in font + +defineSymbol(math, main, rel, "\u22b7", "\\imageof", true); // not in font + defineSymbol(math, ams, rel, "\u22b8", "\\multimap", true); defineSymbol(math, ams, rel, "\u21ad", "\\leftrightsquigarrow", true); defineSymbol(math, ams, rel, "\u21c9", "\\rightrightarrows", true); @@ -4585,6 +4405,8 @@ defineSymbol(math, main, op, "\u2a02", "\\bigotimes"); defineSymbol(math, main, op, "\u2a01", "\\bigoplus"); defineSymbol(math, main, op, "\u2a00", "\\bigodot"); defineSymbol(math, main, op, "\u222e", "\\oint"); +defineSymbol(math, main, op, "\u222f", "\\oiint"); +defineSymbol(math, main, op, "\u2230", "\\oiiint"); defineSymbol(math, main, op, "\u2a06", "\\bigsqcup"); defineSymbol(math, main, op, "\u222b", "\\smallint"); defineSymbol(text$1, main, inner, "\u2026", "\\textellipsis"); @@ -4645,7 +4467,7 @@ defineSymbol(text$1, main, accent, "\u02dd", "\\H"); // double acute defineSymbol(text$1, main, accent, "\u25ef", "\\textcircled"); // \bigcirc glyph // These ligatures are detected and created in Parser.js's `formLigatures`. -const ligatures = { +var ligatures = { "--": true, "---": true, "``": true, @@ -4678,28 +4500,30 @@ defineSymbol(math, ams, textord, "\u2720", "\\maltese"); defineSymbol(text$1, ams, textord, "\u2720", "\\maltese"); // There are lots of symbols which are the same, so we add them in afterwards. // All of these are textords in math mode -const mathTextSymbols = "0123456789/@.\""; +var mathTextSymbols = "0123456789/@.\""; -for (let i = 0; i < mathTextSymbols.length; i++) { - const ch = mathTextSymbols.charAt(i); +for (var i = 0; i < mathTextSymbols.length; i++) { + var ch = mathTextSymbols.charAt(i); defineSymbol(math, main, textord, ch, ch); } // All of these are textords in text mode -const textSymbols = "0123456789!@*()-=+\";:?/.,"; +var textSymbols = "0123456789!@*()-=+\";:?/.,"; -for (let i = 0; i < textSymbols.length; i++) { - const ch = textSymbols.charAt(i); - defineSymbol(text$1, main, textord, ch, ch); +for (var _i = 0; _i < textSymbols.length; _i++) { + var _ch = textSymbols.charAt(_i); + + defineSymbol(text$1, main, textord, _ch, _ch); } // All of these are textords in text mode, and mathords in math mode -const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -for (let i = 0; i < letters.length; i++) { - const ch = letters.charAt(i); - defineSymbol(math, main, mathord, ch, ch); - defineSymbol(text$1, main, textord, ch, ch); +for (var _i2 = 0; _i2 < letters.length; _i2++) { + var _ch2 = letters.charAt(_i2); + + defineSymbol(math, main, mathord, _ch2, _ch2); + defineSymbol(text$1, main, textord, _ch2, _ch2); } // Blackboard bold and script letters in Unicode range @@ -4726,57 +4550,58 @@ defineSymbol(text$1, main, mathord, "h", "\u210E"); // The next loop loads wide // Some editors do not deal well with wide characters. So don't write the // string into this file. Instead, create the string from the surrogate pair. -let wideChar = ""; +var wideChar = ""; -for (let i = 0; i < letters.length; i++) { - const ch = letters.charAt(i); // The hex numbers in the next line are a surrogate pair. +for (var _i3 = 0; _i3 < letters.length; _i3++) { + var _ch3 = letters.charAt(_i3); // The hex numbers in the next line are a surrogate pair. // 0xD835 is the high surrogate for all letters in the range we support. // 0xDC00 is the low surrogate for bold A. - wideChar = String.fromCharCode(0xD835, 0xDC00 + i); // A-Z a-z bold - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDC34 + i); // A-Z a-z italic + wideChar = String.fromCharCode(0xD835, 0xDC00 + _i3); // A-Z a-z bold - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDC68 + i); // A-Z a-z bold italic + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text$1, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDC34 + _i3); // A-Z a-z italic - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDD04 + i); // A-Z a-z Fractur + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text$1, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDC68 + _i3); // A-Z a-z bold italic - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDDA0 + i); // A-Z a-z sans-serif + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text$1, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fractur - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDDD4 + i); // A-Z a-z sans bold + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text$1, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDDA0 + _i3); // A-Z a-z sans-serif - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDE08 + i); // A-Z a-z sans italic + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text$1, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDDD4 + _i3); // A-Z a-z sans bold - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDE70 + i); // A-Z a-z monospace + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text$1, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDE08 + _i3); // A-Z a-z sans italic - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text$1, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDE70 + _i3); // A-Z a-z monospace - if (i < 26) { + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text$1, main, textord, _ch3, wideChar); + + if (_i3 < 26) { // KaTeX fonts have only capital letters for blackboard bold and script. // See exception for k below. - wideChar = String.fromCharCode(0xD835, 0xDD38 + i); // A-Z double struck + wideChar = String.fromCharCode(0xD835, 0xDD38 + _i3); // A-Z double struck - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDC9C + i); // A-Z script + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text$1, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDC9C + _i3); // A-Z script - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text$1, main, textord, _ch3, wideChar); } // TODO: Add bold script when it is supported by a KaTeX font. } // "k" is the only double struck lower case letter in the KaTeX fonts. @@ -4787,36 +4612,38 @@ wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck defineSymbol(math, main, mathord, "k", wideChar); defineSymbol(text$1, main, textord, "k", wideChar); // Next, some wide character numerals -for (let i = 0; i < 10; i++) { - const ch = i.toString(); - wideChar = String.fromCharCode(0xD835, 0xDFCE + i); // 0-9 bold +for (var _i4 = 0; _i4 < 10; _i4++) { + var _ch4 = _i4.toString(); - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDFE2 + i); // 0-9 sans serif + wideChar = String.fromCharCode(0xD835, 0xDFCE + _i4); // 0-9 bold - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDFEC + i); // 0-9 bold sans + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text$1, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDFE2 + _i4); // 0-9 sans serif - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); - wideChar = String.fromCharCode(0xD835, 0xDFF6 + i); // 0-9 monospace + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text$1, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDFEC + _i4); // 0-9 bold sans - defineSymbol(math, main, mathord, ch, wideChar); - defineSymbol(text$1, main, textord, ch, wideChar); + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text$1, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDFF6 + _i4); // 0-9 monospace + + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text$1, main, textord, _ch4, wideChar); } // We add these Latin-1 letters as symbols for backwards-compatibility, // but they are not actually in the font, nor are they supported by the // Unicode accent mechanism, so they fall back to Times font and look ugly. // TODO(edemaine): Fix this. -const extraLatin = "\u00c7\u00d0\u00de\u00e7\u00fe"; +var extraLatin = "\u00c7\u00d0\u00de\u00e7\u00fe"; -for (let i = 0; i < extraLatin.length; i++) { - const ch = extraLatin.charAt(i); - defineSymbol(math, main, mathord, ch, ch); - defineSymbol(text$1, main, textord, ch, ch); +for (var _i5 = 0; _i5 < extraLatin.length; _i5++) { + var _ch5 = extraLatin.charAt(_i5); + + defineSymbol(math, main, mathord, _ch5, _ch5); + defineSymbol(text$1, main, textord, _ch5, _ch5); } /** @@ -4836,7 +4663,7 @@ for (let i = 0; i < extraLatin.length; i++) { * * The font name, so that KaTeX can get font metrics. */ -const wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright +var wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright ["mathbf", "textbf", "Main-Bold"], // a-z bold upright ["mathnormal", "textit", "Math-Italic"], // A-Z italic ["mathnormal", "textit", "Math-Italic"], // a-z italic @@ -4863,30 +4690,33 @@ const wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upri ["", "", ""], // A-Z bold italic sans. No font ["", "", ""], // a-z bold italic sans. No font ["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace -["mathtt", "texttt", "Typewriter-Regular"]]; -const wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold +["mathtt", "texttt", "Typewriter-Regular"] // a-z monospace +]; +var wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold ["", "", ""], // 0-9 double-struck. No KaTeX font. ["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif -["mathtt", "texttt", "Typewriter-Regular"]]; -const wideCharacterFont = function wideCharacterFont(wideChar, mode) { +["mathtt", "texttt", "Typewriter-Regular"] // 0-9 monospace +]; +var wideCharacterFont = function wideCharacterFont(wideChar, mode) { // IE doesn't support codePointAt(). So work with the surrogate pair. - const H = wideChar.charCodeAt(0); // high surrogate + var H = wideChar.charCodeAt(0); // high surrogate - const L = wideChar.charCodeAt(1); // low surrogate + var L = wideChar.charCodeAt(1); // low surrogate - const codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000; - const j = mode === "math" ? 0 : 1; // column index for CSS class. + var codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000; + var j = mode === "math" ? 0 : 1; // column index for CSS class. if (0x1D400 <= codePoint && codePoint < 0x1D6A4) { // wideLatinLetterData contains exactly 26 chars on each row. // So we can calculate the relevant row. No traverse necessary. - const i = Math.floor((codePoint - 0x1D400) / 26); + var i = Math.floor((codePoint - 0x1D400) / 26); return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]]; } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) { // Numerals, ten per row. - const i = Math.floor((codePoint - 0x1D7CE) / 10); - return [wideNumeralData[i][2], wideNumeralData[i][j]]; + var _i = Math.floor((codePoint - 0x1D7CE) / 10); + + return [wideNumeralData[_i][2], wideNumeralData[_i][j]]; } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) { // dotless i or j return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]]; @@ -4905,7 +4735,7 @@ const wideCharacterFont = function wideCharacterFont(wideChar, mode) { * recursing, a new `Options` object can be created with the `.with*` and * `.reset` functions. */ -const sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize]. +var sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize]. // The size mappings are taken from TeX with \normalsize=10pt. [1, 1, 1], // size1: [5, 5, 5] \tiny [2, 1, 1], // size2: [6, 5, 5] @@ -4917,12 +4747,13 @@ const sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscri [8, 6, 3], // size8: [14.4, 10, 7] \Large [9, 7, 6], // size9: [17.28, 12, 10] \LARGE [10, 8, 7], // size10: [20.74, 14.4, 12] \huge -[11, 10, 9]]; -const sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if +[11, 10, 9] // size11: [24.88, 20.74, 17.28] \HUGE +]; +var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if // you change size indexes, change that function. 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488]; -const sizeAtStyle = function sizeAtStyle(size, style) { +var sizeAtStyle = function sizeAtStyle(size, style) { return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1]; }; // In these types, "" (empty string) means "no change". @@ -4977,7 +4808,7 @@ class Options { extend(extension) { - const data = { + var data = { style: this.style, size: this.size, textSize: this.textSize, @@ -4991,7 +4822,7 @@ class Options { minRuleThickness: this.minRuleThickness }; - for (const key in extension) { + for (var key in extension) { if (extension.hasOwnProperty(key)) { data[key] = extension[key]; } @@ -5050,7 +4881,7 @@ class Options { havingBaseStyle(style) { style = style || this.style.text(); - const wantSize = sizeAtStyle(Options.BASESIZE, style); + var wantSize = sizeAtStyle(Options.BASESIZE, style); if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) { return this; @@ -5068,7 +4899,7 @@ class Options { havingBaseSizing() { - let size; + var size; switch (this.style.id) { case 4: @@ -5220,7 +5051,7 @@ Options.BASESIZE = 6; // into pts. Dividing the result by ptPerEm gives the number of ems // *assuming* a font size of ptPerEm (normal size, normal style). -const ptPerUnit = { +var ptPerUnit = { // https://en.wikibooks.org/wiki/LaTeX/Lengths and // https://tex.stackexchange.com/a/8263 "pt": 1, @@ -5250,7 +5081,7 @@ const ptPerUnit = { }; // Dictionary of relative units, for fast validity testing. -const relativeUnit = { +var relativeUnit = { "ex": true, "em": true, "mu": true @@ -5260,7 +5091,7 @@ const relativeUnit = { * Determine whether the specified unit (either a string defining the unit * or a "size" parse node containing a unit field) is valid. */ -const validUnit = function validUnit(unit) { +var validUnit = function validUnit(unit) { if (typeof unit !== "string") { unit = unit.unit; } @@ -5273,8 +5104,8 @@ const validUnit = function validUnit(unit) { * current style/scale. `options` gives the current options. */ -const calculateSize = function calculateSize(sizeValue, options) { - let scale; +var calculateSize = function calculateSize(sizeValue, options) { + var scale; if (sizeValue.unit in ptPerUnit) { // Absolute units @@ -5287,7 +5118,7 @@ const calculateSize = function calculateSize(sizeValue, options) { } else { // Other relative units always refer to the *textstyle* font // in the current size. - let unitOptions; + var unitOptions; if (options.style.isTight()) { // isTight() means current style is script/scriptscript. @@ -5325,7 +5156,7 @@ const calculateSize = function calculateSize(sizeValue, options) { * Looks up the given symbol in fontMetrics, after applying any symbol * replacements defined in symbol.js */ -const lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this. +var lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this. fontName, mode) { // Replace the value with its replaced value from symbol.js if (symbols[mode][value] && symbols[mode][value].replace) { @@ -5349,14 +5180,14 @@ fontName, mode) { */ -const makeSymbol = function makeSymbol(value, fontName, mode, options, classes) { - const lookup = lookupSymbol(value, fontName, mode); - const metrics = lookup.metrics; +var makeSymbol = function makeSymbol(value, fontName, mode, options, classes) { + var lookup = lookupSymbol(value, fontName, mode); + var metrics = lookup.metrics; value = lookup.value; - let symbolNode; + var symbolNode; if (metrics) { - let italic = metrics.italic; + var italic = metrics.italic; if (mode === "text" || options && options.font === "mathit") { italic = 0; @@ -5365,7 +5196,7 @@ const makeSymbol = function makeSymbol(value, fontName, mode, options, classes) symbolNode = new SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes); } else { // TODO(emily): Figure out a good way to only print this in development - typeof console !== "undefined" && console.warn("No character metrics " + `for '${value}' in style '${fontName}' and mode '${mode}'`); + typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'")); symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes); } @@ -5376,7 +5207,7 @@ const makeSymbol = function makeSymbol(value, fontName, mode, options, classes) symbolNode.classes.push("mtight"); } - const color = options.getColor(); + var color = options.getColor(); if (color) { symbolNode.style.color = color; @@ -5391,7 +5222,7 @@ const makeSymbol = function makeSymbol(value, fontName, mode, options, classes) */ -const mathsym = function mathsym(value, mode, options, classes) { +var mathsym = function mathsym(value, mode, options, classes) { if (classes === void 0) { classes = []; } @@ -5419,7 +5250,7 @@ const mathsym = function mathsym(value, mode, options, classes) { */ -const boldsymbol = function boldsymbol(value, mode, options, classes, type) { +var boldsymbol = function boldsymbol(value, mode, options, classes, type) { if (type !== "textord" && lookupSymbol(value, "Math-BoldItalic", mode).metrics) { return { fontName: "Math-BoldItalic", @@ -5439,27 +5270,24 @@ const boldsymbol = function boldsymbol(value, mode, options, classes, type) { */ -const makeOrd = function makeOrd(group, options, type) { - const mode = group.mode; - const text = group.text; - const classes = ["mord"]; // Math mode or Old font (i.e. \rm) +var makeOrd = function makeOrd(group, options, type) { + var mode = group.mode; + var text = group.text; + var classes = ["mord"]; // Math mode or Old font (i.e. \rm) - const isFont = mode === "math" || mode === "text" && options.font; - const fontOrFamily = isFont ? options.font : options.fontFamily; + var isFont = mode === "math" || mode === "text" && options.font; + var fontOrFamily = isFont ? options.font : options.fontFamily; if (text.charCodeAt(0) === 0xD835) { // surrogate pairs get special treatment - const _wideCharacterFont = wideCharacterFont(text, mode), - wideFontName = _wideCharacterFont[0], - wideFontClass = _wideCharacterFont[1]; - + var [wideFontName, wideFontClass] = wideCharacterFont(text, mode); return makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass)); } else if (fontOrFamily) { - let fontName; - let fontClasses; + var fontName; + var fontClasses; if (fontOrFamily === "boldsymbol") { - const fontData = boldsymbol(text, mode, options, classes, type); + var fontData = boldsymbol(text, mode, options, classes, type); fontName = fontData.fontName; fontClasses = [fontData.fontClass]; } else if (isFont) { @@ -5474,9 +5302,9 @@ const makeOrd = function makeOrd(group, options, type) { return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses)); } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") { // Deconstruct ligatures in monospace fonts (\texttt, \tt). - const parts = []; + var parts = []; - for (let i = 0; i < text.length; i++) { + for (var i = 0; i < text.length; i++) { parts.push(makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses))); } @@ -5488,19 +5316,22 @@ const makeOrd = function makeOrd(group, options, type) { if (type === "mathord") { return makeSymbol(text, "Math-Italic", mode, options, classes.concat(["mathnormal"])); } else if (type === "textord") { - const font = symbols[mode][text] && symbols[mode][text].font; + var font = symbols[mode][text] && symbols[mode][text].font; if (font === "ams") { - const fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape); - return makeSymbol(text, fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape)); + var _fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape); + + return makeSymbol(text, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape)); } else if (font === "main" || !font) { - const fontName = retrieveTextFontName("textrm", options.fontWeight, options.fontShape); - return makeSymbol(text, fontName, mode, options, classes.concat(options.fontWeight, options.fontShape)); + var _fontName2 = retrieveTextFontName("textrm", options.fontWeight, options.fontShape); + + return makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape)); } else { // fonts added by plugins - const fontName = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class + var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class - return makeSymbol(text, fontName, mode, options, classes.concat(fontName, options.fontWeight, options.fontShape)); + + return makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape)); } } else { throw new Error("unexpected type: " + type + " in makeOrd"); @@ -5512,19 +5343,29 @@ const makeOrd = function makeOrd(group, options, type) { */ -const canCombine = (prev, next) => { +var canCombine = (prev, next) => { if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) { return false; + } // If prev and next both are just "mbin"s or "mord"s we don't combine them + // so that the proper spacing can be preserved. + + + if (prev.classes.length === 1) { + var cls = prev.classes[0]; + + if (cls === "mbin" || cls === "mord") { + return false; + } } - for (const style in prev.style) { + for (var style in prev.style) { if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) { return false; } } - for (const style in next.style) { - if (next.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) { + for (var _style in next.style) { + if (next.style.hasOwnProperty(_style) && prev.style[_style] !== next.style[_style]) { return false; } } @@ -5532,15 +5373,15 @@ const canCombine = (prev, next) => { return true; }; /** - * Combine consequetive domTree.symbolNodes into a single symbolNode. + * Combine consecutive domTree.symbolNodes into a single symbolNode. * Note: this function mutates the argument. */ -const tryCombineChars = chars => { - for (let i = 0; i < chars.length - 1; i++) { - const prev = chars[i]; - const next = chars[i + 1]; +var tryCombineChars = chars => { + for (var i = 0; i < chars.length - 1; i++) { + var prev = chars[i]; + var next = chars[i + 1]; if (prev instanceof SymbolNode && next instanceof SymbolNode && canCombine(prev, next)) { prev.text += next.text; @@ -5563,13 +5404,13 @@ const tryCombineChars = chars => { */ -const sizeElementFromChildren = function sizeElementFromChildren(elem) { - let height = 0; - let depth = 0; - let maxFontSize = 0; +var sizeElementFromChildren = function sizeElementFromChildren(elem) { + var height = 0; + var depth = 0; + var maxFontSize = 0; - for (let i = 0; i < elem.children.length; i++) { - const child = elem.children[i]; + for (var i = 0; i < elem.children.length; i++) { + var child = elem.children[i]; if (child.height > height) { height = child.height; @@ -5598,18 +5439,18 @@ const sizeElementFromChildren = function sizeElementFromChildren(elem) { */ -const makeSpan = function makeSpan(classes, children, options, style) { - const span = new Span(classes, children, options, style); +var makeSpan = function makeSpan(classes, children, options, style) { + var span = new Span(classes, children, options, style); sizeElementFromChildren(span); return span; }; // SVG one is simpler -- doesn't require height, depth, max-font setting. // This is also a separate method for typesafety. -const makeSvgSpan = (classes, children, options, style) => new Span(classes, children, options, style); +var makeSvgSpan = (classes, children, options, style) => new Span(classes, children, options, style); -const makeLineSpan = function makeLineSpan(className, options, thickness) { - const line = makeSpan([className], [], options); +var makeLineSpan = function makeLineSpan(className, options, thickness) { + var line = makeSpan([className], [], options); line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness); line.style.borderBottomWidth = line.height + "em"; line.maxFontSize = 1.0; @@ -5621,8 +5462,8 @@ const makeLineSpan = function makeLineSpan(className, options, thickness) { */ -const makeAnchor = function makeAnchor(href, classes, children, options) { - const anchor = new Anchor(href, classes, children, options); +var makeAnchor = function makeAnchor(href, classes, children, options) { + var anchor = new Anchor(href, classes, children, options); sizeElementFromChildren(anchor); return anchor; }; @@ -5631,8 +5472,8 @@ const makeAnchor = function makeAnchor(href, classes, children, options) { */ -const makeFragment = function makeFragment(children) { - const fragment = new DocumentFragment(children); +var makeFragment = function makeFragment(children) { + var fragment = new DocumentFragment(children); sizeElementFromChildren(fragment); return fragment; }; @@ -5642,7 +5483,7 @@ const makeFragment = function makeFragment(children) { */ -const wrapFragment = function wrapFragment(group, options) { +var wrapFragment = function wrapFragment(group, options) { if (group instanceof DocumentFragment) { return makeSpan([], [group], options); } @@ -5655,18 +5496,19 @@ const wrapFragment = function wrapFragment(group, options) { // // This helper function for makeVList makes it easier to enforce type safety by // allowing early exits (returns) in the logic. -const getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { +var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { if (params.positionType === "individualShift") { - const oldChildren = params.children; - const children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be + var oldChildren = params.children; + var children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be // shifted to the correct specified shift - const depth = -oldChildren[0].shift - oldChildren[0].elem.depth; - let currPos = depth; + var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth; - for (let i = 1; i < oldChildren.length; i++) { - const diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; - const size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); + var currPos = _depth; + + for (var i = 1; i < oldChildren.length; i++) { + var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; + var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); currPos = currPos + diff; children.push({ type: "kern", @@ -5677,19 +5519,19 @@ const getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { return { children, - depth + depth: _depth }; } - let depth; + var depth; if (params.positionType === "top") { // We always start at the bottom, so calculate the bottom by adding up // all the sizes - let bottom = params.positionData; + var bottom = params.positionData; - for (let i = 0; i < params.children.length; i++) { - const child = params.children[i]; + for (var _i = 0; _i < params.children.length; _i++) { + var child = params.children[_i]; bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth; } @@ -5697,7 +5539,7 @@ const getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { } else if (params.positionType === "bottom") { depth = -params.positionData; } else { - const firstChild = params.children[0]; + var firstChild = params.children[0]; if (firstChild.type !== "elem") { throw new Error('First child must have type "elem".'); @@ -5708,7 +5550,7 @@ const getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { } else if (params.positionType === "firstBaseline") { depth = -firstChild.elem.depth; } else { - throw new Error(`Invalid positionType ${params.positionType}.`); + throw new Error("Invalid positionType " + params.positionType + "."); } } @@ -5725,10 +5567,11 @@ const getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { */ -const makeVList = function makeVList(params, options) { - const _getVListChildrenAndD = getVListChildrenAndDepth(params), - children = _getVListChildrenAndD.children, - depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to +var makeVList = function makeVList(params, options) { + var { + children, + depth + } = getVListChildrenAndDepth(params); // Create a strut that is taller than any list item. The strut is added to // each item, where it will determine the item's baseline. Since it has // `overflow:hidden`, the strut's top edge will sit on the item's line box's // top edge and the strut's bottom edge will sit on the item's baseline, @@ -5736,49 +5579,48 @@ const makeVList = function makeVList(params, options) { // be positioned precisely without worrying about font ascent and // line-height. + var pstrutSize = 0; - let pstrutSize = 0; - - for (let i = 0; i < children.length; i++) { - const child = children[i]; + for (var i = 0; i < children.length; i++) { + var child = children[i]; if (child.type === "elem") { - const elem = child.elem; + var elem = child.elem; pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height); } } pstrutSize += 2; - const pstrut = makeSpan(["pstrut"], []); + var pstrut = makeSpan(["pstrut"], []); pstrut.style.height = pstrutSize + "em"; // Create a new list of actual children at the correct offsets - const realChildren = []; - let minPos = depth; - let maxPos = depth; - let currPos = depth; + var realChildren = []; + var minPos = depth; + var maxPos = depth; + var currPos = depth; - for (let i = 0; i < children.length; i++) { - const child = children[i]; + for (var _i2 = 0; _i2 < children.length; _i2++) { + var _child = children[_i2]; - if (child.type === "kern") { - currPos += child.size; + if (_child.type === "kern") { + currPos += _child.size; } else { - const elem = child.elem; - const classes = child.wrapperClasses || []; - const style = child.wrapperStyle || {}; - const childWrap = makeSpan(classes, [pstrut, elem], undefined, style); - childWrap.style.top = -pstrutSize - currPos - elem.depth + "em"; + var _elem = _child.elem; + var classes = _child.wrapperClasses || []; + var style = _child.wrapperStyle || {}; + var childWrap = makeSpan(classes, [pstrut, _elem], undefined, style); + childWrap.style.top = -pstrutSize - currPos - _elem.depth + "em"; - if (child.marginLeft) { - childWrap.style.marginLeft = child.marginLeft; + if (_child.marginLeft) { + childWrap.style.marginLeft = _child.marginLeft; } - if (child.marginRight) { - childWrap.style.marginRight = child.marginRight; + if (_child.marginRight) { + childWrap.style.marginRight = _child.marginRight; } realChildren.push(childWrap); - currPos += elem.height + elem.depth; + currPos += _elem.height + _elem.depth; } minPos = Math.min(minPos, currPos); @@ -5788,10 +5630,10 @@ const makeVList = function makeVList(params, options) { // without overly expanding the containing line-box. - const vlist = makeSpan(["vlist"], realChildren); + var vlist = makeSpan(["vlist"], realChildren); vlist.style.height = maxPos + "em"; // A second row is used if necessary to represent the vlist's depth. - let rows; + var rows; if (minPos < 0) { // We will define depth in an empty span with display: table-cell. @@ -5799,18 +5641,18 @@ const makeVList = function makeVList(params, options) { // contenteditable mode only, treats that span as if it contains some // text content. And that min-height over-rides our desired height. // So we put another empty span inside the depth strut span. - const emptySpan = makeSpan([], []); - const depthStrut = makeSpan(["vlist"], [emptySpan]); + var emptySpan = makeSpan([], []); + var depthStrut = makeSpan(["vlist"], [emptySpan]); depthStrut.style.height = -minPos + "em"; // Safari wants the first row to have inline content; otherwise it // puts the bottom of the *second* row on the baseline. - const topStrut = makeSpan(["vlist-s"], [new SymbolNode("\u200b")]); + var topStrut = makeSpan(["vlist-s"], [new SymbolNode("\u200b")]); rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])]; } else { rows = [makeSpan(["vlist-r"], [vlist])]; } - const vtable = makeSpan(["vlist-t"], rows); + var vtable = makeSpan(["vlist-t"], rows); if (rows.length === 2) { vtable.classes.push("vlist-t2"); @@ -5824,17 +5666,17 @@ const makeVList = function makeVList(params, options) { // static space between elements in a horizontal layout. -const makeGlue = (measurement, options) => { +var makeGlue = (measurement, options) => { // Make an empty span for the space - const rule = makeSpan(["mspace"], [], options); - const size = calculateSize(measurement, options); - rule.style.marginRight = `${size}em`; + var rule = makeSpan(["mspace"], [], options); + var size = calculateSize(measurement, options); + rule.style.marginRight = size + "em"; return rule; }; // Takes font options, and returns the appropriate fontLookup name -const retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) { - let baseFontName = ""; +var retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) { + var baseFontName = ""; switch (fontFamily) { case "amsrm": @@ -5858,7 +5700,7 @@ const retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeigh // use fonts added by a plugin } - let fontStylesName; + var fontStylesName; if (fontWeight === "textbf" && fontShape === "textit") { fontStylesName = "BoldItalic"; @@ -5870,7 +5712,7 @@ const retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeigh fontStylesName = "Regular"; } - return `${baseFontName}-${fontStylesName}`; + return baseFontName + "-" + fontStylesName; }; /** * Maps TeX font commands to objects containing: @@ -5880,7 +5722,7 @@ const retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeigh // A map between tex font commands an MathML mathvariant attribute values -const fontMap = { +var fontMap = { // styles "mathbf": { variant: "bold", @@ -5931,7 +5773,7 @@ const fontMap = { fontName: "Typewriter-Regular" } }; -const svgData = { +var svgData = { // path, width, height vec: ["vec", 0.471, 0.714], // values from the font glyph @@ -5939,19 +5781,14 @@ const svgData = { // oval to overlay the integrand oiintSize2: ["oiintSize2", 1.472, 0.659], oiiintSize1: ["oiiintSize1", 1.304, 0.499], - oiiintSize2: ["oiiintSize2", 1.98, 0.659], - leftParenInner: ["leftParenInner", 0.875, 0.3], - rightParenInner: ["rightParenInner", 0.875, 0.3] + oiiintSize2: ["oiiintSize2", 1.98, 0.659] }; -const staticSvg = function staticSvg(value, options) { +var staticSvg = function staticSvg(value, options) { // Create a span with inline SVG for the element. - const _svgData$value = svgData[value], - pathName = _svgData$value[0], - width = _svgData$value[1], - height = _svgData$value[2]; - const path = new PathNode(pathName); - const svgNode = new SvgNode([path], { + var [pathName, width, height] = svgData[value]; + var path = new PathNode(pathName); + var svgNode = new SvgNode([path], { "width": width + "em", "height": height + "em", // Override CSS rule `.katex svg { width: 100% }` @@ -5959,7 +5796,7 @@ const staticSvg = function staticSvg(value, options) { "viewBox": "0 0 " + 1000 * width + " " + 1000 * height, "preserveAspectRatio": "xMinYMin" }); - const span = makeSvgSpan(["overlay"], [svgNode], options); + var span = makeSvgSpan(["overlay"], [svgNode], options); span.height = height; span.style.height = height + "em"; span.style.width = width + "em"; @@ -5987,15 +5824,15 @@ var buildCommon = { /** * Describes spaces between different classes of atoms. */ -const thinspace = { +var thinspace = { number: 3, unit: "mu" }; -const mediumspace = { +var mediumspace = { number: 4, unit: "mu" }; -const thickspace = { +var thickspace = { number: 5, unit: "mu" }; // Making the type below exact with all optional fields doesn't work due to @@ -6005,7 +5842,7 @@ const thickspace = { // above. // Spacing relationships for display and text styles -const spacings = { +var spacings = { mord: { mop: thinspace, mbin: mediumspace, @@ -6057,7 +5894,7 @@ const spacings = { } }; // Spacing relationships for script and scriptscript styles -const tightSpacings = { +var tightSpacings = { mord: { mop: thinspace }, @@ -6097,40 +5934,43 @@ const tightSpacings = { * `functions.js` just exports this same dictionary again and makes it public. * `Parser.js` requires this dictionary. */ -const _functions = {}; +var _functions = {}; /** * All HTML builders. Should be only used in the `define*` and the `build*ML` * functions. */ -const _htmlGroupBuilders = {}; +var _htmlGroupBuilders = {}; /** * All MathML builders. Should be only used in the `define*` and the `build*ML` * functions. */ -const _mathmlGroupBuilders = {}; +var _mathmlGroupBuilders = {}; function defineFunction(_ref) { - let type = _ref.type, - names = _ref.names, - props = _ref.props, - handler = _ref.handler, - htmlBuilder = _ref.htmlBuilder, - mathmlBuilder = _ref.mathmlBuilder; + var { + type, + names, + props, + handler, + htmlBuilder, + mathmlBuilder + } = _ref; // Set default values of functions - const data = { + var data = { type, numArgs: props.numArgs, argTypes: props.argTypes, - greediness: props.greediness === undefined ? 1 : props.greediness, + allowedInArgument: !!props.allowedInArgument, allowedInText: !!props.allowedInText, allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath, numOptionalArgs: props.numOptionalArgs || 0, infix: !!props.infix, + primitive: !!props.primitive, handler: handler }; - for (let i = 0; i < names.length; ++i) { + for (var i = 0; i < names.length; ++i) { _functions[names[i]] = data; } @@ -6151,9 +5991,11 @@ function defineFunction(_ref) { */ function defineFunctionBuilders(_ref2) { - let type = _ref2.type, - htmlBuilder = _ref2.htmlBuilder, - mathmlBuilder = _ref2.mathmlBuilder; + var { + type, + htmlBuilder, + mathmlBuilder + } = _ref2; defineFunction({ type, names: [], @@ -6168,10 +6010,13 @@ function defineFunctionBuilders(_ref2) { htmlBuilder, mathmlBuilder }); -} // Since the corresponding buildHTML/buildMathML function expects a +} +var normalizeArgument = function normalizeArgument(arg) { + return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg; +}; // Since the corresponding buildHTML/buildMathML function expects a // list of elements, we normalize for different kinds of arguments -const ordargument = function ordargument(arg) { +var ordargument = function ordargument(arg) { return arg.type === "ordgroup" ? arg.body : [arg]; }; @@ -6181,19 +6026,19 @@ const ordargument = function ordargument(arg) { * Then, the buildExpression, buildGroup, and various groupBuilders functions * are called, to produce a final HTML tree. */ -const makeSpan$1 = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`) +var makeSpan$1 = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`) // depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6, // and the text before Rule 19. -const binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]; -const binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"]; -const styleMap = { +var binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]; +var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"]; +var styleMap = { "display": Style$1.DISPLAY, "text": Style$1.TEXT, "script": Style$1.SCRIPT, "scriptscript": Style$1.SCRIPTSCRIPT }; -const DomEnum = { +var DomEnum = { mord: "mord", mop: "mop", mbin: "mbin", @@ -6212,35 +6057,37 @@ const DomEnum = { * a partial group (e.g. one created by \color). `surrounding` is an array * consisting type of nodes that will be added to the left and right. */ -const buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) { +var buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) { if (surrounding === void 0) { surrounding = [null, null]; } // Parse expressions into `groups`. - const groups = []; + var groups = []; - for (let i = 0; i < expression.length; i++) { - const output = buildGroup(expression[i], options); + for (var i = 0; i < expression.length; i++) { + var output = buildGroup(expression[i], options); if (output instanceof DocumentFragment) { - const children = output.children; + var children = output.children; groups.push(...children); } else { groups.push(output); } - } // If `expression` is a partial group, let the parent handle spacings - // to avoid processing groups multiple times. + } // Combine consecutive domTree.symbolNodes into a single symbolNode. + buildCommon.tryCombineChars(groups); // If `expression` is a partial group, let the parent handle spacings + // to avoid processing groups multiple times. + if (!isRealGroup) { return groups; } - let glueOptions = options; + var glueOptions = options; if (expression.length === 1) { - const node = expression[0]; + var node = expression[0]; if (node.type === "sizing") { glueOptions = options.havingSize(node.size); @@ -6252,17 +6099,17 @@ const buildExpression = function buildExpression(expression, options, isRealGrou // or "rightmost", respectively, is used to indicate it. - const dummyPrev = makeSpan$1([surrounding[0] || "leftmost"], [], options); - const dummyNext = makeSpan$1([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element + var dummyPrev = makeSpan$1([surrounding[0] || "leftmost"], [], options); + var dummyNext = makeSpan$1([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element // of its `classes` array. A later cleanup should ensure this, for // instance by changing the signature of `makeSpan`. // Before determining what spaces to insert, perform bin cancellation. // Binary operators change to ordinary symbols in some contexts. - const isRoot = isRealGroup === "root"; + var isRoot = isRealGroup === "root"; traverseNonSpaceNodes(groups, (node, prev) => { - const prevType = prev.classes[0]; - const type = node.classes[0]; + var prevType = prev.classes[0]; + var type = node.classes[0]; if (prevType === "mbin" && utils.contains(binRightCanceller, type)) { prev.classes[0] = "mord"; @@ -6273,10 +6120,10 @@ const buildExpression = function buildExpression(expression, options, isRealGrou node: dummyPrev }, dummyNext, isRoot); traverseNonSpaceNodes(groups, (node, prev) => { - const prevType = getTypeOfDomTree(prev); - const type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style. + var prevType = getTypeOfDomTree(prev); + var type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style. - const space = prevType && type ? node.hasClass("mtight") ? tightSpacings[prevType][type] : spacings[prevType][type] : null; + var space = prevType && type ? node.hasClass("mtight") ? tightSpacings[prevType][type] : spacings[prevType][type] : null; if (space) { // Insert glue (spacing) after the `prev`. @@ -6292,17 +6139,17 @@ const buildExpression = function buildExpression(expression, options, isRealGrou // function to insert after it. `next` is a node that will be added to the right. // Used for bin cancellation and inserting spacings. -const traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next, isRoot) { +var traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next, isRoot) { if (next) { // temporarily append the right node, if exists nodes.push(next); } - let i = 0; + var i = 0; for (; i < nodes.length; i++) { - const node = nodes[i]; - const partialGroup = checkPartialGroup(node); + var node = nodes[i]; + var partialGroup = checkPartialGroup(node); if (partialGroup) { // Recursive DFS @@ -6313,10 +6160,10 @@ const traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, pr // spacing should go between atoms of different classes - const nonspace = !node.hasClass("mspace"); + var nonspace = !node.hasClass("mspace"); if (nonspace) { - const result = callback(node, prev.node); + var result = callback(node, prev.node); if (result) { if (prev.insertAfter) { @@ -6347,7 +6194,7 @@ const traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, pr }; // Check if given node is a partial group, i.e., does not affect spacing around. -const checkPartialGroup = function checkPartialGroup(node) { +var checkPartialGroup = function checkPartialGroup(node) { if (node instanceof DocumentFragment || node instanceof Anchor || node instanceof Span && node.hasClass("enclosing")) { return node; } @@ -6356,11 +6203,11 @@ const checkPartialGroup = function checkPartialGroup(node) { }; // Return the outermost node of a domTree. -const getOutermostNode = function getOutermostNode(node, side) { - const partialGroup = checkPartialGroup(node); +var getOutermostNode = function getOutermostNode(node, side) { + var partialGroup = checkPartialGroup(node); if (partialGroup) { - const children = partialGroup.children; + var children = partialGroup.children; if (children.length) { if (side === "right") { @@ -6376,7 +6223,7 @@ const getOutermostNode = function getOutermostNode(node, side) { // If `side` is given, it will get the type of the outermost node at given side. -const getTypeOfDomTree = function getTypeOfDomTree(node, side) { +var getTypeOfDomTree = function getTypeOfDomTree(node, side) { if (!node) { return null; } @@ -6389,8 +6236,8 @@ const getTypeOfDomTree = function getTypeOfDomTree(node, side) { return DomEnum[node.classes[0]] || null; }; -const makeNullDelimiter = function makeNullDelimiter(options, classes) { - const moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); +var makeNullDelimiter = function makeNullDelimiter(options, classes) { + var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); return makeSpan$1(classes.concat(moreClasses)); }; /** @@ -6399,19 +6246,20 @@ const makeNullDelimiter = function makeNullDelimiter(options, classes) { * between parents and children. */ -const buildGroup = function buildGroup(group, options, baseOptions) { +var buildGroup = function buildGroup(group, options, baseOptions) { if (!group) { return makeSpan$1(); } if (_htmlGroupBuilders[group.type]) { // Call the groupBuilders function - let groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account + // $FlowFixMe + var groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account // for that size difference. if (baseOptions && options.size !== baseOptions.size) { groupNode = makeSpan$1(options.sizingClasses(baseOptions), [groupNode], options); - const multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; + var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; groupNode.height *= multiplier; groupNode.depth *= multiplier; } @@ -6430,11 +6278,11 @@ const buildGroup = function buildGroup(group, options, baseOptions) { function buildHTMLUnbreakable(children, options) { // Compute height and depth of this chunk. - const body = makeSpan$1(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at + var body = makeSpan$1(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at // the height of the expression, and the bottom of the HTML element // falls at the depth of the expression. - const strut = makeSpan$1(["strut"]); + var strut = makeSpan$1(["strut"]); strut.style.height = body.height + body.depth + "em"; strut.style.verticalAlign = -body.depth + "em"; body.children.unshift(strut); @@ -6448,7 +6296,7 @@ function buildHTMLUnbreakable(children, options) { function buildHTML(tree, options) { // Strip off outer tag wrapper for processing below. - let tag = null; + var tag = null; if (tree.length === 1 && tree[0].type === "tag") { tag = tree[0].tag; @@ -6456,23 +6304,30 @@ function buildHTML(tree, options) { } // Build the expression contained in the tree - const expression = buildExpression(tree, options, "root"); - const children = []; // Create one base node for each chunk between potential line breaks. + var expression = buildExpression(tree, options, "root"); + var eqnNum; + + if (expression.length === 2 && expression[1].hasClass("tag")) { + // An environment with automatic equation numbers, e.g. {gather}. + eqnNum = expression.pop(); + } + + var children = []; // Create one base node for each chunk between potential line breaks. // The TeXBook [p.173] says "A formula will be broken only after a // relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary // operation symbol like $+$ or $-$ or $\times$, where the relation or // binary operation is on the ``outer level'' of the formula (i.e., not // enclosed in {...} and not part of an \over construction)." - let parts = []; + var parts = []; - for (let i = 0; i < expression.length; i++) { + for (var i = 0; i < expression.length; i++) { parts.push(expression[i]); if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) { // Put any post-operator glue on same line as operator. // Watch for \nobreak along the way, and stop at \newline. - let nobreak = false; + var nobreak = false; while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) { i++; @@ -6507,20 +6362,22 @@ function buildHTML(tree, options) { } // Now, if there was a tag, build it too and append it as a final child. - let tagChild; + var tagChild; if (tag) { tagChild = buildHTMLUnbreakable(buildExpression(tag, options, true)); tagChild.classes = ["tag"]; children.push(tagChild); + } else if (eqnNum) { + children.push(eqnNum); } - const htmlNode = makeSpan$1(["katex-html"], children); + var htmlNode = makeSpan$1(["katex-html"], children); htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children // (the height of the enclosing htmlNode) for proper vertical alignment. if (tagChild) { - const strut = tagChild.children[0]; + var strut = tagChild.children[0]; strut.style.height = htmlNode.height + htmlNode.depth + "em"; strut.style.verticalAlign = -htmlNode.depth + "em"; } @@ -6547,13 +6404,15 @@ function newDocumentFragment(children) { */ class MathNode { - constructor(type, children) { + constructor(type, children, classes) { this.type = void 0; this.attributes = void 0; this.children = void 0; + this.classes = void 0; this.type = type; this.attributes = {}; this.children = children || []; + this.classes = classes || []; } /** * Sets an attribute on a MathML node. MathML depends on attributes to convey a @@ -6578,15 +6437,19 @@ class MathNode { toNode() { - const node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); + var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); - for (const attr in this.attributes) { + for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } - for (let i = 0; i < this.children.length; i++) { + if (this.classes.length > 0) { + node.className = createClass(this.classes); + } + + for (var i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } @@ -6598,9 +6461,9 @@ class MathNode { toMarkup() { - let markup = "<" + this.type; // Add the attributes + var markup = "<" + this.type; // Add the attributes - for (const attr in this.attributes) { + for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { markup += " " + attr + "=\""; markup += utils.escape(this.attributes[attr]); @@ -6608,9 +6471,13 @@ class MathNode { } } + if (this.classes.length > 0) { + markup += " class =\"" + utils.escape(createClass(this.classes)) + "\""; + } + markup += ">"; - for (let i = 0; i < this.children.length; i++) { + for (var i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } @@ -6710,7 +6577,7 @@ class SpaceNode { if (this.character) { return document.createTextNode(this.character); } else { - const node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace"); + var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace"); node.setAttribute("width", this.width + "em"); return node; } @@ -6722,9 +6589,9 @@ class SpaceNode { toMarkup() { if (this.character) { - return `${this.character}`; + return "" + this.character + ""; } else { - return ``; + return ""; } } /** @@ -6759,7 +6626,7 @@ var mathMLTree = { * Takes a symbol and converts it into a MathML text node after performing * optional replacement from symbols.js. */ -const makeText = function makeText(text, mode, options) { +var makeText = function makeText(text, mode, options) { if (symbols[mode][text] && symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === "tt" || options.font && options.font.substr(4, 2) === "tt"))) { text = symbols[mode][text].replace; } @@ -6771,7 +6638,7 @@ const makeText = function makeText(text, mode, options) { * unless the array has length 1. Always returns a single node. */ -const makeRow = function makeRow(body) { +var makeRow = function makeRow(body) { if (body.length === 1) { return body[0]; } else { @@ -6782,7 +6649,7 @@ const makeRow = function makeRow(body) { * Returns the math variant as a string or null if none is required. */ -const getVariant = function getVariant(group, options) { +var getVariant = function getVariant(group, options) { // Handle \text... font specifiers as best we can. // MathML has a limited list of allowable mathvariant specifiers; see // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt @@ -6806,13 +6673,13 @@ const getVariant = function getVariant(group, options) { return "bold"; } - const font = options.font; + var font = options.font; if (!font || font === "mathnormal") { return null; } - const mode = group.mode; + var mode = group.mode; if (font === "mathit") { return "italic"; @@ -6833,7 +6700,7 @@ const getVariant = function getVariant(group, options) { return "monospace"; } - let text = group.text; + var text = group.text; if (utils.contains(["\\imath", "\\jmath"], text)) { return null; @@ -6843,7 +6710,7 @@ const getVariant = function getVariant(group, options) { text = symbols[mode][text].replace; } - const fontName = buildCommon.fontMap[font].fontName; + var fontName = buildCommon.fontMap[font].fontName; if (getCharacterMetrics(text, fontName, mode)) { return buildCommon.fontMap[font].variant; @@ -6857,9 +6724,9 @@ const getVariant = function getVariant(group, options) { * tag. */ -const buildExpression$1 = function buildExpression(expression, options, isOrdgroup) { +var buildExpression$1 = function buildExpression(expression, options, isOrdgroup) { if (expression.length === 1) { - const group = buildGroup$1(expression[0], options); + var group = buildGroup$1(expression[0], options); if (isOrdgroup && group instanceof MathNode && group.type === "mo") { // When TeX writers want to suppress spacing on an operator, @@ -6871,44 +6738,44 @@ const buildExpression$1 = function buildExpression(expression, options, isOrdgro return [group]; } - const groups = []; - let lastGroup; + var groups = []; + var lastGroup; - for (let i = 0; i < expression.length; i++) { - const group = buildGroup$1(expression[i], options); + for (var i = 0; i < expression.length; i++) { + var _group = buildGroup$1(expression[i], options); - if (group instanceof MathNode && lastGroup instanceof MathNode) { + if (_group instanceof MathNode && lastGroup instanceof MathNode) { // Concatenate adjacent s - if (group.type === 'mtext' && lastGroup.type === 'mtext' && group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) { - lastGroup.children.push(...group.children); + if (_group.type === 'mtext' && lastGroup.type === 'mtext' && _group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) { + lastGroup.children.push(..._group.children); continue; // Concatenate adjacent s - } else if (group.type === 'mn' && lastGroup.type === 'mn') { - lastGroup.children.push(...group.children); + } else if (_group.type === 'mn' && lastGroup.type === 'mn') { + lastGroup.children.push(..._group.children); continue; // Concatenate ... followed by . - } else if (group.type === 'mi' && group.children.length === 1 && lastGroup.type === 'mn') { - const child = group.children[0]; + } else if (_group.type === 'mi' && _group.children.length === 1 && lastGroup.type === 'mn') { + var child = _group.children[0]; if (child instanceof TextNode && child.text === '.') { - lastGroup.children.push(...group.children); + lastGroup.children.push(..._group.children); continue; } } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) { - const lastChild = lastGroup.children[0]; + var lastChild = lastGroup.children[0]; - if (lastChild instanceof TextNode && lastChild.text === '\u0338' && (group.type === 'mo' || group.type === 'mi' || group.type === 'mn')) { - const child = group.children[0]; + if (lastChild instanceof TextNode && lastChild.text === '\u0338' && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) { + var _child = _group.children[0]; - if (child instanceof TextNode && child.text.length > 0) { + if (_child instanceof TextNode && _child.text.length > 0) { // Overlay with combining character long solidus - child.text = child.text.slice(0, 1) + "\u0338" + child.text.slice(1); + _child.text = _child.text.slice(0, 1) + "\u0338" + _child.text.slice(1); groups.pop(); } } } } - groups.push(group); - lastGroup = group; + groups.push(_group); + lastGroup = _group; } return groups; @@ -6918,7 +6785,7 @@ const buildExpression$1 = function buildExpression(expression, options, isOrdgro * if there's more than one. Returns a single node instead of an array. */ -const buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) { +var buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) { return makeRow(buildExpression$1(expression, options, isOrdgroup)); }; /** @@ -6926,14 +6793,16 @@ const buildExpressionRow = function buildExpressionRow(expression, options, isOr * on it to produce a MathML node. */ -const buildGroup$1 = function buildGroup(group, options) { +var buildGroup$1 = function buildGroup(group, options) { if (!group) { return new mathMLTree.MathNode("mrow"); } if (_mathmlGroupBuilders[group.type]) { // Call the groupBuilders function - const result = _mathmlGroupBuilders[group.type](group, options); + // $FlowFixMe + var result = _mathmlGroupBuilders[group.type](group, options); // $FlowFixMe + return result; } else { throw new ParseError("Got group of unknown type: '" + group.type + "'"); @@ -6949,10 +6818,14 @@ const buildGroup$1 = function buildGroup(group, options) { */ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) { - const expression = buildExpression$1(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics + var expression = buildExpression$1(tree, options); // TODO: Make a pass thru the MathML similar to buildHTML.traverseNonSpaceNodes + // and add spacing nodes. This is necessary only adjacent to math operators + // like \sin or \lim or to subsup elements that contain math operators. + // MathML takes care of the other spacing issues. + // Wrap up the expression in an mrow so it is presented in the semantics // tag correctly, unless it's a single or . - let wrapper; + var wrapper; if (expression.length === 1 && expression[0] instanceof MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) { wrapper = expression[0]; @@ -6961,10 +6834,10 @@ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) } // Build a TeX annotation of the source - const annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]); + var annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]); annotation.setAttribute("encoding", "application/x-tex"); - const semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]); - const math = new mathMLTree.MathNode("math", [semantics]); + var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]); + var math = new mathMLTree.MathNode("math", [semantics]); math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"); if (isDisplayMode) { @@ -6975,12 +6848,12 @@ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) // of span are expected to have more fields in `buildHtml` contexts. - const wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; // $FlowFixMe + var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; // $FlowFixMe return buildCommon.makeSpan([wrapperClass], [math]); } -const optionsFromSettings = function optionsFromSettings(settings) { +var optionsFromSettings = function optionsFromSettings(settings) { return new Options({ style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT, maxSize: settings.maxSize, @@ -6988,9 +6861,9 @@ const optionsFromSettings = function optionsFromSettings(settings) { }); }; -const displayWrap = function displayWrap(node, settings) { +var displayWrap = function displayWrap(node, settings) { if (settings.displayMode) { - const classes = ["katex-display"]; + var classes = ["katex-display"]; if (settings.leqno) { classes.push("leqno"); @@ -7006,27 +6879,29 @@ const displayWrap = function displayWrap(node, settings) { return node; }; -const buildTree = function buildTree(tree, expression, settings) { - const options = optionsFromSettings(settings); - let katexNode; +var buildTree = function buildTree(tree, expression, settings) { + var options = optionsFromSettings(settings); + var katexNode; if (settings.output === "mathml") { return buildMathML(tree, expression, options, settings.displayMode, true); } else if (settings.output === "html") { - const htmlNode = buildHTML(tree, options); + var htmlNode = buildHTML(tree, options); katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); } else { - const mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false); - const htmlNode = buildHTML(tree, options); - katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, htmlNode]); + var mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false); + + var _htmlNode = buildHTML(tree, options); + + katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]); } return displayWrap(katexNode, settings); }; -const buildHTMLTree = function buildHTMLTree(tree, expression, settings) { - const options = optionsFromSettings(settings); - const htmlNode = buildHTML(tree, options); - const katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); +var buildHTMLTree = function buildHTMLTree(tree, expression, settings) { + var options = optionsFromSettings(settings); + var htmlNode = buildHTML(tree, options); + var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); return displayWrap(katexNode, settings); }; @@ -7035,7 +6910,7 @@ const buildHTMLTree = function buildHTMLTree(tree, expression, settings) { * for stretchy wide elements rendered from SVG files * and other CSS trickery. */ -const stretchyCodePoint = { +var stretchyCodePoint = { widehat: "^", widecheck: "ˇ", widetilde: "~", @@ -7075,12 +6950,15 @@ const stretchyCodePoint = { xrightleftarrows: "\u21c4", xrightequilibrium: "\u21cc", // Not a perfect match. - xleftequilibrium: "\u21cb" // None better available. - + xleftequilibrium: "\u21cb", + // None better available. + "\\\\cdrightarrow": "\u2192", + "\\\\cdleftarrow": "\u2190", + "\\\\cdlongequal": "=" }; -const mathMLnode = function mathMLnode(label) { - const node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.substr(1)])]); +var mathMLnode = function mathMLnode(label) { + var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label])]); node.setAttribute("stretchy", "true"); return node; }; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts. @@ -7121,14 +6999,17 @@ const mathMLnode = function mathMLnode(label) { // corresponds to 0.522 em inside the document. -const katexImagesData = { +var katexImagesData = { // path(s), minWidth, height, align overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], + "\\cdrightarrow": [["rightarrow"], 3.0, 522, "xMaxYMin"], + // CD minwwidth2.5pc xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], + "\\cdleftarrow": [["leftarrow"], 3.0, 522, "xMinYMin"], Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], @@ -7139,6 +7020,7 @@ const katexImagesData = { xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], + "\\cdlongequal": [["longequal"], 3.0, 334, "xMinYMin"], xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], @@ -7166,7 +7048,7 @@ const katexImagesData = { xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716] }; -const groupLength = function groupLength(arg) { +var groupLength = function groupLength(arg) { if (arg.type === "ordgroup") { return arg.body.length; } else { @@ -7174,78 +7056,80 @@ const groupLength = function groupLength(arg) { } }; -const svgSpan = function svgSpan(group, options) { +var svgSpan = function svgSpan(group, options) { // Create a span with inline SVG for the element. function buildSvgSpan_() { - let viewBoxWidth = 400000; // default + var viewBoxWidth = 400000; // default - const label = group.label.substr(1); + var label = group.label.substr(1); if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) { // Each type in the `if` statement corresponds to one of the ParseNode // types below. This narrowing is required to access `grp.base`. - const grp = group; // There are four SVG images available for each function. + // $FlowFixMe + var grp = group; // There are four SVG images available for each function. // Choose a taller image when there are more characters. - const numChars = groupLength(grp.base); - let viewBoxHeight; - let pathName; - let height; + var numChars = groupLength(grp.base); + var viewBoxHeight; + var pathName; + + var _height; if (numChars > 5) { if (label === "widehat" || label === "widecheck") { viewBoxHeight = 420; viewBoxWidth = 2364; - height = 0.42; + _height = 0.42; pathName = label + "4"; } else { viewBoxHeight = 312; viewBoxWidth = 2340; - height = 0.34; + _height = 0.34; pathName = "tilde4"; } } else { - const imgIndex = [1, 1, 2, 2, 3, 3][numChars]; + var imgIndex = [1, 1, 2, 2, 3, 3][numChars]; if (label === "widehat" || label === "widecheck") { viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; - height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; + _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; pathName = label + imgIndex; } else { viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; - height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; + _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; pathName = "tilde" + imgIndex; } } - const path = new PathNode(pathName); - const svgNode = new SvgNode([path], { + var path = new PathNode(pathName); + var svgNode = new SvgNode([path], { "width": "100%", - "height": height + "em", - "viewBox": `0 0 ${viewBoxWidth} ${viewBoxHeight}`, + "height": _height + "em", + "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight, "preserveAspectRatio": "none" }); return { span: buildCommon.makeSvgSpan([], [svgNode], options), minWidth: 0, - height + height: _height }; } else { - const spans = []; - const data = katexImagesData[label]; - const paths = data[0], - minWidth = data[1], - viewBoxHeight = data[2]; - const height = viewBoxHeight / 1000; - const numSvgChildren = paths.length; - let widthClasses; - let aligns; + var spans = []; + var data = katexImagesData[label]; + var [paths, _minWidth, _viewBoxHeight] = data; + + var _height2 = _viewBoxHeight / 1000; + + var numSvgChildren = paths.length; + var widthClasses; + var aligns; if (numSvgChildren === 1) { // $FlowFixMe: All these cases must be of the 4-tuple type. - const align1 = data[3]; + var align1 = data[3]; widthClasses = ["hide-tail"]; aligns = [align1]; } else if (numSvgChildren === 2) { @@ -7255,48 +7139,49 @@ const svgSpan = function svgSpan(group, options) { widthClasses = ["brace-left", "brace-center", "brace-right"]; aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; } else { - throw new Error(`Correct katexImagesData or update code here to support - ${numSvgChildren} children.`); + throw new Error("Correct katexImagesData or update code here to support\n " + numSvgChildren + " children."); } - for (let i = 0; i < numSvgChildren; i++) { - const path = new PathNode(paths[i]); - const svgNode = new SvgNode([path], { + for (var i = 0; i < numSvgChildren; i++) { + var _path = new PathNode(paths[i]); + + var _svgNode = new SvgNode([_path], { "width": "400em", - "height": height + "em", - "viewBox": `0 0 ${viewBoxWidth} ${viewBoxHeight}`, + "height": _height2 + "em", + "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight, "preserveAspectRatio": aligns[i] + " slice" }); - const span = buildCommon.makeSvgSpan([widthClasses[i]], [svgNode], options); + + var _span = buildCommon.makeSvgSpan([widthClasses[i]], [_svgNode], options); if (numSvgChildren === 1) { return { - span, - minWidth, - height + span: _span, + minWidth: _minWidth, + height: _height2 }; } else { - span.style.height = height + "em"; - spans.push(span); + _span.style.height = _height2 + "em"; + spans.push(_span); } } return { span: buildCommon.makeSpan(["stretchy"], spans, options), - minWidth, - height + minWidth: _minWidth, + height: _height2 }; } } // buildSvgSpan_() - const _buildSvgSpan_ = buildSvgSpan_(), - span = _buildSvgSpan_.span, - minWidth = _buildSvgSpan_.minWidth, - height = _buildSvgSpan_.height; // Note that we are returning span.depth = 0. + var { + span, + minWidth, + height + } = buildSvgSpan_(); // Note that we are returning span.depth = 0. // Any adjustments relative to the baseline must be done in buildHTML. - span.height = height; span.style.height = height + "em"; @@ -7307,16 +7192,16 @@ const svgSpan = function svgSpan(group, options) { return span; }; -const encloseSpan = function encloseSpan(inner, label, pad, options) { - // Return an image span for \cancel, \bcancel, \xcancel, or \fbox - let img; - const totalHeight = inner.height + inner.depth + 2 * pad; +var encloseSpan = function encloseSpan(inner, label, topPad, bottomPad, options) { + // Return an image span for \cancel, \bcancel, \xcancel, \fbox, or \angl + var img; + var totalHeight = inner.height + inner.depth + topPad + bottomPad; - if (/fbox|color/.test(label)) { + if (/fbox|color|angl/.test(label)) { img = buildCommon.makeSpan(["stretchy", label], [], options); if (label === "fbox") { - const color = options.color && options.getColor(); + var color = options.color && options.getColor(); if (color) { img.style.borderColor = color; @@ -7326,7 +7211,7 @@ const encloseSpan = function encloseSpan(inner, label, pad, options) { // \cancel, \bcancel, or \xcancel // Since \cancel's SVG is inline and it omits the viewBox attribute, // its stroke-width will not vary with span area. - const lines = []; + var lines = []; if (/^[bx]cancel$/.test(label)) { lines.push(new LineNode({ @@ -7348,7 +7233,7 @@ const encloseSpan = function encloseSpan(inner, label, pad, options) { })); } - const svgNode = new SvgNode(lines, { + var svgNode = new SvgNode(lines, { "width": "100%", "height": totalHeight + "em" }); @@ -7372,8 +7257,9 @@ var stretchy = { */ function assertNodeType(node, type) { if (!node || node.type !== type) { - throw new Error(`Expected node of type ${type}, but got ` + (node ? `node of type ${node.type}` : String(node))); - } + throw new Error("Expected node of type " + type + ", but got " + (node ? "node of type " + node.type : String(node))); + } // $FlowFixMe, >=0.125 + return node; } @@ -7383,10 +7269,10 @@ function assertNodeType(node, type) { */ function assertSymbolNodeType(node) { - const typedNode = checkSymbolNodeType(node); + var typedNode = checkSymbolNodeType(node); if (!typedNode) { - throw new Error(`Expected node of symbol group type, but got ` + (node ? `node of type ${node.type}` : String(node))); + throw new Error("Expected node of symbol group type, but got " + (node ? "node of type " + node.type : String(node))); } return typedNode; @@ -7406,11 +7292,12 @@ function checkSymbolNodeType(node) { } // NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but -const htmlBuilder = (grp, options) => { +// also "supsub" since an accent can affect super/subscripting. +var htmlBuilder = (grp, options) => { // Accents are handled in the TeXbook pg. 443, rule 12. - let base; - let group; - let supSubGroup; + var base; + var group; + var supSubGroup; if (grp && grp.type === "supsub") { // If our base is a character box, and we have superscripts and @@ -7437,22 +7324,22 @@ const htmlBuilder = (grp, options) => { } // Build the base group - const body = buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character? + var body = buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character? - const mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the + var mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the // nucleus is not a single character, let s = 0; otherwise set s to the // kern amount for the nucleus followed by the \skewchar of its font." // Note that our skew metrics are just the kern between each character // and the skewchar. - let skew = 0; + var skew = 0; if (mustShift) { // If the base is a character box, then we want the skew of the // innermost character. To do that, we find the innermost character: - const baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it + var baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it - const baseGroup = buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol. + var baseGroup = buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol. skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we // removed with getBaseElem might contain things like \color which @@ -7461,13 +7348,13 @@ const htmlBuilder = (grp, options) => { } // calculate the amount of space between the body and the accent - let clearance = Math.min(body.height, options.fontMetrics().xHeight); // Build the accent + var clearance = Math.min(body.height, options.fontMetrics().xHeight); // Build the accent - let accentBody; + var accentBody; if (!group.isStretchy) { - let accent; - let width; + var accent; + var width; if (group.label === "\\vec") { // Before version 0.9, \vec used the combining font glyph U+20D7. @@ -7493,7 +7380,7 @@ const htmlBuilder = (grp, options) => { // at least the width of the accent, and overlap directly onto the // character without any vertical offset. - const accentFull = group.label === "\\textcircled"; + var accentFull = group.label === "\\textcircled"; if (accentFull) { accentBody.classes.push('accent-full'); @@ -7501,7 +7388,7 @@ const htmlBuilder = (grp, options) => { } // Shift the accent over by the skew. - let left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }` + var left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }` // so that the accent doesn't contribute to the bounding box. // We need to shift the character by its width (effectively half // its width) to compensate. @@ -7542,14 +7429,14 @@ const htmlBuilder = (grp, options) => { elem: accentBody, wrapperClasses: ["svg-align"], wrapperStyle: skew > 0 ? { - width: `calc(100% - ${2 * skew}em)`, - marginLeft: `${2 * skew}em` + width: "calc(100% - " + 2 * skew + "em)", + marginLeft: 2 * skew + "em" } : undefined }] }, options); } - const accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options); + var accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options); if (supSubGroup) { // Here, we replace the "base" child of the supsub with our newly @@ -7566,14 +7453,14 @@ const htmlBuilder = (grp, options) => { } }; -const mathmlBuilder = (group, options) => { - const accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]); - const node = new mathMLTree.MathNode("mover", [buildGroup$1(group.base, options), accentNode]); +var mathmlBuilder = (group, options) => { + var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]); + var node = new mathMLTree.MathNode("mover", [buildGroup$1(group.base, options), accentNode]); node.setAttribute("accent", "true"); return node; }; -const NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map(accent => `\\${accent}`).join("|")); // Accents +var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map(accent => "\\" + accent).join("|")); // Accents defineFunction({ type: "accent", @@ -7582,9 +7469,9 @@ defineFunction({ numArgs: 1 }, handler: (context, args) => { - const base = args[0]; - const isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); - const isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck"; + var base = normalizeArgument(args[0]); + var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); + var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck"; return { type: "accent", mode: context.parser.mode, @@ -7604,10 +7491,11 @@ defineFunction({ props: { numArgs: 1, allowedInText: true, - allowedInMath: false + allowedInMath: false, + argTypes: ["primitive"] }, handler: (context, args) => { - const base = args[0]; + var base = args[0]; return { type: "accent", mode: context.parser.mode, @@ -7629,9 +7517,11 @@ defineFunction({ numArgs: 1 }, handler: (_ref, args) => { - let parser = _ref.parser, - funcName = _ref.funcName; - const base = args[0]; + var { + parser, + funcName + } = _ref; + var base = args[0]; return { type: "accentUnder", mode: parser.mode, @@ -7641,11 +7531,11 @@ defineFunction({ }, htmlBuilder: (group, options) => { // Treat under accents much like underlines. - const innerGroup = buildGroup(group.base, options); - const accentBody = stretchy.svgSpan(group, options); - const kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns + var innerGroup = buildGroup(group.base, options); + var accentBody = stretchy.svgSpan(group, options); + var kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns - const vlist = buildCommon.makeVList({ + var vlist = buildCommon.makeVList({ positionType: "top", positionData: innerGroup.height, children: [{ @@ -7663,16 +7553,16 @@ defineFunction({ return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options); }, mathmlBuilder: (group, options) => { - const accentNode = stretchy.mathMLnode(group.label); - const node = new mathMLTree.MathNode("munder", [buildGroup$1(group.base, options), accentNode]); + var accentNode = stretchy.mathMLnode(group.label); + var node = new mathMLTree.MathNode("munder", [buildGroup$1(group.base, options), accentNode]); node.setAttribute("accentunder", "true"); return node; } }); // Helper function -const paddedNode = group => { - const node = new mathMLTree.MathNode("mpadded", group ? [group] : []); +var paddedNode = group => { + var node = new mathMLTree.MathNode("mpadded", group ? [group] : []); node.setAttribute("width", "+0.6em"); node.setAttribute("lspace", "0.3em"); return node; @@ -7683,15 +7573,18 @@ defineFunction({ type: "xArrow", names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension. // Direct use of these functions is discouraged and may break someday. - "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium"], + "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium", // The next 3 functions are here only to support the {CD} environment. + "\\\\cdrightarrow", "\\\\cdleftarrow", "\\\\cdlongequal"], props: { numArgs: 1, numOptionalArgs: 1 }, handler(_ref, args, optArgs) { - let parser = _ref.parser, - funcName = _ref.funcName; + var { + parser, + funcName + } = _ref; return { type: "xArrow", mode: parser.mode, @@ -7704,39 +7597,40 @@ defineFunction({ // Flow is unable to correctly infer the type of `group`, even though it's // unamibiguously determined from the passed-in `type` above. htmlBuilder(group, options) { - const style = options.style; // Build the argument groups in the appropriate style. + var style = options.style; // Build the argument groups in the appropriate style. // Ref: amsmath.dtx: \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% // Some groups can return document fragments. Handle those by wrapping // them in a span. - let newOptions = options.havingStyle(style.sup()); - const upperGroup = buildCommon.wrapFragment(buildGroup(group.body, newOptions, options), options); - upperGroup.classes.push("x-arrow-pad"); - let lowerGroup; + var newOptions = options.havingStyle(style.sup()); + var upperGroup = buildCommon.wrapFragment(buildGroup(group.body, newOptions, options), options); + var arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd"; + upperGroup.classes.push(arrowPrefix + "-arrow-pad"); + var lowerGroup; if (group.below) { // Build the lower group newOptions = options.havingStyle(style.sub()); lowerGroup = buildCommon.wrapFragment(buildGroup(group.below, newOptions, options), options); - lowerGroup.classes.push("x-arrow-pad"); + lowerGroup.classes.push(arrowPrefix + "-arrow-pad"); } - const arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0. + var arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0. // The point we want on the math axis is at 0.5 * arrowBody.height. - const arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi + var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi - let upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu + var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") { upperShift -= upperGroup.depth; // shift up if depth encroaches } // Generate the vlist - let vlist; + var vlist; if (lowerGroup) { - const lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111; + var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111; vlist = buildCommon.makeVList({ positionType: "individualShift", children: [{ @@ -7774,21 +7668,23 @@ defineFunction({ }, mathmlBuilder(group, options) { - const arrowNode = stretchy.mathMLnode(group.label); - let node; + var arrowNode = stretchy.mathMLnode(group.label); + arrowNode.setAttribute("minsize", group.label.charAt(0) === "x" ? "1.75em" : "3.0em"); + var node; if (group.body) { - const upperNode = paddedNode(buildGroup$1(group.body, options)); + var upperNode = paddedNode(buildGroup$1(group.body, options)); if (group.below) { - const lowerNode = paddedNode(buildGroup$1(group.below, options)); + var lowerNode = paddedNode(buildGroup$1(group.below, options)); node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]); } else { node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]); } } else if (group.below) { - const lowerNode = paddedNode(buildGroup$1(group.below, options)); - node = new mathMLTree.MathNode("munder", [arrowNode, lowerNode]); + var _lowerNode = paddedNode(buildGroup$1(group.below, options)); + + node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]); } else { // This should never happen. // Parser.js throws an error if there is no argument. @@ -7801,6 +7697,330 @@ defineFunction({ }); +var cdArrowFunctionName = { + ">": "\\\\cdrightarrow", + "<": "\\\\cdleftarrow", + "=": "\\\\cdlongequal", + "A": "\\uparrow", + "V": "\\downarrow", + "|": "\\Vert", + ".": "no arrow" +}; + +var newCell = () => { + // Create an empty cell, to be filled below with parse nodes. + // The parseTree from this module must be constructed like the + // one created by parseArray(), so an empty CD cell must + // be a ParseNode<"styling">. And CD is always displaystyle. + // So these values are fixed and flow can do implicit typing. + return { + type: "styling", + body: [], + mode: "math", + style: "display" + }; +}; + +var isStartOfArrow = node => { + return node.type === "textord" && node.text === "@"; +}; + +var isLabelEnd = (node, endChar) => { + return (node.type === "mathord" || node.type === "atom") && node.text === endChar; +}; + +function cdArrow(arrowChar, labels, parser) { + // Return a parse tree of an arrow and its labels. + // This acts in a way similar to a macro expansion. + var funcName = cdArrowFunctionName[arrowChar]; + + switch (funcName) { + case "\\\\cdrightarrow": + case "\\\\cdleftarrow": + return parser.callFunction(funcName, [labels[0]], [labels[1]]); + + case "\\uparrow": + case "\\downarrow": + { + var leftLabel = parser.callFunction("\\\\cdleft", [labels[0]], []); + var bareArrow = { + type: "atom", + text: funcName, + mode: "math", + family: "rel" + }; + var sizedArrow = parser.callFunction("\\Big", [bareArrow], []); + var rightLabel = parser.callFunction("\\\\cdright", [labels[1]], []); + var arrowGroup = { + type: "ordgroup", + mode: "math", + body: [leftLabel, sizedArrow, rightLabel] + }; + return parser.callFunction("\\\\cdparent", [arrowGroup], []); + } + + case "\\\\cdlongequal": + return parser.callFunction("\\\\cdlongequal", [], []); + + case "\\Vert": + { + var arrow = { + type: "textord", + text: "\\Vert", + mode: "math" + }; + return parser.callFunction("\\Big", [arrow], []); + } + + default: + return { + type: "textord", + text: " ", + mode: "math" + }; + } +} + +function parseCD(parser) { + // Get the array's parse nodes with \\ temporarily mapped to \cr. + var parsedRows = []; + parser.gullet.beginGroup(); + parser.gullet.macros.set("\\cr", "\\\\\\relax"); + parser.gullet.beginGroup(); + + while (true) { + // eslint-disable-line no-constant-condition + // Get the parse nodes for the next row. + parsedRows.push(parser.parseExpression(false, "\\\\")); + parser.gullet.endGroup(); + parser.gullet.beginGroup(); + var next = parser.fetch().text; + + if (next === "&" || next === "\\\\") { + parser.consume(); + } else if (next === "\\end") { + if (parsedRows[parsedRows.length - 1].length === 0) { + parsedRows.pop(); // final row ended in \\ + } + + break; + } else { + throw new ParseError("Expected \\\\ or \\cr or \\end", parser.nextToken); + } + } + + var row = []; + var body = [row]; // Loop thru the parse nodes. Collect them into cells and arrows. + + for (var i = 0; i < parsedRows.length; i++) { + // Start a new row. + var rowNodes = parsedRows[i]; // Create the first cell. + + var cell = newCell(); + + for (var j = 0; j < rowNodes.length; j++) { + if (!isStartOfArrow(rowNodes[j])) { + // If a parseNode is not an arrow, it goes into a cell. + cell.body.push(rowNodes[j]); + } else { + // Parse node j is an "@", the start of an arrow. + // Before starting on the arrow, push the cell into `row`. + row.push(cell); // Now collect parseNodes into an arrow. + // The character after "@" defines the arrow type. + + j += 1; + var arrowChar = assertSymbolNodeType(rowNodes[j]).text; // Create two empty label nodes. We may or may not use them. + + var labels = new Array(2); + labels[0] = { + type: "ordgroup", + mode: "math", + body: [] + }; + labels[1] = { + type: "ordgroup", + mode: "math", + body: [] + }; // Process the arrow. + + if ("=|.".indexOf(arrowChar) > -1) ; else if ("<>AV".indexOf(arrowChar) > -1) { + // Four arrows, `@>>>`, `@<<<`, `@AAA`, and `@VVV`, each take + // two optional labels. E.g. the right-point arrow syntax is + // really: @>{optional label}>{optional label}> + // Collect parseNodes into labels. + for (var labelNum = 0; labelNum < 2; labelNum++) { + var inLabel = true; + + for (var k = j + 1; k < rowNodes.length; k++) { + if (isLabelEnd(rowNodes[k], arrowChar)) { + inLabel = false; + j = k; + break; + } + + if (isStartOfArrow(rowNodes[k])) { + throw new ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[k]); + } + + labels[labelNum].body.push(rowNodes[k]); + } + + if (inLabel) { + // isLabelEnd never returned a true. + throw new ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[j]); + } + } + } else { + throw new ParseError("Expected one of \"<>AV=|.\" after @", rowNodes[j]); + } // Now join the arrow to its labels. + + + var arrow = cdArrow(arrowChar, labels, parser); // Wrap the arrow in ParseNode<"styling">. + // This is done to match parseArray() behavior. + + var wrappedArrow = { + type: "styling", + body: [arrow], + mode: "math", + style: "display" // CD is always displaystyle. + + }; + row.push(wrappedArrow); // In CD's syntax, cells are implicit. That is, everything that + // is not an arrow gets collected into a cell. So create an empty + // cell now. It will collect upcoming parseNodes. + + cell = newCell(); + } + } + + if (i % 2 === 0) { + // Even-numbered rows consist of: cell, arrow, cell, arrow, ... cell + // The last cell is not yet pushed into `row`, so: + row.push(cell); + } else { + // Odd-numbered rows consist of: vert arrow, empty cell, ... vert arrow + // Remove the empty cell that was placed at the beginning of `row`. + row.shift(); + } + + row = []; + body.push(row); + } // End row group + + + parser.gullet.endGroup(); // End array group defining \\ + + parser.gullet.endGroup(); // define column separation. + + var cols = new Array(body[0].length).fill({ + type: "align", + align: "c", + pregap: 0.25, + // CD package sets \enskip between columns. + postgap: 0.25 // So pre and post each get half an \enskip, i.e. 0.25em. + + }); + return { + type: "array", + mode: "math", + body, + arraystretch: 1, + addJot: true, + rowGaps: [null], + cols, + colSeparationType: "CD", + hLinesBeforeRow: new Array(body.length + 1).fill([]) + }; +} // The functions below are not available for general use. +// They are here only for internal use by the {CD} environment in placing labels +// next to vertical arrows. +// We don't need any such functions for horizontal arrows because we can reuse +// the functionality that already exists for extensible arrows. + +defineFunction({ + type: "cdlabel", + names: ["\\\\cdleft", "\\\\cdright"], + props: { + numArgs: 1 + }, + + handler(_ref, args) { + var { + parser, + funcName + } = _ref; + return { + type: "cdlabel", + mode: parser.mode, + side: funcName.slice(4), + label: args[0] + }; + }, + + htmlBuilder(group, options) { + var newOptions = options.havingStyle(options.style.sup()); + var label = buildCommon.wrapFragment(buildGroup(group.label, newOptions, options), options); + label.classes.push("cd-label-" + group.side); + label.style.bottom = 0.8 - label.depth + "em"; // Zero out label height & depth, so vertical align of arrow is set + // by the arrow height, not by the label. + + label.height = 0; + label.depth = 0; + return label; + }, + + mathmlBuilder(group, options) { + var label = new mathMLTree.MathNode("mrow", [buildGroup$1(group.label, options)]); + label = new mathMLTree.MathNode("mpadded", [label]); + label.setAttribute("width", "0"); + + if (group.side === "left") { + label.setAttribute("lspace", "-1width"); + } // We have to guess at vertical alignment. We know the arrow is 1.8em tall, + // But we don't know the height or depth of the label. + + + label.setAttribute("voffset", "0.7em"); + label = new mathMLTree.MathNode("mstyle", [label]); + label.setAttribute("displaystyle", "false"); + label.setAttribute("scriptlevel", "1"); + return label; + } + +}); +defineFunction({ + type: "cdlabelparent", + names: ["\\\\cdparent"], + props: { + numArgs: 1 + }, + + handler(_ref2, args) { + var { + parser + } = _ref2; + return { + type: "cdlabelparent", + mode: parser.mode, + fragment: args[0] + }; + }, + + htmlBuilder(group, options) { + // Wrap the vertical arrow and its labels. + // The parent gets position: relative. The child gets position: absolute. + // So CSS can locate the label correctly. + var parent = buildCommon.wrapFragment(buildGroup(group.fragment, options), options); + parent.classes.push("cd-vert-arrow"); + return parent; + }, + + mathmlBuilder(group, options) { + return new mathMLTree.MathNode("mrow", [buildGroup$1(group.fragment, options)]); + } + +}); + // {123} and converts into symbol with code 123. It is used by the *macro* // \char defined in macros.js. @@ -7813,20 +8033,22 @@ defineFunction({ }, handler(_ref, args) { - let parser = _ref.parser; - const arg = assertNodeType(args[0], "ordgroup"); - const group = arg.body; - let number = ""; + var { + parser + } = _ref; + var arg = assertNodeType(args[0], "ordgroup"); + var group = arg.body; + var number = ""; - for (let i = 0; i < group.length; i++) { - const node = assertNodeType(group[i], "textord"); + for (var i = 0; i < group.length; i++) { + var node = assertNodeType(group[i], "textord"); number += node.text; } - const code = parseInt(number); + var code = parseInt(number); if (isNaN(code)) { - throw new ParseError(`\\@char has non-numeric argument ${number}`); + throw new ParseError("\\@char has non-numeric argument " + number); } return { @@ -7838,8 +8060,8 @@ defineFunction({ }); -const htmlBuilder$1 = (group, options) => { - const elements = buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains. +var htmlBuilder$1 = (group, options) => { + var elements = buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains. // To accomplish this, we wrap the results in a fragment, so the inner // elements will be able to directly interact with their neighbors. For // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` @@ -7847,9 +8069,9 @@ const htmlBuilder$1 = (group, options) => { return buildCommon.makeFragment(elements); }; -const mathmlBuilder$1 = (group, options) => { - const inner = buildExpression$1(group.body, options.withColor(group.color)); - const node = new mathMLTree.MathNode("mstyle", inner); +var mathmlBuilder$1 = (group, options) => { + var inner = buildExpression$1(group.body, options.withColor(group.color)); + var node = new mathMLTree.MathNode("mstyle", inner); node.setAttribute("mathcolor", group.color); return node; }; @@ -7860,14 +8082,15 @@ defineFunction({ props: { numArgs: 2, allowedInText: true, - greediness: 3, argTypes: ["color", "original"] }, handler(_ref, args) { - let parser = _ref.parser; - const color = assertNodeType(args[0], "color-token").color; - const body = args[1]; + var { + parser + } = _ref; + var color = assertNodeType(args[0], "color-token").color; + var body = args[1]; return { type: "color", mode: parser.mode, @@ -7885,21 +8108,22 @@ defineFunction({ props: { numArgs: 1, allowedInText: true, - greediness: 3, argTypes: ["color"] }, handler(_ref2, args) { - let parser = _ref2.parser, - breakOnTokenText = _ref2.breakOnTokenText; - const color = assertNodeType(args[0], "color-token").color; // Set macro \current@color in current namespace to store the current + var { + parser, + breakOnTokenText + } = _ref2; + var color = assertNodeType(args[0], "color-token").color; // Set macro \current@color in current namespace to store the current // color, mimicking the behavior of color.sty. // This is currently used just to correctly color a \right // that follows a \color command. parser.gullet.macros.set("\\current@color", color); // Parse out the implicit body that should be colored. - const body = parser.parseExpression(true, breakOnTokenText); + var body = parser.parseExpression(true, breakOnTokenText); return { type: "color", mode: parser.mode, @@ -7913,13 +8137,10 @@ defineFunction({ }); // Row breaks within tabular environments, and line breaks at top level -// same signature, we implement them as one megafunction, with newRow -// indicating whether we're in the \cr case, and newLine indicating whether -// to break the line in the \newline case. defineFunction({ type: "cr", - names: ["\\cr", "\\newline"], + names: ["\\\\"], props: { numArgs: 0, numOptionalArgs: 1, @@ -7928,25 +8149,15 @@ defineFunction({ }, handler(_ref, args, optArgs) { - let parser = _ref.parser, - funcName = _ref.funcName; - const size = optArgs[0]; - const newRow = funcName === "\\cr"; - let newLine = false; - - if (!newRow) { - if (parser.settings.displayMode && parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode")) { - newLine = false; - } else { - newLine = true; - } - } - + var { + parser + } = _ref; + var size = optArgs[0]; + var newLine = !parser.settings.displayMode || !parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode"); return { type: "cr", mode: parser.mode, newLine, - newRow, size: size && assertNodeType(size, "size").value }; }, @@ -7954,11 +8165,7 @@ defineFunction({ // The following builders are called only at the top level, // not within tabular/array environments. htmlBuilder(group, options) { - if (group.newRow) { - throw new ParseError("\\cr valid only within a tabular/array environment"); - } - - const span = buildCommon.makeSpan(["mspace"], [], options); + var span = buildCommon.makeSpan(["mspace"], [], options); if (group.newLine) { span.classes.push("newline"); @@ -7972,7 +8179,7 @@ defineFunction({ }, mathmlBuilder(group, options) { - const node = new mathMLTree.MathNode("mspace"); + var node = new mathMLTree.MathNode("mspace"); if (group.newLine) { node.setAttribute("linebreak", "newline"); @@ -7987,7 +8194,7 @@ defineFunction({ }); -const globalMap = { +var globalMap = { "\\global": "\\global", "\\long": "\\\\globallong", "\\\\globallong": "\\\\globallong", @@ -7999,8 +8206,8 @@ const globalMap = { "\\futurelet": "\\\\globalfuture" }; -const checkControlSequence = tok => { - const name = tok.text; +var checkControlSequence = tok => { + var name = tok.text; if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { throw new ParseError("Expected a control sequence", tok); @@ -8009,8 +8216,8 @@ const checkControlSequence = tok => { return name; }; -const getRHS = parser => { - let tok = parser.gullet.popToken(); +var getRHS = parser => { + var tok = parser.gullet.popToken(); if (tok.text === "=") { // consume optional equals @@ -8025,8 +8232,8 @@ const getRHS = parser => { return tok; }; -const letCommand = (parser, name, tok, global) => { - let macro = parser.gullet.macros.get(tok.text); +var letCommand = (parser, name, tok, global) => { + var macro = parser.gullet.macros.get(tok.text); if (macro == null) { // don't expand it later even if a macro with the same name is defined @@ -8049,17 +8256,20 @@ const letCommand = (parser, name, tok, global) => { defineFunction({ type: "internal", - names: ["\\global", "\\long", "\\\\globallong"], + names: ["\\global", "\\long", "\\\\globallong" // can’t be entered directly + ], props: { numArgs: 0, allowedInText: true }, handler(_ref) { - let parser = _ref.parser, - funcName = _ref.funcName; + var { + parser, + funcName + } = _ref; parser.consumeSpaces(); - const token = parser.fetch(); + var token = parser.fetch(); if (globalMap[token.text]) { // KaTeX doesn't have \par, so ignore \long @@ -8070,7 +8280,7 @@ defineFunction({ return assertNodeType(parser.parseFunction(), "internal"); } - throw new ParseError(`Invalid token after macro prefix`, token); + throw new ParseError("Invalid token after macro prefix", token); } }); // Basic support for macro definitions: \def, \gdef, \edef, \xdef @@ -8083,52 +8293,80 @@ defineFunction({ names: ["\\def", "\\gdef", "\\edef", "\\xdef"], props: { numArgs: 0, - allowedInText: true + allowedInText: true, + primitive: true }, handler(_ref2) { - let parser = _ref2.parser, - funcName = _ref2.funcName; - let arg = parser.gullet.consumeArgs(1)[0]; + var { + parser, + funcName + } = _ref2; + var tok = parser.gullet.popToken(); + var name = tok.text; - if (arg.length !== 1) { - throw new ParseError("\\gdef's first argument must be a macro name"); + if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { + throw new ParseError("Expected a control sequence", tok); } - const name = arg[0].text; // Count argument specifiers, and check they are in the order #1 #2 ... + var numArgs = 0; + var insert; + var delimiters = [[]]; // contains no braces - let numArgs = 0; - arg = parser.gullet.consumeArgs(1)[0]; + while (parser.gullet.future().text !== "{") { + tok = parser.gullet.popToken(); - while (arg.length === 1 && arg[0].text === "#") { - arg = parser.gullet.consumeArgs(1)[0]; + if (tok.text === "#") { + // If the very last character of the is #, so that + // this # is immediately followed by {, TeX will behave as if the { + // had been inserted at the right end of both the parameter text + // and the replacement text. + if (parser.gullet.future().text === "{") { + insert = parser.gullet.future(); + delimiters[numArgs].push("{"); + break; + } // A parameter, the first appearance of # must be followed by 1, + // the next by 2, and so on; up to nine #’s are allowed - if (arg.length !== 1) { - throw new ParseError(`Invalid argument number length "${arg.length}"`); + + tok = parser.gullet.popToken(); + + if (!/^[1-9]$/.test(tok.text)) { + throw new ParseError("Invalid argument number \"" + tok.text + "\""); + } + + if (parseInt(tok.text) !== numArgs + 1) { + throw new ParseError("Argument number \"" + tok.text + "\" out of order"); + } + + numArgs++; + delimiters.push([]); + } else if (tok.text === "EOF") { + throw new ParseError("Expected a macro definition"); + } else { + delimiters[numArgs].push(tok.text); } + } // replacement text, enclosed in '{' and '}' and properly nested - if (!/^[1-9]$/.test(arg[0].text)) { - throw new ParseError(`Invalid argument number "${arg[0].text}"`); - } - numArgs++; + var { + tokens + } = parser.gullet.consumeArg(); - if (parseInt(arg[0].text) !== numArgs) { - throw new ParseError(`Argument number "${arg[0].text}" out of order`); - } - - arg = parser.gullet.consumeArgs(1)[0]; + if (insert) { + tokens.unshift(insert); } if (funcName === "\\edef" || funcName === "\\xdef") { - arg = parser.gullet.expandTokens(arg); - arg.reverse(); // to fit in with stack order + tokens = parser.gullet.expandTokens(tokens); + tokens.reverse(); // to fit in with stack order } // Final arg is the expansion of the macro parser.gullet.macros.set(name, { - tokens: arg, - numArgs + tokens, + numArgs, + delimiters }, funcName === globalMap[funcName]); return { type: "internal", @@ -8143,18 +8381,22 @@ defineFunction({ defineFunction({ type: "internal", - names: ["\\let", "\\\\globallet"], + names: ["\\let", "\\\\globallet" // can’t be entered directly + ], props: { numArgs: 0, - allowedInText: true + allowedInText: true, + primitive: true }, handler(_ref3) { - let parser = _ref3.parser, - funcName = _ref3.funcName; - const name = checkControlSequence(parser.gullet.popToken()); + var { + parser, + funcName + } = _ref3; + var name = checkControlSequence(parser.gullet.popToken()); parser.gullet.consumeSpaces(); - const tok = getRHS(parser); + var tok = getRHS(parser); letCommand(parser, name, tok, funcName === "\\\\globallet"); return { type: "internal", @@ -8166,18 +8408,22 @@ defineFunction({ defineFunction({ type: "internal", - names: ["\\futurelet", "\\\\globalfuture"], + names: ["\\futurelet", "\\\\globalfuture" // can’t be entered directly + ], props: { numArgs: 0, - allowedInText: true + allowedInText: true, + primitive: true }, handler(_ref4) { - let parser = _ref4.parser, - funcName = _ref4.funcName; - const name = checkControlSequence(parser.gullet.popToken()); - const middle = parser.gullet.popToken(); - const tok = parser.gullet.popToken(); + var { + parser, + funcName + } = _ref4; + var name = checkControlSequence(parser.gullet.popToken()); + var middle = parser.gullet.popToken(); + var tok = parser.gullet.popToken(); letCommand(parser, name, tok, funcName === "\\\\globalfuture"); parser.gullet.pushToken(tok); parser.gullet.pushToken(middle); @@ -8215,12 +8461,12 @@ defineFunction({ * Get the metrics for a given symbol and font, after transformation (i.e. * after following replacement from symbols.js) */ -const getMetrics = function getMetrics(symbol, font, mode) { - const replace = symbols.math[symbol] && symbols.math[symbol].replace; - const metrics = getCharacterMetrics(replace || symbol, font, mode); +var getMetrics = function getMetrics(symbol, font, mode) { + var replace = symbols.math[symbol] && symbols.math[symbol].replace; + var metrics = getCharacterMetrics(replace || symbol, font, mode); if (!metrics) { - throw new Error(`Unsupported symbol ${symbol} and font size ${font}.`); + throw new Error("Unsupported symbol " + symbol + " and font size " + font + "."); } return metrics; @@ -8231,19 +8477,19 @@ const getMetrics = function getMetrics(symbol, font, mode) { */ -const styleWrap = function styleWrap(delim, toStyle, options, classes) { - const newOptions = options.havingBaseStyle(toStyle); - const span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options); - const delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; +var styleWrap = function styleWrap(delim, toStyle, options, classes) { + var newOptions = options.havingBaseStyle(toStyle); + var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options); + var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; span.height *= delimSizeMultiplier; span.depth *= delimSizeMultiplier; span.maxFontSize = newOptions.sizeMultiplier; return span; }; -const centerSpan = function centerSpan(span, options, style) { - const newOptions = options.havingBaseStyle(style); - const shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight; +var centerSpan = function centerSpan(span, options, style) { + var newOptions = options.havingBaseStyle(style); + var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight; span.classes.push("delimcenter"); span.style.top = shift + "em"; span.height -= shift; @@ -8256,9 +8502,9 @@ const centerSpan = function centerSpan(span, options, style) { */ -const makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { - const text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); - const span = styleWrap(text, style, options, classes); +var makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { + var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); + var span = styleWrap(text, style, options, classes); if (center) { centerSpan(span, options, style); @@ -8271,7 +8517,7 @@ const makeSmallDelim = function makeSmallDelim(delim, style, center, options, mo */ -const mathrmSize = function mathrmSize(value, size, mode, options) { +var mathrmSize = function mathrmSize(value, size, mode, options) { return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options); }; /** @@ -8280,9 +8526,9 @@ const mathrmSize = function mathrmSize(value, size, mode, options) { */ -const makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { - const inner = mathrmSize(delim, size, mode, options); - const span = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), Style$1.TEXT, options, classes); +var makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { + var inner = mathrmSize(delim, size, mode, options); + var span = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), Style$1.TEXT, options, classes); if (center) { centerSpan(span, options, Style$1.TEXT); @@ -8291,13 +8537,13 @@ const makeLargeDelim = function makeLargeDelim(delim, size, center, options, mod return span; }; /** - * Make an inner span with the given offset and in the given font. This is used - * in `makeStackedDelim` to make the stacking pieces for the delimiter. + * Make a span from a font glyph with the given offset and in the given font. + * This is used in makeStackedDelim to make the stacking pieces for the delimiter. */ -const makeInner = function makeInner(symbol, font, mode) { - let sizeClass; // Apply the correct CSS class to choose the right font. +var makeGlyphSpan = function makeGlyphSpan(symbol, font, mode) { + var sizeClass; // Apply the correct CSS class to choose the right font. if (font === "Size1-Regular") { sizeClass = "delim-size1"; @@ -8307,36 +8553,61 @@ const makeInner = function makeInner(symbol, font, mode) { sizeClass = "delim-size4"; } - const inner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element + var corner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element // in the appropriate tag that VList uses. return { type: "elem", - elem: inner + elem: corner }; -}; // Helper for makeStackedDelim - - -const lap = { - type: "kern", - size: -0.005 }; + +var makeInner = function makeInner(ch, height, options) { + // Create a span with inline SVG for the inner part of a tall stacked delimiter. + var width = fontMetricsData['Size4-Regular'][ch.charCodeAt(0)] ? fontMetricsData['Size4-Regular'][ch.charCodeAt(0)][4].toFixed(3) : fontMetricsData['Size1-Regular'][ch.charCodeAt(0)][4].toFixed(3); + var path = new PathNode("inner", innerPath(ch, Math.round(1000 * height))); + var svgNode = new SvgNode([path], { + "width": width + "em", + "height": height + "em", + // Override CSS rule `.katex svg { width: 100% }` + "style": "width:" + width + "em", + "viewBox": "0 0 " + 1000 * width + " " + Math.round(1000 * height), + "preserveAspectRatio": "xMinYMin" + }); + var span = buildCommon.makeSvgSpan([], [svgNode], options); + span.height = height; + span.style.height = height + "em"; + span.style.width = width + "em"; + return { + type: "elem", + elem: span + }; +}; // Helpers for makeStackedDelim + + +var lapInEms = 0.008; +var lap = { + type: "kern", + size: -1 * lapInEms +}; +var verts = ["|", "\\lvert", "\\rvert", "\\vert"]; +var doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"]; /** * Make a stacked delimiter out of a given delimiter, with the total height at * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook. */ -const makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { +var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { // There are four parts, the top, an optional middle, a repeated part, and a // bottom. - let top; - let middle; - let repeat; - let bottom; + var top; + var middle; + var repeat; + var bottom; top = repeat = bottom = delim; middle = null; // Also keep track of what font the delimiters are in - let font = "Size1-Regular"; // We set the parts and font based on the symbol. Note that we use + var font = "Size1-Regular"; // We set the parts and font based on the symbol. Note that we use // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the // repeats of the arrows @@ -8356,6 +8627,10 @@ const makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, o top = "\\Uparrow"; repeat = "\u2016"; bottom = "\\Downarrow"; + } else if (utils.contains(verts, delim)) { + repeat = "\u2223"; + } else if (utils.contains(doubleVerts, delim)) { + repeat = "\u2225"; } else if (delim === "[" || delim === "\\lbrack") { top = "\u23a1"; repeat = "\u23a2"; @@ -8427,136 +8702,88 @@ const makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, o } // Get the metrics of the four sections - const topMetrics = getMetrics(top, font, mode); - const topHeightTotal = topMetrics.height + topMetrics.depth; - const repeatMetrics = getMetrics(repeat, font, mode); - const repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; - const bottomMetrics = getMetrics(bottom, font, mode); - const bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; - let middleHeightTotal = 0; - let middleFactor = 1; + var topMetrics = getMetrics(top, font, mode); + var topHeightTotal = topMetrics.height + topMetrics.depth; + var repeatMetrics = getMetrics(repeat, font, mode); + var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; + var bottomMetrics = getMetrics(bottom, font, mode); + var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; + var middleHeightTotal = 0; + var middleFactor = 1; if (middle !== null) { - const middleMetrics = getMetrics(middle, font, mode); + var middleMetrics = getMetrics(middle, font, mode); middleHeightTotal = middleMetrics.height + middleMetrics.depth; middleFactor = 2; // repeat symmetrically above and below middle } // Calcuate the minimal height that the delimiter can have. // It is at least the size of the top, bottom, and optional middle combined. - const minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need + var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need - const repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); // Compute the total height of the delimiter including all the symbols + var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); // Compute the total height of the delimiter including all the symbols - const realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note + var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note // that in this context, "center" means that the delimiter should be // centered around the axis in the current style, while normally it is // centered around the axis in textstyle. - let axisHeight = options.fontMetrics().axisHeight; + var axisHeight = options.fontMetrics().axisHeight; if (center) { axisHeight *= options.sizeMultiplier; } // Calculate the depth - const depth = realHeightTotal / 2 - axisHeight; // This function differs from the TeX procedure in one way. - // We shift each repeat element downwards by 0.005em, to prevent a gap - // due to browser floating point rounding error. - // Then, at the last element-to element joint, we add one extra repeat - // element to cover the gap created by the shifts. - // Find the shift needed to align the upper end of the extra element at a point - // 0.005em above the lower end of the top element. + var depth = realHeightTotal / 2 - axisHeight; // Now, we start building the pieces that will go into the vlist + // Keep a list of the pieces of the stacked delimiter - const shiftOfExtraElement = (repeatCount + 1) * 0.005 - repeatHeightTotal; // Now, we start building the pieces that will go into the vlist - // Keep a list of the inner pieces + var stack = []; // Add the bottom symbol - const inners = []; // Add the bottom symbol - - inners.push(makeInner(bottom, font, mode)); + stack.push(makeGlyphSpan(bottom, font, mode)); + stack.push(lap); // overlap if (middle === null) { - // Add that many symbols - for (let i = 0; i < repeatCount; i++) { - inners.push(lap); // overlap - - inners.push(makeInner(repeat, font, mode)); - } + // The middle section will be an SVG. Make it an extra 0.016em tall. + // We'll overlap by 0.008em at top and bottom. + var innerHeight = realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms; + stack.push(makeInner(repeat, innerHeight, options)); } else { // When there is a middle bit, we need the middle part and two repeated // sections - for (let i = 0; i < repeatCount; i++) { - inners.push(lap); - inners.push(makeInner(repeat, font, mode)); - } // Insert one extra repeat element. + var _innerHeight = (realHeightTotal - topHeightTotal - bottomHeightTotal - middleHeightTotal) / 2 + 2 * lapInEms; + stack.push(makeInner(repeat, _innerHeight, options)); // Now insert the middle of the brace. - inners.push({ - type: "kern", - size: shiftOfExtraElement - }); - inners.push(makeInner(repeat, font, mode)); - inners.push(lap); // Now insert the middle of the brace. - - inners.push(makeInner(middle, font, mode)); - - for (let i = 0; i < repeatCount; i++) { - inners.push(lap); - inners.push(makeInner(repeat, font, mode)); - } - } // To cover the gap create by the overlaps, insert one more repeat element, - // at a position that juts 0.005 above the bottom of the top element. - - - if ((repeat === "\u239c" || repeat === "\u239f") && repeatCount === 0) { - // Parentheses need a short repeat element in order to avoid an overrun. - // We'll make a 0.3em tall element from a SVG. - const overlap = buildCommon.svgData.leftParenInner[2] / 2; - inners.push({ - type: "kern", - size: -overlap - }); - const pathName = repeat === "\u239c" ? "leftParenInner" : "rightParenInner"; - const innerSpan = buildCommon.staticSvg(pathName, options); - inners.push({ - type: "elem", - elem: innerSpan - }); - inners.push({ - type: "kern", - size: -overlap - }); - } else { - inners.push({ - type: "kern", - size: shiftOfExtraElement - }); - inners.push(makeInner(repeat, font, mode)); - inners.push(lap); + stack.push(lap); + stack.push(makeGlyphSpan(middle, font, mode)); + stack.push(lap); + stack.push(makeInner(repeat, _innerHeight, options)); } // Add the top symbol - inners.push(makeInner(top, font, mode)); // Finally, build the vlist + stack.push(lap); + stack.push(makeGlyphSpan(top, font, mode)); // Finally, build the vlist - const newOptions = options.havingBaseStyle(Style$1.TEXT); - const inner = buildCommon.makeVList({ + var newOptions = options.havingBaseStyle(Style$1.TEXT); + var inner = buildCommon.makeVList({ positionType: "bottom", positionData: depth, - children: inners + children: stack }, newOptions); return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), Style$1.TEXT, options, classes); }; // All surds have 0.08em padding above the viniculum inside the SVG. // That keeps browser span height rounding error from pinching the line. -const vbPad = 80; // padding above the surd, measured inside the viewBox. +var vbPad = 80; // padding above the surd, measured inside the viewBox. -const emPad = 0.08; // padding, in ems, measured in the document. +var emPad = 0.08; // padding, in ems, measured in the document. -const sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) { - const path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight); - const pathNode = new PathNode(sqrtName, path); - const svg = new SvgNode([pathNode], { +var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) { + var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight); + var pathNode = new PathNode(sqrtName, path); + var svg = new SvgNode([pathNode], { // Note: 1000:1 ratio of viewBox to document em width. "width": "400em", "height": height + "em", @@ -8570,23 +8797,23 @@ const sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum */ -const makeSqrtImage = function makeSqrtImage(height, options) { +var makeSqrtImage = function makeSqrtImage(height, options) { // Define a newOptions that removes the effect of size changes such as \Huge. // We don't pick different a height surd for \Huge. For it, we scale up. - const newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds. + var newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds. - const delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions); - let sizeMultiplier = newOptions.sizeMultiplier; // default + var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions); + var sizeMultiplier = newOptions.sizeMultiplier; // default // The standard sqrt SVGs each have a 0.04em thick viniculum. // If Settings.minRuleThickness is larger than that, we add extraViniculum. - const extraViniculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol. + var extraViniculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol. - let span; - let spanHeight = 0; - let texHeight = 0; - let viewBoxHeight = 0; - let advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd. + var span; + var spanHeight = 0; + var texHeight = 0; + var viewBoxHeight = 0; + var advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd. // Then browser rounding error on the parent span height will not // encroach on the ink of the viniculum. But that padding is not // included in the TeX-like `height` used for calculation of @@ -8642,20 +8869,20 @@ const makeSqrtImage = function makeSqrtImage(height, options) { // too large -const stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; // delimiters that always stack +var stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; // delimiters that always stack -const stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1"]; // and delimiters that never stack +var stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1"]; // and delimiters that never stack -const stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of +var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of // $\bigl| // \Bigl| \biggl| \Biggl| \showlists$ // Used to create stacked delimiters of appropriate sizes in makeSizedDelim. -const sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; +var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; /** * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4. */ -const makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { +var makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { // < and > turn into \langle and \rangle in delimiters if (delim === "<" || delim === "\\lt" || delim === "\u27e8") { delim = "\\langle"; @@ -8686,7 +8913,7 @@ const makeSizedDelim = function makeSizedDelim(delim, size, options, mode, class // Delimiters that never stack try small delimiters and large delimiters only -const stackNeverDelimiterSequence = [{ +var stackNeverDelimiterSequence = [{ type: "small", style: Style$1.SCRIPTSCRIPT }, { @@ -8709,7 +8936,7 @@ const stackNeverDelimiterSequence = [{ size: 4 }]; // Delimiters that always stack try the small delimiters first, then stack -const stackAlwaysDelimiterSequence = [{ +var stackAlwaysDelimiterSequence = [{ type: "small", style: Style$1.SCRIPTSCRIPT }, { @@ -8723,7 +8950,7 @@ const stackAlwaysDelimiterSequence = [{ }]; // Delimiters that stack when large try the small and then large delimiters, and // stack afterwards -const stackLargeDelimiterSequence = [{ +var stackLargeDelimiterSequence = [{ type: "small", style: Style$1.SCRIPTSCRIPT }, { @@ -8752,7 +8979,7 @@ const stackLargeDelimiterSequence = [{ * TODO(#963) Use more specific font family return type once that is introduced. */ -const delimTypeToFont = function delimTypeToFont(type) { +var delimTypeToFont = function delimTypeToFont(type) { if (type.type === "small") { return "Main-Regular"; } else if (type.type === "large") { @@ -8760,7 +8987,7 @@ const delimTypeToFont = function delimTypeToFont(type) { } else if (type.type === "stack") { return "Size4-Regular"; } else { - throw new Error(`Add support for delim type '${type.type}' here.`); + throw new Error("Add support for delim type '" + type.type + "' here."); } }; /** @@ -8769,25 +8996,25 @@ const delimTypeToFont = function delimTypeToFont(type) { */ -const traverseSequence = function traverseSequence(delim, height, sequence, options) { +var traverseSequence = function traverseSequence(delim, height, sequence, options) { // Here, we choose the index we should start at in the sequences. In smaller // sizes (which correspond to larger numbers in style.size) we start earlier // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2 - const start = Math.min(2, 3 - options.style.size); + var start = Math.min(2, 3 - options.style.size); - for (let i = start; i < sequence.length; i++) { + for (var i = start; i < sequence.length; i++) { if (sequence[i].type === "stack") { // This is always the last delimiter, so we just break the loop now. break; } - const metrics = getMetrics(delim, delimTypeToFont(sequence[i]), "math"); - let heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we + var metrics = getMetrics(delim, delimTypeToFont(sequence[i]), "math"); + var heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we // account for the style change size. if (sequence[i].type === "small") { - const newOptions = options.havingBaseStyle(sequence[i].style); + var newOptions = options.havingBaseStyle(sequence[i].style); heightDepth *= newOptions.sizeMultiplier; } // Check if the delimiter at this size works for the given height. @@ -8806,7 +9033,7 @@ const traverseSequence = function traverseSequence(delim, height, sequence, opti */ -const makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { +var makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { if (delim === "<" || delim === "\\lt" || delim === "\u27e8") { delim = "\\langle"; } else if (delim === ">" || delim === "\\gt" || delim === "\u27e9") { @@ -8814,7 +9041,7 @@ const makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center } // Decide what sequence to use - let sequence; + var sequence; if (utils.contains(stackNeverDelimiters, delim)) { sequence = stackNeverDelimiterSequence; @@ -8825,7 +9052,7 @@ const makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center } // Look through the sequence - const delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs. + var delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs. // Depending on the sequence element we decided on, call the // appropriate function. @@ -8845,14 +9072,14 @@ const makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center */ -const makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) { +var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) { // We always center \left/\right delimiters, so the axis is always shifted - const axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right + var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right - const delimiterFactor = 901; - const delimiterExtend = 5.0 / options.fontMetrics().ptPerEm; - const maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); - const totalHeight = Math.max( // In real TeX, calculations are done using integral values which are + var delimiterFactor = 901; + var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm; + var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); + var totalHeight = Math.max( // In real TeX, calculations are done using integral values which are // 65536 per pt, or 655360 per em. So, the division here truncates in // TeX but doesn't here, producing different results. If we wanted to // exactly match TeX's calculation, we could do @@ -8870,12 +9097,13 @@ const makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, opt var delimiter = { sqrtImage: makeSqrtImage, sizedDelim: makeSizedDelim, + sizeToMaxHeight: sizeToMaxHeight, customSizedDelim: makeCustomSizedDelim, leftRightDelim: makeLeftRightDelim }; // Extra data needed for the delimiter handler down below -const delimiterSizes = { +var delimiterSizes = { "\\bigl": { mclass: "mopen", size: 1 @@ -8941,18 +9169,18 @@ const delimiterSizes = { size: 4 } }; -const delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27e8", "\\rangle", "\u27e9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; +var delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27e8", "\\rangle", "\u27e9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; // Delimiter functions function checkDelimiter(delim, context) { - const symDelim = checkSymbolNodeType(delim); + var symDelim = checkSymbolNodeType(delim); if (symDelim && utils.contains(delimiters, symDelim.text)) { return symDelim; } else if (symDelim) { - throw new ParseError(`Invalid delimiter '${symDelim.text}' after '${context.funcName}'`, delim); + throw new ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim); } else { - throw new ParseError(`Invalid delimiter type '${delim.type}'`, delim); + throw new ParseError("Invalid delimiter type '" + delim.type + "'", delim); } } @@ -8960,10 +9188,11 @@ defineFunction({ type: "delimsizing", names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], props: { - numArgs: 1 + numArgs: 1, + argTypes: ["primitive"] }, handler: (context, args) => { - const delim = checkDelimiter(args[0], context); + var delim = checkDelimiter(args[0], context); return { type: "delimsizing", mode: context.parser.mode, @@ -8983,13 +9212,13 @@ defineFunction({ return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]); }, mathmlBuilder: group => { - const children = []; + var children = []; if (group.delim !== ".") { children.push(makeText(group.delim, group.mode)); } - const node = new mathMLTree.MathNode("mo", children); + var node = new mathMLTree.MathNode("mo", children); if (group.mclass === "mopen" || group.mclass === "mclose") { // Only some of the delimsizing functions act as fences, and they @@ -9001,6 +9230,9 @@ defineFunction({ node.setAttribute("fence", "false"); } + node.setAttribute("stretchy", "true"); + node.setAttribute("minsize", delimiter.sizeToMaxHeight[group.size] + "em"); + node.setAttribute("maxsize", delimiter.sizeToMaxHeight[group.size] + "em"); return node; } }); @@ -9015,13 +9247,14 @@ defineFunction({ type: "leftright-right", names: ["\\right"], props: { - numArgs: 1 + numArgs: 1, + primitive: true }, handler: (context, args) => { // \left case below triggers parsing of \right in // `const right = parser.parseFunction();` // uses this return value. - const color = context.parser.gullet.macros.get("\\current@color"); + var color = context.parser.gullet.macros.get("\\current@color"); if (color && typeof color !== "string") { throw new ParseError("\\current@color set to non-string in \\right"); @@ -9040,19 +9273,20 @@ defineFunction({ type: "leftright", names: ["\\left"], props: { - numArgs: 1 + numArgs: 1, + primitive: true }, handler: (context, args) => { - const delim = checkDelimiter(args[0], context); - const parser = context.parser; // Parse out the implicit body + var delim = checkDelimiter(args[0], context); + var parser = context.parser; // Parse out the implicit body ++parser.leftrightDepth; // parseExpression stops before '\\right' - const body = parser.parseExpression(false); + var body = parser.parseExpression(false); --parser.leftrightDepth; // Check the next token parser.expect("\\right", false); - const right = assertNodeType(parser.parseFunction(), "leftright-right"); + var right = assertNodeType(parser.parseFunction(), "leftright-right"); return { type: "leftright", mode: parser.mode, @@ -9065,12 +9299,12 @@ defineFunction({ htmlBuilder: (group, options) => { assertParsed(group); // Build the inner expression - const inner = buildExpression(group.body, options, true, ["mopen", "mclose"]); - let innerHeight = 0; - let innerDepth = 0; - let hadMiddle = false; // Calculate its height and depth + var inner = buildExpression(group.body, options, true, ["mopen", "mclose"]); + var innerHeight = 0; + var innerDepth = 0; + var hadMiddle = false; // Calculate its height and depth - for (let i = 0; i < inner.length; i++) { + for (var i = 0; i < inner.length; i++) { // Property `isMiddle` not defined on `span`. See comment in // "middle"'s htmlBuilder. // $FlowFixMe @@ -9087,7 +9321,7 @@ defineFunction({ innerHeight *= options.sizeMultiplier; innerDepth *= options.sizeMultiplier; - let leftDelim; + var leftDelim; if (group.left === ".") { // Empty delimiters in \left and \right make null delimiter spaces. @@ -9102,26 +9336,26 @@ defineFunction({ inner.unshift(leftDelim); // Handle middle delimiters if (hadMiddle) { - for (let i = 1; i < inner.length; i++) { - const middleDelim = inner[i]; // Property `isMiddle` not defined on `span`. See comment in + for (var _i = 1; _i < inner.length; _i++) { + var middleDelim = inner[_i]; // Property `isMiddle` not defined on `span`. See comment in // "middle"'s htmlBuilder. // $FlowFixMe - const isMiddle = middleDelim.isMiddle; + var isMiddle = middleDelim.isMiddle; if (isMiddle) { // Apply the options that were active when \middle was called - inner[i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []); + inner[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []); } } } - let rightDelim; // Same for the right delimiter, but using color specified by \color + var rightDelim; // Same for the right delimiter, but using color specified by \color if (group.right === ".") { rightDelim = makeNullDelimiter(options, ["mclose"]); } else { - const colorOptions = group.rightColor ? options.withColor(group.rightColor) : options; + var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options; rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]); } // Add it to the end of the expression. @@ -9131,16 +9365,16 @@ defineFunction({ }, mathmlBuilder: (group, options) => { assertParsed(group); - const inner = buildExpression$1(group.body, options); + var inner = buildExpression$1(group.body, options); if (group.left !== ".") { - const leftNode = new mathMLTree.MathNode("mo", [makeText(group.left, group.mode)]); + var leftNode = new mathMLTree.MathNode("mo", [makeText(group.left, group.mode)]); leftNode.setAttribute("fence", "true"); inner.unshift(leftNode); } if (group.right !== ".") { - const rightNode = new mathMLTree.MathNode("mo", [makeText(group.right, group.mode)]); + var rightNode = new mathMLTree.MathNode("mo", [makeText(group.right, group.mode)]); rightNode.setAttribute("fence", "true"); if (group.rightColor) { @@ -9157,10 +9391,11 @@ defineFunction({ type: "middle", names: ["\\middle"], props: { - numArgs: 1 + numArgs: 1, + primitive: true }, handler: (context, args) => { - const delim = checkDelimiter(args[0], context); + var delim = checkDelimiter(args[0], context); if (!context.parser.leftrightDepth) { throw new ParseError("\\middle without preceding \\left", delim); @@ -9173,13 +9408,13 @@ defineFunction({ }; }, htmlBuilder: (group, options) => { - let middleDelim; + var middleDelim; if (group.delim === ".") { middleDelim = makeNullDelimiter(options, []); } else { middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []); - const isMiddle = { + var isMiddle = { delim: group.delim, options }; // Property `isMiddle` not defined on `span`. It is only used in @@ -9198,8 +9433,8 @@ defineFunction({ // is in the fence part of the operator dictionary at: // https://www.w3.org/TR/MathML3/appendixc.html. // So we need to avoid U+2223 and use plain "|" instead. - const textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode); - const middleNode = new mathMLTree.MathNode("mo", [textNode]); + var textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode); + var middleNode = new mathMLTree.MathNode("mo", [textNode]); middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each element. // \middle should get delimiter spacing instead. @@ -9209,57 +9444,99 @@ defineFunction({ } }); -const htmlBuilder$2 = (group, options) => { - // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox +var htmlBuilder$2 = (group, options) => { + // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox, \phase // Some groups can return document fragments. Handle those by wrapping // them in a span. - const inner = buildCommon.wrapFragment(buildGroup(group.body, options), options); - const label = group.label.substr(1); - const scale = options.sizeMultiplier; - let img; - let imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different + var inner = buildCommon.wrapFragment(buildGroup(group.body, options), options); + var label = group.label.substr(1); + var scale = options.sizeMultiplier; + var img; + var imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different // depending on whether the subject is wider than it is tall, or vice versa. // We don't know the width of a group, so as a proxy, we test if // the subject is a single character. This captures most of the // subjects that should get the "tall" treatment. - const isSingleChar = utils.isCharacterBox(group.body); + var isSingleChar = utils.isCharacterBox(group.body); if (label === "sout") { img = buildCommon.makeSpan(["stretchy", "sout"]); img.height = options.fontMetrics().defaultRuleThickness / scale; imgShift = -0.5 * options.fontMetrics().xHeight; + } else if (label === "phase") { + // Set a couple of dimensions from the steinmetz package. + var lineWeight = calculateSize({ + number: 0.6, + unit: "pt" + }, options); + var clearance = calculateSize({ + number: 0.35, + unit: "ex" + }, options); // Prevent size changes like \Huge from affecting line thickness + + var newOptions = options.havingBaseSizing(); + scale = scale / newOptions.sizeMultiplier; + var angleHeight = inner.height + inner.depth + lineWeight + clearance; // Reserve a left pad for the angle. + + inner.style.paddingLeft = angleHeight / 2 + lineWeight + "em"; // Create an SVG + + var viewBoxHeight = Math.floor(1000 * angleHeight * scale); + var path = phasePath(viewBoxHeight); + var svgNode = new SvgNode([new PathNode("phase", path)], { + "width": "400em", + "height": viewBoxHeight / 1000 + "em", + "viewBox": "0 0 400000 " + viewBoxHeight, + "preserveAspectRatio": "xMinYMin slice" + }); // Wrap it in a span with overflow: hidden. + + img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode], options); + img.style.height = angleHeight + "em"; + imgShift = inner.depth + lineWeight + clearance; } else { // Add horizontal padding if (/cancel/.test(label)) { if (!isSingleChar) { inner.classes.push("cancel-pad"); } + } else if (label === "angl") { + inner.classes.push("anglpad"); } else { inner.classes.push("boxpad"); } // Add vertical padding - let vertPad = 0; - let ruleThickness = 0; // ref: cancel package: \advance\totalheight2\p@ % "+2" + var topPad = 0; + var bottomPad = 0; + var ruleThickness = 0; // ref: cancel package: \advance\totalheight2\p@ % "+2" if (/box/.test(label)) { ruleThickness = Math.max(options.fontMetrics().fboxrule, // default options.minRuleThickness // User override. ); - vertPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness); + topPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness); + bottomPad = topPad; + } else if (label === "angl") { + ruleThickness = Math.max(options.fontMetrics().defaultRuleThickness, options.minRuleThickness); + topPad = 4 * ruleThickness; // gap = 3 × line, plus the line itself. + + bottomPad = Math.max(0, 0.25 - inner.depth); } else { - vertPad = isSingleChar ? 0.2 : 0; + topPad = isSingleChar ? 0.2 : 0; + bottomPad = topPad; } - img = stretchy.encloseSpan(inner, label, vertPad, options); + img = stretchy.encloseSpan(inner, label, topPad, bottomPad, options); if (/fbox|boxed|fcolorbox/.test(label)) { img.style.borderStyle = "solid"; - img.style.borderWidth = `${ruleThickness}em`; + img.style.borderWidth = ruleThickness + "em"; + } else if (label === "angl" && ruleThickness !== 0.049) { + img.style.borderTopWidth = ruleThickness + "em"; + img.style.borderRightWidth = ruleThickness + "em"; } - imgShift = inner.depth + vertPad; + imgShift = inner.depth + bottomPad; if (group.backgroundColor) { img.style.backgroundColor = group.backgroundColor; @@ -9270,7 +9547,7 @@ const htmlBuilder$2 = (group, options) => { } } - let vlist; + var vlist; if (group.backgroundColor) { vlist = buildCommon.makeVList({ @@ -9287,6 +9564,7 @@ const htmlBuilder$2 = (group, options) => { }] }, options); } else { + var classes = /cancel|phase/.test(label) ? ["svg-align"] : []; vlist = buildCommon.makeVList({ positionType: "individualShift", children: [// Write the \cancel stroke on top of inner. @@ -9298,7 +9576,7 @@ const htmlBuilder$2 = (group, options) => { type: "elem", elem: img, shift: imgShift, - wrapperClasses: /cancel/.test(label) ? ["svg-align"] : [] + wrapperClasses: classes }] }, options); } @@ -9318,9 +9596,9 @@ const htmlBuilder$2 = (group, options) => { } }; -const mathmlBuilder$2 = (group, options) => { - let fboxsep = 0; - const node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup$1(group.body, options)]); +var mathmlBuilder$2 = (group, options) => { + var fboxsep = 0; + var node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup$1(group.body, options)]); switch (group.label) { case "\\cancel": @@ -9331,6 +9609,10 @@ const mathmlBuilder$2 = (group, options) => { node.setAttribute("notation", "downdiagonalstrike"); break; + case "\\phase": + node.setAttribute("notation", "phasorangle"); + break; + case "\\sout": node.setAttribute("notation", "horizontalstrike"); break; @@ -9339,19 +9621,23 @@ const mathmlBuilder$2 = (group, options) => { node.setAttribute("notation", "box"); break; + case "\\angl": + node.setAttribute("notation", "actuarial"); + break; + case "\\fcolorbox": case "\\colorbox": // doesn't have a good notation option. So use // instead. Set some attributes that come included with . fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm; - node.setAttribute("width", `+${2 * fboxsep}pt`); - node.setAttribute("height", `+${2 * fboxsep}pt`); - node.setAttribute("lspace", `${fboxsep}pt`); // + node.setAttribute("width", "+" + 2 * fboxsep + "pt"); + node.setAttribute("height", "+" + 2 * fboxsep + "pt"); + node.setAttribute("lspace", fboxsep + "pt"); // - node.setAttribute("voffset", `${fboxsep}pt`); + node.setAttribute("voffset", fboxsep + "pt"); if (group.label === "\\fcolorbox") { - const thk = Math.max(options.fontMetrics().fboxrule, // default + var thk = Math.max(options.fontMetrics().fboxrule, // default options.minRuleThickness // user override ); node.setAttribute("style", "border: " + thk + "em solid " + String(group.borderColor)); @@ -9377,15 +9663,16 @@ defineFunction({ props: { numArgs: 2, allowedInText: true, - greediness: 3, argTypes: ["color", "text"] }, handler(_ref, args, optArgs) { - let parser = _ref.parser, - funcName = _ref.funcName; - const color = assertNodeType(args[0], "color-token").color; - const body = args[1]; + var { + parser, + funcName + } = _ref; + var color = assertNodeType(args[0], "color-token").color; + var body = args[1]; return { type: "enclose", mode: parser.mode, @@ -9404,16 +9691,17 @@ defineFunction({ props: { numArgs: 3, allowedInText: true, - greediness: 3, argTypes: ["color", "color", "text"] }, handler(_ref2, args, optArgs) { - let parser = _ref2.parser, - funcName = _ref2.funcName; - const borderColor = assertNodeType(args[0], "color-token").color; - const backgroundColor = assertNodeType(args[1], "color-token").color; - const body = args[2]; + var { + parser, + funcName + } = _ref2; + var borderColor = assertNodeType(args[0], "color-token").color; + var backgroundColor = assertNodeType(args[1], "color-token").color; + var body = args[2]; return { type: "enclose", mode: parser.mode, @@ -9437,7 +9725,9 @@ defineFunction({ }, handler(_ref3, args) { - let parser = _ref3.parser; + var { + parser + } = _ref3; return { type: "enclose", mode: parser.mode, @@ -9449,15 +9739,17 @@ defineFunction({ }); defineFunction({ type: "enclose", - names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout"], + names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"], props: { numArgs: 1 }, - handler(_ref4, args, optArgs) { - let parser = _ref4.parser, - funcName = _ref4.funcName; - const body = args[0]; + handler(_ref4, args) { + var { + parser, + funcName + } = _ref4; + var body = args[0]; return { type: "enclose", mode: parser.mode, @@ -9469,35 +9761,57 @@ defineFunction({ htmlBuilder: htmlBuilder$2, mathmlBuilder: mathmlBuilder$2 }); +defineFunction({ + type: "enclose", + names: ["\\angl"], + props: { + numArgs: 1, + argTypes: ["hbox"], + allowedInText: false + }, + + handler(_ref5, args) { + var { + parser + } = _ref5; + return { + type: "enclose", + mode: parser.mode, + label: "\\angl", + body: args[0] + }; + } + +}); /** * All registered environments. * `environments.js` exports this same dictionary again and makes it public. * `Parser.js` requires this dictionary via `environments.js`. */ -const _environments = {}; +var _environments = {}; function defineEnvironment(_ref) { - let type = _ref.type, - names = _ref.names, - props = _ref.props, - handler = _ref.handler, - htmlBuilder = _ref.htmlBuilder, - mathmlBuilder = _ref.mathmlBuilder; + var { + type, + names, + props, + handler, + htmlBuilder, + mathmlBuilder + } = _ref; // Set default values of environments. - const data = { + var data = { type, numArgs: props.numArgs || 0, - greediness: 1, allowedInText: false, numOptionalArgs: 0, handler }; - for (let i = 0; i < names.length; ++i) { + for (var i = 0; i < names.length; ++i) { // TODO: The value type of _environments should be a type union of all // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is // an existential type. - // $FlowFixMe _environments[names[i]] = data; } @@ -9510,12 +9824,13 @@ function defineEnvironment(_ref) { } } +// Helper functions function getHLines(parser) { // Return an array. The array length = number of hlines. // Each element in the array tells if the line is dashed. - const hlineInfo = []; + var hlineInfo = []; parser.consumeSpaces(); - let nxt = parser.fetch().text; + var nxt = parser.fetch().text; while (nxt === "\\hline" || nxt === "\\hdashline") { parser.consume(); @@ -9526,6 +9841,14 @@ function getHLines(parser) { return hlineInfo; } + +var validateAmsEnvironmentContext = context => { + var settings = context.parser.settings; + + if (!settings.displayMode) { + throw new ParseError("{" + context.envName + "} can be used only in" + " display mode."); + } +}; /** * Parse the body of the environment, with rows delimited by \\ and * columns delimited by &, and create a nested list in row-major order @@ -9535,17 +9858,28 @@ function getHLines(parser) { function parseArray(parser, _ref, style) { - let hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, - addJot = _ref.addJot, - cols = _ref.cols, - arraystretch = _ref.arraystretch, - colSeparationType = _ref.colSeparationType; - // Parse body of array with \\ temporarily mapped to \cr + var { + hskipBeforeAndAfter, + addJot, + cols, + arraystretch, + colSeparationType, + addEqnNum, + singleRow, + maxNumCols, + leqno + } = _ref; parser.gullet.beginGroup(); - parser.gullet.macros.set("\\\\", "\\cr"); // Get current arraystretch if it's not set by the environment + + if (!singleRow) { + // \cr is equivalent to \\ without the optional size argument (see below) + // TODO: provide helpful error when \cr is used outside array environment + parser.gullet.macros.set("\\cr", "\\\\\\relax"); + } // Get current arraystretch if it's not set by the environment + if (!arraystretch) { - const stretch = parser.gullet.expandMacroAsText("\\arraystretch"); + var stretch = parser.gullet.expandMacroAsText("\\arraystretch"); if (stretch == null) { // Default \arraystretch from lttab.dtx @@ -9554,24 +9888,24 @@ function parseArray(parser, _ref, style) { arraystretch = parseFloat(stretch); if (!arraystretch || arraystretch < 0) { - throw new ParseError(`Invalid \\arraystretch: ${stretch}`); + throw new ParseError("Invalid \\arraystretch: " + stretch); } } } // Start group for first cell parser.gullet.beginGroup(); - let row = []; - const body = [row]; - const rowGaps = []; - const hLinesBeforeRow = []; // Test for \hline at the top of the array. + var row = []; + var body = [row]; + var rowGaps = []; + var hLinesBeforeRow = []; // Test for \hline at the top of the array. hLinesBeforeRow.push(getHLines(parser)); while (true) { // eslint-disable-line no-constant-condition // Parse each cell in its own group (namespace) - let cell = parser.parseExpression(false, "\\cr"); + var cell = parser.parseExpression(false, singleRow ? "\\end" : "\\\\"); parser.gullet.endGroup(); parser.gullet.beginGroup(); cell = { @@ -9590,9 +9924,19 @@ function parseArray(parser, _ref, style) { } row.push(cell); - const next = parser.fetch().text; + var next = parser.fetch().text; if (next === "&") { + if (maxNumCols && row.length === maxNumCols) { + if (singleRow || colSeparationType) { + // {equation} or {split} + throw new ParseError("Too many tab characters: &", parser.nextToken); + } else { + // {array} environment + parser.settings.reportNonstrict("textEnv", "Too few columns " + "specified in the {array} column argument."); + } + } + parser.consume(); } else if (next === "\\end") { // Arrays terminate newlines with `\crcr` which consumes a `\cr` if @@ -9607,9 +9951,19 @@ function parseArray(parser, _ref, style) { } break; - } else if (next === "\\cr") { - const cr = assertNodeType(parser.parseFunction(), "cr"); - rowGaps.push(cr.size); // check for \hline(s) following the row separator + } else if (next === "\\\\") { + parser.consume(); + var size = void 0; // \def\Let@{\let\\\math@cr} + // \def\math@cr{...\math@cr@} + // \def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}} + // \def\math@cr@@[#1]{...\math@cr@@@...} + // \def\math@cr@@@{\cr} + + if (parser.gullet.future().text !== " ") { + size = parser.parseSizeGroup(true); + } + + rowGaps.push(size ? size.value : null); // check for \hline(s) following the row separator hLinesBeforeRow.push(getHLines(parser)); row = []; @@ -9620,7 +9974,7 @@ function parseArray(parser, _ref, style) { } // End cell group - parser.gullet.endGroup(); // End array group defining \\ + parser.gullet.endGroup(); // End array group defining \cr parser.gullet.endGroup(); return { @@ -9633,7 +9987,9 @@ function parseArray(parser, _ref, style) { rowGaps, hskipBeforeAndAfter, hLinesBeforeRow, - colSeparationType + colSeparationType, + addEqnNum, + leqno }; } // Decides on a style for cells in an array according to whether the given // environment name starts with the letter 'd'. @@ -9647,20 +10003,20 @@ function dCellStyle(envName) { } } -const htmlBuilder$3 = function htmlBuilder(group, options) { - let r; - let c; - const nr = group.body.length; - const hLinesBeforeRow = group.hLinesBeforeRow; - let nc = 0; - let body = new Array(nr); - const hlines = []; - const ruleThickness = Math.max( // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em. +var htmlBuilder$3 = function htmlBuilder(group, options) { + var r; + var c; + var nr = group.body.length; + var hLinesBeforeRow = group.hLinesBeforeRow; + var nc = 0; + var body = new Array(nr); + var hlines = []; + var ruleThickness = Math.max( // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em. options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override. ); // Horizontal spacing - const pt = 1 / options.fontMetrics().ptPerEm; - let arraycolsep = 5 * pt; // default value, i.e. \arraycolsep in article.cls + var pt = 1 / options.fontMetrics().ptPerEm; + var arraycolsep = 5 * pt; // default value, i.e. \arraycolsep in article.cls if (group.colSeparationType && group.colSeparationType === "small") { // We're in a {smallmatrix}. Default column space is \thickspace, @@ -9668,25 +10024,28 @@ const htmlBuilder$3 = function htmlBuilder(group, options) { // But that needs adjustment because LaTeX applies \scriptstyle to the // entire array, including the colspace, but this function applies // \scriptstyle only inside each element. - const localMultiplier = options.havingStyle(Style$1.SCRIPT).sizeMultiplier; + var localMultiplier = options.havingStyle(Style$1.SCRIPT).sizeMultiplier; arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier); } // Vertical spacing - const baselineskip = 12 * pt; // see size10.clo + var baselineskip = group.colSeparationType === "CD" ? calculateSize({ + number: 3, + unit: "ex" + }, options) : 12 * pt; // see size10.clo // Default \jot from ltmath.dtx // TODO(edemaine): allow overriding \jot via \setlength (#687) - const jot = 3 * pt; - const arrayskip = group.arraystretch * baselineskip; - const arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and + var jot = 3 * pt; + var arrayskip = group.arraystretch * baselineskip; + var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and - const arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx + var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx - let totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any. + var totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any. function setHLinePos(hlinesInGap) { - for (let i = 0; i < hlinesInGap.length; ++i) { + for (var i = 0; i < hlinesInGap.length; ++i) { if (i > 0) { totalHeight += 0.25; } @@ -9701,19 +10060,19 @@ const htmlBuilder$3 = function htmlBuilder(group, options) { setHLinePos(hLinesBeforeRow[0]); for (r = 0; r < group.body.length; ++r) { - const inrow = group.body[r]; - let height = arstrutHeight; // \@array adds an \@arstrut + var inrow = group.body[r]; + var height = arstrutHeight; // \@array adds an \@arstrut - let depth = arstrutDepth; // to each tow (via the template) + var depth = arstrutDepth; // to each tow (via the template) if (nc < inrow.length) { nc = inrow.length; } - const outrow = new Array(inrow.length); + var outrow = new Array(inrow.length); for (c = 0; c < inrow.length; ++c) { - const elt = buildGroup(inrow[c], options); + var elt = buildGroup(inrow[c], options); if (depth < elt.depth) { depth = elt.depth; @@ -9726,8 +10085,8 @@ const htmlBuilder$3 = function htmlBuilder(group, options) { outrow[c] = elt; } - const rowGap = group.rowGaps[r]; - let gap = 0; + var rowGap = group.rowGaps[r]; + var gap = 0; if (rowGap) { gap = calculateSize(rowGap, options); @@ -9762,17 +10121,35 @@ const htmlBuilder$3 = function htmlBuilder(group, options) { setHLinePos(hLinesBeforeRow[r + 1]); } - const offset = totalHeight / 2 + options.fontMetrics().axisHeight; - const colDescriptions = group.cols || []; - const cols = []; - let colSep; - let colDescrNum; + var offset = totalHeight / 2 + options.fontMetrics().axisHeight; + var colDescriptions = group.cols || []; + var cols = []; + var colSep; + var colDescrNum; + var eqnNumSpans = []; + + if (group.addEqnNum) { + // An environment with automatic equation numbers. + // Create node(s) that will trigger CSS counter increment. + for (r = 0; r < nr; ++r) { + var rw = body[r]; + var shift = rw.pos - offset; + var eqnTag = buildCommon.makeSpan(["eqn-num"], [], options); + eqnTag.depth = rw.depth; + eqnTag.height = rw.height; + eqnNumSpans.push({ + type: "elem", + elem: eqnTag, + shift + }); + } + } for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column // descriptions, so trailing separators don't get lost. c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) { - let colDescr = colDescriptions[colDescrNum] || {}; - let firstSeparator = true; + var colDescr = colDescriptions[colDescrNum] || {}; + var firstSeparator = true; while (colDescr.type === "separator") { // If there is more than one separator in a row, add a space @@ -9784,12 +10161,12 @@ const htmlBuilder$3 = function htmlBuilder(group, options) { } if (colDescr.separator === "|" || colDescr.separator === ":") { - const lineType = colDescr.separator === "|" ? "solid" : "dashed"; - const separator = buildCommon.makeSpan(["vertical-separator"], [], options); + var lineType = colDescr.separator === "|" ? "solid" : "dashed"; + var separator = buildCommon.makeSpan(["vertical-separator"], [], options); separator.style.height = totalHeight + "em"; - separator.style.borderRightWidth = `${ruleThickness}em`; + separator.style.borderRightWidth = ruleThickness + "em"; separator.style.borderRightStyle = lineType; - separator.style.margin = `0 -${ruleThickness / 2}em`; + separator.style.margin = "0 -" + ruleThickness / 2 + "em"; separator.style.verticalAlign = -(totalHeight - offset) + "em"; cols.push(separator); } else { @@ -9805,7 +10182,7 @@ const htmlBuilder$3 = function htmlBuilder(group, options) { continue; } - let sepwidth; + var sepwidth = void 0; if (c > 0 || group.hskipBeforeAndAfter) { sepwidth = utils.deflt(colDescr.pregap, arraycolsep); @@ -9817,23 +10194,24 @@ const htmlBuilder$3 = function htmlBuilder(group, options) { } } - let col = []; + var col = []; for (r = 0; r < nr; ++r) { - const row = body[r]; - const elem = row[c]; + var row = body[r]; + var elem = row[c]; if (!elem) { continue; } - const shift = row.pos - offset; + var _shift = row.pos - offset; + elem.depth = row.depth; elem.height = row.height; col.push({ type: "elem", elem: elem, - shift: shift + shift: _shift }); } @@ -9858,17 +10236,17 @@ const htmlBuilder$3 = function htmlBuilder(group, options) { body = buildCommon.makeSpan(["mtable"], cols); // Add \hline(s), if any. if (hlines.length > 0) { - const line = buildCommon.makeLineSpan("hline", options, ruleThickness); - const dashes = buildCommon.makeLineSpan("hdashline", options, ruleThickness); - const vListElems = [{ + var line = buildCommon.makeLineSpan("hline", options, ruleThickness); + var dashes = buildCommon.makeLineSpan("hdashline", options, ruleThickness); + var vListElems = [{ type: "elem", elem: body, shift: 0 }]; while (hlines.length > 0) { - const hline = hlines.pop(); - const lineShift = hline.pos - offset; + var hline = hlines.pop(); + var lineShift = hline.pos - offset; if (hline.isDashed) { vListElems.push({ @@ -9891,21 +10269,52 @@ const htmlBuilder$3 = function htmlBuilder(group, options) { }, options); } - return buildCommon.makeSpan(["mord"], [body], options); + if (!group.addEqnNum) { + return buildCommon.makeSpan(["mord"], [body], options); + } else { + var eqnNumCol = buildCommon.makeVList({ + positionType: "individualShift", + children: eqnNumSpans + }, options); + eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options); + return buildCommon.makeFragment([body, eqnNumCol]); + } }; -const alignMap = { +var alignMap = { c: "center ", l: "left ", r: "right " }; -const mathmlBuilder$3 = function mathmlBuilder(group, options) { - let table = new mathMLTree.MathNode("mtable", group.body.map(function (row) { - return new mathMLTree.MathNode("mtr", row.map(function (cell) { - return new mathMLTree.MathNode("mtd", [buildGroup$1(cell, options)]); - })); - })); // Set column alignment, row spacing, column spacing, and +var mathmlBuilder$3 = function mathmlBuilder(group, options) { + var tbl = []; + var glue = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]); + var tag = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]); + + for (var i = 0; i < group.body.length; i++) { + var rw = group.body[i]; + var row = []; + + for (var j = 0; j < rw.length; j++) { + row.push(new mathMLTree.MathNode("mtd", [buildGroup$1(rw[j], options)])); + } + + if (group.addEqnNum) { + row.unshift(glue); + row.push(glue); + + if (group.leqno) { + row.unshift(tag); + } else { + row.push(tag); + } + } + + tbl.push(new mathMLTree.MathNode("mtr", row)); + } + + var table = new mathMLTree.MathNode("mtable", tbl); // Set column alignment, row spacing, column spacing, and // array lines by setting attributes on the table element. // Set the row spacing. In MathML, we specify a gap distance. // We do not use rowGap[] because MathML automatically increases @@ -9916,21 +10325,21 @@ const mathmlBuilder$3 = function mathmlBuilder(group, options) { // The 0.16 and 0.09 values are found emprically. They produce an array // similar to LaTeX and in which content does not interfere with \hines. - const gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray} + var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray} : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0); - table.setAttribute("rowspacing", gap + "em"); // MathML table lines go only between cells. + table.setAttribute("rowspacing", gap.toFixed(4) + "em"); // MathML table lines go only between cells. // To place a line on an edge we'll use , if necessary. - let menclose = ""; - let align = ""; + var menclose = ""; + var align = ""; if (group.cols && group.cols.length > 0) { // Find column alignment, column spacing, and vertical lines. - const cols = group.cols; - let columnLines = ""; - let prevTypeWasAlign = false; - let iStart = 0; - let iEnd = cols.length; + var cols = group.cols; + var columnLines = ""; + var prevTypeWasAlign = false; + var iStart = 0; + var iEnd = cols.length; if (cols[0].type === "separator") { menclose += "top "; @@ -9942,20 +10351,20 @@ const mathmlBuilder$3 = function mathmlBuilder(group, options) { iEnd -= 1; } - for (let i = iStart; i < iEnd; i++) { - if (cols[i].type === "align") { - align += alignMap[cols[i].align]; + for (var _i = iStart; _i < iEnd; _i++) { + if (cols[_i].type === "align") { + align += alignMap[cols[_i].align]; if (prevTypeWasAlign) { columnLines += "none "; } prevTypeWasAlign = true; - } else if (cols[i].type === "separator") { + } else if (cols[_i].type === "separator") { // MathML accepts only single lines between cells. // So we read only the first of consecutive separators. if (prevTypeWasAlign) { - columnLines += cols[i].separator === "|" ? "solid " : "dashed "; + columnLines += cols[_i].separator === "|" ? "solid " : "dashed "; prevTypeWasAlign = false; } } @@ -9970,31 +10379,34 @@ const mathmlBuilder$3 = function mathmlBuilder(group, options) { if (group.colSeparationType === "align") { - const cols = group.cols || []; - let spacing = ""; + var _cols = group.cols || []; - for (let i = 1; i < cols.length; i++) { - spacing += i % 2 ? "0em " : "1em "; + var spacing = ""; + + for (var _i2 = 1; _i2 < _cols.length; _i2++) { + spacing += _i2 % 2 ? "0em " : "1em "; } table.setAttribute("columnspacing", spacing.trim()); - } else if (group.colSeparationType === "alignat") { + } else if (group.colSeparationType === "alignat" || group.colSeparationType === "gather") { table.setAttribute("columnspacing", "0em"); } else if (group.colSeparationType === "small") { table.setAttribute("columnspacing", "0.2778em"); + } else if (group.colSeparationType === "CD") { + table.setAttribute("columnspacing", "0.5em"); } else { table.setAttribute("columnspacing", "1em"); } // Address \hline and \hdashline - let rowLines = ""; - const hlines = group.hLinesBeforeRow; + var rowLines = ""; + var hlines = group.hLinesBeforeRow; menclose += hlines[0].length > 0 ? "left " : ""; menclose += hlines[hlines.length - 1].length > 0 ? "right " : ""; - for (let i = 1; i < hlines.length - 1; i++) { - rowLines += hlines[i].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element. - : hlines[i][0] ? "dashed " : "solid "; + for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) { + rowLines += hlines[_i3].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element. + : hlines[_i3][0] ? "dashed " : "solid "; } if (/[sd]/.test(rowLines)) { @@ -10013,14 +10425,23 @@ const mathmlBuilder$3 = function mathmlBuilder(group, options) { } return table; -}; // Convenience function for aligned and alignedat environments. +}; // Convenience function for align, align*, aligned, alignat, alignat*, alignedat. -const alignedHandler = function alignedHandler(context, args) { - const cols = []; - const res = parseArray(context.parser, { +var alignedHandler = function alignedHandler(context, args) { + if (context.envName.indexOf("ed") === -1) { + validateAmsEnvironmentContext(context); + } + + var cols = []; + var separationType = context.envName.indexOf("at") > -1 ? "alignat" : "align"; + var res = parseArray(context.parser, { cols, - addJot: true + addJot: true, + addEqnNum: context.envName === "align" || context.envName === "alignat", + colSeparationType: separationType, + maxNumCols: context.envName === "split" ? 2 : undefined, + leqno: context.parser.settings.leqno }, "display"); // Determining number of columns. // 1. If the first argument is given, we use it as a number of columns, // and makes sure that each row doesn't exceed that number. @@ -10031,19 +10452,19 @@ const alignedHandler = function alignedHandler(context, args) { // cell in each row (starting with second cell) so that operators become // binary. This behavior is implemented in amsmath's \start@aligned. - let numMaths; - let numCols = 0; - const emptyGroup = { + var numMaths; + var numCols = 0; + var emptyGroup = { type: "ordgroup", mode: context.mode, body: [] }; if (args[0] && args[0].type === "ordgroup") { - let arg0 = ""; + var arg0 = ""; - for (let i = 0; i < args[0].body.length; i++) { - const textord = assertNodeType(args[0].body[i], "textord"); + for (var i = 0; i < args[0].body.length; i++) { + var textord = assertNodeType(args[0].body[i], "textord"); arg0 += textord.text; } @@ -10051,21 +10472,21 @@ const alignedHandler = function alignedHandler(context, args) { numCols = numMaths * 2; } - const isAligned = !numCols; + var isAligned = !numCols; res.body.forEach(function (row) { - for (let i = 1; i < row.length; i += 2) { + for (var _i4 = 1; _i4 < row.length; _i4 += 2) { // Modify ordgroup node within styling node - const styling = assertNodeType(row[i], "styling"); - const ordgroup = assertNodeType(styling.body[0], "ordgroup"); + var styling = assertNodeType(row[_i4], "styling"); + var ordgroup = assertNodeType(styling.body[0], "ordgroup"); ordgroup.body.unshift(emptyGroup); } if (!isAligned) { // Case 1 - const curMaths = row.length / 2; + var curMaths = row.length / 2; if (numMaths < curMaths) { - throw new ParseError("Too many math in a row: " + `expected ${numMaths}, but got ${curMaths}`, row[0]); + throw new ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]); } } else if (numCols < row.length) { // Case 2 @@ -10075,18 +10496,18 @@ const alignedHandler = function alignedHandler(context, args) { // In aligned mode, we add one \qquad between columns; // otherwise we add nothing. - for (let i = 0; i < numCols; ++i) { - let align = "r"; - let pregap = 0; + for (var _i5 = 0; _i5 < numCols; ++_i5) { + var align = "r"; + var pregap = 0; - if (i % 2 === 1) { + if (_i5 % 2 === 1) { align = "l"; - } else if (i > 0 && isAligned) { + } else if (_i5 > 0 && isAligned) { // "aligned" mode. pregap = 1; // add one \quad } - cols[i] = { + cols[_i5] = { type: "align", align: align, pregap: pregap, @@ -10114,11 +10535,11 @@ defineEnvironment({ // - The argument is wrapped in {} or [], in which case Parser's // parseGroup() returns an "ordgroup" wrapping some symbol node. // - The argument is a bare symbol node. - const symNode = checkSymbolNodeType(args[0]); - const colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; - const cols = colalign.map(function (nde) { - const node = assertSymbolNodeType(nde); - const ca = node.text; + var symNode = checkSymbolNodeType(args[0]); + var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; + var cols = colalign.map(function (nde) { + var node = assertSymbolNodeType(nde); + var ca = node.text; if ("lcr".indexOf(ca) !== -1) { return { @@ -10139,10 +10560,11 @@ defineEnvironment({ throw new ParseError("Unknown column alignment: " + ca, nde); }); - const res = { + var res = { cols, - hskipBeforeAndAfter: true // \@preamble in lttab.dtx - + hskipBeforeAndAfter: true, + // \@preamble in lttab.dtx + maxNumCols: cols.length }; return parseArray(context.parser, res, dCellStyle(context.envName)); }, @@ -10151,28 +10573,67 @@ defineEnvironment({ mathmlBuilder: mathmlBuilder$3 }); // The matrix environments of amsmath builds on the array environment // of LaTeX, which is discussed above. +// The mathtools package adds starred versions of the same environments. +// These have an optional argument to choose left|center|right justification. defineEnvironment({ type: "array", - names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"], + names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"], props: { numArgs: 0 }, handler(context) { - const delimiters = { + var delimiters = { "matrix": null, "pmatrix": ["(", ")"], "bmatrix": ["[", "]"], "Bmatrix": ["\\{", "\\}"], "vmatrix": ["|", "|"], "Vmatrix": ["\\Vert", "\\Vert"] - }[context.envName]; // \hskip -\arraycolsep in amsmath + }[context.envName.replace("*", "")]; // \hskip -\arraycolsep in amsmath - const payload = { - hskipBeforeAndAfter: false + var colAlign = "c"; + var payload = { + hskipBeforeAndAfter: false, + cols: [{ + type: "align", + align: colAlign + }] }; - const res = parseArray(context.parser, payload, dCellStyle(context.envName)); + + if (context.envName.charAt(context.envName.length - 1) === "*") { + // It's one of the mathtools starred functions. + // Parse the optional alignment argument. + var parser = context.parser; + parser.consumeSpaces(); + + if (parser.fetch().text === "[") { + parser.consume(); + parser.consumeSpaces(); + colAlign = parser.fetch().text; + + if ("lcr".indexOf(colAlign) === -1) { + throw new ParseError("Expected l or c or r", parser.nextToken); + } + + parser.consume(); + parser.consumeSpaces(); + parser.expect("]"); + parser.consume(); + payload.cols = [{ + type: "align", + align: colAlign + }]; + } + } + + var res = parseArray(context.parser, payload, dCellStyle(context.envName)); // Populate cols with the correct number of column alignment specs. + + res.cols = new Array(res.body[0].length).fill({ + type: "align", + align: colAlign + }); return delimiters ? { type: "leftright", mode: context.mode, @@ -10195,10 +10656,10 @@ defineEnvironment({ }, handler(context) { - const payload = { + var payload = { arraystretch: 0.5 }; - const res = parseArray(context.parser, payload, "script"); + var res = parseArray(context.parser, payload, "script"); res.colSeparationType = "small"; return res; }, @@ -10215,11 +10676,11 @@ defineEnvironment({ handler(context, args) { // Parsing of {subarray} is similar to {array} - const symNode = checkSymbolNodeType(args[0]); - const colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; - const cols = colalign.map(function (nde) { - const node = assertSymbolNodeType(nde); - const ca = node.text; // {subarray} only recognizes "l" & "c" + var symNode = checkSymbolNodeType(args[0]); + var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; + var cols = colalign.map(function (nde) { + var node = assertSymbolNodeType(nde); + var ca = node.text; // {subarray} only recognizes "l" & "c" if ("lc".indexOf(ca) !== -1) { return { @@ -10235,7 +10696,7 @@ defineEnvironment({ throw new ParseError("{subarray} can contain only one column"); } - let res = { + var res = { cols, hskipBeforeAndAfter: false, arraystretch: 0.5 @@ -10266,7 +10727,7 @@ defineEnvironment({ }, handler(context) { - const payload = { + var payload = { arraystretch: 1.2, cols: [{ type: "align", @@ -10286,7 +10747,7 @@ defineEnvironment({ postgap: 0 }] }; - const res = parseArray(context.parser, payload, dCellStyle(context.envName)); + var res = parseArray(context.parser, payload, dCellStyle(context.envName)); return { type: "leftright", mode: context.mode, @@ -10299,14 +10760,16 @@ defineEnvironment({ htmlBuilder: htmlBuilder$3, mathmlBuilder: mathmlBuilder$3 -}); // An aligned environment is like the align* environment -// except it operates within math mode. +}); // In the align environment, one uses ampersands, &, to specify number of +// columns in each row, and to locate spacing between each column. +// align gets automatic numbering. align* and aligned do not. +// The alignedat environment can be used in math mode. // Note that we assume \nomallineskiplimit to be zero, // so that \strut@ is the same as \strut. defineEnvironment({ type: "array", - names: ["aligned"], + names: ["align", "align*", "aligned", "split"], props: { numArgs: 0 }, @@ -10319,18 +10782,25 @@ defineEnvironment({ defineEnvironment({ type: "array", - names: ["gathered"], + names: ["gathered", "gather", "gather*"], props: { numArgs: 0 }, handler(context) { - const res = { + if (utils.contains(["gather", "gather*"], context.envName)) { + validateAmsEnvironmentContext(context); + } + + var res = { cols: [{ type: "align", align: "c" }], - addJot: true + addJot: true, + colSeparationType: "gather", + addEqnNum: context.envName === "gather", + leqno: context.parser.settings.leqno }; return parseArray(context.parser, res, "display"); }, @@ -10343,14 +10813,47 @@ defineEnvironment({ defineEnvironment({ type: "array", - names: ["alignedat"], - // One for numbered and for unnumbered; - // but, KaTeX doesn't supports math numbering yet, - // they make no difference for now. + names: ["alignat", "alignat*", "alignedat"], props: { numArgs: 1 }, handler: alignedHandler, + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$3 +}); +defineEnvironment({ + type: "array", + names: ["equation", "equation*"], + props: { + numArgs: 0 + }, + + handler(context) { + validateAmsEnvironmentContext(context); + var res = { + addEqnNum: context.envName === "equation", + singleRow: true, + maxNumCols: 1, + leqno: context.parser.settings.leqno + }; + return parseArray(context.parser, res, "display"); + }, + + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$3 +}); +defineEnvironment({ + type: "array", + names: ["CD"], + props: { + numArgs: 0 + }, + + handler(context) { + validateAmsEnvironmentContext(context); + return parseCD(context.parser); + }, + htmlBuilder: htmlBuilder$3, mathmlBuilder: mathmlBuilder$3 }); // Catch \hline outside array environment @@ -10366,15 +10869,14 @@ defineFunction({ }, handler(context, args) { - throw new ParseError(`${context.funcName} valid only within array environment`); + throw new ParseError(context.funcName + " valid only within array environment"); } }); -const environments = _environments; +var environments = _environments; // defineEnvironment definitions. -// $FlowFixMe, "environment" handler returns an environment ParseNode defineFunction({ type: "environment", @@ -10385,17 +10887,19 @@ defineFunction({ }, handler(_ref, args) { - let parser = _ref.parser, - funcName = _ref.funcName; - const nameGroup = args[0]; + var { + parser, + funcName + } = _ref; + var nameGroup = args[0]; if (nameGroup.type !== "ordgroup") { throw new ParseError("Invalid environment name", nameGroup); } - let envName = ""; + var envName = ""; - for (let i = 0; i < nameGroup.body.length; ++i) { + for (var i = 0; i < nameGroup.body.length; ++i) { envName += assertNodeType(nameGroup.body[i], "textord").text; } @@ -10407,25 +10911,25 @@ defineFunction({ // be made available to the begin and end methods using properties. - const env = environments[envName]; - - const _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env), - args = _parser$parseArgument.args, - optArgs = _parser$parseArgument.optArgs; - - const context = { + var env = environments[envName]; + var { + args: _args, + optArgs + } = parser.parseArguments("\\begin{" + envName + "}", env); + var context = { mode: parser.mode, envName, parser }; - const result = env.handler(context, args, optArgs); + var result = env.handler(context, _args, optArgs); parser.expect("\\end", false); - const endNameToken = parser.nextToken; - const end = assertNodeType(parser.parseFunction(), "environment"); + var endNameToken = parser.nextToken; + var end = assertNodeType(parser.parseFunction(), "environment"); if (end.name !== envName) { - throw new ParseError(`Mismatch: \\begin{${envName}} matched by \\end{${end.name}}`, endNameToken); - } + throw new ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end.name + "}", endNameToken); + } // $FlowFixMe, "environment" handler returns an environment ParseNode + return result; } @@ -10440,16 +10944,16 @@ defineFunction({ }); -const makeSpan$2 = buildCommon.makeSpan; +var makeSpan$2 = buildCommon.makeSpan; function htmlBuilder$4(group, options) { - const elements = buildExpression(group.body, options, true); + var elements = buildExpression(group.body, options, true); return makeSpan$2([group.mclass], elements, options); } function mathmlBuilder$4(group, options) { - let node; - const inner = buildExpression$1(group.body, options); + var node; + var inner = buildExpression$1(group.body, options); if (group.mclass === "minner") { return mathMLTree.newDocumentFragment(inner); @@ -10493,13 +10997,16 @@ defineFunction({ type: "mclass", names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], props: { - numArgs: 1 + numArgs: 1, + primitive: true }, handler(_ref, args) { - let parser = _ref.parser, - funcName = _ref.funcName; - const body = args[0]; + var { + parser, + funcName + } = _ref; + var body = args[0]; return { type: "mclass", mode: parser.mode, @@ -10513,12 +11020,12 @@ defineFunction({ htmlBuilder: htmlBuilder$4, mathmlBuilder: mathmlBuilder$4 }); -const binrelClass = arg => { +var binrelClass = arg => { // \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument. // (by rendering separately and with {}s before and after, and measuring // the change in spacing). We'll do roughly the same by detecting the // atom type directly. - const atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg; + var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg; if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) { return "m" + atom.family; @@ -10536,12 +11043,14 @@ defineFunction({ }, handler(_ref2, args) { - let parser = _ref2.parser; + var { + parser + } = _ref2; return { type: "mclass", mode: parser.mode, mclass: binrelClass(args[0]), - body: [args[1]], + body: ordargument(args[1]), isCharacterBox: utils.isCharacterBox(args[1]) }; } @@ -10556,11 +11065,13 @@ defineFunction({ }, handler(_ref3, args) { - let parser = _ref3.parser, - funcName = _ref3.funcName; - const baseArg = args[1]; - const shiftedArg = args[0]; - let mclass; + var { + parser, + funcName + } = _ref3; + var baseArg = args[1]; + var shiftedArg = args[0]; + var mclass; if (funcName !== "\\stackrel") { // LaTeX applies \binrel spacing to \overset and \underset. @@ -10569,7 +11080,7 @@ defineFunction({ mclass = "mrel"; // for \stackrel } - const baseOp = { + var baseOp = { type: "op", mode: baseArg.mode, limits: true, @@ -10579,7 +11090,7 @@ defineFunction({ suppressBaseShift: funcName !== "\\stackrel", body: ordargument(baseArg) }; - const supsub = { + var supsub = { type: "supsub", mode: shiftedArg.mode, base: baseOp, @@ -10601,19 +11112,19 @@ defineFunction({ // TODO(kevinb): implement \\sl and \\sc -const htmlBuilder$5 = (group, options) => { - const font = group.font; - const newOptions = options.withFont(font); +var htmlBuilder$5 = (group, options) => { + var font = group.font; + var newOptions = options.withFont(font); return buildGroup(group.body, newOptions); }; -const mathmlBuilder$5 = (group, options) => { - const font = group.font; - const newOptions = options.withFont(font); +var mathmlBuilder$5 = (group, options) => { + var font = group.font; + var newOptions = options.withFont(font); return buildGroup$1(group.body, newOptions); }; -const fontAliases = { +var fontAliases = { "\\Bbb": "\\mathbb", "\\bold": "\\mathbf", "\\frak": "\\mathfrak", @@ -10627,13 +11138,15 @@ defineFunction({ "\\Bbb", "\\bold", "\\frak"], props: { numArgs: 1, - greediness: 2 + allowedInArgument: true }, handler: (_ref, args) => { - let parser = _ref.parser, - funcName = _ref.funcName; - const body = args[0]; - let func = funcName; + var { + parser, + funcName + } = _ref; + var body = normalizeArgument(args[0]); + var func = funcName; if (func in fontAliases) { func = fontAliases[func]; @@ -10653,13 +11166,14 @@ defineFunction({ type: "mclass", names: ["\\boldsymbol", "\\bm"], props: { - numArgs: 1, - greediness: 2 + numArgs: 1 }, handler: (_ref2, args) => { - let parser = _ref2.parser; - const body = args[0]; - const isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the + var { + parser + } = _ref2; + var body = args[0]; + var isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the // argument's bin|rel|ord status return { @@ -10685,12 +11199,16 @@ defineFunction({ allowedInText: true }, handler: (_ref3, args) => { - let parser = _ref3.parser, - funcName = _ref3.funcName, - breakOnTokenText = _ref3.breakOnTokenText; - const mode = parser.mode; - const body = parser.parseExpression(true, breakOnTokenText); - const style = `math${funcName.slice(1)}`; + var { + parser, + funcName, + breakOnTokenText + } = _ref3; + var { + mode + } = parser; + var body = parser.parseExpression(true, breakOnTokenText); + var style = "math" + funcName.slice(1); return { type: "font", mode: mode, @@ -10706,10 +11224,10 @@ defineFunction({ mathmlBuilder: mathmlBuilder$5 }); -const adjustStyle = (size, originalStyle) => { +var adjustStyle = (size, originalStyle) => { // Figure out what style this fraction should be in based on the // function used - let style = originalStyle; + var style = originalStyle; if (size === "display") { // Get display style as a default. @@ -10727,29 +11245,29 @@ const adjustStyle = (size, originalStyle) => { return style; }; -const htmlBuilder$6 = (group, options) => { +var htmlBuilder$6 = (group, options) => { // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). - const style = adjustStyle(group.size, options.style); - const nstyle = style.fracNum(); - const dstyle = style.fracDen(); - let newOptions; + var style = adjustStyle(group.size, options.style); + var nstyle = style.fracNum(); + var dstyle = style.fracDen(); + var newOptions; newOptions = options.havingStyle(nstyle); - const numerm = buildGroup(group.numer, newOptions, options); + var numerm = buildGroup(group.numer, newOptions, options); if (group.continued) { // \cfrac inserts a \strut into the numerator. // Get \strut dimensions from TeXbook page 353. - const hStrut = 8.5 / options.fontMetrics().ptPerEm; - const dStrut = 3.5 / options.fontMetrics().ptPerEm; + var hStrut = 8.5 / options.fontMetrics().ptPerEm; + var dStrut = 3.5 / options.fontMetrics().ptPerEm; numerm.height = numerm.height < hStrut ? hStrut : numerm.height; numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth; } newOptions = options.havingStyle(dstyle); - const denomm = buildGroup(group.denom, newOptions, options); - let rule; - let ruleWidth; - let ruleSpacing; + var denomm = buildGroup(group.denom, newOptions, options); + var rule; + var ruleWidth; + var ruleSpacing; if (group.hasBarLine) { if (group.barSize) { @@ -10768,9 +11286,9 @@ const htmlBuilder$6 = (group, options) => { } // Rule 15b - let numShift; - let clearance; - let denomShift; + var numShift; + var clearance; + var denomShift; if (style.size === Style$1.DISPLAY.size || group.size === "display") { numShift = options.fontMetrics().num1; @@ -10794,11 +11312,11 @@ const htmlBuilder$6 = (group, options) => { denomShift = options.fontMetrics().denom2; } - let frac; + var frac; if (!rule) { // Rule 15c - const candidateClearance = numShift - numerm.depth - (denomm.height - denomShift); + var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift); if (candidateClearance < clearance) { numShift += 0.5 * (clearance - candidateClearance); @@ -10819,7 +11337,7 @@ const htmlBuilder$6 = (group, options) => { }, options); } else { // Rule 15d - const axisHeight = options.fontMetrics().axisHeight; + var axisHeight = options.fontMetrics().axisHeight; if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) { numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); @@ -10829,7 +11347,7 @@ const htmlBuilder$6 = (group, options) => { denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); } - const midShift = -(axisHeight - 0.5 * ruleWidth); + var midShift = -(axisHeight - 0.5 * ruleWidth); frac = buildCommon.makeVList({ positionType: "individualShift", children: [{ @@ -10854,7 +11372,7 @@ const htmlBuilder$6 = (group, options) => { frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier; frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e - let delimSize; + var delimSize; if (style.size === Style$1.DISPLAY.size) { delimSize = options.fontMetrics().delim1; @@ -10862,8 +11380,8 @@ const htmlBuilder$6 = (group, options) => { delimSize = options.fontMetrics().delim2; } - let leftDelim; - let rightDelim; + var leftDelim; + var rightDelim; if (group.leftDelim == null) { leftDelim = makeNullDelimiter(options, ["mopen"]); @@ -10882,30 +11400,30 @@ const htmlBuilder$6 = (group, options) => { return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options); }; -const mathmlBuilder$6 = (group, options) => { - let node = new mathMLTree.MathNode("mfrac", [buildGroup$1(group.numer, options), buildGroup$1(group.denom, options)]); +var mathmlBuilder$6 = (group, options) => { + var node = new mathMLTree.MathNode("mfrac", [buildGroup$1(group.numer, options), buildGroup$1(group.denom, options)]); if (!group.hasBarLine) { node.setAttribute("linethickness", "0px"); } else if (group.barSize) { - const ruleWidth = calculateSize(group.barSize, options); + var ruleWidth = calculateSize(group.barSize, options); node.setAttribute("linethickness", ruleWidth + "em"); } - const style = adjustStyle(group.size, options.style); + var style = adjustStyle(group.size, options.style); if (style.size !== options.style.size) { node = new mathMLTree.MathNode("mstyle", [node]); - const isDisplay = style.size === Style$1.DISPLAY.size ? "true" : "false"; + var isDisplay = style.size === Style$1.DISPLAY.size ? "true" : "false"; node.setAttribute("displaystyle", isDisplay); node.setAttribute("scriptlevel", "0"); } if (group.leftDelim != null || group.rightDelim != null) { - const withDelims = []; + var withDelims = []; if (group.leftDelim != null) { - const leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]); + var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]); leftOp.setAttribute("fence", "true"); withDelims.push(leftOp); } @@ -10913,7 +11431,7 @@ const mathmlBuilder$6 = (group, options) => { withDelims.push(node); if (group.rightDelim != null) { - const rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]); + var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]); rightOp.setAttribute("fence", "true"); withDelims.push(rightOp); } @@ -10926,24 +11444,26 @@ const mathmlBuilder$6 = (group, options) => { defineFunction({ type: "genfrac", - names: ["\\cfrac", "\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly - "\\\\bracefrac", "\\\\brackfrac"], + names: ["\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly + "\\\\bracefrac", "\\\\brackfrac" // ditto + ], props: { numArgs: 2, - greediness: 2 + allowedInArgument: true }, handler: (_ref, args) => { - let parser = _ref.parser, - funcName = _ref.funcName; - const numer = args[0]; - const denom = args[1]; - let hasBarLine; - let leftDelim = null; - let rightDelim = null; - let size = "auto"; + var { + parser, + funcName + } = _ref; + var numer = args[0]; + var denom = args[1]; + var hasBarLine; + var leftDelim = null; + var rightDelim = null; + var size = "auto"; switch (funcName) { - case "\\cfrac": case "\\dfrac": case "\\frac": case "\\tfrac": @@ -10979,7 +11499,6 @@ defineFunction({ } switch (funcName) { - case "\\cfrac": case "\\dfrac": case "\\dbinom": size = "display"; @@ -10994,7 +11513,7 @@ defineFunction({ return { type: "genfrac", mode: parser.mode, - continued: funcName === "\\cfrac", + continued: false, numer, denom, hasBarLine, @@ -11006,6 +11525,33 @@ defineFunction({ }, htmlBuilder: htmlBuilder$6, mathmlBuilder: mathmlBuilder$6 +}); +defineFunction({ + type: "genfrac", + names: ["\\cfrac"], + props: { + numArgs: 2 + }, + handler: (_ref2, args) => { + var { + parser, + funcName + } = _ref2; + var numer = args[0]; + var denom = args[1]; + return { + type: "genfrac", + mode: parser.mode, + continued: true, + numer, + denom, + hasBarLine: true, + leftDelim: null, + rightDelim: null, + size: "display", + barSize: null + }; + } }); // Infix generalized fractions -- these are not rendered directly, but replaced // immediately by one of the variants above. @@ -11017,11 +11563,13 @@ defineFunction({ infix: true }, - handler(_ref2) { - let parser = _ref2.parser, - funcName = _ref2.funcName, - token = _ref2.token; - let replaceWith; + handler(_ref3) { + var { + parser, + funcName, + token + } = _ref3; + var replaceWith; switch (funcName) { case "\\over": @@ -11057,10 +11605,10 @@ defineFunction({ } }); -const stylArray = ["display", "text", "script", "scriptscript"]; +var stylArray = ["display", "text", "script", "scriptscript"]; -const delimFromValue = function delimFromValue(delimString) { - let delim = null; +var delimFromValue = function delimFromValue(delimString) { + var delim = null; if (delimString.length > 0) { delim = delimString; @@ -11075,20 +11623,24 @@ defineFunction({ names: ["\\genfrac"], props: { numArgs: 6, - greediness: 6, + allowedInArgument: true, argTypes: ["math", "math", "size", "text", "math", "math"] }, - handler(_ref3, args) { - let parser = _ref3.parser; - const numer = args[4]; - const denom = args[5]; // Look into the parse nodes to get the desired delimiters. + handler(_ref4, args) { + var { + parser + } = _ref4; + var numer = args[4]; + var denom = args[5]; // Look into the parse nodes to get the desired delimiters. - const leftDelim = args[0].type === "atom" && args[0].family === "open" ? delimFromValue(args[0].text) : null; - const rightDelim = args[1].type === "atom" && args[1].family === "close" ? delimFromValue(args[1].text) : null; - const barNode = assertNodeType(args[2], "size"); - let hasBarLine; - let barSize = null; + var leftNode = normalizeArgument(args[0]); + var leftDelim = leftNode.type === "atom" && leftNode.family === "open" ? delimFromValue(leftNode.text) : null; + var rightNode = normalizeArgument(args[1]); + var rightDelim = rightNode.type === "atom" && rightNode.family === "close" ? delimFromValue(rightNode.text) : null; + var barNode = assertNodeType(args[2], "size"); + var hasBarLine; + var barSize = null; if (barNode.isBlank) { // \genfrac acts differently than \above. @@ -11101,12 +11653,12 @@ defineFunction({ } // Find out if we want displaystyle, textstyle, etc. - let size = "auto"; - let styl = args[3]; + var size = "auto"; + var styl = args[3]; if (styl.type === "ordgroup") { if (styl.body.length > 0) { - const textOrd = assertNodeType(styl.body[0], "textord"); + var textOrd = assertNodeType(styl.body[0], "textord"); size = stylArray[Number(textOrd.text)]; } } else { @@ -11141,10 +11693,12 @@ defineFunction({ infix: true }, - handler(_ref4, args) { - let parser = _ref4.parser, - funcName = _ref4.funcName, - token = _ref4.token; + handler(_ref5, args) { + var { + parser, + funcName, + token + } = _ref5; return { type: "infix", mode: parser.mode, @@ -11162,13 +11716,15 @@ defineFunction({ numArgs: 3, argTypes: ["math", "size", "math"] }, - handler: (_ref5, args) => { - let parser = _ref5.parser, - funcName = _ref5.funcName; - const numer = args[0]; - const barSize = assert(assertNodeType(args[1], "infix").size); - const denom = args[2]; - const hasBarLine = barSize.number > 0; + handler: (_ref6, args) => { + var { + parser, + funcName + } = _ref6; + var numer = args[0]; + var barSize = assert(assertNodeType(args[1], "infix").size); + var denom = args[2]; + var hasBarLine = barSize.number > 0; return { type: "genfrac", mode: parser.mode, @@ -11187,11 +11743,12 @@ defineFunction({ }); // NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but -const htmlBuilder$7 = (grp, options) => { - const style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node. +// also "supsub" since an over/underbrace can affect super/subscripting. +var htmlBuilder$7 = (grp, options) => { + var style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node. - let supSubGroup; - let group; + var supSubGroup; + var group; if (grp.type === "supsub") { // Ref: LaTeX source2e: }}}}\limits} @@ -11204,12 +11761,12 @@ const htmlBuilder$7 = (grp, options) => { } // Build the base group - const body = buildGroup(group.base, options.havingBaseStyle(Style$1.DISPLAY)); // Create the stretchy element + var body = buildGroup(group.base, options.havingBaseStyle(Style$1.DISPLAY)); // Create the stretchy element - const braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓ + var braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓ // This first vlist contains the content and the brace: equation - let vlist; + var vlist; if (group.isOver) { vlist = buildCommon.makeVList({ @@ -11254,7 +11811,7 @@ const htmlBuilder$7 = (grp, options) => { // note long note long note // ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓ // equation eqn eqn - const vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); + var vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); if (group.isOver) { vlist = buildCommon.makeVList({ @@ -11291,8 +11848,8 @@ const htmlBuilder$7 = (grp, options) => { return buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); }; -const mathmlBuilder$7 = (group, options) => { - const accentNode = stretchy.mathMLnode(group.label); +var mathmlBuilder$7 = (group, options) => { + var accentNode = stretchy.mathMLnode(group.label); return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [buildGroup$1(group.base, options), accentNode]); }; // Horizontal stretchy braces @@ -11305,8 +11862,10 @@ defineFunction({ }, handler(_ref, args) { - let parser = _ref.parser, - funcName = _ref.funcName; + var { + parser, + funcName + } = _ref; return { type: "horizBrace", mode: parser.mode, @@ -11329,9 +11888,11 @@ defineFunction({ allowedInText: true }, handler: (_ref, args) => { - let parser = _ref.parser; - const body = args[1]; - const href = assertNodeType(args[0], "url").url; + var { + parser + } = _ref; + var body = args[1]; + var href = assertNodeType(args[0], "url").url; if (!parser.settings.isTrusted({ command: "\\href", @@ -11348,11 +11909,11 @@ defineFunction({ }; }, htmlBuilder: (group, options) => { - const elements = buildExpression(group.body, options, false); + var elements = buildExpression(group.body, options, false); return buildCommon.makeAnchor(group.href, [], elements, options); }, mathmlBuilder: (group, options) => { - let math = buildExpressionRow(group.body, options); + var math = buildExpressionRow(group.body, options); if (!(math instanceof MathNode)) { math = new MathNode("mrow", [math]); @@ -11371,8 +11932,10 @@ defineFunction({ allowedInText: true }, handler: (_ref2, args) => { - let parser = _ref2.parser; - const href = assertNodeType(args[0], "url").url; + var { + parser + } = _ref2; + var href = assertNodeType(args[0], "url").url; if (!parser.settings.isTrusted({ command: "\\url", @@ -11381,10 +11944,10 @@ defineFunction({ return parser.formatUnsupportedCmd("\\url"); } - const chars = []; + var chars = []; - for (let i = 0; i < href.length; i++) { - let c = href[i]; + for (var i = 0; i < href.length; i++) { + var c = href[i]; if (c === "~") { c = "\\textasciitilde"; @@ -11397,7 +11960,7 @@ defineFunction({ }); } - const body = { + var body = { type: "text", mode: parser.mode, font: "\\texttt", @@ -11412,6 +11975,42 @@ defineFunction({ } }); +// In LaTeX, \vcenter can act only on a box, as in +// \vcenter{\hbox{$\frac{a+b}{\dfrac{c}{d}}$}} +// This function by itself doesn't do anything but prevent a soft line break. + +defineFunction({ + type: "hbox", + names: ["\\hbox"], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInText: true, + primitive: true + }, + + handler(_ref, args) { + var { + parser + } = _ref; + return { + type: "hbox", + mode: parser.mode, + body: ordargument(args[0]) + }; + }, + + htmlBuilder(group, options) { + var elements = buildExpression(group.body, options, false); + return buildCommon.makeFragment(elements); + }, + + mathmlBuilder(group, options) { + return new mathMLTree.MathNode("mrow", buildExpression$1(group.body, options)); + } + +}); + defineFunction({ type: "html", names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"], @@ -11421,18 +12020,20 @@ defineFunction({ allowedInText: true }, handler: (_ref, args) => { - let parser = _ref.parser, - funcName = _ref.funcName, - token = _ref.token; - const value = assertNodeType(args[0], "raw").string; - const body = args[1]; + var { + parser, + funcName, + token + } = _ref; + var value = assertNodeType(args[0], "raw").string; + var body = args[1]; if (parser.settings.strict) { parser.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode"); } - let trustContext; - const attributes = {}; + var trustContext; + var attributes = {}; switch (funcName) { case "\\htmlClass": @@ -11461,10 +12062,10 @@ defineFunction({ case "\\htmlData": { - const data = value.split(","); + var data = value.split(","); - for (let i = 0; i < data.length; i++) { - const keyVal = data[i].split("="); + for (var i = 0; i < data.length; i++) { + var keyVal = data[i].split("="); if (keyVal.length !== 2) { throw new ParseError("Error parsing key-value for \\htmlData"); @@ -11496,16 +12097,16 @@ defineFunction({ }; }, htmlBuilder: (group, options) => { - const elements = buildExpression(group.body, options, false); - const classes = ["enclosing"]; + var elements = buildExpression(group.body, options, false); + var classes = ["enclosing"]; if (group.attributes.class) { classes.push(...group.attributes.class.trim().split(/\s+/)); } - const span = buildCommon.makeSpan(classes, elements, options); + var span = buildCommon.makeSpan(classes, elements, options); - for (const attr in group.attributes) { + for (var attr in group.attributes) { if (attr !== "class" && group.attributes.hasOwnProperty(attr)) { span.setAttribute(attr, group.attributes[attr]); } @@ -11526,7 +12127,9 @@ defineFunction({ allowedInText: true }, handler: (_ref, args) => { - let parser = _ref.parser; + var { + parser + } = _ref; return { type: "htmlmathml", mode: parser.mode, @@ -11535,7 +12138,7 @@ defineFunction({ }; }, htmlBuilder: (group, options) => { - const elements = buildExpression(group.html, options, false); + var elements = buildExpression(group.html, options, false); return buildCommon.makeFragment(elements); }, mathmlBuilder: (group, options) => { @@ -11543,7 +12146,7 @@ defineFunction({ } }); -const sizeData = function sizeData(str) { +var sizeData = function sizeData(str) { if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) { // str is a number with no unit specified. // default unit is bp, per graphix package. @@ -11552,13 +12155,13 @@ const sizeData = function sizeData(str) { unit: "bp" }; } else { - const match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str); + var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str); if (!match) { throw new ParseError("Invalid size: '" + str + "' in \\includegraphics"); } - const data = { + var data = { number: +(match[1] + match[2]), // sign + magnitude, cast to number unit: match[3] @@ -11582,32 +12185,34 @@ defineFunction({ allowedInText: false }, handler: (_ref, args, optArgs) => { - let parser = _ref.parser; - let width = { + var { + parser + } = _ref; + var width = { number: 0, unit: "em" }; - let height = { + var height = { number: 0.9, unit: "em" }; // sorta character sized. - let totalheight = { + var totalheight = { number: 0, unit: "em" }; - let alt = ""; + var alt = ""; if (optArgs[0]) { - const attributeStr = assertNodeType(optArgs[0], "raw").string; // Parser.js does not parse key/value pairs. We get a string. + var attributeStr = assertNodeType(optArgs[0], "raw").string; // Parser.js does not parse key/value pairs. We get a string. - const attributes = attributeStr.split(","); + var attributes = attributeStr.split(","); - for (let i = 0; i < attributes.length; i++) { - const keyVal = attributes[i].split("="); + for (var i = 0; i < attributes.length; i++) { + var keyVal = attributes[i].split("="); if (keyVal.length === 2) { - const str = keyVal[1].trim(); + var str = keyVal[1].trim(); switch (keyVal[0].trim()) { case "alt": @@ -11633,7 +12238,7 @@ defineFunction({ } } - const src = assertNodeType(args[0], "url").url; + var src = assertNodeType(args[0], "url").url; if (alt === "") { // No alt given. Use the file name. Strip away the path. @@ -11660,21 +12265,21 @@ defineFunction({ }; }, htmlBuilder: (group, options) => { - const height = calculateSize(group.height, options); - let depth = 0; + var height = calculateSize(group.height, options); + var depth = 0; if (group.totalheight.number > 0) { depth = calculateSize(group.totalheight, options) - height; depth = Number(depth.toFixed(2)); } - let width = 0; + var width = 0; if (group.width.number > 0) { width = calculateSize(group.width, options); } - const style = { + var style = { height: height + depth + "em" }; @@ -11686,16 +12291,16 @@ defineFunction({ style.verticalAlign = -depth + "em"; } - const node = new Img(group.src, group.alt, style); + var node = new Img(group.src, group.alt, style); node.height = height; node.depth = depth; return node; }, mathmlBuilder: (group, options) => { - const node = new mathMLTree.MathNode("mglyph", []); + var node = new mathMLTree.MathNode("mglyph", []); node.setAttribute("alt", group.alt); - const height = calculateSize(group.height, options); - let depth = 0; + var height = calculateSize(group.height, options); + var depth = 0; if (group.totalheight.number > 0) { depth = calculateSize(group.totalheight, options) - height; @@ -11706,7 +12311,7 @@ defineFunction({ node.setAttribute("height", height + depth + "em"); if (group.width.number > 0) { - const width = calculateSize(group.width, options); + var width = calculateSize(group.width, options); node.setAttribute("width", width + "em"); } @@ -11723,31 +12328,34 @@ defineFunction({ props: { numArgs: 1, argTypes: ["size"], + primitive: true, allowedInText: true }, handler(_ref, args) { - let parser = _ref.parser, - funcName = _ref.funcName; - const size = assertNodeType(args[0], "size"); + var { + parser, + funcName + } = _ref; + var size = assertNodeType(args[0], "size"); if (parser.settings.strict) { - const mathFunction = funcName[1] === 'm'; // \mkern, \mskip + var mathFunction = funcName[1] === 'm'; // \mkern, \mskip - const muUnit = size.value.unit === 'mu'; + var muUnit = size.value.unit === 'mu'; if (mathFunction) { if (!muUnit) { - parser.settings.reportNonstrict("mathVsTextUnits", `LaTeX's ${funcName} supports only mu units, ` + `not ${size.value.unit} units`); + parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units")); } if (parser.mode !== "math") { - parser.settings.reportNonstrict("mathVsTextUnits", `LaTeX's ${funcName} works only in math mode`); + parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode"); } } else { // !mathFunction if (muUnit) { - parser.settings.reportNonstrict("mathVsTextUnits", `LaTeX's ${funcName} doesn't support mu units`); + parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units"); } } } @@ -11764,7 +12372,7 @@ defineFunction({ }, mathmlBuilder(group, options) { - const dimension = calculateSize(group.dimension, options); + var dimension = calculateSize(group.dimension, options); return new mathMLTree.SpaceNode(dimension); } @@ -11779,9 +12387,11 @@ defineFunction({ allowedInText: true }, handler: (_ref, args) => { - let parser = _ref.parser, - funcName = _ref.funcName; - const body = args[0]; + var { + parser, + funcName + } = _ref; + var body = args[0]; return { type: "lap", mode: parser.mode, @@ -11791,7 +12401,7 @@ defineFunction({ }, htmlBuilder: (group, options) => { // mathllap, mathrlap, mathclap - let inner; + var inner; if (group.alignment === "clap") { // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/ @@ -11802,14 +12412,14 @@ defineFunction({ inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options)]); } - const fix = buildCommon.makeSpan(["fix"], []); - let node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the + var fix = buildCommon.makeSpan(["fix"], []); + var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the // two items involved in the lap. // Next, use a strut to set the height of the HTML bounding box. // Otherwise, a tall argument may be misplaced. // This code resolved issue #1153 - const strut = buildCommon.makeSpan(["strut"]); + var strut = buildCommon.makeSpan(["strut"]); strut.style.height = node.height + node.depth + "em"; strut.style.verticalAlign = -node.depth + "em"; node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall. @@ -11820,10 +12430,10 @@ defineFunction({ }, mathmlBuilder: (group, options) => { // mathllap, mathrlap, mathclap - const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); + var node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); if (group.alignment !== "rlap") { - const offset = group.alignment === "llap" ? "-1" : "-0.5"; + var offset = group.alignment === "llap" ? "-1" : "-0.5"; node.setAttribute("lspace", offset + "width"); } @@ -11842,12 +12452,14 @@ defineFunction({ }, handler(_ref, args) { - let funcName = _ref.funcName, - parser = _ref.parser; - const outerMode = parser.mode; + var { + funcName, + parser + } = _ref; + var outerMode = parser.mode; parser.switchMode("math"); - const close = funcName === "\\(" ? "\\)" : "$"; - const body = parser.parseExpression(false, close); + var close = funcName === "\\(" ? "\\)" : "$"; + var body = parser.parseExpression(false, close); parser.expect(close); parser.switchMode(outerMode); return { @@ -11871,12 +12483,12 @@ defineFunction({ }, handler(context, args) { - throw new ParseError(`Mismatched ${context.funcName}`); + throw new ParseError("Mismatched " + context.funcName); } }); -const chooseMathStyle = (group, options) => { +var chooseMathStyle = (group, options) => { switch (options.style.size) { case Style$1.DISPLAY.size: return group.display; @@ -11899,10 +12511,13 @@ defineFunction({ type: "mathchoice", names: ["\\mathchoice"], props: { - numArgs: 4 + numArgs: 4, + primitive: true }, handler: (_ref, args) => { - let parser = _ref.parser; + var { + parser + } = _ref; return { type: "mathchoice", mode: parser.mode, @@ -11913,25 +12528,25 @@ defineFunction({ }; }, htmlBuilder: (group, options) => { - const body = chooseMathStyle(group, options); - const elements = buildExpression(body, options, false); + var body = chooseMathStyle(group, options); + var elements = buildExpression(body, options, false); return buildCommon.makeFragment(elements); }, mathmlBuilder: (group, options) => { - const body = chooseMathStyle(group, options); + var body = chooseMathStyle(group, options); return buildExpressionRow(body, options); } }); // For an operator with limits, assemble the base, sup, and sub into a span. -const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift) => { +var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift) => { base = buildCommon.makeSpan([], [base]); - let sub; - let sup; // We manually have to handle the superscripts and subscripts. This, + var sub; + var sup; // We manually have to handle the superscripts and subscripts. This, // aside from the kern calculations, is copied from supsub. if (supGroup) { - const elem = buildGroup(supGroup, options.havingStyle(style.sup()), options); + var elem = buildGroup(supGroup, options.havingStyle(style.sup()), options); sup = { elem, kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth) @@ -11939,19 +12554,20 @@ const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShi } if (subGroup) { - const elem = buildGroup(subGroup, options.havingStyle(style.sub()), options); + var _elem = buildGroup(subGroup, options.havingStyle(style.sub()), options); + sub = { - elem, - kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - elem.height) + elem: _elem, + kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height) }; } // Build the final group as a vlist of the possible subscript, base, // and possible superscript. - let finalGroup; + var finalGroup; if (sup && sub) { - const bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift; + var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift; finalGroup = buildCommon.makeVList({ positionType: "bottom", positionData: bottom, @@ -11981,7 +12597,7 @@ const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShi }] }, options); } else if (sub) { - const top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note + var top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note // that we are supposed to shift the limits by 1/2 of the slant, // but since we are centering the limits adding a full slant of // margin will shift by 1/2 that. @@ -12005,10 +12621,11 @@ const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShi }] }, options); } else if (sup) { - const bottom = base.depth + baseShift; + var _bottom = base.depth + baseShift; + finalGroup = buildCommon.makeVList({ positionType: "bottom", - positionData: bottom, + positionData: _bottom, children: [{ type: "elem", elem: base @@ -12036,15 +12653,15 @@ const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShi // Limits, symbols // Most operators have a large successor symbol, but these don't. -const noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also +var noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also // "supsub" since some of them (like \int) can affect super/subscripting. -const htmlBuilder$8 = (grp, options) => { +var htmlBuilder$8 = (grp, options) => { // Operators are handled in the TeXbook pg. 443-444, rule 13(a). - let supGroup; - let subGroup; - let hasLimits = false; - let group; + var supGroup; + var subGroup; + var hasLimits = false; + var group; if (grp.type === "supsub") { // If we have limits, supsub will pass us its group to handle. Pull @@ -12058,26 +12675,25 @@ const htmlBuilder$8 = (grp, options) => { group = assertNodeType(grp, "op"); } - const style = options.style; - let large = false; + var style = options.style; + var large = false; if (style.size === Style$1.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) { // Most symbol operators get larger in displaystyle (rule 13) large = true; } - let base; + var base; if (group.symbol) { // If this is a symbol, create the symbol. - const fontName = large ? "Size2-Regular" : "Size1-Regular"; - let stash = ""; + var fontName = large ? "Size2-Regular" : "Size1-Regular"; + var stash = ""; if (group.name === "\\oiint" || group.name === "\\oiiint") { // No font glyphs yet, so use a glyph w/o the oval. // TODO: When font glyphs are available, delete this code. - stash = group.name.substr(1); // $FlowFixMe - + stash = group.name.substr(1); group.name = stash === "oiint" ? "\\iint" : "\\iiint"; } @@ -12086,8 +12702,8 @@ const htmlBuilder$8 = (grp, options) => { if (stash.length > 0) { // We're in \oiint or \oiiint. Overlay the oval. // TODO: When font glyphs are available, delete this code. - const italic = base.italic; - const oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options); + var italic = base.italic; + var oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options); base = buildCommon.makeVList({ positionType: "individualShift", children: [{ @@ -12099,8 +12715,7 @@ const htmlBuilder$8 = (grp, options) => { elem: oval, shift: large ? 0.08 : 0 }] - }, options); // $FlowFixMe - + }, options); group.name = "\\" + stash; base.classes.unshift("mop"); // $FlowFixMe @@ -12108,22 +12723,20 @@ const htmlBuilder$8 = (grp, options) => { } } else if (group.body) { // If this is a list, compose that list. - const inner = buildExpression(group.body, options, true); + var inner = buildExpression(group.body, options, true); if (inner.length === 1 && inner[0] instanceof SymbolNode) { base = inner[0]; base.classes[0] = "mop"; // replace old mclass } else { - base = buildCommon.makeSpan(["mop"], buildCommon.tryCombineChars(inner), options); + base = buildCommon.makeSpan(["mop"], inner, options); } } else { // Otherwise, this is a text operator. Build the text from the // operator's name. - // TODO(emily): Add a space in the middle of some of these - // operators, like \limsup - const output = []; + var output = []; - for (let i = 1; i < group.name.length; i++) { + for (var i = 1; i < group.name.length; i++) { output.push(buildCommon.mathsym(group.name[i], group.mode, options)); } @@ -12131,8 +12744,8 @@ const htmlBuilder$8 = (grp, options) => { } // If content of op is a single symbol, shift it vertically. - let baseShift = 0; - let slant = 0; + var baseShift = 0; + var slant = 0; if ((base instanceof SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) { // We suppress the shift of the base of \overset and \underset. Otherwise, @@ -12159,8 +12772,8 @@ const htmlBuilder$8 = (grp, options) => { } }; -const mathmlBuilder$8 = (group, options) => { - let node; +var mathmlBuilder$8 = (group, options) => { + var node; if (group.symbol) { // This is a symbol. Just add the symbol. @@ -12178,10 +12791,10 @@ const mathmlBuilder$8 = (group, options) => { node = new MathNode("mi", [new TextNode(group.name.slice(1))]); // Append an . // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 - const operator = new MathNode("mo", [makeText("\u2061", "text")]); + var operator = new MathNode("mo", [makeText("\u2061", "text")]); if (group.parentIsSupSub) { - node = new MathNode("mo", [node, operator]); + node = new MathNode("mrow", [node, operator]); } else { node = newDocumentFragment([node, operator]); } @@ -12190,7 +12803,7 @@ const mathmlBuilder$8 = (group, options) => { return node; }; -const singleCharBigOps = { +var singleCharBigOps = { "\u220F": "\\prod", "\u2210": "\\coprod", "\u2211": "\\sum", @@ -12211,9 +12824,11 @@ defineFunction({ numArgs: 0 }, handler: (_ref, args) => { - let parser = _ref.parser, - funcName = _ref.funcName; - let fName = funcName; + var { + parser, + funcName + } = _ref; + var fName = funcName; if (fName.length === 1) { fName = singleCharBigOps[fName]; @@ -12237,11 +12852,14 @@ defineFunction({ type: "op", names: ["\\mathop"], props: { - numArgs: 1 + numArgs: 1, + primitive: true }, handler: (_ref2, args) => { - let parser = _ref2.parser; - const body = args[0]; + var { + parser + } = _ref2; + var body = args[0]; return { type: "op", mode: parser.mode, @@ -12257,7 +12875,7 @@ defineFunction({ // displaystyle, and whether they are symbols and should grow in // displaystyle. These four groups cover the four possible choices. -const singleCharIntegrals = { +var singleCharIntegrals = { "\u222b": "\\int", "\u222c": "\\iint", "\u222d": "\\iiint", @@ -12274,8 +12892,10 @@ defineFunction({ }, handler(_ref3) { - let parser = _ref3.parser, - funcName = _ref3.funcName; + var { + parser, + funcName + } = _ref3; return { type: "op", mode: parser.mode, @@ -12298,8 +12918,10 @@ defineFunction({ }, handler(_ref4) { - let parser = _ref4.parser, - funcName = _ref4.funcName; + var { + parser, + funcName + } = _ref4; return { type: "op", mode: parser.mode, @@ -12322,9 +12944,11 @@ defineFunction({ }, handler(_ref5) { - let parser = _ref5.parser, - funcName = _ref5.funcName; - let fName = funcName; + var { + parser, + funcName + } = _ref5; + var fName = funcName; if (fName.length === 1) { fName = singleCharIntegrals[fName]; @@ -12346,12 +12970,13 @@ defineFunction({ // NOTE: Unlike most `htmlBuilder`s, this one handles not only // "operatorname", but also "supsub" since \operatorname* can -const htmlBuilder$9 = (grp, options) => { +// affect super/subscripting. +var htmlBuilder$9 = (grp, options) => { // Operators are handled in the TeXbook pg. 443-444, rule 13(a). - let supGroup; - let subGroup; - let hasLimits = false; - let group; + var supGroup; + var subGroup; + var hasLimits = false; + var group; if (grp.type === "supsub") { // If we have limits, supsub will pass us its group to handle. Pull @@ -12365,12 +12990,12 @@ const htmlBuilder$9 = (grp, options) => { group = assertNodeType(grp, "operatorname"); } - let base; + var base; if (group.body.length > 0) { - const body = group.body.map(child => { + var body = group.body.map(child => { // $FlowFixMe: Check if the node has a string `text` property. - const childText = child.text; + var childText = child.text; if (typeof childText === "string") { return { @@ -12383,10 +13008,10 @@ const htmlBuilder$9 = (grp, options) => { } }); // Consolidate function names into symbol characters. - const expression = buildExpression(body, options.withFont("mathrm"), true); + var expression = buildExpression(body, options.withFont("mathrm"), true); - for (let i = 0; i < expression.length; i++) { - const child = expression[i]; + for (var i = 0; i < expression.length; i++) { + var child = expression[i]; if (child instanceof SymbolNode) { // Per amsopn package, @@ -12407,14 +13032,14 @@ const htmlBuilder$9 = (grp, options) => { } }; -const mathmlBuilder$9 = (group, options) => { +var mathmlBuilder$9 = (group, options) => { // The steps taken here are similar to the html version. - let expression = buildExpression$1(group.body, options.withFont("mathrm")); // Is expression a string or has it something like a fraction? + var expression = buildExpression$1(group.body, options.withFont("mathrm")); // Is expression a string or has it something like a fraction? - let isAllString = true; // default + var isAllString = true; // default - for (let i = 0; i < expression.length; i++) { - const node = expression[i]; + for (var i = 0; i < expression.length; i++) { + var node = expression[i]; if (node instanceof mathMLTree.SpaceNode) ; else if (node instanceof mathMLTree.MathNode) { switch (node.type) { @@ -12428,7 +13053,7 @@ const mathmlBuilder$9 = (group, options) => { case "mo": { - const child = node.children[0]; + var child = node.children[0]; if (node.children.length === 1 && child instanceof mathMLTree.TextNode) { child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); @@ -12449,18 +13074,18 @@ const mathmlBuilder$9 = (group, options) => { if (isAllString) { // Write a single TextNode instead of multiple nested tags. - const word = expression.map(node => node.toText()).join(""); + var word = expression.map(node => node.toText()).join(""); expression = [new mathMLTree.TextNode(word)]; } - const identifier = new mathMLTree.MathNode("mi", expression); + var identifier = new mathMLTree.MathNode("mi", expression); identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as ⁡ // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp - const operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]); + var operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]); if (group.parentIsSupSub) { - return new mathMLTree.MathNode("mo", [identifier, operator]); + return new mathMLTree.MathNode("mrow", [identifier, operator]); } else { return mathMLTree.newDocumentFragment([identifier, operator]); } @@ -12475,9 +13100,11 @@ defineFunction({ numArgs: 1 }, handler: (_ref, args) => { - let parser = _ref.parser, - funcName = _ref.funcName; - const body = args[0]; + var { + parser, + funcName + } = _ref; + var body = args[0]; return { type: "operatorname", mode: parser.mode, @@ -12516,8 +13143,10 @@ defineFunction({ }, handler(_ref, args) { - let parser = _ref.parser; - const body = args[0]; + var { + parser + } = _ref; + var body = args[0]; return { type: "overline", mode: parser.mode, @@ -12528,12 +13157,12 @@ defineFunction({ htmlBuilder(group, options) { // Overlines are handled in the TeXbook pg 443, Rule 9. // Build the inner group in the cramped style. - const innerGroup = buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body + var innerGroup = buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body - const line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns + var line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns - const defaultRuleThickness = options.fontMetrics().defaultRuleThickness; - const vlist = buildCommon.makeVList({ + var defaultRuleThickness = options.fontMetrics().defaultRuleThickness; + var vlist = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", @@ -12553,9 +13182,9 @@ defineFunction({ }, mathmlBuilder(group, options) { - const operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203e")]); + var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203e")]); operator.setAttribute("stretchy", "true"); - const node = new mathMLTree.MathNode("mover", [buildGroup$1(group.body, options), operator]); + var node = new mathMLTree.MathNode("mover", [buildGroup$1(group.body, options), operator]); node.setAttribute("accent", "true"); return node; } @@ -12570,8 +13199,10 @@ defineFunction({ allowedInText: true }, handler: (_ref, args) => { - let parser = _ref.parser; - const body = args[0]; + var { + parser + } = _ref; + var body = args[0]; return { type: "phantom", mode: parser.mode, @@ -12579,13 +13210,13 @@ defineFunction({ }; }, htmlBuilder: (group, options) => { - const elements = buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains. + var elements = buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains. // See "color" for more details. return buildCommon.makeFragment(elements); }, mathmlBuilder: (group, options) => { - const inner = buildExpression$1(group.body, options); + var inner = buildExpression$1(group.body, options); return new mathMLTree.MathNode("mphantom", inner); } }); @@ -12597,8 +13228,10 @@ defineFunction({ allowedInText: true }, handler: (_ref2, args) => { - let parser = _ref2.parser; - const body = args[0]; + var { + parser + } = _ref2; + var body = args[0]; return { type: "hphantom", mode: parser.mode, @@ -12606,12 +13239,12 @@ defineFunction({ }; }, htmlBuilder: (group, options) => { - let node = buildCommon.makeSpan([], [buildGroup(group.body, options.withPhantom())]); + var node = buildCommon.makeSpan([], [buildGroup(group.body, options.withPhantom())]); node.height = 0; node.depth = 0; if (node.children) { - for (let i = 0; i < node.children.length; i++) { + for (var i = 0; i < node.children.length; i++) { node.children[i].height = 0; node.children[i].depth = 0; } @@ -12629,9 +13262,9 @@ defineFunction({ return buildCommon.makeSpan(["mord"], [node], options); }, mathmlBuilder: (group, options) => { - const inner = buildExpression$1(ordargument(group.body), options); - const phantom = new mathMLTree.MathNode("mphantom", inner); - const node = new mathMLTree.MathNode("mpadded", [phantom]); + var inner = buildExpression$1(ordargument(group.body), options); + var phantom = new mathMLTree.MathNode("mphantom", inner); + var node = new mathMLTree.MathNode("mpadded", [phantom]); node.setAttribute("height", "0px"); node.setAttribute("depth", "0px"); return node; @@ -12645,8 +13278,10 @@ defineFunction({ allowedInText: true }, handler: (_ref3, args) => { - let parser = _ref3.parser; - const body = args[0]; + var { + parser + } = _ref3; + var body = args[0]; return { type: "vphantom", mode: parser.mode, @@ -12654,14 +13289,14 @@ defineFunction({ }; }, htmlBuilder: (group, options) => { - const inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options.withPhantom())]); - const fix = buildCommon.makeSpan(["fix"], []); + var inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options.withPhantom())]); + var fix = buildCommon.makeSpan(["fix"], []); return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options); }, mathmlBuilder: (group, options) => { - const inner = buildExpression$1(ordargument(group.body), options); - const phantom = new mathMLTree.MathNode("mphantom", inner); - const node = new mathMLTree.MathNode("mpadded", [phantom]); + var inner = buildExpression$1(ordargument(group.body), options); + var phantom = new mathMLTree.MathNode("mphantom", inner); + var node = new mathMLTree.MathNode("mpadded", [phantom]); node.setAttribute("width", "0px"); return node; } @@ -12677,9 +13312,11 @@ defineFunction({ }, handler(_ref, args) { - let parser = _ref.parser; - const amount = assertNodeType(args[0], "size").value; - const body = args[1]; + var { + parser + } = _ref; + var amount = assertNodeType(args[0], "size").value; + var body = args[1]; return { type: "raisebox", mode: parser.mode, @@ -12689,8 +13326,8 @@ defineFunction({ }, htmlBuilder(group, options) { - const body = buildGroup(group.body, options); - const dy = calculateSize(group.dy, options); + var body = buildGroup(group.body, options); + var dy = calculateSize(group.dy, options); return buildCommon.makeVList({ positionType: "shift", positionData: -dy, @@ -12702,8 +13339,8 @@ defineFunction({ }, mathmlBuilder(group, options) { - const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); - const dy = group.dy.number + group.dy.unit; + var node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); + var dy = group.dy.number + group.dy.unit; node.setAttribute("voffset", dy); return node; } @@ -12720,10 +13357,12 @@ defineFunction({ }, handler(_ref, args, optArgs) { - let parser = _ref.parser; - const shift = optArgs[0]; - const width = assertNodeType(args[0], "size"); - const height = assertNodeType(args[1], "size"); + var { + parser + } = _ref; + var shift = optArgs[0]; + var width = assertNodeType(args[0], "size"); + var height = assertNodeType(args[1], "size"); return { type: "rule", mode: parser.mode, @@ -12735,11 +13374,11 @@ defineFunction({ htmlBuilder(group, options) { // Make an empty span for the rule - const rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units + var rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units - const width = calculateSize(group.width, options); - const height = calculateSize(group.height, options); - const shift = group.shift ? calculateSize(group.shift, options) : 0; // Style the rule to the right size + var width = calculateSize(group.width, options); + var height = calculateSize(group.height, options); + var shift = group.shift ? calculateSize(group.shift, options) : 0; // Style the rule to the right size rule.style.borderRightWidth = width + "em"; rule.style.borderTopWidth = height + "em"; @@ -12756,15 +13395,15 @@ defineFunction({ }, mathmlBuilder(group, options) { - const width = calculateSize(group.width, options); - const height = calculateSize(group.height, options); - const shift = group.shift ? calculateSize(group.shift, options) : 0; - const color = options.color && options.getColor() || "black"; - const rule = new mathMLTree.MathNode("mspace"); + var width = calculateSize(group.width, options); + var height = calculateSize(group.height, options); + var shift = group.shift ? calculateSize(group.shift, options) : 0; + var color = options.color && options.getColor() || "black"; + var rule = new mathMLTree.MathNode("mspace"); rule.setAttribute("mathbackground", color); rule.setAttribute("width", width + "em"); rule.setAttribute("height", height + "em"); - const wrapper = new mathMLTree.MathNode("mpadded", [rule]); + var wrapper = new mathMLTree.MathNode("mpadded", [rule]); if (shift >= 0) { wrapper.setAttribute("height", "+" + shift + "em"); @@ -12780,12 +13419,12 @@ defineFunction({ }); function sizingGroup(value, options, baseOptions) { - const inner = buildExpression(value, options, false); - const multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize + var inner = buildExpression(value, options, false); + var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize // manually. Handle nested size changes. - for (let i = 0; i < inner.length; i++) { - const pos = inner[i].classes.indexOf("sizing"); + for (var i = 0; i < inner.length; i++) { + var pos = inner[i].classes.indexOf("sizing"); if (pos < 0) { Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions)); @@ -12802,12 +13441,12 @@ function sizingGroup(value, options, baseOptions) { return buildCommon.makeFragment(inner); } -const sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"]; -const htmlBuilder$a = (group, options) => { +var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"]; +var htmlBuilder$a = (group, options) => { // Handle sizing operators like \Huge. Real TeX doesn't actually allow // these functions inside of math expressions, so we do some special // handling. - const newOptions = options.havingSize(group.size); + var newOptions = options.havingSize(group.size); return sizingGroup(group.body, newOptions, options); }; defineFunction({ @@ -12818,10 +13457,12 @@ defineFunction({ allowedInText: true }, handler: (_ref, args) => { - let breakOnTokenText = _ref.breakOnTokenText, - funcName = _ref.funcName, - parser = _ref.parser; - const body = parser.parseExpression(false, breakOnTokenText); + var { + breakOnTokenText, + funcName, + parser + } = _ref; + var body = parser.parseExpression(false, breakOnTokenText); return { type: "sizing", mode: parser.mode, @@ -12832,9 +13473,9 @@ defineFunction({ }, htmlBuilder: htmlBuilder$a, mathmlBuilder: (group, options) => { - const newOptions = options.havingSize(group.size); - const inner = buildExpression$1(group.body, newOptions); - const node = new mathMLTree.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size + var newOptions = options.havingSize(group.size); + var inner = buildExpression$1(group.body, newOptions); + var node = new mathMLTree.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size // changes, because we don't keep state of what style we're currently // in, so we can't reset the size to normal before changing it. Now // that we're passing an options parameter we should be able to fix @@ -12855,19 +13496,21 @@ defineFunction({ allowedInText: true }, handler: (_ref, args, optArgs) => { - let parser = _ref.parser; - let smashHeight = false; - let smashDepth = false; - const tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup"); + var { + parser + } = _ref; + var smashHeight = false; + var smashDepth = false; + var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup"); if (tbArg) { // Optional [tb] argument is engaged. // ref: amsmath: \renewcommand{\smash}[1][tb]{% // def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% - let letter = ""; + var letter = ""; - for (let i = 0; i < tbArg.body.length; ++i) { - const node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property. + for (var i = 0; i < tbArg.body.length; ++i) { + var node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property. letter = node.text; @@ -12886,7 +13529,7 @@ defineFunction({ smashDepth = true; } - const body = args[0]; + var body = args[0]; return { type: "smash", mode: parser.mode, @@ -12896,7 +13539,7 @@ defineFunction({ }; }, htmlBuilder: (group, options) => { - const node = buildCommon.makeSpan([], [buildGroup(group.body, options)]); + var node = buildCommon.makeSpan([], [buildGroup(group.body, options)]); if (!group.smashHeight && !group.smashDepth) { return node; @@ -12906,7 +13549,7 @@ defineFunction({ node.height = 0; // In order to influence makeVList, we have to reset the children. if (node.children) { - for (let i = 0; i < node.children.length; i++) { + for (var i = 0; i < node.children.length; i++) { node.children[i].height = 0; } } @@ -12916,8 +13559,8 @@ defineFunction({ node.depth = 0; if (node.children) { - for (let i = 0; i < node.children.length; i++) { - node.children[i].depth = 0; + for (var _i = 0; _i < node.children.length; _i++) { + node.children[_i].depth = 0; } } } // At this point, we've reset the TeX-like height and depth values. @@ -12926,7 +13569,7 @@ defineFunction({ // from acting on that line height. So we'll call makeVList now. - const smashedNode = buildCommon.makeVList({ + var smashedNode = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", @@ -12937,7 +13580,7 @@ defineFunction({ return buildCommon.makeSpan(["mord"], [smashedNode], options); }, mathmlBuilder: (group, options) => { - const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); + var node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); if (group.smashHeight) { node.setAttribute("height", "0px"); @@ -12960,9 +13603,11 @@ defineFunction({ }, handler(_ref, args, optArgs) { - let parser = _ref.parser; - const index = optArgs[0]; - const body = args[0]; + var { + parser + } = _ref; + var index = optArgs[0]; + var body = args[0]; return { type: "sqrt", mode: parser.mode, @@ -12975,7 +13620,7 @@ defineFunction({ // Square roots are handled in the TeXbook pg. 443, Rule 11. // First, we do the same steps as in overline to build the inner group // and line - let inner = buildGroup(group.body, options.havingCrampedStyle()); + var inner = buildGroup(group.body, options.havingCrampedStyle()); if (inner.height === 0) { // Render a small surd. @@ -12986,34 +13631,34 @@ defineFunction({ inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter - const metrics = options.fontMetrics(); - const theta = metrics.defaultRuleThickness; - let phi = theta; + var metrics = options.fontMetrics(); + var theta = metrics.defaultRuleThickness; + var phi = theta; if (options.style.id < Style$1.TEXT.id) { phi = options.fontMetrics().xHeight; } // Calculate the clearance between the body and line - let lineClearance = theta + phi / 4; - const minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size + var lineClearance = theta + phi / 4; + var minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size - const _delimiter$sqrtImage = delimiter.sqrtImage(minDelimiterHeight, options), - img = _delimiter$sqrtImage.span, - ruleWidth = _delimiter$sqrtImage.ruleWidth, - advanceWidth = _delimiter$sqrtImage.advanceWidth; - - const delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size + var { + span: img, + ruleWidth, + advanceWidth + } = delimiter.sqrtImage(minDelimiterHeight, options); + var delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size if (delimDepth > inner.height + inner.depth + lineClearance) { lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2; } // Shift the sqrt image - const imgShift = img.height - inner.height - lineClearance - ruleWidth; + var imgShift = img.height - inner.height - lineClearance - ruleWidth; inner.style.paddingLeft = advanceWidth + "em"; // Overlay the image and the argument. - const body = buildCommon.makeVList({ + var body = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", @@ -13036,13 +13681,13 @@ defineFunction({ } else { // Handle the optional root index // The index is always in scriptscript style - const newOptions = options.havingStyle(Style$1.SCRIPTSCRIPT); - const rootm = buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX + var newOptions = options.havingStyle(Style$1.SCRIPTSCRIPT); + var rootm = buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX // source, in the definition of `\r@@t`. - const toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly + var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly - const rootVList = buildCommon.makeVList({ + var rootVList = buildCommon.makeVList({ positionType: "shift", positionData: -toShift, children: [{ @@ -13052,20 +13697,22 @@ defineFunction({ }, options); // Add a class surrounding it so we can add on the appropriate // kerning - const rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]); + var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]); return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options); } }, mathmlBuilder(group, options) { - const body = group.body, - index = group.index; + var { + body, + index + } = group; return index ? new mathMLTree.MathNode("mroot", [buildGroup$1(body, options), buildGroup$1(index, options)]) : new mathMLTree.MathNode("msqrt", [buildGroup$1(body, options)]); } }); -const styleMap$1 = { +var styleMap$1 = { "display": Style$1.DISPLAY, "text": Style$1.TEXT, "script": Style$1.SCRIPT, @@ -13076,19 +13723,22 @@ defineFunction({ names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], props: { numArgs: 0, - allowedInText: true + allowedInText: true, + primitive: true }, handler(_ref, args) { - let breakOnTokenText = _ref.breakOnTokenText, - funcName = _ref.funcName, - parser = _ref.parser; + var { + breakOnTokenText, + funcName, + parser + } = _ref; // parse out the implicit body - const body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g. + var body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g. // here and in buildHTML and de-dupe the enumeration of all the styles). // $FlowFixMe: The names above exactly match the styles. - const style = funcName.slice(1, funcName.length - 5); + var style = funcName.slice(1, funcName.length - 5); return { type: "styling", mode: parser.mode, @@ -13101,24 +13751,24 @@ defineFunction({ htmlBuilder(group, options) { // Style changes are handled in the TeXbook on pg. 442, Rule 3. - const newStyle = styleMap$1[group.style]; - const newOptions = options.havingStyle(newStyle).withFont(''); + var newStyle = styleMap$1[group.style]; + var newOptions = options.havingStyle(newStyle).withFont(''); return sizingGroup(group.body, newOptions, options); }, mathmlBuilder(group, options) { // Figure out what style we're changing to. - const newStyle = styleMap$1[group.style]; - const newOptions = options.havingStyle(newStyle); - const inner = buildExpression$1(group.body, newOptions); - const node = new mathMLTree.MathNode("mstyle", inner); - const styleAttributes = { + var newStyle = styleMap$1[group.style]; + var newOptions = options.havingStyle(newStyle); + var inner = buildExpression$1(group.body, newOptions); + var node = new mathMLTree.MathNode("mstyle", inner); + var styleAttributes = { "display": ["0", "true"], "text": ["0", "false"], "script": ["1", "false"], "scriptscript": ["2", "false"] }; - const attr = styleAttributes[group.style]; + var attr = styleAttributes[group.style]; node.setAttribute("scriptlevel", attr[0]); node.setAttribute("displaystyle", attr[1]); return node; @@ -13133,23 +13783,24 @@ defineFunction({ * its inner element should handle the superscripts and subscripts instead of * handling them itself. */ -const htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { - const base = group.base; +var htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { + var base = group.base; if (!base) { return null; } else if (base.type === "op") { // Operators handle supsubs differently when they have limits // (e.g. `\displaystyle\sum_2^3`) - const delegate = base.limits && (options.style.size === Style$1.DISPLAY.size || base.alwaysHandleSupSub); + var delegate = base.limits && (options.style.size === Style$1.DISPLAY.size || base.alwaysHandleSupSub); return delegate ? htmlBuilder$8 : null; } else if (base.type === "operatorname") { - const delegate = base.alwaysHandleSupSub && (options.style.size === Style$1.DISPLAY.size || base.limits); - return delegate ? htmlBuilder$9 : null; + var _delegate = base.alwaysHandleSupSub && (options.style.size === Style$1.DISPLAY.size || base.limits); + + return _delegate ? htmlBuilder$9 : null; } else if (base.type === "accent") { return utils.isCharacterBox(base.base) ? htmlBuilder : null; } else if (base.type === "horizBrace") { - const isSup = !group.sub; + var isSup = !group.sub; return isSup === base.isOver ? htmlBuilder$7 : null; } else { return null; @@ -13166,26 +13817,28 @@ defineFunctionBuilders({ // 445-446, rules 18(a-f). // Here is where we defer to the inner group if it should handle // superscripts and subscripts itself. - const builderDelegate = htmlBuilderDelegate(group, options); + var builderDelegate = htmlBuilderDelegate(group, options); if (builderDelegate) { return builderDelegate(group, options); } - const valueBase = group.base, - valueSup = group.sup, - valueSub = group.sub; - const base = buildGroup(valueBase, options); - let supm; - let subm; - const metrics = options.fontMetrics(); // Rule 18a + var { + base: valueBase, + sup: valueSup, + sub: valueSub + } = group; + var base = buildGroup(valueBase, options); + var supm; + var subm; + var metrics = options.fontMetrics(); // Rule 18a - let supShift = 0; - let subShift = 0; - const isCharacterBox = valueBase && utils.isCharacterBox(valueBase); + var supShift = 0; + var subShift = 0; + var isCharacterBox = valueBase && utils.isCharacterBox(valueBase); if (valueSup) { - const newOptions = options.havingStyle(options.style.sup()); + var newOptions = options.havingStyle(options.style.sup()); supm = buildGroup(valueSup, newOptions, options); if (!isCharacterBox) { @@ -13194,16 +13847,17 @@ defineFunctionBuilders({ } if (valueSub) { - const newOptions = options.havingStyle(options.style.sub()); - subm = buildGroup(valueSub, newOptions, options); + var _newOptions = options.havingStyle(options.style.sub()); + + subm = buildGroup(valueSub, _newOptions, options); if (!isCharacterBox) { - subShift = base.depth + newOptions.fontMetrics().subDrop * newOptions.sizeMultiplier / options.sizeMultiplier; + subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier; } } // Rule 18c - let minSupShift; + var minSupShift; if (options.style === Style$1.DISPLAY) { minSupShift = metrics.sup1; @@ -13215,15 +13869,15 @@ defineFunctionBuilders({ // appropriately for use as the marginRight. - const multiplier = options.sizeMultiplier; - const marginRight = 0.5 / metrics.ptPerEm / multiplier + "em"; - let marginLeft = null; + var multiplier = options.sizeMultiplier; + var marginRight = 0.5 / metrics.ptPerEm / multiplier + "em"; + var marginLeft = null; if (subm) { // Subscripts shouldn't be shifted by the base's italic correction. // Account for that by shifting the subscript back the appropriate // amount. Note we only do this when the base is a single symbol. - const isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint"); + var isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint"); if (base instanceof SymbolNode || isOiint) { // $FlowFixMe @@ -13231,18 +13885,18 @@ defineFunctionBuilders({ } } - let supsub; + var supsub; if (supm && subm) { supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); subShift = Math.max(subShift, metrics.sub2); - const ruleWidth = metrics.defaultRuleThickness; // Rule 18e + var ruleWidth = metrics.defaultRuleThickness; // Rule 18e - const maxWidth = 4 * ruleWidth; + var maxWidth = 4 * ruleWidth; if (supShift - supm.depth - (subm.height - subShift) < maxWidth) { subShift = maxWidth - (supShift - supm.depth) + subm.height; - const psi = 0.8 * metrics.xHeight - (supShift - supm.depth); + var psi = 0.8 * metrics.xHeight - (supShift - supm.depth); if (psi > 0) { supShift += psi; @@ -13250,7 +13904,7 @@ defineFunctionBuilders({ } } - const vlistElem = [{ + var vlistElem = [{ type: "elem", elem: subm, shift: subShift, @@ -13269,7 +13923,7 @@ defineFunctionBuilders({ } else if (subm) { // Rule 18b subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight); - const vlistElem = [{ + var _vlistElem = [{ type: "elem", elem: subm, marginLeft, @@ -13278,7 +13932,7 @@ defineFunctionBuilders({ supsub = buildCommon.makeVList({ positionType: "shift", positionData: subShift, - children: vlistElem + children: _vlistElem }, options); } else if (supm) { // Rule 18c, d @@ -13297,15 +13951,15 @@ defineFunctionBuilders({ } // Wrap the supsub vlist in a span.msupsub to reset text-align. - const mclass = getTypeOfDomTree(base, "right") || "mord"; + var mclass = getTypeOfDomTree(base, "right") || "mord"; return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options); }, mathmlBuilder(group, options) { // Is the inner group a relevant horizonal brace? - let isBrace = false; - let isOver; - let isSup; + var isBrace = false; + var isOver; + var isSup; if (group.base && group.base.type === "horizBrace") { isSup = !!group.sup; @@ -13320,7 +13974,7 @@ defineFunctionBuilders({ group.base.parentIsSupSub = true; } - const children = [buildGroup$1(group.base, options)]; + var children = [buildGroup$1(group.base, options)]; if (group.sub) { children.push(buildGroup$1(group.sub, options)); @@ -13330,12 +13984,12 @@ defineFunctionBuilders({ children.push(buildGroup$1(group.sup, options)); } - let nodeType; + var nodeType; if (isBrace) { nodeType = isOver ? "mover" : "munder"; } else if (!group.sub) { - const base = group.base; + var base = group.base; if (base && base.type === "op" && base.limits && (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) { nodeType = "mover"; @@ -13345,29 +13999,28 @@ defineFunctionBuilders({ nodeType = "msup"; } } else if (!group.sup) { - const base = group.base; + var _base = group.base; - if (base && base.type === "op" && base.limits && (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) { + if (_base && _base.type === "op" && _base.limits && (options.style === Style$1.DISPLAY || _base.alwaysHandleSupSub)) { nodeType = "munder"; - } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options.style === Style$1.DISPLAY)) { + } else if (_base && _base.type === "operatorname" && _base.alwaysHandleSupSub && (_base.limits || options.style === Style$1.DISPLAY)) { nodeType = "munder"; } else { nodeType = "msub"; } } else { - const base = group.base; + var _base2 = group.base; - if (base && base.type === "op" && base.limits && options.style === Style$1.DISPLAY) { + if (_base2 && _base2.type === "op" && _base2.limits && options.style === Style$1.DISPLAY) { nodeType = "munderover"; - } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (options.style === Style$1.DISPLAY || base.limits)) { + } else if (_base2 && _base2.type === "operatorname" && _base2.alwaysHandleSupSub && (options.style === Style$1.DISPLAY || _base2.limits)) { nodeType = "munderover"; } else { nodeType = "msubsup"; } } - const node = new mathMLTree.MathNode(nodeType, children); - return node; + return new mathMLTree.MathNode(nodeType, children); } }); @@ -13380,10 +14033,10 @@ defineFunctionBuilders({ }, mathmlBuilder(group, options) { - const node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]); + var node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]); if (group.family === "bin") { - const variant = getVariant(group, options); + var variant = getVariant(group, options); if (variant === "bold-italic") { node.setAttribute("mathvariant", variant); @@ -13402,7 +14055,8 @@ defineFunctionBuilders({ }); // "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in -const defaultVariant = { +// src/symbols.js. +var defaultVariant = { "mi": "italic", "mn": "normal", "mtext": "normal" @@ -13415,8 +14069,8 @@ defineFunctionBuilders({ }, mathmlBuilder(group, options) { - const node = new mathMLTree.MathNode("mi", [makeText(group.text, group.mode, options)]); - const variant = getVariant(group, options) || "italic"; + var node = new mathMLTree.MathNode("mi", [makeText(group.text, group.mode, options)]); + var variant = getVariant(group, options) || "italic"; if (variant !== defaultVariant[node.type]) { node.setAttribute("mathvariant", variant); @@ -13434,15 +14088,13 @@ defineFunctionBuilders({ }, mathmlBuilder(group, options) { - const text = makeText(group.text, group.mode, options); - const variant = getVariant(group, options) || "normal"; - let node; + var text = makeText(group.text, group.mode, options); + var variant = getVariant(group, options) || "normal"; + var node; if (group.mode === 'text') { node = new mathMLTree.MathNode("mtext", [text]); } else if (/[0-9]/.test(group.text)) { - // TODO(kevinb) merge adjacent nodes - // do it as a post processing step node = new mathMLTree.MathNode("mn", [text]); } else if (group.text === "\\prime") { node = new mathMLTree.MathNode("mo", [text]); @@ -13459,7 +14111,7 @@ defineFunctionBuilders({ }); -const cssSpace = { +var cssSpace = { "\\nobreak": "nobreak", "\\allowbreak": "allowbreak" }; // A lookup table to determine whether a spacing function/symbol should be @@ -13468,7 +14120,7 @@ const cssSpace = { // the associated value may have a `className` specifying an extra CSS class // to add to the created `span`. -const regularSpace = { +var regularSpace = { " ": {}, "\\ ": {}, "~": { @@ -13486,12 +14138,12 @@ defineFunctionBuilders({ htmlBuilder(group, options) { if (regularSpace.hasOwnProperty(group.text)) { - const className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these + var className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these // things has an entry in the symbols table, so these will be turned // into appropriate outputs. if (group.mode === "text") { - const ord = buildCommon.makeOrd(group, options, "textord"); + var ord = buildCommon.makeOrd(group, options, "textord"); ord.classes.push(className); return ord; } else { @@ -13501,12 +14153,12 @@ defineFunctionBuilders({ // Spaces based on just a CSS class. return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options); } else { - throw new ParseError(`Unknown type of space "${group.text}"`); + throw new ParseError("Unknown type of space \"" + group.text + "\""); } }, mathmlBuilder(group, options) { - let node; + var node; if (regularSpace.hasOwnProperty(group.text)) { node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\u00a0")]); @@ -13514,7 +14166,7 @@ defineFunctionBuilders({ // CSS-based MathML spaces (\nobreak, \allowbreak) are ignored return new mathMLTree.MathNode("mspace"); } else { - throw new ParseError(`Unknown type of space "${group.text}"`); + throw new ParseError("Unknown type of space \"" + group.text + "\""); } return node; @@ -13522,8 +14174,8 @@ defineFunctionBuilders({ }); -const pad = () => { - const padNode = new mathMLTree.MathNode("mtd", []); +var pad = () => { + var padNode = new mathMLTree.MathNode("mtd", []); padNode.setAttribute("width", "50%"); return padNode; }; @@ -13532,7 +14184,7 @@ defineFunctionBuilders({ type: "tag", mathmlBuilder(group, options) { - const table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]); + var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]); table.setAttribute("width", "100%"); return table; // TODO: Left-aligned tags. // Currently, the group and options passed here do not contain @@ -13545,24 +14197,24 @@ defineFunctionBuilders({ }); -const textFontFamilies = { +var textFontFamilies = { "\\text": undefined, "\\textrm": "textrm", "\\textsf": "textsf", "\\texttt": "texttt", "\\textnormal": "textrm" }; -const textFontWeights = { +var textFontWeights = { "\\textbf": "textbf", "\\textmd": "textmd" }; -const textFontShapes = { +var textFontShapes = { "\\textit": "textit", "\\textup": "textup" }; -const optionsWithFont = (group, options) => { - const font = group.font; // Checks if the argument is a font family or a font style. +var optionsWithFont = (group, options) => { + var font = group.font; // Checks if the argument is a font family or a font style. if (!font) { return options; @@ -13584,14 +14236,16 @@ defineFunction({ props: { numArgs: 1, argTypes: ["text"], - greediness: 2, + allowedInArgument: true, allowedInText: true }, handler(_ref, args) { - let parser = _ref.parser, - funcName = _ref.funcName; - const body = args[0]; + var { + parser, + funcName + } = _ref; + var body = args[0]; return { type: "text", mode: parser.mode, @@ -13601,13 +14255,13 @@ defineFunction({ }, htmlBuilder(group, options) { - const newOptions = optionsWithFont(group, options); - const inner = buildExpression(group.body, newOptions, true); - return buildCommon.makeSpan(["mord", "text"], buildCommon.tryCombineChars(inner), newOptions); + var newOptions = optionsWithFont(group, options); + var inner = buildExpression(group.body, newOptions, true); + return buildCommon.makeSpan(["mord", "text"], inner, newOptions); }, mathmlBuilder(group, options) { - const newOptions = optionsWithFont(group, options); + var newOptions = optionsWithFont(group, options); return buildExpressionRow(group.body, newOptions); } @@ -13622,7 +14276,9 @@ defineFunction({ }, handler(_ref, args) { - let parser = _ref.parser; + var { + parser + } = _ref; return { type: "underline", mode: parser.mode, @@ -13633,12 +14289,12 @@ defineFunction({ htmlBuilder(group, options) { // Underlines are handled in the TeXbook pg 443, Rule 10. // Build the inner group. - const innerGroup = buildGroup(group.body, options); // Create the line to go below the body + var innerGroup = buildGroup(group.body, options); // Create the line to go below the body - const line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns + var line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns - const defaultRuleThickness = options.fontMetrics().defaultRuleThickness; - const vlist = buildCommon.makeVList({ + var defaultRuleThickness = options.fontMetrics().defaultRuleThickness; + var vlist = buildCommon.makeVList({ positionType: "top", positionData: innerGroup.height, children: [{ @@ -13659,15 +14315,59 @@ defineFunction({ }, mathmlBuilder(group, options) { - const operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203e")]); + var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203e")]); operator.setAttribute("stretchy", "true"); - const node = new mathMLTree.MathNode("munder", [buildGroup$1(group.body, options), operator]); + var node = new mathMLTree.MathNode("munder", [buildGroup$1(group.body, options), operator]); node.setAttribute("accentunder", "true"); return node; } }); +defineFunction({ + type: "vcenter", + names: ["\\vcenter"], + props: { + numArgs: 1, + argTypes: ["original"], + // In LaTeX, \vcenter can act only on a box. + allowedInText: false + }, + + handler(_ref, args) { + var { + parser + } = _ref; + return { + type: "vcenter", + mode: parser.mode, + body: args[0] + }; + }, + + htmlBuilder(group, options) { + var body = buildGroup(group.body, options); + var axisHeight = options.fontMetrics().axisHeight; + var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight)); + return buildCommon.makeVList({ + positionType: "shift", + positionData: dy, + children: [{ + type: "elem", + elem: body + }] + }, options); + }, + + mathmlBuilder(group, options) { + // There is no way to do this in MathML. + // Write a class as a breadcrumb in case some post-processor wants + // to perform a vcenter adjustment. + return new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)], ["vcenter"]); + } + +}); + defineFunction({ type: "verb", names: ["\\verb"], @@ -13685,13 +14385,13 @@ defineFunction({ }, htmlBuilder(group, options) { - const text = makeVerb(group); - const body = []; // \verb enters text mode and therefore is sized like \textstyle + var text = makeVerb(group); + var body = []; // \verb enters text mode and therefore is sized like \textstyle - const newOptions = options.havingStyle(options.style.text()); + var newOptions = options.havingStyle(options.style.text()); - for (let i = 0; i < text.length; i++) { - let c = text[i]; + for (var i = 0; i < text.length; i++) { + var c = text[i]; if (c === '~') { c = '\\textasciitilde'; @@ -13704,8 +14404,8 @@ defineFunction({ }, mathmlBuilder(group, options) { - const text = new mathMLTree.TextNode(makeVerb(group)); - const node = new mathMLTree.MathNode("mtext", [text]); + var text = new mathMLTree.TextNode(makeVerb(group)); + var node = new mathMLTree.MathNode("mtext", [text]); node.setAttribute("mathvariant", "monospace"); return node; } @@ -13718,10 +14418,10 @@ defineFunction({ * \verb replaces each space with a no-break space \xA0 */ -const makeVerb = group => group.body.replace(/ /g, group.star ? '\u2423' : '\xA0'); +var makeVerb = group => group.body.replace(/ /g, group.star ? '\u2423' : '\xA0'); /** Include this to ensure that all functions are defined. */ -const functions = _functions; +var functions = _functions; /** * The Lexer class handles tokenizing the input in various ways. Since our @@ -13751,23 +14451,23 @@ const functions = _functions; * If there is no matching function or symbol definition, the Parser will * still reject the input. */ -const spaceRegexString = "[ \r\n\t]"; -const controlWordRegexString = "\\\\[a-zA-Z@]+"; -const controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; -const controlWordWhitespaceRegexString = `${controlWordRegexString}${spaceRegexString}*`; -const controlWordWhitespaceRegex = new RegExp(`^(${controlWordRegexString})${spaceRegexString}*$`); -const combiningDiacriticalMarkString = "[\u0300-\u036f]"; -const combiningDiacriticalMarksEndRegex = new RegExp(`${combiningDiacriticalMarkString}+$`); -const tokenRegexString = `(${spaceRegexString}+)|` + // whitespace -"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + // single codepoint -`${combiningDiacriticalMarkString}*` + // ...plus accents -"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair -`${combiningDiacriticalMarkString}*` + // ...plus accents +var spaceRegexString = "[ \r\n\t]"; +var controlWordRegexString = "\\\\[a-zA-Z@]+"; +var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; +var controlWordWhitespaceRegexString = "" + controlWordRegexString + spaceRegexString + "*"; +var controlWordWhitespaceRegex = new RegExp("^(" + controlWordRegexString + ")" + spaceRegexString + "*$"); +var combiningDiacriticalMarkString = "[\u0300-\u036f]"; +var combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$"); +var tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace +"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + ( // single codepoint +combiningDiacriticalMarkString + "*") + // ...plus accents +"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + ( // surrogate pair +combiningDiacriticalMarkString + "*") + // ...plus accents "|\\\\verb\\*([^]).*?\\3" + // \verb* "|\\\\verb([^*a-zA-Z]).*?\\4" + // \verb unstarred -"|\\\\operatorname\\*" + // \operatorname* -`|${controlWordWhitespaceRegexString}` + // \macroName + spaces -`|${controlSymbolRegexString})`; // \\, \', etc. +"|\\\\operatorname\\*" + ( // \operatorname* +"|" + controlWordWhitespaceRegexString) + ( // \macroName + spaces +"|" + controlSymbolRegexString + ")"); // \\, \', etc. /** Main Lexer class */ @@ -13797,24 +14497,24 @@ class Lexer { lex() { - const input = this.input; - const pos = this.tokenRegex.lastIndex; + var input = this.input; + var pos = this.tokenRegex.lastIndex; if (pos === input.length) { return new Token("EOF", new SourceLocation(this, pos, pos)); } - const match = this.tokenRegex.exec(input); + var match = this.tokenRegex.exec(input); if (match === null || match.index !== pos) { - throw new ParseError(`Unexpected character: '${input[pos]}'`, new Token(input[pos], new SourceLocation(this, pos, pos + 1))); + throw new ParseError("Unexpected character: '" + input[pos] + "'", new Token(input[pos], new SourceLocation(this, pos, pos + 1))); } - let text = match[2] || " "; + var text = match[2] || " "; if (this.catcodes[text] === 14) { // comment character - const nlIndex = input.indexOf('\n', this.tokenRegex.lastIndex); + var nlIndex = input.indexOf('\n', this.tokenRegex.lastIndex); if (nlIndex === -1) { this.tokenRegex.lastIndex = input.length; // EOF @@ -13828,7 +14528,7 @@ class Lexer { } // Trim any trailing whitespace from control word match - const controlMatch = text.match(controlWordWhitespaceRegex); + var controlMatch = text.match(controlWordWhitespaceRegex); if (controlMatch) { text = controlMatch[1]; @@ -13887,9 +14587,9 @@ class Namespace { throw new ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug"); } - const undefs = this.undefStack.pop(); + var undefs = this.undefStack.pop(); - for (const undef in undefs) { + for (var undef in undefs) { if (undefs.hasOwnProperty(undef)) { if (undefs[undef] === undefined) { delete this.current[undef]; @@ -13943,7 +14643,7 @@ class Namespace { // by destroying any undos currently scheduled for this name, // and adding an undo with the *new* value (in case it later gets // locally reset within this environment). - for (let i = 0; i < this.undefStack.length; i++) { + for (var i = 0; i < this.undefStack.length; i++) { delete this.undefStack[i][name]; } @@ -13954,7 +14654,7 @@ class Namespace { // Undo this set at end of this group (possibly to `undefined`), // unless an undo is already in place, in which case that older // value is the correct one. - const top = this.undefStack[this.undefStack.length - 1]; + var top = this.undefStack[this.undefStack.length - 1]; if (top && !top.hasOwnProperty(name)) { top[name] = this.current[name]; @@ -13970,7 +14670,7 @@ class Namespace { * Predefined macros for KaTeX. * This can be used to define some commands in terms of others. */ -const builtinMacros = {}; +var builtinMacros = {}; function defineMacro(name, body) { builtinMacros[name] = body; @@ -13981,7 +14681,7 @@ defineMacro("\\noexpand", function (context) { // The expansion is the token itself; but that token is interpreted // as if its meaning were ‘\relax’ if it is a control sequence that // would ordinarily be expanded by TeX’s expansion rules. - const t = context.popToken(); + var t = context.popToken(); if (context.isExpandable(t.text)) { t.noexpand = true; @@ -13999,7 +14699,7 @@ defineMacro("\\expandafter", function (context) { // token that comes after t (and possibly more tokens, if that token // has an argument), replacing it by its expansion. Finally TeX puts // t back in front of that expansion. - const t = context.popToken(); + var t = context.popToken(); context.expandOnce(true); // expand only an expandable token return { @@ -14010,7 +14710,7 @@ defineMacro("\\expandafter", function (context) { // TeX source: \long\def\@firstoftwo#1#2{#1} defineMacro("\\@firstoftwo", function (context) { - const args = context.consumeArgs(2); + var args = context.consumeArgs(2); return { tokens: args[0], numArgs: 0 @@ -14019,7 +14719,7 @@ defineMacro("\\@firstoftwo", function (context) { // TeX source: \long\def\@secondoftwo#1#2{#2} defineMacro("\\@secondoftwo", function (context) { - const args = context.consumeArgs(2); + var args = context.consumeArgs(2); return { tokens: args[1], numArgs: 0 @@ -14030,10 +14730,10 @@ defineMacro("\\@secondoftwo", function (context) { // the macro expands to #2; otherwise, it expands to #3. defineMacro("\\@ifnextchar", function (context) { - const args = context.consumeArgs(3); // symbol, if, else + var args = context.consumeArgs(3); // symbol, if, else context.consumeSpaces(); - const nextToken = context.future(); + var nextToken = context.future(); if (args[0].length === 1 && args[0][0].text === nextToken.text) { return { @@ -14054,7 +14754,7 @@ defineMacro("\\@ifnextchar", function (context) { defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); // LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode defineMacro("\\TextOrMath", function (context) { - const args = context.consumeArgs(2); + var args = context.consumeArgs(2); if (context.mode === 'text') { return { @@ -14069,7 +14769,7 @@ defineMacro("\\TextOrMath", function (context) { } }); // Lookup table for parsing numbers in base 8 through 16 -const digitToNumber = { +var digitToNumber = { "0": 0, "1": 1, "2": 2, @@ -14103,9 +14803,9 @@ const digitToNumber = { // calls to a function \@char dealt with in the Parser. defineMacro("\\char", function (context) { - let token = context.popToken(); - let base; - let number = ''; + var token = context.popToken(); + var base; + var number = ''; if (token.text === "'") { base = 8; @@ -14132,10 +14832,10 @@ defineMacro("\\char", function (context) { number = digitToNumber[token.text]; if (number == null || number >= base) { - throw new ParseError(`Invalid base-${base} digit ${token.text}`); + throw new ParseError("Invalid base-" + base + " digit " + token.text); } - let digit; + var digit; while ((digit = digitToNumber[context.future().text]) != null && digit < base) { number *= base; @@ -14144,35 +14844,35 @@ defineMacro("\\char", function (context) { } } - return `\\@char{${number}}`; + return "\\@char{" + number + "}"; }); // \newcommand{\macro}[args]{definition} // \renewcommand{\macro}[args]{definition} // TODO: Optional arguments: \newcommand{\macro}[args][default]{definition} -const newcommand = (context, existsOK, nonexistsOK) => { - let arg = context.consumeArgs(1)[0]; +var newcommand = (context, existsOK, nonexistsOK) => { + var arg = context.consumeArg().tokens; if (arg.length !== 1) { throw new ParseError("\\newcommand's first argument must be a macro name"); } - const name = arg[0].text; - const exists = context.isDefined(name); + var name = arg[0].text; + var exists = context.isDefined(name); if (exists && !existsOK) { - throw new ParseError(`\\newcommand{${name}} attempting to redefine ` + `${name}; use \\renewcommand`); + throw new ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand")); } if (!exists && !nonexistsOK) { - throw new ParseError(`\\renewcommand{${name}} when command ${name} ` + `does not yet exist; use \\newcommand`); + throw new ParseError("\\renewcommand{" + name + "} when command " + name + " " + "does not yet exist; use \\newcommand"); } - let numArgs = 0; - arg = context.consumeArgs(1)[0]; + var numArgs = 0; + arg = context.consumeArg().tokens; if (arg.length === 1 && arg[0].text === "[") { - let argText = ''; - let token = context.expandNextToken(); + var argText = ''; + var token = context.expandNextToken(); while (token.text !== "]" && token.text !== "EOF") { // TODO: Should properly expand arg, e.g., ignore {}s @@ -14181,11 +14881,11 @@ const newcommand = (context, existsOK, nonexistsOK) => { } if (!argText.match(/^\s*[0-9]+\s*$/)) { - throw new ParseError(`Invalid number of arguments: ${argText}`); + throw new ParseError("Invalid number of arguments: " + argText); } numArgs = parseInt(argText); - arg = context.consumeArgs(1)[0]; + arg = context.consumeArg().tokens; } // Final arg is the expansion of the macro @@ -14201,20 +14901,20 @@ defineMacro("\\renewcommand", context => newcommand(context, true, false)); defineMacro("\\providecommand", context => newcommand(context, true, true)); // terminal (console) tools defineMacro("\\message", context => { - const arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console + var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console console.log(arg.reverse().map(token => token.text).join("")); return ''; }); defineMacro("\\errmessage", context => { - const arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console + var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console console.error(arg.reverse().map(token => token.text).join("")); return ''; }); defineMacro("\\show", context => { - const tok = context.popToken(); - const name = tok.text; // eslint-disable-next-line no-console + var tok = context.popToken(); + var name = tok.text; // eslint-disable-next-line no-console console.log(tok, context.macros.get(name), functions[name], symbols.math[name], symbols.text[name]); return ''; @@ -14265,7 +14965,11 @@ defineMacro("\u00b7", "\\cdotp"); // \llap and \rlap render their contents in te defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); -defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \not is defined by base/fontmath.ltx via +defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \mathstrut from the TeXbook, p 360 + +defineMacro("\\mathstrut", "\\vphantom{(}"); // \underbar from TeXbook p 353 + +defineMacro("\\underbar", "\\underline{\\text{#1}}"); // \not is defined by base/fontmath.ltx via // \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36} // It's thus treated like a \mathrel, but defined by a symbol that has zero // width but extends to the right. We use \rlap to get that spacing. @@ -14345,7 +15049,7 @@ defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // AMSMath's automatic \dots, based on \mdots@@ macro. -const dotsByToken = { +var dotsByToken = { ',': '\\dotsc', '\\not': '\\dotsb', // \keybin@ checks for the following: @@ -14406,8 +15110,8 @@ defineMacro("\\dots", function (context) { // (in text mode), and it's unlikely we'd see any of the math commands // that affect the behavior of \dots when in text mode. So fine for now // (until we support \ifmmode ... \else ... \fi). - let thedots = '\\dotso'; - const next = context.expandAfterFuture().text; + var thedots = '\\dotso'; + var next = context.expandAfterFuture().text; if (next in dotsByToken) { thedots = dotsByToken[next]; @@ -14421,7 +15125,7 @@ defineMacro("\\dots", function (context) { return thedots; }); -const spaceAfterDots = { +var spaceAfterDots = { // \rightdelim@ checks for the following: ')': true, ']': true, @@ -14446,7 +15150,7 @@ const spaceAfterDots = { ',': true }; defineMacro("\\dotso", function (context) { - const next = context.future().text; + var next = context.future().text; if (next in spaceAfterDots) { return "\\ldots\\,"; @@ -14455,7 +15159,7 @@ defineMacro("\\dotso", function (context) { } }); defineMacro("\\dotsc", function (context) { - const next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for + var next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for // ';' and '.', but doesn't check for ','. if (next in spaceAfterDots && next !== ',') { @@ -14465,7 +15169,7 @@ defineMacro("\\dotsc", function (context) { } }); defineMacro("\\cdots", function (context) { - const next = context.future().text; + var next = context.future().text; if (next in spaceAfterDots) { return "\\@cdots\\,"; @@ -14555,9 +15259,11 @@ defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\ defineMacro("\\pmb", "\\html@mathml{" + "\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}" + "{\\mathbf{#1}}"); ////////////////////////////////////////////////////////////////////// // LaTeX source2e -// \\ defaults to \newline, but changes to \cr within array environment +// \expandafter\let\expandafter\@normalcr +// \csname\expandafter\@gobble\string\\ \endcsname +// \DeclareRobustCommand\newline{\@normalcr\relax} -defineMacro("\\\\", "\\newline"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} +defineMacro("\\newline", "\\\\\\relax"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} // TODO: Doesn't normally work in math mode because \@ fails. KaTeX doesn't // support \@ yet, so that's omitted, and we add \text so that the result // doesn't look funny in math mode. @@ -14577,10 +15283,10 @@ defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5e // We compute the corresponding \raisebox when A is rendered in \normalsize // \scriptstyle, which has a scale factor of 0.7 (see Options.js). -const latexRaiseA = metricMap['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * metricMap['Main-Regular']["A".charCodeAt(0)][1] + "em"; -defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + `L\\kern-.36em\\raisebox{${latexRaiseA}}{\\scriptstyle A}` + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo +var latexRaiseA = fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1] + "em"; +defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo -defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + `K\\kern-.17em\\raisebox{${latexRaiseA}}{\\scriptstyle A}` + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} +defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} // \def\@hspace#1{\hskip #1\relax} // \def\@hspacer#1{\vrule \@width\z@\nobreak // \hskip #1\hskip \z@skip} @@ -14660,6 +15366,14 @@ defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\d defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}"); defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}"); defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); ////////////////////////////////////////////////////////////////////// +// From amsopn.sty + +defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}"); +defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}"); +defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}"); +defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}"); +defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}"); +defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}"); ////////////////////////////////////////////////////////////////////// // MathML alternates for KaTeX glyphs in the Unicode private area defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}"); @@ -14783,7 +15497,10 @@ defineMacro("\\bra", "\\mathinner{\\langle{#1}|}"); defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}"); defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}"); defineMacro("\\Bra", "\\left\\langle#1\\right|"); -defineMacro("\\Ket", "\\left|#1\\right\\rangle"); // Custom Khan Academy colors, should be moved to an optional package +defineMacro("\\Ket", "\\left|#1\\right\\rangle"); ////////////////////////////////////////////////////////////////////// +// actuarialangle.dtx + +defineMacro("\\angln", "{\\angl n}"); // Custom Khan Academy colors, should be moved to an optional package defineMacro("\\blue", "\\textcolor{##6495ed}{#1}"); defineMacro("\\orange", "\\textcolor{##ffa500}{#1}"); @@ -14848,7 +15565,7 @@ defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}"); */ // List of commands that act like macros but aren't defined as a macro, // function, or symbol. Used in `isDefined`. -const implicitCommands = { +var implicitCommands = { "\\relax": true, // MacroExpander.js "^": true, @@ -14949,6 +15666,43 @@ class MacroExpander { pushTokens(tokens) { this.stack.push(...tokens); } + /** + * Find an macro argument without expanding tokens and append the array of + * tokens to the token stack. Uses Token as a container for the result. + */ + + + scanArgument(isOptional) { + var start; + var end; + var tokens; + + if (isOptional) { + this.consumeSpaces(); // \@ifnextchar gobbles any space following it + + if (this.future().text !== "[") { + return null; + } + + start = this.popToken(); // don't include [ in tokens + + ({ + tokens, + end + } = this.consumeArg(["]"])); + } else { + ({ + tokens, + start, + end + } = this.consumeArg()); + } // indicate the end of an argument + + + this.pushToken(new Token("EOF", end.loc)); + this.pushTokens(tokens); + return start.range(end, ""); + } /** * Consume all following space tokens, without expansion. */ @@ -14956,7 +15710,7 @@ class MacroExpander { consumeSpaces() { for (;;) { - const token = this.future(); + var token = this.future(); if (token.text === " ") { this.stack.pop(); @@ -14966,46 +15720,107 @@ class MacroExpander { } } /** - * Consume the specified number of arguments from the token stream, - * and return the resulting array of arguments. + * Consume an argument from the token stream, and return the resulting array + * of tokens and start/end token. */ - consumeArgs(numArgs) { - const args = []; // obtain arguments, either single token or balanced {…} group + consumeArg(delims) { + // The argument for a delimited parameter is the shortest (possibly + // empty) sequence of tokens with properly nested {...} groups that is + // followed ... by this particular list of non-parameter tokens. + // The argument for an undelimited parameter is the next nonblank + // token, unless that token is ‘{’, when the argument will be the + // entire {...} group that follows. + var tokens = []; + var isDelimited = delims && delims.length > 0; - for (let i = 0; i < numArgs; ++i) { - this.consumeSpaces(); // ignore spaces before each argument + if (!isDelimited) { + // Ignore spaces between arguments. As the TeXbook says: + // "After you have said ‘\def\row#1#2{...}’, you are allowed to + // put spaces between the arguments (e.g., ‘\row x n’), because + // TeX doesn’t use single spaces as undelimited arguments." + this.consumeSpaces(); + } - const startOfArg = this.popToken(); + var start = this.future(); + var tok; + var depth = 0; + var match = 0; - if (startOfArg.text === "{") { - const arg = []; - let depth = 1; + do { + tok = this.popToken(); + tokens.push(tok); - while (depth !== 0) { - const tok = this.popToken(); - arg.push(tok); + if (tok.text === "{") { + ++depth; + } else if (tok.text === "}") { + --depth; - if (tok.text === "{") { - ++depth; - } else if (tok.text === "}") { - --depth; - } else if (tok.text === "EOF") { - throw new ParseError("End of input in macro argument", startOfArg); - } + if (depth === -1) { + throw new ParseError("Extra }", tok); } - - arg.pop(); // remove last } - - arg.reverse(); // like above, to fit in with stack order - - args[i] = arg; - } else if (startOfArg.text === "EOF") { - throw new ParseError("End of input expecting macro argument"); - } else { - args[i] = [startOfArg]; + } else if (tok.text === "EOF") { + throw new ParseError("Unexpected end of input in a macro argument" + ", expected '" + (delims && isDelimited ? delims[match] : "}") + "'", tok); } + + if (delims && isDelimited) { + if ((depth === 0 || depth === 1 && delims[match] === "{") && tok.text === delims[match]) { + ++match; + + if (match === delims.length) { + // don't include delims in tokens + tokens.splice(-match, match); + break; + } + } else { + match = 0; + } + } + } while (depth !== 0 || isDelimited); // If the argument found ... has the form ‘{}’, + // ... the outermost braces enclosing the argument are removed + + + if (start.text === "{" && tokens[tokens.length - 1].text === "}") { + tokens.pop(); + tokens.shift(); + } + + tokens.reverse(); // to fit in with stack order + + return { + tokens, + start, + end: tok + }; + } + /** + * Consume the specified number of (delimited) arguments from the token + * stream and return the resulting array of arguments. + */ + + + consumeArgs(numArgs, delimiters) { + if (delimiters) { + if (delimiters.length !== numArgs + 1) { + throw new ParseError("The length of delimiters doesn't match the number of args!"); + } + + var delims = delimiters[0]; + + for (var i = 0; i < delims.length; i++) { + var tok = this.popToken(); + + if (delims[i] !== tok.text) { + throw new ParseError("Use of the macro doesn't match its definition", tok); + } + } + } + + var args = []; + + for (var _i = 0; _i < numArgs; _i++) { + args.push(this.consumeArg(delimiters && delimiters[_i + 1]).tokens); } return args; @@ -15026,19 +15841,15 @@ class MacroExpander { * * Used to implement `expandAfterFuture` and `expandNextToken`. * - * At the moment, macro expansion doesn't handle delimited macros, - * i.e. things like those defined by \def\foo#1\end{…}. - * See the TeX book page 202ff. for details on how those should behave. - * * If expandableOnly, only expandable tokens are expanded and * an undefined control sequence results in an error. */ expandOnce(expandableOnly) { - const topToken = this.popToken(); - const name = topToken.text; - const expansion = !topToken.noexpand ? this._getExpansion(name) : null; + var topToken = this.popToken(); + var name = topToken.text; + var expansion = !topToken.noexpand ? this._getExpansion(name) : null; if (expansion == null || expandableOnly && expansion.unexpandable) { if (expandableOnly && expansion == null && name[0] === "\\" && !this.isDefined(name)) { @@ -15055,15 +15866,15 @@ class MacroExpander { throw new ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting"); } - let tokens = expansion.tokens; + var tokens = expansion.tokens; + var args = this.consumeArgs(expansion.numArgs, expansion.delimiters); if (expansion.numArgs) { - const args = this.consumeArgs(expansion.numArgs); // paste arguments in place of the placeholders - + // paste arguments in place of the placeholders tokens = tokens.slice(); // make a shallow copy - for (let i = tokens.length - 1; i >= 0; --i) { - let tok = tokens[i]; + for (var i = tokens.length - 1; i >= 0; --i) { + var tok = tokens[i]; if (tok.text === "#") { if (i === 0) { @@ -15108,7 +15919,7 @@ class MacroExpander { expandNextToken() { for (;;) { - const expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded. + var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded. if (expanded instanceof Token) { // \relax stops the expansion, but shouldn't get returned (a @@ -15142,12 +15953,12 @@ class MacroExpander { expandTokens(tokens) { - const output = []; - const oldStackLength = this.stack.length; + var output = []; + var oldStackLength = this.stack.length; this.pushTokens(tokens); while (this.stack.length > oldStackLength) { - const expanded = this.expandOnce(true); // expand only expandable tokens + var expanded = this.expandOnce(true); // expand only expandable tokens // expandOnce returns Token if and only if it's fully expanded. if (expanded instanceof Token) { @@ -15170,7 +15981,7 @@ class MacroExpander { expandMacroAsText(name) { - const tokens = this.expandMacro(name); + var tokens = this.expandMacro(name); if (tokens) { return tokens.map(token => token.text).join(""); @@ -15185,29 +15996,29 @@ class MacroExpander { _getExpansion(name) { - const definition = this.macros.get(name); + var definition = this.macros.get(name); if (definition == null) { // mainly checking for undefined here return definition; } - const expansion = typeof definition === "function" ? definition(this) : definition; + var expansion = typeof definition === "function" ? definition(this) : definition; if (typeof expansion === "string") { - let numArgs = 0; + var numArgs = 0; if (expansion.indexOf("#") !== -1) { - const stripped = expansion.replace(/##/g, ""); + var stripped = expansion.replace(/##/g, ""); while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { ++numArgs; } } - const bodyLexer = new Lexer(expansion, this.settings); - const tokens = []; - let tok = bodyLexer.lex(); + var bodyLexer = new Lexer(expansion, this.settings); + var tokens = []; + var tok = bodyLexer.lex(); while (tok.text !== "EOF") { tokens.push(tok); @@ -15216,7 +16027,7 @@ class MacroExpander { tokens.reverse(); // to fit in with stack using push and pop - const expanded = { + var expanded = { tokens, numArgs }; @@ -15242,18 +16053,15 @@ class MacroExpander { isExpandable(name) { - const macro = this.macros.get(name); - return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable // TODO(ylem): #2085 - : functions.hasOwnProperty(name) - /* && !functions[name].primitive*/ - ; + var macro = this.macros.get(name); + return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable : functions.hasOwnProperty(name) && !functions[name].primitive; } } /* eslint no-constant-condition:0 */ -const unicodeAccents = { +var unicodeAccents = { "́": { "text": "\\'", "math": "\\acute" @@ -15298,7 +16106,7 @@ const unicodeAccents = { "text": "\\H" } }; -const unicodeSymbols = { +var unicodeSymbols = { "á": "á", "à": "à", "ä": "ä", @@ -15677,7 +16485,7 @@ class Parser { } if (this.fetch().text !== text) { - throw new ParseError(`Expected '${text}', got '${this.fetch().text}'`, this.fetch()); + throw new ParseError("Expected '" + text + "', got '" + this.fetch().text + "'", this.fetch()); } if (consume) { @@ -15735,7 +16543,7 @@ class Parser { } // Try to parse the input - const parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end + var parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end this.expect("EOF"); // End the group namespace for the expression @@ -15746,8 +16554,19 @@ class Parser { return parse; } + /** + * Parses an "expression", which is a list of atoms. + * + * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This + * happens when functions have higher precendence han infix + * nodes in implicit parses. + * + * `breakOnTokenText`: The text of the token that the expression should end + * with, or `null` if something else should end the + * expression. + */ parseExpression(breakOnInfix, breakOnTokenText) { - const body = []; // Keep adding atoms to the body until we can't parse any more atoms (either + var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either // we reached the end, a }, or a \right) while (true) { @@ -15756,7 +16575,7 @@ class Parser { this.consumeSpaces(); } - const lex = this.fetch(); + var lex = this.fetch(); if (Parser.endOfExpression.indexOf(lex.text) !== -1) { break; @@ -15770,7 +16589,7 @@ class Parser { break; } - const atom = this.parseAtom(breakOnTokenText); + var atom = this.parseAtom(breakOnTokenText); if (!atom) { break; @@ -15797,10 +16616,10 @@ class Parser { handleInfixNodes(body) { - let overIndex = -1; - let funcName; + var overIndex = -1; + var funcName; - for (let i = 0; i < body.length; i++) { + for (var i = 0; i < body.length; i++) { if (body[i].type === "infix") { if (overIndex !== -1) { throw new ParseError("only one infix operator per group", body[i].token); @@ -15812,10 +16631,10 @@ class Parser { } if (overIndex !== -1 && funcName) { - let numerNode; - let denomNode; - const numerBody = body.slice(0, overIndex); - const denomBody = body.slice(overIndex + 1); + var numerNode; + var denomNode; + var numerBody = body.slice(0, overIndex); + var denomBody = body.slice(overIndex + 1); if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { numerNode = numerBody[0]; @@ -15837,7 +16656,7 @@ class Parser { }; } - let node; + var node; if (funcName === "\\\\abovefrac") { node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []); @@ -15849,17 +16668,19 @@ class Parser { } else { return body; } - } // The greediness of a superscript or subscript - - + } /** * Handle a subscript or superscript with nice errors. */ + + handleSupSubscript(name) { - const symbolToken = this.fetch(); - const symbol = symbolToken.text; + var symbolToken = this.fetch(); + var symbol = symbolToken.text; this.consume(); - const group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS, undefined, undefined, true); // ignore spaces before sup/subscript argument + this.consumeSpaces(); // ignore spaces before sup/subscript argument + + var group = this.parseGroup(name); if (!group) { throw new ParseError("Expected group after '" + symbol + "'", symbolToken); @@ -15874,9 +16695,9 @@ class Parser { formatUnsupportedCmd(text) { - const textordArray = []; + var textordArray = []; - for (let i = 0; i < text.length; i++) { + for (var i = 0; i < text.length; i++) { textordArray.push({ type: "textord", mode: "text", @@ -15884,12 +16705,12 @@ class Parser { }); } - const textNode = { + var textNode = { type: "text", mode: this.mode, body: textordArray }; - const colorNode = { + var colorNode = { type: "color", mode: this.mode, color: this.settings.errorColor, @@ -15905,31 +16726,32 @@ class Parser { parseAtom(breakOnTokenText) { // The body of an atom is an implicit group, so that things like // \left(x\right)^2 work correctly. - const base = this.parseGroup("atom", false, null, breakOnTokenText); // In text mode, we don't have superscripts or subscripts + var base = this.parseGroup("atom", breakOnTokenText); // In text mode, we don't have superscripts or subscripts if (this.mode === "text") { return base; } // Note that base may be empty (i.e. null) at this point. - let superscript; - let subscript; + var superscript; + var subscript; while (true) { // Guaranteed in math mode, so eat any spaces first. this.consumeSpaces(); // Lex the first token - const lex = this.fetch(); + var lex = this.fetch(); if (lex.text === "\\limits" || lex.text === "\\nolimits") { // We got a limit control if (base && base.type === "op") { - const limits = lex.text === "\\limits"; + var limits = lex.text === "\\limits"; base.limits = limits; base.alwaysHandleSupSub = true; } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub) { - const limits = lex.text === "\\limits"; - base.limits = limits; + var _limits = lex.text === "\\limits"; + + base.limits = _limits; } else { throw new ParseError("Limit controls must follow a math operator", lex); } @@ -15955,13 +16777,13 @@ class Parser { throw new ParseError("Double superscript", lex); } - const prime = { + var prime = { type: "textord", mode: this.mode, text: "\\prime" }; // Many primes can be grouped together, so we handle this here - const primes = [prime]; + var primes = [prime]; this.consume(); // Keep lexing tokens until we get something that's not a prime while (this.fetch().text === "'") { @@ -16009,11 +16831,10 @@ class Parser { */ - parseFunction(breakOnTokenText, name, // For error reporting. - greediness) { - const token = this.fetch(); - const func = token.text; - const funcData = functions[func]; + parseFunction(breakOnTokenText, name) { + var token = this.fetch(); + var func = token.text; + var funcData = functions[func]; if (!funcData) { return null; @@ -16021,7 +16842,7 @@ class Parser { this.consume(); // consume command token - if (greediness != null && funcData.greediness <= greediness) { + if (name && name !== "atom" && !funcData.allowedInArgument) { throw new ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token); } else if (this.mode === "text" && !funcData.allowedInText) { throw new ParseError("Can't use function '" + func + "' in text mode", token); @@ -16029,10 +16850,10 @@ class Parser { throw new ParseError("Can't use function '" + func + "' in math mode", token); } - const _this$parseArguments = this.parseArguments(func, funcData), - args = _this$parseArguments.args, - optArgs = _this$parseArguments.optArgs; - + var { + args, + optArgs + } = this.parseArguments(func, funcData); return this.callFunction(func, args, optArgs, token, breakOnTokenText); } /** @@ -16041,18 +16862,18 @@ class Parser { callFunction(name, args, optArgs, token, breakOnTokenText) { - const context = { + var context = { funcName: name, parser: this, token, breakOnTokenText }; - const func = functions[name]; + var func = functions[name]; if (func && func.handler) { return func.handler(context, args, optArgs); } else { - throw new ParseError(`No function handler for ${name}`); + throw new ParseError("No function handler for " + name); } } /** @@ -16062,7 +16883,7 @@ class Parser { parseArguments(func, // Should look like "\name" or "\begin{name}". funcData) { - const totalArgs = funcData.numArgs + funcData.numOptionalArgs; + var totalArgs = funcData.numArgs + funcData.numOptionalArgs; if (totalArgs === 0) { return { @@ -16071,36 +16892,28 @@ class Parser { }; } - const baseGreediness = funcData.greediness; - const args = []; - const optArgs = []; + var args = []; + var optArgs = []; - for (let i = 0; i < totalArgs; i++) { - const argType = funcData.argTypes && funcData.argTypes[i]; - const isOptional = i < funcData.numOptionalArgs; // Ignore spaces between arguments. As the TeXbook says: - // "After you have said ‘\def\row#1#2{...}’, you are allowed to - // put spaces between the arguments (e.g., ‘\row x n’), because - // TeX doesn’t use single spaces as undelimited arguments." + for (var i = 0; i < totalArgs; i++) { + var argType = funcData.argTypes && funcData.argTypes[i]; + var isOptional = i < funcData.numOptionalArgs; - const consumeSpaces = i > 0 && !isOptional || // Also consume leading spaces in math mode, as parseSymbol - // won't know what to do with them. This can only happen with - // macros, e.g. \frac\foo\foo where \foo expands to a space symbol. - // In LaTeX, the \foo's get treated as (blank) arguments. - // In KaTeX, for now, both spaces will get consumed. - // TODO(edemaine) - i === 0 && !isOptional && this.mode === "math"; - const arg = this.parseGroupOfType(`argument to '${func}'`, argType, isOptional, baseGreediness, consumeSpaces); - - if (!arg) { - if (isOptional) { - optArgs.push(null); - continue; - } - - throw new ParseError(`Expected group after '${func}'`, this.fetch()); + if (funcData.primitive && argType == null || // \sqrt expands into primitive if optional argument doesn't exist + funcData.type === "sqrt" && i === 1 && optArgs[0] == null) { + argType = "primitive"; } - (isOptional ? optArgs : args).push(arg); + var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional); + + if (isOptional) { + optArgs.push(arg); + } else if (arg != null) { + args.push(arg); + } else { + // should be unreachable + throw new ParseError("Null argument, please report this as a bug"); + } } return { @@ -16113,76 +16926,64 @@ class Parser { */ - parseGroupOfType(name, type, optional, greediness, consumeSpaces) { + parseGroupOfType(name, type, optional) { switch (type) { case "color": - if (consumeSpaces) { - this.consumeSpaces(); - } - return this.parseColorGroup(optional); case "size": - if (consumeSpaces) { - this.consumeSpaces(); - } - return this.parseSizeGroup(optional); case "url": - return this.parseUrlGroup(optional, consumeSpaces); + return this.parseUrlGroup(optional); case "math": case "text": - return this.parseGroup(name, optional, greediness, undefined, type, consumeSpaces); + return this.parseArgumentGroup(optional, type); case "hbox": { // hbox argument type wraps the argument in the equivalent of // \hbox, which is like \text but switching to \textstyle size. - const group = this.parseGroup(name, optional, greediness, undefined, "text", consumeSpaces); - - if (!group) { - return group; - } - - const styledGroup = { + var group = this.parseArgumentGroup(optional, "text"); + return group != null ? { type: "styling", mode: group.mode, body: [group], style: "text" // simulate \textstyle - }; - return styledGroup; + } : null; } case "raw": { - if (consumeSpaces) { - this.consumeSpaces(); + var token = this.parseStringGroup("raw", optional); + return token != null ? { + type: "raw", + mode: "text", + string: token.text + } : null; + } + + case "primitive": + { + if (optional) { + throw new ParseError("A primitive argument cannot be optional"); } - if (optional && this.fetch().text === "{") { - return null; + var _group = this.parseGroup(name); + + if (_group == null) { + throw new ParseError("Expected group as " + name, this.fetch()); } - const token = this.parseStringGroup("raw", optional, true); - - if (token) { - return { - type: "raw", - mode: "text", - string: token.text - }; - } else { - throw new ParseError("Expected raw group", this.fetch()); - } + return _group; } case "original": case null: case undefined: - return this.parseGroup(name, optional, greediness, undefined, undefined, consumeSpaces); + return this.parseArgumentGroup(optional); default: throw new ParseError("Unknown group type as " + name, this.fetch()); @@ -16205,52 +17006,25 @@ class Parser { parseStringGroup(modeName, // Used to describe the mode in error messages. - optional, raw) { - const groupBegin = optional ? "[" : "{"; - const groupEnd = optional ? "]" : "}"; - const beginToken = this.fetch(); + optional) { + var argToken = this.gullet.scanArgument(optional); - if (beginToken.text !== groupBegin) { - if (optional) { - return null; - } else if (raw && beginToken.text !== "EOF" && /[^{}[\]]/.test(beginToken.text)) { - this.consume(); - return beginToken; - } + if (argToken == null) { + return null; } - const outerMode = this.mode; - this.mode = "text"; - this.expect(groupBegin); - let str = ""; - const firstToken = this.fetch(); - let nested = 0; // allow nested braces in raw string group + var str = ""; + var nextToken; - let lastToken = firstToken; - let nextToken; - - while ((nextToken = this.fetch()).text !== groupEnd || raw && nested > 0) { - switch (nextToken.text) { - case "EOF": - throw new ParseError("Unexpected end of input in " + modeName, firstToken.range(lastToken, str)); - - case groupBegin: - nested++; - break; - - case groupEnd: - nested--; - break; - } - - lastToken = nextToken; - str += lastToken.text; + while ((nextToken = this.fetch()).text !== "EOF") { + str += nextToken.text; this.consume(); } - this.expect(groupEnd); - this.mode = outerMode; - return firstToken.range(lastToken, str); + this.consume(); // consume the end of the argument + + argToken.text = str; + return argToken; } /** * Parses a regex-delimited group: the largest sequence of tokens @@ -16260,12 +17034,10 @@ class Parser { parseRegexGroup(regex, modeName) { - const outerMode = this.mode; - this.mode = "text"; - const firstToken = this.fetch(); - let lastToken = firstToken; - let str = ""; - let nextToken; + var firstToken = this.fetch(); + var lastToken = firstToken; + var str = ""; + var nextToken; while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) { lastToken = nextToken; @@ -16277,7 +17049,6 @@ class Parser { throw new ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken); } - this.mode = outerMode; return firstToken.range(lastToken, str); } /** @@ -16286,19 +17057,19 @@ class Parser { parseColorGroup(optional) { - const res = this.parseStringGroup("color", optional); + var res = this.parseStringGroup("color", optional); - if (!res) { + if (res == null) { return null; } - const match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); + var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); if (!match) { throw new ParseError("Invalid color: '" + res.text + "'", res); } - let color = match[0]; + var color = match[0]; if (/^[0-9a-f]{6}$/i.test(color)) { // We allow a 6-digit HTML color spec without a leading "#". @@ -16319,10 +17090,12 @@ class Parser { parseSizeGroup(optional) { - let res; - let isBlank = false; + var res; + var isBlank = false; // don't expand before parseStringGroup - if (!optional && this.fetch().text !== "{") { + this.gullet.consumeSpaces(); + + if (!optional && this.gullet.future().text !== "{") { res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size"); } else { res = this.parseStringGroup("size", optional); @@ -16341,13 +17114,13 @@ class Parser { isBlank = true; // This is here specifically for \genfrac } - const match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text); + var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text); if (!match) { throw new ParseError("Invalid size: '" + res.text + "'", res); } - const data = { + var data = { number: +(match[1] + match[2]), // sign + magnitude, cast to number unit: match[3] @@ -16370,14 +17143,13 @@ class Parser { */ - parseUrlGroup(optional, consumeSpaces) { + parseUrlGroup(optional) { this.gullet.lexer.setCatcode("%", 13); // active character - const res = this.parseStringGroup("url", optional, true); // get raw string - + var res = this.parseStringGroup("url", optional); this.gullet.lexer.setCatcode("%", 14); // comment character - if (!res) { + if (res == null) { return null; } // hyperref package allows backslashes alone in href, but doesn't // generate valid links in such cases; we interpret this as @@ -16385,7 +17157,7 @@ class Parser { // replace backslashes with forward slashes. - const url = res.text.replace(/\\([#$%&~_^{}])/g, '$1'); + var url = res.text.replace(/\\([#$%&~_^{}])/g, '$1'); return { type: "url", mode: this.mode, @@ -16393,49 +17165,66 @@ class Parser { }; } /** - * If `optional` is false or absent, this parses an ordinary group, - * which is either a single nucleus (like "x") or an expression - * in braces (like "{x+y}") or an implicit group, a group that starts - * at the current position, and ends right before a higher explicit + * Parses an argument with the mode specified. + */ + + + parseArgumentGroup(optional, mode) { + var argToken = this.gullet.scanArgument(optional); + + if (argToken == null) { + return null; + } + + var outerMode = this.mode; + + if (mode) { + // Switch to specified mode + this.switchMode(mode); + } + + this.gullet.beginGroup(); + var expression = this.parseExpression(false, "EOF"); // TODO: find an alternative way to denote the end + + this.expect("EOF"); // expect the end of the argument + + this.gullet.endGroup(); + var result = { + type: "ordgroup", + mode: this.mode, + loc: argToken.loc, + body: expression + }; + + if (mode) { + // Switch mode back + this.switchMode(outerMode); + } + + return result; + } + /** + * Parses an ordinary group, which is either a single nucleus (like "x") + * or an expression in braces (like "{x+y}") or an implicit group, a group + * that starts at the current position, and ends right before a higher explicit * group ends, or at EOF. - * If `optional` is true, it parses either a bracket-delimited expression - * (like "[x+y]") or returns null to indicate the absence of a - * bracket-enclosed group. - * If `mode` is present, switches to that mode while parsing the group, - * and switches back after. */ parseGroup(name, // For error reporting. - optional, greediness, breakOnTokenText, mode, consumeSpaces) { - // Switch to specified mode - const outerMode = this.mode; + breakOnTokenText) { + var firstToken = this.fetch(); + var text = firstToken.text; + var result; // Try to parse an open brace or \begingroup - if (mode) { - this.switchMode(mode); - } // Consume spaces if requested, crucially *after* we switch modes, - // so that the next non-space token is parsed in the correct mode. - - - if (consumeSpaces) { - this.consumeSpaces(); - } // Get first token - - - const firstToken = this.fetch(); - const text = firstToken.text; - let result; // Try to parse an open brace or \begingroup - - if (optional ? text === "[" : text === "{" || text === "\\begingroup") { + if (text === "{" || text === "\\begingroup") { this.consume(); - const groupEnd = Parser.endOfGroup[text]; // Start a new group namespace - + var groupEnd = text === "{" ? "}" : "\\endgroup"; this.gullet.beginGroup(); // If we get a brace, parse an expression - const expression = this.parseExpression(false, groupEnd); - const lastToken = this.fetch(); // Check that we got a matching closing brace - - this.expect(groupEnd); // End group namespace + var expression = this.parseExpression(false, groupEnd); + var lastToken = this.fetch(); + this.expect(groupEnd); // Check that we got a matching closing brace this.gullet.endGroup(); result = { @@ -16449,13 +17238,10 @@ class Parser { // use-begingroup-instead-of-bgroup semisimple: text === "\\begingroup" || undefined }; - } else if (optional) { - // Return nothing for an optional group - result = null; } else { // If there exists a function with this name, parse the function. // Otherwise, just return a nucleus - result = this.parseFunction(breakOnTokenText, name, greediness) || this.parseSymbol(); + result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol(); if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) { if (this.settings.throwOnError) { @@ -16465,11 +17251,6 @@ class Parser { result = this.formatUnsupportedCmd(text); this.consume(); } - } // Switch mode back - - - if (mode) { - this.switchMode(outerMode); } return result; @@ -16485,12 +17266,12 @@ class Parser { formLigatures(group) { - let n = group.length - 1; + var n = group.length - 1; - for (let i = 0; i < n; ++i) { - const a = group[i]; // $FlowFixMe: Not every node type has a `text` property. + for (var i = 0; i < n; ++i) { + var a = group[i]; // $FlowFixMe: Not every node type has a `text` property. - const v = a.text; + var v = a.text; if (v === "-" && group[i + 1].text === "-") { if (i + 1 < n && group[i + 2].text === "-") { @@ -16530,13 +17311,13 @@ class Parser { parseSymbol() { - const nucleus = this.fetch(); - let text = nucleus.text; + var nucleus = this.fetch(); + var text = nucleus.text; if (/^\\verb[^a-zA-Z]/.test(text)) { this.consume(); - let arg = text.slice(5); - const star = arg.charAt(0) === "*"; + var arg = text.slice(5); + var star = arg.charAt(0) === "*"; if (star) { arg = arg.slice(1); @@ -16545,8 +17326,7 @@ class Parser { if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { - throw new ParseError(`\\verb assertion failed -- - please report what input caused this bug`); + throw new ParseError("\\verb assertion failed --\n please report what input caused this bug"); } arg = arg.slice(1, -1); // remove first and last char @@ -16564,14 +17344,14 @@ class Parser { if (unicodeSymbols.hasOwnProperty(text[0]) && !symbols[this.mode][text[0]]) { // This behavior is not strict (XeTeX-compatible) in math mode. if (this.settings.strict && this.mode === "math") { - this.settings.reportNonstrict("unicodeTextInMathMode", `Accented Unicode text character "${text[0]}" used in ` + `math mode`, nucleus); + this.settings.reportNonstrict("unicodeTextInMathMode", "Accented Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus); } text = unicodeSymbols[text[0]] + text.substr(1); } // Strip off any combining characters - const match = combiningDiacriticalMarksEndRegex.exec(text); + var match = combiningDiacriticalMarksEndRegex.exec(text); if (match) { text = text.substring(0, match.index); @@ -16584,20 +17364,20 @@ class Parser { } // Recognize base symbol - let symbol; + var symbol; if (symbols[this.mode][text]) { if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) { - this.settings.reportNonstrict("unicodeTextInMathMode", `Latin-1/Unicode text character "${text[0]}" used in ` + `math mode`, nucleus); + this.settings.reportNonstrict("unicodeTextInMathMode", "Latin-1/Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus); } - const group = symbols[this.mode][text].group; - const loc = SourceLocation.range(nucleus); - let s; + var group = symbols[this.mode][text].group; + var loc = SourceLocation.range(nucleus); + var s; if (ATOMS.hasOwnProperty(group)) { // $FlowFixMe - const family = group; + var family = group; s = { type: "atom", mode: this.mode, @@ -16613,16 +17393,17 @@ class Parser { loc, text }; - } + } // $FlowFixMe + symbol = s; } else if (text.charCodeAt(0) >= 0x80) { // no symbol for e.g. ^ if (this.settings.strict) { if (!supportedCodepoint(text.charCodeAt(0))) { - this.settings.reportNonstrict("unknownSymbol", `Unrecognized Unicode character "${text[0]}"` + ` (${text.charCodeAt(0)})`, nucleus); + this.settings.reportNonstrict("unknownSymbol", "Unrecognized Unicode character \"" + text[0] + "\"" + (" (" + text.charCodeAt(0) + ")"), nucleus); } else if (this.mode === "math") { - this.settings.reportNonstrict("unicodeTextInMathMode", `Unicode text character "${text[0]}" used in math mode`, nucleus); + this.settings.reportNonstrict("unicodeTextInMathMode", "Unicode text character \"" + text[0] + "\" used in math mode", nucleus); } } // All nonmathematical Unicode characters are rendered as if they // are in text mode (wrapped in \text) because that's what it @@ -16646,17 +17427,17 @@ class Parser { this.consume(); // Transform combining characters into accents if (match) { - for (let i = 0; i < match[0].length; i++) { - const accent = match[0][i]; + for (var i = 0; i < match[0].length; i++) { + var accent = match[0][i]; if (!unicodeAccents[accent]) { - throw new ParseError(`Unknown accent ' ${accent}'`, nucleus); + throw new ParseError("Unknown accent ' " + accent + "'", nucleus); } - const command = unicodeAccents[accent][this.mode]; + var command = unicodeAccents[accent][this.mode]; if (!command) { - throw new ParseError(`Accent ${accent} unsupported in ${this.mode} mode`, nucleus); + throw new ParseError("Accent " + accent + " unsupported in " + this.mode + " mode", nucleus); } symbol = { @@ -16666,34 +17447,18 @@ class Parser { label: command, isStretchy: false, isShifty: true, + // $FlowFixMe base: symbol }; } - } + } // $FlowFixMe + return symbol; } } Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"]; -Parser.endOfGroup = { - "[": "]", - "{": "}", - "\\begingroup": "\\endgroup" - /** - * Parses an "expression", which is a list of atoms. - * - * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This - * happens when functions have higher precendence han infix - * nodes in implicit parses. - * - * `breakOnTokenText`: The text of the token that the expression should end - * with, or `null` if something else should end the - * expression. - */ - -}; -Parser.SUPSUB_GREEDINESS = 1; /** * Provides a single function for parsing an expression using a Parser @@ -16703,15 +17468,18 @@ Parser.SUPSUB_GREEDINESS = 1; /** * Parses an expression using a Parser, then returns the parsed result. */ -const parseTree = function parseTree(toParse, settings) { +var parseTree = function parseTree(toParse, settings) { if (!(typeof toParse === 'string' || toParse instanceof String)) { throw new TypeError('KaTeX can only parse string typed expression'); } - const parser = new Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors + var parser = new Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors delete parser.gullet.macros.current["\\df@tag"]; - let tree = parser.parse(); // If the input used \tag, it will set the \df@tag macro to the tag. + var tree = parser.parse(); // Prevent a color definition from persisting between calls to katex.render(). + + delete parser.gullet.macros.current["\\current@color"]; + delete parser.gullet.macros.current["\\color"]; // If the input used \tag, it will set the \df@tag macro to the tag. // In this case, we separately parse the tag and wrap the tree. if (parser.gullet.macros.get("\\df@tag")) { @@ -16737,9 +17505,9 @@ const parseTree = function parseTree(toParse, settings) { * Parse and build an expression, and place that expression in the DOM node * given. */ -let render = function render(expression, baseNode, options) { +var render = function render(expression, baseNode, options) { baseNode.textContent = ""; - const node = renderToDomTree(expression, options).toNode(); + var node = renderToDomTree(expression, options).toNode(); baseNode.appendChild(node); }; // KaTeX's styles don't work properly in quirks mode. Print out an error, and // disable rendering. @@ -16759,8 +17527,8 @@ if (typeof document !== "undefined") { */ -const renderToString = function renderToString(expression, options) { - const markup = renderToDomTree(expression, options).toMarkup(); +var renderToString = function renderToString(expression, options) { + var markup = renderToDomTree(expression, options).toMarkup(); return markup; }; /** @@ -16768,8 +17536,8 @@ const renderToString = function renderToString(expression, options) { */ -const generateParseTree = function generateParseTree(expression, options) { - const settings = new Settings(options); +var generateParseTree = function generateParseTree(expression, options) { + var settings = new Settings(options); return parseTree(expression, settings); }; /** @@ -16779,14 +17547,14 @@ const generateParseTree = function generateParseTree(expression, options) { */ -const renderError = function renderError(error, expression, options) { +var renderError = function renderError(error, expression, options) { if (options.throwOnError || !(error instanceof ParseError)) { throw error; } - const node = buildCommon.makeSpan(["katex-error"], [new SymbolNode(expression)]); + var node = buildCommon.makeSpan(["katex-error"], [new SymbolNode(expression)]); node.setAttribute("title", error.toString()); - node.setAttribute("style", `color:${options.errorColor}`); + node.setAttribute("style", "color:" + options.errorColor); return node; }; /** @@ -16795,11 +17563,11 @@ const renderError = function renderError(error, expression, options) { */ -const renderToDomTree = function renderToDomTree(expression, options) { - const settings = new Settings(options); +var renderToDomTree = function renderToDomTree(expression, options) { + var settings = new Settings(options); try { - const tree = parseTree(expression, settings); + var tree = parseTree(expression, settings); return buildTree(tree, expression, settings); } catch (error) { return renderError(error, expression, settings); @@ -16811,11 +17579,11 @@ const renderToDomTree = function renderToDomTree(expression, options) { */ -const renderToHTMLTree = function renderToHTMLTree(expression, options) { - const settings = new Settings(options); +var renderToHTMLTree = function renderToHTMLTree(expression, options) { + var settings = new Settings(options); try { - const tree = parseTree(expression, settings); + var tree = parseTree(expression, settings); return buildHTMLTree(tree, expression, settings); } catch (error) { return renderError(error, expression, settings); @@ -16826,7 +17594,7 @@ var katex = { /** * Current KaTeX version */ - version: "0.12.0", + version: "0.13.0", /** * Renders the given LaTeX into an HTML+MathML combination, and adds