-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: optional vertical alignment [t|b|c] for array and aligned environments #3190
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3190 +/- ##
==========================================
+ Coverage 93.94% 93.97% +0.03%
==========================================
Files 87 88 +1
Lines 6344 6362 +18
Branches 1314 1320 +6
==========================================
+ Hits 5960 5979 +19
+ Misses 354 353 -1
Partials 30 30
Continue to review full report at Codecov.
|
Allowed: `\begin{array}`, `\begin{aligned}`, `\begin{alignedat}`, `\begin{gathered}` Forbidden: `\begin{align}`, `\begin{alignat}`, `\begin{equation}`, `\begin{gather}`, `\begin{split}` and starred variants, `\begin{darray}`, `\begin{matrix}` and variants, `\begin{smallmatrix}`, `\begin{cases}`.
No longer need manual optional argument parsing
This is good stuff. It should get recognized in the documentation. Suggest modification of In the Other KaTeX Environments table, to the row labeled Revise one example environment to read
There is a sentence that begins: "The |
it would be nice if this got approved! |
What is the previous behavior before this PR?
\begin{array}
and\begin{aligned}
rendered any optional argument like[t]
.What is the new behavior after this PR?
Matching LaTeX,
\begin{array}
,\begin{darray}
,\begin{aligned}
,\begin{alignedat}
,\begin{gathered}
(but not\begin{align}
,\begin{alignat}
,\begin{equation}
,\begin{gather}
,\begin{split}
and starred variants,\begin{matrix}
and variants,\begin{smallmatrix}
,\begin{cases}
) support custom vertical alignment via[t]
,[b]
, or[c]
optional argument.At least, that's the goal. I haven't been able to test this yet, or write tests, because of #3189, but I theorize that it or a slight variation will work.Optional arguments in environments: Along the way, I had to add support for optional arguments in environments, which was silently ignored before.
This only gets used inTurns out I was wrong, and the correct order is\begin{alignedat}[t]{2}
because the optional argument is in the "correct" position before the required argument. We can't use it (without some modification) in\begin{array}{cc}[t]
because the optional argument comes later.\begin{array}[t]{cc}
, so I can use the optional argument parser in all cases.Demo:
BREAKING CHANGE: Optional arguments used to be rendered in aligned environments, but now they are correctly processed (as they would in LaTeX). This is arguably a bug fix, but could break existing code like
Fixes #2172, fixes #2760