diff --git a/unpacked/extensions/MathML/content-mathml.js b/unpacked/extensions/MathML/content-mathml.js new file mode 100644 index 000000000..d0dbe9d7e --- /dev/null +++ b/unpacked/extensions/MathML/content-mathml.js @@ -0,0 +1,59 @@ +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/************************************************************* + * + * MathJax/extensions/MathML/content-mathml.js + * + * This extension allows HTML-CSS output to deal with floating elements + * better. In particular, when there are tags or equation numbers, these + * would overlap floating elements, but with this extension, the width of + * the line should properly correspond to the amount of space remaining. + * + * To load it, include + * + * MathML: { + * extensions: ["content-mathml.js"] + * } + * + * in your configuration. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013 Design Science, Inc. + * + * 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.Extension["MathML/content-mathml"] = { + version: "2.2" +}; + +MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { + + MathJax.InputJax.MathML.prefilterHooks.Add(function (data) { + var doc = MathJax.InputJax.MathML.ParseXML(data.math); + var newMath = MathJax.InputJax.MathML.ctopXSLT. + transformToFragment(doc.documentElement, doc); + var serializer = new XMLSerializer(); + data.math = serializer.serializeToString(newMath, doc); + }); + + var ctopStylesheet = new DOMParser().parseFromString(' +i +i / / ei ei E 0x . (-1) λ. id domain codomain image unexpected domainofapplication restriction {   if     otherwise / ! / max min (+) mod (×) gcd xor ¬ . . , || ¯ arg lcm = > < | d dddd D, + + , div div() grad grad() curl 2 () || × = lim lim tendsto e loglog , σ σ2 median mode () [|] [|] () () [m , | m , =;] () det || T , . Z R Q N C P e i NaN true false π γ () () ||, share ) ( ] [ } { ) ( ] [ } { \ )(}{>< top right ;color:;background-color:; 0 decimalpoint decimalpoint. decimalpoint*0.1em0.15em0.2em0.15em 0 /\)(:=) ', "text/xml"); + MathJax.InputJax.MathML.ctopXSLT = new XSLTProcessor(); + MathJax.InputJax.MathML.ctopXSLT.importStylesheet(ctopStylesheet); + + MathJax.Hub.Startup.signal.Post("MathML content-mathml Ready"); +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/MathML/content-mathml.js");