# Left-align column and row matrices and right-align the dimensions

I have some vectors, one of which is written as column and others as rows. I would like to have them so, that the vectors are left-aligned and the corresponding dimensions right-aligned, as I tried to indicate in my plot below. The code I used is also supplied.

Can anyone help me with that? Preferably within one equation environment...

\documentclass[a4paper,12pt]{report}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\begin{document}

$$\begin{split} Y &=(y_1,\dots,y_T) \hspace{2,3cm} \\ B &=(\nu,A_1,\dots,A_p) \hspace{2cm} \end{split} \quad \begin{split} (K\times T) \\ (K\times (Kp+1)) \end{split}$$

$$\begin{split} Z_t &= \begin{bmatrix} 1 \\ y_t \\ \vdots \\ y_{t-p+1} \end{bmatrix} \end{split} \qquad \begin{split} ((Kp+1)\times 1) \end{split}$$

$$\label{schaetzer-matrizen} \begin{split} Z &=(Z_0,\dots,Z_{T-1}) \\ \textbf{y} &=vec((Y)) \\ \boldsymbol{\beta} &=vec(B) \\ \end{split} \qquad \begin{split} ((Kp+1)\times T) \\ (KT\times 1) \\ ((K^2p+K)\times 1) \\ \end{split}$$

\end{document}


-

A split can have only one alignment point, but you need two. I can't see a really neat way to do it, but this seems to work:

\documentclass[a4paper,12pt]{report}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb,bm}
\DeclareMathOperator{\vecop}{vec}

\newcommand\righthandside[2]{%
\makebox[.5\displaywidth][s]{$\displaystyle#1\hfill#2$}%
}

\begin{document}

\begin{align}
\begin{split}
Y &=\righthandside{(y_1,\dots,y_T)}{(K\times T)} \\
B &=\righthandside{(\nu,A_1,\dots,A_p)}{(K\times (Kp+1))}
\end{split} \\
Z_t &=
\righthandside{
\begin{bmatrix}
1 \\
y_t \\
\vdots \\
y_{t-p+1}
\end{bmatrix}}{(Kp+1)\times 1)} \\
\begin{split}
Z &=\righthandside{(Z_0,\dots,Z_{T-1})}{((Kp+1)\times T)} \\
\textbf{y} &= \righthandside{\vecop((Y))}{(KT\times 1)} \\
\bm{\beta} &= \righthandside{\vecop(B)}{((K^2p+K)\times 1)}
\end{split}
\end{align}

\end{document}


However, I'd use a number for each line and a single align.

-

Here are two solutions using the alignat environment: the first has all equations numbered; in the second, using the aligned environment allows numbering by groups of equations.

\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage[x11names]{xcolor}

\DeclareMathOperator\vectop{vec}

\begin{document}

\begin{alignat}{3}[left = \color{VioletRed3}\empheqlvert, right = \color{VioletRed3}\empheqrvert ]%
&Y=(y_1,\dots,y_T) & (K\times T) &  \\
&B=(\nu,A_1,\dots,A_p)  &\hspace{5em} (K\times (Kp+1)) & \\[4pt]
&Z_t =
\begin{bmatrix*}[l]
1 \\ y_t \\ \vdots \\ y_{t-p+1}
\end{bmatrix*} & ((Kp+1)\times 1) & \\[4pt]
&Z=(Z_0,\dots,Z_{T-1}) &((Kp+1)\times T) &  \\
&\mathbf{y}= \vectop((Y))  & (KT\times 1) & \\
&\boldsymbol{\beta}=\vectop(B) &((K^2p+K)\times 1) &
\end{alignat}
\bigskip

\begin{alignat}{3}[left = \color{LightSteelBlue3}\empheqlvert, right = \color{LightSteelBlue3}\empheqrvert ]
& \begin{aligned}
&Y=(y_1,\dots,y_T)   \\
&B=(\nu,A_1,\dots,A_p)
\end{aligned}
& \hspace{5em}\begin{aligned}
(K\times T) &  \\
(K\times (Kp+1)) &
\end{aligned}&  \\[4pt]
&Z_t =
\begin{bmatrix*}[l]
1 \\ y_t \\ \vdots \\ y_{t-p+1}
\end{bmatrix*}  & ((Kp+1)\times 1)&  \\[4pt]
& \begin{aligned}
&Z=(Z_0,\dots,Z_{T-1})  \\
&\mathbf{y}= \vectop((Y)) \\
&\boldsymbol{\beta}=\vectop(B)
\end{aligned}
& \hspace{5em}\begin{aligned}
((Kp+1)\times T) &  \\
(KT\times 1) & \\
((K^2p+K)\times 1) &
\end{aligned}
\end{alignat}

\end{document}


-