Add support for \phantom

Summary:
Using \phantom with non-phantom math in Perseus doesn't render to be the
same size because \phantom uses MathJax and the non-phantom math uses KaTeX.
Implementing \phantom in KaTeX should solve this alignment issue.

Test Plan:
[x] write (and run) unit tests
[x] create (and run) screenshotter tests

Reviewers: emily

Reviewed By: emily

Differential Revision: https://phabricator.khanacademy.org/D16720
This commit is contained in:
Kevin Barabash
2015-03-13 16:24:04 -06:00
parent 51d751f96d
commit 39f5bcb042
7 changed files with 148 additions and 23 deletions

View File

@@ -164,6 +164,23 @@ var functions = {
type: "katex"
};
}
},
"\\phantom": {
numArgs: 1,
handler: function(func, body) {
var inner;
if (body.type === "ordgroup") {
inner = body.value;
} else {
inner = [body];
}
return {
type: "phantom",
value: inner
};
}
}
};