mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-11 22:18:41 +00:00
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:
@@ -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() {
|
||||
|
Reference in New Issue
Block a user