diff --git a/unpacked/jax/output/SVG/autoload/multiline.js b/unpacked/jax/output/SVG/autoload/multiline.js index f3cf5b8e8..7fb753e19 100644 --- a/unpacked/jax/output/SVG/autoload/multiline.js +++ b/unpacked/jax/output/SVG/autoload/multiline.js @@ -86,10 +86,13 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { // // Start with a fresh SVG element // and make it full width if we are breaking to a specific width + // in the top-level math element // svg = this.SVG(); - if (SVG.linebreakWidth < SVG.BIGDIMEN) {svg.w = SVG.linebreakWidth} - else {svg.w = SVG.cwidth/SVG.em * 1000} + if (isTop && parent.type !== "mtd") { + if (SVG.linebreakWidth < SVG.BIGDIMEN) {svg.w = SVG.linebreakWidth} + else {svg.w = SVG.cwidth/SVG.em * 1000} + } var state = { n: 0, Y: 0, diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js index 0ab43bf26..eb509c72c 100644 --- a/unpacked/jax/output/SVG/jax.js +++ b/unpacked/jax/output/SVG/jax.js @@ -858,6 +858,17 @@ }, Align: function (svg,align,dx,dy) { dx = ({left: dx, center: (this.w - svg.w)/2, right: this.w - svg.w - dx})[align] || 0; + // + // If we extend to the left of the current contents, + // move the contents to the right and adjust the bounding box + // + if (dx < 0) { + if (this.element.childNodes.length) { + this.element.setAttribute("transform","translate("+Math.floor(-dx)+",0)"); + var g = SVG.Element("g"); g.appendChild(this.element); this.element = g; + } + this.l -= dx; this.w -= dx; this.r -= dx; dx = 0; + } this.Add(svg,dx,dy); }, Clean: function () {