mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 19:28:39 +00:00
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:
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user