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
feature request: align / align* support #61
Comments
I was doing some preliminary investigation into how this works in LaTeX and
|
on a (Xe)(La)TeX note, using align in running math mode would be curious, since the point of the align/align* environments is to set up a (by definition multi-line) box, so it shouldn't be usable inline. Requiring the |
@KevinB7, as soon as this is implemented, I am going to switch from |
@KevinB7 , |
fyi @episodeyang you can subscribe to the issue to get notifications sent to your email instead of manually checking all of the time. The button is in the right sidebar. |
@episodeyang Sorry for the delayed reply. I haven't done any implementation work on this yet. I just did some investigating to see how difficult/easy it would be to implement this feature. |
+1. I am missing this feature too, otherwise KaTex works amazingly well. |
Summary: Add basic support for some environments in KaTeX. To create multiple columns of objects, we simply stack vlists next to each other, and then manually manage the vertical alignment ourselves. So far, this only supports `matrix` (to an artibrary size, where real LaTeX only supports 10 columns!), and the `align*` environment with only two columns in it. Support for more environments shouldn't be terribly hard with this basic structure though. Fixes KaTeX#43 Partially fixes KaTeX#61 Ping KaTeX#206 Test Plan: - `make test` - Make sure screenshots look good Reviewers: kevinb, alpert Differential Revision: https://phabricator.khanacademy.org/D17235
Since #246 got merged, we have support for environments, and with |
I found this in amstex.sty:
In "TeX for the Impatient" it states the following:
I take that to mean that there is no space between the columns or rows. |
Note that that is not
which are then unfortunately followed by a rather long and detailed alignment implementation |
OK, so there is no gap between rows or columns as far as \def\strut@{\copy\strutbox@}
\addto@hook\every@math@size{%
\global\setbox\strutbox@\hbox{\lower.5\normallineskiplimit
\vbox{\kern-\normallineskiplimit\copy\strutbox}}} The
So yes, it agrees with my interpretation above. Fortunately, |
I found this post on the tex stack exchange about the difference between The basic difference AFAICT is that |
Whats the current position of implementing support for the align environment? |
@Reflic environment support has been added so adding support for {align} is easier than it would've been in the past. If you're willing to take a stab it we'd love a pull request for this. |
Will you also include the numbering? StackEdit made it work pretty well. |
@RoyiAvital: I'd say equation numbers are a different issue, to be discussed in a separate ticket. We should avoid supporting the |
I see... Well, I really hope you'll get there soon. Thank You. |
@gagern In LaTeX, |
We could add numbers in parens after the inline equations as suggested in http://tex.stackexchange.com/questions/78579/labelled-in-line-equation. |
At least with LaTeX compatibility in mind, I'd say that the |
I've created a new issue for equation numbering: #350. |
@RoyiAvital, it's true that multi-line equation numbering would be hard to tackle by an outside script.. but it's certainly not trivial to implement within KaTeX! If someone wants a KaTeX "hack" in the meantime, use \begin{matrix} A + B & = & C \\ C & = & D + E \end{matrix} which centers the columns and puts too much space around the equals sign, but it may work in some situations. |
Regarding my previous comments: It turns out that what I'm really asking for is an implementation of LaTeX' I guess this environment could be implemented fairly easily within the current KaTeX framework? And it may be sufficient for many users. |
I've just created a branch https://github.com/gagern/KaTeX/tree/aligned which implements the Note that we don't have rubber lengths in KaTeX. I fixed the column distance as one |
Great! Precisely what I hoped for! BTW, how do I "build" and test the code..? I've only used the |
Run |
I might give make a try, but I'm using a Windows computer and would have to install some additional software I guess. Perhaps another day! |
@gagern awesome stuff! |
I probably should have written this ages ago, seeing how many people seem to see this as the main missing feature of KaTeX. @kevinbarabash, do you have an idea as to how much jasmine tests you'd like to see for this? The cases environment for example just has a single check, to see whether its input parses. Do we have any additional features of the |
I think just that it parses is good enough for the jasmine tests. Having the image is more important. |
Awesome work @gagern! Any idea if this will be landing in KaTeX itself soon? It's been a pretty long time since I filed this, and Small note on the build procedure: the Makefile right now will fail building if there are spaces in the path. Should be relatively easy to fix. |
#398 landed, though there hasn't been a KaTeX release with it yet. I think MathJax treats align* and aligned interchangeably so align* should be super easy (assuming we want to match that), though we should double check. |
nice! Is there a way to require this unreleased version using node atm, pending a release? I tried an |
I think aligned (not align) should work that way. |
@Pomax if you add an entry to package.json manually you should be able to get the unreleased version, see https://docs.npmjs.com/files/package.json#git-urls-as-dependencies. |
@kevinbarabash cheers! |
Any new ideas how to tackle the 'align' environment and equation numbering? |
For For equation numbering, the first step would be to implement |
This is, at the moment, not shared state between invocations of
|
#604 is roughly along those lines. We could also have some kind of shared state between invocations of |
Still not possible in 2020? |
Aligning is possible. Example: T(n) =
\left\{\begin{matrix}
\begin{aligned}
a, && w=1\\
bbbbbbbb, && w \ge 1
\end{aligned}
\end{matrix}\right. Try it on codecogs.com |
Support for |
I waited for LUAtex's v1.0 release penned for 2012 while working on a book in 2006. I have no complaints about an issue filed in 2014 getting a PR landed in 2020 =D |
for the simple reason that it's one of the most used environments (along with
matrix
andarray
) =)The text was updated successfully, but these errors were encountered: