From 0529b5d78c07f4d151e35c24a49b4be67d3e9795 Mon Sep 17 00:00:00 2001
From: "Davide P. Cervone" <dpvc@union.edu>
Date: Sat, 27 Dec 2014 08:56:58 -0500
Subject: [PATCH] Take base.x into account for positioning of super ans
 subscripts.  Resolves issue #966.

---
 unpacked/jax/output/SVG/jax.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js
index 4c79c4cc8..92d00f785 100644
--- a/unpacked/jax/output/SVG/jax.js
+++ b/unpacked/jax/output/SVG/jax.js
@@ -1976,17 +1976,18 @@
 	var min = this.getValues("subscriptshift","superscriptshift");
 	min.subscriptshift   = (min.subscriptshift === ""   ? 0 : SVG.length2em(min.subscriptshift,mu));
 	min.superscriptshift = (min.superscriptshift === "" ? 0 : SVG.length2em(min.superscriptshift,mu));
+        var x = base.w + base.x;
 	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); this.data[this.sub].SVGdata.dy = -v;
+            svg.Add(sub,x,-v); this.data[this.sub].SVGdata.dy = -v;
 	  }
 	} else {
 	  if (!sub) {
 	    values = this.getValues("displaystyle","texprimestyle");
 	    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);
+            svg.Add(sup,x+delta,u);
             this.data[this.sup].SVGdata.dx = delta; 
             this.data[this.sup].SVGdata.dy = u;
 	  } else {
@@ -1997,8 +1998,8 @@
 	      q = (4/5)*x_height - (u - sup.d);
 	      if (q > 0) {u += q; v -= q}
 	    }
-            svg.Add(sup,base.w+delta,Math.max(u,min.superscriptshift));
-	    svg.Add(sub,base.w,-Math.max(v,min.subscriptshift));
+            svg.Add(sup,x+delta,Math.max(u,min.superscriptshift));
+	    svg.Add(sub,x,-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);