-
-
Notifications
You must be signed in to change notification settings - Fork 873
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
Add alignment parameter to matrices and vectors #454
Comments
Proof of concept:
Does what you expect. (side note, it may be better to make the Although manually inserting |
I think this is also solved by tabular alignment because you can just align the first row and the others will follow. |
We discovered that's not true for left alignment. I won't have the time to implement this, but here are some thoughts:
|
I think you're making things more complicated than they need to be. There is no real reason to touch vertical alignment, and the vast majority of use cases would be covered by simply allowing the user to set left, center (default) or right alignment for the entire matrix. |
Hence "If we allow a list" :) |
If you allowed a list it would specify alignment for each column. Though I can't imagine spacing would look very good in most cases. My vote would be for removing & from matrices entirely, allowing the user to specify left/center/right alignment, and rather leave more arbitrary alignment to some future package. Though obviously @laurmaedje may feel otherwise. |
I tried to use the same trick to match the rows of matrices using:
but it is still not perfect. I also tried the |
I doubt anyone's working on it unless they've mentioned it here. The actual implementation wouldn't be that hard I would think, but there's some design decisions to be discussed and made. |
Thanks a lot @Enivex for the quick response and appreciate the work you guys do on Typst and makes sense😄. I'll do it manual for now and see if it takes to much effort as i have to write a lot of matrices and if its better to try latex at present for some docs types |
To be clear, I'm not affiliated with typst |
Affiliated or not, you're doing a lot for the project and we're very thankful! :) |
@GuyKawaii I plan on working on the matrix issues/feature requests after I finish with another PR I'm doing. |
If I write the matrix
$ mat(-1, 1, 1; 1, -1, 1; 1, 1, -1) $
this is displayed as
To "correctly" display this, I currently have to add & to every single cell in the matrix, when all I really want is for cells to be aligned to be flush right
$ mat(-1&, 1&, 1&; 1&, -1&, 1&; 1&, 1&, -1&) $
While allowing arbitrary alignment is nice, it would be nicer in this case if I could write something like
$ mat(-1, 1, 1; 1, -1, 1; 1, 1, -1; align: right) $
to achieve the same effect. (Also for vectors)
In LaTeX I can do this with
\[ \begin{pmatrix*}[r] -1 & 1 & 1\\ 1 & -1 & 1\\ 1 & 1 & -1 \end{pmatrix*} \]
The text was updated successfully, but these errors were encountered: