diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js
index 6b9e78516..e62afc7de 100644
--- a/unpacked/jax/output/CommonHTML/jax.js
+++ b/unpacked/jax/output/CommonHTML/jax.js
@@ -539,6 +539,7 @@
this.CHTMLhandleColor(span);
if (this.isToken) this.CHTMLhandleToken(span);
for (var i = 0, m = this.data.length; i < m; i++) this.CHTMLaddChild(span,i,options);
+ if (!options.noMargins && !options.noBBox) this.CHTMLhandleMargins(span);
return span;
},
CHTMLaddChild: function (span,i,options) {
@@ -613,6 +614,20 @@
}
},
+ CHTMLhandleMargins: function (span,box) {
+ var bbox = this.CHTML;
+ // ### FIXME: should these be FONTDATA values?
+ if (bbox.h < .9 || bbox.d < .25) {
+ if (box == null) {
+ box = HTML.Element("span",{className:"MJXc-box"});
+ while (span.firstChild) box.appendChild(span.firstChild);
+ span.appendChild(box);
+ }
+ if (bbox.h < .9) box.style.marginTop = CHTML.Em(bbox.h-.9);
+ if (bbox.d < .25) box.style.marginBottom = CHTML.Em(bbox.d-.25);
+ }
+ },
+
CHTMLhandleText: function (span,text,variant) {
var c, n;
var H = 0, D = 0, W = 0;