Implement correct macros for liminf and limsup, fixes #111 (#887)

* Implement correct macros for liminf and limsup, fixes #111

* fix nits
This commit is contained in:
Kevin Barabash
2017-12-26 17:11:10 -07:00
committed by GitHub
parent c883b3d54d
commit 7229f02d8f
12 changed files with 159 additions and 23 deletions

View File

@@ -77,6 +77,76 @@ exports[`A MathML builder should make prime operators into <mo> nodes 1`] = `
`;
exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} correctly in \\textstyle 1`] = `
<math>
<semantics>
<mrow>
<msub>
<mo>
<mi mathvariant="normal">
limsup
</mi>
<mo>
</mo>
</mo>
<mrow>
<mi>
x
</mi>
<mo>
</mo>
<mi mathvariant="normal">
</mi>
</mrow>
</msub>
</mrow>
<annotation encoding="application/x-tex">
\\limsup_{x \\rightarrow \\infty}
</annotation>
</semantics>
</math>
`;
exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} in displaymode correctly 1`] = `
<math>
<semantics>
<mrow>
<munder>
<mo>
<mi mathvariant="normal">
limsup
</mi>
<mo>
</mo>
</mo>
<mrow>
<mi>
x
</mi>
<mo>
</mo>
<mi mathvariant="normal">
</mi>
</mrow>
</munder>
</mrow>
<annotation encoding="application/x-tex">
\\limsup_{x \\rightarrow \\infty}
</annotation>
</semantics>
</math>
`;
exports[`A MathML builder should render boldsymbol with the correct mathvariants 1`] = `
<math>

View File

@@ -2733,6 +2733,16 @@ describe("A macro expander", function() {
expect("\\hspace{1em}").toParseLike("\\kern1em");
expect("\\hspace*{1em}").toParseLike("\\kern1em");
});
it("should expand \\limsup as expected", () => {
expect("\\limsup")
.toParseLike("\\mathop{\\operatorname{lim\\,sup}}\\limits");
});
it("should expand \\liminf as expected", () => {
expect("\\liminf")
.toParseLike("\\mathop{\\operatorname{lim\\,inf}}\\limits");
});
});
describe("A parser taking String objects", function() {

View File

@@ -51,6 +51,19 @@ describe("A MathML builder", function() {
expect(getMathML("\\textstyle\\sum_a^b")).toMatchSnapshot();
});
it("should output \\limsup_{x \\rightarrow \\infty} correctly in " +
"\\textstyle", () => {
const mathml = getMathML("\\limsup_{x \\rightarrow \\infty}");
expect(mathml).toMatchSnapshot();
});
it("should output \\limsup_{x \\rightarrow \\infty} in " +
"displaymode correctly", () => {
const settings = new Settings({displayMode: true});
const mathml = getMathML("\\limsup_{x \\rightarrow \\infty}", settings);
expect(mathml).toMatchSnapshot();
});
it('should use <mpadded> for raisebox', () => {
expect(getMathML("\\raisebox{0.25em}{b}")).toMatchSnapshot();
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -195,8 +195,11 @@ OperatorName: |
\operatorname{Gam ma}(z) + \operatorname{\Gamma}(z) + \operatorname{}x
\end{matrix}
OpLimits: |
{\sin_2^2 \lim_2^2 \int_2^2 \sum_2^2}
{\displaystyle \lim_2^2 \int_2^2 \intop_2^2 \sum_2^2}
\begin{matrix}
{\sin_2^2 \lim_2^2 \int_2^2 \sum_2^2}
{\displaystyle \lim_2^2 \int_2^2 \intop_2^2 \sum_2^2} \\
\limsup_{x \rightarrow \infty} x \stackrel{?}= \liminf_{x \rightarrow \infty} x
\end{matrix}
OverUnderline: x\underline{x}\underline{\underline{x}}\underline{x_{x_{x_x}}}\underline{x^{x^{x^x}}}\overline{x}\overline{x}\overline{x^{x^{x^x}}} \blue{\overline{\underline{x}}\underline{\overline{x}}}
OverUnderset: |
\begin{array}{l}