diff --git a/testsuite/tests/input/tex/__snapshots__/Bussproofs.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Bussproofs.test.ts.snap
index f30adfc1e..78e77a56a 100644
--- a/testsuite/tests/input/tex/__snapshots__/Bussproofs.test.ts.snap
+++ b/testsuite/tests/input/tex/__snapshots__/Bussproofs.test.ts.snap
@@ -616,8 +616,7 @@ exports[`BussproofsRegInf Unary Inference Abbr 1`] = `
exports[`BussproofsRegProofs Extreme 1`] = `
""
`;
exports[`BussproofsRegProofs Proof Mixing Order 1`] = `
"
-
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
@@ -1165,10 +1145,8 @@ exports[`BussproofsRegProofs Proof Mixing Order 1`] = `
-
-
-
-
+
+
@@ -1176,8 +1154,7 @@ exports[`BussproofsRegProofs Proof Mixing Order 1`] = `
-
-
+
@@ -1308,7 +1285,7 @@ exports[`BussproofsRegProofs Proof Mixing Order 1`] = `
-
+
@@ -1352,7 +1329,6 @@ exports[`BussproofsRegProofs Proof Mixing Order 1`] = `
-
@@ -1384,7 +1360,6 @@ exports[`BussproofsRegProofs Proof Mixing Order 1`] = `
-
@@ -1424,25 +1399,21 @@ exports[`BussproofsRegProofs Proof Mixing Order 1`] = `
-
"
`;
exports[`BussproofsRegProofs Proof Very Right Label 1`] = `
"
-
-
+
-
-
-
-
+
+
@@ -1450,8 +1421,7 @@ exports[`BussproofsRegProofs Proof Very Right Label 1`] = `
-
-
+
@@ -1503,7 +1473,7 @@ exports[`BussproofsRegProofs Proof Very Right Label 1`] = `
-
+
@@ -1519,7 +1489,7 @@ exports[`BussproofsRegProofs Proof Very Right Label 1`] = `
-
+
@@ -1565,7 +1535,6 @@ exports[`BussproofsRegProofs Proof Very Right Label 1`] = `
Nowhere
-
@@ -1586,7 +1555,6 @@ exports[`BussproofsRegProofs Proof Very Right Label 1`] = `
BBB
-
@@ -1626,7 +1594,7 @@ exports[`BussproofsRegProofs Proof Very Right Label 1`] = `
-
+
@@ -1658,7 +1626,6 @@ exports[`BussproofsRegProofs Proof Very Right Label 1`] = `
QERE
-
@@ -1709,14 +1676,13 @@ exports[`BussproofsRegProofs Proof Very Right Label 1`] = `
-
"
`;
exports[`BussproofsRegProofs Simple Proof 1`] = `
"
-
+
@@ -1731,7 +1697,7 @@ exports[`BussproofsRegProofs Simple Proof 1`] = `
-
+
@@ -1801,7 +1767,6 @@ exports[`BussproofsRegProofs Simple Proof 1`] = `
-
@@ -1818,31 +1783,27 @@ exports[`BussproofsRegProofs Simple Proof 1`] = `
-
"
`;
exports[`BussproofsRegProofs Simple Proof Large 1`] = `
"
-
-
+
-
-
+
-
-
+
@@ -1889,7 +1850,7 @@ exports[`BussproofsRegProofs Simple Proof Large 1`] = `
-
+
@@ -1959,7 +1920,6 @@ exports[`BussproofsRegProofs Simple Proof Large 1`] = `
-
@@ -2012,7 +1972,7 @@ exports[`BussproofsRegProofs Simple Proof Large 1`] = `
exports[`BussproofsRegProofs Simple Proof Noise 1`] = `
"
-
+
$
α
$
@@ -2030,7 +1990,7 @@ exports[`BussproofsRegProofs Simple Proof Noise 1`] = `
-
+
@@ -2100,7 +2060,6 @@ exports[`BussproofsRegProofs Simple Proof Noise 1`] = `
-
@@ -2117,15 +2076,13 @@ exports[`BussproofsRegProofs Simple Proof Noise 1`] = `
-
"
`;
exports[`BussproofsRegProofs Simple Proofs Left Labels 1`] = `
"
-
-
+
@@ -2138,12 +2095,9 @@ exports[`BussproofsRegProofs Simple Proofs Left Labels 1`] = `
-
-
-
-
-
-
+
+
+
CCCCC
@@ -2153,8 +2107,7 @@ exports[`BussproofsRegProofs Simple Proofs Left Labels 1`] = `
-
-
+
@@ -2201,7 +2154,7 @@ exports[`BussproofsRegProofs Simple Proofs Left Labels 1`] = `
-
+
BBB
@@ -2281,7 +2234,6 @@ exports[`BussproofsRegProofs Simple Proofs Left Labels 1`] = `
-
@@ -2337,8 +2289,7 @@ exports[`BussproofsRegProofs Simple Proofs Left Labels 1`] = `
exports[`BussproofsRegProofs Simple Proofs Mixed Labels 1`] = `
"
-
-
+
@@ -2351,12 +2302,9 @@ exports[`BussproofsRegProofs Simple Proofs Mixed Labels 1`] = `
-
-
-
-
-
-
+
+
+
CCCCC
@@ -2366,8 +2314,7 @@ exports[`BussproofsRegProofs Simple Proofs Mixed Labels 1`] = `
-
-
+
@@ -2414,7 +2361,7 @@ exports[`BussproofsRegProofs Simple Proofs Mixed Labels 1`] = `
-
+
BBB
@@ -2433,7 +2380,7 @@ exports[`BussproofsRegProofs Simple Proofs Mixed Labels 1`] = `
-
+
@@ -2479,7 +2426,6 @@ exports[`BussproofsRegProofs Simple Proofs Mixed Labels 1`] = `
AAAA
-
@@ -2497,7 +2443,6 @@ exports[`BussproofsRegProofs Simple Proofs Mixed Labels 1`] = `
-
@@ -2558,8 +2503,7 @@ exports[`BussproofsRegProofs Simple Proofs Mixed Labels 1`] = `
exports[`BussproofsRegProofs Simple Proofs Right Labels 1`] = `
"
-
-
+
@@ -2567,10 +2511,8 @@ exports[`BussproofsRegProofs Simple Proofs Right Labels 1`] = `
-
-
-
-
+
+
@@ -2578,8 +2520,7 @@ exports[`BussproofsRegProofs Simple Proofs Right Labels 1`] = `
-
-
+
@@ -2626,7 +2567,7 @@ exports[`BussproofsRegProofs Simple Proofs Right Labels 1`] = `
-
+
@@ -2642,7 +2583,7 @@ exports[`BussproofsRegProofs Simple Proofs Right Labels 1`] = `
-
+
@@ -2688,7 +2629,6 @@ exports[`BussproofsRegProofs Simple Proofs Right Labels 1`] = `
AAAA
-
@@ -2709,7 +2649,6 @@ exports[`BussproofsRegProofs Simple Proofs Right Labels 1`] = `
BBB
-
diff --git a/ts/input/tex/bussproofs/BussproofsUtil.ts b/ts/input/tex/bussproofs/BussproofsUtil.ts
index 3e1caccc6..a69d5f0c6 100644
--- a/ts/input/tex/bussproofs/BussproofsUtil.ts
+++ b/ts/input/tex/bussproofs/BussproofsUtil.ts
@@ -52,7 +52,7 @@ let item: MATHITEM = null;
* @param {MmlNode} node The target node.
* @returns {number} Width of the proof node.
*/
-const getBBox = function (node: MmlNode) {
+const getBBox = function (node: MmlNode): number {
item.root = node;
const { w: width } = (doc.outputJax as any).getBBox(item, doc);
return width;
@@ -190,8 +190,8 @@ const getParentInf = function (inf: MmlNode): MmlNode {
return inf;
};
-// Computes bbox spaces
//
+// Computes bbox spaces
//
/**
@@ -214,11 +214,8 @@ const getSpaces = function (
return result;
}
if (inf !== rule.parent) {
- const children = inf.childNodes;
- const index = right ? children.length - 1 : 0;
- if (NodeUtil.isType(children[index], 'mspace')) {
- result += getBBox(children[index]);
- }
+ result +=
+ (inf.getProperty(right ? 'proof-right' : 'proof-left') as number) || 0;
inf = rule.parent;
}
if (inf === rule) {
@@ -278,29 +275,16 @@ const addSpace = function (
moveProperties(inf, mrow);
inf = mrow;
}
- // TODO: Simplify below as we now have a definite mrow.
- const index = right ? inf.childNodes.length - 1 : 0;
- let mspace = inf.childNodes[index];
- if (NodeUtil.isType(mspace, 'mspace')) {
- NodeUtil.setAttribute(
- mspace,
- 'width',
- UnitUtil.em(
- UnitUtil.dimen2em(NodeUtil.getAttribute(mspace, 'width') as string) +
- space
- )
- );
- return;
- }
- mspace = config.nodeFactory.create('node', 'mspace', [], {
- width: UnitUtil.em(space),
- });
- if (right) {
- inf.appendChild(mspace);
- return;
+ const prop = right ? 'proof-right' : 'proof-left';
+ inf.setProperty(prop, ((inf.getProperty(prop) as number) || 0) + space);
+ const styles = [];
+ for (const side of ['left', 'right']) {
+ const margin = inf.getProperty(`proof-${side}`) as number;
+ if (margin) {
+ styles.push(`margin-${side}: ${UnitUtil.em(margin)}`);
+ }
}
- mspace.parent = inf;
- inf.childNodes.unshift(mspace);
+ inf.attributes.set('style', styles.join('; '));
};
/**