diff --git a/unpacked/jax/element/mml/jax.js b/unpacked/jax/element/mml/jax.js index 4dad22a4d..f401a5c61 100644 --- a/unpacked/jax/element/mml/jax.js +++ b/unpacked/jax/element/mml/jax.js @@ -638,7 +638,16 @@ MathJax.ElementJax.mml.Augment({ depth: "0ex", linebreak: MML.LINEBREAK.AUTO }, - hasNewline: function () {return (this.Get("linebreak") === MML.LINEBREAK.NEWLINE)} + hasDimAttr: function () { + return (this.hasValue("width") || this.hasValue("height") || + this.hasValue("depth")); + }, + hasNewline: function () { + // The MathML spec says that the linebreak attribute should be ignored + // if any dimensional attribute is set. + return (!this.hasDimAttr() && + this.Get("linebreak") === MML.LINEBREAK.NEWLINE); + } }); MML.ms = MML.mbase.Subclass({ diff --git a/unpacked/jax/output/HTML-CSS/autoload/multiline.js b/unpacked/jax/output/HTML-CSS/autoload/multiline.js index 639d0b35e..f4ba8218a 100644 --- a/unpacked/jax/output/HTML-CSS/autoload/multiline.js +++ b/unpacked/jax/output/HTML-CSS/autoload/multiline.js @@ -1,3 +1,5 @@ +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/jax/output/HTML-CSS/autoload/multiline.js @@ -594,6 +596,12 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { HTMLbetterBreak: function (info,state) { if (info.values && info.values.id === this.spanID) {return false} var values = this.getValues("linebreak"); + var linebreakValue = values.linebreak; + if (!linebreakValue || this.hasDimAttr()) { + // The MathML spec says that the linebreak attribute should be ignored + // if any dimensional attribute is set. + linebreakValue = MML.LINEBREAK.AUTO; + } // // Get the default penalty for this location // @@ -609,8 +617,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { // Get the penalty for this type of break and // use it to modify the default penalty // - var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO]; - if (values.linebreak === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit) + var linebreak = PENALTY[linebreakValue]; + if (linebreakValue === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit) {linebreak = [(w+PENALTY.spaceoffset)*PENALTY.spacefactor]} if (!(linebreak instanceof Array)) { // for breaks past the width, don't modify penalty diff --git a/unpacked/jax/output/SVG/autoload/multiline.js b/unpacked/jax/output/SVG/autoload/multiline.js index 3025cb044..6553c1080 100644 --- a/unpacked/jax/output/SVG/autoload/multiline.js +++ b/unpacked/jax/output/SVG/autoload/multiline.js @@ -1,3 +1,5 @@ +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/jax/output/SVG/autoload/multiline.js @@ -541,6 +543,12 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { SVGbetterBreak: function (info,state) { if (info.values && info.values.last === this) {return false} var values = this.getValues("linebreak"); + var linebreakValue = values.linebreak; + if (!linebreakValue || this.hasDimAttr()) { + // The MathML spec says that the linebreak attribute should be ignored + // if any dimensional attribute is set. + linebreakValue = MML.LINEBREAK.AUTO; + } // // Get the default penalty for this location // @@ -555,8 +563,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { // Get the penalty for this type of break and // use it to modify the default penalty // - var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO]; - if (values.linebreak === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit*1000) + var linebreak = PENALTY[linebreakValue]; + if (linebreakValue === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit*1000) {linebreak = [(w+PENALTY.spaceoffset)*PENALTY.spacefactor]} if (!(linebreak instanceof Array)) { // for breaks past the width, don't modify penalty