Support {smallmatrix}, {subarray}, and \substack (#1969)

* Support {smallmatrix}, {subarray}, and \substack

* Fix lint errors

* Update docs. Screenshots step 1.

* Screenshots step 2

* Screenshots step 3

* Pick up review comments

* Fixed arraycolsep for {smallmatrix}

* Fixed lint error

* Updated screenshots
This commit is contained in:
Ron Kok
2019-05-20 20:34:49 -07:00
committed by Kevin Barabash
parent 6b0f06df21
commit 3b60aee16c
10 changed files with 135 additions and 15 deletions

View File

@@ -2582,6 +2582,43 @@ describe("An array environment", function() {
});
describe("A subarray environment", function() {
it("should accept only a single alignment character", function() {
const parse = getParsed`\begin{subarray}{c}a \\ b\end{subarray}`;
expect(parse[0].type).toBe("array");
expect(parse[0].cols).toEqual([
{type: "align", align: "c"},
]);
expect`\begin{subarray}{cc}a \\ b\end{subarray}`.not.toParse();
expect`\begin{subarray}{c}a & b \\ c & d\end{subarray}`.not.toParse();
expect`\begin{subarray}{c}a \\ b\end{subarray}`.toBuild();
});
});
describe("A substack function", function() {
it("should build", function() {
expect`\sum_{\substack{ 0<i<m \\ 0<j<n }} P(i,j)`.toBuild();
});
it("should accommodate spaces in the argument", function() {
expect`\sum_{\substack{ 0<i<m \\ 0<j<n }} P(i,j)`.toBuild();
});
it("should accommodate macros in the argument", function() {
expect`\sum_{\substack{ 0<i<\varPi \\ 0<j<\pi }} P(i,j)`.toBuild();
});
});
describe("A smallmatrix environment", function() {
it("should build", function() {
expect`\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}`.toBuild();
});
});
describe("A cases environment", function() {
it("should parse its input", function() {