[Tex/LaTex] How to pad cells of a blockarray

matricesspacing

After some struggle, I was able to render the matrix I was after. It now has the right "shape", but it does not look very nice; especially the spacing between the bracket and the matrix contents is too small, both horizontally and vertically. How can I solve this? Is there a way to define cell padding?

\documentclass{article}  
\usepackage{blkarray}
\usepackage{multirow}
\begin{document}  
\begin{equation}
C =
\begin{blockarray}{cccccccc}
  &   & & & j & & &   \\
\begin{block}{c[ccc|c|ccc]} % [I O]
  & 1 &                                    &     & 0      & 0      & \ldots & 0           \\
  &   & \ddots                             &     & \vdots & \vdots &        & \vdots      \\
  &   &                                    & 1   & 0      & 0      & \ldots & 0           \\ 
\BAhhline{&-------} 
i & \BAmulticolumn{3}{c|}{A_1}             & Q_{11} & \multirow{4}{*}{$B_2+b_2$} &
                                                      \multirow{4}{*}{$\ldots$}  &
                                                      \multirow{4}{*}{$B_n+b_n$}          \\
\BAhhline{&----} 
  & \BAmulticolumn{3}{c|}{A_1+a_1}         & 0      &                                     \\
  &   & \vdots                             &        & \vdots &                            \\
  & \BAmulticolumn{3}{c|}{A_n+A_n} & 0     &                                              \\  
\end{block} 
\end{blockarray}
\end{equation}
\end{document}

Best Answer

The parameter \BAextraheightafterhline probably does what you want for vertical spacing. Modifying the horizontal around the delimiters is something of a black art.

enter image description here

\documentclass{article}  
\usepackage{blkarray}
\usepackage{multirow}
\begin{document}
  \setlength\BAextraheightafterhline{5pt}
\setlength\tabcolsep{15pt}
\begin{equation}
C =
\begin{blockarray}{cccccccc}
  &   & & & j & & &   \\
\begin{block}{c\Left{}{[\;}ccc|c|ccc<{\;}]} % [I O]
  & 1 &                                    &     & 0      & 0      & \ldots & 0           \\
  &   & \ddots                             &     & \vdots & \vdots &        & \vdots      \\
  &   &                                    & 1   & 0      & 0      & \ldots & 0           \\ 
\BAhhline{&-------} 
i & \BAmulticolumn{3}{c|}{A_1}             & Q_{11} & \multirow{4}{*}{$B_2+b_2$} &
                                                      \multirow{4}{*}{$\ldots$}  &
                                                      \multirow{4}{*}{$B_n+b_n$}          \\
\BAhhline{&----} 
  & \BAmulticolumn{3}{c|}{A_1+a_1}         & 0      &                                     \\
  &   & \vdots                             &        & \vdots &                            \\
  & \BAmulticolumn{3}{c|}{A_n+A_n} & 0     &                                              \\  
\end{block} 
\end{blockarray}
\end{equation}
\end{document}
Related Question