mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-07 12:18:39 +00:00
Improve MathML for \not (#1923)
* Improve MathML for \not * Move into previous loop * Update buildMathML.js
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user