mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-15 07:48:41 +00:00
Support \brace and \brack (#1453)
* Support \brace and \brack * Update screenshots
This commit is contained in:
@@ -15,6 +15,7 @@ defineFunction({
|
||||
"\\cfrac", "\\dfrac", "\\frac", "\\tfrac",
|
||||
"\\dbinom", "\\binom", "\\tbinom",
|
||||
"\\\\atopfrac", // can’t be entered directly
|
||||
"\\\\bracefrac", "\\\\brackfrac", // ditto
|
||||
],
|
||||
props: {
|
||||
numArgs: 2,
|
||||
@@ -45,6 +46,16 @@ defineFunction({
|
||||
leftDelim = "(";
|
||||
rightDelim = ")";
|
||||
break;
|
||||
case "\\\\bracefrac":
|
||||
hasBarLine = false;
|
||||
leftDelim = "\\{";
|
||||
rightDelim = "\\}";
|
||||
break;
|
||||
case "\\\\brackfrac":
|
||||
hasBarLine = false;
|
||||
leftDelim = "[";
|
||||
rightDelim = "]";
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unrecognized genfrac command");
|
||||
}
|
||||
@@ -272,7 +283,7 @@ defineFunction({
|
||||
// immediately by one of the variants above.
|
||||
defineFunction({
|
||||
type: "infix",
|
||||
names: ["\\over", "\\choose", "\\atop"],
|
||||
names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
|
||||
props: {
|
||||
numArgs: 0,
|
||||
infix: true,
|
||||
@@ -289,6 +300,12 @@ defineFunction({
|
||||
case "\\atop":
|
||||
replaceWith = "\\\\atopfrac";
|
||||
break;
|
||||
case "\\brace":
|
||||
replaceWith = "\\\\bracefrac";
|
||||
break;
|
||||
case "\\brack":
|
||||
replaceWith = "\\\\brackfrac";
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unrecognized infix genfrac command");
|
||||
}
|
||||
|
Reference in New Issue
Block a user