* Fix \fbox

* Fix lint errors

* Change negative space test from \fbox to \boxed
This commit is contained in:
Ron Kok
2018-08-04 20:32:06 -07:00
committed by GitHub
parent aef9256419
commit b2d38104cd
4 changed files with 30 additions and 3 deletions

View File

@@ -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,
},

View File

@@ -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\;}

View File

@@ -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();

View File

@@ -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}}