Handle movablelimits on TeXAtom elements. Resolves issue #1197.
This commit is contained in:
parent
3ba60663df
commit
dc450d6bc7
|
@ -186,8 +186,15 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
|
||||||
MML.munderover.Augment({
|
MML.munderover.Augment({
|
||||||
toMathML: function (space) {
|
toMathML: function (space) {
|
||||||
var tag = this.type;
|
var tag = this.type;
|
||||||
if (this.data[this.under] == null) {tag = "mover"}
|
var base = this.data[this.base];
|
||||||
if (this.data[this.over] == null) {tag = "munder"}
|
if (base && base.isa(MML.TeXAtom) && base.movablelimits && !base.Get("displaystyle")) {
|
||||||
|
type = "msubsup";
|
||||||
|
if (this.data[this.under] == null) {tag = "msup"}
|
||||||
|
if (this.data[this.over] == null) {tag = "msub"}
|
||||||
|
} else {
|
||||||
|
if (this.data[this.under] == null) {tag = "mover"}
|
||||||
|
if (this.data[this.over] == null) {tag = "munder"}
|
||||||
|
}
|
||||||
var attr = this.toMathMLattributes();
|
var attr = this.toMathMLattributes();
|
||||||
delete this.data[0].inferred;
|
delete this.data[0].inferred;
|
||||||
var data = [];
|
var data = [];
|
||||||
|
|
|
@ -1367,6 +1367,7 @@
|
||||||
}
|
}
|
||||||
op.movesupsub = (limits ? true : false);
|
op.movesupsub = (limits ? true : false);
|
||||||
op.Core().movablelimits = false;
|
op.Core().movablelimits = false;
|
||||||
|
if (op.movablelimits) op.movablelimits = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
Over: function (name,open,close) {
|
Over: function (name,open,close) {
|
||||||
|
|
|
@ -2054,13 +2054,14 @@
|
||||||
MML.munderover.Augment({
|
MML.munderover.Augment({
|
||||||
toCommonHTML: function (node,stretch) {
|
toCommonHTML: function (node,stretch) {
|
||||||
var values = this.getValues("displaystyle","accent","accentunder","align");
|
var values = this.getValues("displaystyle","accent","accentunder","align");
|
||||||
if (!values.displaystyle && this.data[this.base] != null &&
|
var base = this.data[this.base];
|
||||||
this.data[this.base].CoreMO().Get("movablelimits"))
|
if (!values.displaystyle && base != null &&
|
||||||
|
(base.movablelimits || base.CoreMO().Get("movablelimits")))
|
||||||
return MML.msubsup.prototype.toCommonHTML.call(this,node,stretch);
|
return MML.msubsup.prototype.toCommonHTML.call(this,node,stretch);
|
||||||
//
|
//
|
||||||
// Get the nodes for base and limits
|
// Get the nodes for base and limits
|
||||||
//
|
//
|
||||||
var base, under, over, nodes = [];
|
var under, over, nodes = [];
|
||||||
if (stretch) {
|
if (stretch) {
|
||||||
base = CHTML.getNode(node,"mjx-op");
|
base = CHTML.getNode(node,"mjx-op");
|
||||||
under = CHTML.getNode(node,"mjx-under");
|
under = CHTML.getNode(node,"mjx-under");
|
||||||
|
|
|
@ -2713,8 +2713,9 @@
|
||||||
MML.munderover.Augment({
|
MML.munderover.Augment({
|
||||||
toHTML: function (span,HW,D) {
|
toHTML: function (span,HW,D) {
|
||||||
var values = this.getValues("displaystyle","accent","accentunder","align");
|
var values = this.getValues("displaystyle","accent","accentunder","align");
|
||||||
if (!values.displaystyle && this.data[this.base] != null &&
|
var base = this.data[this.base];
|
||||||
this.data[this.base].CoreMO().Get("movablelimits"))
|
if (!values.displaystyle && base != null &&
|
||||||
|
(base.movablelimits || base.CoreMO().Get("movablelimits")))
|
||||||
{return MML.msubsup.prototype.toHTML.call(this,span)}
|
{return MML.msubsup.prototype.toHTML.call(this,span)}
|
||||||
span = this.HTMLcreateSpan(span); var scale = this.HTMLgetScale();
|
span = this.HTMLcreateSpan(span); var scale = this.HTMLgetScale();
|
||||||
var stack = HTMLCSS.createStack(span);
|
var stack = HTMLCSS.createStack(span);
|
||||||
|
@ -2753,8 +2754,8 @@
|
||||||
if (box.bbox.w > WW) {WW = box.bbox.w}
|
if (box.bbox.w > WW) {WW = box.bbox.w}
|
||||||
}}
|
}}
|
||||||
var t = HTMLCSS.TeX.rule_thickness * this.mscale, factor = HTMLCSS.FONTDATA.TeX_factor;
|
var t = HTMLCSS.TeX.rule_thickness * this.mscale, factor = HTMLCSS.FONTDATA.TeX_factor;
|
||||||
var base = boxes[this.base] || {bbox: this.HTMLzeroBBox()};
|
|
||||||
var x, y, z1, z2, z3, dw, k, delta = 0;
|
var x, y, z1, z2, z3, dw, k, delta = 0;
|
||||||
|
base = boxes[this.base] || {bbox: this.HTMLzeroBBox()};
|
||||||
if (base.bbox.ic) {delta = 1.3*base.bbox.ic + .05} // adjust faked IC to be more in line with expeted results
|
if (base.bbox.ic) {delta = 1.3*base.bbox.ic + .05} // adjust faked IC to be more in line with expeted results
|
||||||
for (i = 0, m = this.data.length; i < m; i++) {
|
for (i = 0, m = this.data.length; i < m; i++) {
|
||||||
if (this.data[i] != null) {
|
if (this.data[i] != null) {
|
||||||
|
|
|
@ -630,12 +630,19 @@
|
||||||
MML.munderover.Augment({
|
MML.munderover.Augment({
|
||||||
//
|
//
|
||||||
// Use proper version of munder, mover, or munderover, depending on
|
// Use proper version of munder, mover, or munderover, depending on
|
||||||
// which items are present
|
// which items are present. Handle movablelimits on TeXAtom base.
|
||||||
//
|
//
|
||||||
toNativeMML: function (parent) {
|
toNativeMML: function (parent) {
|
||||||
var type = this.type;
|
var type = this.type;
|
||||||
if (this.data[this.under] == null) {type = "mover"}
|
var base = this.data[this.base];
|
||||||
if (this.data[this.over] == null) {type = "munder"}
|
if (base && base.isa(MML.TeXAtom) && base.movablelimits && !base.Get("displaystyle")) {
|
||||||
|
type = "msubsup";
|
||||||
|
if (this.data[this.under] == null) {type = "msup"}
|
||||||
|
if (this.data[this.over] == null) {type = "msub"}
|
||||||
|
} else {
|
||||||
|
if (this.data[this.under] == null) {type = "mover"}
|
||||||
|
if (this.data[this.over] == null) {type = "munder"}
|
||||||
|
}
|
||||||
var tag = this.NativeMMLelement(type);
|
var tag = this.NativeMMLelement(type);
|
||||||
this.NativeMMLattributes(tag);
|
this.NativeMMLattributes(tag);
|
||||||
if (this.data[0]) {delete this.data[0].inferred}
|
if (this.data[0]) {delete this.data[0].inferred}
|
||||||
|
|
|
@ -750,8 +750,9 @@
|
||||||
MML.munderover.Augment({
|
MML.munderover.Augment({
|
||||||
toPreviewHTML: function (span) {
|
toPreviewHTML: function (span) {
|
||||||
var values = this.getValues("displaystyle","accent","accentunder","align");
|
var values = this.getValues("displaystyle","accent","accentunder","align");
|
||||||
if (!values.displaystyle && this.data[this.base] != null &&
|
var base = this.data[this.base];
|
||||||
this.data[this.base].CoreMO().Get("movablelimits")) {
|
if (!values.displaystyle && base != null &&
|
||||||
|
(base.movablelimits || base.CoreMO().Get("movablelimits"))) {
|
||||||
span = MML.msubsup.prototype.toPreviewHTML.call(this,span);
|
span = MML.msubsup.prototype.toPreviewHTML.call(this,span);
|
||||||
//
|
//
|
||||||
// Change class to msubsup for CSS rules.
|
// Change class to msubsup for CSS rules.
|
||||||
|
|
|
@ -1882,8 +1882,9 @@
|
||||||
toSVG: function (HW,D) {
|
toSVG: function (HW,D) {
|
||||||
this.SVGgetStyles();
|
this.SVGgetStyles();
|
||||||
var values = this.getValues("displaystyle","accent","accentunder","align");
|
var values = this.getValues("displaystyle","accent","accentunder","align");
|
||||||
if (!values.displaystyle && this.data[this.base] != null &&
|
var base = this.data[this.base];
|
||||||
this.data[this.base].CoreMO().Get("movablelimits"))
|
if (!values.displaystyle && base != null &&
|
||||||
|
(base.movablelimits || base.CoreMO().Get("movablelimits")))
|
||||||
{return MML.msubsup.prototype.toSVG.call(this)}
|
{return MML.msubsup.prototype.toSVG.call(this)}
|
||||||
var svg = this.SVG(), scale = this.SVGgetScale(svg); this.SVGhandleSpace(svg);
|
var svg = this.SVG(), scale = this.SVGgetScale(svg); this.SVGhandleSpace(svg);
|
||||||
var boxes = [], stretch = [], box, i, m, W = -SVG.BIGDIMEN, WW = W;
|
var boxes = [], stretch = [], box, i, m, W = -SVG.BIGDIMEN, WW = W;
|
||||||
|
@ -1909,8 +1910,8 @@
|
||||||
if (boxes[i].w > WW) {WW = boxes[i].w}
|
if (boxes[i].w > WW) {WW = boxes[i].w}
|
||||||
}}
|
}}
|
||||||
var t = SVG.TeX.rule_thickness * this.mscale;
|
var t = SVG.TeX.rule_thickness * this.mscale;
|
||||||
var base = boxes[this.base] || {w:0, h:0, d:0, H:0, D:0, l:0, r:0, y:0, scale:scale};
|
|
||||||
var x, y, z1, z2, z3, dw, k, delta = 0;
|
var x, y, z1, z2, z3, dw, k, delta = 0;
|
||||||
|
base = boxes[this.base] || {w:0, h:0, d:0, H:0, D:0, l:0, r:0, y:0, scale:scale};
|
||||||
if (base.ic) {delta = 1.3*base.ic + .05} // adjust faked IC to be more in line with expeted results
|
if (base.ic) {delta = 1.3*base.ic + .05} // adjust faked IC to be more in line with expeted results
|
||||||
for (i = 0, m = this.data.length; i < m; i++) {
|
for (i = 0, m = this.data.length; i < m; i++) {
|
||||||
if (this.data[i] != null) {
|
if (this.data[i] != null) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user