mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-12 14:38:39 +00:00
Support \brace and \brack (#1453)
* Support \brace and \brack * Update screenshots
This commit is contained in:
@@ -477,13 +477,17 @@ describe("A frac parser", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("An over parser", function() {
|
||||
describe("An over/brace/brack parser", function() {
|
||||
const simpleOver = "1 \\over x";
|
||||
const complexOver = "1+2i \\over 3+4i";
|
||||
const braceFrac = "a+b \\brace c+d";
|
||||
const brackFrac = "a+b \\brack c+d";
|
||||
|
||||
it("should not fail", function() {
|
||||
expect(simpleOver).toParse();
|
||||
expect(complexOver).toParse();
|
||||
expect(braceFrac).toParse();
|
||||
expect(brackFrac).toParse();
|
||||
});
|
||||
|
||||
it("should produce a frac", function() {
|
||||
@@ -500,6 +504,22 @@ describe("An over parser", function() {
|
||||
expect(parse.type).toEqual("genfrac");
|
||||
expect(parse.value.numer).toBeDefined();
|
||||
expect(parse.value.denom).toBeDefined();
|
||||
|
||||
const parseBraceFrac = getParsed(braceFrac)[0];
|
||||
|
||||
expect(parseBraceFrac.type).toEqual("genfrac");
|
||||
expect(parseBraceFrac.value.numer).toBeDefined();
|
||||
expect(parseBraceFrac.value.denom).toBeDefined();
|
||||
expect(parseBraceFrac.value.leftDelim).toBeDefined();
|
||||
expect(parseBraceFrac.value.rightDelim).toBeDefined();
|
||||
|
||||
const parseBrackFrac = getParsed(brackFrac)[0];
|
||||
|
||||
expect(parseBrackFrac.type).toEqual("genfrac");
|
||||
expect(parseBrackFrac.value.numer).toBeDefined();
|
||||
expect(parseBrackFrac.value.denom).toBeDefined();
|
||||
expect(parseBrackFrac.value.leftDelim).toBeDefined();
|
||||
expect(parseBrackFrac.value.rightDelim).toBeDefined();
|
||||
});
|
||||
|
||||
it("should create a numerator from the atoms before \\over", function() {
|
||||
@@ -567,6 +587,16 @@ describe("An over parser", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("A infix builder", function() {
|
||||
it("should not fail", function() {
|
||||
expect("a \\over b").toBuild();
|
||||
expect("a \\atop b").toBuild();
|
||||
expect("a \\choose b").toBuild();
|
||||
expect("a \\brace b").toBuild();
|
||||
expect("a \\brack b").toBuild();
|
||||
});
|
||||
});
|
||||
|
||||
describe("A sizing parser", function() {
|
||||
const sizeExpression = "\\Huge{x}\\small{x}";
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 12 KiB |
@@ -113,7 +113,11 @@ ExtensibleArrows: |
|
||||
\xrightleftharpoons[ab]{ABC} + \xhookrightarrow[ab]{ABC} \\
|
||||
\xtwoheadrightarrow{ABC} + \frac{\xrightarrow[ab]{ABC}}{\xrightarrow[ab]{ABC}} + \left\lvert\xrightarrow[ab]{ABC}\right\rvert
|
||||
\end{array}
|
||||
FractionTest: \dfrac{a}{b}\frac{a}{b}\tfrac{a}{b}\;-\dfrac12\;1\tfrac12\;{1 \atop 2}\; \cfrac{1}{1+\cfrac{1}{x}}
|
||||
FractionTest: |
|
||||
\begin{array}{l}
|
||||
\dfrac{a}{b}\frac{a}{b}\tfrac{a}{b}\;-\dfrac12\;1\tfrac12\;{1 \atop 2}\; \cfrac{1}{1+\cfrac{1}{x}} \\[2.5em]
|
||||
{a \brace b} \; {a \brack b}
|
||||
\end{array}
|
||||
Functions: \sin\cos\tan\ln\log
|
||||
Gathered: |
|
||||
\begin{gathered}
|
||||
|
Reference in New Issue
Block a user