Improve MathML for \not (#1923)

* Improve MathML for \not

* Move into previous loop

* Update buildMathML.js
This commit is contained in:
Ron Kok
2019-04-05 18:40:00 -07:00
committed by ylemkimon
parent 070883532a
commit eeb403fc5c
2 changed files with 15 additions and 4 deletions

View File

@@ -145,14 +145,24 @@ export const buildExpression = function(
lastGroup.children.push(...group.children);
continue;
}
} else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) {
const lastChild = lastGroup.children[0];
if (lastChild instanceof TextNode && lastChild.text === '\u0338' &&
(group.type === 'mo' || group.type === 'mi' ||
group.type === 'mn')) {
const child = group.children[0];
if (child instanceof TextNode && child.text.length > 0) {
// Overlay with combining character long solidus
child.text = child.text.slice(0, 1) + "\u0338" +
child.text.slice(1);
groups.pop();
}
}
}
}
groups.push(group);
lastGroup = group;
}
// TODO(kevinb): combine \\not with mrels and mords
return groups;
};

View File

@@ -348,7 +348,8 @@ defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
// \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36}
// It's thus treated like a \mathrel, but defined by a symbol that has zero
// width but extends to the right. We use \rlap to get that spacing.
defineMacro("\\not", '\\mathrel{\\mathrlap\\@not}');
// For MathML we write U+0338 here. buildMathML.js will then do the overlay.
defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');
// Negated symbols from base/fontmath.ltx:
// \def\neq{\not=} \let\ne=\neq