mathjax
Version:
Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers. This package includes the packaged components (install mathjax-full to get the source
1 lines • 5.95 kB
JavaScript
(()=>{"use strict";var e={d:(t,n)=>{for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};e.r(t),e.d(t,{EmpheqUtil:()=>b});var n={};e.r(n),e.d(n,{EmpheqConfiguration:()=>f,EmpheqMethods:()=>E});const a=("undefined"!=typeof window?window:e.g).MathJax._.components.global,i=(a.GLOBAL,a.isObject,a.combineConfig,a.combineDefaults,a.combineWithMathJax),r=(a.MathJax,MathJax._.input.tex.HandlerTypes),o=r.ConfigurationType,p=r.HandlerType,h=MathJax._.input.tex.Configuration,l=h.Configuration,m=(h.ConfigurationHandler,h.ParserConfiguration,MathJax._.input.tex.TokenMap),s=(m.parseResult,m.AbstractTokenMap,m.RegExpMap,m.AbstractParseMap,m.CharacterMap,m.DelimiterMap,m.MacroMap,m.CommandMap),c=m.EnvironmentMap,d=MathJax._.input.tex.ParseUtil,g=(d.KeyValueDef,d.KeyValueTypes,d.ParseUtil),q=MathJax._.input.tex.TexError.default,u=MathJax._.input.tex.TexParser.default,b={splitOptions:(e,t=null)=>g.keyvalOptions(e,t,!0),columnCount(e){let t=0;for(const n of e.childNodes){const e=n.childNodes.length-(n.isKind("mlabeledtr")?1:0);e>t&&(t=e)}return t},cellBlock(e,t,n,a){const i=n.create("node","mpadded",[],{height:0,depth:0,voffset:"-1height"}),r=new u(e,n.stack.env,n.configuration),o=r.mml();a&&r.configuration.tags.label&&(r.configuration.tags.currentTag.env=a,r.configuration.tags.getTag(!0));for(const e of o.isInferred?o.childNodes:[o])i.appendChild(e);return i.appendChild(n.create("node","mphantom",[n.create("node","mpadded",[t],{width:0})])),i},topRowTable(e,t){const n=g.copyNode(e,t);return n.setChildren(n.childNodes.slice(0,1)),n.attributes.set("align","baseline 1"),e.factory.create("mphantom",{},[t.create("node","mpadded",[n],{width:0})])},rowspanCell(e,t,n,a,i){e.appendChild(a.create("node","mpadded",[this.cellBlock(t,g.copyNode(n,a),a,i),this.topRowTable(n,a)],{height:0,depth:0,voffset:"height"}))},left(e,t,n,a,i=""){let r;e.attributes.set("columnalign","right "+e.attributes.get("columnalign")),e.attributes.set("columnspacing","0em "+e.attributes.get("columnspacing")),0===e.childNodes.length&&e.appendChild(a.create("node","mtr"));for(const t of e.childNodes.slice(0).reverse())r=a.create("node","mtd"),t.childNodes.unshift(r),r.parent=t,t.isKind("mlabeledtr")&&(t.childNodes[0]=t.childNodes[1],t.childNodes[1]=r);this.rowspanCell(r,n,t,a,i)},right(e,t,n,a,i=""){0===e.childNodes.length&&e.appendChild(a.create("node","mtr"));const r=e.childNodes[0],o=b.columnCount(e)+(r.isKind("mlabeledtr")?1:0);for(;r.childNodes.length<o;)r.appendChild(a.create("node","mtd"));const p=r.appendChild(a.create("node","mtd"));b.rowspanCell(p,n,t,a,i),e.attributes.set("columnalign",(e.attributes.get("columnalign")||"").split(/ /).slice(0,o).join(" ")+" left"),e.attributes.set("columnspacing",e.attributes.get("columnspacing").split(/ /).slice(0,o-1).join(" ")+" 0em")},adjustTable(e,t){const n=e.getProperty("left"),a=e.getProperty("right");if(n||a){const i=e.Last,r=g.copyNode(i,t);n&&this.left(i,r,n,t),a&&this.right(i,r,a,t)}},allowEnv:{equation:!0,align:!0,gather:!0,flalign:!0,alignat:!0,multline:!0},checkEnv(e){return Object.hasOwn(this.allowEnv,e.replace(/\*$/,""))||!1}},M=MathJax._.input.tex.ParseMethods.default,E={Empheq(e,t){if(e.stack.env.closing===t.getName()){delete e.stack.env.closing,e.Push(e.itemFactory.create("end").setProperty("name",e.stack.global.empheq)),e.stack.global.empheq="";const t=e.stack.Top();b.adjustTable(t,e),e.Push(e.itemFactory.create("end").setProperty("name","empheq"))}else{g.checkEqnEnv(e);const n=e.GetBrackets("\\begin{"+t.getName()+"}")||"",[a,i]=e.GetArgument("\\begin{"+t.getName()+"}").split(/=/);if(!b.checkEnv(a))throw new q("EmpheqInvalidEnv",'Invalid environment "%1" for %2',a,t.getName());t.setProperty("nestStart",!0),n&&t.setProperties(b.splitOptions(n,{left:1,right:1})),e.stack.global.empheq=a,e.string="\\begin{"+a+"}"+(i?"{"+i+"}":"")+e.string.slice(e.i),e.i=0,e.Push(t)}},EmpheqMO(e,t,n){e.Push(e.create("token","mo",{},n))},EmpheqDelim(e,t){const n=e.GetDelimiter(t);e.Push(e.create("token","mo",{stretchy:!0,symmetric:!0},n))}};new c("empheq-env",M.environment,{empheq:[E.Empheq,"empheq"]}),new s("empheq-macros",{empheqlbrace:[E.EmpheqMO,"{"],empheqrbrace:[E.EmpheqMO,"}"],empheqlbrack:[E.EmpheqMO,"["],empheqrbrack:[E.EmpheqMO,"]"],empheqlangle:[E.EmpheqMO,"\u27e8"],empheqrangle:[E.EmpheqMO,"\u27e9"],empheqlparen:[E.EmpheqMO,"("],empheqrparen:[E.EmpheqMO,")"],empheqlvert:[E.EmpheqMO,"|"],empheqrvert:[E.EmpheqMO,"|"],empheqlVert:[E.EmpheqMO,"\u2016"],empheqrVert:[E.EmpheqMO,"\u2016"],empheqlfloor:[E.EmpheqMO,"\u230a"],empheqrfloor:[E.EmpheqMO,"\u230b"],empheqlceil:[E.EmpheqMO,"\u2308"],empheqrceil:[E.EmpheqMO,"\u2309"],empheqbiglbrace:[E.EmpheqMO,"{"],empheqbigrbrace:[E.EmpheqMO,"}"],empheqbiglbrack:[E.EmpheqMO,"["],empheqbigrbrack:[E.EmpheqMO,"]"],empheqbiglangle:[E.EmpheqMO,"\u27e8"],empheqbigrangle:[E.EmpheqMO,"\u27e9"],empheqbiglparen:[E.EmpheqMO,"("],empheqbigrparen:[E.EmpheqMO,")"],empheqbiglvert:[E.EmpheqMO,"|"],empheqbigrvert:[E.EmpheqMO,"|"],empheqbiglVert:[E.EmpheqMO,"\u2016"],empheqbigrVert:[E.EmpheqMO,"\u2016"],empheqbiglfloor:[E.EmpheqMO,"\u230a"],empheqbigrfloor:[E.EmpheqMO,"\u230b"],empheqbiglceil:[E.EmpheqMO,"\u2308"],empheqbigrceil:[E.EmpheqMO,"\u2309"],empheql:E.EmpheqDelim,empheqr:E.EmpheqDelim,empheqbigl:E.EmpheqDelim,empheqbigr:E.EmpheqDelim});const f=l.create("empheq",{[o.HANDLER]:{[p.MACRO]:["empheq-macros"],[p.ENVIRONMENT]:["empheq-env"]}});MathJax.loader&&MathJax.loader.checkVersion("[tex]/empheq","4.1.0","tex-extension"),i({_:{input:{tex:{empheq:{EmpheqConfiguration:n,EmpheqUtil:t}}}}})})();