Fix ApplyFunction character (#1890)

This commit is contained in:
Ron Kok
2019-03-22 18:30:33 -07:00
committed by ylemkimon
parent a1e341a5c6
commit f8f4809886
4 changed files with 24 additions and 8 deletions

View File

@@ -99,6 +99,7 @@ defineFunction({
mode: baseArg.mode,
limits: true,
alwaysHandleSupSub: true,
parentIsSupSub: false,
symbol: false,
suppressBaseShift: funcName !== "\\stackrel",
body: ordargument(baseArg),

View File

@@ -252,15 +252,19 @@ 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))]);
if (group.parentIsSupSub) {
node = new mathMLTree.MathNode(
"mo", [new mathMLTree.TextNode(group.name.slice(1))]);
} else {
node = new mathMLTree.MathNode(
"mi", [new mathMLTree.TextNode(group.name.slice(1))]);
// Append an <mo>&ApplyFunction;</mo>.
// ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
const operator = new mathMLTree.MathNode("mo",
[mml.makeText("\u2061", "text")]);
// Append an <mo>&ApplyFunction;</mo>.
// 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]);
return mathMLTree.newDocumentFragment([node, operator]);
}
}
return node;
@@ -302,6 +306,7 @@ defineFunction({
type: "op",
mode: parser.mode,
limits: true,
parentIsSupSub: false,
symbol: true,
name: fName,
};
@@ -324,6 +329,7 @@ defineFunction({
type: "op",
mode: parser.mode,
limits: false,
parentIsSupSub: false,
symbol: false,
body: ordargument(body),
};
@@ -363,6 +369,7 @@ defineFunction({
type: "op",
mode: parser.mode,
limits: false,
parentIsSupSub: false,
symbol: false,
name: funcName,
};
@@ -385,6 +392,7 @@ defineFunction({
type: "op",
mode: parser.mode,
limits: true,
parentIsSupSub: false,
symbol: false,
name: funcName,
};
@@ -412,6 +420,7 @@ defineFunction({
type: "op",
mode: parser.mode,
limits: false,
parentIsSupSub: false,
symbol: true,
name: fName,
};

View File

@@ -201,6 +201,10 @@ defineFunctionBuilders({
}
}
if (group.base && group.base.type === "op") {
group.base.parentIsSupSub = true;
}
const children = [mml.buildGroup(group.base, options)];
if (group.sub) {

View File

@@ -66,6 +66,7 @@ type ParseNodeTypes = {
limits: boolean,
alwaysHandleSupSub?: boolean,
suppressBaseShift?: boolean,
parentIsSupSub: boolean,
symbol: boolean,
name: string,
body?: void,
@@ -76,6 +77,7 @@ type ParseNodeTypes = {
limits: boolean,
alwaysHandleSupSub?: boolean,
suppressBaseShift?: boolean,
parentIsSupSub: boolean,
symbol: false, // If 'symbol' is true, `body` *must* be set.
name?: void,
body: AnyParseNode[],