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
@@ -137,7 +137,7 @@ exports[`A font parser \\boldsymbol should inherit mbin/mrel from argument 1`] =
|
||||
{
|
||||
"classes": [
|
||||
"mord",
|
||||
"mathit"
|
||||
"mathdefault"
|
||||
],
|
||||
"depth": 0,
|
||||
"height": 0.43056,
|
||||
@@ -180,7 +180,7 @@ exports[`A font parser \\boldsymbol should inherit mbin/mrel from argument 1`] =
|
||||
{
|
||||
"classes": [
|
||||
"mord",
|
||||
"mathit"
|
||||
"mathdefault"
|
||||
],
|
||||
"depth": 0,
|
||||
"height": 0.69444,
|
||||
@@ -268,7 +268,7 @@ exports[`A font parser \\boldsymbol should inherit mbin/mrel from argument 1`] =
|
||||
{
|
||||
"classes": [
|
||||
"mord",
|
||||
"mathit"
|
||||
"mathdefault"
|
||||
],
|
||||
"depth": 0,
|
||||
"height": 0.43056,
|
||||
@@ -356,7 +356,7 @@ exports[`A font parser \\boldsymbol should inherit mbin/mrel from argument 1`] =
|
||||
{
|
||||
"classes": [
|
||||
"mord",
|
||||
"mathit"
|
||||
"mathdefault"
|
||||
],
|
||||
"depth": 0,
|
||||
"height": 0.69444,
|
||||
@@ -459,7 +459,7 @@ exports[`A font parser \\boldsymbol should inherit mbin/mrel from argument 1`] =
|
||||
{
|
||||
"classes": [
|
||||
"mord",
|
||||
"mathit"
|
||||
"mathdefault"
|
||||
],
|
||||
"depth": 0,
|
||||
"height": 0.43056,
|
||||
@@ -547,7 +547,7 @@ exports[`A font parser \\boldsymbol should inherit mbin/mrel from argument 1`] =
|
||||
{
|
||||
"classes": [
|
||||
"mord",
|
||||
"mathit"
|
||||
"mathdefault"
|
||||
],
|
||||
"depth": 0.19444,
|
||||
"height": 0.69444,
|
||||
|
@@ -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);
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
BIN
test/screenshotter/images/MathNormal-chrome.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
test/screenshotter/images/MathNormal-firefox.png
Normal file
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
@@ -200,6 +200,7 @@ MathBf: \mathbf{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}
|
||||
MathCal: \mathcal{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}
|
||||
MathFrak: \mathfrak{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}
|
||||
MathIt: \mathit{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}
|
||||
MathNormal: \mathnormal{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}
|
||||
MathOp: a\mathop+b\mathop:c\mathop{\delta}e\mathop{\textrm{and}}f\mathrel{\mathop{:}}=g\sin h
|
||||
MathRm: \mathrm{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}
|
||||
MathSf: \mathsf{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}
|
||||
|