Merge branch 'tex-fixes' into v2.0-candidate
This commit is contained in:
commit
45d81dfc3e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
(function(){var c="1.1";var a=MathJax.Hub.CombineConfig("TeX.noErrors",{multiLine:true,inlineDelimiters:["",""],style:{"font-family":"serif","font-size":"80%","text-align":"left",color:"black",padding:"1px 3px",border:"1px solid"}});var b="\u00A0";MathJax.Extension["TeX/noErrors"]={version:c,config:a};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){MathJax.InputJax.TeX.Augment({formatError:function(f,e,g,d){var i=a.inlineDelimiters;var h=(g||a.multiLine);if(!g){e=i[0]+e+i[1]}if(h){e=e.replace(/ /g,b)}else{e=e.replace(/\n/g," ")}return MathJax.ElementJax.mml.merror(e).With({isError:true,multiLine:h})}})});MathJax.Hub.Register.StartupHook("HTML-CSS Jax Config",function(){MathJax.Hub.Config({"HTML-CSS":{styles:{".MathJax .merror":MathJax.Hub.Insert({"font-style":null,"background-color":null,"vertical-align":(MathJax.Hub.Browser.isMSIE&&a.multiLine?"-2px":"")},a.style)}}})})})();MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.ElementJax.mml;var b=MathJax.OutputJax["HTML-CSS"];var c=a.math.prototype.toHTML;a.math.Augment({toHTML:function(d,e){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){return this.data[0].data[0].toHTML(d)}return c.call(this,d,e)}});a.merror.Augment({toHTML:function(j){if(!this.isError){return a.mbase.prototype.toHTML.call(this,j)}j=this.HTMLcreateSpan(j);if(this.multiLine){j.style.display="inline-block"}var l=this.data[0].data[0].data.join("").split(/\n/);for(var g=0,e=l.length;g<e;g++){b.addText(j,l[g]);if(g!==e-1){b.addElement(j,"br")}}var n=b.getHD(j.parentNode),d=b.getW(j.parentNode);if(e>1){var k=(n.h+n.d)/2,h=b.TeX.x_height/2;var f=b.config.styles[".MathJax .merror"]["font-size"];if(f&&f.match(/%/)){h*=parseInt(f)/100}j.parentNode.style.verticalAlign=b.Em(n.d+(h-k));n.h=h+k;n.d=k-h}j.bbox={h:n.h,d:n.d,w:d,lw:0,rw:d};return j}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.Hub.Register.StartupHook("NativeMML Jax Ready",function(){var b=MathJax.ElementJax.mml;var a=MathJax.Extension["TeX/noErrors"].config;var c=b.math.prototype.toNativeMML;b.math.Augment({toNativeMML:function(d){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){return this.data[0].data[0].toNativeMML(d)}return c.call(this,d)}});b.merror.Augment({toNativeMML:function(g){if(!this.isError){return b.mbase.prototype.toNativeMML.call(this,g)}g=g.appendChild(document.createElement("span"));var h=this.data[0].data[0].data.join("").split(/\n/);for(var f=0,e=h.length;f<e;f++){g.appendChild(document.createTextNode(h[f]));if(f!==e-1){g.appendChild(document.createElement("br"))}}if(this.multiLine){g.style.display="inline-block";if(e>1){g.style.verticalAlign="middle"}}for(var j in a.style){if(a.style.hasOwnProperty(j)){var d=j.replace(/-./g,function(i){return i.charAt(1).toUpperCase()});g.style[d]=a.style[j]}}return g}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noErrors.js");
|
||||
(function(){var c="1.1.1";var a=MathJax.Hub.CombineConfig("TeX.noErrors",{multiLine:true,inlineDelimiters:["",""],style:{"font-size":"80%","text-align":"left",color:"black",padding:"1px 3px",border:"1px solid"}});var b="\u00A0";MathJax.Extension["TeX/noErrors"]={version:c,config:a};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){MathJax.InputJax.TeX.Augment({formatError:function(f,e,g,d){var i=a.inlineDelimiters;var h=(g||a.multiLine);if(!g){e=i[0]+e+i[1]}if(h){e=e.replace(/ /g,b)}else{e=e.replace(/\n/g," ")}return MathJax.ElementJax.mml.merror(e).With({isError:true,multiLine:h})}})});MathJax.Hub.Register.StartupHook("HTML-CSS Jax Config",function(){MathJax.Hub.Config({"HTML-CSS":{styles:{".MathJax .merror":MathJax.Hub.Insert({"font-style":null,"background-color":null,"vertical-align":(MathJax.Hub.Browser.isMSIE&&a.multiLine?"-2px":"")},a.style)}}})})})();MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.ElementJax.mml;var b=MathJax.OutputJax["HTML-CSS"];var c=a.math.prototype.toHTML;a.math.Augment({toHTML:function(d,e){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){return this.data[0].data[0].toHTML(d)}return c.call(this,d,e)}});a.merror.Augment({toHTML:function(j){if(!this.isError){return a.mbase.prototype.toHTML.call(this,j)}j=this.HTMLcreateSpan(j);if(this.multiLine){j.style.display="inline-block"}var l=this.data[0].data[0].data.join("").split(/\n/);for(var g=0,e=l.length;g<e;g++){b.addText(j,l[g]);if(g!==e-1){b.addElement(j,"br")}}var n=b.getHD(j.parentNode),d=b.getW(j.parentNode);if(e>1){var k=(n.h+n.d)/2,h=b.TeX.x_height/2;var f=b.config.styles[".MathJax .merror"]["font-size"];if(f&&f.match(/%/)){h*=parseInt(f)/100}j.parentNode.style.verticalAlign=b.Em(n.d+(h-k));n.h=h+k;n.d=k-h}j.bbox={h:n.h,d:n.d,w:d,lw:0,rw:d};return j}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.Hub.Register.StartupHook("NativeMML Jax Ready",function(){var b=MathJax.ElementJax.mml;var a=MathJax.Extension["TeX/noErrors"].config;var c=b.math.prototype.toNativeMML;b.math.Augment({toNativeMML:function(d){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){return this.data[0].data[0].toNativeMML(d)}return c.call(this,d)}});b.merror.Augment({toNativeMML:function(g){if(!this.isError){return b.mbase.prototype.toNativeMML.call(this,g)}g=g.appendChild(document.createElement("span"));var h=this.data[0].data[0].data.join("").split(/\n/);for(var f=0,e=h.length;f<e;f++){g.appendChild(document.createTextNode(h[f]));if(f!==e-1){g.appendChild(document.createElement("br"))}}if(this.multiLine){g.style.display="inline-block";if(e>1){g.style.verticalAlign="middle"}}for(var j in a.style){if(a.style.hasOwnProperty(j)){var d=j.replace(/-./g,function(i){return i.charAt(1).toUpperCase()});g.style[d]=a.style[j]}}return g}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noErrors.js");
|
||||
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Extension["TeX/unicode"]={version:"1.1",unicode:{},config:MathJax.Hub.CombineConfig("TeX.unicode",{fonts:"STIXGeneral,'Arial Unicode MS'"})};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var d=MathJax.InputJax.TeX;var a=MathJax.ElementJax.mml;var c=MathJax.Extension["TeX/unicode"].config.fonts;var b=MathJax.Extension["TeX/unicode"].unicode;d.Definitions.macros.unicode="Unicode";d.Parse.Augment({Unicode:function(f){var j=this.GetBrackets(f),e;if(j){j=j.replace(/ /g,"");if(j.match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)){j=j.split(/,/);e=this.GetBrackets(f)}else{e=j;j=null}}var k=this.trimSpaces(this.GetArgument(f)),i=parseInt(k.match(/^x/)?"0"+k:k);b[i]=[800,200,500,0,500,{isUnknown:true,isUnicode:true,font:c}];if(j){b[i][0]=Math.floor(j[0]*1000);b[i][1]=Math.floor(j[1]*1000)}var g=this.stack.env.font,h={};if(e){h.fontfamily=e;if(g){if(g.match(/bold/)){h.fontweight="bold"}if(g.match(/italic/)){h.fontstyle="italic"}}b[i][5].font=e+","+c}else{if(g){h.mathvariant=g}}this.Push(a.mtext(a.entity("#"+k)).With(h))}})});MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.OutputJax["HTML-CSS"];var c=MathJax.Extension["TeX/unicode"].unicode;var b=a.lookupChar;a.Augment({lookupChar:function(e,f){var d=b.call(this,e,f);if(d[f][5]&&d[f][5].isUnknown&&c[f]){d[f]=c[f]}return d}});MathJax.Hub.Startup.signal.Post("TeX unicode Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/unicode.js");
|
||||
MathJax.Extension["TeX/unicode"]={version:"1.1",unicode:{},config:MathJax.Hub.CombineConfig("TeX.unicode",{fonts:"STIXGeneral,'Arial Unicode MS'"})};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var d=MathJax.InputJax.TeX;var a=MathJax.ElementJax.mml;var c=MathJax.Extension["TeX/unicode"].config.fonts;var b=MathJax.Extension["TeX/unicode"].unicode;d.Definitions.macros.unicode="Unicode";d.Parse.Augment({Unicode:function(f){var j=this.GetBrackets(f),e;if(j){if(j.replace(/ /g,"").match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)){j=j.replace(/ /g,"").split(/,/);e=this.GetBrackets(f)}else{e=j;j=null}}var k=this.trimSpaces(this.GetArgument(f)),i=parseInt(k.match(/^x/)?"0"+k:k);b[i]=[800,200,500,0,500,{isUnknown:true,isUnicode:true,font:c}];if(j){b[i][0]=Math.floor(j[0]*1000);b[i][1]=Math.floor(j[1]*1000)}var g=this.stack.env.font,h={};if(e){h.fontfamily=e.replace(/"/g,"'");if(g){if(g.match(/bold/)){h.fontweight="bold"}if(g.match(/italic/)){h.fontstyle="italic"}}b[i][5].font=e+","+c}else{if(g){h.mathvariant=g}}this.Push(a.mtext(a.entity("#"+k)).With(h))}})});MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.OutputJax["HTML-CSS"];var c=MathJax.Extension["TeX/unicode"].unicode;var b=a.lookupChar;a.Augment({lookupChar:function(e,f){var d=b.call(this,e,f);if(d[f][5]&&d[f][5].isUnknown&&c[f]){d[f]=c[f]}return d}});MathJax.Hub.Startup.signal.Post("TeX unicode Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/unicode.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.InputJax.TeX=MathJax.InputJax({id:"TeX",version:"1.1.1",directory:MathJax.InputJax.directory+"/TeX",extensionDir:MathJax.InputJax.extensionDir+"/TeX",config:{TagSide:"right",TagIndent:"0.8em",MultLineWidth:"85%"}});MathJax.InputJax.TeX.Register("math/tex");MathJax.InputJax.TeX.loadComplete("config.js");
|
||||
MathJax.InputJax.TeX=MathJax.InputJax({id:"TeX",version:"1.1.7",directory:MathJax.InputJax.directory+"/TeX",extensionDir:MathJax.InputJax.extensionDir+"/TeX",config:{TagSide:"right",TagIndent:"0.8em",MultLineWidth:"85%"}});MathJax.InputJax.TeX.Register("math/tex");MathJax.InputJax.TeX.loadComplete("config.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||
var VERSION = "1.1";
|
||||
var VERSION = "1.1.1";
|
||||
|
||||
var MML = MathJax.ElementJax.mml;
|
||||
var TEX = MathJax.InputJax.TeX;
|
||||
|
@ -97,8 +97,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
'alignat*': ['AlignAt',null,false,true],
|
||||
alignedat: ['AlignAt',null,false,false],
|
||||
|
||||
aligned: ['Array',null,null,null,'rlrlrlrlrlrl',COLS([5/18,2,5/18,2,5/18,2,5/18,2,5/18,2,5/18]),".5em",'D'],
|
||||
gathered: ['Array',null,null,null,'c',null,".5em",'D'],
|
||||
aligned: ['ArrayII',null,null,null,'rlrlrlrlrlrl',COLS([5/18,2,5/18,2,5/18,2,5/18,2,5/18,2,5/18]),".5em",'D'],
|
||||
gathered: ['ArrayII',null,null,null,'c',null,".5em",'D'],
|
||||
|
||||
subarray: ['Array',null,null,null,null,COLS([0,0,0,0]),"0.1em",'S',1],
|
||||
smallmatrix: ['Array',null,null,null,'c',COLS([1/3]),".2em",'S',1]
|
||||
|
@ -202,7 +202,6 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
if (STYLE === "D") {frac.displaystyle = true; frac.scriptlevel = 0}
|
||||
else {frac.displaystyle = false; frac.scriptlevel = style - 1}
|
||||
}
|
||||
|
||||
this.Push(frac);
|
||||
},
|
||||
|
||||
|
@ -242,6 +241,16 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
});
|
||||
},
|
||||
|
||||
ArrayII: function (begin) {
|
||||
var align = this.GetBrackets("\\begin{"+begin.name+"}");
|
||||
var array = this.Array.apply(this,arguments);
|
||||
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;
|
||||
},
|
||||
|
||||
AlignAt: function (begin,numbered,taggable) {
|
||||
var n = this.GetArgument("\\begin{"+begin.name+"}");
|
||||
if (n.match(/[^0-9]/)) {TEX.Error("Argument to \\begin{"+begin.name+"} must me a positive integer")}
|
||||
|
|
|
@ -148,7 +148,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
backsim: '223D',
|
||||
thicksim: ['223C',{variantForm: true}],
|
||||
backsimeq: '22CD',
|
||||
thickapprox: '2248',
|
||||
thickapprox: ['2248',{variantForm: true}],
|
||||
subseteqq: '2AC5',
|
||||
supseteqq: '2AC6',
|
||||
Subset: '22D0',
|
||||
|
|
|
@ -67,13 +67,12 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
var VERSION = "1.1";
|
||||
var VERSION = "1.1.1";
|
||||
|
||||
var CONFIG = MathJax.Hub.CombineConfig("TeX.noErrors",{
|
||||
multiLine: true,
|
||||
inlineDelimiters: ["",""], // or use ["$","$"] or ["\\(","\\)"]
|
||||
style: {
|
||||
"font-family": "serif",
|
||||
"font-size": "80%",
|
||||
"text-align": "left",
|
||||
"color": "black",
|
||||
|
|
|
@ -83,9 +83,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
Unicode: function(name) {
|
||||
var HD = this.GetBrackets(name), font;
|
||||
if (HD) {
|
||||
HD = HD.replace(/ /g,"");
|
||||
if (HD.match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/))
|
||||
{HD = HD.split(/,/); font = this.GetBrackets(name)} else {font = HD; HD = null}
|
||||
if (HD.replace(/ /g,"").match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/))
|
||||
{HD = HD.replace(/ /g,"").split(/,/); font = this.GetBrackets(name)}
|
||||
else {font = HD; HD = null}
|
||||
}
|
||||
var n = this.trimSpaces(this.GetArgument(name)),
|
||||
N = parseInt(n.match(/^x/) ? "0"+n : n);
|
||||
|
@ -96,7 +96,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
}
|
||||
var variant = this.stack.env.font, def = {};
|
||||
if (font) {
|
||||
def.fontfamily = font;
|
||||
def.fontfamily = font.replace(/"/g,"'");
|
||||
if (variant) {
|
||||
if (variant.match(/bold/)) {def.fontweight = "bold"}
|
||||
if (variant.match(/italic/)) {def.fontstyle = "italic"}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
MathJax.Extension.tex2jax = {
|
||||
version: "1.1.3",
|
||||
version: "1.1.4",
|
||||
config: {
|
||||
inlineMath: [ // The start/stop pairs for in-line math
|
||||
// ['$','$'], // (comment out any you don't want, or add your own, but
|
||||
|
@ -117,7 +117,7 @@ MathJax.Extension.tex2jax = {
|
|||
},
|
||||
|
||||
scanElement: function (element,stop,ignore) {
|
||||
var cname, tname, ignoreChild;
|
||||
var cname, tname, ignoreChild, process;
|
||||
while (element && element != stop) {
|
||||
if (element.nodeName.toLowerCase() === '#text') {
|
||||
if (!ignore) {element = this.scanText(element)}
|
||||
|
@ -125,8 +125,10 @@ MathJax.Extension.tex2jax = {
|
|||
cname = (typeof(element.className) === "undefined" ? "" : element.className);
|
||||
tname = (typeof(element.tagName) === "undefined" ? "" : element.tagName);
|
||||
if (typeof(cname) !== "string") {cname = String(cname)} // jsxgraph uses non-string class names!
|
||||
if (element.firstChild && !cname.match(/(^| )MathJax/) && !this.skipTags.exec(tname)) {
|
||||
ignoreChild = (ignore || this.ignoreClass.exec(cname)) && !this.processClass.exec(cname);
|
||||
process = this.processClass.exec(cname);
|
||||
if (element.firstChild && !cname.match(/(^| )MathJax/) &&
|
||||
(process || !this.skipTags.exec(tname))) {
|
||||
ignoreChild = (ignore || this.ignoreClass.exec(cname)) && !process;
|
||||
this.scanElement(element.firstChild,stop,ignoreChild);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -545,7 +545,7 @@ MathJax.ElementJax.mml.Augment({
|
|||
setTeXclass: function (prev) {
|
||||
this.getValues("lspace","rspace"); // sets useMMLspacing
|
||||
if (this.useMMLspacing) {this.texClass = MML.TEXCLASS.NONE; return this}
|
||||
this.texClass = this.Get("texClass");
|
||||
this.texClass = this.Get("texClass"); if (this.texClass === MML.TEXCLASS.NONE) {return prev}
|
||||
if (prev) {this.prevClass = prev.texClass || MML.TEXCLASS.ORD; this.prevLevel = prev.Get("scriptlevel")}
|
||||
else {this.prevClass = MML.TEXCLASS.NONE}
|
||||
if (this.texClass === MML.TEXCLASS.BIN &&
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
MathJax.InputJax.TeX = MathJax.InputJax({
|
||||
id: "TeX",
|
||||
version: "1.1.1",
|
||||
version: "1.1.7",
|
||||
directory: MathJax.InputJax.directory + "/TeX",
|
||||
extensionDir: MathJax.InputJax.extensionDir + "/TeX",
|
||||
|
||||
|
|
|
@ -264,6 +264,11 @@
|
|||
this.arraydef.rowlines += " none";
|
||||
}
|
||||
}
|
||||
if (this.rowspacing) {
|
||||
var rows = this.arraydef.rowspacing.split(/ /);
|
||||
while (rows.length < this.table.length) {rows.push(this.rowspacing)}
|
||||
this.arraydef.rowspacing = rows.join(' ');
|
||||
}
|
||||
},
|
||||
clearEnv: function () {
|
||||
for (var id in this.env) {if (this.env.hasOwnProperty(id)) {delete this.env[id]}}
|
||||
|
@ -276,17 +281,20 @@
|
|||
|
||||
STACKITEM.mml = STACKITEM.Subclass({
|
||||
type: "mml", isNotStack: TRUE,
|
||||
Push: function () {
|
||||
// embellished are type ORD in TeX (but not MML) so wrap them in TeXAtom
|
||||
for (var i = 0, m = arguments.length; i < m; i++) {
|
||||
if (arguments[i].type !== "mo" && arguments[i].isEmbellished())
|
||||
{arguments[i] = MML.TeXAtom(arguments[i]).With({isEmbellishedWrapper: TRUE})}
|
||||
}
|
||||
this.data.push.apply(this.data,arguments);
|
||||
},
|
||||
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.type !== "mml") {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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var TEXDEF = {};
|
||||
var STARTUP = function () {
|
||||
|
@ -635,43 +643,43 @@
|
|||
huge: ['SetSize',2.07],
|
||||
Huge: ['SetSize',2.49],
|
||||
|
||||
arcsin: ['NamedOp',0],
|
||||
arccos: ['NamedOp',0],
|
||||
arctan: ['NamedOp',0],
|
||||
arg: ['NamedOp',0],
|
||||
cos: ['NamedOp',0],
|
||||
cosh: ['NamedOp',0],
|
||||
cot: ['NamedOp',0],
|
||||
coth: ['NamedOp',0],
|
||||
csc: ['NamedOp',0],
|
||||
deg: ['NamedOp',0],
|
||||
arcsin: ['NamedFn'],
|
||||
arccos: ['NamedFn'],
|
||||
arctan: ['NamedFn'],
|
||||
arg: ['NamedFn'],
|
||||
cos: ['NamedFn'],
|
||||
cosh: ['NamedFn'],
|
||||
cot: ['NamedFn'],
|
||||
coth: ['NamedFn'],
|
||||
csc: ['NamedFn'],
|
||||
deg: ['NamedFn'],
|
||||
det: 'NamedOp',
|
||||
dim: ['NamedOp',0],
|
||||
exp: ['NamedOp',0],
|
||||
dim: ['NamedFn'],
|
||||
exp: ['NamedFn'],
|
||||
gcd: 'NamedOp',
|
||||
hom: ['NamedOp',0],
|
||||
hom: ['NamedFn'],
|
||||
inf: 'NamedOp',
|
||||
ker: ['NamedOp',0],
|
||||
lg: ['NamedOp',0],
|
||||
ker: ['NamedFn'],
|
||||
lg: ['NamedFn'],
|
||||
lim: 'NamedOp',
|
||||
liminf: ['NamedOp',null,'lim inf'],
|
||||
limsup: ['NamedOp',null,'lim sup'],
|
||||
ln: ['NamedOp',0],
|
||||
log: ['NamedOp',0],
|
||||
liminf: ['NamedOp','lim inf'],
|
||||
limsup: ['NamedOp','lim sup'],
|
||||
ln: ['NamedFn'],
|
||||
log: ['NamedFn'],
|
||||
max: 'NamedOp',
|
||||
min: 'NamedOp',
|
||||
Pr: 'NamedOp',
|
||||
sec: ['NamedOp',0],
|
||||
sin: ['NamedOp',0],
|
||||
sinh: ['NamedOp',0],
|
||||
sec: ['NamedFn'],
|
||||
sin: ['NamedFn'],
|
||||
sinh: ['NamedFn'],
|
||||
sup: 'NamedOp',
|
||||
tan: ['NamedOp',0],
|
||||
tanh: ['NamedOp',0],
|
||||
tan: ['NamedFn'],
|
||||
tanh: ['NamedFn'],
|
||||
|
||||
limits: ['Limits',1],
|
||||
nolimits: ['Limits',0],
|
||||
|
||||
overline: ['UnderOver','203E'],
|
||||
overline: ['UnderOver','00AF'],
|
||||
underline: ['UnderOver','005F'],
|
||||
overbrace: ['UnderOver','23DE',1],
|
||||
underbrace: ['UnderOver','23DF',1],
|
||||
|
@ -713,7 +721,7 @@
|
|||
moveright: 'MoveLeftRight',
|
||||
|
||||
',': ['Spacer',MML.LENGTH.THINMATHSPACE],
|
||||
':': ['Spacer',MML.LENGTH.THINMATHSPACE], // for LaTeX
|
||||
':': ['Spacer',MML.LENGTH.MEDIUMMATHSPACE], // for LaTeX
|
||||
'>': ['Spacer',MML.LENGTH.MEDIUMMATHSPACE],
|
||||
';': ['Spacer',MML.LENGTH.THICKMATHSPACE],
|
||||
'!': ['Spacer',MML.LENGTH.NEGATIVETHINMATHSPACE],
|
||||
|
@ -795,7 +803,7 @@
|
|||
eqalign: ['Matrix',null,null,"right left",MML.LENGTH.THICKMATHSPACE,".5em",'D'],
|
||||
displaylines: ['Matrix',null,null,"center",null,".5em",'D'],
|
||||
cr: 'Cr',
|
||||
'\\': 'Cr',
|
||||
'\\': 'CrLaTeX',
|
||||
newline: 'Cr',
|
||||
hline: ['HLine','solid'],
|
||||
hdashline: ['HLine','dashed'],
|
||||
|
@ -804,9 +812,9 @@
|
|||
leqalignno: ['Matrix',null,null,"right left right",MML.LENGTH.THICKMATHSPACE+" 3em",".5em",'D'],
|
||||
|
||||
// TeX substitution macros
|
||||
bmod: ['Macro','\\mathbin{\\rm mod}'],
|
||||
pmod: ['Macro','\\pod{{\\rm mod}\\kern 6mu #1}',1],
|
||||
mod: ['Macro','\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}{\\rm mod}\\,\\,#1',1],
|
||||
bmod: ['Macro','\\mathbin{\\mmlToken{mo}{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],
|
||||
|
@ -859,6 +867,8 @@
|
|||
cssId: ['Extension','HTML'],
|
||||
// bbox: ['Extension','bbox'],
|
||||
|
||||
mmlToken: 'MmlToken',
|
||||
|
||||
require: 'Require'
|
||||
|
||||
},
|
||||
|
@ -1057,7 +1067,7 @@
|
|||
do {sup += this.PRIME; this.i++, c = this.GetNext()}
|
||||
while (c === "'" || c === this.SMARTQUOTE);
|
||||
sup = this.mmlToken(MML.mo(MML.chars(sup)).With({isPrime: TRUE, variantForm: TEX.isSTIX}));
|
||||
this.Push(MML.msubsup(base,null,sup));
|
||||
this.Push(MML.msup(base,sup));
|
||||
},
|
||||
|
||||
/*
|
||||
|
@ -1122,13 +1132,17 @@
|
|||
this.Push(STACKITEM[name.substr(1)]().With({delim: this.GetDelimiter(name)}));
|
||||
},
|
||||
|
||||
NamedOp: function (name,limits,id) {
|
||||
var underover = (limits != null && limits === 0 ? FALSE : TRUE);
|
||||
if (!id) {id = name.substr(1)}; limits = ((limits || limits == null) ? TRUE : FALSE);
|
||||
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(/ /,String.fromCharCode(0x2006));
|
||||
var mml = MML.mo(id).With({
|
||||
movablelimits: limits,
|
||||
movesupsub: underover,
|
||||
movablelimits: TRUE,
|
||||
movesupsub: TRUE,
|
||||
form: MML.FORM.PREFIX,
|
||||
texClass: MML.TEXCLASS.OP
|
||||
});
|
||||
|
@ -1162,7 +1176,9 @@
|
|||
},
|
||||
|
||||
Sqrt: function (name) {
|
||||
var n = this.GetBrackets(name), mml = this.ParseArg(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);
|
||||
|
@ -1198,7 +1214,7 @@
|
|||
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);
|
||||
this.Push(MML.munderover(c,null,mml).With({accent: TRUE}));
|
||||
this.Push(MML.TeXAtom(MML.munderover(c,null,mml).With({accent: TRUE})));
|
||||
},
|
||||
|
||||
UnderOver: function (name,c,stack) {
|
||||
|
@ -1209,16 +1225,16 @@
|
|||
if (stack) {mml.movesupsub = TRUE}
|
||||
mml.data[mml[pos]] =
|
||||
this.mmlToken(MML.mo(MML.entity("#x"+c)).With({stretchy: TRUE, accent: (pos == "under")}));
|
||||
this.Push(mml);
|
||||
this.Push(MML.TeXAtom(mml));
|
||||
},
|
||||
|
||||
Overset: function (name) {
|
||||
var top = this.ParseArg(name), base = this.ParseArg(name);
|
||||
this.Push(MML.munderover(base,null,top));
|
||||
this.Push(MML.mover(base,top));
|
||||
},
|
||||
Underset: function (name) {
|
||||
var bot = this.ParseArg(name), base = this.ParseArg(name);
|
||||
this.Push(MML.munderover(base,bot,null));
|
||||
this.Push(MML.munder(base,bot));
|
||||
},
|
||||
|
||||
TeXAtom: function (name,mclass) {
|
||||
|
@ -1228,24 +1244,36 @@
|
|||
var arg = this.GetArgument(name);
|
||||
var match = arg.match(/^\s*\\rm\s+([a-zA-Z0-9 ]+)$/);
|
||||
if (match) {
|
||||
mml = this.mmlToken(MML.mo(match[1]).With({
|
||||
movablelimits: TRUE, movesupsub: TRUE,
|
||||
mathvariant: MML.VARIANT.NORMAL,
|
||||
form: MML.FORM.PREFIX,
|
||||
texClass: MML.TEXCLASS.OP
|
||||
}));
|
||||
mml.useMMLspacing &= ~mml.SPACE_ATTR.form; // don't count this explicit form setting
|
||||
} else {mml = MML.TeXAtom(TEX.Parse(arg,this.stack.env).mml()).With(def)}
|
||||
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 = {}, match;
|
||||
if (!MML[type] || !MML[type].prototype.isToken) {TEX.Error(type+" is not a token element")}
|
||||
while (attr !== "") {
|
||||
match = attr.match(/^([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^ ]*)\s*/i);
|
||||
if (!match) {TEX.Error("Invalid MathML attribute: "+attr)}
|
||||
def[match[1]] = match[2].replace(/^(['"])(.*)\1$/,"$2");
|
||||
attr = attr.substr(match[0].length);
|
||||
}
|
||||
this.Push(this.mmlToken(MML[type](data).With(def)));
|
||||
},
|
||||
|
||||
Strut: function (name) {
|
||||
this.Push(MML.mpadded(MML.mrow()).With({height: "8.6pt", depth: "3pt", width: 0}));
|
||||
},
|
||||
|
||||
Phantom: function (name,v,h) {
|
||||
var box = MML.mphantom(this.ParseArg(name));
|
||||
var box = MML.TeXAtom(MML.mphantom(this.ParseArg(name)));
|
||||
if (v || h) {
|
||||
box = MML.mpadded(box);
|
||||
if (h) {box.height = box.depth = 0}
|
||||
|
@ -1256,7 +1284,7 @@
|
|||
|
||||
Smash: function (name) {
|
||||
var bt = this.trimSpaces(this.GetBrackets(name));
|
||||
var smash = MML.mpadded(this.ParseArg(name));
|
||||
var smash = MML.TeXAtom(MML.mpadded(this.ParseArg(name)));
|
||||
switch (bt) {
|
||||
case "b": smash.depth = 0; break;
|
||||
case "t": smash.height = 0; break;
|
||||
|
@ -1266,7 +1294,7 @@
|
|||
},
|
||||
|
||||
Lap: function (name) {
|
||||
var mml = MML.mpadded(this.ParseArg(name)).With({width: 0});
|
||||
var mml = MML.TeXAtom(MML.mpadded(this.ParseArg(name)).With({width: 0}));
|
||||
if (name === "\\llap") {mml.lspace = "-1 width"}
|
||||
this.Push(mml);
|
||||
},
|
||||
|
@ -1302,9 +1330,9 @@
|
|||
d = this.GetDimen(name);
|
||||
var mml, def = {width:w, height:h, depth:d};
|
||||
if (style !== 'blank') {
|
||||
mml = MML.mpadded(MML.mrow()).With(def);
|
||||
if (parseFloat(w) && parseFloat(h)+parseFloat(d))
|
||||
{mml = MML.mstyle(mml).With({mathbackground:(this.stack.env.color || "black")})}
|
||||
{def.mathbackground = (this.stack.env.color || "black")}
|
||||
mml = MML.mpadded(MML.mrow()).With(def);
|
||||
} else {
|
||||
mml = MML.mspace().With(def);
|
||||
}
|
||||
|
@ -1386,10 +1414,43 @@
|
|||
this.Push(STACKITEM.cell().With({isCR: TRUE, name: name}));
|
||||
},
|
||||
|
||||
CrLaTeX: function (name) {
|
||||
var n = this.GetBrackets(name).replace(/ /g,"");
|
||||
if (n && !n.match(/^(((\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/))
|
||||
{TEX.Error("Bracket argument to "+name+" must be a dimension")}
|
||||
this.Push(STACKITEM.cell().With({isCR: TRUE, name: name}));
|
||||
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(top.rowspacing)}
|
||||
rows[top.table.length-1] = (top.rowspacing+this.dimen2em(n)) + "em";
|
||||
top.arraydef.rowspacing = rows.join(' ');
|
||||
}
|
||||
} else {
|
||||
// force line break
|
||||
}
|
||||
},
|
||||
emPerInch: 7.2,
|
||||
dimen2em: function (dim) {
|
||||
var match = dim.match(/^((?:\.\d+|\d+(?:\.\d*)?))(pt|em|ex|mu|pc|in|mm|cm)/);
|
||||
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 === "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;
|
||||
},
|
||||
|
||||
HLine: function (name,style) {
|
||||
if (style == null) {style = "solid"}
|
||||
var top = this.stack.Top();
|
||||
if (top.type !== "array" || top.data.length) {TEX.Error("Misplaced "+name)}
|
||||
if (!top.isa(STACKITEM.array) || top.data.length) {TEX.Error("Misplaced "+name)}
|
||||
if (top.table.length == 0) {
|
||||
top.arraydef.frame = style;
|
||||
} else {
|
||||
|
@ -1738,15 +1799,20 @@
|
|||
},
|
||||
|
||||
combineRelations: function (mml) {
|
||||
for (var i = 0, m = mml.data.length; i < m; i++) {
|
||||
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 && mml.data[i+1] &&
|
||||
mml.data[i].isa(MML.mo) && mml.data[i+1].isa(MML.mo) &&
|
||||
mml.data[i].Get("texClass") === MML.TEXCLASS.REL &&
|
||||
mml.data[i+1].Get("texClass") === MML.TEXCLASS.REL) {
|
||||
mml.data[i].Append.apply(mml.data[i],mml.data[i+1].data);
|
||||
mml.data.splice(i+1,1); m--;
|
||||
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.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])}
|
||||
|
|
|
@ -1807,9 +1807,10 @@
|
|||
HTMLCSS.createDelimiter(rule,HTMLCSS.FONTDATA.RULECHAR,W,scale);
|
||||
}
|
||||
H = base.bbox.h + q + t;
|
||||
q = H*HTMLCSS.rfuzz; if (surd.isMultiChar) {q = HTMLCSS.rfuzz}
|
||||
x = this.HTMLaddRoot(sqrt,surd,x,surd.bbox.h+surd.bbox.d-H,scale);
|
||||
HTMLCSS.placeBox(surd,x,H-surd.bbox.h);
|
||||
HTMLCSS.placeBox(rule,x+surd.bbox.w,H-rule.bbox.h+HTMLCSS.rfuzz);
|
||||
HTMLCSS.placeBox(rule,x+surd.bbox.w,H-rule.bbox.h+q);
|
||||
HTMLCSS.placeBox(base,x+surd.bbox.w,0);
|
||||
this.HTMLhandleSpace(span);
|
||||
this.HTMLhandleColor(span);
|
||||
|
@ -2226,7 +2227,7 @@
|
|||
}
|
||||
},
|
||||
useProcessingFrame: true,
|
||||
rfuzz: .05,
|
||||
rfuzz: .011,
|
||||
AccentBug: true,
|
||||
AdjustSurd: true,
|
||||
safariContextMenuBug: true,
|
||||
|
@ -2248,7 +2249,7 @@
|
|||
Chrome: function (browser) {
|
||||
HTMLCSS.Augment({
|
||||
useProcessingFrame: true,
|
||||
rfuzz: .05,
|
||||
rfuzz: .011,
|
||||
AccentBug: true,
|
||||
AdjustSurd: true,
|
||||
allowWebFonts: (browser.versionAtLeast("4.0") ? "otf" : "svg"),
|
||||
|
|
Loading…
Reference in New Issue
Block a user