[Tex/LaTex] Evenly spacing aligned matrices with different elements

alignmath-modematrices

I have 8 vectors that I display as bmatrix in an align environment as follows:

But as you can see, the first vector is slightly thinner, making the rest unaligned aswell. How can I make the first vector as wide as the others? If someone knows how to make the heights the same aswell, that'd be even more awesome!

Here is a MWE:

\documentclass[preview, border = 2pt]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{align*}
b_1 &= \begin{bmatrix} 0 \\ 0 \end{bmatrix}, \quad b_2 = \begin{bmatrix} \frac{1}{3} \\ 0 \end{bmatrix}, \quad
b_3 = \begin{bmatrix} 0 \\ \frac{1}{3} \end{bmatrix}, \quad b_4 = \begin{bmatrix} \frac{1}{3} \\[.1cm] \frac{2}{3} \end{bmatrix} \\
b_5 &= \begin{bmatrix} \frac{2}{3} \\[.1cm] \frac{2}{3} \end{bmatrix}, \quad b_6 = \begin{bmatrix} \frac{2}{3} \\ 0 \end{bmatrix}, \quad
b_7 = \begin{bmatrix} 0 \\ \frac{2}{3} \end{bmatrix}, \quad b_8 = \begin{bmatrix} \frac{2}{3} \\[.1cm] \frac{1}{3} \end{bmatrix}
\end{align*}
\end{document}

EDIT:
The following solution, as also provided by Ignasi, didn't fit my needs because I also had one-row cases that didn't need an align environment and it would look strange between equations.

\documentclass[preview, border = 2pt]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{align*}
b_1 &= \begin{bmatrix} 0 \\ 0 \end{bmatrix}, 
&
b_2 &= \begin{bmatrix} \frac{1}{3} \\ 0 \end{bmatrix}, 
&
b_3 &= \begin{bmatrix} 0 \\ \frac{1}{3} \end{bmatrix}, 
&
b_4 &= \begin{bmatrix} \frac{1}{3} \\ \frac{2}{3} \end{bmatrix} \\
b_5 &= \begin{bmatrix} \frac{2}{3} \\ \frac{2}{3} \end{bmatrix}, 
&
b_6 &= \begin{bmatrix} \frac{2}{3} \\ 0 \end{bmatrix}, 
&
b_7 &= \begin{bmatrix} 0 \\ \frac{2}{3} \end{bmatrix}, 
&
b_8 &= \begin{bmatrix} \frac{2}{3} \\ \frac{1}{3} \end{bmatrix}
\end{align*}
\end{document}

Best Answer

You have two different spacing issues here. The first one is that 0 is not as wide as \frac{2}{3}. This can be corrected by setting the first number 0 in a \makebox with that very width.

The second issue is that you are having two different bracket sizes. The moment you correct your spacing by \\[.1cm], you get ugly alignment for the one-fraction-terms and the next bigger bracket size for the two-fractions-terms. Well, this would be not such a problem, if the spacing in front of those two bracket sizes would be the same. Unluckily it isn't. The bigger bracket occupies more space in front of it.

The easiest approach here would be to enlarge all vectors two the same size. Doing this, you will get the horizontal alignment you wish.

I used some Stefan Kottwitz magic to give every matrix an optional parameter for stretching it. I added the lua-visual-debug package in order to prove the perfect alignment. You can remove this and compile with PDFLaTeX instead.

% arara: lualatex

\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}
\usepackage{lua-visual-debug}
\makeatletter
\renewcommand*\env@matrix[1][\arraystretch]{%
    \edef\arraystretch{#1}%
    \hskip -\arraycolsep
    \let\@ifnextchar\new@ifnextchar
    \array{*\c@MaxMatrixCols c}}
\makeatother

\begin{document}
\begin{align*}
    b_1 &= \begin{bmatrix}[1.2] \makebox[\widthof{$\frac{1}{2}$}][c]{0} \\ 0 \end{bmatrix}, \quad 
    b_2 = \begin{bmatrix}[1.2] \frac{1}{3} \\ 0 \end{bmatrix}, \quad
    b_3 = \begin{bmatrix}[1.2] 0 \\ \frac{1}{3} \end{bmatrix}, \quad 
    b_4 = \begin{bmatrix}[1.2] \frac{1}{3}\\\frac{2}{3}\end{bmatrix}\\
    %%%%%%%%%%
    b_5 &= \begin{bmatrix}[1.2] \frac{2}{3} \\ \frac{2}{3} \end{bmatrix}, \quad 
    b_6 = \begin{bmatrix}[1.2] \frac{2}{3} \\ 0 \end{bmatrix}, \quad
    b_7 = \begin{bmatrix}[1.2] 0 \\ \frac{2}{3} \end{bmatrix}, \quad 
    b_8 = \begin{bmatrix}[1.2] \frac{2}{3} \\ \frac{1}{3} \end{bmatrix}
\end{align*}
\end{document}

enter image description here