Skip to content

Commit 2cc672f

Browse files
authored
Merge pull request #1547 from dpvc/issue1539
Fix fractions with line breaks in HTML output. #1539
2 parents 66c73ce + 38a9a12 commit 2cc672f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

unpacked/jax/output/CommonHTML/jax.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2423,6 +2423,7 @@
24232423
toCommonHTML: function (node) {
24242424
node = this.CHTMLdefaultNode(node,{
24252425
childNodes:["mjx-numerator","mjx-denominator"],
2426+
childOptions: {autowidth: true},
24262427
forceChild:true, noBBox:true, minChildren:2
24272428
});
24282429
var values = this.getValues("linethickness","displaystyle",
@@ -2610,7 +2611,8 @@
26102611
/********************************************************/
26112612

26122613
MML.mrow.Augment({
2613-
toCommonHTML: function (node) {
2614+
toCommonHTML: function (node,options) {
2615+
options = options || {};
26142616
node = this.CHTMLdefaultNode(node);
26152617
var bbox = this.CHTML, H = bbox.h, D = bbox.d, hasNegative;
26162618
for (var i = 0, m = this.data.length; i < m; i++) {
@@ -2619,6 +2621,7 @@
26192621
}
26202622
if (this.CHTMLlineBreaks()) {
26212623
this.CHTMLmultiline(node);
2624+
if (options.autowidth) node.style.width = "";
26222625
} else {
26232626
if (hasNegative && bbox.w) node.style.width = CHTML.Em(Math.max(0,bbox.w));
26242627
if (bbox.w < 0) node.style.marginRight = CHTML.Em(bbox.w);

unpacked/jax/output/HTML-CSS/jax.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@
12961296
if (bbox.tw) {BBOX.tw = bbox.tw}
12971297
}
12981298
},
1299-
alignBox: function (span,align,y,dx) {
1299+
alignBox: function (span,align,y,dx,noskip) {
13001300
if (dx == null) {dx = 0}
13011301
this.placeBox(span,dx,y); // set y position (and left aligned)
13021302
if (this.msiePlaceBoxBug) {
@@ -1307,7 +1307,7 @@
13071307
while (node && node.nodeName !== "#text") {node = node.previousSibling}
13081308
if (node) {span.removeChild(node)}
13091309
}
1310-
var bbox = span.bbox; if (bbox.isMultiline) return;
1310+
var bbox = span.bbox; if (bbox.isMultiline && !noskip) return;
13111311
var isRelative = bbox.width != null && !bbox.isFixed;
13121312
var r = 0, c = dx-bbox.w/2, l = "50%";
13131313
if (this.initialSkipBug) {r = bbox.w-bbox.rw-.1; c += bbox.lw}
@@ -2592,8 +2592,8 @@
25922592
HTMLCSS.createRule(rule,t,0,W+2*t);
25932593
HTMLCSS.placeBox(rule,0,a-t/2);
25942594
}
2595-
HTMLCSS.alignBox(num,values.numalign,u);
2596-
HTMLCSS.alignBox(den,values.denomalign,-v);
2595+
HTMLCSS.alignBox(num,values.numalign,u,0,true);
2596+
HTMLCSS.alignBox(den,values.denomalign,-v,0,true);
25972597
}
25982598
this.HTMLhandleSpace(span);
25992599
this.HTMLhandleColor(span);

0 commit comments

Comments
 (0)