diff --git a/src/buildMathML.js b/src/buildMathML.js index 20d42560..89aa6e58 100644 --- a/src/buildMathML.js +++ b/src/buildMathML.js @@ -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; }; diff --git a/src/macros.js b/src/macros.js index 06541df7..e8c68497 100644 --- a/src/macros.js +++ b/src/macros.js @@ -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