diff options
Diffstat (limited to 'js/mathjax/jax/input')
35 files changed, 7411 insertions, 0 deletions
diff --git a/js/mathjax/jax/input/AsciiMath/config.js b/js/mathjax/jax/input/AsciiMath/config.js new file mode 100644 index 0000000..97f5369 --- /dev/null +++ b/js/mathjax/jax/input/AsciiMath/config.js @@ -0,0 +1,48 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/input/AsciiMath/config.js + * + * Initializes the AsciiMath InputJax (the main definition is in + * MathJax/jax/input/AsciiMath/jax.js, which is loaded when needed). + * + * Originally adapted for MathJax by David Lippman. + * Additional work done by Davide P. Cervone. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2012-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.InputJax.AsciiMath = MathJax.InputJax({ + id: "AsciiMath", + version: "2.7.9", + directory: MathJax.InputJax.directory + "/AsciiMath", + extensionDir: MathJax.InputJax.extensionDir + "/AsciiMath", + + config: { + fixphi: true, // switch phi and varphi unicode values + useMathMLspacing: true, // use MathML spacing rather than TeX spacing? + displaystyle: true, // put limits above and below operators + decimalsign: "." // can change to "," but watch out for "(1,2)" + } +}); +MathJax.InputJax.AsciiMath.Register("math/asciimath"); + +MathJax.InputJax.AsciiMath.loadComplete("config.js"); +// @license-end diff --git a/js/mathjax/jax/input/AsciiMath/jax.js b/js/mathjax/jax/input/AsciiMath/jax.js new file mode 100644 index 0000000..bad0cd8 --- /dev/null +++ b/js/mathjax/jax/input/AsciiMath/jax.js @@ -0,0 +1,1543 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/input/AsciiMath/jax.js + * + * An Input Jax for AsciiMath notation + * (see http://www1.chapman.edu/~jipsen/mathml/asciimath.html). + * + * Originally adapted for MathJax by David Lippman. + * Additional work done by Davide P. Cervone. + * + * The current development repository for AsciiMathML is + * https://github.com/mathjax/asciimathml + * + * A portion of this file is taken from + * ASCIIMathML.js Version 2.2 Mar 3, 2014, (c) Peter Jipsen http://www.chapman.edu/~jipsen + * and is used by permission of Peter Jipsen, who has agreed to allow us to + * release it under the Apache2 license (see below). That portion is indicated + * via comments. + * + * The remainder falls under the copyright that follows. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2012-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (ASCIIMATH) { + + var MML; // Filled in later + + // + // Make a documentFragment work-alike that uses MML objects + // rather than DOM objects. + // + var DOCFRAG = MathJax.Object.Subclass({ + firstChild: null, + lastChild: null, + Init: function () { + this.childNodes = []; + }, + appendChild: function (node) { + if (node.parent) {node.parent.removeChild(node)} + if (this.lastChild) {this.lastChild.nextSibling = node} + if (!this.firstChild) {this.firstChild = node} + this.childNodes.push(node); node.parent = this; + this.lastChild = node; + return node; + }, + removeChild: function (node) { + for (var i = 0, m = this.childNodes.length; i < m; i++) + {if (this.childNodes[i] === node) break} + if (i === m) return; + this.childNodes.splice(i,1); + if (node === this.firstChild) {this.firstChild = node.nextSibling} + if (node === this.lastChild) { + if (!this.childNodes.length) {this.lastChild = null} + else {this.lastChild = this.childNodes[this.childNodes.length-1]} + } + if (i) {this.childNodes[i-1].nextSibling = node.nextSibling} + node.nextSibling = node.parent = null; + return node; + }, + replaceChild: function (node,old) { + for (var i = 0, m = this.childNodes.length; i < m; i++) + {if (this.childNodes[i] === old) break} + if (i) {this.childNodes[i-1].nextSibling = node} else {this.firstChild = node} + if (i >= m-1) {this.lastChild = node} + this.childNodes[i] = node; node.nextSibling = old.nextSibling; + old.nextSibling = old.parent = null; + return old; + }, + hasChildNodes: function (node) { + return (this.childNodes.length>0); + }, + toString: function () {return "{"+this.childNodes.join("")+"}"} + }); + + var INITASCIIMATH = function () { + MML = MathJax.ElementJax.mml; + var MBASEINIT = MML.mbase.prototype.Init; + + // + // Make MML elements looks like DOM elements (add the + // methods that AsciiMath needs) + // + MML.mbase.Augment({ + firstChild: null, + lastChild: null, + nodeValue: null, + nextSibling: null, + Init: function () { + var obj = MBASEINIT.apply(this,arguments) || this; + obj.childNodes = obj.data; + obj.nodeName = obj.type; + return obj; + }, + appendChild: function (node) { + if (node.parent) {node.parent.removeChild(node)} + var nodes = arguments; + if (node.isa(DOCFRAG)) { + nodes = node.childNodes; + node.data = node.childNodes = []; + node.firstChild = node.lastChild = null; + } + for (var i = 0, m = nodes.length; i < m; i++) { + node = nodes[i]; + if (this.lastChild) {this.lastChild.nextSibling = node} + if (!this.firstChild) {this.firstChild = node} + this.Append(node); + this.lastChild = node; + } + return node; + }, + removeChild: function (node) { + for (var i = 0, m = this.childNodes.length; i < m; i++) + {if (this.childNodes[i] === node) break} + if (i === m) return; + this.childNodes.splice(i,1); + if (node === this.firstChild) {this.firstChild = node.nextSibling} + if (node === this.lastChild) { + if (!this.childNodes.length) {this.lastChild = null} + else {this.lastChild = this.childNodes[this.childNodes.length-1]} + } + if (i) {this.childNodes[i-1].nextSibling = node.nextSibling} + node.nextSibling = node.parent = null; + return node; + }, + replaceChild: function (node,old) { + for (var i = 0, m = this.childNodes.length; i < m; i++) + {if (this.childNodes[i] === old) break} + // FIXME: make this work with DOCFRAG's? + if (i) {this.childNodes[i-1].nextSibling = node} else {this.firstChild = node} + if (i >= m-1) {this.lastChild = node} + this.SetData(i,node); node.nextSibling = old.nextSibling; + old.nextSibling = old.parent = null; + return old; + }, + hasChildNodes: function (node) { + return (this.childNodes.length>0); + }, + setAttribute: function (name,value) {this[name] = value} + }); + }; + + // + // Set up to isolate ASCIIMathML.js + // + + var window = {}; // hide the true window + + // + // Hide the true document, and add functions that + // use and produce MML objects instead of DOM objects + // + var document = { + getElementById: true, + createElementNS: function (ns,type) { + var node = MML[type](); + if (type === "mo" && ASCIIMATH.config.useMathMLspacing) {node.useMMLspacing = 0x80} + return node; + }, + createTextNode: function (text) {return MML.chars(text).With({nodeValue:text})}, + createDocumentFragment: function () {return DOCFRAG()} + }; + + var navigator = {appName: "MathJax"}; // hide the true navigator object + +/****************************************************************** + * + * The following section is ASCIIMathML.js Version 2.2 + * (c) Peter Jipsen, used with permission. + * + * Some sections are commented out to save space in the + * minified version (but that is not strictly necessary). + * + ******************************************************************/ + +/* +ASCIIMathML.js +============== +This file contains JavaScript functions to convert ASCII math notation +and (some) LaTeX to Presentation MathML. The conversion is done while the +HTML page loads, and should work with Firefox and other browsers that can +render MathML. + +Just add the next line to your HTML page with this file in the same folder: + +<script type="text/javascript" src="ASCIIMathML.js"></script> + +Version 2.2 Mar 3, 2014. +Latest version at https://github.com/mathjax/asciimathml +If you use it on a webpage, please send the URL to jipsen@chapman.edu + +Copyright (c) 2014 Peter Jipsen and other ASCIIMathML.js contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +//var asciimath = {}; + +//(function(){ +var mathcolor = "blue"; // change it to "" (to inherit) or another color +//var mathfontsize = "1em"; // change to e.g. 1.2em for larger math +//var mathfontfamily = "serif"; // change to "" to inherit (works in IE) + // or another family (e.g. "arial") +//var automathrecognize = false; // writing "amath" on page makes this true +//var checkForMathML = true; // check if browser can display MathML +//var notifyIfNoMathML = true; // display note at top if no MathML capability +//var alertIfNoMathML = false; // show alert box if no MathML capability +//var translateOnLoad = true; // set to false to do call translators from js +//var translateASCIIMath = true; // false to preserve `..` +var displaystyle = true; // puts limits above and below large operators +var showasciiformulaonhover = true; // helps students learn ASCIIMath +var decimalsign = "."; // change to "," if you like, beware of `(1,2)`! +//var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters +//var AMdocumentId = "wikitext" // PmWiki element containing math (default=body) +var fixphi = true; //false to return to legacy phi/varphi mapping + +/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ + +var isIE = (navigator.appName.slice(0,9)=="Microsoft"); +/* +var noMathML = false, translated = false; + +if (isIE) { // add MathPlayer info to IE webpages + document.write("<object id=\"mathplayer\"\ + classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>"); + document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>"); +} + +// Add a stylesheet, replacing any previous custom stylesheet (adapted from TW) +function setStylesheet(s) { + var id = "AMMLcustomStyleSheet"; + var n = document.getElementById(id); + if(document.createStyleSheet) { + // Test for IE's non-standard createStyleSheet method + if(n) + n.parentNode.removeChild(n); + // This failed without the + document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd"," <style id='" + id + "'>" + s + "</style>"); + } else { + if(n) { + n.replaceChild(document.createTextNode(s),n.firstChild); + } else { + n = document.createElement("style"); + n.type = "text/css"; + n.id = id; + n.appendChild(document.createTextNode(s)); + document.getElementsByTagName("head")[0].appendChild(n); + } + } +} + +setStylesheet("#AMMLcloseDiv \{font-size:0.8em; padding-top:1em; color:#014\}\n#AMMLwarningBox \{position:absolute; width:100%; top:0; left:0; z-index:200; text-align:center; font-size:1em; font-weight:bold; padding:0.5em 0 0.5em 0; color:#ffc; background:#c30\}"); + +function init(){ + var msg, warnings = new Array(); + if (document.getElementById==null){ + alert("This webpage requires a recent browser such as Mozilla Firefox"); + return null; + } + if (checkForMathML && (msg = checkMathML())) warnings.push(msg); + if (warnings.length>0) displayWarnings(warnings); + if (!noMathML) initSymbols(); + return true; +} + +function checkMathML(){ + if (navigator.appName.slice(0,8)=="Netscape") + if (navigator.appVersion.slice(0,1)>="5") noMathML = null; + else noMathML = true; + else if (navigator.appName.slice(0,9)=="Microsoft") + try { + var ActiveX = new ActiveXObject("MathPlayer.Factory.1"); + noMathML = null; + } catch (e) { + noMathML = true; + } + else if (navigator.appName.slice(0,5)=="Opera") + if (navigator.appVersion.slice(0,3)>="9.5") noMathML = null; + else noMathML = true; +//noMathML = true; //uncomment to check + if (noMathML && notifyIfNoMathML) { + var msg = "To view the ASCIIMathML notation use Internet Explorer + MathPlayer or Mozilla Firefox 2.0 or later."; + if (alertIfNoMathML) + alert(msg); + else return msg; + } +} + +function hideWarning(){ + var body = document.getElementsByTagName("body")[0]; + body.removeChild(document.getElementById('AMMLwarningBox')); + body.onclick = null; +} + +function displayWarnings(warnings) { + var i, frag, nd = createElementXHTML("div"); + var body = document.getElementsByTagName("body")[0]; + body.onclick=hideWarning; + nd.id = 'AMMLwarningBox'; + for (i=0; i<warnings.length; i++) { + frag = createElementXHTML("div"); + frag.appendChild(document.createTextNode(warnings[i])); + frag.style.paddingBottom = "1.0em"; + nd.appendChild(frag); + } + nd.appendChild(createElementXHTML("p")); + nd.appendChild(document.createTextNode("For instructions see the ")); + var an = createElementXHTML("a"); + an.appendChild(document.createTextNode("ASCIIMathML")); + an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html"); + nd.appendChild(an); + nd.appendChild(document.createTextNode(" homepage")); + an = createElementXHTML("div"); + an.id = 'AMMLcloseDiv'; + an.appendChild(document.createTextNode('(click anywhere to close this warning)')); + nd.appendChild(an); + var body = document.getElementsByTagName("body")[0]; + body.insertBefore(nd,body.childNodes[0]); +} + +function translate(spanclassAM) { + if (!translated) { // run this only once + translated = true; + var body = document.getElementsByTagName("body")[0]; + var processN = document.getElementById(AMdocumentId); + if (translateASCIIMath) AMprocessNode((processN!=null?processN:body), false, spanclassAM); + } +} +*/ +function createElementXHTML(t) { + if (isIE) return document.createElement(t); + else return document.createElementNS("http://www.w3.org/1999/xhtml",t); +} + +var AMmathml = "http://www.w3.org/1998/Math/MathML"; + +function AMcreateElementMathML(t) { + if (isIE) return document.createElement("m:"+t); + else return document.createElementNS(AMmathml,t); +} + +function createMmlNode(t,frag) { + var node; + if (isIE) node = document.createElement("m:"+t); + else node = document.createElementNS(AMmathml,t); + if (frag) node.appendChild(frag); + return node; +} + +function newcommand(oldstr,newstr) { + AMsymbols.push({input:oldstr, tag:"mo", output:newstr, tex:null, ttype:DEFINITION}); + refreshSymbols(); +} + +function newsymbol(symbolobj) { + AMsymbols.push(symbolobj); + refreshSymbols(); +} + +// character lists for Mozilla/Netscape fonts +var AMcal = ["\uD835\uDC9C","\u212C","\uD835\uDC9E","\uD835\uDC9F","\u2130","\u2131","\uD835\uDCA2","\u210B","\u2110","\uD835\uDCA5","\uD835\uDCA6","\u2112","\u2133","\uD835\uDCA9","\uD835\uDCAA","\uD835\uDCAB","\uD835\uDCAC","\u211B","\uD835\uDCAE","\uD835\uDCAF","\uD835\uDCB0","\uD835\uDCB1","\uD835\uDCB2","\uD835\uDCB3","\uD835\uDCB4","\uD835\uDCB5","\uD835\uDCB6","\uD835\uDCB7","\uD835\uDCB8","\uD835\uDCB9","\u212F","\uD835\uDCBB","\u210A","\uD835\uDCBD","\uD835\uDCBE","\uD835\uDCBF","\uD835\uDCC0","\uD835\uDCC1","\uD835\uDCC2","\uD835\uDCC3","\u2134","\uD835\uDCC5","\uD835\uDCC6","\uD835\uDCC7","\uD835\uDCC8","\uD835\uDCC9","\uD835\uDCCA","\uD835\uDCCB","\uD835\uDCCC","\uD835\uDCCD","\uD835\uDCCE","\uD835\uDCCF"]; + +var AMfrk = ["\uD835\uDD04","\uD835\uDD05","\u212D","\uD835\uDD07","\uD835\uDD08","\uD835\uDD09","\uD835\uDD0A","\u210C","\u2111","\uD835\uDD0D","\uD835\uDD0E","\uD835\uDD0F","\uD835\uDD10","\uD835\uDD11","\uD835\uDD12","\uD835\uDD13","\uD835\uDD14","\u211C","\uD835\uDD16","\uD835\uDD17","\uD835\uDD18","\uD835\uDD19","\uD835\uDD1A","\uD835\uDD1B","\uD835\uDD1C","\u2128","\uD835\uDD1E","\uD835\uDD1F","\uD835\uDD20","\uD835\uDD21","\uD835\uDD22","\uD835\uDD23","\uD835\uDD24","\uD835\uDD25","\uD835\uDD26","\uD835\uDD27","\uD835\uDD28","\uD835\uDD29","\uD835\uDD2A","\uD835\uDD2B","\uD835\uDD2C","\uD835\uDD2D","\uD835\uDD2E","\uD835\uDD2F","\uD835\uDD30","\uD835\uDD31","\uD835\uDD32","\uD835\uDD33","\uD835\uDD34","\uD835\uDD35","\uD835\uDD36","\uD835\uDD37"]; + +var AMbbb = ["\uD835\uDD38","\uD835\uDD39","\u2102","\uD835\uDD3B","\uD835\uDD3C","\uD835\uDD3D","\uD835\uDD3E","\u210D","\uD835\uDD40","\uD835\uDD41","\uD835\uDD42","\uD835\uDD43","\uD835\uDD44","\u2115","\uD835\uDD46","\u2119","\u211A","\u211D","\uD835\uDD4A","\uD835\uDD4B","\uD835\uDD4C","\uD835\uDD4D","\uD835\uDD4E","\uD835\uDD4F","\uD835\uDD50","\u2124","\uD835\uDD52","\uD835\uDD53","\uD835\uDD54","\uD835\uDD55","\uD835\uDD56","\uD835\uDD57","\uD835\uDD58","\uD835\uDD59","\uD835\uDD5A","\uD835\uDD5B","\uD835\uDD5C","\uD835\uDD5D","\uD835\uDD5E","\uD835\uDD5F","\uD835\uDD60","\uD835\uDD61","\uD835\uDD62","\uD835\uDD63","\uD835\uDD64","\uD835\uDD65","\uD835\uDD66","\uD835\uDD67","\uD835\uDD68","\uD835\uDD69","\uD835\uDD6A","\uD835\uDD6B"]; +/*var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46]; +var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128]; +var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];*/ + +var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4, + RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8, + LEFTRIGHT = 9, TEXT = 10, /*BIG = 11, LONG = 12, STRETCHY = 13, + MATRIX = 14,*/ UNARYUNDEROVER = 15; // token types + +var AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}; + +var AMsymbols = [ +//some greek symbols +{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST}, +{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST}, +{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST}, +{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST}, +{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST}, +{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST}, +{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST}, +{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST}, +{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST}, +{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST}, +{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST}, +{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST}, +{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST}, +{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST}, +{input:"lamda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST}, +{input:"Lamda", tag:"mo", output:"\u039B", tex:null, ttype:CONST}, +{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST}, +{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST}, +{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST}, +{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST}, +{input:"phi", tag:"mi", output:fixphi?"\u03D5":"\u03C6", tex:null, ttype:CONST}, +{input:"varphi", tag:"mi", output:fixphi?"\u03C6":"\u03D5", tex:null, ttype:CONST}, +{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST}, +{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST}, +{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST}, +{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST}, +{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST}, +{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST}, +{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST}, +{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST}, +{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST}, +{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST}, +{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST}, +{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST}, +{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST}, +{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST}, +{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST}, +{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST}, + +//binary operation symbols +//{input:"-", tag:"mo", output:"\u0096", tex:null, ttype:CONST}, +{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST}, +{input:"**", tag:"mo", output:"\u2217", tex:"ast", ttype:CONST}, +{input:"***", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST}, +{input:"//", tag:"mo", output:"/", tex:null, ttype:CONST}, +{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST}, +{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST}, +{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST}, +{input:"|><", tag:"mo", output:"\u22C9", tex:"ltimes", ttype:CONST}, +{input:"><|", tag:"mo", output:"\u22CA", tex:"rtimes", ttype:CONST}, +{input:"|><|", tag:"mo", output:"\u22C8", tex:"bowtie", ttype:CONST}, +{input:"-:", tag:"mo", output:"\u00F7", tex:"div", ttype:CONST}, +{input:"divide", tag:"mo", output:"-:", tex:null, ttype:DEFINITION}, +{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST}, +{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST}, +{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST}, +{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST}, +{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER}, +{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER}, +{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST}, +{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER}, +{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST}, +{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER}, +{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST}, +{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER}, +{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST}, +{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER}, + +//binary relation symbols +{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST}, +{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST}, +{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST}, +{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST}, +{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST}, +{input:"gt", tag:"mo", output:">", tex:null, ttype:CONST}, +{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST}, +{input:"gt=", tag:"mo", output:"\u2265", tex:"geq", ttype:CONST}, +{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST}, +{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST}, +{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST}, +{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST}, +{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST}, +{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST}, +{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST}, +{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST}, +{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST}, +{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST}, +{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST}, +{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST}, +{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST}, +{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST}, +{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST}, + +//logical symbols +{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE}, +{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE}, +{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST}, +{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST}, +{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE}, +{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST}, +{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST}, +{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST}, +{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST}, +{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST}, +{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST}, +{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST}, + +//grouping brackets +{input:"(", tag:"mo", output:"(", tex:"left(", ttype:LEFTBRACKET}, +{input:")", tag:"mo", output:")", tex:"right)", ttype:RIGHTBRACKET}, +{input:"[", tag:"mo", output:"[", tex:"left[", ttype:LEFTBRACKET}, +{input:"]", tag:"mo", output:"]", tex:"right]", ttype:RIGHTBRACKET}, +{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET}, +{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET}, +{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT}, +{input:":|:", tag:"mo", output:"|", tex:null, ttype:CONST}, +{input:"|:", tag:"mo", output:"|", tex:null, ttype:LEFTBRACKET}, +{input:":|", tag:"mo", output:"|", tex:null, ttype:RIGHTBRACKET}, +//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT}, +{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET}, +{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET}, +{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET}, +{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET}, +{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true}, +{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true}, + +//miscellaneous symbols +{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST}, +{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION}, +{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION}, +{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION}, +{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION}, +{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST}, +{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST}, +{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST}, +{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST}, +{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST}, +{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST}, +{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST}, +{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST}, +{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST}, +{input:":'", tag:"mo", output:"\u2235", tex:"because", ttype:CONST}, +{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST}, +{input:"/_\\", tag:"mo", output:"\u25B3", tex:"triangle", ttype:CONST}, +{input:"'", tag:"mo", output:"\u2032", tex:"prime", ttype:CONST}, +{input:"tilde", tag:"mover", output:"~", tex:null, ttype:UNARY, acc:true}, +{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST}, +{input:"frown", tag:"mo", output:"\u2322", tex:null, ttype:CONST}, +{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST}, +{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST}, +{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST}, +{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST}, +{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST}, +{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST}, +{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST}, +{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST}, +{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST}, +{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST}, +{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST}, +{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST}, +{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST}, +{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST}, +{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST}, +{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST}, +{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true}, +{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true}, + +//standard functions +{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER}, +{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER}, +{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true}, +{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true}, +{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true}, +{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true}, +{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true}, +{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true}, +{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true}, +{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true}, +{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true}, +{input:"arcsin", tag:"mo", output:"arcsin", tex:null, ttype:UNARY, func:true}, +{input:"arccos", tag:"mo", output:"arccos", tex:null, ttype:UNARY, func:true}, +{input:"arctan", tag:"mo", output:"arctan", tex:null, ttype:UNARY, func:true}, +{input:"coth", tag:"mo", output:"coth", tex:null, ttype:UNARY, func:true}, +{input:"sech", tag:"mo", output:"sech", tex:null, ttype:UNARY, func:true}, +{input:"csch", tag:"mo", output:"csch", tex:null, ttype:UNARY, func:true}, +{input:"exp", tag:"mo", output:"exp", tex:null, ttype:UNARY, func:true}, +{input:"abs", tag:"mo", output:"abs", tex:null, ttype:UNARY, rewriteleftright:["|","|"]}, +{input:"norm", tag:"mo", output:"norm", tex:null, ttype:UNARY, rewriteleftright:["\u2225","\u2225"]}, +{input:"floor", tag:"mo", output:"floor", tex:null, ttype:UNARY, rewriteleftright:["\u230A","\u230B"]}, +{input:"ceil", tag:"mo", output:"ceil", tex:null, ttype:UNARY, rewriteleftright:["\u2308","\u2309"]}, +{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true}, +{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true}, +{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true}, +{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST}, +{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST}, +{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true}, +{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true}, +{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST}, +{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST}, +{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER}, +{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER}, +{input:"Sin", tag:"mo", output:"Sin", tex:null, ttype:UNARY, func:true}, +{input:"Cos", tag:"mo", output:"Cos", tex:null, ttype:UNARY, func:true}, +{input:"Tan", tag:"mo", output:"Tan", tex:null, ttype:UNARY, func:true}, +{input:"Arcsin", tag:"mo", output:"Arcsin", tex:null, ttype:UNARY, func:true}, +{input:"Arccos", tag:"mo", output:"Arccos", tex:null, ttype:UNARY, func:true}, +{input:"Arctan", tag:"mo", output:"Arctan", tex:null, ttype:UNARY, func:true}, +{input:"Sinh", tag:"mo", output:"Sinh", tex:null, ttype:UNARY, func:true}, +{input:"Cosh", tag:"mo", output:"Cosh", tex:null, ttype:UNARY, func:true}, +{input:"Tanh", tag:"mo", output:"Tanh", tex:null, ttype:UNARY, func:true}, +{input:"Cot", tag:"mo", output:"Cot", tex:null, ttype:UNARY, func:true}, +{input:"Sec", tag:"mo", output:"Sec", tex:null, ttype:UNARY, func:true}, +{input:"Csc", tag:"mo", output:"Csc", tex:null, ttype:UNARY, func:true}, +{input:"Log", tag:"mo", output:"Log", tex:null, ttype:UNARY, func:true}, +{input:"Ln", tag:"mo", output:"Ln", tex:null, ttype:UNARY, func:true}, +{input:"Abs", tag:"mo", output:"abs", tex:null, ttype:UNARY, notexcopy:true, rewriteleftright:["|","|"]}, + +//arrows +{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST}, +{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST}, +{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST}, +{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST}, +{input:">->", tag:"mo", output:"\u21A3", tex:"rightarrowtail", ttype:CONST}, +{input:"->>", tag:"mo", output:"\u21A0", tex:"twoheadrightarrow", ttype:CONST}, +{input:">->>", tag:"mo", output:"\u2916", tex:"twoheadrightarrowtail", ttype:CONST}, +{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST}, +{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST}, +{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST}, +{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST}, +{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST}, +{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST}, +//commands with argument +{input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY}, +{input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY}, +{input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY}, +{input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX}, +{input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, +{input:"overset", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, +{input:"underset", tag:"munder", output:"stackrel", tex:null, ttype:BINARY}, +{input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX}, +{input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX}, +{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true}, +{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true}, +{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true}, +{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true}, +{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true}, +{input:"overarc", tag:"mover", output:"\u23DC", tex:"overparen", ttype:UNARY, acc:true}, +{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true}, +{input:"ubrace", tag:"munder", output:"\u23DF", tex:"underbrace", ttype:UNARYUNDEROVER, acc:true}, +{input:"obrace", tag:"mover", output:"\u23DE", tex:"overbrace", ttype:UNARYUNDEROVER, acc:true}, +{input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT}, +{input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}, +{input:"color", tag:"mstyle", ttype:BINARY}, +{input:"id", tag:"mrow", ttype:BINARY}, +{input:"class", tag:"mrow", ttype:BINARY}, +{input:"cancel", tag:"menclose", output:"cancel", tex:null, ttype:UNARY}, +AMquote, +{input:"bb", tag:"mstyle", atname:"mathvariant", atval:"bold", output:"bb", tex:null, ttype:UNARY}, +{input:"mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", output:"mathbf", tex:null, ttype:UNARY}, +{input:"sf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY}, +{input:"mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY}, +{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb}, +{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb}, +{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal}, +{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal}, +{input:"tt", tag:"mstyle", atname:"mathvariant", atval:"monospace", output:"tt", tex:null, ttype:UNARY}, +{input:"mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY}, +{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk}, +{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk} +]; + +function compareNames(s1,s2) { + if (s1.input > s2.input) return 1 + else return -1; +} + +var AMnames = []; //list of input symbols + +function initSymbols() { + var i; + var symlen = AMsymbols.length; + for (i=0; i<symlen; i++) { + if (AMsymbols[i].tex) { + AMsymbols.push({input:AMsymbols[i].tex, + tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype, + acc:(AMsymbols[i].acc||false)}); + } + } + refreshSymbols(); +} + +function refreshSymbols(){ + var i; + AMsymbols.sort(compareNames); + for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input; +} + +function define(oldstr,newstr) { + AMsymbols.push({input:oldstr, tag:"mo", output:newstr, tex:null, ttype:DEFINITION}); + refreshSymbols(); // this may be a problem if many symbols are defined! +} + +function AMremoveCharsAndBlanks(str,n) { +//remove n characters and any following blanks + var st; + if (str.charAt(n)=="\\" && str.charAt(n+1)!="\\" && str.charAt(n+1)!=" ") + st = str.slice(n+1); + else st = str.slice(n); + for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1); + return st.slice(i); +} + +function position(arr, str, n) { +// return position >=n where str appears or would be inserted +// assumes arr is sorted + if (n==0) { + var h,m; + n = -1; + h = arr.length; + while (n+1<h) { + m = (n+h) >> 1; + if (arr[m]<str) n = m; else h = m; + } + return h; + } else + for (var i=n; i<arr.length && arr[i]<str; i++); + return i; // i=arr.length || arr[i]>=str +} + +function AMgetSymbol(str) { +//return maximal initial substring of str that appears in names +//return null if there is none + var k = 0; //new pos + var j = 0; //old pos + var mk; //match pos + var st; + var tagst; + var match = ""; + var more = true; + for (var i=1; i<=str.length && more; i++) { + st = str.slice(0,i); //initial substring of length i + j = k; + k = position(AMnames, st, j); + if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){ + match = AMnames[k]; + mk = k; + i = match.length; + } + more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k]; + } + AMpreviousSymbol=AMcurrentSymbol; + if (match!=""){ + AMcurrentSymbol=AMsymbols[mk].ttype; + return AMsymbols[mk]; + } +// if str[0] is a digit or - return maxsubstring of digits.digits + AMcurrentSymbol=CONST; + k = 1; + st = str.slice(0,1); + var integ = true; + while ("0"<=st && st<="9" && k<=str.length) { + st = str.slice(k,k+1); + k++; + } + if (st == decimalsign) { + st = str.slice(k,k+1); + if ("0"<=st && st<="9") { + integ = false; + k++; + while ("0"<=st && st<="9" && k<=str.length) { + st = str.slice(k,k+1); + k++; + } + } + } + if ((integ && k>1) || k>2) { + st = str.slice(0,k-1); + tagst = "mn"; + } else { + k = 2; + st = str.slice(0,1); //take 1 character + tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi"); + } + if (st=="-" && AMpreviousSymbol==INFIX) { + AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse + return {input:st, tag:tagst, output:st, ttype:UNARY, func:true}; + } + return {input:st, tag:tagst, output:st, ttype:CONST}; +} + +function AMremoveBrackets(node) { + var st; + if (!node.hasChildNodes()) { return; } + if (node.firstChild.hasChildNodes() && (node.nodeName=="mrow" || node.nodeName=="M:MROW")) { + st = node.firstChild.firstChild.nodeValue; + if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild); + } + if (node.lastChild.hasChildNodes() && (node.nodeName=="mrow" || node.nodeName=="M:MROW")) { + st = node.lastChild.firstChild.nodeValue; + if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild); + } +} + +/*Parsing ASCII math expressions with the following grammar +v ::= [A-Za-z] | greek letters | numbers | other constant symbols +u ::= sqrt | text | bb | other unary symbols for font commands +b ::= frac | root | stackrel binary symbols +l ::= ( | [ | { | (: | {: left brackets +r ::= ) | ] | } | :) | :} right brackets +S ::= v | lEr | uS | bSS Simple expression +I ::= S_S | S^S | S_S^S | S Intermediate expression +E ::= IE | I/I Expression +Each terminal symbol is translated into a corresponding mathml node.*/ + +var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol; + +function AMparseSexpr(str) { //parses str and returns [node,tailstr] + var symbol, node, result, i, st,// rightvert = false, + newFrag = document.createDocumentFragment(); + str = AMremoveCharsAndBlanks(str,0); + symbol = AMgetSymbol(str); //either a token or a bracket or empty + if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) { + return [null,str]; + } + if (symbol.ttype == DEFINITION) { + str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); + symbol = AMgetSymbol(str); + } + switch (symbol.ttype) { case UNDEROVER: + case CONST: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [createMmlNode(symbol.tag, //its a constant + document.createTextNode(symbol.output)),str]; + case LEFTBRACKET: //read (expr+) + AMnestingDepth++; + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseExpr(str,true); + AMnestingDepth--; + if (typeof symbol.invisible == "boolean" && symbol.invisible) + node = createMmlNode("mrow",result[0]); + else { + node = createMmlNode("mo",document.createTextNode(symbol.output)); + node = createMmlNode("mrow",node); + node.appendChild(result[0]); + } + return [node,result[1]]; + case TEXT: + if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length); + if (str.charAt(0)=="{") i=str.indexOf("}"); + else if (str.charAt(0)=="(") i=str.indexOf(")"); + else if (str.charAt(0)=="[") i=str.indexOf("]"); + else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1; + else i = 0; + if (i==-1) i = str.length; + st = str.slice(1,i); + if (st.charAt(0) == " ") { + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + } + newFrag.appendChild( + createMmlNode(symbol.tag,document.createTextNode(st))); + if (st.charAt(st.length-1) == " ") { + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + } + str = AMremoveCharsAndBlanks(str,i+1); + return [createMmlNode("mrow",newFrag),str]; + case UNARYUNDEROVER: + case UNARY: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseSexpr(str); + if (result[0]==null) return [createMmlNode(symbol.tag, + document.createTextNode(symbol.output)),str]; + if (typeof symbol.func == "boolean" && symbol.func) { // functions hack + st = str.charAt(0); + if (st=="^" || st=="_" || st=="/" || st=="|" || st=="," || + (symbol.input.length==1 && symbol.input.match(/\w/) && st!="(")) { + return [createMmlNode(symbol.tag, + document.createTextNode(symbol.output)),str]; + } else { + node = createMmlNode("mrow", + createMmlNode(symbol.tag,document.createTextNode(symbol.output))); + node.appendChild(result[0]); + return [node,result[1]]; + } + } + AMremoveBrackets(result[0]); + if (symbol.input == "sqrt") { // sqrt + return [createMmlNode(symbol.tag,result[0]),result[1]]; + } else if (typeof symbol.rewriteleftright != "undefined") { // abs, floor, ceil + node = createMmlNode("mrow", createMmlNode("mo",document.createTextNode(symbol.rewriteleftright[0]))); + node.appendChild(result[0]); + node.appendChild(createMmlNode("mo",document.createTextNode(symbol.rewriteleftright[1]))); + return [node,result[1]]; + } else if (symbol.input == "cancel") { // cancel + node = createMmlNode(symbol.tag,result[0]); + node.setAttribute("notation","updiagonalstrike"); + return [node,result[1]]; + } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent + node = createMmlNode(symbol.tag,result[0]); + var accnode = createMmlNode("mo",document.createTextNode(symbol.output)); + if (symbol.input=="vec" && ( + (result[0].nodeName=="mrow" && result[0].childNodes.length==1 + && result[0].firstChild.firstChild.nodeValue !== null + && result[0].firstChild.firstChild.nodeValue.length==1) || + (result[0].firstChild.nodeValue !== null + && result[0].firstChild.nodeValue.length==1) )) { + accnode.setAttribute("stretchy",false); + } + node.appendChild(accnode); + return [node,result[1]]; + } else { // font change command + if (!isIE && typeof symbol.codes != "undefined") { + for (i=0; i<result[0].childNodes.length; i++) + if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") { + st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue: + result[0].childNodes[i].firstChild.nodeValue); + var newst = []; + for (var j=0; j<st.length; j++) + if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) + newst = newst + symbol.codes[st.charCodeAt(j)-65]; + else if (st.charCodeAt(j)>96 && st.charCodeAt(j)<123) + newst = newst + symbol.codes[st.charCodeAt(j)-71]; + else newst = newst + st.charAt(j); + if (result[0].nodeName=="mi") + result[0]=createMmlNode("mo"). + appendChild(document.createTextNode(newst)); + else result[0].replaceChild(createMmlNode("mo"). + appendChild(document.createTextNode(newst)), + result[0].childNodes[i]); + } + } + node = createMmlNode(symbol.tag,result[0]); + node.setAttribute(symbol.atname,symbol.atval); + return [node,result[1]]; + } + case BINARY: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseSexpr(str); + if (result[0]==null) return [createMmlNode("mo", + document.createTextNode(symbol.input)),str]; + AMremoveBrackets(result[0]); + var result2 = AMparseSexpr(result[1]); + if (result2[0]==null) return [createMmlNode("mo", + document.createTextNode(symbol.input)),str]; + AMremoveBrackets(result2[0]); + if (['color', 'class', 'id'].indexOf(symbol.input) >= 0) { + + // Get the second argument + if (str.charAt(0)=="{") i=str.indexOf("}"); + else if (str.charAt(0)=="(") i=str.indexOf(")"); + else if (str.charAt(0)=="[") i=str.indexOf("]"); + st = str.slice(1,i); + + // Make a mathml node + node = createMmlNode(symbol.tag,result2[0]); + + // Set the correct attribute + if (symbol.input === "color") node.setAttribute("mathcolor", st) + else if (symbol.input === "class") node.setAttribute("class", st) + else if (symbol.input === "id") node.setAttribute("id", st) + return [node,result2[1]]; + } + if (symbol.input=="root" || symbol.output=="stackrel") + newFrag.appendChild(result2[0]); + newFrag.appendChild(result[0]); + if (symbol.input=="frac") newFrag.appendChild(result2[0]); + return [createMmlNode(symbol.tag,newFrag),result2[1]]; + case INFIX: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [createMmlNode("mo",document.createTextNode(symbol.output)),str]; + case SPACE: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + newFrag.appendChild( + createMmlNode(symbol.tag,document.createTextNode(symbol.output))); + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + return [createMmlNode("mrow",newFrag),str]; + case LEFTRIGHT: +// if (rightvert) return [null,str]; else rightvert = true; + AMnestingDepth++; + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseExpr(str,false); + AMnestingDepth--; + st = ""; + if (result[0].lastChild!=null) + st = result[0].lastChild.firstChild.nodeValue; + if (st == "|" && str.charAt(0)!==",") { // its an absolute value subterm + node = createMmlNode("mo",document.createTextNode(symbol.output)); + node = createMmlNode("mrow",node); + node.appendChild(result[0]); + return [node,result[1]]; + } else { // the "|" is a \mid so use unicode 2223 (divides) for spacing + node = createMmlNode("mo",document.createTextNode("\u2223")); + node = createMmlNode("mrow",node); + return [node,str]; + } + default: +//alert("default"); + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [createMmlNode(symbol.tag, //its a constant + document.createTextNode(symbol.output)),str]; + } +} + +function AMparseIexpr(str) { + var symbol, sym1, sym2, node, result, underover; + str = AMremoveCharsAndBlanks(str,0); + sym1 = AMgetSymbol(str); + result = AMparseSexpr(str); + node = result[0]; + str = result[1]; + symbol = AMgetSymbol(str); + if (symbol.ttype == INFIX && symbol.input != "/") { + str = AMremoveCharsAndBlanks(str,symbol.input.length); +// if (symbol.input == "/") result = AMparseIexpr(str); else ... + result = AMparseSexpr(str); + if (result[0] == null) // show box in place of missing argument + result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); + else AMremoveBrackets(result[0]); + str = result[1]; +// if (symbol.input == "/") AMremoveBrackets(node); + underover = (sym1.ttype == UNDEROVER || sym1.ttype == UNARYUNDEROVER); + if (symbol.input == "_") { + sym2 = AMgetSymbol(str); + if (sym2.input == "^") { + str = AMremoveCharsAndBlanks(str,sym2.input.length); + var res2 = AMparseSexpr(str); + AMremoveBrackets(res2[0]); + str = res2[1]; + node = createMmlNode((underover?"munderover":"msubsup"),node); + node.appendChild(result[0]); + node.appendChild(res2[0]); + node = createMmlNode("mrow",node); // so sum does not stretch + } else { + node = createMmlNode((underover?"munder":"msub"),node); + node.appendChild(result[0]); + } + } else if (symbol.input == "^" && underover) { + node = createMmlNode("mover",node); + node.appendChild(result[0]); + } else { + node = createMmlNode(symbol.tag,node); + node.appendChild(result[0]); + } + if (typeof sym1.func != 'undefined' && sym1.func) { + sym2 = AMgetSymbol(str); + if (sym2.ttype != INFIX && sym2.ttype != RIGHTBRACKET && + (sym1.input.length>1 || sym2.ttype == LEFTBRACKET)) { + result = AMparseIexpr(str); + node = createMmlNode("mrow",node); + node.appendChild(result[0]); + str = result[1]; + } + } + } + return [node,str]; +} + +function AMparseExpr(str,rightbracket) { + var symbol, node, result, i, + newFrag = document.createDocumentFragment(); + do { + str = AMremoveCharsAndBlanks(str,0); + result = AMparseIexpr(str); + node = result[0]; + str = result[1]; + symbol = AMgetSymbol(str); + if (symbol.ttype == INFIX && symbol.input == "/") { + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseIexpr(str); + if (result[0] == null) // show box in place of missing argument + result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); + else AMremoveBrackets(result[0]); + str = result[1]; + AMremoveBrackets(node); + node = createMmlNode(symbol.tag,node); + node.appendChild(result[0]); + newFrag.appendChild(node); + symbol = AMgetSymbol(str); + } + else if (node!=undefined) newFrag.appendChild(node); + } while ((symbol.ttype != RIGHTBRACKET && + (symbol.ttype != LEFTRIGHT || rightbracket) + || AMnestingDepth == 0) && symbol!=null && symbol.output!=""); + if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) { +// if (AMnestingDepth > 0) AMnestingDepth--; + var len = newFrag.childNodes.length; + if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" + && newFrag.childNodes[len-1].lastChild + && newFrag.childNodes[len-1].lastChild.firstChild ) { //matrix + //removed to allow row vectors: //&& len>1 && + //newFrag.childNodes[len-2].nodeName == "mo" && + //newFrag.childNodes[len-2].firstChild.nodeValue == "," + var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue; + if (right==")" || right=="]") { + var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue; + if (left=="(" && right==")" && symbol.output != "}" || + left=="[" && right=="]") { + var pos = []; // positions of commas + var matrix = true; + var m = newFrag.childNodes.length; + for (i=0; matrix && i<m; i=i+2) { + pos[i] = []; + node = newFrag.childNodes[i]; + if (matrix) matrix = node.nodeName=="mrow" && + (i==m-1 || node.nextSibling.nodeName=="mo" && + node.nextSibling.firstChild.nodeValue==",")&& + node.firstChild.firstChild.nodeValue==left && + node.lastChild.firstChild.nodeValue==right; + if (matrix) + for (var j=0; j<node.childNodes.length; j++) + if (node.childNodes[j].firstChild.nodeValue==",") + pos[i][pos[i].length]=j; + if (matrix && i>1) matrix = pos[i].length == pos[i-2].length; + } + matrix = matrix && (pos.length>1 || pos[0].length>0); + var columnlines = []; + if (matrix) { + var row, frag, n, k, table = document.createDocumentFragment(); + for (i=0; i<m; i=i+2) { + row = document.createDocumentFragment(); + frag = document.createDocumentFragment(); + node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow> + n = node.childNodes.length; + k = 0; + node.removeChild(node.firstChild); //remove ( + for (j=1; j<n-1; j++) { + if (typeof pos[i][k] != "undefined" && j==pos[i][k]){ + node.removeChild(node.firstChild); //remove , + if (node.firstChild.nodeName=="mrow" && node.firstChild.childNodes.length==1 && + node.firstChild.firstChild.firstChild.nodeValue=="\u2223") { + //is columnline marker - skip it + if (i==0) { columnlines.push("solid"); } + node.removeChild(node.firstChild); //remove mrow + node.removeChild(node.firstChild); //remove , + j+=2; + k++; + } else if (i==0) { columnlines.push("none"); } + row.appendChild(createMmlNode("mtd",frag)); + k++; + } else frag.appendChild(node.firstChild); + } + row.appendChild(createMmlNode("mtd",frag)); + if (i==0) { columnlines.push("none"); } + if (newFrag.childNodes.length>2) { + newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow> + newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo> + } + table.appendChild(createMmlNode("mtr",row)); + } + node = createMmlNode("mtable",table); + node.setAttribute("columnlines", columnlines.join(" ")); + if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left"); + newFrag.replaceChild(node,newFrag.firstChild); + } + } + } + } + str = AMremoveCharsAndBlanks(str,symbol.input.length); + if (typeof symbol.invisible != "boolean" || !symbol.invisible) { + node = createMmlNode("mo",document.createTextNode(symbol.output)); + newFrag.appendChild(node); + } + } + return [newFrag,str]; +} + +function parseMath(str,latex) { + var frag, node; + AMnestingDepth = 0; + //some basic cleanup for dealing with stuff editors like TinyMCE adds + str = str.replace(/ /g,""); + str = str.replace(/>/g,">"); + str = str.replace(/</g,"<"); + frag = AMparseExpr(str.replace(/^\s+/g,""),false)[0]; + node = createMmlNode("mstyle",frag); + if (mathcolor != "") node.setAttribute("mathcolor",mathcolor); + if (mathfontsize != "") { + node.setAttribute("fontsize", mathfontsize); + node.setAttribute("mathsize", mathfontsize); + } + if (mathfontfamily != "") { + node.setAttribute("fontfamily", mathfontfamily); + node.setAttribute("mathvariant", mathfontfamily); + } + + if (displaystyle) node.setAttribute("displaystyle","true"); + node = createMmlNode("math",node); + if (showasciiformulaonhover) //fixed by djhsu so newline + node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko + return node; +} + +/* +function strarr2docFrag(arr, linebreaks, latex) { + var newFrag=document.createDocumentFragment(); + var expr = false; + for (var i=0; i<arr.length; i++) { + if (expr) newFrag.appendChild(parseMath(arr[i],latex)); + else { + var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]); + newFrag.appendChild(createElementXHTML("span"). + appendChild(document.createTextNode(arri[0]))); + for (var j=1; j<arri.length; j++) { + newFrag.appendChild(createElementXHTML("p")); + newFrag.appendChild(createElementXHTML("span"). + appendChild(document.createTextNode(arri[j]))); + } + } + expr = !expr; + } + return newFrag; +} + +function AMautomathrec(str) { +//formula is a space (or start of str) followed by a maximal sequence of *two* or more tokens, possibly separated by runs of digits and/or space. +//tokens are single letters (except a, A, I) and ASCIIMathML tokens + var texcommand = "\\\\[a-zA-Z]+|\\\\\\s|"; + var ambigAMtoken = "\\b(?:oo|lim|ln|int|oint|del|grad|aleph|prod|prop|sinh|cosh|tanh|cos|sec|pi|tt|fr|sf|sube|supe|sub|sup|det|mod|gcd|lcm|min|max|vec|ddot|ul|chi|eta|nu|mu)(?![a-z])|"; + var englishAMtoken = "\\b(?:sum|ox|log|sin|tan|dim|hat|bar|dot)(?![a-z])|"; + var secondenglishAMtoken = "|\\bI\\b|\\bin\\b|\\btext\\b"; // took if and or not out + var simpleAMtoken = "NN|ZZ|QQ|RR|CC|TT|AA|EE|sqrt|dx|dy|dz|dt|xx|vv|uu|nn|bb|cc|csc|cot|alpha|beta|delta|Delta|epsilon|gamma|Gamma|kappa|lambda|Lambda|omega|phi|Phi|Pi|psi|Psi|rho|sigma|Sigma|tau|theta|Theta|xi|Xi|zeta"; // uuu nnn? + var letter = "[a-zA-HJ-Z](?=(?:[^a-zA-Z]|$|"+ambigAMtoken+englishAMtoken+simpleAMtoken+"))|"; + var token = letter+texcommand+"\\d+|[-()[\\]{}+=*&^_%\\\@/<>,\\|!:;'~]|\\.(?!(?:\x20|$))|"+ambigAMtoken+englishAMtoken+simpleAMtoken; + var re = new RegExp("(^|\\s)((("+token+")\\s?)(("+token+secondenglishAMtoken+")\\s?)+)([,.?]?(?=\\s|$))","g"); + str = str.replace(re," `$2`$7"); + var arr = str.split(AMdelimiter1); + var re1 = new RegExp("(^|\\s)([b-zB-HJ-Z+*<>]|"+texcommand+ambigAMtoken+simpleAMtoken+")(\\s|\\n|$)","g"); + var re2 = new RegExp("(^|\\s)([a-z]|"+texcommand+ambigAMtoken+simpleAMtoken+")([,.])","g"); // removed |\d+ for now + for (i=0; i<arr.length; i++) //single nonenglish tokens + if (i%2==0) { + arr[i] = arr[i].replace(re1," `$2`$3"); + arr[i] = arr[i].replace(re2," `$2`$3"); + arr[i] = arr[i].replace(/([{}[\]])/,"`$1`"); + } + str = arr.join(AMdelimiter1); + str = str.replace(/((^|\s)\([a-zA-Z]{2,}.*?)\)`/g,"$1`)"); //fix parentheses + str = str.replace(/`(\((a\s|in\s))(.*?[a-zA-Z]{2,}\))/g,"$1`$3"); //fix parentheses + str = str.replace(/\sin`/g,"` in"); + str = str.replace(/`(\(\w\)[,.]?(\s|\n|$))/g,"$1`"); + str = str.replace(/`([0-9.]+|e.g|i.e)`(\.?)/gi,"$1$2"); + str = str.replace(/`([0-9.]+:)`/g,"$1"); + return str; +} + +function processNodeR(n, linebreaks,latex) { + var mtch, str, arr, frg, i; + if (n.childNodes.length == 0) { + if ((n.nodeType!=8 || linebreaks) && + n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" && + n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" + //&& + //n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE" + ) { + str = n.nodeValue; + if (!(str == null)) { + str = str.replace(/\r\n\r\n/g,"\n\n"); + str = str.replace(/\x20+/g," "); + str = str.replace(/\s*\r\n/g," "); + if(latex) { +// DELIMITERS: + mtch = (str.indexOf("\$")==-1 ? false : true); + str = str.replace(/([^\\])\$/g,"$1 \$"); + str = str.replace(/^\$/," \$"); // in case \$ at start of string + arr = str.split(" \$"); + for (i=0; i<arr.length; i++) + arr[i]=arr[i].replace(/\\\$/g,"\$"); + } else { + mtch = false; + str = str.replace(new RegExp(AMescape1, "g"), + function(){mtch = true; return "AMescape1"}); + str = str.replace(/\\?end{?a?math}?/i, + function(){automathrecognize = false; mtch = true; return ""}); + str = str.replace(/amath\b|\\begin{a?math}/i, + function(){automathrecognize = true; mtch = true; return ""}); + arr = str.split(AMdelimiter1); + if (automathrecognize) + for (i=0; i<arr.length; i++) + if (i%2==0) arr[i] = AMautomathrec(arr[i]); + str = arr.join(AMdelimiter1); + arr = str.split(AMdelimiter1); + for (i=0; i<arr.length; i++) // this is a problem ************ + arr[i]=arr[i].replace(/AMescape1/g,AMdelimiter1); + } + if (arr.length>1 || mtch) { + if (!noMathML) { + frg = strarr2docFrag(arr,n.nodeType==8,latex); + var len = frg.childNodes.length; + n.parentNode.replaceChild(frg,n); + return len-1; + } else return 0; + } + } + } else return 0; + } else if (n.nodeName!="math") { + for (i=0; i<n.childNodes.length; i++) + i += processNodeR(n.childNodes[i], linebreaks,latex); + } + return 0; +} + +function AMprocessNode(n, linebreaks, spanclassAM) { + var frag,st; + if (spanclassAM!=null) { + frag = document.getElementsByTagName("span") + for (var i=0;i<frag.length;i++) + if (frag[i].className == "AM") + processNodeR(frag[i],linebreaks,false); + } else { + try { + st = n.innerHTML; // look for AMdelimiter on page + } catch(err) {} +//alert(st) + if (st==null || /amath\b|\\begin{a?math}/i.test(st) || + st.indexOf(AMdelimiter1+" ")!=-1 || st.slice(-1)==AMdelimiter1 || + st.indexOf(AMdelimiter1+"<")!=-1 || st.indexOf(AMdelimiter1+"\n")!=-1) { + processNodeR(n,linebreaks,false); + } + } +} + +function generic(){ + if(!init()) return; + if (translateOnLoad) { + translate(); + } +}; +//setup onload function +if(typeof window.addEventListener != 'undefined'){ + //.. gecko, safari, konqueror and standard + window.addEventListener('load', generic, false); +} +else if(typeof document.addEventListener != 'undefined'){ + //.. opera 7 + document.addEventListener('load', generic, false); +} +else if(typeof window.attachEvent != 'undefined'){ + //.. win/ie + window.attachEvent('onload', generic); +}else{ + //.. mac/ie5 and anything else that gets this far + //if there's an existing onload function + if(typeof window.onload == 'function'){ + //store it + var existing = onload; + //add new onload handler + window.onload = function(){ + //call existing onload function + existing(); + //call generic onload function + generic(); + }; + }else{ + window.onload = generic; + } +} + +//expose some functions to outside +asciimath.newcommand = newcommand; +asciimath.newsymbol = newsymbol; +asciimath.AMprocesssNode = AMprocessNode; +asciimath.parseMath = parseMath; +asciimath.translate = translate; +})(); + +*/ + +/****************************************************************** + * + * The previous section is ASCIIMathML.js Version 2.2 + * (c) Peter Jipsen, used with permission. + * + ******************************************************************/ + +showasciiformulaonhover = false; +mathfontfamily = ""; +mathcolor = ""; +mathfontsize = ""; + +// +// Remove remapping of mathvariants to plane1 (MathJax handles that) +// Change functions to mi rather than mo (to get spacing right) +// +(function () { + for (var i = 0, m = AMsymbols.length; i < m; i++) { + if (AMsymbols[i].codes) {delete AMsymbols[i].codes} + if (AMsymbols[i].func) {AMsymbols[i].tag = "mi"} + } +})(); + +// +// Access to AsciiMath functions and values +// +ASCIIMATH.Augment({ + AM: { + Init: function () { + displaystyle = ASCIIMATH.config.displaystyle; + // Old versions use the "decimal" option, so take it into account if it + // is defined by the user. See issue 384. + decimalsign = (ASCIIMATH.config.decimal || ASCIIMATH.config.decimalsign); + // unfix phi and varphi, if requested + if (!ASCIIMATH.config.fixphi) { + for (var i = 0, m = AMsymbols.length; i < m; i++) { + if (AMsymbols[i].input === "phi") {AMsymbols[i].output = "\u03C6"} + if (AMsymbols[i].input === "varphi") {AMsymbols[i].output = "\u03D5"; i = m} + } + } + + INITASCIIMATH(); + initSymbols(); + }, + Augment: function (def) { + for (var id in def) {if (def.hasOwnProperty(id)) { + switch (id) { + case "displaystyle": displaystyle = def[id]; break; + case "decimal": decimal = def[id]; break; + case "parseMath": parseMath = def[id]; break; + case "parseExpr": AMparseExpr = def[id]; break; + case "parseIexpr": AMparseIexpr = def[id]; break; + case "parseSexpr": AMparseSexpr = def[id]; break; + case "removeBrackets": AMremoveBrackets = def[id]; break; + case "getSymbol": AMgetSymbol = def[id]; break; + case "position": position = def[id]; break; + case "removeCharsAndBlanks": AMremoveCharsAndBlanks = def[id]; break; + case "createMmlNode": createMmlNode = def[id]; break; + case "createElementMathML": AMcreateElementMathML = def[id]; break; + case "createElementXHTML": createElementXHTML = def[id]; break; + case "initSymbols": initSymbols = def[id]; break; + case "refreshSymbols": refreshSymbols = def[id]; break; + case "compareNames": compareNames = def[id]; break; + }; + this[id] = def[id]; + }}; + }, + parseMath: parseMath, + parseExpr: AMparseExpr, + parseIexpr: AMparseIexpr, + parseSexr: AMparseSexpr, + removeBrackets: AMremoveBrackets, + getSymbol: AMgetSymbol, + position: position, + removeCharsAndBlanks: AMremoveCharsAndBlanks, + createMmlNode: createMmlNode, + createElementMathML: AMcreateElementMathML, + createElementXHTML: createElementXHTML, + initSymbols: initSymbols, + refreshSymbols: refreshSymbols, + compareNames: compareNames, + + createDocumentFragment: DOCFRAG, + document: document, + + define: define, + newcommand: newcommand, + newsymbol: newsymbol, + symbols: AMsymbols, + names: AMnames, + + TOKEN: { + CONST:CONST, UNARY:UNARY, BINARY:BINARY, INFIX:INFIX, + LEFTBRACKET:LEFTBRACKET, RIGHTBRACKET:RIGHTBRACKET, SPACE:SPACE, + UNDEROVER:UNDEROVER, DEFINITION:DEFINITION, LEFTRIGHT:LEFTRIGHT, TEXT:TEXT, + UNARYUNDEROVER:UNARYUNDEROVER + } + } +}); + +// +// Make minimizer think these have been used +// +var junk = [window, navigator]; junk = null; + +})(MathJax.InputJax.AsciiMath); + + +/************************************************************************/ + +(function (ASCIIMATH) { + var MML; + + ASCIIMATH.Augment({ + sourceMenuTitle: /*_(MathMenu)*/ ["AsciiMathInput","AsciiMath Input"], + annotationEncoding: "text/x-asciimath", + + prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing AsciiMath + postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing AsciiMath + + Translate: function (script) { + var mml, math = MathJax.HTML.getScript(script); + var data = {math:math, script:script}; + var callback = this.prefilterHooks.Execute(data); if (callback) return callback; + math = data.math; + try { + mml = this.AM.parseMath(math); + } catch(err) { + if (!err.asciimathError) {throw err} + mml = this.formatError(err,math); + } + data.math = MML(mml); this.postfilterHooks.Execute(data); + return this.postfilterHooks.Execute(data) || data.math; + }, + formatError: function (err,math,script) { + var message = err.message.replace(/\n.*/,""); + MathJax.Hub.signal.Post(["AsciiMath Jax - parse error",message,math,script]); + return MML.Error(message); + }, + Error: function (message) { + throw MathJax.Hub.Insert(Error(message),{asciimathError: true}); + }, + // + // Initialize the MML variable and AsciiMath itself + // + Startup: function () { + MML = MathJax.ElementJax.mml; + this.AM.Init(); + } + }); + + ASCIIMATH.loadComplete("jax.js"); + +})(MathJax.InputJax.AsciiMath); + + + +// @license-end diff --git a/js/mathjax/jax/input/MathML/config.js b/js/mathjax/jax/input/MathML/config.js new file mode 100644 index 0000000..d5f902b --- /dev/null +++ b/js/mathjax/jax/input/MathML/config.js @@ -0,0 +1,43 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/input/MathML/config.js + * + * Initializes the MathML InputJax (the main definition is in + * MathJax/jax/input/MathML/jax.js, which is loaded when needed). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.InputJax.MathML = MathJax.InputJax({ + id: "MathML", + version: "2.7.9", + directory: MathJax.InputJax.directory + "/MathML", + extensionDir: MathJax.InputJax.extensionDir + "/MathML", + entityDir: MathJax.InputJax.directory + "/MathML/entities", + + config: { + useMathMLspacing: false // false means use TeX spacing, true means MML spacing + } +}); +MathJax.InputJax.MathML.Register("math/mml"); + +MathJax.InputJax.MathML.loadComplete("config.js"); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/a.js b/js/mathjax/jax/input/MathML/entities/a.js new file mode 100644 index 0000000..4e7dae4 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/a.js @@ -0,0 +1,92 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/a.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'AElig': '\u00C6', + 'AMP': '\u0026', + 'Aacute': '\u00C1', + 'Abreve': '\u0102', + 'Acirc': '\u00C2', + 'Acy': '\u0410', + 'Agrave': '\u00C0', + 'Alpha': '\u0391', + 'Amacr': '\u0100', + 'And': '\u2A53', + 'Aogon': '\u0104', + 'Aring': '\u00C5', + 'Assign': '\u2254', + 'Atilde': '\u00C3', + 'Auml': '\u00C4', + 'aacute': '\u00E1', + 'abreve': '\u0103', + 'ac': '\u223E', + 'acE': '\u223E\u0333', + 'acd': '\u223F', + 'acirc': '\u00E2', + 'acy': '\u0430', + 'aelig': '\u00E6', + 'af': '\u2061', + 'agrave': '\u00E0', + 'alefsym': '\u2135', + 'amacr': '\u0101', + 'amp': '\u0026', + 'andand': '\u2A55', + 'andd': '\u2A5C', + 'andslope': '\u2A58', + 'andv': '\u2A5A', + 'ange': '\u29A4', + 'angle': '\u2220', + 'angmsdaa': '\u29A8', + 'angmsdab': '\u29A9', + 'angmsdac': '\u29AA', + 'angmsdad': '\u29AB', + 'angmsdae': '\u29AC', + 'angmsdaf': '\u29AD', + 'angmsdag': '\u29AE', + 'angmsdah': '\u29AF', + 'angrt': '\u221F', + 'angrtvb': '\u22BE', + 'angrtvbd': '\u299D', + 'angst': '\u00C5', + 'angzarr': '\u237C', + 'aogon': '\u0105', + 'ap': '\u2248', + 'apE': '\u2A70', + 'apacir': '\u2A6F', + 'apid': '\u224B', + 'apos': '\u0027', + 'approx': '\u2248', + 'approxeq': '\u224A', + 'aring': '\u00E5', + 'ast': '\u002A', + 'asymp': '\u2248', + 'asympeq': '\u224D', + 'atilde': '\u00E3', + 'auml': '\u00E4', + 'awconint': '\u2233', + 'awint': '\u2A11' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/a.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/b.js b/js/mathjax/jax/input/MathML/entities/b.js new file mode 100644 index 0000000..c3e04ee --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/b.js @@ -0,0 +1,118 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/b.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'Barv': '\u2AE7', + 'Barwed': '\u2306', + 'Bcy': '\u0411', + 'Bernoullis': '\u212C', + 'Beta': '\u0392', + 'Bumpeq': '\u224E', + 'bNot': '\u2AED', + 'backcong': '\u224C', + 'backepsilon': '\u03F6', + 'barvee': '\u22BD', + 'barwed': '\u2305', + 'barwedge': '\u2305', + 'bbrk': '\u23B5', + 'bbrktbrk': '\u23B6', + 'bcong': '\u224C', + 'bcy': '\u0431', + 'bdquo': '\u201E', + 'becaus': '\u2235', + 'because': '\u2235', + 'bemptyv': '\u29B0', + 'bepsi': '\u03F6', + 'bernou': '\u212C', + 'bigcap': '\u22C2', + 'bigcup': '\u22C3', + 'bigvee': '\u22C1', + 'bigwedge': '\u22C0', + 'bkarow': '\u290D', + 'blacksquare': '\u25AA', + 'blacktriangleright': '\u25B8', + 'blank': '\u2423', + 'blk12': '\u2592', + 'blk14': '\u2591', + 'blk34': '\u2593', + 'block': '\u2588', + 'bne': '\u003D\u20E5', + 'bnequiv': '\u2261\u20E5', + 'bnot': '\u2310', + 'bot': '\u22A5', + 'bottom': '\u22A5', + 'boxDL': '\u2557', + 'boxDR': '\u2554', + 'boxDl': '\u2556', + 'boxDr': '\u2553', + 'boxH': '\u2550', + 'boxHD': '\u2566', + 'boxHU': '\u2569', + 'boxHd': '\u2564', + 'boxHu': '\u2567', + 'boxUL': '\u255D', + 'boxUR': '\u255A', + 'boxUl': '\u255C', + 'boxUr': '\u2559', + 'boxV': '\u2551', + 'boxVH': '\u256C', + 'boxVL': '\u2563', + 'boxVR': '\u2560', + 'boxVh': '\u256B', + 'boxVl': '\u2562', + 'boxVr': '\u255F', + 'boxbox': '\u29C9', + 'boxdL': '\u2555', + 'boxdR': '\u2552', + 'boxh': '\u2500', + 'boxhD': '\u2565', + 'boxhU': '\u2568', + 'boxhd': '\u252C', + 'boxhu': '\u2534', + 'boxuL': '\u255B', + 'boxuR': '\u2558', + 'boxv': '\u2502', + 'boxvH': '\u256A', + 'boxvL': '\u2561', + 'boxvR': '\u255E', + 'boxvh': '\u253C', + 'boxvl': '\u2524', + 'boxvr': '\u251C', + 'bprime': '\u2035', + 'breve': '\u02D8', + 'brvbar': '\u00A6', + 'bsemi': '\u204F', + 'bsim': '\u223D', + 'bsime': '\u22CD', + 'bsolb': '\u29C5', + 'bsolhsub': '\u27C8', + 'bullet': '\u2022', + 'bump': '\u224E', + 'bumpE': '\u2AAE', + 'bumpe': '\u224F', + 'bumpeq': '\u224F' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/b.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/c.js b/js/mathjax/jax/input/MathML/entities/c.js new file mode 100644 index 0000000..90ef2e6 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/c.js @@ -0,0 +1,116 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/c.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'CHcy': '\u0427', + 'COPY': '\u00A9', + 'Cacute': '\u0106', + 'CapitalDifferentialD': '\u2145', + 'Cayleys': '\u212D', + 'Ccaron': '\u010C', + 'Ccedil': '\u00C7', + 'Ccirc': '\u0108', + 'Cconint': '\u2230', + 'Cdot': '\u010A', + 'Cedilla': '\u00B8', + 'Chi': '\u03A7', + 'ClockwiseContourIntegral': '\u2232', + 'CloseCurlyDoubleQuote': '\u201D', + 'CloseCurlyQuote': '\u2019', + 'Colon': '\u2237', + 'Colone': '\u2A74', + 'Conint': '\u222F', + 'CounterClockwiseContourIntegral': '\u2233', + 'cacute': '\u0107', + 'capand': '\u2A44', + 'capbrcup': '\u2A49', + 'capcap': '\u2A4B', + 'capcup': '\u2A47', + 'capdot': '\u2A40', + 'caps': '\u2229\uFE00', + 'caret': '\u2041', + 'caron': '\u02C7', + 'ccaps': '\u2A4D', + 'ccaron': '\u010D', + 'ccedil': '\u00E7', + 'ccirc': '\u0109', + 'ccups': '\u2A4C', + 'ccupssm': '\u2A50', + 'cdot': '\u010B', + 'cedil': '\u00B8', + 'cemptyv': '\u29B2', + 'cent': '\u00A2', + 'centerdot': '\u00B7', + 'chcy': '\u0447', + 'checkmark': '\u2713', + 'cir': '\u25CB', + 'cirE': '\u29C3', + 'cire': '\u2257', + 'cirfnint': '\u2A10', + 'cirmid': '\u2AEF', + 'cirscir': '\u29C2', + 'clubsuit': '\u2663', + 'colone': '\u2254', + 'coloneq': '\u2254', + 'comma': '\u002C', + 'commat': '\u0040', + 'compfn': '\u2218', + 'complement': '\u2201', + 'complexes': '\u2102', + 'cong': '\u2245', + 'congdot': '\u2A6D', + 'conint': '\u222E', + 'coprod': '\u2210', + 'copy': '\u00A9', + 'copysr': '\u2117', + 'crarr': '\u21B5', + 'cross': '\u2717', + 'csub': '\u2ACF', + 'csube': '\u2AD1', + 'csup': '\u2AD0', + 'csupe': '\u2AD2', + 'cudarrl': '\u2938', + 'cudarrr': '\u2935', + 'cularrp': '\u293D', + 'cupbrcap': '\u2A48', + 'cupcap': '\u2A46', + 'cupcup': '\u2A4A', + 'cupdot': '\u228D', + 'cupor': '\u2A45', + 'cups': '\u222A\uFE00', + 'curarrm': '\u293C', + 'curlyeqprec': '\u22DE', + 'curlyeqsucc': '\u22DF', + 'curren': '\u00A4', + 'curvearrowleft': '\u21B6', + 'curvearrowright': '\u21B7', + 'cuvee': '\u22CE', + 'cuwed': '\u22CF', + 'cwconint': '\u2232', + 'cwint': '\u2231', + 'cylcty': '\u232D' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/c.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/d.js b/js/mathjax/jax/input/MathML/entities/d.js new file mode 100644 index 0000000..7dd0375 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/d.js @@ -0,0 +1,114 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/d.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'DD': '\u2145', + 'DDotrahd': '\u2911', + 'DJcy': '\u0402', + 'DScy': '\u0405', + 'DZcy': '\u040F', + 'Darr': '\u21A1', + 'Dashv': '\u2AE4', + 'Dcaron': '\u010E', + 'Dcy': '\u0414', + 'DiacriticalAcute': '\u00B4', + 'DiacriticalDot': '\u02D9', + 'DiacriticalDoubleAcute': '\u02DD', + 'DiacriticalGrave': '\u0060', + 'DiacriticalTilde': '\u02DC', + 'Dot': '\u00A8', + 'DotDot': '\u20DC', + 'DoubleContourIntegral': '\u222F', + 'DoubleDownArrow': '\u21D3', + 'DoubleLeftArrow': '\u21D0', + 'DoubleLeftRightArrow': '\u21D4', + 'DoubleLeftTee': '\u2AE4', + 'DoubleLongLeftArrow': '\u27F8', + 'DoubleLongLeftRightArrow': '\u27FA', + 'DoubleLongRightArrow': '\u27F9', + 'DoubleRightArrow': '\u21D2', + 'DoubleUpArrow': '\u21D1', + 'DoubleUpDownArrow': '\u21D5', + 'DownArrowBar': '\u2913', + 'DownArrowUpArrow': '\u21F5', + 'DownBreve': '\u0311', + 'DownLeftRightVector': '\u2950', + 'DownLeftTeeVector': '\u295E', + 'DownLeftVectorBar': '\u2956', + 'DownRightTeeVector': '\u295F', + 'DownRightVectorBar': '\u2957', + 'DownTeeArrow': '\u21A7', + 'Dstrok': '\u0110', + 'dArr': '\u21D3', + 'dHar': '\u2965', + 'darr': '\u2193', + 'dash': '\u2010', + 'dashv': '\u22A3', + 'dbkarow': '\u290F', + 'dblac': '\u02DD', + 'dcaron': '\u010F', + 'dcy': '\u0434', + 'dd': '\u2146', + 'ddagger': '\u2021', + 'ddotseq': '\u2A77', + 'demptyv': '\u29B1', + 'dfisht': '\u297F', + 'dharl': '\u21C3', + 'dharr': '\u21C2', + 'diam': '\u22C4', + 'diamond': '\u22C4', + 'diamondsuit': '\u2666', + 'diams': '\u2666', + 'die': '\u00A8', + 'disin': '\u22F2', + 'divide': '\u00F7', + 'divonx': '\u22C7', + 'djcy': '\u0452', + 'dlcorn': '\u231E', + 'dlcrop': '\u230D', + 'dollar': '\u0024', + 'doteq': '\u2250', + 'dotminus': '\u2238', + 'doublebarwedge': '\u2306', + 'downarrow': '\u2193', + 'downdownarrows': '\u21CA', + 'downharpoonleft': '\u21C3', + 'downharpoonright': '\u21C2', + 'drbkarow': '\u2910', + 'drcorn': '\u231F', + 'drcrop': '\u230C', + 'dscy': '\u0455', + 'dsol': '\u29F6', + 'dstrok': '\u0111', + 'dtri': '\u25BF', + 'dtrif': '\u25BE', + 'duarr': '\u21F5', + 'duhar': '\u296F', + 'dwangle': '\u29A6', + 'dzcy': '\u045F', + 'dzigrarr': '\u27FF' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/d.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/e.js b/js/mathjax/jax/input/MathML/entities/e.js new file mode 100644 index 0000000..215047d --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/e.js @@ -0,0 +1,94 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/e.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'ENG': '\u014A', + 'ETH': '\u00D0', + 'Eacute': '\u00C9', + 'Ecaron': '\u011A', + 'Ecirc': '\u00CA', + 'Ecy': '\u042D', + 'Edot': '\u0116', + 'Egrave': '\u00C8', + 'Emacr': '\u0112', + 'EmptySmallSquare': '\u25FB', + 'EmptyVerySmallSquare': '\u25AB', + 'Eogon': '\u0118', + 'Epsilon': '\u0395', + 'Equal': '\u2A75', + 'Esim': '\u2A73', + 'Eta': '\u0397', + 'Euml': '\u00CB', + 'eDDot': '\u2A77', + 'eDot': '\u2251', + 'eacute': '\u00E9', + 'easter': '\u2A6E', + 'ecaron': '\u011B', + 'ecirc': '\u00EA', + 'ecolon': '\u2255', + 'ecy': '\u044D', + 'edot': '\u0117', + 'ee': '\u2147', + 'eg': '\u2A9A', + 'egrave': '\u00E8', + 'egsdot': '\u2A98', + 'el': '\u2A99', + 'elinters': '\u23E7', + 'elsdot': '\u2A97', + 'emacr': '\u0113', + 'emptyset': '\u2205', + 'emptyv': '\u2205', + 'emsp': '\u2003', + 'emsp13': '\u2004', + 'emsp14': '\u2005', + 'eng': '\u014B', + 'ensp': '\u2002', + 'eogon': '\u0119', + 'epar': '\u22D5', + 'eparsl': '\u29E3', + 'eplus': '\u2A71', + 'epsilon': '\u03B5', + 'eqcirc': '\u2256', + 'eqcolon': '\u2255', + 'eqsim': '\u2242', + 'eqslantgtr': '\u2A96', + 'eqslantless': '\u2A95', + 'equals': '\u003D', + 'equest': '\u225F', + 'equiv': '\u2261', + 'equivDD': '\u2A78', + 'eqvparsl': '\u29E5', + 'erarr': '\u2971', + 'esdot': '\u2250', + 'esim': '\u2242', + 'euml': '\u00EB', + 'euro': '\u20AC', + 'excl': '\u0021', + 'exist': '\u2203', + 'expectation': '\u2130', + 'exponentiale': '\u2147' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/e.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/f.js b/js/mathjax/jax/input/MathML/entities/f.js new file mode 100644 index 0000000..5319a4e --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/f.js @@ -0,0 +1,62 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/f.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'Fcy': '\u0424', + 'FilledSmallSquare': '\u25FC', + 'Fouriertrf': '\u2131', + 'fallingdotseq': '\u2252', + 'fcy': '\u0444', + 'female': '\u2640', + 'ffilig': '\uFB03', + 'fflig': '\uFB00', + 'ffllig': '\uFB04', + 'filig': '\uFB01', + 'fjlig': '\u0066\u006A', + 'fllig': '\uFB02', + 'fltns': '\u25B1', + 'fnof': '\u0192', + 'forall': '\u2200', + 'forkv': '\u2AD9', + 'fpartint': '\u2A0D', + 'frac12': '\u00BD', + 'frac13': '\u2153', + 'frac14': '\u00BC', + 'frac15': '\u2155', + 'frac16': '\u2159', + 'frac18': '\u215B', + 'frac23': '\u2154', + 'frac25': '\u2156', + 'frac34': '\u00BE', + 'frac35': '\u2157', + 'frac38': '\u215C', + 'frac45': '\u2158', + 'frac56': '\u215A', + 'frac58': '\u215D', + 'frac78': '\u215E', + 'frasl': '\u2044' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/f.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/fr.js b/js/mathjax/jax/input/MathML/entities/fr.js new file mode 100644 index 0000000..cf2aca7 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/fr.js @@ -0,0 +1,81 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/fr.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'Afr': '\uD835\uDD04', + 'Bfr': '\uD835\uDD05', + 'Cfr': '\u212D', + 'Dfr': '\uD835\uDD07', + 'Efr': '\uD835\uDD08', + 'Ffr': '\uD835\uDD09', + 'Gfr': '\uD835\uDD0A', + 'Hfr': '\u210C', + 'Ifr': '\u2111', + 'Jfr': '\uD835\uDD0D', + 'Kfr': '\uD835\uDD0E', + 'Lfr': '\uD835\uDD0F', + 'Mfr': '\uD835\uDD10', + 'Nfr': '\uD835\uDD11', + 'Ofr': '\uD835\uDD12', + 'Pfr': '\uD835\uDD13', + 'Qfr': '\uD835\uDD14', + 'Rfr': '\u211C', + 'Sfr': '\uD835\uDD16', + 'Tfr': '\uD835\uDD17', + 'Ufr': '\uD835\uDD18', + 'Vfr': '\uD835\uDD19', + 'Wfr': '\uD835\uDD1A', + 'Xfr': '\uD835\uDD1B', + 'Yfr': '\uD835\uDD1C', + 'Zfr': '\u2128', + 'afr': '\uD835\uDD1E', + 'bfr': '\uD835\uDD1F', + 'cfr': '\uD835\uDD20', + 'dfr': '\uD835\uDD21', + 'efr': '\uD835\uDD22', + 'ffr': '\uD835\uDD23', + 'gfr': '\uD835\uDD24', + 'hfr': '\uD835\uDD25', + 'ifr': '\uD835\uDD26', + 'jfr': '\uD835\uDD27', + 'kfr': '\uD835\uDD28', + 'lfr': '\uD835\uDD29', + 'mfr': '\uD835\uDD2A', + 'nfr': '\uD835\uDD2B', + 'ofr': '\uD835\uDD2C', + 'pfr': '\uD835\uDD2D', + 'qfr': '\uD835\uDD2E', + 'rfr': '\uD835\uDD2F', + 'sfr': '\uD835\uDD30', + 'tfr': '\uD835\uDD31', + 'ufr': '\uD835\uDD32', + 'vfr': '\uD835\uDD33', + 'wfr': '\uD835\uDD34', + 'xfr': '\uD835\uDD35', + 'yfr': '\uD835\uDD36', + 'zfr': '\uD835\uDD37' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/fr.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/g.js b/js/mathjax/jax/input/MathML/entities/g.js new file mode 100644 index 0000000..8c3f003 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/g.js @@ -0,0 +1,85 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/g.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'GJcy': '\u0403', + 'GT': '\u003E', + 'Gammad': '\u03DC', + 'Gbreve': '\u011E', + 'Gcedil': '\u0122', + 'Gcirc': '\u011C', + 'Gcy': '\u0413', + 'Gdot': '\u0120', + 'GreaterGreater': '\u2AA2', + 'Gt': '\u226B', + 'gE': '\u2267', + 'gacute': '\u01F5', + 'gammad': '\u03DD', + 'gbreve': '\u011F', + 'gcirc': '\u011D', + 'gcy': '\u0433', + 'gdot': '\u0121', + 'ge': '\u2265', + 'gel': '\u22DB', + 'geq': '\u2265', + 'geqq': '\u2267', + 'geqslant': '\u2A7E', + 'ges': '\u2A7E', + 'gescc': '\u2AA9', + 'gesdot': '\u2A80', + 'gesdoto': '\u2A82', + 'gesdotol': '\u2A84', + 'gesl': '\u22DB\uFE00', + 'gesles': '\u2A94', + 'gg': '\u226B', + 'ggg': '\u22D9', + 'gjcy': '\u0453', + 'gl': '\u2277', + 'glE': '\u2A92', + 'gla': '\u2AA5', + 'glj': '\u2AA4', + 'gnapprox': '\u2A8A', + 'gneq': '\u2A88', + 'gneqq': '\u2269', + 'grave': '\u0060', + 'gsim': '\u2273', + 'gsime': '\u2A8E', + 'gsiml': '\u2A90', + 'gtcc': '\u2AA7', + 'gtcir': '\u2A7A', + 'gtlPar': '\u2995', + 'gtquest': '\u2A7C', + 'gtrapprox': '\u2A86', + 'gtrarr': '\u2978', + 'gtrdot': '\u22D7', + 'gtreqless': '\u22DB', + 'gtreqqless': '\u2A8C', + 'gtrless': '\u2277', + 'gtrsim': '\u2273', + 'gvertneqq': '\u2269\uFE00', + 'gvnE': '\u2269\uFE00' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/g.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/h.js b/js/mathjax/jax/input/MathML/entities/h.js new file mode 100644 index 0000000..1a22014 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/h.js @@ -0,0 +1,54 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/h.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'HARDcy': '\u042A', + 'Hcirc': '\u0124', + 'HilbertSpace': '\u210B', + 'HorizontalLine': '\u2500', + 'Hstrok': '\u0126', + 'hArr': '\u21D4', + 'hairsp': '\u200A', + 'half': '\u00BD', + 'hamilt': '\u210B', + 'hardcy': '\u044A', + 'harr': '\u2194', + 'harrcir': '\u2948', + 'hcirc': '\u0125', + 'hearts': '\u2665', + 'heartsuit': '\u2665', + 'hercon': '\u22B9', + 'hksearow': '\u2925', + 'hkswarow': '\u2926', + 'hoarr': '\u21FF', + 'homtht': '\u223B', + 'horbar': '\u2015', + 'hslash': '\u210F', + 'hstrok': '\u0127', + 'hybull': '\u2043', + 'hyphen': '\u2010' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/h.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/i.js b/js/mathjax/jax/input/MathML/entities/i.js new file mode 100644 index 0000000..3ee68f4 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/i.js @@ -0,0 +1,88 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/i.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'IEcy': '\u0415', + 'IJlig': '\u0132', + 'IOcy': '\u0401', + 'Iacute': '\u00CD', + 'Icirc': '\u00CE', + 'Icy': '\u0418', + 'Idot': '\u0130', + 'Igrave': '\u00CC', + 'Imacr': '\u012A', + 'Implies': '\u21D2', + 'Int': '\u222C', + 'Iogon': '\u012E', + 'Iota': '\u0399', + 'Itilde': '\u0128', + 'Iukcy': '\u0406', + 'Iuml': '\u00CF', + 'iacute': '\u00ED', + 'ic': '\u2063', + 'icirc': '\u00EE', + 'icy': '\u0438', + 'iecy': '\u0435', + 'iexcl': '\u00A1', + 'iff': '\u21D4', + 'igrave': '\u00EC', + 'ii': '\u2148', + 'iiiint': '\u2A0C', + 'iiint': '\u222D', + 'iinfin': '\u29DC', + 'iiota': '\u2129', + 'ijlig': '\u0133', + 'imacr': '\u012B', + 'image': '\u2111', + 'imagline': '\u2110', + 'imagpart': '\u2111', + 'imof': '\u22B7', + 'imped': '\u01B5', + 'in': '\u2208', + 'incare': '\u2105', + 'infintie': '\u29DD', + 'inodot': '\u0131', + 'int': '\u222B', + 'integers': '\u2124', + 'intercal': '\u22BA', + 'intlarhk': '\u2A17', + 'intprod': '\u2A3C', + 'iocy': '\u0451', + 'iogon': '\u012F', + 'iprod': '\u2A3C', + 'iquest': '\u00BF', + 'isin': '\u2208', + 'isinE': '\u22F9', + 'isindot': '\u22F5', + 'isins': '\u22F4', + 'isinsv': '\u22F3', + 'isinv': '\u2208', + 'it': '\u2062', + 'itilde': '\u0129', + 'iukcy': '\u0456', + 'iuml': '\u00EF' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/i.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/j.js b/js/mathjax/jax/input/MathML/entities/j.js new file mode 100644 index 0000000..cea0ee9 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/j.js @@ -0,0 +1,37 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/j.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'Jcirc': '\u0134', + 'Jcy': '\u0419', + 'Jsercy': '\u0408', + 'Jukcy': '\u0404', + 'jcirc': '\u0135', + 'jcy': '\u0439', + 'jsercy': '\u0458', + 'jukcy': '\u0454' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/j.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/k.js b/js/mathjax/jax/input/MathML/entities/k.js new file mode 100644 index 0000000..2bb63b3 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/k.js @@ -0,0 +1,39 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/k.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'KHcy': '\u0425', + 'KJcy': '\u040C', + 'Kappa': '\u039A', + 'Kcedil': '\u0136', + 'Kcy': '\u041A', + 'kcedil': '\u0137', + 'kcy': '\u043A', + 'kgreen': '\u0138', + 'khcy': '\u0445', + 'kjcy': '\u045C' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/k.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/l.js b/js/mathjax/jax/input/MathML/entities/l.js new file mode 100644 index 0000000..9136ea5 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/l.js @@ -0,0 +1,181 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/l.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'LJcy': '\u0409', + 'LT': '\u003C', + 'Lacute': '\u0139', + 'Lang': '\u27EA', + 'Laplacetrf': '\u2112', + 'Lcaron': '\u013D', + 'Lcedil': '\u013B', + 'Lcy': '\u041B', + 'LeftArrowBar': '\u21E4', + 'LeftDoubleBracket': '\u27E6', + 'LeftDownTeeVector': '\u2961', + 'LeftDownVectorBar': '\u2959', + 'LeftRightVector': '\u294E', + 'LeftTeeArrow': '\u21A4', + 'LeftTeeVector': '\u295A', + 'LeftTriangleBar': '\u29CF', + 'LeftUpDownVector': '\u2951', + 'LeftUpTeeVector': '\u2960', + 'LeftUpVectorBar': '\u2958', + 'LeftVectorBar': '\u2952', + 'LessLess': '\u2AA1', + 'Lmidot': '\u013F', + 'LowerLeftArrow': '\u2199', + 'LowerRightArrow': '\u2198', + 'Lstrok': '\u0141', + 'Lt': '\u226A', + 'lAarr': '\u21DA', + 'lArr': '\u21D0', + 'lAtail': '\u291B', + 'lBarr': '\u290E', + 'lE': '\u2266', + 'lHar': '\u2962', + 'lacute': '\u013A', + 'laemptyv': '\u29B4', + 'lagran': '\u2112', + 'lang': '\u27E8', + 'langd': '\u2991', + 'langle': '\u27E8', + 'laquo': '\u00AB', + 'larr': '\u2190', + 'larrb': '\u21E4', + 'larrbfs': '\u291F', + 'larrfs': '\u291D', + 'larrhk': '\u21A9', + 'larrpl': '\u2939', + 'larrsim': '\u2973', + 'lat': '\u2AAB', + 'latail': '\u2919', + 'late': '\u2AAD', + 'lates': '\u2AAD\uFE00', + 'lbarr': '\u290C', + 'lbbrk': '\u2772', + 'lbrke': '\u298B', + 'lbrksld': '\u298F', + 'lbrkslu': '\u298D', + 'lcaron': '\u013E', + 'lcedil': '\u013C', + 'lceil': '\u2308', + 'lcub': '\u007B', + 'lcy': '\u043B', + 'ldca': '\u2936', + 'ldquo': '\u201C', + 'ldquor': '\u201E', + 'ldrdhar': '\u2967', + 'ldrushar': '\u294B', + 'ldsh': '\u21B2', + 'leftarrow': '\u2190', + 'leftarrowtail': '\u21A2', + 'leftharpoondown': '\u21BD', + 'leftharpoonup': '\u21BC', + 'leftrightarrow': '\u2194', + 'leftrightarrows': '\u21C6', + 'leftrightharpoons': '\u21CB', + 'leftrightsquigarrow': '\u21AD', + 'leg': '\u22DA', + 'leq': '\u2264', + 'leqq': '\u2266', + 'leqslant': '\u2A7D', + 'les': '\u2A7D', + 'lescc': '\u2AA8', + 'lesdot': '\u2A7F', + 'lesdoto': '\u2A81', + 'lesdotor': '\u2A83', + 'lesg': '\u22DA\uFE00', + 'lesges': '\u2A93', + 'lessapprox': '\u2A85', + 'lesseqgtr': '\u22DA', + 'lesseqqgtr': '\u2A8B', + 'lessgtr': '\u2276', + 'lesssim': '\u2272', + 'lfisht': '\u297C', + 'lfloor': '\u230A', + 'lg': '\u2276', + 'lgE': '\u2A91', + 'lhard': '\u21BD', + 'lharu': '\u21BC', + 'lharul': '\u296A', + 'lhblk': '\u2584', + 'ljcy': '\u0459', + 'll': '\u226A', + 'llarr': '\u21C7', + 'llcorner': '\u231E', + 'llhard': '\u296B', + 'lltri': '\u25FA', + 'lmidot': '\u0140', + 'lmoustache': '\u23B0', + 'lnapprox': '\u2A89', + 'lneq': '\u2A87', + 'lneqq': '\u2268', + 'loang': '\u27EC', + 'loarr': '\u21FD', + 'lobrk': '\u27E6', + 'longleftarrow': '\u27F5', + 'longleftrightarrow': '\u27F7', + 'longrightarrow': '\u27F6', + 'looparrowleft': '\u21AB', + 'lopar': '\u2985', + 'loplus': '\u2A2D', + 'lotimes': '\u2A34', + 'lowbar': '\u005F', + 'lozenge': '\u25CA', + 'lozf': '\u29EB', + 'lpar': '\u0028', + 'lparlt': '\u2993', + 'lrarr': '\u21C6', + 'lrcorner': '\u231F', + 'lrhar': '\u21CB', + 'lrhard': '\u296D', + 'lrm': '\u200E', + 'lrtri': '\u22BF', + 'lsaquo': '\u2039', + 'lsh': '\u21B0', + 'lsim': '\u2272', + 'lsime': '\u2A8D', + 'lsimg': '\u2A8F', + 'lsqb': '\u005B', + 'lsquo': '\u2018', + 'lsquor': '\u201A', + 'lstrok': '\u0142', + 'ltcc': '\u2AA6', + 'ltcir': '\u2A79', + 'ltdot': '\u22D6', + 'lthree': '\u22CB', + 'ltlarr': '\u2976', + 'ltquest': '\u2A7B', + 'ltrPar': '\u2996', + 'ltrie': '\u22B4', + 'ltrif': '\u25C2', + 'lurdshar': '\u294A', + 'luruhar': '\u2966', + 'lvertneqq': '\u2268\uFE00', + 'lvnE': '\u2268\uFE00' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/l.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/m.js b/js/mathjax/jax/input/MathML/entities/m.js new file mode 100644 index 0000000..823a6a2 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/m.js @@ -0,0 +1,63 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/m.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'Map': '\u2905', + 'Mcy': '\u041C', + 'MediumSpace': '\u205F', + 'Mellintrf': '\u2133', + 'Mu': '\u039C', + 'mDDot': '\u223A', + 'male': '\u2642', + 'maltese': '\u2720', + 'map': '\u21A6', + 'mapsto': '\u21A6', + 'mapstodown': '\u21A7', + 'mapstoleft': '\u21A4', + 'mapstoup': '\u21A5', + 'marker': '\u25AE', + 'mcomma': '\u2A29', + 'mcy': '\u043C', + 'mdash': '\u2014', + 'measuredangle': '\u2221', + 'micro': '\u00B5', + 'mid': '\u2223', + 'midast': '\u002A', + 'midcir': '\u2AF0', + 'middot': '\u00B7', + 'minus': '\u2212', + 'minusb': '\u229F', + 'minusd': '\u2238', + 'minusdu': '\u2A2A', + 'mlcp': '\u2ADB', + 'mldr': '\u2026', + 'mnplus': '\u2213', + 'models': '\u22A7', + 'mp': '\u2213', + 'mstpos': '\u223E', + 'mumap': '\u22B8' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/m.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/n.js b/js/mathjax/jax/input/MathML/entities/n.js new file mode 100644 index 0000000..491daf5 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/n.js @@ -0,0 +1,222 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/n.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'NJcy': '\u040A', + 'Nacute': '\u0143', + 'Ncaron': '\u0147', + 'Ncedil': '\u0145', + 'Ncy': '\u041D', + 'NegativeMediumSpace': '\u200B', + 'NegativeThickSpace': '\u200B', + 'NegativeThinSpace': '\u200B', + 'NegativeVeryThinSpace': '\u200B', + 'NewLine': '\u000A', + 'NoBreak': '\u2060', + 'NonBreakingSpace': '\u00A0', + 'Not': '\u2AEC', + 'NotCongruent': '\u2262', + 'NotCupCap': '\u226D', + 'NotEqualTilde': '\u2242\u0338', + 'NotGreaterFullEqual': '\u2267\u0338', + 'NotGreaterGreater': '\u226B\u0338', + 'NotGreaterLess': '\u2279', + 'NotGreaterSlantEqual': '\u2A7E\u0338', + 'NotGreaterTilde': '\u2275', + 'NotHumpDownHump': '\u224E\u0338', + 'NotHumpEqual': '\u224F\u0338', + 'NotLeftTriangleBar': '\u29CF\u0338', + 'NotLessGreater': '\u2278', + 'NotLessLess': '\u226A\u0338', + 'NotLessSlantEqual': '\u2A7D\u0338', + 'NotLessTilde': '\u2274', + 'NotNestedGreaterGreater': '\u2AA2\u0338', + 'NotNestedLessLess': '\u2AA1\u0338', + 'NotPrecedesEqual': '\u2AAF\u0338', + 'NotReverseElement': '\u220C', + 'NotRightTriangleBar': '\u29D0\u0338', + 'NotSquareSubset': '\u228F\u0338', + 'NotSquareSubsetEqual': '\u22E2', + 'NotSquareSuperset': '\u2290\u0338', + 'NotSquareSupersetEqual': '\u22E3', + 'NotSubset': '\u2282\u20D2', + 'NotSucceedsEqual': '\u2AB0\u0338', + 'NotSucceedsTilde': '\u227F\u0338', + 'NotSuperset': '\u2283\u20D2', + 'NotTildeEqual': '\u2244', + 'NotTildeFullEqual': '\u2247', + 'NotTildeTilde': '\u2249', + 'Ntilde': '\u00D1', + 'Nu': '\u039D', + 'nGg': '\u22D9\u0338', + 'nGt': '\u226B\u20D2', + 'nGtv': '\u226B\u0338', + 'nLl': '\u22D8\u0338', + 'nLt': '\u226A\u20D2', + 'nLtv': '\u226A\u0338', + 'nabla': '\u2207', + 'nacute': '\u0144', + 'nang': '\u2220\u20D2', + 'nap': '\u2249', + 'napE': '\u2A70\u0338', + 'napid': '\u224B\u0338', + 'napos': '\u0149', + 'napprox': '\u2249', + 'natural': '\u266E', + 'naturals': '\u2115', + 'nbsp': '\u00A0', + 'nbump': '\u224E\u0338', + 'nbumpe': '\u224F\u0338', + 'ncap': '\u2A43', + 'ncaron': '\u0148', + 'ncedil': '\u0146', + 'ncong': '\u2247', + 'ncongdot': '\u2A6D\u0338', + 'ncup': '\u2A42', + 'ncy': '\u043D', + 'ndash': '\u2013', + 'ne': '\u2260', + 'neArr': '\u21D7', + 'nearhk': '\u2924', + 'nearrow': '\u2197', + 'nedot': '\u2250\u0338', + 'nequiv': '\u2262', + 'nesear': '\u2928', + 'nesim': '\u2242\u0338', + 'nexist': '\u2204', + 'nexists': '\u2204', + 'ngE': '\u2267\u0338', + 'nge': '\u2271', + 'ngeq': '\u2271', + 'ngeqq': '\u2267\u0338', + 'ngeqslant': '\u2A7E\u0338', + 'nges': '\u2A7E\u0338', + 'ngsim': '\u2275', + 'ngt': '\u226F', + 'ngtr': '\u226F', + 'nhArr': '\u21CE', + 'nhpar': '\u2AF2', + 'ni': '\u220B', + 'nis': '\u22FC', + 'nisd': '\u22FA', + 'niv': '\u220B', + 'njcy': '\u045A', + 'nlArr': '\u21CD', + 'nlE': '\u2266\u0338', + 'nldr': '\u2025', + 'nle': '\u2270', + 'nleftarrow': '\u219A', + 'nleftrightarrow': '\u21AE', + 'nleq': '\u2270', + 'nleqq': '\u2266\u0338', + 'nleqslant': '\u2A7D\u0338', + 'nles': '\u2A7D\u0338', + 'nless': '\u226E', + 'nlsim': '\u2274', + 'nlt': '\u226E', + 'nltri': '\u22EA', + 'nltrie': '\u22EC', + 'nmid': '\u2224', + 'notin': '\u2209', + 'notinE': '\u22F9\u0338', + 'notindot': '\u22F5\u0338', + 'notinva': '\u2209', + 'notinvb': '\u22F7', + 'notinvc': '\u22F6', + 'notni': '\u220C', + 'notniva': '\u220C', + 'notnivb': '\u22FE', + 'notnivc': '\u22FD', + 'npar': '\u2226', + 'nparallel': '\u2226', + 'nparsl': '\u2AFD\u20E5', + 'npart': '\u2202\u0338', + 'npolint': '\u2A14', + 'npr': '\u2280', + 'nprcue': '\u22E0', + 'npre': '\u2AAF\u0338', + 'nprec': '\u2280', + 'npreceq': '\u2AAF\u0338', + 'nrArr': '\u21CF', + 'nrarrc': '\u2933\u0338', + 'nrarrw': '\u219D\u0338', + 'nrightarrow': '\u219B', + 'nrtri': '\u22EB', + 'nrtrie': '\u22ED', + 'nsc': '\u2281', + 'nsccue': '\u22E1', + 'nsce': '\u2AB0\u0338', + 'nshortmid': '\u2224', + 'nshortparallel': '\u2226', + 'nsim': '\u2241', + 'nsime': '\u2244', + 'nsimeq': '\u2244', + 'nsmid': '\u2224', + 'nspar': '\u2226', + 'nsqsube': '\u22E2', + 'nsqsupe': '\u22E3', + 'nsub': '\u2284', + 'nsubE': '\u2AC5\u0338', + 'nsube': '\u2288', + 'nsubset': '\u2282\u20D2', + 'nsubseteq': '\u2288', + 'nsubseteqq': '\u2AC5\u0338', + 'nsucc': '\u2281', + 'nsucceq': '\u2AB0\u0338', + 'nsup': '\u2285', + 'nsupE': '\u2AC6\u0338', + 'nsupe': '\u2289', + 'nsupset': '\u2283\u20D2', + 'nsupseteq': '\u2289', + 'nsupseteqq': '\u2AC6\u0338', + 'ntgl': '\u2279', + 'ntilde': '\u00F1', + 'ntlg': '\u2278', + 'ntriangleleft': '\u22EA', + 'ntrianglelefteq': '\u22EC', + 'ntriangleright': '\u22EB', + 'ntrianglerighteq': '\u22ED', + 'num': '\u0023', + 'numero': '\u2116', + 'numsp': '\u2007', + 'nvHarr': '\u2904', + 'nvap': '\u224D\u20D2', + 'nvge': '\u2265\u20D2', + 'nvgt': '\u003E\u20D2', + 'nvinfin': '\u29DE', + 'nvlArr': '\u2902', + 'nvle': '\u2264\u20D2', + 'nvlt': '\u003C\u20D2', + 'nvltrie': '\u22B4\u20D2', + 'nvrArr': '\u2903', + 'nvrtrie': '\u22B5\u20D2', + 'nvsim': '\u223C\u20D2', + 'nwArr': '\u21D6', + 'nwarhk': '\u2923', + 'nwarrow': '\u2196', + 'nwnear': '\u2927' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/n.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/o.js b/js/mathjax/jax/input/MathML/entities/o.js new file mode 100644 index 0000000..5017e8e --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/o.js @@ -0,0 +1,92 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/o.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'OElig': '\u0152', + 'Oacute': '\u00D3', + 'Ocirc': '\u00D4', + 'Ocy': '\u041E', + 'Odblac': '\u0150', + 'Ograve': '\u00D2', + 'Omacr': '\u014C', + 'Omicron': '\u039F', + 'OpenCurlyDoubleQuote': '\u201C', + 'OpenCurlyQuote': '\u2018', + 'Or': '\u2A54', + 'Oslash': '\u00D8', + 'Otilde': '\u00D5', + 'Otimes': '\u2A37', + 'Ouml': '\u00D6', + 'OverBracket': '\u23B4', + 'OverParenthesis': '\u23DC', + 'oS': '\u24C8', + 'oacute': '\u00F3', + 'oast': '\u229B', + 'ocir': '\u229A', + 'ocirc': '\u00F4', + 'ocy': '\u043E', + 'odash': '\u229D', + 'odblac': '\u0151', + 'odiv': '\u2A38', + 'odot': '\u2299', + 'odsold': '\u29BC', + 'oelig': '\u0153', + 'ofcir': '\u29BF', + 'ogon': '\u02DB', + 'ograve': '\u00F2', + 'ogt': '\u29C1', + 'ohbar': '\u29B5', + 'ohm': '\u03A9', + 'oint': '\u222E', + 'olarr': '\u21BA', + 'olcir': '\u29BE', + 'olcross': '\u29BB', + 'oline': '\u203E', + 'olt': '\u29C0', + 'omacr': '\u014D', + 'omid': '\u29B6', + 'ominus': '\u2296', + 'opar': '\u29B7', + 'operp': '\u29B9', + 'oplus': '\u2295', + 'orarr': '\u21BB', + 'ord': '\u2A5D', + 'order': '\u2134', + 'orderof': '\u2134', + 'ordf': '\u00AA', + 'ordm': '\u00BA', + 'origof': '\u22B6', + 'oror': '\u2A56', + 'orslope': '\u2A57', + 'orv': '\u2A5B', + 'oslash': '\u00F8', + 'otilde': '\u00F5', + 'otimes': '\u2297', + 'otimesas': '\u2A36', + 'ouml': '\u00F6', + 'ovbar': '\u233D' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/o.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/opf.js b/js/mathjax/jax/input/MathML/entities/opf.js new file mode 100644 index 0000000..8085482 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/opf.js @@ -0,0 +1,81 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/opf.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'Aopf': '\uD835\uDD38', + 'Bopf': '\uD835\uDD39', + 'Copf': '\u2102', + 'Dopf': '\uD835\uDD3B', + 'Eopf': '\uD835\uDD3C', + 'Fopf': '\uD835\uDD3D', + 'Gopf': '\uD835\uDD3E', + 'Hopf': '\u210D', + 'Iopf': '\uD835\uDD40', + 'Jopf': '\uD835\uDD41', + 'Kopf': '\uD835\uDD42', + 'Lopf': '\uD835\uDD43', + 'Mopf': '\uD835\uDD44', + 'Nopf': '\u2115', + 'Oopf': '\uD835\uDD46', + 'Popf': '\u2119', + 'Qopf': '\u211A', + 'Ropf': '\u211D', + 'Sopf': '\uD835\uDD4A', + 'Topf': '\uD835\uDD4B', + 'Uopf': '\uD835\uDD4C', + 'Vopf': '\uD835\uDD4D', + 'Wopf': '\uD835\uDD4E', + 'Xopf': '\uD835\uDD4F', + 'Yopf': '\uD835\uDD50', + 'Zopf': '\u2124', + 'aopf': '\uD835\uDD52', + 'bopf': '\uD835\uDD53', + 'copf': '\uD835\uDD54', + 'dopf': '\uD835\uDD55', + 'eopf': '\uD835\uDD56', + 'fopf': '\uD835\uDD57', + 'gopf': '\uD835\uDD58', + 'hopf': '\uD835\uDD59', + 'iopf': '\uD835\uDD5A', + 'jopf': '\uD835\uDD5B', + 'kopf': '\uD835\uDD5C', + 'lopf': '\uD835\uDD5D', + 'mopf': '\uD835\uDD5E', + 'nopf': '\uD835\uDD5F', + 'oopf': '\uD835\uDD60', + 'popf': '\uD835\uDD61', + 'qopf': '\uD835\uDD62', + 'ropf': '\uD835\uDD63', + 'sopf': '\uD835\uDD64', + 'topf': '\uD835\uDD65', + 'uopf': '\uD835\uDD66', + 'vopf': '\uD835\uDD67', + 'wopf': '\uD835\uDD68', + 'xopf': '\uD835\uDD69', + 'yopf': '\uD835\uDD6A', + 'zopf': '\uD835\uDD6B' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/opf.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/p.js b/js/mathjax/jax/input/MathML/entities/p.js new file mode 100644 index 0000000..41870fe --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/p.js @@ -0,0 +1,86 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/p.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'Pcy': '\u041F', + 'Poincareplane': '\u210C', + 'Pr': '\u2ABB', + 'Prime': '\u2033', + 'Proportion': '\u2237', + 'par': '\u2225', + 'para': '\u00B6', + 'parallel': '\u2225', + 'parsim': '\u2AF3', + 'parsl': '\u2AFD', + 'part': '\u2202', + 'pcy': '\u043F', + 'percnt': '\u0025', + 'permil': '\u2030', + 'perp': '\u22A5', + 'pertenk': '\u2031', + 'phmmat': '\u2133', + 'phone': '\u260E', + 'pitchfork': '\u22D4', + 'planck': '\u210F', + 'planckh': '\u210E', + 'plankv': '\u210F', + 'plus': '\u002B', + 'plusacir': '\u2A23', + 'plusb': '\u229E', + 'pluscir': '\u2A22', + 'plusdo': '\u2214', + 'plusdu': '\u2A25', + 'pluse': '\u2A72', + 'plusmn': '\u00B1', + 'plussim': '\u2A26', + 'plustwo': '\u2A27', + 'pm': '\u00B1', + 'pointint': '\u2A15', + 'pound': '\u00A3', + 'pr': '\u227A', + 'prE': '\u2AB3', + 'prcue': '\u227C', + 'pre': '\u2AAF', + 'prec': '\u227A', + 'precapprox': '\u2AB7', + 'preccurlyeq': '\u227C', + 'preceq': '\u2AAF', + 'precsim': '\u227E', + 'primes': '\u2119', + 'prnE': '\u2AB5', + 'prnap': '\u2AB9', + 'prnsim': '\u22E8', + 'prod': '\u220F', + 'profalar': '\u232E', + 'profline': '\u2312', + 'profsurf': '\u2313', + 'prop': '\u221D', + 'propto': '\u221D', + 'prsim': '\u227E', + 'prurel': '\u22B0', + 'puncsp': '\u2008' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/p.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/q.js b/js/mathjax/jax/input/MathML/entities/q.js new file mode 100644 index 0000000..c900aa4 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/q.js @@ -0,0 +1,37 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/q.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'QUOT': '\u0022', + 'qint': '\u2A0C', + 'qprime': '\u2057', + 'quaternions': '\u210D', + 'quatint': '\u2A16', + 'quest': '\u003F', + 'questeq': '\u225F', + 'quot': '\u0022' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/q.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/r.js b/js/mathjax/jax/input/MathML/entities/r.js new file mode 100644 index 0000000..92129bf --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/r.js @@ -0,0 +1,140 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/r.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'RBarr': '\u2910', + 'REG': '\u00AE', + 'Racute': '\u0154', + 'Rang': '\u27EB', + 'Rarrtl': '\u2916', + 'Rcaron': '\u0158', + 'Rcedil': '\u0156', + 'Rcy': '\u0420', + 'ReverseElement': '\u220B', + 'ReverseUpEquilibrium': '\u296F', + 'Rho': '\u03A1', + 'RightArrowBar': '\u21E5', + 'RightDoubleBracket': '\u27E7', + 'RightDownTeeVector': '\u295D', + 'RightDownVectorBar': '\u2955', + 'RightTeeVector': '\u295B', + 'RightTriangleBar': '\u29D0', + 'RightUpDownVector': '\u294F', + 'RightUpTeeVector': '\u295C', + 'RightUpVectorBar': '\u2954', + 'RightVectorBar': '\u2953', + 'RoundImplies': '\u2970', + 'RuleDelayed': '\u29F4', + 'rAarr': '\u21DB', + 'rArr': '\u21D2', + 'rAtail': '\u291C', + 'rBarr': '\u290F', + 'rHar': '\u2964', + 'race': '\u223D\u0331', + 'racute': '\u0155', + 'radic': '\u221A', + 'raemptyv': '\u29B3', + 'rang': '\u27E9', + 'rangd': '\u2992', + 'range': '\u29A5', + 'rangle': '\u27E9', + 'raquo': '\u00BB', + 'rarr': '\u2192', + 'rarrap': '\u2975', + 'rarrb': '\u21E5', + 'rarrbfs': '\u2920', + 'rarrc': '\u2933', + 'rarrfs': '\u291E', + 'rarrhk': '\u21AA', + 'rarrlp': '\u21AC', + 'rarrpl': '\u2945', + 'rarrsim': '\u2974', + 'rarrw': '\u219D', + 'ratail': '\u291A', + 'ratio': '\u2236', + 'rationals': '\u211A', + 'rbarr': '\u290D', + 'rbbrk': '\u2773', + 'rbrke': '\u298C', + 'rbrksld': '\u298E', + 'rbrkslu': '\u2990', + 'rcaron': '\u0159', + 'rcedil': '\u0157', + 'rceil': '\u2309', + 'rcub': '\u007D', + 'rcy': '\u0440', + 'rdca': '\u2937', + 'rdldhar': '\u2969', + 'rdquo': '\u201D', + 'rdquor': '\u201D', + 'rdsh': '\u21B3', + 'real': '\u211C', + 'realine': '\u211B', + 'realpart': '\u211C', + 'reals': '\u211D', + 'rect': '\u25AD', + 'reg': '\u00AE', + 'rfisht': '\u297D', + 'rfloor': '\u230B', + 'rhard': '\u21C1', + 'rharu': '\u21C0', + 'rharul': '\u296C', + 'rightarrow': '\u2192', + 'rightarrowtail': '\u21A3', + 'rightharpoondown': '\u21C1', + 'rightharpoonup': '\u21C0', + 'rightleftarrows': '\u21C4', + 'rightleftharpoons': '\u21CC', + 'rightsquigarrow': '\u219D', + 'risingdotseq': '\u2253', + 'rlarr': '\u21C4', + 'rlhar': '\u21CC', + 'rlm': '\u200F', + 'rmoustache': '\u23B1', + 'rnmid': '\u2AEE', + 'roang': '\u27ED', + 'roarr': '\u21FE', + 'robrk': '\u27E7', + 'ropar': '\u2986', + 'roplus': '\u2A2E', + 'rotimes': '\u2A35', + 'rpar': '\u0029', + 'rpargt': '\u2994', + 'rppolint': '\u2A12', + 'rrarr': '\u21C9', + 'rsaquo': '\u203A', + 'rsh': '\u21B1', + 'rsqb': '\u005D', + 'rsquo': '\u2019', + 'rsquor': '\u2019', + 'rthree': '\u22CC', + 'rtrie': '\u22B5', + 'rtrif': '\u25B8', + 'rtriltri': '\u29CE', + 'ruluhar': '\u2968', + 'rx': '\u211E' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/r.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/s.js b/js/mathjax/jax/input/MathML/entities/s.js new file mode 100644 index 0000000..181d853 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/s.js @@ -0,0 +1,172 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/s.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'SHCHcy': '\u0429', + 'SHcy': '\u0428', + 'SOFTcy': '\u042C', + 'Sacute': '\u015A', + 'Sc': '\u2ABC', + 'Scaron': '\u0160', + 'Scedil': '\u015E', + 'Scirc': '\u015C', + 'Scy': '\u0421', + 'ShortDownArrow': '\u2193', + 'ShortLeftArrow': '\u2190', + 'ShortRightArrow': '\u2192', + 'ShortUpArrow': '\u2191', + 'Sub': '\u22D0', + 'Sup': '\u22D1', + 'sacute': '\u015B', + 'sbquo': '\u201A', + 'sc': '\u227B', + 'scE': '\u2AB4', + 'scaron': '\u0161', + 'sccue': '\u227D', + 'sce': '\u2AB0', + 'scedil': '\u015F', + 'scirc': '\u015D', + 'scpolint': '\u2A13', + 'scsim': '\u227F', + 'scy': '\u0441', + 'sdotb': '\u22A1', + 'sdote': '\u2A66', + 'seArr': '\u21D8', + 'searhk': '\u2925', + 'searrow': '\u2198', + 'semi': '\u003B', + 'seswar': '\u2929', + 'setminus': '\u2216', + 'setmn': '\u2216', + 'sext': '\u2736', + 'sfrown': '\u2322', + 'shchcy': '\u0449', + 'shcy': '\u0448', + 'shortmid': '\u2223', + 'shortparallel': '\u2225', + 'shy': '\u00AD', + 'sigmaf': '\u03C2', + 'sim': '\u223C', + 'simdot': '\u2A6A', + 'sime': '\u2243', + 'simeq': '\u2243', + 'simg': '\u2A9E', + 'simgE': '\u2AA0', + 'siml': '\u2A9D', + 'simlE': '\u2A9F', + 'simplus': '\u2A24', + 'simrarr': '\u2972', + 'slarr': '\u2190', + 'smallsetminus': '\u2216', + 'smashp': '\u2A33', + 'smeparsl': '\u29E4', + 'smid': '\u2223', + 'smt': '\u2AAA', + 'smte': '\u2AAC', + 'smtes': '\u2AAC\uFE00', + 'softcy': '\u044C', + 'sol': '\u002F', + 'solb': '\u29C4', + 'solbar': '\u233F', + 'spadesuit': '\u2660', + 'spar': '\u2225', + 'sqcap': '\u2293', + 'sqcaps': '\u2293\uFE00', + 'sqcup': '\u2294', + 'sqcups': '\u2294\uFE00', + 'sqsub': '\u228F', + 'sqsube': '\u2291', + 'sqsubset': '\u228F', + 'sqsubseteq': '\u2291', + 'sqsup': '\u2290', + 'sqsupe': '\u2292', + 'sqsupset': '\u2290', + 'sqsupseteq': '\u2292', + 'squ': '\u25A1', + 'square': '\u25A1', + 'squarf': '\u25AA', + 'squf': '\u25AA', + 'srarr': '\u2192', + 'ssetmn': '\u2216', + 'ssmile': '\u2323', + 'sstarf': '\u22C6', + 'star': '\u2606', + 'starf': '\u2605', + 'straightepsilon': '\u03F5', + 'straightphi': '\u03D5', + 'strns': '\u00AF', + 'subdot': '\u2ABD', + 'sube': '\u2286', + 'subedot': '\u2AC3', + 'submult': '\u2AC1', + 'subplus': '\u2ABF', + 'subrarr': '\u2979', + 'subset': '\u2282', + 'subseteq': '\u2286', + 'subseteqq': '\u2AC5', + 'subsetneq': '\u228A', + 'subsetneqq': '\u2ACB', + 'subsim': '\u2AC7', + 'subsub': '\u2AD5', + 'subsup': '\u2AD3', + 'succ': '\u227B', + 'succapprox': '\u2AB8', + 'succcurlyeq': '\u227D', + 'succeq': '\u2AB0', + 'succnapprox': '\u2ABA', + 'succneqq': '\u2AB6', + 'succnsim': '\u22E9', + 'succsim': '\u227F', + 'sum': '\u2211', + 'sung': '\u266A', + 'sup': '\u2283', + 'sup1': '\u00B9', + 'sup2': '\u00B2', + 'sup3': '\u00B3', + 'supdot': '\u2ABE', + 'supdsub': '\u2AD8', + 'supe': '\u2287', + 'supedot': '\u2AC4', + 'suphsol': '\u27C9', + 'suphsub': '\u2AD7', + 'suplarr': '\u297B', + 'supmult': '\u2AC2', + 'supplus': '\u2AC0', + 'supset': '\u2283', + 'supseteq': '\u2287', + 'supseteqq': '\u2AC6', + 'supsetneq': '\u228B', + 'supsetneqq': '\u2ACC', + 'supsim': '\u2AC8', + 'supsub': '\u2AD4', + 'supsup': '\u2AD6', + 'swArr': '\u21D9', + 'swarhk': '\u2926', + 'swarrow': '\u2199', + 'swnwar': '\u292A', + 'szlig': '\u00DF' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/s.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/scr.js b/js/mathjax/jax/input/MathML/entities/scr.js new file mode 100644 index 0000000..c94df31 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/scr.js @@ -0,0 +1,81 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/scr.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'Ascr': '\uD835\uDC9C', + 'Bscr': '\u212C', + 'Cscr': '\uD835\uDC9E', + 'Dscr': '\uD835\uDC9F', + 'Escr': '\u2130', + 'Fscr': '\u2131', + 'Gscr': '\uD835\uDCA2', + 'Hscr': '\u210B', + 'Iscr': '\u2110', + 'Jscr': '\uD835\uDCA5', + 'Kscr': '\uD835\uDCA6', + 'Lscr': '\u2112', + 'Mscr': '\u2133', + 'Nscr': '\uD835\uDCA9', + 'Oscr': '\uD835\uDCAA', + 'Pscr': '\uD835\uDCAB', + 'Qscr': '\uD835\uDCAC', + 'Rscr': '\u211B', + 'Sscr': '\uD835\uDCAE', + 'Tscr': '\uD835\uDCAF', + 'Uscr': '\uD835\uDCB0', + 'Vscr': '\uD835\uDCB1', + 'Wscr': '\uD835\uDCB2', + 'Xscr': '\uD835\uDCB3', + 'Yscr': '\uD835\uDCB4', + 'Zscr': '\uD835\uDCB5', + 'ascr': '\uD835\uDCB6', + 'bscr': '\uD835\uDCB7', + 'cscr': '\uD835\uDCB8', + 'dscr': '\uD835\uDCB9', + 'escr': '\u212F', + 'fscr': '\uD835\uDCBB', + 'gscr': '\u210A', + 'hscr': '\uD835\uDCBD', + 'iscr': '\uD835\uDCBE', + 'jscr': '\uD835\uDCBF', + 'kscr': '\uD835\uDCC0', + 'lscr': '\uD835\uDCC1', + 'mscr': '\uD835\uDCC2', + 'nscr': '\uD835\uDCC3', + 'oscr': '\u2134', + 'pscr': '\uD835\uDCC5', + 'qscr': '\uD835\uDCC6', + 'rscr': '\uD835\uDCC7', + 'sscr': '\uD835\uDCC8', + 'tscr': '\uD835\uDCC9', + 'uscr': '\uD835\uDCCA', + 'vscr': '\uD835\uDCCB', + 'wscr': '\uD835\uDCCC', + 'xscr': '\uD835\uDCCD', + 'yscr': '\uD835\uDCCE', + 'zscr': '\uD835\uDCCF' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/scr.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/t.js b/js/mathjax/jax/input/MathML/entities/t.js new file mode 100644 index 0000000..b70d29c --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/t.js @@ -0,0 +1,88 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/t.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'THORN': '\u00DE', + 'TRADE': '\u2122', + 'TSHcy': '\u040B', + 'TScy': '\u0426', + 'Tab': '\u0009', + 'Tau': '\u03A4', + 'Tcaron': '\u0164', + 'Tcedil': '\u0162', + 'Tcy': '\u0422', + 'ThickSpace': '\u205F\u200A', + 'ThinSpace': '\u2009', + 'TripleDot': '\u20DB', + 'Tstrok': '\u0166', + 'target': '\u2316', + 'tbrk': '\u23B4', + 'tcaron': '\u0165', + 'tcedil': '\u0163', + 'tcy': '\u0442', + 'tdot': '\u20DB', + 'telrec': '\u2315', + 'there4': '\u2234', + 'therefore': '\u2234', + 'thetasym': '\u03D1', + 'thickapprox': '\u2248', + 'thicksim': '\u223C', + 'thinsp': '\u2009', + 'thkap': '\u2248', + 'thksim': '\u223C', + 'thorn': '\u00FE', + 'timesb': '\u22A0', + 'timesbar': '\u2A31', + 'timesd': '\u2A30', + 'tint': '\u222D', + 'toea': '\u2928', + 'top': '\u22A4', + 'topbot': '\u2336', + 'topcir': '\u2AF1', + 'topfork': '\u2ADA', + 'tosa': '\u2929', + 'tprime': '\u2034', + 'trade': '\u2122', + 'triangledown': '\u25BF', + 'triangleleft': '\u25C3', + 'trianglelefteq': '\u22B4', + 'triangleright': '\u25B9', + 'trianglerighteq': '\u22B5', + 'tridot': '\u25EC', + 'trie': '\u225C', + 'triminus': '\u2A3A', + 'triplus': '\u2A39', + 'trisb': '\u29CD', + 'tritime': '\u2A3B', + 'trpezium': '\u23E2', + 'tscy': '\u0446', + 'tshcy': '\u045B', + 'tstrok': '\u0167', + 'twixt': '\u226C', + 'twoheadleftarrow': '\u219E', + 'twoheadrightarrow': '\u21A0' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/t.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/u.js b/js/mathjax/jax/input/MathML/entities/u.js new file mode 100644 index 0000000..cf22bdc --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/u.js @@ -0,0 +1,94 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/u.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'Uacute': '\u00DA', + 'Uarr': '\u219F', + 'Uarrocir': '\u2949', + 'Ubrcy': '\u040E', + 'Ubreve': '\u016C', + 'Ucirc': '\u00DB', + 'Ucy': '\u0423', + 'Udblac': '\u0170', + 'Ugrave': '\u00D9', + 'Umacr': '\u016A', + 'UnderBracket': '\u23B5', + 'UnderParenthesis': '\u23DD', + 'Uogon': '\u0172', + 'UpArrowBar': '\u2912', + 'UpArrowDownArrow': '\u21C5', + 'UpEquilibrium': '\u296E', + 'UpTeeArrow': '\u21A5', + 'UpperLeftArrow': '\u2196', + 'UpperRightArrow': '\u2197', + 'Upsi': '\u03D2', + 'Uring': '\u016E', + 'Utilde': '\u0168', + 'Uuml': '\u00DC', + 'uArr': '\u21D1', + 'uHar': '\u2963', + 'uacute': '\u00FA', + 'uarr': '\u2191', + 'ubrcy': '\u045E', + 'ubreve': '\u016D', + 'ucirc': '\u00FB', + 'ucy': '\u0443', + 'udarr': '\u21C5', + 'udblac': '\u0171', + 'udhar': '\u296E', + 'ufisht': '\u297E', + 'ugrave': '\u00F9', + 'uharl': '\u21BF', + 'uharr': '\u21BE', + 'uhblk': '\u2580', + 'ulcorn': '\u231C', + 'ulcorner': '\u231C', + 'ulcrop': '\u230F', + 'ultri': '\u25F8', + 'umacr': '\u016B', + 'uml': '\u00A8', + 'uogon': '\u0173', + 'uparrow': '\u2191', + 'updownarrow': '\u2195', + 'upharpoonleft': '\u21BF', + 'upharpoonright': '\u21BE', + 'uplus': '\u228E', + 'upsih': '\u03D2', + 'upsilon': '\u03C5', + 'urcorn': '\u231D', + 'urcorner': '\u231D', + 'urcrop': '\u230E', + 'uring': '\u016F', + 'urtri': '\u25F9', + 'utdot': '\u22F0', + 'utilde': '\u0169', + 'utri': '\u25B5', + 'utrif': '\u25B4', + 'uuarr': '\u21C8', + 'uuml': '\u00FC', + 'uwangle': '\u29A7' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/u.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/v.js b/js/mathjax/jax/input/MathML/entities/v.js new file mode 100644 index 0000000..e944c95 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/v.js @@ -0,0 +1,75 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/v.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'VDash': '\u22AB', + 'Vbar': '\u2AEB', + 'Vcy': '\u0412', + 'Vdashl': '\u2AE6', + 'Verbar': '\u2016', + 'Vert': '\u2016', + 'VerticalLine': '\u007C', + 'VerticalSeparator': '\u2758', + 'VeryThinSpace': '\u200A', + 'vArr': '\u21D5', + 'vBar': '\u2AE8', + 'vBarv': '\u2AE9', + 'vDash': '\u22A8', + 'vangrt': '\u299C', + 'varepsilon': '\u03F5', + 'varkappa': '\u03F0', + 'varnothing': '\u2205', + 'varphi': '\u03D5', + 'varpi': '\u03D6', + 'varpropto': '\u221D', + 'varr': '\u2195', + 'varrho': '\u03F1', + 'varsigma': '\u03C2', + 'varsubsetneq': '\u228A\uFE00', + 'varsubsetneqq': '\u2ACB\uFE00', + 'varsupsetneq': '\u228B\uFE00', + 'varsupsetneqq': '\u2ACC\uFE00', + 'vartheta': '\u03D1', + 'vartriangleleft': '\u22B2', + 'vartriangleright': '\u22B3', + 'vcy': '\u0432', + 'vdash': '\u22A2', + 'vee': '\u2228', + 'veeeq': '\u225A', + 'verbar': '\u007C', + 'vert': '\u007C', + 'vltri': '\u22B2', + 'vnsub': '\u2282\u20D2', + 'vnsup': '\u2283\u20D2', + 'vprop': '\u221D', + 'vrtri': '\u22B3', + 'vsubnE': '\u2ACB\uFE00', + 'vsubne': '\u228A\uFE00', + 'vsupnE': '\u2ACC\uFE00', + 'vsupne': '\u228B\uFE00', + 'vzigzag': '\u299A' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/v.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/w.js b/js/mathjax/jax/input/MathML/entities/w.js new file mode 100644 index 0000000..2f2f9f9 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/w.js @@ -0,0 +1,37 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/w.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'Wcirc': '\u0174', + 'wcirc': '\u0175', + 'wedbar': '\u2A5F', + 'wedge': '\u2227', + 'wedgeq': '\u2259', + 'wp': '\u2118', + 'wr': '\u2240', + 'wreath': '\u2240' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/w.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/x.js b/js/mathjax/jax/input/MathML/entities/x.js new file mode 100644 index 0000000..7b23395 --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/x.js @@ -0,0 +1,49 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/x.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'xcap': '\u22C2', + 'xcirc': '\u25EF', + 'xcup': '\u22C3', + 'xdtri': '\u25BD', + 'xhArr': '\u27FA', + 'xharr': '\u27F7', + 'xlArr': '\u27F8', + 'xlarr': '\u27F5', + 'xmap': '\u27FC', + 'xnis': '\u22FB', + 'xodot': '\u2A00', + 'xoplus': '\u2A01', + 'xotime': '\u2A02', + 'xrArr': '\u27F9', + 'xrarr': '\u27F6', + 'xsqcup': '\u2A06', + 'xuplus': '\u2A04', + 'xutri': '\u25B3', + 'xvee': '\u22C1', + 'xwedge': '\u22C0' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/x.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/y.js b/js/mathjax/jax/input/MathML/entities/y.js new file mode 100644 index 0000000..bcaebab --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/y.js @@ -0,0 +1,43 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/y.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'YAcy': '\u042F', + 'YIcy': '\u0407', + 'YUcy': '\u042E', + 'Yacute': '\u00DD', + 'Ycirc': '\u0176', + 'Ycy': '\u042B', + 'Yuml': '\u0178', + 'yacute': '\u00FD', + 'yacy': '\u044F', + 'ycirc': '\u0177', + 'ycy': '\u044B', + 'yicy': '\u0457', + 'yucy': '\u044E', + 'yuml': '\u00FF' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/y.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/entities/z.js b/js/mathjax/jax/input/MathML/entities/z.js new file mode 100644 index 0000000..2883e8d --- /dev/null +++ b/js/mathjax/jax/input/MathML/entities/z.js @@ -0,0 +1,44 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/entities/z.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MATHML) { + MathJax.Hub.Insert(MATHML.Parse.Entity,{ + 'ZHcy': '\u0416', + 'Zacute': '\u0179', + 'Zcaron': '\u017D', + 'Zcy': '\u0417', + 'Zdot': '\u017B', + 'ZeroWidthSpace': '\u200B', + 'Zeta': '\u0396', + 'zacute': '\u017A', + 'zcaron': '\u017E', + 'zcy': '\u0437', + 'zdot': '\u017C', + 'zeetrf': '\u2128', + 'zhcy': '\u0436', + 'zwj': '\u200D', + 'zwnj': '\u200C' + }); + + MathJax.Ajax.loadComplete(MATHML.entityDir+"/z.js"); + +})(MathJax.InputJax.MathML); +// @license-end diff --git a/js/mathjax/jax/input/MathML/jax.js b/js/mathjax/jax/input/MathML/jax.js new file mode 100644 index 0000000..cc4081b --- /dev/null +++ b/js/mathjax/jax/input/MathML/jax.js @@ -0,0 +1,783 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/input/MathML/jax.js + * + * Implements the MathML InputJax that reads mathematics in + * MathML format and converts it to the MML ElementJax + * internal format. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (MATHML,BROWSER) { + var MML; + + var _ = function (id) { + return MathJax.Localization._.apply(MathJax.Localization, + [["MathML",id]].concat([].slice.call(arguments,1))) + }; + + MATHML.Parse = MathJax.Object.Subclass({ + + Init: function (string,script) {this.Parse(string,script)}, + + // + // Parse the MathML and check for errors + // + Parse: function (math,script) { + var doc; + if (typeof math !== "string") {doc = math.parentNode} else { + doc = MATHML.ParseXML(this.preProcessMath.call(this,math)); + if (doc == null) {MATHML.Error(["ErrorParsingMathML","Error parsing MathML"])} + } + var err = doc.getElementsByTagName("parsererror")[0]; + if (err) MATHML.Error(["ParsingError","Error parsing MathML: %1", + err.textContent.replace(/This page.*?errors:|XML Parsing Error: |Below is a rendering of the page.*/g,"")]); + if (doc.childNodes.length !== 1) + {MATHML.Error(["MathMLSingleElement","MathML must be formed by a single element"])} + if (doc.firstChild.nodeName.toLowerCase() === "html") { + var h1 = doc.getElementsByTagName("h1")[0]; + if (h1 && h1.textContent === "XML parsing error" && h1.nextSibling) + MATHML.Error(["ParsingError","Error parsing MathML: %1", + String(h1.nextSibling.nodeValue).replace(/fatal parsing error: /,"")]); + } + if (doc.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"") !== "math") { + MATHML.Error(["MathMLRootElement", + "MathML must be formed by a <math> element, not %1", + "<"+doc.firstChild.nodeName+">"]); + } + var data = {math:doc.firstChild, script:script}; + MATHML.DOMfilterHooks.Execute(data); + this.mml = this.MakeMML(data.math); + }, + + // + // Convert the MathML structure to the MathJax Element jax structure + // + MakeMML: function (node) { + var CLASS = String(node.getAttribute("class")||""); // make sure CLASS is a string + var mml, type = node.nodeName.toLowerCase().replace(/^[a-z]+:/,""); + var match = (CLASS.match(/(^| )MJX-TeXAtom-([^ ]*)/)); + if (match) { + mml = this.TeXAtom(match[2],match[2] === "OP" && !CLASS.match(/MJX-fixedlimits/)); + } else if (!(MML[type] && MML[type].isa && MML[type].isa(MML.mbase))) { + MathJax.Hub.signal.Post(["MathML Jax - unknown node type",type]); + return MML.Error(_("UnknownNodeType","Unknown node type: %1",type)); + } else { + mml = MML[type](); + } + this.AddAttributes(mml,node); this.CheckClass(mml,mml["class"]); + this.AddChildren(mml,node); + if (MATHML.config.useMathMLspacing) {mml.useMMLspacing = 0x08} + return mml; + }, + TeXAtom: function (mclass,movablelimits) { + var mml = MML.TeXAtom().With({texClass:MML.TEXCLASS[mclass]}); + if (movablelimits) {mml.movesupsub = mml.movablelimits = true} + return mml; + }, + CheckClass: function (mml,CLASS) { + CLASS = (CLASS||"").split(/ /); var NCLASS = []; + for (var i = 0, m = CLASS.length; i < m; i++) { + if (CLASS[i].substr(0,4) === "MJX-") { + if (CLASS[i] === "MJX-arrow") { + // This class was used in former versions of MathJax to attach an + // arrow to the updiagonalstrike notation. For backward + // compatibility, let's continue to accept this case. See issue 481. + if (!mml.notation.match("/"+MML.NOTATION.UPDIAGONALARROW+"/")) + mml.notation += " "+MML.NOTATION.UPDIAGONALARROW; + } else if (CLASS[i] === "MJX-variant") { + mml.variantForm = true; + // + // Variant forms come from AMSsymbols, and it sets up the + // character mappings, so load that if needed. + // + if (!MathJax.Extension["TeX/AMSsymbols"]) + {MathJax.Hub.RestartAfter(MathJax.Ajax.Require("[MathJax]/extensions/TeX/AMSsymbols.js"))} + } else if (CLASS[i].substr(0,11) !== "MJX-TeXAtom") { + mml.mathvariant = CLASS[i].substr(3); + // + // Caligraphic and oldstyle bold are set up in the boldsymbol + // extension, so load it if it isn't already loaded. + // + if (mml.mathvariant === "-tex-caligraphic-bold" || + mml.mathvariant === "-tex-oldstyle-bold") { + if (!MathJax.Extension["TeX/boldsymbol"]) + {MathJax.Hub.RestartAfter(MathJax.Ajax.Require("[MathJax]/extensions/TeX/boldsymbol.js"))} + } + } + } else {NCLASS.push(CLASS[i])} + } + if (NCLASS.length) {mml["class"] = NCLASS.join(" ")} else {delete mml["class"]} + }, + + // + // Add the attributes to the mml node + // + AddAttributes: function (mml,node) { + mml.attr = {}; mml.attrNames = []; + for (var i = 0, m = node.attributes.length; i < m; i++) { + var name = node.attributes[i].name; + if (name == "xlink:href") {name = "href"} + if (name.match(/:/)) continue; + if (name.match(/^_moz-math-((column|row)(align|line)|font-style)$/)) continue; + var value = node.attributes[i].value; + value = this.filterAttribute(name,value); + var defaults = (mml.type === "mstyle" ? MML.math.prototype.defaults : mml.defaults); + if (value != null) { + var val = value.toLowerCase(); + if (val === "true" || val === "false") { + if (typeof (defaults[name]) === "boolean" || defaults[name] === MML.INHERIT || + mml.type === "math" || mml.type === "mstyle" || + (defaults[name] === MML.AUTO && + (mml.defaultDef == null || typeof(mml.defaultDef[name]) === "boolean"))) { + value = (val === "true"); + } + } + if (defaults[name] != null || MML.copyAttributes[name]) + {mml[name] = value} else {mml.attr[name] = value} + mml.attrNames.push(name); + } + } + }, + filterAttribute: function (name,value) {return value}, // safe mode overrides this + + // + // Create the children for the mml node + // + AddChildren: function (mml,node) { + for (var i = 0, m = node.childNodes.length; i < m; i++) { + var child = node.childNodes[i]; + if (child.nodeName === "#comment") continue; + if (child.nodeName === "#text") { + if ((mml.isToken || mml.isChars) && !mml.mmlSelfClosing) { + var text = child.nodeValue; + if (mml.isToken) { + text = text.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); + text = this.trimSpace(text); + } + mml.Append(MML.chars(text)); + } else if (child.nodeValue.match(/\S/)) { + MATHML.Error(["UnexpectedTextNode", + "Unexpected text node: %1","'"+child.nodeValue+"'"]); + } + } else if (mml.type === "annotation-xml") { + mml.Append(MML.xml(child)); + } else { + var cmml = this.MakeMML(child); mml.Append(cmml); + if (cmml.mmlSelfClosing && cmml.data.length) + {mml.Append.apply(mml,cmml.data); cmml.data = []} + } + } + if (mml.type === "mrow" && mml.data.length >= 2) { + var first = mml.data[0], last = mml.data[mml.data.length-1]; + if (first.type === "mo" && first.Get("fence") && + last.type === "mo" && last.Get("fence")) { + if (first.data[0]) {mml.open = first.data.join("")} + if (last.data[0]) {mml.close = last.data.join("")} + } + } + }, + + // + // Clean Up the <math> source to prepare for XML parsing + // + preProcessMath: function (math) { + if (math.match(/^<[a-z]+:/i) && !math.match(/^<[^<>]* xmlns:/)) { + math = math.replace(/^<([a-z]+)(:math)/i,'<$1$2 xmlns:$1="http://www.w3.org/1998/Math/MathML"') + } + // HTML5 removes xmlns: namespaces, so put them back for XML + var match = math.match(/^(<math( ('.*?'|".*?"|[^>])+)>)/i); + if (match && match[2].match(/ (?!xmlns=)[a-z]+=\"http:/i)) { + math = match[1].replace(/ (?!xmlns=)([a-z]+=(['"])http:.*?\2)/ig," xmlns:$1 $1") + + math.substr(match[0].length); + } + if (math.match(/^<math[ >]/i) && !math.match(/^<[^<>]* xmlns=/)) { + // append the MathML namespace + math = math.replace(/^<(math)/i,'<math xmlns="http://www.w3.org/1998/Math/MathML"') + } + math = math.replace(/^\s*(?:\/\/)?<!(--)?\[CDATA\[((.|\n)*)(\/\/)?\]\]\1>\s*$/,"$2"); + return math.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); + }, + + // + // Remove attribute whitespace + // + trimSpace: function (string) { + return string.replace(/[\t\n\r]/g," ") // whitespace to spaces + .replace(/^ +/,"") // initial whitespace + .replace(/ +$/,"") // trailing whitespace + .replace(/ +/g," "); // internal multiple whitespace + }, + + // + // Replace a named entity by its value + // (look up from external files if necessary) + // + replaceEntity: function (match,entity) { + if (entity.match(/^(lt|amp|quot)$/)) {return match} // these mess up attribute parsing + if (MATHML.Parse.Entity[entity]) {return MATHML.Parse.Entity[entity]} + var file = entity.charAt(0).toLowerCase(); + var font = entity.match(/^[a-zA-Z](fr|scr|opf)$/); + if (font) {file = font[1]} + if (!MATHML.Parse.loaded[file]) { + MATHML.Parse.loaded[file] = true; + MathJax.Hub.RestartAfter(MathJax.Ajax.Require(MATHML.entityDir+"/"+file+".js")); + } + return match; + } + }, { + loaded: [] // the entity files that are loaded + }); + + /************************************************************************/ + + MATHML.Augment({ + sourceMenuTitle: /*_(MathMenu)*/ ["OriginalMathML","Original MathML"], + + prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run on MathML string before processing MathML + DOMfilterHooks: MathJax.Callback.Hooks(true), // hooks to run on MathML DOM before processing + postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run on internal jax format after processing MathML + + Translate: function (script) { + if (!this.ParseXML) {this.ParseXML = this.createParser()} + var mml, math, data = {script:script}; + if (script.firstChild && + script.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"") === "math") { + data.math = script.firstChild; + } else { + math = MathJax.HTML.getScript(script); + if (BROWSER.isMSIE) {math = math.replace(/( )+$/,"")} + data.math = math; + } + var callback = this.prefilterHooks.Execute(data); if (callback) return callback; + math = data.math; + try { + mml = MATHML.Parse(math,script).mml; + } catch(err) { + if (!err.mathmlError) {throw err} + mml = this.formatError(err,math,script); + } + data.math = MML(mml); + return this.postfilterHooks.Execute(data) || data.math; + }, + prefilterMath: function (math,script) {return math}, + prefilterMathML: function (math,script) {return math}, + formatError: function (err,math,script) { + var message = err.message.replace(/\n.*/,""); + MathJax.Hub.signal.Post(["MathML Jax - parse error",message,math,script]); + return MML.Error(message); + }, + Error: function (message) { + // + // Translate message if it is ["id","message",args] + // + if (MathJax.Object.isArray(message)) {message = _.apply(_,message)} + throw MathJax.Hub.Insert(Error(message),{mathmlError: true}); + }, + // + // Parsers for various forms (DOMParser, Windows ActiveX object, other) + // + parseDOM: function (string) {return this.parser.parseFromString(string,"text/xml")}, + parseMS: function (string) {return (this.parser.loadXML(string) ? this.parser : null)}, + parseDIV: function (string) { + this.div.innerHTML = + "<div>"+string.replace(/<([a-z]+)([^>]*)\/>/g,"<$1$2></$1>")+"</div>"; + var doc = this.div.firstChild; + this.div.innerHTML = ""; + return doc; + }, + parseError: function (string) {return null}, + createMSParser: function() { + var parser = null; + var xml = ["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.5.0", + "MSXML2.DOMDocument.4.0","MSXML2.DOMDocument.3.0", + "MSXML2.DOMDocument.2.0","Microsoft.XMLDOM"]; + for (var i = 0, m = xml.length; i < m && !parser; i++) { + try { + parser = new ActiveXObject(xml[i]) + } catch (err) {} + } + return parser; + }, + // + // Create the parser using a DOMParser, or other fallback method + // + createParser: function () { + if (window.DOMParser) { + this.parser = new DOMParser(); + return(this.parseDOM); + } else if (window.ActiveXObject) { + this.parser = this.createMSParser(); + if (!this.parser) { + MathJax.Localization.Try(this.parserCreationError); + return(this.parseError); + } + this.parser.async = false; + return(this.parseMS); + } + this.div = MathJax.Hub.Insert(document.createElement("div"),{ + style:{visibility:"hidden", overflow:"hidden", height:"1px", + position:"absolute", top:0} + }); + if (!document.body.firstChild) {document.body.appendChild(this.div)} + else {document.body.insertBefore(this.div,document.body.firstChild)} + return(this.parseDIV); + }, + parserCreationError: function () { + alert(_("CantCreateXMLParser", + "MathJax can't create an XML parser for MathML. Check that\n"+ + "the 'Script ActiveX controls marked safe for scripting' security\n"+ + "setting is enabled (use the Internet Options item in the Tools\n"+ + "menu, and select the Security panel, then press the Custom Level\n"+ + "button to check this).\n\n"+ + "MathML equations will not be able to be processed by MathJax.")); + }, + // + // Initialize the parser object (whichever type is used) + // + Startup: function () { + MML = MathJax.ElementJax.mml; + MML.mspace.Augment({mmlSelfClosing: true}); + MML.none.Augment({mmlSelfClosing: true}); + MML.mprescripts.Augment({mmlSelfClosing:true}); + MML.maligngroup.Augment({mmlSelfClosing:true}); + MML.malignmark.Augment({mmlSelfClosing:true}); + } + }); + + // + // Add the default pre-filter (for backward compatibility) + // + MATHML.prefilterHooks.Add(function (data) { + data.math = (typeof(data.math) === "string" ? + MATHML.prefilterMath(data.math,data.script) : + MATHML.prefilterMathML(data.math,data.script)); + }); + + MATHML.Parse.Entity = { + ApplyFunction: '\u2061', + Backslash: '\u2216', + Because: '\u2235', + Breve: '\u02D8', + Cap: '\u22D2', + CenterDot: '\u00B7', + CircleDot: '\u2299', + CircleMinus: '\u2296', + CirclePlus: '\u2295', + CircleTimes: '\u2297', + Congruent: '\u2261', + ContourIntegral: '\u222E', + Coproduct: '\u2210', + Cross: '\u2A2F', + Cup: '\u22D3', + CupCap: '\u224D', + Dagger: '\u2021', + Del: '\u2207', + Delta: '\u0394', + Diamond: '\u22C4', + DifferentialD: '\u2146', + DotEqual: '\u2250', + DoubleDot: '\u00A8', + DoubleRightTee: '\u22A8', + DoubleVerticalBar: '\u2225', + DownArrow: '\u2193', + DownLeftVector: '\u21BD', + DownRightVector: '\u21C1', + DownTee: '\u22A4', + Downarrow: '\u21D3', + Element: '\u2208', + EqualTilde: '\u2242', + Equilibrium: '\u21CC', + Exists: '\u2203', + ExponentialE: '\u2147', + FilledVerySmallSquare: '\u25AA', + ForAll: '\u2200', + Gamma: '\u0393', + Gg: '\u22D9', + GreaterEqual: '\u2265', + GreaterEqualLess: '\u22DB', + GreaterFullEqual: '\u2267', + GreaterLess: '\u2277', + GreaterSlantEqual: '\u2A7E', + GreaterTilde: '\u2273', + Hacek: '\u02C7', + Hat: '\u005E', + HumpDownHump: '\u224E', + HumpEqual: '\u224F', + Im: '\u2111', + ImaginaryI: '\u2148', + Integral: '\u222B', + Intersection: '\u22C2', + InvisibleComma: '\u2063', + InvisibleTimes: '\u2062', + Lambda: '\u039B', + Larr: '\u219E', + LeftAngleBracket: '\u27E8', + LeftArrow: '\u2190', + LeftArrowRightArrow: '\u21C6', + LeftCeiling: '\u2308', + LeftDownVector: '\u21C3', + LeftFloor: '\u230A', + LeftRightArrow: '\u2194', + LeftTee: '\u22A3', + LeftTriangle: '\u22B2', + LeftTriangleEqual: '\u22B4', + LeftUpVector: '\u21BF', + LeftVector: '\u21BC', + Leftarrow: '\u21D0', + Leftrightarrow: '\u21D4', + LessEqualGreater: '\u22DA', + LessFullEqual: '\u2266', + LessGreater: '\u2276', + LessSlantEqual: '\u2A7D', + LessTilde: '\u2272', + Ll: '\u22D8', + Lleftarrow: '\u21DA', + LongLeftArrow: '\u27F5', + LongLeftRightArrow: '\u27F7', + LongRightArrow: '\u27F6', + Longleftarrow: '\u27F8', + Longleftrightarrow: '\u27FA', + Longrightarrow: '\u27F9', + Lsh: '\u21B0', + MinusPlus: '\u2213', + NestedGreaterGreater: '\u226B', + NestedLessLess: '\u226A', + NotDoubleVerticalBar: '\u2226', + NotElement: '\u2209', + NotEqual: '\u2260', + NotExists: '\u2204', + NotGreater: '\u226F', + NotGreaterEqual: '\u2271', + NotLeftTriangle: '\u22EA', + NotLeftTriangleEqual: '\u22EC', + NotLess: '\u226E', + NotLessEqual: '\u2270', + NotPrecedes: '\u2280', + NotPrecedesSlantEqual: '\u22E0', + NotRightTriangle: '\u22EB', + NotRightTriangleEqual: '\u22ED', + NotSubsetEqual: '\u2288', + NotSucceeds: '\u2281', + NotSucceedsSlantEqual: '\u22E1', + NotSupersetEqual: '\u2289', + NotTilde: '\u2241', + NotVerticalBar: '\u2224', + Omega: '\u03A9', + OverBar: '\u203E', + OverBrace: '\u23DE', + PartialD: '\u2202', + Phi: '\u03A6', + Pi: '\u03A0', + PlusMinus: '\u00B1', + Precedes: '\u227A', + PrecedesEqual: '\u2AAF', + PrecedesSlantEqual: '\u227C', + PrecedesTilde: '\u227E', + Product: '\u220F', + Proportional: '\u221D', + Psi: '\u03A8', + Rarr: '\u21A0', + Re: '\u211C', + ReverseEquilibrium: '\u21CB', + RightAngleBracket: '\u27E9', + RightArrow: '\u2192', + RightArrowLeftArrow: '\u21C4', + RightCeiling: '\u2309', + RightDownVector: '\u21C2', + RightFloor: '\u230B', + RightTee: '\u22A2', + RightTeeArrow: '\u21A6', + RightTriangle: '\u22B3', + RightTriangleEqual: '\u22B5', + RightUpVector: '\u21BE', + RightVector: '\u21C0', + Rightarrow: '\u21D2', + Rrightarrow: '\u21DB', + Rsh: '\u21B1', + Sigma: '\u03A3', + SmallCircle: '\u2218', + Sqrt: '\u221A', + Square: '\u25A1', + SquareIntersection: '\u2293', + SquareSubset: '\u228F', + SquareSubsetEqual: '\u2291', + SquareSuperset: '\u2290', + SquareSupersetEqual: '\u2292', + SquareUnion: '\u2294', + Star: '\u22C6', + Subset: '\u22D0', + SubsetEqual: '\u2286', + Succeeds: '\u227B', + SucceedsEqual: '\u2AB0', + SucceedsSlantEqual: '\u227D', + SucceedsTilde: '\u227F', + SuchThat: '\u220B', + Sum: '\u2211', + Superset: '\u2283', + SupersetEqual: '\u2287', + Supset: '\u22D1', + Therefore: '\u2234', + Theta: '\u0398', + Tilde: '\u223C', + TildeEqual: '\u2243', + TildeFullEqual: '\u2245', + TildeTilde: '\u2248', + UnderBar: '\u005F', + UnderBrace: '\u23DF', + Union: '\u22C3', + UnionPlus: '\u228E', + UpArrow: '\u2191', + UpDownArrow: '\u2195', + UpTee: '\u22A5', + Uparrow: '\u21D1', + Updownarrow: '\u21D5', + Upsilon: '\u03A5', + Vdash: '\u22A9', + Vee: '\u22C1', + VerticalBar: '\u2223', + VerticalTilde: '\u2240', + Vvdash: '\u22AA', + Wedge: '\u22C0', + Xi: '\u039E', + acute: '\u00B4', + aleph: '\u2135', + alpha: '\u03B1', + amalg: '\u2A3F', + and: '\u2227', + ang: '\u2220', + angmsd: '\u2221', + angsph: '\u2222', + ape: '\u224A', + backprime: '\u2035', + backsim: '\u223D', + backsimeq: '\u22CD', + beta: '\u03B2', + beth: '\u2136', + between: '\u226C', + bigcirc: '\u25EF', + bigodot: '\u2A00', + bigoplus: '\u2A01', + bigotimes: '\u2A02', + bigsqcup: '\u2A06', + bigstar: '\u2605', + bigtriangledown: '\u25BD', + bigtriangleup: '\u25B3', + biguplus: '\u2A04', + blacklozenge: '\u29EB', + blacktriangle: '\u25B4', + blacktriangledown: '\u25BE', + blacktriangleleft: '\u25C2', + bowtie: '\u22C8', + boxdl: '\u2510', + boxdr: '\u250C', + boxminus: '\u229F', + boxplus: '\u229E', + boxtimes: '\u22A0', + boxul: '\u2518', + boxur: '\u2514', + bsol: '\u005C', + bull: '\u2022', + cap: '\u2229', + check: '\u2713', + chi: '\u03C7', + circ: '\u02C6', + circeq: '\u2257', + circlearrowleft: '\u21BA', + circlearrowright: '\u21BB', + circledR: '\u00AE', + circledS: '\u24C8', + circledast: '\u229B', + circledcirc: '\u229A', + circleddash: '\u229D', + clubs: '\u2663', + colon: '\u003A', + comp: '\u2201', + ctdot: '\u22EF', + cuepr: '\u22DE', + cuesc: '\u22DF', + cularr: '\u21B6', + cup: '\u222A', + curarr: '\u21B7', + curlyvee: '\u22CE', + curlywedge: '\u22CF', + dagger: '\u2020', + daleth: '\u2138', + ddarr: '\u21CA', + deg: '\u00B0', + delta: '\u03B4', + digamma: '\u03DD', + div: '\u00F7', + divideontimes: '\u22C7', + dot: '\u02D9', + doteqdot: '\u2251', + dotplus: '\u2214', + dotsquare: '\u22A1', + dtdot: '\u22F1', + ecir: '\u2256', + efDot: '\u2252', + egs: '\u2A96', + ell: '\u2113', + els: '\u2A95', + empty: '\u2205', + epsi: '\u03B5', + epsiv: '\u03F5', + erDot: '\u2253', + eta: '\u03B7', + eth: '\u00F0', + flat: '\u266D', + fork: '\u22D4', + frown: '\u2322', + gEl: '\u2A8C', + gamma: '\u03B3', + gap: '\u2A86', + gimel: '\u2137', + gnE: '\u2269', + gnap: '\u2A8A', + gne: '\u2A88', + gnsim: '\u22E7', + gt: '\u003E', + gtdot: '\u22D7', + harrw: '\u21AD', + hbar: '\u210F', + hellip: '\u2026', + hookleftarrow: '\u21A9', + hookrightarrow: '\u21AA', + imath: '\u0131', + infin: '\u221E', + intcal: '\u22BA', + iota: '\u03B9', + jmath: '\u0237', + kappa: '\u03BA', + kappav: '\u03F0', + lEg: '\u2A8B', + lambda: '\u03BB', + lap: '\u2A85', + larrlp: '\u21AB', + larrtl: '\u21A2', + lbrace: '\u007B', + lbrack: '\u005B', + le: '\u2264', + leftleftarrows: '\u21C7', + leftthreetimes: '\u22CB', + lessdot: '\u22D6', + lmoust: '\u23B0', + lnE: '\u2268', + lnap: '\u2A89', + lne: '\u2A87', + lnsim: '\u22E6', + longmapsto: '\u27FC', + looparrowright: '\u21AC', + lowast: '\u2217', + loz: '\u25CA', + lt: '\u003C', + ltimes: '\u22C9', + ltri: '\u25C3', + macr: '\u00AF', + malt: '\u2720', + mho: '\u2127', + mu: '\u03BC', + multimap: '\u22B8', + nLeftarrow: '\u21CD', + nLeftrightarrow: '\u21CE', + nRightarrow: '\u21CF', + nVDash: '\u22AF', + nVdash: '\u22AE', + natur: '\u266E', + nearr: '\u2197', + nharr: '\u21AE', + nlarr: '\u219A', + not: '\u00AC', + nrarr: '\u219B', + nu: '\u03BD', + nvDash: '\u22AD', + nvdash: '\u22AC', + nwarr: '\u2196', + omega: '\u03C9', + omicron: '\u03BF', + or: '\u2228', + osol: '\u2298', + period: '\u002E', + phi: '\u03C6', + phiv: '\u03D5', + pi: '\u03C0', + piv: '\u03D6', + prap: '\u2AB7', + precnapprox: '\u2AB9', + precneqq: '\u2AB5', + precnsim: '\u22E8', + prime: '\u2032', + psi: '\u03C8', + rarrtl: '\u21A3', + rbrace: '\u007D', + rbrack: '\u005D', + rho: '\u03C1', + rhov: '\u03F1', + rightrightarrows: '\u21C9', + rightthreetimes: '\u22CC', + ring: '\u02DA', + rmoust: '\u23B1', + rtimes: '\u22CA', + rtri: '\u25B9', + scap: '\u2AB8', + scnE: '\u2AB6', + scnap: '\u2ABA', + scnsim: '\u22E9', + sdot: '\u22C5', + searr: '\u2198', + sect: '\u00A7', + sharp: '\u266F', + sigma: '\u03C3', + sigmav: '\u03C2', + simne: '\u2246', + smile: '\u2323', + spades: '\u2660', + sub: '\u2282', + subE: '\u2AC5', + subnE: '\u2ACB', + subne: '\u228A', + supE: '\u2AC6', + supnE: '\u2ACC', + supne: '\u228B', + swarr: '\u2199', + tau: '\u03C4', + theta: '\u03B8', + thetav: '\u03D1', + tilde: '\u02DC', + times: '\u00D7', + triangle: '\u25B5', + triangleq: '\u225C', + upsi: '\u03C5', + upuparrows: '\u21C8', + veebar: '\u22BB', + vellip: '\u22EE', + weierp: '\u2118', + xi: '\u03BE', + yen: '\u00A5', + zeta: '\u03B6', + zigrarr: '\u21DD' + }; + + MATHML.loadComplete("jax.js"); + +})(MathJax.InputJax.MathML,MathJax.Hub.Browser); +// @license-end diff --git a/js/mathjax/jax/input/TeX/config.js b/js/mathjax/jax/input/TeX/config.js new file mode 100644 index 0000000..76e751f --- /dev/null +++ b/js/mathjax/jax/input/TeX/config.js @@ -0,0 +1,56 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/input/TeX/config.js + * + * Initializes the TeX InputJax (the main definition is in + * MathJax/jax/input/TeX/jax.js, which is loaded when needed). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.InputJax.TeX = MathJax.InputJax({ + id: "TeX", + version: "2.7.9", + directory: MathJax.InputJax.directory + "/TeX", + extensionDir: MathJax.InputJax.extensionDir + "/TeX", + + config: { + TagSide: "right", + TagIndent: "0.8em", + MultLineWidth: "85%", + + equationNumbers: { + autoNumber: "none", // "AMS" for standard AMS numbering, + // or "all" for all displayed equations + formatNumber: function (n) {return n}, + formatTag: function (n) {return '('+n+')'}, + formatID: function (n) {return 'mjx-eqn-'+String(n).replace(/\s/g,"_")}, + formatURL: function (id,base) {return base+'#'+encodeURIComponent(id)}, + useLabelIds: true + } + }, + + resetEquationNumbers: function () {} // filled in by AMSmath extension +}); +MathJax.InputJax.TeX.Register("math/tex"); + +MathJax.InputJax.TeX.loadComplete("config.js"); +// @license-end diff --git a/js/mathjax/jax/input/TeX/jax.js b/js/mathjax/jax/input/TeX/jax.js new file mode 100644 index 0000000..9c36d31 --- /dev/null +++ b/js/mathjax/jax/input/TeX/jax.js @@ -0,0 +1,2373 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/input/TeX/jax.js + * + * Implements the TeX InputJax that reads mathematics in + * TeX and LaTeX format and converts it to the MML ElementJax + * internal format. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (TEX,HUB,AJAX) { + var MML, NBSP = "\u00A0"; + + var _ = function (id) { + return MathJax.Localization._.apply(MathJax.Localization, + [["TeX", id]].concat([].slice.call(arguments,1))); + }; + + var isArray = MathJax.Object.isArray; + + var STACK = MathJax.Object.Subclass({ + Init: function (env,inner) { + this.global = {isInner: inner}; + this.data = [STACKITEM.start(this.global)]; + if (env) {this.data[0].env = env} + this.env = this.data[0].env; + }, + Push: function () { + var i, m, item, top; + for (i = 0, m = arguments.length; i < m; i++) { + item = arguments[i]; if (!item) continue; + if (item instanceof MML.mbase) {item = STACKITEM.mml(item)} + item.global = this.global; + top = (this.data.length ? this.Top().checkItem(item) : true); + if (top instanceof Array) {this.Pop(); this.Push.apply(this,top)} + else if (top instanceof STACKITEM) {this.Pop(); this.Push(top)} + else if (top) { + this.data.push(item); + if (item.env) { + if (item.copyEnv !== false) { + for (var id in this.env) + {if (this.env.hasOwnProperty(id)) {item.env[id] = this.env[id]}} + } + this.env = item.env; + } else {item.env = this.env} + } + } + }, + Pop: function () { + var item = this.data.pop(); if (!item.isOpen) {delete item.env} + this.env = (this.data.length ? this.Top().env : {}); + return item; + }, + Top: function (n) { + if (n == null) {n = 1} + if (this.data.length < n) {return null} + return this.data[this.data.length-n]; + }, + Prev: function (noPop) { + var top = this.Top(); + if (noPop) {return top.data[top.data.length-1]} + else {return top.Pop()} + }, + toString: function () {return "stack[\n "+this.data.join("\n ")+"\n]"} + }); + + var STACKITEM = STACK.Item = MathJax.Object.Subclass({ + type: "base", + endError: /*_()*/ ["ExtraOpenMissingClose","Extra open brace or missing close brace"], + closeError: /*_()*/ ["ExtraCloseMissingOpen","Extra close brace or missing open brace"], + rightError: /*_()*/ ["MissingLeftExtraRight","Missing \\left or extra \\right"], + Init: function () { + if (this.isOpen) {this.env = {}} + this.data = []; + this.Push.apply(this,arguments); + }, + Push: function () {this.data.push.apply(this.data,arguments)}, + Pop: function () {return this.data.pop()}, + mmlData: function (inferred,forceRow) { + if (inferred == null) {inferred = true} + if (this.data.length === 1 && !forceRow) {return this.data[0]} + return MML.mrow.apply(MML,this.data).With((inferred ? {inferred: true}: {})); + }, + checkItem: function (item) { + if (item.type === "over" && this.isOpen) {item.num = this.mmlData(false); this.data = []} + if (item.type === "cell" && this.isOpen) { + if (item.linebreak) {return false} + TEX.Error(["Misplaced","Misplaced %1",item.name]); + } + if (item.isClose && this[item.type+"Error"]) {TEX.Error(this[item.type+"Error"])} + if (!item.isNotStack) {return true} + this.Push(item.data[0]); return false; + }, + With: function (def) { + for (var id in def) {if (def.hasOwnProperty(id)) {this[id] = def[id]}} + return this; + }, + toString: function () {return this.type+"["+this.data.join("; ")+"]"} + }); + + STACKITEM.start = STACKITEM.Subclass({ + type: "start", isOpen: true, + Init: function (global) { + this.SUPER(arguments).Init.call(this); + this.global = global; + }, + checkItem: function (item) { + if (item.type === "stop") {return STACKITEM.mml(this.mmlData())} + return this.SUPER(arguments).checkItem.call(this,item); + } + }); + + STACKITEM.stop = STACKITEM.Subclass({ + type: "stop", isClose: true + }); + + STACKITEM.open = STACKITEM.Subclass({ + type: "open", isOpen: true, + stopError: /*_()*/ ["ExtraOpenMissingClose","Extra open brace or missing close brace"], + checkItem: function (item) { + if (item.type === "close") { + var mml = this.mmlData(); + return STACKITEM.mml(MML.TeXAtom(mml)); // TeXAtom make it an ORD to prevent spacing (FIXME: should be another way) + } + return this.SUPER(arguments).checkItem.call(this,item); + } + }); + + STACKITEM.close = STACKITEM.Subclass({ + type: "close", isClose: true + }); + + STACKITEM.prime = STACKITEM.Subclass({ + type: "prime", + checkItem: function (item) { + if (this.data[0].type !== "msubsup") + {return [MML.msup(this.data[0],this.data[1]),item]} + this.data[0].SetData(this.data[0].sup,this.data[1]); + return [this.data[0],item]; + } + }); + + STACKITEM.subsup = STACKITEM.Subclass({ + type: "subsup", + stopError: /*_()*/ ["MissingScript","Missing superscript or subscript argument"], + supError: /*_()*/ ["MissingOpenForSup","Missing open brace for superscript"], + subError: /*_()*/ ["MissingOpenForSub","Missing open brace for subscript"], + checkItem: function (item) { + if (item.type === "open" || item.type === "left") {return true} + if (item.type === "mml") { + if (this.primes) { + if (this.position !== 2) {this.data[0].SetData(2,this.primes)} + else {item.data[0] = MML.mrow(this.primes.With({variantForm:true}),item.data[0])} + } + this.data[0].SetData(this.position,item.data[0]); + if (this.movesupsub != null) {this.data[0].movesupsub = this.movesupsub} + return STACKITEM.mml(this.data[0]); + } + if (this.SUPER(arguments).checkItem.call(this,item)) + {TEX.Error(this[["","subError","supError"][this.position]])} + }, + Pop: function () {} + }); + + STACKITEM.over = STACKITEM.Subclass({ + type: "over", isClose: true, name: "\\over", + checkItem: function (item,stack) { + if (item.type === "over") + {TEX.Error(["AmbiguousUseOf","Ambiguous use of %1",item.name])} + if (item.isClose) { + var mml = MML.mfrac(this.num,this.mmlData(false)); + if (this.thickness != null) {mml.linethickness = this.thickness} + if (this.open || this.close) { + mml.texWithDelims = true; + mml = TEX.fixedFence(this.open,mml,this.close); + } + return [STACKITEM.mml(mml), item]; + } + return this.SUPER(arguments).checkItem.call(this,item); + }, + toString: function () {return "over["+this.num+" / "+this.data.join("; ")+"]"} + }); + + STACKITEM.left = STACKITEM.Subclass({ + type: "left", isOpen: true, delim: '(', + stopError: /*_()*/ ["ExtraLeftMissingRight", "Extra \\left or missing \\right"], + checkItem: function (item) { + if (item.type === "right") + {return STACKITEM.mml(TEX.fenced(this.delim,this.mmlData(),item.delim))} + return this.SUPER(arguments).checkItem.call(this,item); + } + }); + + STACKITEM.right = STACKITEM.Subclass({ + type: "right", isClose: true, delim: ')' + }); + + STACKITEM.begin = STACKITEM.Subclass({ + type: "begin", isOpen: true, + checkItem: function (item) { + if (item.type === "end") { + if (item.name !== this.name) + {TEX.Error(["EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.name,item.name])} + if (!this.end) {return STACKITEM.mml(this.mmlData())} + return this.parse[this.end].call(this.parse,this,this.data); + } + if (item.type === "stop") + {TEX.Error(["EnvMissingEnd","Missing \\end{%1}",this.name])} + return this.SUPER(arguments).checkItem.call(this,item); + } + }); + + STACKITEM.end = STACKITEM.Subclass({ + type: "end", isClose: true + }); + + STACKITEM.style = STACKITEM.Subclass({ + type: "style", + checkItem: function (item) { + if (!item.isClose) {return this.SUPER(arguments).checkItem.call(this,item)} + var mml = MML.mstyle.apply(MML,this.data).With(this.styles); + return [STACKITEM.mml(mml),item]; + } + }); + + STACKITEM.position = STACKITEM.Subclass({ + type: "position", + checkItem: function (item) { + if (item.isClose) {TEX.Error(["MissingBoxFor","Missing box for %1",this.name])} + if (item.isNotStack) { + var mml = item.mmlData(); + switch (this.move) { + case 'vertical': + mml = MML.mpadded(mml).With({height: this.dh, depth: this.dd, voffset: this.dh}); + return [STACKITEM.mml(mml)]; + case 'horizontal': + return [STACKITEM.mml(this.left),item,STACKITEM.mml(this.right)]; + } + } + return this.SUPER(arguments).checkItem.call(this,item); + } + }); + + STACKITEM.array = STACKITEM.Subclass({ + type: "array", isOpen: true, copyEnv: false, arraydef: {}, + Init: function () { + this.table = []; this.row = []; this.frame = []; this.hfill = []; + this.SUPER(arguments).Init.apply(this,arguments); + }, + checkItem: function (item) { + if (item.isClose && item.type !== "over") { + if (item.isEntry) {this.EndEntry(); this.clearEnv(); return false} + if (item.isCR) {this.EndEntry(); this.EndRow(); this.clearEnv(); return false} + this.EndTable(); this.clearEnv(); + var scriptlevel = this.arraydef.scriptlevel; delete this.arraydef.scriptlevel; + var mml = MML.mtable.apply(MML,this.table).With(this.arraydef); + if (this.frame.length === 4) { + mml.frame = (this.frame.dashed ? "dashed" : "solid"); + } else if (this.frame.length) { + mml.hasFrame = true; + if (this.arraydef.rowlines) {this.arraydef.rowlines = this.arraydef.rowlines.replace(/none( none)+$/,"none")} + mml = MML.menclose(mml).With({notation: this.frame.join(" "), isFrame: true}); + if ((this.arraydef.columnlines||"none") != "none" || + (this.arraydef.rowlines||"none") != "none") {mml.padding = 0} // HTML-CSS jax implements this + } + if (scriptlevel) {mml = MML.mstyle(mml).With({scriptlevel: scriptlevel})} + if (this.open || this.close) {mml = TEX.fenced(this.open,mml,this.close)} + mml = STACKITEM.mml(mml); + if (this.requireClose) { + if (item.type === 'close') {return mml} + TEX.Error(["MissingCloseBrace","Missing close brace"]); + } + return [mml,item]; + } + return this.SUPER(arguments).checkItem.call(this,item); + }, + EndEntry: function () { + var mtd = MML.mtd.apply(MML,this.data); + if (this.hfill.length) { + if (this.hfill[0] === 0) mtd.columnalign = "right"; + if (this.hfill[this.hfill.length-1] === this.data.length) + mtd.columnalign = (mtd.columnalign ? "center" : "left"); + } + this.row.push(mtd); this.data = []; this.hfill = []; + }, + EndRow: function () { + var mtr = MML.mtr; + if (this.isNumbered && this.row.length === 3) { + this.row.unshift(this.row.pop()); // move equation number to first position + mtr = MML.mlabeledtr; + } + this.table.push(mtr.apply(MML,this.row)); this.row = []; + }, + EndTable: function () { + if (this.data.length || this.row.length) {this.EndEntry(); this.EndRow()} + this.checkLines(); + }, + checkLines: function () { + if (this.arraydef.rowlines) { + var lines = this.arraydef.rowlines.split(/ /); + if (lines.length === this.table.length) { + this.frame.push("bottom"); lines.pop(); + this.arraydef.rowlines = lines.join(' '); + } else if (lines.length < this.table.length-1) { + this.arraydef.rowlines += " none"; + } + } + if (this.rowspacing) { + var rows = this.arraydef.rowspacing.split(/ /); + while (rows.length < this.table.length) {rows.push(this.rowspacing+"em")} + this.arraydef.rowspacing = rows.join(' '); + } + }, + clearEnv: function () { + for (var id in this.env) {if (this.env.hasOwnProperty(id)) {delete this.env[id]}} + } + }); + + STACKITEM.cell = STACKITEM.Subclass({ + type: "cell", isClose: true + }); + + STACKITEM.mml = STACKITEM.Subclass({ + type: "mml", isNotStack: true, + Add: function () {this.data.push.apply(this.data,arguments); return this} + }); + + STACKITEM.fn = STACKITEM.Subclass({ + type: "fn", + checkItem: function (item) { + if (this.data[0]) { + if (item.isOpen) {return true} + if (item.type !== "fn") { + if (item.type !== "mml" || !item.data[0]) {return [this.data[0],item]} + if (item.data[0].isa(MML.mspace)) {return [this.data[0],item]} + var mml = item.data[0]; if (mml.isEmbellished()) {mml = mml.CoreMO()} + if ([0,0,1,1,0,1,1,0,0,0][mml.Get("texClass")]) {return [this.data[0],item]} + } + return [this.data[0],MML.mo(MML.entity("#x2061")).With({texClass:MML.TEXCLASS.NONE}),item]; + } + return this.SUPER(arguments).checkItem.apply(this,arguments); + } + }); + + STACKITEM.not = STACKITEM.Subclass({ + type: "not", + checkItem: function (item) { + var mml, c; + if (item.type === "open" || item.type === "left") {return true} + if (item.type === "mml" && item.data[0].type.match(/^(mo|mi|mtext)$/)) { + mml = item.data[0], c = mml.data.join(""); + if (c.length === 1 && !mml.movesupsub && mml.data.length === 1) { + c = STACKITEM.not.remap[c.charCodeAt(0)]; + if (c) {mml.SetData(0,MML.chars(String.fromCharCode(c)))} + else {mml.Append(MML.chars("\u0338"))} + return item; + } + } + // \mathrel{\rlap{\notChar}} + mml = MML.mpadded(MML.mtext("\u29F8")).With({width:0}); + mml = MML.TeXAtom(mml).With({texClass:MML.TEXCLASS.REL}); + return [mml,item]; + } + }); + STACKITEM.not.remap = { + 0x2190:0x219A, 0x2192:0x219B, 0x2194:0x21AE, + 0x21D0:0x21CD, 0x21D2:0x21CF, 0x21D4:0x21CE, + 0x2208:0x2209, 0x220B:0x220C, 0x2223:0x2224, 0x2225:0x2226, + 0x223C:0x2241, 0x007E:0x2241, 0x2243:0x2244, 0x2245:0x2247, + 0x2248:0x2249, 0x224D:0x226D, 0x003D:0x2260, 0x2261:0x2262, + 0x003C:0x226E, 0x003E:0x226F, 0x2264:0x2270, 0x2265:0x2271, + 0x2272:0x2274, 0x2273:0x2275, 0x2276:0x2278, 0x2277:0x2279, + 0x227A:0x2280, 0x227B:0x2281, 0x2282:0x2284, 0x2283:0x2285, + 0x2286:0x2288, 0x2287:0x2289, 0x22A2:0x22AC, 0x22A8:0x22AD, + 0x22A9:0x22AE, 0x22AB:0x22AF, 0x227C:0x22E0, 0x227D:0x22E1, + 0x2291:0x22E2, 0x2292:0x22E3, 0x22B2:0x22EA, 0x22B3:0x22EB, + 0x22B4:0x22EC, 0x22B5:0x22ED, 0x2203:0x2204 + }; + + STACKITEM.dots = STACKITEM.Subclass({ + type: "dots", + checkItem: function (item) { + if (item.type === "open" || item.type === "left") {return true} + var dots = this.ldots; + if (item.type === "mml" && item.data[0].isEmbellished()) { + var tclass = item.data[0].CoreMO().Get("texClass"); + if (tclass === MML.TEXCLASS.BIN || tclass === MML.TEXCLASS.REL) {dots = this.cdots} + } + return [dots,item]; + } + }); + + + var TEXDEF = { + // + // Add new definitions without overriding user-defined ones + // + Add: function (src,dst,nouser) { + if (!dst) {dst = this} + for (var id in src) {if (src.hasOwnProperty(id)) { + if (typeof src[id] === 'object' && !isArray(src[id]) && + (typeof dst[id] === 'object' || typeof dst[id] === 'function')) + {this.Add(src[id],dst[id],src[id],nouser)} + else if (!dst[id] || !dst[id].isUser || !nouser) {dst[id] = src[id]} + }} + return dst; + } + }; + var STARTUP = function () { + MML = MathJax.ElementJax.mml; + HUB.Insert(TEXDEF,{ + + // patterns for letters and numbers + letter: /[a-z]/i, + digit: /[0-9.]/, + number: /^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)*|\.[0-9]+)/, + + special: { + '\\': 'ControlSequence', + '{': 'Open', + '}': 'Close', + '~': 'Tilde', + '^': 'Superscript', + '_': 'Subscript', + ' ': 'Space', + "\t": 'Space', + "\r": 'Space', + "\n": 'Space', + "'": 'Prime', + '%': 'Comment', + '&': 'Entry', + '#': 'Hash', + '\u00A0': 'Space', + '\u2019': 'Prime' + }, + + remap: { + '-': '2212', + '*': '2217', + '`': '2018' // map ` to back quote + }, + + mathchar0mi: { + // Lower-case greek + alpha: '03B1', + beta: '03B2', + gamma: '03B3', + delta: '03B4', + epsilon: '03F5', + zeta: '03B6', + eta: '03B7', + theta: '03B8', + iota: '03B9', + kappa: '03BA', + lambda: '03BB', + mu: '03BC', + nu: '03BD', + xi: '03BE', + omicron: '03BF', // added for completeness + pi: '03C0', + rho: '03C1', + sigma: '03C3', + tau: '03C4', + upsilon: '03C5', + phi: '03D5', + chi: '03C7', + psi: '03C8', + omega: '03C9', + varepsilon: '03B5', + vartheta: '03D1', + varpi: '03D6', + varrho: '03F1', + varsigma: '03C2', + varphi: '03C6', + + // Ord symbols + S: ['00A7',{mathvariant: MML.VARIANT.NORMAL}], + aleph: ['2135',{mathvariant: MML.VARIANT.NORMAL}], + hbar: ['210F',{variantForm:true}], + imath: '0131', + jmath: '0237', + ell: '2113', + wp: ['2118',{mathvariant: MML.VARIANT.NORMAL}], + Re: ['211C',{mathvariant: MML.VARIANT.NORMAL}], + Im: ['2111',{mathvariant: MML.VARIANT.NORMAL}], + partial: ['2202',{mathvariant: MML.VARIANT.NORMAL}], + infty: ['221E',{mathvariant: MML.VARIANT.NORMAL}], + prime: ['2032',{mathvariant: MML.VARIANT.NORMAL, variantForm:true}], + emptyset: ['2205',{mathvariant: MML.VARIANT.NORMAL}], + nabla: ['2207',{mathvariant: MML.VARIANT.NORMAL}], + top: ['22A4',{mathvariant: MML.VARIANT.NORMAL}], + bot: ['22A5',{mathvariant: MML.VARIANT.NORMAL}], + angle: ['2220',{mathvariant: MML.VARIANT.NORMAL}], + triangle: ['25B3',{mathvariant: MML.VARIANT.NORMAL}], + backslash: ['2216',{mathvariant: MML.VARIANT.NORMAL, variantForm:true}], + forall: ['2200',{mathvariant: MML.VARIANT.NORMAL}], + exists: ['2203',{mathvariant: MML.VARIANT.NORMAL}], + neg: ['00AC',{mathvariant: MML.VARIANT.NORMAL}], + lnot: ['00AC',{mathvariant: MML.VARIANT.NORMAL}], + flat: ['266D',{mathvariant: MML.VARIANT.NORMAL}], + natural: ['266E',{mathvariant: MML.VARIANT.NORMAL}], + sharp: ['266F',{mathvariant: MML.VARIANT.NORMAL}], + clubsuit: ['2663',{mathvariant: MML.VARIANT.NORMAL}], + diamondsuit: ['2662',{mathvariant: MML.VARIANT.NORMAL}], + heartsuit: ['2661',{mathvariant: MML.VARIANT.NORMAL}], + spadesuit: ['2660',{mathvariant: MML.VARIANT.NORMAL}] + }, + + mathchar0mo: { + surd: '221A', + + // big ops + coprod: ['2210',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigvee: ['22C1',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigwedge: ['22C0',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + biguplus: ['2A04',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigcap: ['22C2',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigcup: ['22C3',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + 'int': ['222B',{texClass: MML.TEXCLASS.OP}], + intop: ['222B',{texClass: MML.TEXCLASS.OP, movesupsub:true, movablelimits:true}], + iint: ['222C',{texClass: MML.TEXCLASS.OP}], + iiint: ['222D',{texClass: MML.TEXCLASS.OP}], + prod: ['220F',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + sum: ['2211',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigotimes: ['2A02',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigoplus: ['2A01',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigodot: ['2A00',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + oint: ['222E',{texClass: MML.TEXCLASS.OP}], + bigsqcup: ['2A06',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + smallint: ['222B',{largeop:false}], + + // binary operations + triangleleft: '25C3', + triangleright: '25B9', + bigtriangleup: '25B3', + bigtriangledown: '25BD', + wedge: '2227', + land: '2227', + vee: '2228', + lor: '2228', + cap: '2229', + cup: '222A', + ddagger: '2021', + dagger: '2020', + sqcap: '2293', + sqcup: '2294', + uplus: '228E', + amalg: '2A3F', + diamond: '22C4', + bullet: '2219', + wr: '2240', + div: '00F7', + odot: ['2299',{largeop: false}], + oslash: ['2298',{largeop: false}], + otimes: ['2297',{largeop: false}], + ominus: ['2296',{largeop: false}], + oplus: ['2295',{largeop: false}], + mp: '2213', + pm: '00B1', + circ: '2218', + bigcirc: '25EF', + setminus: ['2216',{variantForm:true}], + cdot: '22C5', + ast: '2217', + times: '00D7', + star: '22C6', + + // Relations + propto: '221D', + sqsubseteq: '2291', + sqsupseteq: '2292', + parallel: '2225', + mid: '2223', + dashv: '22A3', + vdash: '22A2', + leq: '2264', + le: '2264', + geq: '2265', + ge: '2265', + lt: '003C', + gt: '003E', + succ: '227B', + prec: '227A', + approx: '2248', + succeq: '2AB0', // or '227C', + preceq: '2AAF', // or '227D', + supset: '2283', + subset: '2282', + supseteq: '2287', + subseteq: '2286', + 'in': '2208', + ni: '220B', + notin: '2209', + owns: '220B', + gg: '226B', + ll: '226A', + sim: '223C', + simeq: '2243', + perp: '22A5', + equiv: '2261', + asymp: '224D', + smile: '2323', + frown: '2322', + ne: '2260', + neq: '2260', + cong: '2245', + doteq: '2250', + bowtie: '22C8', + models: '22A8', + + notChar: '29F8', + + + // Arrows + Leftrightarrow: '21D4', + Leftarrow: '21D0', + Rightarrow: '21D2', + leftrightarrow: '2194', + leftarrow: '2190', + gets: '2190', + rightarrow: '2192', + to: '2192', + mapsto: '21A6', + leftharpoonup: '21BC', + leftharpoondown: '21BD', + rightharpoonup: '21C0', + rightharpoondown: '21C1', + nearrow: '2197', + searrow: '2198', + nwarrow: '2196', + swarrow: '2199', + rightleftharpoons: '21CC', + hookrightarrow: '21AA', + hookleftarrow: '21A9', + longleftarrow: '27F5', + Longleftarrow: '27F8', + longrightarrow: '27F6', + Longrightarrow: '27F9', + Longleftrightarrow: '27FA', + longleftrightarrow: '27F7', + longmapsto: '27FC', + + + // Misc. + ldots: '2026', + cdots: '22EF', + vdots: '22EE', + ddots: '22F1', + dotsc: '2026', // dots with commas + dotsb: '22EF', // dots with binary ops and relations + dotsm: '22EF', // dots with multiplication + dotsi: '22EF', // dots with integrals + dotso: '2026', // other dots + + ldotp: ['002E', {texClass: MML.TEXCLASS.PUNCT}], + cdotp: ['22C5', {texClass: MML.TEXCLASS.PUNCT}], + colon: ['003A', {texClass: MML.TEXCLASS.PUNCT}] + }, + + mathchar7: { + Gamma: '0393', + Delta: '0394', + Theta: '0398', + Lambda: '039B', + Xi: '039E', + Pi: '03A0', + Sigma: '03A3', + Upsilon: '03A5', + Phi: '03A6', + Psi: '03A8', + Omega: '03A9', + + '_': '005F', + '#': '0023', + '$': '0024', + '%': '0025', + '&': '0026', + And: '0026' + }, + + delimiter: { + '(': '(', + ')': ')', + '[': '[', + ']': ']', + '<': '27E8', + '>': '27E9', + '\\lt': '27E8', + '\\gt': '27E9', + '/': '/', + '|': ['|',{texClass:MML.TEXCLASS.ORD}], + '.': '', + '\\\\': '\\', + '\\lmoustache': '23B0', // non-standard + '\\rmoustache': '23B1', // non-standard + '\\lgroup': '27EE', // non-standard + '\\rgroup': '27EF', // non-standard + '\\arrowvert': '23D0', + '\\Arrowvert': '2016', + '\\bracevert': '23AA', // non-standard + '\\Vert': ['2016',{texClass:MML.TEXCLASS.ORD}], + '\\|': ['2016',{texClass:MML.TEXCLASS.ORD}], + '\\vert': ['|',{texClass:MML.TEXCLASS.ORD}], + '\\uparrow': '2191', + '\\downarrow': '2193', + '\\updownarrow': '2195', + '\\Uparrow': '21D1', + '\\Downarrow': '21D3', + '\\Updownarrow': '21D5', + '\\backslash': '\\', + '\\rangle': '27E9', + '\\langle': '27E8', + '\\rbrace': '}', + '\\lbrace': '{', + '\\}': '}', + '\\{': '{', + '\\rceil': '2309', + '\\lceil': '2308', + '\\rfloor': '230B', + '\\lfloor': '230A', + '\\lbrack': '[', + '\\rbrack': ']' + }, + + macros: { + displaystyle: ['SetStyle','D',true,0], + textstyle: ['SetStyle','T',false,0], + scriptstyle: ['SetStyle','S',false,1], + scriptscriptstyle: ['SetStyle','SS',false,2], + + rm: ['SetFont',MML.VARIANT.NORMAL], + mit: ['SetFont',MML.VARIANT.ITALIC], + oldstyle: ['SetFont',MML.VARIANT.OLDSTYLE], + cal: ['SetFont',MML.VARIANT.CALIGRAPHIC], + it: ['SetFont',"-tex-mathit"], // needs special handling + bf: ['SetFont',MML.VARIANT.BOLD], + bbFont: ['SetFont',MML.VARIANT.DOUBLESTRUCK], + scr: ['SetFont',MML.VARIANT.SCRIPT], + frak: ['SetFont',MML.VARIANT.FRAKTUR], + sf: ['SetFont',MML.VARIANT.SANSSERIF], + tt: ['SetFont',MML.VARIANT.MONOSPACE], + +// font: + + tiny: ['SetSize',0.5], + Tiny: ['SetSize',0.6], // non-standard + scriptsize: ['SetSize',0.7], + small: ['SetSize',0.85], + normalsize: ['SetSize',1.0], + large: ['SetSize',1.2], + Large: ['SetSize',1.44], + LARGE: ['SetSize',1.73], + huge: ['SetSize',2.07], + Huge: ['SetSize',2.49], + + arcsin: ['NamedFn'], + arccos: ['NamedFn'], + arctan: ['NamedFn'], + arg: ['NamedFn'], + cos: ['NamedFn'], + cosh: ['NamedFn'], + cot: ['NamedFn'], + coth: ['NamedFn'], + csc: ['NamedFn'], + deg: ['NamedFn'], + det: 'NamedOp', + dim: ['NamedFn'], + exp: ['NamedFn'], + gcd: 'NamedOp', + hom: ['NamedFn'], + inf: 'NamedOp', + ker: ['NamedFn'], + lg: ['NamedFn'], + lim: 'NamedOp', + liminf: ['NamedOp','lim inf'], + limsup: ['NamedOp','lim sup'], + ln: ['NamedFn'], + log: ['NamedFn'], + max: 'NamedOp', + min: 'NamedOp', + Pr: 'NamedOp', + sec: ['NamedFn'], + sin: ['NamedFn'], + sinh: ['NamedFn'], + sup: 'NamedOp', + tan: ['NamedFn'], + tanh: ['NamedFn'], + + limits: ['Limits',1], + nolimits: ['Limits',0], + + overline: ['UnderOver','00AF',null,1], + underline: ['UnderOver','005F'], + overbrace: ['UnderOver','23DE',1], + underbrace: ['UnderOver','23DF',1], + overparen: ['UnderOver','23DC'], + underparen: ['UnderOver','23DD'], + overrightarrow: ['UnderOver','2192'], + underrightarrow: ['UnderOver','2192'], + overleftarrow: ['UnderOver','2190'], + underleftarrow: ['UnderOver','2190'], + overleftrightarrow: ['UnderOver','2194'], + underleftrightarrow: ['UnderOver','2194'], + + overset: 'Overset', + underset: 'Underset', + stackrel: ['Macro','\\mathrel{\\mathop{#2}\\limits^{#1}}',2], + + over: 'Over', + overwithdelims: 'Over', + atop: 'Over', + atopwithdelims: 'Over', + above: 'Over', + abovewithdelims: 'Over', + brace: ['Over','{','}'], + brack: ['Over','[',']'], + choose: ['Over','(',')'], + + frac: 'Frac', + sqrt: 'Sqrt', + root: 'Root', + uproot: ['MoveRoot','upRoot'], + leftroot: ['MoveRoot','leftRoot'], + + left: 'LeftRight', + right: 'LeftRight', + middle: 'Middle', + + llap: 'Lap', + rlap: 'Lap', + raise: 'RaiseLower', + lower: 'RaiseLower', + moveleft: 'MoveLeftRight', + moveright: 'MoveLeftRight', + + ',': ['Spacer',MML.LENGTH.THINMATHSPACE], + ':': ['Spacer',MML.LENGTH.MEDIUMMATHSPACE], // for LaTeX + '>': ['Spacer',MML.LENGTH.MEDIUMMATHSPACE], + ';': ['Spacer',MML.LENGTH.THICKMATHSPACE], + '!': ['Spacer',MML.LENGTH.NEGATIVETHINMATHSPACE], + enspace: ['Spacer',".5em"], + quad: ['Spacer',"1em"], + qquad: ['Spacer',"2em"], + thinspace: ['Spacer',MML.LENGTH.THINMATHSPACE], + negthinspace: ['Spacer',MML.LENGTH.NEGATIVETHINMATHSPACE], + + hskip: 'Hskip', + hspace: 'Hskip', + kern: 'Hskip', + mskip: 'Hskip', + mspace: 'Hskip', + mkern: 'Hskip', + rule: 'rule', + Rule: ['Rule'], + Space: ['Rule','blank'], + + big: ['MakeBig',MML.TEXCLASS.ORD,0.85], + Big: ['MakeBig',MML.TEXCLASS.ORD,1.15], + bigg: ['MakeBig',MML.TEXCLASS.ORD,1.45], + Bigg: ['MakeBig',MML.TEXCLASS.ORD,1.75], + bigl: ['MakeBig',MML.TEXCLASS.OPEN,0.85], + Bigl: ['MakeBig',MML.TEXCLASS.OPEN,1.15], + biggl: ['MakeBig',MML.TEXCLASS.OPEN,1.45], + Biggl: ['MakeBig',MML.TEXCLASS.OPEN,1.75], + bigr: ['MakeBig',MML.TEXCLASS.CLOSE,0.85], + Bigr: ['MakeBig',MML.TEXCLASS.CLOSE,1.15], + biggr: ['MakeBig',MML.TEXCLASS.CLOSE,1.45], + Biggr: ['MakeBig',MML.TEXCLASS.CLOSE,1.75], + bigm: ['MakeBig',MML.TEXCLASS.REL,0.85], + Bigm: ['MakeBig',MML.TEXCLASS.REL,1.15], + biggm: ['MakeBig',MML.TEXCLASS.REL,1.45], + Biggm: ['MakeBig',MML.TEXCLASS.REL,1.75], + + mathord: ['TeXAtom',MML.TEXCLASS.ORD], + mathop: ['TeXAtom',MML.TEXCLASS.OP], + mathopen: ['TeXAtom',MML.TEXCLASS.OPEN], + mathclose: ['TeXAtom',MML.TEXCLASS.CLOSE], + mathbin: ['TeXAtom',MML.TEXCLASS.BIN], + mathrel: ['TeXAtom',MML.TEXCLASS.REL], + mathpunct: ['TeXAtom',MML.TEXCLASS.PUNCT], + mathinner: ['TeXAtom',MML.TEXCLASS.INNER], + + vcenter: ['TeXAtom',MML.TEXCLASS.VCENTER], + + mathchoice: ['Extension','mathchoice'], + buildrel: 'BuildRel', + + hbox: ['HBox',0], + text: 'HBox', + mbox: ['HBox',0], + fbox: 'FBox', + + strut: 'Strut', + mathstrut: ['Macro','\\vphantom{(}'], + phantom: 'Phantom', + vphantom: ['Phantom',1,0], + hphantom: ['Phantom',0,1], + smash: 'Smash', + + acute: ['Accent', "00B4"], // or 0301 or 02CA + grave: ['Accent', "0060"], // or 0300 or 02CB + ddot: ['Accent', "00A8"], // or 0308 + tilde: ['Accent', "007E"], // or 0303 or 02DC + bar: ['Accent', "00AF"], // or 0304 or 02C9 + breve: ['Accent', "02D8"], // or 0306 + check: ['Accent', "02C7"], // or 030C + hat: ['Accent', "005E"], // or 0302 or 02C6 + vec: ['Accent', "2192"], // or 20D7 + dot: ['Accent', "02D9"], // or 0307 + widetilde: ['Accent', "007E",1], // or 0303 or 02DC + widehat: ['Accent', "005E",1], // or 0302 or 02C6 + + matrix: 'Matrix', + array: 'Matrix', + pmatrix: ['Matrix','(',')'], + cases: ['Matrix','{','',"left left",null,".1em",null,true], + eqalign: ['Matrix',null,null,"right left",MML.LENGTH.THICKMATHSPACE,".5em",'D'], + displaylines: ['Matrix',null,null,"center",null,".5em",'D'], + cr: 'Cr', + '\\': 'CrLaTeX', + newline: ['CrLaTeX',true], + hline: ['HLine','solid'], + hdashline: ['HLine','dashed'], +// noalign: 'HandleNoAlign', + eqalignno: ['Matrix',null,null,"right left",MML.LENGTH.THICKMATHSPACE,".5em",'D',null,"right"], + leqalignno: ['Matrix',null,null,"right left",MML.LENGTH.THICKMATHSPACE,".5em",'D',null,"left"], + hfill: 'HFill', + hfil: 'HFill', // \hfil treated as \hfill for now + hfilll: 'HFill', // \hfilll treated as \hfill for now + + // TeX substitution macros + bmod: ['Macro','\\mmlToken{mo}[lspace="thickmathspace" rspace="thickmathspace"]{mod}'], + pmod: ['Macro','\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}',1], + mod: ['Macro','\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1',1], + pod: ['Macro','\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)',1], + iff: ['Macro','\\;\\Longleftrightarrow\\;'], + skew: ['Macro','{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}',3], + mathcal: ['Macro','{\\cal #1}',1], + mathscr: ['Macro','{\\scr #1}',1], + mathrm: ['Macro','{\\rm #1}',1], + mathbf: ['Macro','{\\bf #1}',1], + mathbb: ['Macro','{\\bbFont #1}',1], + Bbb: ['Macro','{\\bbFont #1}',1], + mathit: ['Macro','{\\it #1}',1], + mathfrak: ['Macro','{\\frak #1}',1], + mathsf: ['Macro','{\\sf #1}',1], + mathtt: ['Macro','{\\tt #1}',1], + textrm: ['Macro','\\mathord{\\rm\\text{#1}}',1], + textit: ['Macro','\\mathord{\\it\\text{#1}}',1], + textbf: ['Macro','\\mathord{\\bf\\text{#1}}',1], + textsf: ['Macro','\\mathord{\\sf\\text{#1}}',1], + texttt: ['Macro','\\mathord{\\tt\\text{#1}}',1], + pmb: ['Macro','\\rlap{#1}\\kern1px{#1}',1], + TeX: ['Macro','T\\kern-.14em\\lower.5ex{E}\\kern-.115em X'], + LaTeX: ['Macro','L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX'], + ' ': ['Macro','\\text{ }'], + + // Specially handled + not: 'Not', + dots: 'Dots', + space: 'Tilde', + '\u00A0': 'Tilde', + + + // LaTeX + begin: 'BeginEnd', + end: 'BeginEnd', + + newcommand: ['Extension','newcommand'], + renewcommand: ['Extension','newcommand'], + newenvironment: ['Extension','newcommand'], + renewenvironment: ['Extension','newcommand'], + def: ['Extension','newcommand'], + 'let': ['Extension','newcommand'], + + verb: ['Extension','verb'], + + boldsymbol: ['Extension','boldsymbol'], + + tag: ['Extension','AMSmath'], + notag: ['Extension','AMSmath'], + label: ['Extension','AMSmath'], + ref: ['Extension','AMSmath'], + eqref: ['Extension','AMSmath'], + nonumber: ['Macro','\\notag'], + + // Extensions to TeX + unicode: ['Extension','unicode'], + color: 'Color', + + href: ['Extension','HTML'], + 'class': ['Extension','HTML'], + style: ['Extension','HTML'], + cssId: ['Extension','HTML'], + bbox: ['Extension','bbox'], + + mmlToken: 'MmlToken', + + require: 'Require' + + }, + + environment: { + array: ['AlignedArray'], + matrix: ['Array',null,null,null,'c'], + pmatrix: ['Array',null,'(',')','c'], + bmatrix: ['Array',null,'[',']','c'], + Bmatrix: ['Array',null,'\\{','\\}','c'], + vmatrix: ['Array',null,'\\vert','\\vert','c'], + Vmatrix: ['Array',null,'\\Vert','\\Vert','c'], + cases: ['Array',null,'\\{','.','ll',null,".2em",'T'], + + equation: [null,'Equation'], + 'equation*': [null,'Equation'], + + eqnarray: ['ExtensionEnv',null,'AMSmath'], + 'eqnarray*': ['ExtensionEnv',null,'AMSmath'], + + align: ['ExtensionEnv',null,'AMSmath'], + 'align*': ['ExtensionEnv',null,'AMSmath'], + aligned: ['ExtensionEnv',null,'AMSmath'], + multline: ['ExtensionEnv',null,'AMSmath'], + 'multline*': ['ExtensionEnv',null,'AMSmath'], + split: ['ExtensionEnv',null,'AMSmath'], + gather: ['ExtensionEnv',null,'AMSmath'], + 'gather*': ['ExtensionEnv',null,'AMSmath'], + gathered: ['ExtensionEnv',null,'AMSmath'], + alignat: ['ExtensionEnv',null,'AMSmath'], + 'alignat*': ['ExtensionEnv',null,'AMSmath'], + alignedat: ['ExtensionEnv',null,'AMSmath'] + }, + + p_height: 1.2 / .85 // cmex10 height plus depth over .85 + + }); + + // + // Add macros defined in the configuration + // + if (this.config.Macros) { + var MACROS = this.config.Macros; + for (var id in MACROS) {if (MACROS.hasOwnProperty(id)) { + if (typeof(MACROS[id]) === "string") {TEXDEF.macros[id] = ['Macro',MACROS[id]]} + else {TEXDEF.macros[id] = ["Macro"].concat(MACROS[id])} + TEXDEF.macros[id].isUser = true; + }} + } + }; + + /************************************************************************/ + /* + * The TeX Parser + */ + + var PARSE = MathJax.Object.Subclass({ + Init: function (string,env) { + this.string = string; this.i = 0; this.macroCount = 0; + var ENV; if (env) {ENV = {}; for (var id in env) {if (env.hasOwnProperty(id)) {ENV[id] = env[id]}}} + this.stack = TEX.Stack(ENV,!!env); + this.Parse(); this.Push(STACKITEM.stop()); + }, + Parse: function () { + var c, n; + while (this.i < this.string.length) { + c = this.string.charAt(this.i++); n = c.charCodeAt(0); + if (n >= 0xD800 && n < 0xDC00) {c += this.string.charAt(this.i++)} + if (TEXDEF.special.hasOwnProperty(c)) {this[TEXDEF.special[c]](c)} + else if (TEXDEF.letter.test(c)) {this.Variable(c)} + else if (TEXDEF.digit.test(c)) {this.Number(c)} + else {this.Other(c)} + } + }, + Push: function () {this.stack.Push.apply(this.stack,arguments)}, + mml: function () { + if (this.stack.Top().type !== "mml") {return null} + return this.stack.Top().data[0]; + }, + mmlToken: function (token) {return token}, // used by boldsymbol extension + + /************************************************************************/ + /* + * Handle various token classes + */ + + /* + * Lookup a control-sequence and process it + */ + ControlSequence: function (c) { + var name = this.GetCS(), macro = this.csFindMacro(name); + if (macro) { + if (!isArray(macro)) {macro = [macro]} + var fn = macro[0]; if (!(fn instanceof Function)) {fn = this[fn]} + fn.apply(this,[c+name].concat(macro.slice(1))); + } else if (TEXDEF.mathchar0mi.hasOwnProperty(name)) {this.csMathchar0mi(name,TEXDEF.mathchar0mi[name])} + else if (TEXDEF.mathchar0mo.hasOwnProperty(name)) {this.csMathchar0mo(name,TEXDEF.mathchar0mo[name])} + else if (TEXDEF.mathchar7.hasOwnProperty(name)) {this.csMathchar7(name,TEXDEF.mathchar7[name])} + else if (TEXDEF.delimiter.hasOwnProperty("\\"+name)) {this.csDelimiter(name,TEXDEF.delimiter["\\"+name])} + else {this.csUndefined(c+name)} + }, + // + // Look up a macro in the macros list + // (overridden in begingroup extension) + // + csFindMacro: function (name) { + return (TEXDEF.macros.hasOwnProperty(name) ? TEXDEF.macros[name] : null); + }, + // + // Handle normal mathchar (as an mi) + // + csMathchar0mi: function (name,mchar) { + var def = {mathvariant: MML.VARIANT.ITALIC}; + if (isArray(mchar)) {def = mchar[1]; mchar = mchar[0]} + this.Push(this.mmlToken(MML.mi(MML.entity("#x"+mchar)).With(def))); + }, + // + // Handle normal mathchar (as an mo) + // + csMathchar0mo: function (name,mchar) { + var def = {stretchy: false}; + if (isArray(mchar)) {def = mchar[1]; def.stretchy = false; mchar = mchar[0]} + this.Push(this.mmlToken(MML.mo(MML.entity("#x"+mchar)).With(def))); + }, + // + // Handle mathchar in current family + // + csMathchar7: function (name,mchar) { + var def = {mathvariant: MML.VARIANT.NORMAL}; + if (isArray(mchar)) {def = mchar[1]; mchar = mchar[0]} + if (this.stack.env.font) {def.mathvariant = this.stack.env.font} + this.Push(this.mmlToken(MML.mi(MML.entity("#x"+mchar)).With(def))); + }, + // + // Handle delimiter + // + csDelimiter: function (name,delim) { + var def = {}; + if (isArray(delim)) {def = delim[1]; delim = delim[0]} + if (delim.length === 4) {delim = MML.entity('#x'+delim)} else {delim = MML.chars(delim)} + this.Push(this.mmlToken(MML.mo(delim).With({fence: false, stretchy: false}).With(def))); + }, + // + // Handle undefined control sequence + // (overridden in noUndefined extension) + // + csUndefined: function (name) { + TEX.Error(["UndefinedControlSequence","Undefined control sequence %1",name]); + }, + + /* + * Handle a variable (a single letter) + */ + Variable: function (c) { + var def = {}; if (this.stack.env.font) {def.mathvariant = this.stack.env.font} + this.Push(this.mmlToken(MML.mi(MML.chars(c)).With(def))); + }, + + /* + * Determine the extent of a number (pattern may need work) + */ + Number: function (c) { + var mml, n = this.string.slice(this.i-1).match(TEXDEF.number); + if (n) {mml = MML.mn(n[0].replace(/[{}]/g,"")); this.i += n[0].length - 1} + else {mml = MML.mo(MML.chars(c))} + if (this.stack.env.font) {mml.mathvariant = this.stack.env.font} + this.Push(this.mmlToken(mml)); + }, + + /* + * Handle { and } + */ + Open: function (c) {this.Push(STACKITEM.open())}, + Close: function (c) {this.Push(STACKITEM.close())}, + + /* + * Handle tilde and spaces + */ + Tilde: function (c) {this.Push(MML.mtext(MML.chars(NBSP)))}, + Space: function (c) {}, + + /* + * Handle ^, _, and ' + */ + Superscript: function (c) { + if (this.GetNext().match(/\d/)) // don't treat numbers as a unit + {this.string = this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1)} + var primes, base, top = this.stack.Top(); + if (top.type === "prime") {base = top.data[0]; primes = top.data[1]; this.stack.Pop()} + else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}} + if (base.isEmbellishedWrapper) {base = base.data[0].data[0]} + var movesupsub = base.movesupsub, position = base.sup; + if ((base.type === "msubsup" && base.data[base.sup]) || + (base.type === "munderover" && base.data[base.over] && !base.subsupOK)) + {TEX.Error(["DoubleExponent","Double exponent: use braces to clarify"])} + if (base.type !== "msubsup") { + if (movesupsub) { + if (base.type !== "munderover" || base.data[base.over]) { + if (base.movablelimits && base.isa(MML.mi)) {base = this.mi2mo(base)} + base = MML.munderover(base,null,null).With({movesupsub:true}) + } + position = base.over; + } else { + base = MML.msubsup(base,null,null); + position = base.sup; + } + } + this.Push(STACKITEM.subsup(base).With({ + position: position, primes: primes, movesupsub: movesupsub + })); + }, + Subscript: function (c) { + if (this.GetNext().match(/\d/)) // don't treat numbers as a unit + {this.string = this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1)} + var primes, base, top = this.stack.Top(); + if (top.type === "prime") {base = top.data[0]; primes = top.data[1]; this.stack.Pop()} + else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}} + if (base.isEmbellishedWrapper) {base = base.data[0].data[0]} + var movesupsub = base.movesupsub, position = base.sub; + if ((base.type === "msubsup" && base.data[base.sub]) || + (base.type === "munderover" && base.data[base.under] && !base.subsupOK)) + {TEX.Error(["DoubleSubscripts","Double subscripts: use braces to clarify"])} + if (base.type !== "msubsup") { + if (movesupsub) { + if (base.type !== "munderover" || base.data[base.under]) { + if (base.movablelimits && base.isa(MML.mi)) {base = this.mi2mo(base)} + base = MML.munderover(base,null,null).With({movesupsub:true}) + } + position = base.under; + } else { + base = MML.msubsup(base,null,null); + position = base.sub; + } + } + this.Push(STACKITEM.subsup(base).With({ + position: position, primes: primes, movesupsub: movesupsub + })); + }, + PRIME: "\u2032", SMARTQUOTE: "\u2019", + Prime: function (c) { + var base = this.stack.Prev(); if (!base) {base = MML.mi()} + if (base.type === "msubsup" && base.data[base.sup]) { + TEX.Error(["DoubleExponentPrime", + "Prime causes double exponent: use braces to clarify"]); + } + var sup = ""; this.i--; + do {sup += this.PRIME; this.i++, c = this.GetNext()} + while (c === "'" || c === this.SMARTQUOTE); + sup = ["","\u2032","\u2033","\u2034","\u2057"][sup.length] || sup; + this.Push(STACKITEM.prime(base,this.mmlToken(MML.mo(sup)))); + }, + mi2mo: function (mi) { + var mo = MML.mo(); mo.Append.apply(mo,mi.data); var id; + for (id in mo.defaults) + {if (mo.defaults.hasOwnProperty(id) && mi[id] != null) {mo[id] = mi[id]}} + for (id in MML.copyAttributes) + {if (MML.copyAttributes.hasOwnProperty(id) && mi[id] != null) {mo[id] = mi[id]}} + mo.lspace = mo.rspace = "0"; // prevent mo from having space in NativeMML + mo.useMMLspacing &= ~(mo.SPACE_ATTR.lspace | mo.SPACE_ATTR.rspace); // don't count these explicit settings + return mo; + }, + + /* + * Handle comments + */ + Comment: function (c) { + while (this.i < this.string.length && this.string.charAt(this.i) != "\n") {this.i++} + }, + + /* + * Handle hash marks outside of definitions + */ + Hash: function (c) { + TEX.Error(["CantUseHash1", + "You can't use 'macro parameter character #' in math mode"]); + }, + + /* + * Handle other characters (as <mo> elements) + */ + Other: function (c) { + var def, mo; + if (this.stack.env.font) {def = {mathvariant: this.stack.env.font}} + if (TEXDEF.remap.hasOwnProperty(c)) { + c = TEXDEF.remap[c]; + if (isArray(c)) {def = c[1]; c = c[0]} + mo = MML.mo(MML.entity('#x'+c)).With(def); + } else { + mo = MML.mo(c).With(def); + } + if (mo.autoDefault("stretchy",true)) {mo.stretchy = false} + if (mo.autoDefault("texClass",true) == "") {mo = MML.TeXAtom(mo)} + this.Push(this.mmlToken(mo)); + }, + + /************************************************************************/ + /* + * Macros + */ + + SetFont: function (name,font) {this.stack.env.font = font}, + SetStyle: function (name,texStyle,style,level) { + this.stack.env.style = texStyle; this.stack.env.level = level; + this.Push(STACKITEM.style().With({styles: {displaystyle: style, scriptlevel: level}})); + }, + SetSize: function (name,size) { + this.stack.env.size = size; + this.Push(STACKITEM.style().With({styles: {mathsize: size+"em"}})); // convert to absolute? + }, + + Color: function (name) { + var color = this.GetArgument(name); + var old = this.stack.env.color; this.stack.env.color = color; + var math = this.ParseArg(name); + if (old) {this.stack.env.color = old} else {delete this.stack.env.color} + this.Push(MML.mstyle(math).With({mathcolor: color})); + }, + + Spacer: function (name,space) { + this.Push(MML.mspace().With({width: space, mathsize: MML.SIZE.NORMAL, scriptlevel:0})); + }, + + LeftRight: function (name) { + this.Push(STACKITEM[name.substr(1)]().With({delim: this.GetDelimiter(name)})); + }, + + Middle: function (name) { + var delim = this.GetDelimiter(name); + this.Push(MML.TeXAtom().With({texClass:MML.TEXCLASS.CLOSE})); + if (this.stack.Top().type !== "left") + {TEX.Error(["MisplacedMiddle","%1 must be within \\left and \\right",name])} + this.Push(MML.mo(delim).With({stretchy:true})); + this.Push(MML.TeXAtom().With({texClass:MML.TEXCLASS.OPEN})); + }, + + NamedFn: function (name,id) { + if (!id) {id = name.substr(1)}; + var mml = MML.mi(id).With({texClass: MML.TEXCLASS.OP}); + this.Push(STACKITEM.fn(this.mmlToken(mml))); + }, + NamedOp: function (name,id) { + if (!id) {id = name.substr(1)}; + id = id.replace(/ /,"\u2006"); + var mml = MML.mo(id).With({ + movablelimits: true, + movesupsub: true, + form: MML.FORM.PREFIX, + texClass: MML.TEXCLASS.OP + }); + this.Push(this.mmlToken(mml)); + }, + Limits: function (name,limits) { + var op = this.stack.Prev("nopop"); + if (!op || (op.Get("texClass") !== MML.TEXCLASS.OP && op.movesupsub == null)) + {TEX.Error(["MisplacedLimits","%1 is allowed only on operators",name])} + var top = this.stack.Top(); + if (op.type === "munderover" && !limits) { + op = top.data[top.data.length-1] = MML.msubsup.apply(MML.subsup,op.data); + } else if (op.type === "msubsup" && limits) { + op = top.data[top.data.length-1] = MML.munderover.apply(MML.underover,op.data); + } + op.movesupsub = (limits ? true : false); + op.Core().movablelimits = false; + if (op.movablelimits) op.movablelimits = false; + }, + + Over: function (name,open,close) { + var mml = STACKITEM.over().With({name: name}); + if (open || close) { + mml.open = open; mml.close = close; + } else if (name.match(/withdelims$/)) { + mml.open = this.GetDelimiter(name); + mml.close = this.GetDelimiter(name); + } + if (name.match(/^\\above/)) {mml.thickness = this.GetDimen(name)} + else if (name.match(/^\\atop/) || open || close) {mml.thickness = 0} + this.Push(mml); + }, + + Frac: function (name) { + var num = this.ParseArg(name); + var den = this.ParseArg(name); + this.Push(MML.mfrac(num,den)); + }, + + Sqrt: function (name) { + var n = this.GetBrackets(name), arg = this.GetArgument(name); + if (arg === "\\frac") {arg += "{"+this.GetArgument(arg)+"}{"+this.GetArgument(arg)+"}"} + var mml = TEX.Parse(arg,this.stack.env).mml(); + if (!n) {mml = MML.msqrt.apply(MML,mml.array())} + else {mml = MML.mroot(mml,this.parseRoot(n))} + this.Push(mml); + }, + Root: function (name) { + var n = this.GetUpTo(name,"\\of"); + var arg = this.ParseArg(name); + this.Push(MML.mroot(arg,this.parseRoot(n))); + }, + parseRoot: function (n) { + var env = this.stack.env, inRoot = env.inRoot; env.inRoot = true; + var parser = TEX.Parse(n,env); n = parser.mml(); var global = parser.stack.global; + if (global.leftRoot || global.upRoot) { + n = MML.mpadded(n); + if (global.leftRoot) {n.width = global.leftRoot} + if (global.upRoot) {n.voffset = global.upRoot; n.height = global.upRoot} + } + env.inRoot = inRoot; + return n; + }, + MoveRoot: function (name,id) { + if (!this.stack.env.inRoot) + {TEX.Error(["MisplacedMoveRoot","%1 can appear only within a root",name])} + if (this.stack.global[id]) + {TEX.Error(["MultipleMoveRoot","Multiple use of %1",name])} + var n = this.GetArgument(name); + if (!n.match(/-?[0-9]+/)) + {TEX.Error(["IntegerArg","The argument to %1 must be an integer",name])} + n = (n/15)+"em"; + if (n.substr(0,1) !== "-") {n = "+"+n} + this.stack.global[id] = n; + }, + + Accent: function (name,accent,stretchy) { + var c = this.ParseArg(name); + var def = {accent: true}; if (this.stack.env.font) {def.mathvariant = this.stack.env.font} + var mml = this.mmlToken(MML.mo(MML.entity("#x"+accent)).With(def)); + mml.stretchy = (stretchy ? true : false); + var mo = (c.isEmbellished() ? c.CoreMO() : c); + if (mo.isa(MML.mo)) mo.movablelimits = false; + this.Push(MML.TeXAtom(MML.munderover(c,null,mml).With({accent: true}))); + }, + + UnderOver: function (name,c,stack,noaccent) { + var pos = {o: "over", u: "under"}[name.charAt(1)]; + var base = this.ParseArg(name); + if (base.Get("movablelimits")) {base.movablelimits = false} + if (base.isa(MML.munderover) && base.isEmbellished()) { + base.Core().With({lspace:0,rspace:0}); // get spacing right for NativeMML + base = MML.mrow(MML.mo().With({rspace:0}),base); // add an empty <mi> so it's not embellished any more + } + var mml = MML.munderover(base,null,null); + mml.SetData( + mml[pos], + this.mmlToken(MML.mo(MML.entity("#x"+c)).With({stretchy:true, accent:!noaccent})) + ); + if (stack) {mml = MML.TeXAtom(mml).With({texClass:MML.TEXCLASS.OP, movesupsub:true})} + this.Push(mml.With({subsupOK:true})); + }, + + Overset: function (name) { + var top = this.ParseArg(name), base = this.ParseArg(name); + base.movablelimits = false; + this.Push(MML.mover(base,top)); + }, + Underset: function (name) { + var bot = this.ParseArg(name), base = this.ParseArg(name); + base.movablelimits = false; + this.Push(MML.munder(base,bot)); + }, + + TeXAtom: function (name,mclass) { + var def = {texClass: mclass}, mml; + if (mclass == MML.TEXCLASS.OP) { + def.movesupsub = def.movablelimits = true; + var arg = this.GetArgument(name); + var match = arg.match(/^\s*\\rm\s+([a-zA-Z0-9 ]+)$/); + if (match) { + def.mathvariant = MML.VARIANT.NORMAL; + mml = STACKITEM.fn(this.mmlToken(MML.mi(match[1]).With(def))); + } else { + mml = STACKITEM.fn(MML.TeXAtom(TEX.Parse(arg,this.stack.env).mml()).With(def)); + } + } else {mml = MML.TeXAtom(this.ParseArg(name)).With(def)} + this.Push(mml); + }, + + MmlToken: function (name) { + var type = this.GetArgument(name), + attr = this.GetBrackets(name,"").replace(/^\s+/,""), + data = this.GetArgument(name), + def = {attrNames:[]}, match; + if (!MML[type] || !MML[type].prototype.isToken) + {TEX.Error(["NotMathMLToken","%1 is not a token element",type])} + while (attr !== "") { + match = attr.match(/^([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^ ,]*)\s*,?\s*/i); + if (!match) + {TEX.Error(["InvalidMathMLAttr","Invalid MathML attribute: %1",attr])} + if (MML[type].prototype.defaults[match[1]] == null && !this.MmlTokenAllow[match[1]]) { + TEX.Error(["UnknownAttrForElement", + "%1 is not a recognized attribute for %2", + match[1],type]); + } + var value = this.MmlFilterAttribute(match[1],match[2].replace(/^(['"])(.*)\1$/,"$2")); + if (value) { + if (value.toLowerCase() === "true") {value = true} + else if (value.toLowerCase() === "false") {value = false} + def[match[1]] = value; + def.attrNames.push(match[1]); + } + attr = attr.substr(match[0].length); + } + this.Push(this.mmlToken(MML[type](data).With(def))); + }, + MmlFilterAttribute: function (name,value) {return value}, + MmlTokenAllow: { + fontfamily:1, fontsize:1, fontweight:1, fontstyle:1, + color:1, background:1, + id:1, "class":1, href:1, style:1 + }, + + Strut: function (name) { + this.Push(MML.mpadded(MML.mrow()).With({height: "8.6pt", depth: "3pt", width: 0})); + }, + + Phantom: function (name,v,h) { + var mml = this.ParseArg(name); + if (v || h) { + mml = MML.mpadded(mml); + if (h) {mml.height = mml.depth = 0} + if (v) {mml.width = 0} + } + this.Push(MML.TeXAtom(MML.mphantom(mml))); + }, + + Smash: function (name) { + var bt = this.trimSpaces(this.GetBrackets(name,"")); + var smash = MML.mpadded(this.ParseArg(name)); + switch (bt) { + case "b": smash.depth = 0; break; + case "t": smash.height = 0; break; + default: smash.height = smash.depth = 0; + } + this.Push(MML.TeXAtom(smash)); + }, + + Lap: function (name) { + var mml = MML.mpadded(this.ParseArg(name)).With({width: 0}); + if (name === "\\llap") {mml.lspace = "-1width"} + this.Push(MML.TeXAtom(mml)); + }, + + RaiseLower: function (name) { + var h = this.GetDimen(name); + var item = STACKITEM.position().With({name: name, move: 'vertical'}); + if (h.charAt(0) === '-') {h = h.slice(1); name = {raise: "\\lower", lower: "\\raise"}[name.substr(1)]} + if (name === "\\lower") {item.dh = '-'+h; item.dd = '+'+h} else {item.dh = '+'+h; item.dd = '-'+h} + this.Push(item); + }, + + MoveLeftRight: function (name) { + var h = this.GetDimen(name); + var nh = (h.charAt(0) === '-' ? h.slice(1) : '-'+h); + if (name === "\\moveleft") {var tmp = h; h = nh; nh = tmp} + this.Push(STACKITEM.position().With({ + name: name, move: 'horizontal', + left: MML.mspace().With({width: h, mathsize: MML.SIZE.NORMAL}), + right: MML.mspace().With({width: nh, mathsize: MML.SIZE.NORMAL}) + })); + }, + + Hskip: function (name) { + this.Push(MML.mspace().With({width: this.GetDimen(name), mathsize: MML.SIZE.NORMAL})); + }, + + Rule: function (name,style) { + var w = this.GetDimen(name), + h = this.GetDimen(name), + d = this.GetDimen(name); + var def = {width:w, height:h, depth:d}; + if (style !== 'blank') { + def.mathbackground = (this.stack.env.color || "black"); + } + this.Push(MML.mspace().With(def)); + }, + rule: function (name) { + var v = this.GetBrackets(name), + w = this.GetDimen(name), + h = this.GetDimen(name); + var mml = MML.mspace().With({ + width: w, height:h, + mathbackground: (this.stack.env.color || "black") + }); + if (v) { + mml = MML.mpadded(mml).With({voffset: v}); + if (v.match(/^\-/)) { + mml.height = v; + mml.depth = '+' + v.substr(1); + } else { + mml.height = '+' + v; + } + } + this.Push(mml); + }, + + MakeBig: function (name,mclass,size) { + size *= TEXDEF.p_height; + size = String(size).replace(/(\.\d\d\d).+/,'$1')+"em"; + var delim = this.GetDelimiter(name,true); + this.Push(MML.mstyle(MML.TeXAtom(MML.mo(delim).With({ + minsize: size, maxsize: size, + fence: true, stretchy: true, symmetric: true + })).With({texClass: mclass})).With({scriptlevel: 0})); + }, + + BuildRel: function (name) { + var top = this.ParseUpTo(name,"\\over"); + var bot = this.ParseArg(name); + this.Push(MML.TeXAtom(MML.munderover(bot,null,top)).With({texClass: MML.TEXCLASS.REL})); + }, + + HBox: function (name,style) { + this.Push.apply(this,this.InternalMath(this.GetArgument(name),style)); + }, + + FBox: function (name) { + this.Push(MML.menclose.apply(MML,this.InternalMath(this.GetArgument(name))).With({notation:"box"})); + }, + + Not: function (name) { + this.Push(STACKITEM.not()); + }, + + Dots: function (name) { + this.Push(STACKITEM.dots().With({ + ldots: this.mmlToken(MML.mo(MML.entity("#x2026")).With({stretchy:false})), + cdots: this.mmlToken(MML.mo(MML.entity("#x22EF")).With({stretchy:false})) + })); + }, + + Require: function (name) { + var file = this.GetArgument(name) + .replace(/.*\//,"") // remove any leading path + .replace(/[^a-z0-9_.-]/ig,""); // remove illegal characters + this.Extension(null,file); + }, + + Extension: function (name,file,array) { + if (name && !typeof(name) === "string") {name = name.name} + file = TEX.extensionDir+"/"+file; + if (!file.match(/\.js$/)) {file += ".js"} + if (!AJAX.loaded[AJAX.fileURL(file)]) { + if (name != null) {delete TEXDEF[array || 'macros'][name.replace(/^\\/,"")]} + HUB.RestartAfter(AJAX.Require(file)); + } + }, + + Macro: function (name,macro,argcount,def) { + if (argcount) { + var args = []; + if (def != null) { + var optional = this.GetBrackets(name); + args.push(optional == null ? def : optional); + } + for (var i = args.length; i < argcount; i++) {args.push(this.GetArgument(name))} + macro = this.SubstituteArgs(args,macro); + } + this.string = this.AddArgs(macro,this.string.slice(this.i)); + this.i = 0; + if (++this.macroCount > TEX.config.MAXMACROS) { + TEX.Error(["MaxMacroSub1", + "MathJax maximum macro substitution count exceeded; " + + "is there a recursive macro call?"]); + } + }, + + Matrix: function (name,open,close,align,spacing,vspacing,style,cases,numbered) { + var c = this.GetNext(); + if (c === "") + {TEX.Error(["MissingArgFor","Missing argument for %1",name])} + if (c === "{") {this.i++} else {this.string = c+"}"+this.string.slice(this.i+1); this.i = 0} + var array = STACKITEM.array().With({ + requireClose: true, + arraydef: { + rowspacing: (vspacing||"4pt"), + columnspacing: (spacing||"1em") + } + }); + if (cases) {array.isCases = true} + if (numbered) {array.isNumbered = true; array.arraydef.side = numbered} + if (open || close) {array.open = open; array.close = close} + if (style === "D") {array.arraydef.displaystyle = true} + if (align != null) {array.arraydef.columnalign = align} + this.Push(array); + }, + + Entry: function (name) { + this.Push(STACKITEM.cell().With({isEntry: true, name: name})); + if (this.stack.Top().isCases) { + // + // Make second column be in \text{...} (unless it is already + // in a \text{...}, for backward compatibility). + // + var string = this.string; + var braces = 0, close = -1, i = this.i, m = string.length; + // + // Look through the string character by character... + // + while (i < m) { + var c = string.charAt(i); + if (c === "{") { + // + // Increase the nested brace count and go on + // + braces++; + i++; + } else if (c === "}") { + // + // If there are too many close braces, just end (we will get an + // error message later when the rest of the string is parsed) + // Otherwise + // decrease the nested brace count, + // if it is now zero and we haven't already marked the end of the + // first brace group, record the position (use to check for \text{} later) + // go on to the next character. + // + if (braces === 0) { + m = 0; + } else { + braces--; + if (braces === 0 && close < 0) { + close = i - this.i; + } + i++; + } + } else if (c === "&" && braces === 0) { + // + // Extra alignment tabs are not allowed in cases + // + TEX.Error(["ExtraAlignTab","Extra alignment tab in \\cases text"]); + } else if (c === "\\") { + // + // If the macro is \cr or \\, end the search, otherwise skip the macro + // (multi-letter names don't matter, as we will skip the rest of the + // characters in the main loop) + // + if (string.substr(i).match(/^((\\cr)[^a-zA-Z]|\\\\)/)) {m = 0} else {i += 2} + } else { + // + // Go on to the next character + // + i++; + } + } + // + // Check if the second column text is already in \text{}, + // If not, process the second column as text and continue parsing from there, + // (otherwise process the second column as normal, since it is in \text{} + // + var text = string.substr(this.i,i-this.i); + if (!text.match(/^\s*\\text[^a-zA-Z]/) || close !== text.replace(/\s+$/,'').length - 1) { + this.Push.apply(this,this.InternalMath(text,0)); + this.i = i; + } + } + }, + + Cr: function (name) { + this.Push(STACKITEM.cell().With({isCR: true, name: name})); + }, + + CrLaTeX: function (name, nobrackets) { + var n; + if (!nobrackets && this.string.charAt(this.i) === "[") { + n = this.GetBrackets(name,"").replace(/ /g,"").replace(/,/,"."); + if (n && !this.matchDimen(n)) { + TEX.Error(["BracketMustBeDimension", + "Bracket argument to %1 must be a dimension",name]); + } + } + this.Push(STACKITEM.cell().With({isCR: true, name: name, linebreak: true})); + var top = this.stack.Top(); + if (top.isa(STACKITEM.array)) { + if (n && top.arraydef.rowspacing) { + var rows = top.arraydef.rowspacing.split(/ /); + if (!top.rowspacing) {top.rowspacing = this.dimen2em(rows[0])} + while (rows.length < top.table.length) {rows.push(this.Em(top.rowspacing))} + rows[top.table.length-1] = this.Em(Math.max(0,top.rowspacing+this.dimen2em(n))); + top.arraydef.rowspacing = rows.join(' '); + } + } else { + if (n) {this.Push(MML.mspace().With({depth:n}))} + this.Push(MML.mspace().With({linebreak:MML.LINEBREAK.NEWLINE})); + } + }, + emPerInch: 7.2, + pxPerInch: 72, + matchDimen: function (dim) { + return dim.match(/^(-?(?:\.\d+|\d+(?:\.\d*)?))(px|pt|em|ex|mu|pc|in|mm|cm)$/); + }, + dimen2em: function (dim) { + var match = this.matchDimen(dim); + var m = parseFloat(match[1]||"1"), unit = match[2]; + if (unit === "em") {return m} + if (unit === "ex") {return m * .43} + if (unit === "pt") {return m / 10} // 10 pt to an em + if (unit === "pc") {return m * 1.2} // 12 pt to a pc + if (unit === "px") {return m * this.emPerInch / this.pxPerInch} + if (unit === "in") {return m * this.emPerInch} + if (unit === "cm") {return m * this.emPerInch / 2.54} // 2.54 cm to an inch + if (unit === "mm") {return m * this.emPerInch / 25.4} // 10 mm to a cm + if (unit === "mu") {return m / 18} + return 0; + }, + Em: function (m) { + if (Math.abs(m) < .0006) {return "0em"} + return m.toFixed(3).replace(/\.?0+$/,"") + "em"; + }, + + HLine: function (name,style) { + if (style == null) {style = "solid"} + var top = this.stack.Top(); + if (!top.isa(STACKITEM.array) || top.data.length) + {TEX.Error(["Misplaced","Misplaced %1",name])} + if (top.table.length == 0) { + top.frame.push("top"); + } else { + var lines = (top.arraydef.rowlines ? top.arraydef.rowlines.split(/ /) : []); + while (lines.length < top.table.length) {lines.push("none")} + lines[top.table.length-1] = style; + top.arraydef.rowlines = lines.join(' '); + } + }, + + HFill: function (name) { + var top = this.stack.Top(); + if (top.isa(STACKITEM.array)) top.hfill.push(top.data.length); + else TEX.Error(["UnsupportedHFill","Unsupported use of %1",name]); + }, + + + + /************************************************************************/ + /* + * LaTeX environments + */ + + BeginEnd: function (name) { + var env = this.GetArgument(name), isEnd = false; + if (env.match(/^\\end\\/)) {isEnd = true; env = env.substr(5)} // special \end{} for \newenvironment environments + if (env.match(/\\/i)) {TEX.Error(["InvalidEnv","Invalid environment name '%1'",env])} + var cmd = this.envFindName(env); + if (!cmd) {TEX.Error(["UnknownEnv","Unknown environment '%1'",env])} + if (!isArray(cmd)) {cmd = [cmd]} + var end = (isArray(cmd[1]) ? cmd[1][0] : cmd[1]); + var mml = STACKITEM.begin().With({name: env, end: end, parse:this}); + if (name === "\\end") { + if (!isEnd && isArray(cmd[1]) && this[cmd[1][1]]) { + mml = this[cmd[1][1]].apply(this,[mml].concat(cmd.slice(2))); + } else { + mml = STACKITEM.end().With({name: env}); + } + } else { + if (++this.macroCount > TEX.config.MAXMACROS) { + TEX.Error(["MaxMacroSub2", + "MathJax maximum substitution count exceeded; " + + "is there a recursive latex environment?"]); + } + if (cmd[0] && this[cmd[0]]) {mml = this[cmd[0]].apply(this,[mml].concat(cmd.slice(2)))} + } + this.Push(mml); + }, + envFindName: function (name) { + return (TEXDEF.environment.hasOwnProperty(name) ? TEXDEF.environment[name] : null); + }, + + Equation: function (begin,row) {return row}, + + ExtensionEnv: function (begin,file) {this.Extension(begin.name,file,"environment")}, + + Array: function (begin,open,close,align,spacing,vspacing,style,raggedHeight) { + if (!align) {align = this.GetArgument("\\begin{"+begin.name+"}")} + var lines = ("c"+align).replace(/[^clr|:]/g,'').replace(/[^|:]([|:])+/g,'$1'); + align = align.replace(/[^clr]/g,'').split('').join(' '); + align = align.replace(/l/g,'left').replace(/r/g,'right').replace(/c/g,'center'); + var array = STACKITEM.array().With({ + arraydef: { + columnalign: align, + columnspacing: (spacing||"1em"), + rowspacing: (vspacing||"4pt") + } + }); + if (lines.match(/[|:]/)) { + if (lines.charAt(0).match(/[|:]/)) {array.frame.push("left"); array.frame.dashed = lines.charAt(0) === ":"} + if (lines.charAt(lines.length-1).match(/[|:]/)) {array.frame.push("right")} + lines = lines.substr(1,lines.length-2); + array.arraydef.columnlines = + lines.split('').join(' ').replace(/[^|: ]/g,'none').replace(/\|/g,'solid').replace(/:/g,'dashed'); + } + if (open) {array.open = this.convertDelimiter(open)} + if (close) {array.close = this.convertDelimiter(close)} + if (style === "D") {array.arraydef.displaystyle = true} + else if (style) {array.arraydef.displaystyle = false} + if (style === "S") {array.arraydef.scriptlevel = 1} // FIXME: should use mstyle? + if (raggedHeight) {array.arraydef.useHeight = false} + this.Push(begin); + return array; + }, + + AlignedArray: function (begin) { + var align = this.GetBrackets("\\begin{"+begin.name+"}"); + return this.setArrayAlign(this.Array.apply(this,arguments),align); + }, + setArrayAlign: function (array,align) { + align = this.trimSpaces(align||""); + if (align === "t") {array.arraydef.align = "baseline 1"} + else if (align === "b") {array.arraydef.align = "baseline -1"} + else if (align === "c") {array.arraydef.align = "center"} + else if (align) {array.arraydef.align = align} // FIXME: should be an error? + return array; + }, + + /************************************************************************/ + /* + * String handling routines + */ + + /* + * Convert delimiter to character + */ + convertDelimiter: function (c) { + if (c) {c = (TEXDEF.delimiter.hasOwnProperty(c) ? TEXDEF.delimiter[c] : null)} + if (c == null) {return null} + if (isArray(c)) {c = c[0]} + if (c.length === 4) {c = String.fromCharCode(parseInt(c,16))} + return c; + }, + + /* + * Trim spaces from a string + */ + trimSpaces: function (text) { + if (typeof(text) != 'string') {return text} + var TEXT = text.replace(/^\s+|\s+$/g,''); + if (TEXT.match(/\\$/) && text.match(/ $/)) TEXT += " "; + return TEXT; + }, + + /* + * Check if the next character is a space + */ + nextIsSpace: function () { + return this.string.charAt(this.i).match(/\s/); + }, + + /* + * Get the next non-space character + */ + GetNext: function () { + while (this.nextIsSpace()) {this.i++} + return this.string.charAt(this.i); + }, + + /* + * Get and return a control-sequence name + */ + GetCS: function () { + var CS = this.string.slice(this.i).match(/^([a-z]+|.) ?/i); + if (CS) {this.i += CS[1].length; return CS[1]} else {this.i++; return " "} + }, + + /* + * Get and return a TeX argument (either a single character or control sequence, + * or the contents of the next set of braces). + */ + GetArgument: function (name,noneOK) { + switch (this.GetNext()) { + case "": + if (!noneOK) {TEX.Error(["MissingArgFor","Missing argument for %1",name])} + return null; + case '}': + if (!noneOK) { + TEX.Error(["ExtraCloseMissingOpen", + "Extra close brace or missing open brace"]); + } + return null; + case '\\': + this.i++; return "\\"+this.GetCS(); + case '{': + var j = ++this.i, parens = 1; + while (this.i < this.string.length) { + switch (this.string.charAt(this.i++)) { + case '\\': this.i++; break; + case '{': parens++; break; + case '}': + if (--parens == 0) {return this.string.slice(j,this.i-1)} + break; + } + } + TEX.Error(["MissingCloseBrace","Missing close brace"]); + break; + } + return this.string.charAt(this.i++); + }, + + /* + * Get an optional LaTeX argument in brackets + */ + GetBrackets: function (name,def) { + if (this.GetNext() != '[') {return def}; + var j = ++this.i, parens = 0; + while (this.i < this.string.length) { + switch (this.string.charAt(this.i++)) { + case '{': parens++; break; + case '\\': this.i++; break; + case '}': + if (parens-- <= 0) { + TEX.Error(["ExtraCloseLooking", + "Extra close brace while looking for %1","']'"]); + } + break; + case ']': + if (parens == 0) {return this.string.slice(j,this.i-1)} + break; + } + } + TEX.Error(["MissingCloseBracket", + "Couldn't find closing ']' for argument to %1",name]); + }, + + /* + * Get the name of a delimiter (check it in the delimiter list). + */ + GetDelimiter: function (name,braceOK) { + while (this.nextIsSpace()) {this.i++} + var c = this.string.charAt(this.i); this.i++; + if (this.i <= this.string.length) { + if (c == "\\") { + c += this.GetCS(name); + } else if (c === "{" && braceOK) { + this.i--; + c = this.GetArgument(name).replace(/^\s+/,'').replace(/\s+$/,''); + } + if (TEXDEF.delimiter.hasOwnProperty(c)) {return this.convertDelimiter(c)} + } + TEX.Error(["MissingOrUnrecognizedDelim", + "Missing or unrecognized delimiter for %1",name]); + }, + + /* + * Get a dimension (including its units). + */ + GetDimen: function (name) { + var dimen; + if (this.nextIsSpace()) {this.i++} + if (this.string.charAt(this.i) == '{') { + dimen = this.GetArgument(name); + if (dimen.match(/^\s*([-+]?([.,]\d+|\d+([.,]\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)\s*$/)) + {return dimen.replace(/ /g,"").replace(/,/,".")} + } else { + dimen = this.string.slice(this.i); + var match = dimen.match(/^\s*(([-+]?([.,]\d+|\d+([.,]\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)) ?/); + if (match) { + this.i += match[0].length; + return match[1].replace(/ /g,"").replace(/,/,"."); + } + } + TEX.Error(["MissingDimOrUnits", + "Missing dimension or its units for %1",name]); + }, + + /* + * Get everything up to the given control sequence (token) + */ + GetUpTo: function (name,token) { + while (this.nextIsSpace()) {this.i++} + var j = this.i, k, c, parens = 0; + while (this.i < this.string.length) { + k = this.i; c = this.string.charAt(this.i++); + switch (c) { + case '\\': c += this.GetCS(); break; + case '{': parens++; break; + case '}': + if (parens == 0) { + TEX.Error(["ExtraCloseLooking", + "Extra close brace while looking for %1",token]) + } + parens--; + break; + } + if (parens == 0 && c == token) {return this.string.slice(j,k)} + } + TEX.Error(["TokenNotFoundForCommand", + "Couldn't find %1 for %2",token,name]); + }, + + /* + * Parse various substrings + */ + ParseArg: function (name) {return TEX.Parse(this.GetArgument(name),this.stack.env).mml()}, + ParseUpTo: function (name,token) {return TEX.Parse(this.GetUpTo(name,token),this.stack.env).mml()}, + + /* + * Break up a string into text and math blocks + */ + InternalMath: function (text,level) { + var def = (this.stack.env.font ? {mathvariant: this.stack.env.font} : {}); + var mml = [], i = 0, k = 0, c, match = '', braces = 0; + if (text.match(/\\?[${}\\]|\\\(|\\(eq)?ref\s*\{/)) { + while (i < text.length) { + c = text.charAt(i++); + if (c === '$') { + if (match === '$' && braces === 0) { + mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i-1),{}).mml())); + match = ''; k = i; + } else if (match === '') { + if (k < i-1) mml.push(this.InternalText(text.slice(k,i-1),def)); + match = '$'; k = i; + } + } else if (c === '{' && match !== '') { + braces++; + } else if (c === '}') { + if (match === '}' && braces === 0) { + mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i),{}).mml().With(def))); + match = ''; k = i; + } else if (match !== '') { + if (braces) braces--; + } + } else if (c === '\\') { + if (match === '' && text.substr(i).match(/^(eq)?ref\s*\{/)) { + var len = RegExp["$&"].length; + if (k < i-1) mml.push(this.InternalText(text.slice(k,i-1),def)); + match = '}'; k = i-1; i += len; + } else { + c = text.charAt(i++); + if (c === '(' && match === '') { + if (k < i-2) mml.push(this.InternalText(text.slice(k,i-2),def)); + match = ')'; k = i; + } else if (c === ')' && match === ')' && braces === 0) { + mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i-2),{}).mml())); + match = ''; k = i; + } else if (c.match(/[${}\\]/) && match === '') { + i--; text = text.substr(0,i-1) + text.substr(i); // remove \ from \$, \{, \}, or \\ + } + } + } + } + if (match !== '') TEX.Error(["MathNotTerminated","Math not terminated in text box"]); + } + if (k < text.length) mml.push(this.InternalText(text.slice(k),def)); + if (level != null) { + mml = [MML.mstyle.apply(MML,mml).With({displaystyle:false,scriptlevel:level})]; + } else if (mml.length > 1) { + mml = [MML.mrow.apply(MML,mml)]; + } + return mml; + }, + InternalText: function (text,def) { + text = text.replace(/^\s+/,NBSP).replace(/\s+$/,NBSP); + return MML.mtext(MML.chars(text)).With(def); + }, + + /* + * Routines to set the macro and environment definitions + * (overridden by begingroup to make localized versions) + */ + setDef: function (name,value) {value.isUser = true; TEXDEF.macros[name] = value}, + setEnv: function (name,value) {value.isUser = true; TEXDEF.environment[name] = value}, + + /* + * Replace macro parameters with their values + */ + SubstituteArgs: function (args,string) { + var text = ''; var newstring = ''; var c; var i = 0; + while (i < string.length) { + c = string.charAt(i++); + if (c === "\\") {text += c + string.charAt(i++)} + else if (c === '#') { + c = string.charAt(i++); + if (c === '#') {text += c} else { + if (!c.match(/[1-9]/) || c > args.length) { + TEX.Error(["IllegalMacroParam", + "Illegal macro parameter reference"]); + } + newstring = this.AddArgs(this.AddArgs(newstring,text),args[c-1]); + text = ''; + } + } else {text += c} + } + return this.AddArgs(newstring,text); + }, + + /* + * Make sure that macros are followed by a space if their names + * could accidentally be continued into the following text. + */ + AddArgs: function (s1,s2) { + if (s2.match(/^[a-z]/i) && s1.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)) {s1 += ' '} + if (s1.length + s2.length > TEX.config.MAXBUFFER) { + TEX.Error(["MaxBufferSize", + "MathJax internal buffer size exceeded; is there a recursive macro call?"]); + } + return s1+s2; + } + + }); + + /************************************************************************/ + + TEX.Augment({ + Stack: STACK, Parse: PARSE, Definitions: TEXDEF, Startup: STARTUP, + + config: { + MAXMACROS: 10000, // maximum number of macro substitutions per equation + MAXBUFFER: 5*1024 // maximum size of TeX string to process + }, + + sourceMenuTitle: /*_(MathMenu)*/ ["TeXCommands","TeX Commands"], + annotationEncoding: "application/x-tex", + + prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing TeX + postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing TeX + + // + // Check if AMSmath extension must be loaded and push + // it on the extensions array, if needed + // + Config: function () { + this.SUPER(arguments).Config.apply(this,arguments); + if (this.config.equationNumbers.autoNumber !== "none") { + if (!this.config.extensions) {this.config.extensions = []} + this.config.extensions.push("AMSmath.js"); + } + }, + + // + // Convert TeX to ElementJax + // + Translate: function (script) { + var mml, isError = false, math = MathJax.HTML.getScript(script); + var display = (script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/) != null); + var data = {math:math, display:display, script:script}; + var callback = this.prefilterHooks.Execute(data); if (callback) return callback; + math = data.math; + try { + mml = TEX.Parse(math).mml(); + } catch(err) { + if (!err.texError) {throw err} + mml = this.formatError(err,math,display,script); + isError = true; + } + if (mml.isa(MML.mtable) && mml.displaystyle === "inherit") mml.displaystyle = display; // for tagged equations + if (mml.inferred) {mml = MML.apply(MathJax.ElementJax,mml.data)} else {mml = MML(mml)} + if (display) {mml.root.display = "block"} + if (isError) {mml.texError = true} + data.math = mml; + return this.postfilterHooks.Execute(data) || data.math; + }, + prefilterMath: function (math,displaystyle,script) { + return math; + }, + postfilterMath: function (math,displaystyle,script) { + this.combineRelations(math.root); + return math; + }, + formatError: function (err,math,display,script) { + var message = err.message.replace(/\n.*/,""); + HUB.signal.Post(["TeX Jax - parse error",message,math,display,script]); + return MML.Error(message); + }, + + // + // Produce an error and stop processing this equation + // + Error: function (message) { + // + // Translate message if it is ["id","message",args] + // + if (isArray(message)) {message = _.apply(_,message)} + throw HUB.Insert(Error(message),{texError: true}); + }, + + // + // Add a user-defined macro to the macro list + // + Macro: function (name,def,argn) { + TEXDEF.macros[name] = ['Macro'].concat([].slice.call(arguments,1)); + TEXDEF.macros[name].isUser = true; + }, + + /* + * Create an mrow that has stretchy delimiters at either end, as needed + */ + fenced: function (open,mml,close) { + var mrow = MML.mrow().With({open:open, close:close, texClass:MML.TEXCLASS.INNER}); + mrow.Append( + MML.mo(open).With({fence:true, stretchy:true, symmetric:true, texClass:MML.TEXCLASS.OPEN}) + ); + if (mml.type === "mrow" && mml.inferred) { + mrow.Append.apply(mrow, mml.data); + } else { + mrow.Append(mml); + } + mrow.Append( + MML.mo(close).With({fence:true, stretchy:true, symmetric:true, texClass:MML.TEXCLASS.CLOSE}) + ); + return mrow; + }, + /* + * Create an mrow that has \mathchoice using \bigg and \big for the delimiters + */ + fixedFence: function (open,mml,close) { + var mrow = MML.mrow().With({open:open, close:close, texClass:MML.TEXCLASS.ORD}); + if (open) {mrow.Append(this.mathPalette(open,"l"))} + if (mml.type === "mrow") {mrow.Append.apply(mrow,mml.data)} else {mrow.Append(mml)} + if (close) {mrow.Append(this.mathPalette(close,"r"))} + return mrow; + }, + mathPalette: function (fence,side) { + if (fence === '{' || fence === '}') {fence = "\\"+fence} + var D = '{\\bigg'+side+' '+fence+'}', T = '{\\big'+side+' '+fence+'}'; + return TEX.Parse('\\mathchoice'+D+T+T+T,{}).mml(); + }, + + // + // Combine adjacent <mo> elements that are relations + // (since MathML treats the spacing very differently) + // + combineRelations: function (mml) { + var i, m, m1, m2; + for (i = 0, m = mml.data.length; i < m; i++) { + if (mml.data[i]) { + if (mml.isa(MML.mrow)) { + while (i+1 < m && (m1 = mml.data[i]) && (m2 = mml.data[i+1]) && + m1.isa(MML.mo) && m2.isa(MML.mo) && + m1.Get("texClass") === MML.TEXCLASS.REL && + m2.Get("texClass") === MML.TEXCLASS.REL) { + if (m1.variantForm == m2.variantForm && + m1.Get("mathvariant") == m2.Get("mathvariant") && m1.style == m2.style && + m1["class"] == m2["class"] && !m1.id && !m2.id) { + m1.Append.apply(m1,m2.data); + mml.data.splice(i+1,1); m--; + } else { + m1.rspace = m2.lspace = "0pt"; i++; + } + } + } + if (!mml.data[i].isToken) {this.combineRelations(mml.data[i])} + } + } + } + }); + + // + // Add the default filters + // + TEX.prefilterHooks.Add(function (data) { + data.math = TEX.prefilterMath(data.math,data.display,data.script); + }); + TEX.postfilterHooks.Add(function (data) { + data.math = TEX.postfilterMath(data.math,data.display,data.script); + }); + + TEX.loadComplete("jax.js"); + +})(MathJax.InputJax.TeX,MathJax.Hub,MathJax.Ajax); +// @license-end |