Implement cases environment

See issue #278.  Although the official definition makes use of @{…}
notation, we use custom spacing instead, since that seems easier for now.
This commit is contained in:
Martin von Gagern
2015-06-30 09:41:03 +02:00
parent 7f1b53cbfd
commit 758bdba31e
6 changed files with 74 additions and 14 deletions

View File

@@ -1310,7 +1310,17 @@ describe("An array environment", function() {
it("should accept a single alignment character", function() {
var parse = getParsed("\\begin{array}r1\\\\20\\end{array}");
expect(parse[0].type).toBe("array");
expect(parse[0].value.colalign).toEqual(["r"]);
expect(parse[0].value.cols).toEqual([{align:"r"}]);
});
});
describe("A cases environment", function() {
it("should parse its input", function() {
expect("f(a,b)=\\begin{cases}a+1&\\text{if }b\\text{ is odd}\\\\" +
"a&\\text{if }b=0\\\\a-1&\\text{otherwise}\\end{cases}")
.toParse();
});
});