Merge branch 'issue305' into develop
This commit is contained in:
commit
8d0b6f5189
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
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -912,7 +912,6 @@ MathJax.ElementJax.mml.Augment({
|
|||
|
||||
MML.msubsup = MML.mbase.Subclass({
|
||||
type: "msubsup", base: 0, sub: 1, sup: 2,
|
||||
linebreakContainer: true,
|
||||
isEmbellished: MML.mbase.childEmbellished,
|
||||
Core: MML.mbase.childCore,
|
||||
CoreMO: MML.mbase.childCoreMO,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||
var VERSION = "2.0.3";
|
||||
var VERSION = "2.0.4";
|
||||
var MML = MathJax.ElementJax.mml,
|
||||
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
|
||||
|
||||
|
@ -36,7 +36,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
badbreak: [+200],
|
||||
auto: [0],
|
||||
|
||||
toobig: 500,
|
||||
toobig: 800,
|
||||
nestfactor: 400,
|
||||
spacefactor: -100,
|
||||
spaceoffset: 2,
|
||||
|
@ -159,7 +159,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
better = true; index = [i].concat(info.index); W = info.W; w = info.w;
|
||||
if (info.penalty === PENALTY.newline) {info.index = index; info.nest--; return true}
|
||||
}
|
||||
if (!broken) {scanW = this.HTMLaddWidth(i,info,scanW)}
|
||||
scanW = (broken ? info.scanW : this.HTMLaddWidth(i,info,scanW));
|
||||
}
|
||||
info.index = []; i++; broken = false;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
this.HTMLmoveLine(start,end,line,state,values);
|
||||
this.HTMLcleanBBox(line.bbox);
|
||||
//
|
||||
// Get the alignment and shift values
|
||||
// Get the alignment and shift values
|
||||
//
|
||||
var align = this.HTMLgetAlign(state,values),
|
||||
shift = this.HTMLgetShift(state,values,align);
|
||||
|
@ -404,7 +404,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
better = true; index = [i].concat(info.index); W = info.W; w = info.w;
|
||||
if (info.penalty === PENALTY.newline) {info.index = index; info.nest--; return true}
|
||||
}
|
||||
if (!broken) {scanW = this.HTMLaddWidth(k,info,scanW)}
|
||||
scanW = (broken ? info.scanW : this.HTMLaddWidth(i,info,scanW));
|
||||
}
|
||||
info.index = []; i++; broken = false;
|
||||
}
|
||||
|
@ -419,7 +419,6 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
if (i === j && start.length > 1) {
|
||||
//
|
||||
// If starting and ending in the same element move the subpiece to the new line
|
||||
// Add the closing fence, if present
|
||||
//
|
||||
this.data[this.dataI[i]].HTMLmoveSlice(start.slice(1),end.slice(1),span,state,values,"paddingLeft");
|
||||
} else {
|
||||
|
@ -436,8 +435,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
i++; k = this.dataI[i]; state.first = false; start = [];
|
||||
}
|
||||
//
|
||||
// If the last item is complete, move it and the closing fence,
|
||||
// otherwise move the first part of it up to the split
|
||||
// If the last item is complete, move it
|
||||
//
|
||||
state.last = last;
|
||||
if (this.data[k]) {
|
||||
|
@ -451,11 +449,80 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
|
||||
/**************************************************************************/
|
||||
|
||||
MML.msubsup.Augment({
|
||||
HTMLbetterBreak: function (info,state) {
|
||||
if (!this.data[this.base]) {return false}
|
||||
//
|
||||
// Get the current breakpoint position and other data
|
||||
//
|
||||
var index = info.index.slice(0), i = info.index.shift(),
|
||||
W, w, scanW, broken = (info.index.length > 0), better = false;
|
||||
if (!broken) {info.W += info.w; info.w = 0}
|
||||
scanW = info.scanW = info.W;
|
||||
//
|
||||
// Record the width of the base and the super- and subscripts
|
||||
//
|
||||
if (i == null) {
|
||||
this.HTMLbaseW = this.data[this.base].HTMLspanElement().bbox.w;
|
||||
this.HTMLdw = this.HTMLspanElement().bbox.w - this.HTMLbaseW;
|
||||
}
|
||||
//
|
||||
// Check if the base can be broken
|
||||
//
|
||||
if (this.data[this.base].HTMLbetterBreak(info,state)) {
|
||||
better = true; index = [this.base].concat(info.index); W = info.W; w = info.w;
|
||||
if (info.penalty === PENALTY.newline) {better = broken = true}
|
||||
}
|
||||
//
|
||||
// Add in the base if it is unbroken, and add the scripts
|
||||
//
|
||||
if (!broken) {this.HTMLaddWidth(this.base,info,scanW)}
|
||||
info.scanW += this.HTMLdw; info.W = info.scanW;
|
||||
info.index = []; if (better) {info.W = W; info.w = w; info.index = index}
|
||||
return better;
|
||||
},
|
||||
|
||||
HTMLmoveLine: function (start,end,span,state,values) {
|
||||
//
|
||||
// Move the proper part of the base
|
||||
//
|
||||
if (this.data[this.base]) {
|
||||
if (start.length > 1) {
|
||||
this.data[this.base].HTMLmoveSlice(start.slice(1),end.slice(1),span,state,values,"paddingLeft");
|
||||
} else {
|
||||
if (end.length <= 1) {this.data[this.base].HTMLmoveSpan(span,state,values)}
|
||||
else {this.data[this.base].HTMLmoveSlice([],end.slice(1),span,state,values,"paddingRight")}
|
||||
}
|
||||
}
|
||||
//
|
||||
// If this is the end, check for super and subscripts, and move those
|
||||
// by moving the stack tht contains them, and shifting by the amount of the
|
||||
// base that has been removed. Remove the empty base box from the stack.
|
||||
//
|
||||
if (end.length === 0) {
|
||||
var s = this.data[this.sup] || this.data[this.sub];
|
||||
if (s) {
|
||||
var box = s.HTMLspanElement().parentNode, stack = box.parentNode;
|
||||
if (this.data[this.base]) {stack.removeChild(stack.firstChild)}
|
||||
for (box = stack.firstChild; box; box = box.nextSibling)
|
||||
{box.style.left = HTMLCSS.Em(HTMLCSS.unEm(box.style.left)-this.HTMLbaseW)}
|
||||
stack.bbox.w -= this.HTMLbaseW; stack.style.width = HTMLCSS.Em(stack.bbox.w);
|
||||
this.HTMLcombineBBoxes(stack,span.bbox);
|
||||
span.appendChild(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
MML.mo.Augment({
|
||||
//
|
||||
// Override the method for checking line breaks to properly handle <mo>
|
||||
//
|
||||
HTMLbetterBreak: function (info,state) {
|
||||
if (info.values && info.values.id === this.spanID) {return false}
|
||||
var values = this.getValues(
|
||||
"linebreak","linebreakstyle","lineleading","linebreakmultchar",
|
||||
"indentalign","indentshift",
|
||||
|
@ -511,6 +578,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
if (penalty >= info.penalty) {return false}
|
||||
info.penalty = penalty; info.values = values; info.W = W; info.w = w;
|
||||
values.lineleading = HTMLCSS.length2em(values.lineleading,state.VALUES.lineleading);
|
||||
values.id = this.spanID;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -522,6 +590,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
// Override the method for checking line breaks to properly handle <mspace>
|
||||
//
|
||||
HTMLbetterBreak: function (info,state) {
|
||||
if (info.values && info.values.id === this.spanID) {return false}
|
||||
var values = this.getValues("linebreak");
|
||||
//
|
||||
// Get the default penalty for this location
|
||||
|
@ -551,7 +620,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
//
|
||||
if (penalty >= info.penalty) {return false}
|
||||
info.penalty = penalty; info.values = values; info.W = W; info.w = w;
|
||||
values.lineleading = state.VALUES.lineleading; values.linebreakstyle = "before";
|
||||
values.lineleading = state.VALUES.lineleading;
|
||||
values.linebreakstyle = "before"; values.id = this.spanID;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||
var VERSION = "2.0.2";
|
||||
var VERSION = "2.0.3";
|
||||
var MML = MathJax.ElementJax.mml,
|
||||
SVG = MathJax.OutputJax.SVG,
|
||||
BBOX = SVG.BBOX;
|
||||
|
@ -37,7 +37,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
badbreak: [+200],
|
||||
auto: [0],
|
||||
|
||||
toobig: 500,
|
||||
toobig: 800,
|
||||
nestfactor: 400,
|
||||
spacefactor: -100,
|
||||
spaceoffset: 2,
|
||||
|
@ -162,7 +162,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
better = true; index = [i].concat(info.index); W = info.W; w = info.w;
|
||||
if (info.penalty === PENALTY.newline) {info.index = index; info.nest--; return true}
|
||||
}
|
||||
if (!broken) {scanW = this.SVGaddWidth(i,info,scanW)}
|
||||
scanW = (broken ? info.scanW : this.SVGaddWidth(i,info,scanW));
|
||||
}
|
||||
info.index = []; i++; broken = false;
|
||||
}
|
||||
|
@ -219,7 +219,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
//
|
||||
// Save the values needed for the future
|
||||
//
|
||||
state.d = line.d; state.values = values; state.n++;
|
||||
state.d = line.d-(line.y||0);
|
||||
state.values = values; state.n++;
|
||||
},
|
||||
|
||||
/****************************************************************/
|
||||
|
@ -362,7 +363,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
better = true; index = [i].concat(info.index); W = info.W; w = info.w;
|
||||
if (info.penalty === PENALTY.newline) {info.index = index; info.nest--; return true}
|
||||
}
|
||||
if (!broken) {scanW = this.SVGaddWidth(k,info,scanW)}
|
||||
scanW = (broken ? info.scanW : this.SVGaddWidth(i,info,scanW));
|
||||
}
|
||||
info.index = []; i++; broken = false;
|
||||
}
|
||||
|
@ -377,7 +378,6 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
if (i === j && start.length > 1) {
|
||||
//
|
||||
// If starting and ending in the same element move the subpiece to the new line
|
||||
// Add the closing fence, if present
|
||||
//
|
||||
this.data[this.dataI[i]].SVGmoveSlice(start.slice(1),end.slice(1),svg,state,values,"paddingLeft");
|
||||
} else {
|
||||
|
@ -394,8 +394,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
i++; k = this.dataI[i]; state.first = false; start = [];
|
||||
}
|
||||
//
|
||||
// If the last item is complete, move it and the closing fence,
|
||||
// otherwise move the first part of it up to the split
|
||||
// If the last item is complete, move it
|
||||
//
|
||||
state.last = last;
|
||||
if (this.data[k]) {
|
||||
|
@ -409,11 +408,70 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
|
||||
/**************************************************************************/
|
||||
|
||||
MML.msubsup.Augment({
|
||||
SVGbetterBreak: function (info,state) {
|
||||
if (!this.data[this.base]) {return false}
|
||||
//
|
||||
// Get the current breakpoint position and other data
|
||||
//
|
||||
var index = info.index.slice(0), i = info.index.shift(),
|
||||
W, w, scanW, broken = (info.index.length > 0), better = false;
|
||||
if (!broken) {info.W += info.w; info.w = 0}
|
||||
scanW = info.scanW = info.W;
|
||||
//
|
||||
// Record the width of the base and the super- and subscripts
|
||||
//
|
||||
if (i == null) {this.SVGdata.dw = this.SVGdata.w - this.data[this.base].SVGdata.w}
|
||||
//
|
||||
// Check if the base can be broken
|
||||
//
|
||||
if (this.data[this.base].SVGbetterBreak(info,state)) {
|
||||
better = true; index = [this.base].concat(info.index); W = info.W; w = info.w;
|
||||
if (info.penalty === PENALTY.newline) {better = broken = true}
|
||||
}
|
||||
//
|
||||
// Add in the base if it is unbroken, and add the scripts
|
||||
//
|
||||
if (!broken) {this.SVGaddWidth(this.base,info,scanW)}
|
||||
info.scanW += this.SVGdata.dw; info.W = info.scanW;
|
||||
info.index = []; if (better) {info.W = W; info.w = w; info.index = index}
|
||||
return better;
|
||||
},
|
||||
|
||||
SVGmoveLine: function (start,end,svg,state,values) {
|
||||
//
|
||||
// Move the proper part of the base
|
||||
//
|
||||
if (this.data[this.base]) {
|
||||
if (start.length > 1) {
|
||||
this.data[this.base].SVGmoveSlice(start.slice(1),end.slice(1),svg,state,values,"paddingLeft");
|
||||
} else {
|
||||
if (end.length <= 1) {this.data[this.base].SVGmove(svg,state,values)}
|
||||
else {this.data[this.base].SVGmoveSlice([],end.slice(1),svg,state,values,"paddingRight")}
|
||||
}
|
||||
}
|
||||
//
|
||||
// If this is the end, check for super and subscripts, and move those
|
||||
// by moving the stack tht contains them, and shifting by the amount of the
|
||||
// base that has been removed. Remove the empty base box from the stack.
|
||||
//
|
||||
if (end.length === 0) {
|
||||
var sup = this.data[this.sup], sub = this.data[this.sub], w = svg.w, data;
|
||||
if (sup) {data = sup.SVGdata; svg.Add(sup.toSVG(),w+(data.dx||0),data.dy)}
|
||||
if (sub) {data = sub.SVGdata; svg.Add(sub.toSVG(),w+(data.dx||0),data.dy)}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
MML.mo.Augment({
|
||||
//
|
||||
// Override the method for checking line breaks to properly handle <mo>
|
||||
//
|
||||
SVGbetterBreak: function (info,state) {
|
||||
if (info.values && info.values.last === this) {return false}
|
||||
var values = this.getValues(
|
||||
"linebreak","linebreakstyle","lineleading","linebreakmultchar",
|
||||
"indentalign","indentshift",
|
||||
|
@ -468,6 +526,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
if (penalty >= info.penalty) {return false}
|
||||
info.penalty = penalty; info.values = values; info.W = W; info.w = w;
|
||||
values.lineleading = SVG.length2em(values.lineleading,state.VALUES.lineleading);
|
||||
values.last = this;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -479,6 +538,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
// Override the method for checking line breaks to properly handle <mspace>
|
||||
//
|
||||
SVGbetterBreak: function (info,state) {
|
||||
if (info.values && info.values.last === this) {return false}
|
||||
var values = this.getValues("linebreak");
|
||||
//
|
||||
// Get the default penalty for this location
|
||||
|
@ -507,7 +567,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
//
|
||||
if (penalty >= info.penalty) {return false}
|
||||
info.penalty = penalty; info.values = values; info.W = W; info.w = w;
|
||||
values.lineleading = state.VALUES.lineleading; values.linebreakstyle = "before";
|
||||
values.lineleading = state.VALUES.lineleading;
|
||||
values.linebreakstyle = "before"; values.last = this;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -536,24 +597,6 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
SVGmoveLine: function (start,end,svg,state,values) {
|
||||
return this.Core().SVGmoveSlice(start,end,svg,state,values);
|
||||
},
|
||||
/*
|
||||
* //
|
||||
* // Split and move the hit boxes as well
|
||||
* //
|
||||
* SVGmoveSlice: function (start,end,svg,state,values,padding) {
|
||||
* var hitbox = document.getElementById("MathJax-HitBox-"+this.spanID+SVG.idPostfix);
|
||||
* if (hitbox) {hitbox.parentNode.removeChild(hitbox)}
|
||||
* var slice = this.SUPER(arguments).SVGmoveSlice.apply(this,arguments);
|
||||
* if (end.length === 0) {
|
||||
* span = this.SVGspanElement(); var n = 0;
|
||||
* while (span) {
|
||||
* hitbox = this.SVGhandleHitBox(span,"-Continue-"+n);
|
||||
* span = span.nextMathJaxSpan; n++;
|
||||
* }
|
||||
* }
|
||||
* return slice;
|
||||
* }
|
||||
*/
|
||||
});
|
||||
|
||||
//
|
||||
|
|
|
@ -1813,7 +1813,7 @@
|
|||
sub.w += s; sub.r = Math.max(sub.w,sub.r);
|
||||
}
|
||||
var q = SVG.TeX.sup_drop * sscale, r = SVG.TeX.sub_drop * sscale;
|
||||
var u = base.h - q, v = base.d + r, delta = 0, p;
|
||||
var u = base.h+(base.y||0) - q, v = base.d-(base.y||0) + r, delta = 0, p;
|
||||
if (base.ic) {
|
||||
base.w -= base.ic; // remove IC (added by mo and mi)
|
||||
delta = 1.3*base.ic+.05; // adjust faked IC to be more in line with expeted results
|
||||
|
@ -1829,7 +1829,7 @@
|
|||
if (!sup) {
|
||||
if (sub) {
|
||||
v = Math.max(v,SVG.TeX.sub1*scale,sub.h-(4/5)*x_height,min.subscriptshift);
|
||||
svg.Add(sub,base.w,-v);
|
||||
svg.Add(sub,base.w,-v); this.data[this.sub].SVGdata.dy = -v;
|
||||
}
|
||||
} else {
|
||||
if (!sub) {
|
||||
|
@ -1837,6 +1837,8 @@
|
|||
p = SVG.TeX[(values.displaystyle ? "sup1" : (values.texprimestyle ? "sup3" : "sup2"))];
|
||||
u = Math.max(u,p*scale,sup.d+(1/4)*x_height,min.superscriptshift);
|
||||
svg.Add(sup,base.w+delta,u);
|
||||
this.data[this.sup].SVGdata.dx = delta;
|
||||
this.data[this.sup].SVGdata.dy = u;
|
||||
} else {
|
||||
v = Math.max(v,SVG.TeX.sub2*scale);
|
||||
var t = SVG.TeX.rule_thickness * scale;
|
||||
|
@ -1847,6 +1849,9 @@
|
|||
}
|
||||
svg.Add(sup,base.w+delta,Math.max(u,min.superscriptshift));
|
||||
svg.Add(sub,base.w,-Math.max(v,min.subscriptshift));
|
||||
this.data[this.sup].SVGdata.dx = delta;
|
||||
this.data[this.sup].SVGdata.dy = Math.max(u,min.superscriptshift);
|
||||
this.data[this.sub].SVGdata.dy = -Math.max(v,min.subscriptshift);
|
||||
}
|
||||
}
|
||||
svg.Clean();
|
||||
|
|
Loading…
Reference in New Issue
Block a user