# [texhax] Dividing a matrix into sub-matrices

Wolfgang Lorenz wl-chmw at gmx.de
Fri Sep 30 10:54:39 CEST 2011

Hello list readers,

I'd like to create a matrix, that's subdivided into several
sub-matrices. The elements of all matrices still should be aligned. I
have found the package blkarray, which is does the placing of the
elements and also produces the sub-matrix brackets. Unfortunately, when
I put the brackets around the whole matrix there seems to be an empty
line below the sub-matrices (see quite minimal example below). Using
nested bmatrix environments produces the right brackets, but doesn't
out of both methods?

Thanks,
Wolfgang

%%% Example file: submatrix.tex %%%

\documentclass{scrreprt}
\usepackage{amsmath}
\usepackage{blkarray}

\newcommand{\xy}[2]{\ensuremath{\frac{x_{#1}}{y_{#2}}}}

\begin{document}

$$\begin{bmatrix} \begin{bmatrix} \xy{1,1}{1,1} & 0 \\ \xy{1,2}{1,1} & 0 \end{bmatrix} & \begin{bmatrix} \xy{1,1}{2,1} & \xy{1,1}{2,2} \\ \xy{1,2}{2,1} & \xy{1,2}{2,2} \end{bmatrix} \\ \begin{bmatrix} \xy{2,1}{1,1} & \xy{2,1}{1,2} \\ \xy{2,2}{1,1} & \xy{2,2}{1,2} \end{bmatrix} & \begin{bmatrix} \xy{2,1}{2,1} & \xy{2,1}{2,2} \\ \xy{2,2}{2,1} & \xy{2,2}{2,2} \end{bmatrix} \end{matrix}$$

$$\left[\begin{blockarray}{cccc} \begin{block}{[cc][cc]} \xy{1,1}{1,1} & 0 & \xy{1,1}{2,1} & \xy{1,1}{2,2} \\ \xy{1,2}{1,1} & 0 & \xy{1,2}{2,1} & \xy{1,2}{2,2} \\ \end{block} \begin{block}{[cc][cc]} \xy{2,1}{1,1} & \xy{2,1}{1,2} & \xy{2,1}{2,1} & \xy{2,1}{2,2} \\ \xy{2,2}{1,1} & \xy{2,2}{1,2} & \xy{2,2}{2,1} & \xy{2,2}{2,2} \\ \end{block} \end{blockarray}\right]$$

\end{document}

%%% End of example file %%%