I want to align multiple vectors (horizontal arrays), each on a separate line. Specifically, some values are negative and some positive, and some have a decimal part and some not. I want to align everything (i.e. values 1st value of all arrays etc) at the decimal place, like this:

 ab=[-0.1  3    2.4]  
xyz=[ 3   -2.7 -2  ]  

I have almost achieved this using a single large matrix, with each row containing one vector. Aligning at the decimal point was initially manual, by breaking up each number into the integer and decimal part and putting each in a separate column, but then I found about the dcolumn package that makes it much easier.

However, since I am using one big array to ensure correct horizontal alignement across multiple lines, I cannot have a \left[ part in one column and a \right] in another. The result is that the brackets are input just by '[' and ']' and are a bit small, rather that being automatically enlarged.

I would like to know if there is any other way to force the same horizontal alignment on multiple arrays (within the same 'align' block if required) without using one big matrix. Maybe some way to nest matrices?

I have though about using tabular or tabularx for each vector and set the same column widths on all of them. While this would align the start and end of the vectors, I am 99% certain the values of each column would not be aligned.

Otherwise, some way to have a '\left[ ...\right]' block span multiple columns of an array would be usefull.

Thanks in advance

2 Answers 2


You can nest array environments and use the dcolumn package to achieve the alignment at the decimal point. A little example:



    ab=[ \\
    -2.3 & 4 & 3.56\\
    5 & -3.5 & -0.5
    ] \\ ]



You can do it by hand with \phantoms or by making a tabular with a specific width



Do it by hand
  x   &= \begin{bmatrix*}[r]     -0.1         & \p{-}3\p{.7} & \p{-}2.4\end{bmatrix*}\\
  xyz &= \begin{bmatrix*}[r] \p{-}3\p{.1} &     -2.7     &     -2\p{.4}\end{bmatrix*}
or inside a tabular
  x   &= \begin{bmatrix*}[r] \dnum{-0.1} & \dnum{3}     & \dnum{2.4}\end{bmatrix*}\\
  xyz &= \begin{bmatrix*}[r] \dnum{3}    & \dnum{-2.7}  & \dnum{-2} \end{bmatrix*}


You must log in to answer this question.