# Compact block matrix

I'm trying to create a block matrix and surely there are hundreds of question about those already. But most of what I read so far, seems quite hackish in the end. What I have is:

\documentclass{article}

\usepackage[fleqn]{amsmath}
\usepackage{blkarray}
\usepackage{multirow}
\usepackage{mathtools}
\usepackage{graphicx}
\newcommand{\rdots}{\hspace{.2ex}\raisebox{1ex}{\rotatebox{-12}{$\ddots$}}}

\begin{document}

$$\begin{blockarray}{(c@{}c@{}c|c@{}c@{}c)l} 1&&0&\BAmulticolumn{3}{c}{\multirow{3}{*}{\huge0}}&\multirow{3}{*}{\dim F\;\text{vertical}}\\&\rdots&&&&&\\0&&1&&&&\\ \cline{1-6} \BAmulticolumn{3}{c|}{\multirow{3}{*}{\huge0}}&\tfrac{1}{t}&&0&\multirow{3}{*}{\dim Z\;\text{horizontal}}\\&&&&\rdots&&\\&&&0&&\tfrac{1}{t}&\\ \end{blockarray}$$

\end{document}


There are a lot of bits, that could be improved, but most importantly the spacing in the submatrices is too wide.

I also tried to enclose things that occur multiple times in macros

\newcommand\zeroblock[3][]{\BAmulticolumn{#2}{c#1}{\multirow{#3}{*}{\huge$0$}}}

\newcommand\position[3]{\mspace{#1}\raisebox{#2}{$\mathclap{#3}$}}
\newcommand\diagonal[1]{\begin{matrix}#1&\position{-8mu}{-2em}{\rdots}\scalebox{1.5}{0}\\\scalebox{1.5}{0}&#1\end{matrix}}

\begin{document}

$$\begin{array}{c|c} \diagonal{1}&\zeroblock33\\ \zeroblock33&\diagonal{\tfrac{1}{t}} \end{array}$$


but \zeroblock gives me

! Misplaced \omit.
\multispan ->\omit
\@multispan
l.18        \diagonal{1}&\zeroblock33
\\


and diagonal, while it works inside of array, does not work in blockarray and gives

! Incompatible list can't be unboxed.
<argument> \BA@first@box


Also it does not look good:

So I was thinking, that certainly there must be a better way to do these things. Is there?

• I think it is better to write I and 1/t times I on the diagonal. Or diag(1,1/t)\otimes I – percusse Feb 21 '13 at 11:36
• @percuße: That is a good suggestion, but I want to put more emphasis on the multiplicity / dimensions. – bodo Feb 21 '13 at 11:40

use the default tabcolsep and increase the array stretch:

\documentclass{article}

\usepackage[fleqn]{amsmath}
\usepackage{blkarray}
\usepackage{multirow}
\usepackage{mathtools}
\usepackage{graphicx}
\newcommand{\rdots}{\hspace{.2ex}\raisebox{1ex}{\rotatebox{-12}{$\ddots$}}}

\begin{document}

$$\def\arraystretch{1.5} \begin{blockarray}{(ccc|ccc)l} 1&&0&\BAmulticolumn{3}{c}{\multirow{3}{*}{\huge0}}&\multirow{3}{*}{\dim F\;\text{vertical}}\\&\rdots&&&&&\\0&&1&&&&\\ \cline{1-6} \BAmulticolumn{3}{c|}{\multirow{3}{*}{\huge0}}&\tfrac{1}{t}&&0&\multirow{3}{*}{\dim Z\;\text{horizontal}}\\&&&&\rdots&&\\&&&0&&\frac{1}{t}&\\ \end{blockarray}$$

\end{document}


Using a small matrix makes also sense:

$$\left( \begin{array}{r@{}c|c@{}l} & \begin{smallmatrix} 1 & & 0 \\ &\ddots&\\ 0 & & 1\rule[-1ex]{0pt}{2ex} \end{smallmatrix} & \mbox{\huge0} & \rlap{\kern5mm\dim F vertical}\\\hline & \mbox{\huge0} & \begin{smallmatrix}\rule{0pt}{2ex} \frac1t & & 0 \\ &\ddots&\\ 0 & & \frac1t \end{smallmatrix} & \rlap{\kern5mm\dim Z horizontal} \end{array} \right)$$


• That does look a bit better, but I was asking for more compact spacing and maybe a simpler approach. – bodo Feb 21 '13 at 11:51
• @canaaerus: see my edit. Using smallmatrix makes more sense – user2478 Feb 21 '13 at 12:25