mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 19:58:40 +00:00
Append ApplyFunction to math functions (#960)
* Append ApplyFunction to math functions As described at: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 Character U+2061 is the same as ⁡. Ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp * Add comment for \u2061
This commit is contained in:
@@ -209,8 +209,12 @@ const mathmlBuilder = (group, options) => {
|
|||||||
node = new mathMLTree.MathNode(
|
node = new mathMLTree.MathNode(
|
||||||
"mi", [new mathMLTree.TextNode(group.value.body.slice(1))]);
|
"mi", [new mathMLTree.TextNode(group.value.body.slice(1))]);
|
||||||
|
|
||||||
// TODO(ron): Append an <mo>⁡</mo> as in \operatorname
|
// Append an <mo>⁡</mo>.
|
||||||
// ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.2
|
// 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 new domTree.documentFragment([node, operator]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
@@ -68,8 +68,10 @@ defineFunction({
|
|||||||
const identifier = new mathMLTree.MathNode("mi", output);
|
const identifier = new mathMLTree.MathNode("mi", output);
|
||||||
identifier.setAttribute("mathvariant", "normal");
|
identifier.setAttribute("mathvariant", "normal");
|
||||||
|
|
||||||
|
// \u2061 is the same as ⁡
|
||||||
|
// ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp
|
||||||
const operator = new mathMLTree.MathNode("mo",
|
const operator = new mathMLTree.MathNode("mo",
|
||||||
[mml.makeText("⁡", "text")]);
|
[mml.makeText("\u2061", "text")]);
|
||||||
|
|
||||||
return new domTree.documentFragment([identifier, operator]);
|
return new domTree.documentFragment([identifier, operator]);
|
||||||
},
|
},
|
||||||
|
@@ -27,6 +27,9 @@ exports[`A MathML builder should generate the right types of nodes 1`] = `
|
|||||||
<mi>
|
<mi>
|
||||||
sin
|
sin
|
||||||
</mi>
|
</mi>
|
||||||
|
<mo>
|
||||||
|
|
||||||
|
</mo>
|
||||||
<mrow>
|
<mrow>
|
||||||
<mi>
|
<mi>
|
||||||
x
|
x
|
||||||
|
Reference in New Issue
Block a user