From cb477ca01a6e3ef8c6d8d4bf8d0d1309aa2f651b Mon Sep 17 00:00:00 2001 From: Ron Kok Date: Sat, 23 Mar 2019 21:02:12 -0700 Subject: [PATCH] Improve MathML for \limits (#1897) * Improve MathML for \limits * Make code parallel --- src/functions/op.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/functions/op.js b/src/functions/op.js index 69fd9b60..e11007f7 100644 --- a/src/functions/op.js +++ b/src/functions/op.js @@ -252,18 +252,16 @@ const mathmlBuilder: MathMLBuilder<"op"> = (group, options) => { // operator's name. // TODO(emily): Add a space in the middle of some of these // operators, like \limsup. + node = new mathMLTree.MathNode( + "mi", [new mathMLTree.TextNode(group.name.slice(1))]); + // Append an . + // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 + const operator = new mathMLTree.MathNode("mo", + [mml.makeText("\u2061", "text")]); if (group.parentIsSupSub) { - node = new mathMLTree.MathNode( - "mo", [new mathMLTree.TextNode(group.name.slice(1))]); + node = new mathMLTree.MathNode("mo", [node, operator]); } else { - node = new mathMLTree.MathNode( - "mi", [new mathMLTree.TextNode(group.name.slice(1))]); - // Append an . - // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 - const operator = new mathMLTree.MathNode("mo", - [mml.makeText("\u2061", "text")]); - - return mathMLTree.newDocumentFragment([node, operator]); + node = mathMLTree.newDocumentFragment([node, operator]); } }