mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 03:38:39 +00:00
\color affects following \right, put array cells in their own groups (#1845)
* \color affects following \right Fix #1844 by giving `leftright` nodes a `rightColor` attribute for how to color the right bracket. Now `\color` sets the macro `\current@color` in the current environment (in particular, resetting after `\right`), just like `color.sty` does in LaTeX. This is used to specially pass the current color into any following `\right` and then into the `leftright` parse node. * Add test * Put each array cell in its own group/namespace * Improve cell group isolation, add test and TODO * Improve comments
This commit is contained in:
committed by
Kevin Barabash
parent
39da3f5119
commit
19d9d83ad3
@@ -3123,6 +3123,21 @@ describe("A macro expander", function() {
|
||||
.toParseLike`11\sqrt[2]{2}11`;
|
||||
});
|
||||
|
||||
it("array cells generate groups", () => {
|
||||
expect`\def\x{1}\begin{matrix}\x&\def\x{2}\x&\x\end{matrix}`
|
||||
.toParseLike`\begin{matrix}1&2&1\end{matrix}`;
|
||||
});
|
||||
|
||||
// TODO: This doesn't yet work; before the environment gets called,
|
||||
// {matrix} gets consumed which means that the \def gets executed, before
|
||||
// we can create a group. :-( Issue #1989
|
||||
/*
|
||||
it("array cells generate groups", () => {
|
||||
expect`\def\x{1}\begin{matrix}\def\x{2}&\x\end{matrix}`
|
||||
.toParseLike`\begin{matrix}&1\end{matrix}`;
|
||||
});
|
||||
*/
|
||||
|
||||
it("\\gdef changes settings.macros", () => {
|
||||
const macros = {};
|
||||
expect`\gdef\foo{1}`.toParse(new Settings({macros}));
|
||||
|
Reference in New Issue
Block a user