Merge branch 'issue596' into develop. Issue #596.

This commit is contained in:
Davide P. Cervone 2015-07-16 15:39:20 -04:00
commit d127b1bcb7
4 changed files with 44 additions and 35 deletions

View File

@ -571,22 +571,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var def = { var def = {
side: TEX.config.TagSide, side: TEX.config.TagSide,
minlabelspacing: TEX.config.TagIndent, minlabelspacing: TEX.config.TagIndent,
columnalign: mml.displayAlign,
displaystyle: "inherit" // replaced by TeX input jax Translate() function with actual value displaystyle: "inherit" // replaced by TeX input jax Translate() function with actual value
}; };
if (mml.displayAlign === MML.INDENTALIGN.LEFT) {
def.width = "100%";
if (mml.displayIndent !== "0") {
def.columnwidth = mml.displayIndent + " fit"; def.columnspacing = "0"
row = [row[0],MML.mtd(),row[1]];
}
} else if (mml.displayAlign === MML.INDENTALIGN.RIGHT) {
def.width = "100%";
if (mml.displayIndent !== "0") {
def.columnwidth = "fit "+mml.displayIndent; def.columnspacing = "0"
row[2] = MML.mtd();
}
}
mml = MML.mtable(MML.mlabeledtr.apply(MML,row)).With(def); mml = MML.mtable(MML.mlabeledtr.apply(MML,row)).With(def);
} }
return STACKITEM.mml(mml); return STACKITEM.mml(mml);

View File

@ -428,24 +428,31 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
if (indent.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) {indent.indentshift = indent.indentshiftfirst} if (indent.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) {indent.indentshift = indent.indentshiftfirst}
if (indent.indentshift === "auto") {indent.indentshift = "0"} if (indent.indentshift === "auto") {indent.indentshift = "0"}
var shift = HTMLCSS.length2em(indent.indentshift,mu,HTMLCSS.cwidth); var shift = HTMLCSS.length2em(indent.indentshift,mu,HTMLCSS.cwidth);
var labelshift = HTMLCSS.length2em(values.minlabelspacing,mu,HTMLCSS.cwidth); var labelspace = HTMLCSS.length2em(values.minlabelspacing,mu,HTMLCSS.cwidth);
if (this.displayIndent !== "0") { var labelW = labelspace + C[LABEL].bbox.w, labelshift = 0, tw = mw;
var dIndent = HTMLCSS.length2em(this.displayIndent,mu,HTMLCSS.cwidth); var dIndent = HTMLCSS.length2em(this.displayIndent,mu,HTMLCSS.cwidth);
shift += (indent.indentAlign === MML.INDENTALIGN.RIGHT ? -dIndent: dIndent); var s = (CALIGN[LABEL] === MML.INDENTALIGN.RIGHT ? -1 : 1);
if (indent.indentalign === MML.INDENTALIGN.CENTER) {
tw += 2 * (labelW - s*(shift + dIndent));
shift += dIndent;
} else if (CALIGN[LABEL] === indent.indentalign) {
if (dIndent < 0) {labelshift = s*dIndent; dIndent = 0}
shift += s*dIndent; if (labelW > s*shift) shift = s*labelW; shift += labelshift;
tw += s*shift;
} else {
tw += labelW - s*shift + dIndent;
shift -= s*dIndent;
} }
var eqn = HTMLCSS.createStack(span,false,"100%"); var eqn = HTMLCSS.createStack(span,false,"100%");
HTMLCSS.addBox(eqn,stack); HTMLCSS.alignBox(stack,indent.indentalign,0,shift); HTMLCSS.addBox(eqn,stack); HTMLCSS.alignBox(stack,indent.indentalign,0,shift);
C[LABEL].parentNode.parentNode.removeChild(C[LABEL].parentNode); C[LABEL].parentNode.parentNode.removeChild(C[LABEL].parentNode);
HTMLCSS.addBox(eqn,C[LABEL]); HTMLCSS.alignBox(C[LABEL],CALIGN[LABEL],0); HTMLCSS.addBox(eqn,C[LABEL]); HTMLCSS.alignBox(C[LABEL],CALIGN[LABEL],0);
if (HTMLCSS.msieRelativeWidthBug) {stack.style.top = C[LABEL].style.top = ""} if (HTMLCSS.msieRelativeWidthBug) {stack.style.top = C[LABEL].style.top = ""}
if (hasRelativeWidth) {stack.style.width = values.width; span.bbox.width = "100%"} if (hasRelativeWidth) {stack.style.width = values.width; span.bbox.width = "100%"}
C[LABEL].style.marginRight = C[LABEL].style.marginLeft = HTMLCSS.Em(labelshift); C[LABEL].style[s === 1 ? "marginLeft" : "marginRight"] = HTMLCSS.Em(s*labelshift);
if (indent.indentalign === MML.INDENTALIGN.CENTER) {mw += 4*labelshift + 2*C[LABEL].bbox.w} span.bbox.tw = tw;
else if (indent.indentalign !== CALIGN[LABEL]) {mw += 2*labelshift + C[LABEL].bbox.w} span.style.minWidth = span.bbox.minWidth = HTMLCSS.Em(tw);
mw = Math.max(0,mw+shift); span.bbox.tw = mw + 2*labelshift; eqn.style.minWidth = eqn.bbox.minWidth = HTMLCSS.Em(tw/scale);
span.style.minWidth = span.bbox.minWidth = HTMLCSS.Em(mw);
eqn.style.minWidth = eqn.bbox.minWidth = HTMLCSS.Em(mw/HTMLCSS.scale);
} }
// //
// Finish the table // Finish the table

View File

@ -2936,10 +2936,10 @@
node.style.textAlign = values.indentalign; node.style.textAlign = values.indentalign;
// ### FIXME: make percentage widths respond to changes in container // ### FIXME: make percentage widths respond to changes in container
if (shift) { if (shift) {
shift *= HTMLCSS.em/HTMLCSS.outerEm; shift *= HTMLCSS.scale;
HUB.Insert(span.style,({ HUB.Insert(span.style,({
left: {marginLeft: HTMLCSS.Em(shift)}, left: {marginLeft: HTMLCSS.Em(shift)},
right: {marginLeft: HTMLCSS.Em(Math.max(0,span.bbox.w+shift)), marginRight: HTMLCSS.Em(-shift)}, right: {marginRight: HTMLCSS.Em(-shift)},
center: {marginLeft: HTMLCSS.Em(shift), marginRight: HTMLCSS.Em(-shift)} center: {marginLeft: HTMLCSS.Em(shift), marginRight: HTMLCSS.Em(-shift)}
})[values.indentalign]); })[values.indentalign]);
// //

View File

@ -331,17 +331,33 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
if (indent.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) {indent.indentshift = indent.indentshiftfirst} if (indent.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) {indent.indentshift = indent.indentshiftfirst}
if (indent.indentshift === "auto" || indent.indentshift === "") {indent.indentshift = "0"} if (indent.indentshift === "auto" || indent.indentshift === "") {indent.indentshift = "0"}
var shift = SVG.length2em(indent.indentshift,mu,SVG.cwidth); var shift = SVG.length2em(indent.indentshift,mu,SVG.cwidth);
var labelshift = SVG.length2em(values.minlabelspacing,mu,SVG.cwidth); var labelspace = SVG.length2em(values.minlabelspacing,mu,SVG.cwidth);
if (this.displayIndent !== "0") { var labelW = labelspace + C[LABEL].w, labelshift = 0, tw = svg.w;
var dIndent = SVG.length2em(this.displayIndent,mu,SVG.cwidth); var dIndent = SVG.length2em(this.displayIndent,mu,SVG.cwidth);
shift += (indent.indentAlign === MML.INDENTALIGN.RIGHT ? -dIndent: dIndent); var s = (CALIGN[LABEL] === MML.INDENTALIGN.RIGHT ? -1 : 1);
if (indent.indentalign === MML.INDENTALIGN.CENTER) {
var dx = (SVG.cwidth-tw)/2; shift += dIndent;
if (labelW + s*labelshift > dx + s*shift) {
indent.indentalign = CALIGN[LABEL];
shift = s*(labelW + s*labelshift); tw += labelW + Math.max(0,shift);
}
} else if (CALIGN[LABEL] === indent.indentalign) {
if (dIndent < 0) {labelshift = s*dIndent; dIndent = 0}
shift += s*dIndent; if (labelW > s*shift) shift = s*labelW; shift += labelshift;
tw += s*shift;
} else {
shift -= s*dIndent;
if (tw - s*shift + labelW > SVG.cwidth) {
shift = s*(tw + labelW - SVG.cwidth);
if (s*shift > 0) {tw = SVG.cwidth + s*shift; shift = 0}
}
} }
var eqn = svg; svg = this.SVG(); var eqn = svg; svg = this.SVG();
svg.w = svg.r = SVG.cwidth; svg.hasIndent = true; svg.hasIndent = true;
svg.Align(C[LABEL],CALIGN[LABEL],labelshift,0); svg.w = svg.r = Math.max(tw,SVG.cwidth);
svg.Align(C[LABEL],CALIGN[LABEL],0,0,labelshift);
svg.Align(eqn,indent.indentalign,0,0,shift); svg.Align(eqn,indent.indentalign,0,0,shift);
svg.tw += C[LABEL].w + shift + svg.tw = tw;
(indent.indentalign === MML.INDENTALIGN.CENTER ? 8 : 4)*labelshift;
} }
this.SVGsaveData(svg); this.SVGsaveData(svg);