mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-08 12:38:39 +00:00
Fix \not vertical alignment (#1497)
* Fix \not vertical alignment Fix #1491 by changing from `position: absolute` to `position: relative`. * Switch to \rlap implementation of \not * Separate \not the macro from \not the symbol via \@not * Fix test
This commit is contained in:
@@ -183,15 +183,6 @@ export const buildExpression = function(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process \\not commands within the group.
|
|
||||||
for (let i = 0; i < groups.length; i++) {
|
|
||||||
const group = groups[i];
|
|
||||||
if (group instanceof domTree.symbolNode && group.value === "\u0338") {
|
|
||||||
// Results in a solidus being overlaid over the following group/atom.
|
|
||||||
group.style.position = "absolute";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return groups;
|
return groups;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -357,6 +357,12 @@ defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
|
|||||||
defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
|
defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
|
||||||
defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
|
defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
|
||||||
|
|
||||||
|
// \not is defined by base/fontmath.ltx via
|
||||||
|
// \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}');
|
||||||
|
|
||||||
// Negated symbols from base/fontmath.ltx:
|
// Negated symbols from base/fontmath.ltx:
|
||||||
// \def\neq{\not=} \let\ne=\neq
|
// \def\neq{\not=} \let\ne=\neq
|
||||||
// \DeclareRobustCommand
|
// \DeclareRobustCommand
|
||||||
|
@@ -563,7 +563,7 @@ defineSymbol(math, main, rel, "\u2265", "\\geq", true);
|
|||||||
defineSymbol(math, main, rel, "\u2190", "\\gets");
|
defineSymbol(math, main, rel, "\u2190", "\\gets");
|
||||||
defineSymbol(math, main, rel, ">", "\\gt");
|
defineSymbol(math, main, rel, ">", "\\gt");
|
||||||
defineSymbol(math, main, rel, "\u2208", "\\in", true);
|
defineSymbol(math, main, rel, "\u2208", "\\in", true);
|
||||||
defineSymbol(math, main, rel, "\u0338", "\\not");
|
defineSymbol(math, main, rel, "\u0338", "\\@not");
|
||||||
defineSymbol(math, main, rel, "\u2282", "\\subset", true);
|
defineSymbol(math, main, rel, "\u2282", "\\subset", true);
|
||||||
defineSymbol(math, main, rel, "\u2283", "\\supset", true);
|
defineSymbol(math, main, rel, "\u2283", "\\supset", true);
|
||||||
defineSymbol(math, main, rel, "\u2286", "\\subseteq", true);
|
defineSymbol(math, main, rel, "\u2286", "\\subseteq", true);
|
||||||
|
@@ -93,8 +93,12 @@ describe("A rel parser", function() {
|
|||||||
if (group.type === "htmlmathml") {
|
if (group.type === "htmlmathml") {
|
||||||
group = group.value.html[0];
|
group = group.value.html[0];
|
||||||
}
|
}
|
||||||
|
if (group.type === "mclass") {
|
||||||
|
expect(group.value.mclass).toEqual("mrel");
|
||||||
|
} else {
|
||||||
expect(group.type).toEqual("rel");
|
expect(group.type).toEqual("rel");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user