Matrix with vertical line in the middle

Since there has been some issues with the vertical spacing inside the first matrix, I've found a specific workaround that is based on the division of the two columns:

  • The first is considered as a separated array environment, so the two expressions will be typeset correctly.

  • The second is a standard displayed equation that will make the third expression lie just bewteen the first two. Notice that this is achieved with the command \middle (thanks to @Mico for pointing this out).

This is the final MWE:

\documentclass{article}
%
\usepackage{amsmath}
% This command adjusts the horizontal shrinking 
% between columns inside the environment.
\renewcommand\arraycolsep{2pt}
%
\begin{document}
%
\begin{equation*}
%
% Hhere starts the first "array" environment, now the delimiters are equal because
% the middle command  "( | )" separates the array from the standard environment 
% in order to make the third expression vertically centered.
\left(
%
\begin{array}{l}
 \alpha_T     \\
 \alpha_{T-1}
\end{array}
%
\middle\vert
%
\;y_{1:T-1},\,\boldsymbol{\theta}
%
\right)
%
\sim N
%
% Now there is the second matrix with the delimiter setting like
% ( [ ],[ ] )
%
\left(  % starting delimiter
%
\left[
 \begin{array}{l}
  d_{T-1}+T_{T-1}a_{T-1|T-1}  \\
  a_{T-1|T-1}
 \end{array}
\right],
% 
% Here is the second square delimited array.
%
\left[
 \begin{array}{lcc}
  T_{T-1}P_{T-1|T-1}T’_{T-1} & + & Q_{T-1}T_{T-1}P_{T-1|T-1}\\
  P_{T-1|T-1}T’_{T-1}        &   & P_{T-1|T-1}
 \end{array}
\right]
%
\right)     % Ending delimiter.
%
\end{equation*}
%
\end{document}

Here is the output:

enter image description here


EDIT:

Since two terms inside the second square-bracketed matrix were merged, this implementation should highlight the spacing:

 ...
 \begin{array}{lcl}
  T_{T-1}P_{T-1|T-1}T’_{T-1}+Q_{T-1} & & T_{T-1}P_{T-1|T-1}\\
  P_{T-1|T-1}T’_{T-1}                & & P_{T-1|T-1}
 \end{array}
 ...

Here is the correct output:

enter image description here


To address just the left-hand term of the equation: It is possible to employ a matrix environment inside a \left( ... \middle\vert ... \right) construct. To force the item \alpha_T to be typeset flush left inside the (one-column) matrix instead of centered, just add \hfill to its right. (This works because the matrix environment builds on the array environment; by default, the columns of a matrix environment are centered, achieved by inserting \hfil on each side of each cell. Because \hfill is "more infinite" than \hfil, the contents of that row get pushed to the far left.)

enter image description here

\documentclass{article}
\usepackage{amsmath} % for "matrix" environment
\begin{document}
\[
\left(
\begin{matrix}
\alpha_T \hfill \\ \alpha_{T-1}
\end{matrix}
\, \middle\vert \,
y_{1,T-1},\boldsymbol{\theta}
\right) 
\sim N \dots
\]
\end{document}

Addendum, posted after the OP clarified the structure of the covariance matrix: Similarly, the mean vector and covariance matrix can be written with bmatrix (short for "matrix with brackets", I suppose) environments, again employing the \hfill device to set some of the items flush-left.

enter image description here

\dots
\sim N\left(
\begin{bmatrix}
d_{T-1}+T_{T-1}\alpha_{T-1\mid T-1}\\
\alpha_{T-1\mid T-1} \hfill
\end{bmatrix},
\begin{bmatrix} 
T_{T-1}P_{T-1|T-1}T_{T-1}'+Q_{T-1}  & T_{T-1}P_{T-1|T-1} \\
P_{T-1|T-1}T_{T-1}' \hfill          & P_{T-1\mid T-1}\hfill
\end{bmatrix}
\right)
\]

Tags:

Matrices