Make sure mmultiscripts aligns HTML-CSS color element for prescripts.

This commit is contained in:
Davide P. Cervone 2016-08-25 06:44:14 -04:00
parent d536272781
commit d3201ada44

View File

@ -139,14 +139,14 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
var w = box[k+1].bbox.w - box[k].bbox.w; var w = box[k+1].bbox.w - box[k].bbox.w;
if (w > 0) { if (w > 0) {
if (isPre) { if (isPre) {
box[k].style.paddingLeft = HTMLCSS.Em(w/(box[k].scale||1)); this.HTMLmoveColor(box[k],w,1);
BOX[k].w += w; BOX[k].w += w;
} else { } else {
HTMLCSS.createBlank(sub,w); HTMLCSS.createBlank(sub,w);
} }
} else if (w < 0) { } else if (w < 0) {
if (isPre) { if (isPre) {
box[k+1].style.paddingLeft = HTMLCSS.Em(-w/(box[k+1].scale||1)); this.HTMLmoveColor(box[k+1],-w,-1);
BOX[k+1].w += -w; BOX[k+1].w += -w;
} else { } else {
HTMLCSS.createBlank(sup,-w); HTMLCSS.createBlank(sup,-w);
@ -179,6 +179,16 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
} }
return BOX; return BOX;
}, },
HTMLmoveColor: function (box,w,sign) {
var W = w/(box.scale||1);
box.style.paddingLeft = HTMLCSS.Em(W);
var color = box.previousSibling;
if (color && (color.id||"").match(/^MathJax-Color-/)) {
color.style.marginLeft = HTMLCSS.Em(W+parseFloat(color.style.marginLeft));
color.style.marginRight = HTMLCSS.Em(sign*(W-parseFloat(color.style.marginRight)));
}
},
HTMLstretchH: MML.mbase.HTMLstretchH, HTMLstretchH: MML.mbase.HTMLstretchH,
HTMLstretchV: MML.mbase.HTMLstretchV HTMLstretchV: MML.mbase.HTMLstretchV
}); });