commit d127b1bcb73bcefc59c167c84aaadee0847f893d
parent f42c71feca08997cccd1851e64ba8f75ba62cde3
Author: Davide P. Cervone <dpvc@union.edu>
Date: Thu, 16 Jul 2015 15:39:20 -0400
Merge branch 'issue596' into develop. Issue #596.
Diffstat:
4 files changed, 44 insertions(+), 35 deletions(-)
diff --git a/unpacked/extensions/TeX/AMSmath.js b/unpacked/extensions/TeX/AMSmath.js
@@ -571,22 +571,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var def = {
side: TEX.config.TagSide,
minlabelspacing: TEX.config.TagIndent,
- columnalign: mml.displayAlign,
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);
}
return STACKITEM.mml(mml);
diff --git a/unpacked/jax/output/HTML-CSS/autoload/mtable.js b/unpacked/jax/output/HTML-CSS/autoload/mtable.js
@@ -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.indentshift === "auto") {indent.indentshift = "0"}
var shift = HTMLCSS.length2em(indent.indentshift,mu,HTMLCSS.cwidth);
- var labelshift = HTMLCSS.length2em(values.minlabelspacing,mu,HTMLCSS.cwidth);
- if (this.displayIndent !== "0") {
- var dIndent = HTMLCSS.length2em(this.displayIndent,mu,HTMLCSS.cwidth);
- shift += (indent.indentAlign === MML.INDENTALIGN.RIGHT ? -dIndent: dIndent);
+ var labelspace = HTMLCSS.length2em(values.minlabelspacing,mu,HTMLCSS.cwidth);
+ var labelW = labelspace + C[LABEL].bbox.w, labelshift = 0, tw = mw;
+ var dIndent = HTMLCSS.length2em(this.displayIndent,mu,HTMLCSS.cwidth);
+ 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%");
HTMLCSS.addBox(eqn,stack); HTMLCSS.alignBox(stack,indent.indentalign,0,shift);
-
C[LABEL].parentNode.parentNode.removeChild(C[LABEL].parentNode);
HTMLCSS.addBox(eqn,C[LABEL]); HTMLCSS.alignBox(C[LABEL],CALIGN[LABEL],0);
if (HTMLCSS.msieRelativeWidthBug) {stack.style.top = C[LABEL].style.top = ""}
if (hasRelativeWidth) {stack.style.width = values.width; span.bbox.width = "100%"}
- C[LABEL].style.marginRight = C[LABEL].style.marginLeft = HTMLCSS.Em(labelshift);
- if (indent.indentalign === MML.INDENTALIGN.CENTER) {mw += 4*labelshift + 2*C[LABEL].bbox.w}
- else if (indent.indentalign !== CALIGN[LABEL]) {mw += 2*labelshift + C[LABEL].bbox.w}
- mw = Math.max(0,mw+shift); span.bbox.tw = mw + 2*labelshift;
- span.style.minWidth = span.bbox.minWidth = HTMLCSS.Em(mw);
- eqn.style.minWidth = eqn.bbox.minWidth = HTMLCSS.Em(mw/HTMLCSS.scale);
+ C[LABEL].style[s === 1 ? "marginLeft" : "marginRight"] = HTMLCSS.Em(s*labelshift);
+ span.bbox.tw = tw;
+ span.style.minWidth = span.bbox.minWidth = HTMLCSS.Em(tw);
+ eqn.style.minWidth = eqn.bbox.minWidth = HTMLCSS.Em(tw/scale);
}
//
// Finish the table
diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js
@@ -2936,10 +2936,10 @@
node.style.textAlign = values.indentalign;
// ### FIXME: make percentage widths respond to changes in container
if (shift) {
- shift *= HTMLCSS.em/HTMLCSS.outerEm;
+ shift *= HTMLCSS.scale;
HUB.Insert(span.style,({
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)}
})[values.indentalign]);
//
diff --git a/unpacked/jax/output/SVG/autoload/mtable.js b/unpacked/jax/output/SVG/autoload/mtable.js
@@ -331,17 +331,33 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
if (indent.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) {indent.indentshift = indent.indentshiftfirst}
if (indent.indentshift === "auto" || indent.indentshift === "") {indent.indentshift = "0"}
var shift = SVG.length2em(indent.indentshift,mu,SVG.cwidth);
- var labelshift = SVG.length2em(values.minlabelspacing,mu,SVG.cwidth);
- if (this.displayIndent !== "0") {
- var dIndent = SVG.length2em(this.displayIndent,mu,SVG.cwidth);
- shift += (indent.indentAlign === MML.INDENTALIGN.RIGHT ? -dIndent: dIndent);
+ var labelspace = SVG.length2em(values.minlabelspacing,mu,SVG.cwidth);
+ var labelW = labelspace + C[LABEL].w, labelshift = 0, tw = svg.w;
+ var dIndent = SVG.length2em(this.displayIndent,mu,SVG.cwidth);
+ 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();
- svg.w = svg.r = SVG.cwidth; svg.hasIndent = true;
- svg.Align(C[LABEL],CALIGN[LABEL],labelshift,0);
+ svg.hasIndent = true;
+ 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.tw += C[LABEL].w + shift +
- (indent.indentalign === MML.INDENTALIGN.CENTER ? 8 : 4)*labelshift;
+ svg.tw = tw;
}
this.SVGsaveData(svg);