Make \it use MathJax_Main-Italic rather than MathJax_Math-italic, and don't do math italic correction (so spacing is correct for text)

This commit is contained in:
Davide P. Cervone 2011-11-20 17:31:10 -05:00
parent aa81d8e8ee
commit c223b6bc8c
20 changed files with 38 additions and 31 deletions

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

View File

@ -12,5 +12,5 @@
* http://www.apache.org/licenses/LICENSE-2.0
*/
MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function(){var b="1.1.3";var a=MathJax.ElementJax.mml;a.mbase.Augment({toMathML:function(k){var g=(this.inferred&&this.parent.inferRow);if(k==null){k=""}var e=this.type,d=this.MathMLattributes();if(e==="mspace"){return k+"<"+e+d+" />"}var j=[];var h=(this.isToken?"":k+(g?"":" "));for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){j.push(this.data[f].toMathML(h))}else{if(!this.isToken){j.push(h+"<mrow />")}}}if(this.isToken){return k+"<"+e+d+">"+j.join("")+"</"+e+">"}if(g){return j.join("\n")}if(j.length===0||(j.length===1&&j[0]==="")){return k+"<"+e+d+" />"}return k+"<"+e+d+">\n"+j.join("\n")+"\n"+k+"</"+e+">"},MathMLattributes:function(){var j=[],g=this.defaults;var c=(this.mmlAttributes||this.copyAttributes),l=this.skipAttributes;if(this.type==="math"){j.push('xmlns="http://www.w3.org/1998/Math/MathML"')}if(!this.mmlAttributes){if(this.type==="mstyle"){g=a.math.prototype.defaults}for(var d in g){if(!l[d]&&g.hasOwnProperty(d)){var e=(d==="open"||d==="close");if(this[d]!=null&&(e||this[d]!==g[d])){var k=this[d];delete this[d];if(e||this.Get(d)!==k){j.push(d+'="'+this.formatAttr(k)+'"')}this[d]=k}}}}for(var h=0,f=c.length;h<f;h++){if(this[c[h]]!=null){j.push(c[h]+'="'+this.quoteHTML(this[c[h]])+'"')}}if(j.length){return" "+j.join(" ")}else{return""}},copyAttributes:["fontfamily","fontsize","fontweight","fontstyle","color","background","id","class","href","style"],skipAttributes:{texClass:1,useHeight:1,texprimestyle:1},formatAttr:function(c){if(typeof(c)==="string"&&c.replace(/ /g,"").match(/^(([-+])?(\d+(\.\d*)?|\.\d+))mu$/)){return((1/18)*RegExp.$1).toFixed(3).replace(/\.?0+$/,"")+"em"}if(c==="-tex-caligraphic"){return"script"}if(c==="-tex-oldstyle"){return"normal"}return this.quoteHTML(c)},quoteHTML:function(e){e=String(e).split("");for(var f=0,d=e.length;f<d;f++){var h=e[f].charCodeAt(0);if(h<32||h>126){e[f]="&#x"+h.toString(16).toUpperCase()+";"}else{var g={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[e[f]];if(g){e[f]=g}}}return e.join("")}});a.msubsup.Augment({toMathML:function(h){var e=this.type;if(this.data[this.sup]==null){e="msub"}if(this.data[this.sub]==null){e="msup"}var d=this.MathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.munderover.Augment({toMathML:function(h){var e=this.type;if(this.data[this.under]==null){e="mover"}if(this.data[this.over]==null){e="munder"}var d=this.MathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.TeXAtom.Augment({toMathML:function(c){return c+"<mrow>\n"+this.data[0].toMathML(c+" ")+"\n"+c+"</mrow>"}});a.chars.Augment({toMathML:function(c){return(c||"")+this.quoteHTML(this.toString())}});a.entity.Augment({toMathML:function(c){return(c||"")+"&"+this.data[0]+";<!-- "+this.toString()+" -->"}});a.xml.Augment({toMathML:function(c){return(c||"")+this.toString()}});MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function(){a.TeXmathchoice.Augment({toMathML:function(c){return this.Core().toMathML(c)}})});MathJax.Hub.Startup.signal.Post("toMathML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/toMathML.js");
MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function(){var b="1.1.3";var a=MathJax.ElementJax.mml;a.mbase.Augment({toMathML:function(k){var g=(this.inferred&&this.parent.inferRow);if(k==null){k=""}var e=this.type,d=this.MathMLattributes();if(e==="mspace"){return k+"<"+e+d+" />"}var j=[];var h=(this.isToken?"":k+(g?"":" "));for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){j.push(this.data[f].toMathML(h))}else{if(!this.isToken){j.push(h+"<mrow />")}}}if(this.isToken){return k+"<"+e+d+">"+j.join("")+"</"+e+">"}if(g){return j.join("\n")}if(j.length===0||(j.length===1&&j[0]==="")){return k+"<"+e+d+" />"}return k+"<"+e+d+">\n"+j.join("\n")+"\n"+k+"</"+e+">"},MathMLattributes:function(){var j=[],g=this.defaults;var c=(this.mmlAttributes||this.copyAttributes),l=this.skipAttributes;if(this.type==="math"){j.push('xmlns="http://www.w3.org/1998/Math/MathML"')}if(!this.mmlAttributes){if(this.type==="mstyle"){g=a.math.prototype.defaults}for(var d in g){if(!l[d]&&g.hasOwnProperty(d)){var e=(d==="open"||d==="close");if(this[d]!=null&&(e||this[d]!==g[d])){var k=this[d];delete this[d];if(e||this.Get(d)!==k){j.push(d+'="'+this.formatAttr(k)+'"')}this[d]=k}}}}for(var h=0,f=c.length;h<f;h++){if(this[c[h]]!=null){j.push(c[h]+'="'+this.quoteHTML(this[c[h]])+'"')}}if(j.length){return" "+j.join(" ")}else{return""}},copyAttributes:["fontfamily","fontsize","fontweight","fontstyle","color","background","id","class","href","style"],skipAttributes:{texClass:1,useHeight:1,texprimestyle:1},formatAttr:function(c){if(typeof(c)==="string"&&c.replace(/ /g,"").match(/^(([-+])?(\d+(\.\d*)?|\.\d+))mu$/)){return((1/18)*RegExp.$1).toFixed(3).replace(/\.?0+$/,"")+"em"}else{if(c==="-tex-caligraphic"){return"script"}else{if(c==="-tex-oldstyle"){return"normal"}else{if(c==="-tex-mathit"){return"italic"}}}}return this.quoteHTML(c)},quoteHTML:function(e){e=String(e).split("");for(var f=0,d=e.length;f<d;f++){var h=e[f].charCodeAt(0);if(h<32||h>126){e[f]="&#x"+h.toString(16).toUpperCase()+";"}else{var g={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[e[f]];if(g){e[f]=g}}}return e.join("")}});a.msubsup.Augment({toMathML:function(h){var e=this.type;if(this.data[this.sup]==null){e="msub"}if(this.data[this.sub]==null){e="msup"}var d=this.MathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.munderover.Augment({toMathML:function(h){var e=this.type;if(this.data[this.under]==null){e="mover"}if(this.data[this.over]==null){e="munder"}var d=this.MathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.TeXAtom.Augment({toMathML:function(c){return c+"<mrow>\n"+this.data[0].toMathML(c+" ")+"\n"+c+"</mrow>"}});a.chars.Augment({toMathML:function(c){return(c||"")+this.quoteHTML(this.toString())}});a.entity.Augment({toMathML:function(c){return(c||"")+"&"+this.data[0]+";<!-- "+this.toString()+" -->"}});a.xml.Augment({toMathML:function(c){return(c||"")+this.toString()}});MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function(){a.TeXmathchoice.Augment({toMathML:function(c){return this.Core().toMathML(c)}})});MathJax.Hub.Startup.signal.Post("toMathML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/toMathML.js");

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

View File

@ -82,8 +82,9 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
return ((1/18)*RegExp.$1).toFixed(3).replace(/\.?0+$/,"")+"em";
}
// FIXME: set classes for these?
if (value === "-tex-caligraphic") {return "script"}
if (value === "-tex-oldstyle") {return "normal"}
else if (value === "-tex-caligraphic") {return "script"}
else if (value === "-tex-oldstyle") {return "normal"}
else if (value === "-tex-mathit") {return "italic"}
return this.quoteHTML(value);
},

View File

@ -649,7 +649,7 @@
mit: ['SetFont',MML.VARIANT.ITALIC],
oldstyle: ['SetFont',MML.VARIANT.OLDSTYLE],
cal: ['SetFont',MML.VARIANT.CALIGRAPHIC],
it: ['SetFont',MML.VARIANT.ITALIC], // may need special handling
it: ['SetFont',"-tex-mathit"], // needs special handling
bf: ['SetFont',MML.VARIANT.BOLD],
bbFont: ['SetFont',MML.VARIANT.DOUBLESTRUCK],
scr: ['SetFont',MML.VARIANT.SCRIPT],

View File

@ -91,6 +91,7 @@
remap: {0xE262: 0xE265, 0xE263: 0xE269, 0xE264: 0xE26D, 0xE265: 0xE271,
0xE266: 0xE275, 0xE267: 0xE279, 0xE268: 0xE27D, 0xE269: 0xE281,
0xE26A: 0xE285}},
"-tex-mathit": {fonts: [ITALIC,"STIXNonUnicode-italic",GENERAL,NONUNI,SIZE1], italic:true, noIC:true},
"-largeOp": {fonts:[SIZE1,"STIXIntegralsD",NONUNI,GENERAL]},
"-smallOp": {}
},

View File

@ -97,6 +97,10 @@
"monospace": {fonts:["MathJax_Typewriter",MAIN,SIZE1,AMS]},
"-tex-caligraphic": {fonts:["MathJax_Caligraphic",MAIN], offsetA: 0x41, variantA: "italic"},
"-tex-oldstyle": {fonts:["MathJax_Caligraphic",MAIN]},
"-tex-mathit": {fonts:["MathJax_Main-italic",ITALIC,MAIN,SIZE1,AMS], italic:true, noIC: true,
remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48,
0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F,
0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58}},
"-largeOp": {fonts:[SIZE2,SIZE1,MAIN]},
"-smallOp": {fonts:[SIZE1,MAIN]}
},

View File

@ -1807,7 +1807,7 @@
if (!span.bbox) {span.bbox = {w:0, h:0, d:0, rw:0, lw:0}}
var text = this.data.join(""), bbox = span.bbox;
if (bbox.skew && text.length !== 1) {delete bbox.skew}
if (bbox.rw > bbox.w && text.length === 1) {
if (bbox.rw > bbox.w && text.length === 1 && !variant.noIC) {
bbox.ic = bbox.rw - bbox.w;
HTMLCSS.createBlank(span,bbox.ic);
bbox.w = bbox.rw;

View File

@ -374,6 +374,7 @@
{value = ((1/18)*RegExp.$1).toFixed(3).replace(/\.?0+$/,"")+"em"} // FIXME: should take scriptlevel into account
else if (value === "-tex-caligraphic") {value = "script"} // FIXME: add a class?
else if (value === "-tex-oldstyle") {value = "normal"} // FIXME: add a class?
else if (value === "-tex-mathit") {value = "italic"} // FIXME: add a class?
return value;
},
//