mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-07 12:18:39 +00:00
Fix \mathit
font and italic correction and add \mathnormal
(#1700)
* Fix \mathit font (Math-Italic -> Main-Italic) and italic correction * Rename mathit to mathdefault and mainit to mathit * Add \mathnormal
This commit is contained in:
@@ -1483,13 +1483,15 @@ describe("A style change parser", function() {
|
||||
});
|
||||
|
||||
describe("A font parser", function() {
|
||||
it("should parse \\mathrm, \\mathbb, and \\mathit", function() {
|
||||
it("should parse \\mathrm, \\mathbb, \\mathit, and \\mathnormal", function() {
|
||||
expect`\mathrm x`.toParse();
|
||||
expect`\mathbb x`.toParse();
|
||||
expect`\mathit x`.toParse();
|
||||
expect`\mathnormal x`.toParse();
|
||||
expect`\mathrm {x + 1}`.toParse();
|
||||
expect`\mathbb {x + 1}`.toParse();
|
||||
expect`\mathit {x + 1}`.toParse();
|
||||
expect`\mathnormal {x + 1}`.toParse();
|
||||
});
|
||||
|
||||
it("should parse \\mathcal and \\mathfrak", function() {
|
||||
@@ -1510,6 +1512,10 @@ describe("A font parser", function() {
|
||||
expect(mathitParse.font).toEqual("mathit");
|
||||
expect(mathitParse.type).toEqual("font");
|
||||
|
||||
const mathnormalParse = getParsed`\mathnormal x`[0];
|
||||
expect(mathnormalParse.font).toEqual("mathnormal");
|
||||
expect(mathnormalParse.type).toEqual("font");
|
||||
|
||||
const mathcalParse = getParsed`\mathcal C`[0];
|
||||
expect(mathcalParse.font).toEqual("mathcal");
|
||||
expect(mathcalParse.type).toEqual("font");
|
||||
@@ -1783,6 +1789,19 @@ describe("A MathML font tree-builder", function() {
|
||||
expect(markup).toContain("<mo>+</mo>");
|
||||
});
|
||||
|
||||
it("should render \\mathnormal{" + contents + "} with the correct mathvariants", function() {
|
||||
const tex = `\\mathnormal{${contents}}`;
|
||||
const tree = getParsed(tex);
|
||||
const markup = buildMathML(tree, tex, defaultOptions).toMarkup();
|
||||
expect(markup).toContain("<mi>A</mi>");
|
||||
expect(markup).toContain("<mi>x</mi>");
|
||||
expect(markup).toContain("<mn>2</mn>");
|
||||
expect(markup).toContain("<mi>\u03c9</mi>"); // \omega
|
||||
expect(markup).toContain("<mi mathvariant=\"normal\">\u03A9</mi>"); // \Omega
|
||||
expect(markup).toContain("<mi>\u0131</mi>"); // \imath
|
||||
expect(markup).toContain("<mo>+</mo>");
|
||||
});
|
||||
|
||||
it("should render \\mathbf{" + contents + "} with the correct mathvariants", function() {
|
||||
const tex = `\\mathbf{${contents}}`;
|
||||
const tree = getParsed(tex);
|
||||
|
Reference in New Issue
Block a user