diff --git a/unpacked/jax/output/HTML-CSS/autoload/multiline.js b/unpacked/jax/output/HTML-CSS/autoload/multiline.js
index 09d90774a..191c02aa0 100644
--- a/unpacked/jax/output/HTML-CSS/autoload/multiline.js
+++ b/unpacked/jax/output/HTML-CSS/autoload/multiline.js
@@ -369,7 +369,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
span.style.paddingLeft = "";
if (color) {this.HTMLremoveColor(span); this.HTMLhandleColor(span)}
}
- if (state.first) {state.nextIsFirst = true} else {delete state.nextIsFirst}
+ if (state.first && span.bbox.w === 0) {state.nextIsFirst = true}
+ else {delete state.nextIsFirst}
//
// Update bounding box
//
diff --git a/unpacked/jax/output/SVG/autoload/multiline.js b/unpacked/jax/output/SVG/autoload/multiline.js
index a5bd05eac..07eb4c0ee 100644
--- a/unpacked/jax/output/SVG/autoload/multiline.js
+++ b/unpacked/jax/output/SVG/autoload/multiline.js
@@ -336,7 +336,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
if (state.last && svg.X) {svg.X = 0}
line.Add(svg,line.w,0,true);
}
- if (state.first) {state.nextIsFirst = true} else {delete state.nextIsFirst}
+ if (state.first && svg.w === 0) {state.nextIsFirst = true}
+ else {delete state.nextIsFirst}
}
});