Skip to content

Commit d3201ad

Browse files
committed
Make sure mmultiscripts aligns HTML-CSS color element for prescripts.
1 parent d536272 commit d3201ad

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
139139
var w = box[k+1].bbox.w - box[k].bbox.w;
140140
if (w > 0) {
141141
if (isPre) {
142-
box[k].style.paddingLeft = HTMLCSS.Em(w/(box[k].scale||1));
142+
this.HTMLmoveColor(box[k],w,1);
143143
BOX[k].w += w;
144144
} else {
145145
HTMLCSS.createBlank(sub,w);
146146
}
147147
} else if (w < 0) {
148148
if (isPre) {
149-
box[k+1].style.paddingLeft = HTMLCSS.Em(-w/(box[k+1].scale||1));
149+
this.HTMLmoveColor(box[k+1],-w,-1);
150150
BOX[k+1].w += -w;
151151
} else {
152152
HTMLCSS.createBlank(sup,-w);
@@ -179,6 +179,16 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
179179
}
180180
return BOX;
181181
},
182+
HTMLmoveColor: function (box,w,sign) {
183+
var W = w/(box.scale||1);
184+
box.style.paddingLeft = HTMLCSS.Em(W);
185+
var color = box.previousSibling;
186+
if (color && (color.id||"").match(/^MathJax-Color-/)) {
187+
color.style.marginLeft = HTMLCSS.Em(W+parseFloat(color.style.marginLeft));
188+
color.style.marginRight = HTMLCSS.Em(sign*(W-parseFloat(color.style.marginRight)));
189+
}
190+
191+
},
182192
HTMLstretchH: MML.mbase.HTMLstretchH,
183193
HTMLstretchV: MML.mbase.HTMLstretchV
184194
});

0 commit comments

Comments
 (0)