Aligning matrices both vertically and horizontally in LaTeX
I am trying to accomplish this in LaTeX:
ā”a⤠ā”b ⦠nā¤
ā¢ā⢠ā¢ā ā± āā¢
ā£x⦠ā£y ⦠zā¦
[a ⦠x]
I can get the vector + matrix on the same line, but I'm not sure how to align the vector below so that it fits perfectly under the large matrix.
Here's a textual representation of the less Unicode "drawing" above:
[a] [ b c ] [d] [ e f ] [ g h ]
Note that the last row ([gh]) is a one-row matrix separated from the 2x2 matrix above it.
\ edit2
final answer:
\begin{align*}
\begin{vmatrix} 1 \\ 2 \end{vmatrix} &\begin{vmatrix} 1 & 2 & 3 \\ 3 & 4 & 5 \end{vmatrix} \\[6px]
&\begin{vmatrix} 2 & 3 & 4 \end{vmatrix}
\end{align*}
does exactly what you want, read below to learn more about placement, etc. The "&" sign is used for general alignment. The first line had 2 matrices, but now you have :).
distance information, etc.
\ {Start alignment *} & \ begin {pmatrix} 1 and 2 and 3 \ 3 and 4 and 5 \ end {pmatrix} \ [6px] & \ hspace {2px} \ begin {pmatrix} 2 and 3 and 4 \ end {pmatrix} \ End {align *}
will do the job. For some strange reason, the alignment was causing errors when leaving the first "&" character, and it gave an offset of 2px. I figured you need some space in between if you don't leave [6px]. You can always use \ hspace {number of spaces} to place the second matrix where you want it. This can be given in pt, px (which I did), etc.
// edit
Hm I noticed that \ hspace {} is not really needed, but can be used in the case of pmatrix . What happens is that the pmatrix brackets give an offset image of the matrices. When using vmatrix , for example:
\begin{align*}
&\begin{vmatrix} 1 & 2 & 3 \\ 3 & 4 & 5 \end{vmatrix} \\[6px]
&\begin{vmatrix} 2 & 3 & 4 \end{vmatrix}
\end{align*}
Everything goes well:). So basically, perhaps the easiest way to fix this is either to use other brackets to make it look good, or to use \ hspace to align it as you see fit.
a source to share
Wrap the thing in \begin{align*} ... \end{align*}
and use it &
as an alignment marker in your formulas.
Example:
\begin{align*}
\begin{pmatrix} ... vector here \end{pmatrix}
&\begin{pmatrix} ... first matrix here \end{pmatrix}\\
&\begin{pmatrix} ... second matrix here \end{pmatrix}
\end{align*}
a source to share