mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 11:48:41 +00:00
Fix \fbox (#1550)
* Fix \fbox * Fix lint errors * Change negative space test from \fbox to \boxed
This commit is contained in:
@@ -195,7 +195,28 @@ defineFunction({
|
||||
|
||||
defineFunction({
|
||||
type: "enclose",
|
||||
names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\fbox"],
|
||||
names: ["\\fbox"],
|
||||
props: {
|
||||
numArgs: 1,
|
||||
argTypes: ["text"],
|
||||
allowedInText: true,
|
||||
},
|
||||
handler({parser}, args) {
|
||||
return {
|
||||
type: "enclose",
|
||||
mode: parser.mode,
|
||||
value: {
|
||||
type: "enclose",
|
||||
label: "\\fbox",
|
||||
body: args[0],
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
defineFunction({
|
||||
type: "enclose",
|
||||
names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout"],
|
||||
props: {
|
||||
numArgs: 1,
|
||||
},
|
||||
|
@@ -441,7 +441,7 @@ defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" +
|
||||
"\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu");
|
||||
|
||||
// \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}}
|
||||
defineMacro("\\boxed", "\\fbox{\\displaystyle{#1}}");
|
||||
defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}");
|
||||
|
||||
// \def\iff{\DOTSB\;\Longleftrightarrow\;}
|
||||
// \def\implies{\DOTSB\;\Longrightarrow\;}
|
||||
|
@@ -2156,6 +2156,12 @@ describe("A boxed builder", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("An fbox parser, unlike a boxed parser,", function() {
|
||||
it("should fail when given math", function() {
|
||||
expect`\fbox{\frac a b}`.not.toParse();
|
||||
});
|
||||
});
|
||||
|
||||
describe("A colorbox parser", function() {
|
||||
it("should not fail, given a text argument", function() {
|
||||
expect`\colorbox{red}{a b}`.toParse();
|
||||
|
@@ -225,7 +225,7 @@ ModSpacing: |
|
||||
\end{array}
|
||||
NegativeSpaceBetweenRel: A =\!= B
|
||||
NegativeSpace:
|
||||
tex: \fbox{\$1,\!000,\!000}\KaTeX
|
||||
tex: \boxed{\$1,\!000,\!000}\KaTeX
|
||||
post: .
|
||||
NestedFractions: |
|
||||
\dfrac{\frac{a}{b}}{\frac{c}{d}}\dfrac{\dfrac{a}{b}}
|
||||
|
Reference in New Issue
Block a user