Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
Hi! :) Could you please edit your code sample so that it becomes a MWE (Minimal Working Example), that is add the necessary code so that other people that want to help can copy the code as it is and be able to compile it? More info about MWE may be found in this discussion: meta.tex.stackexchange.com/questions/228/… –  ricmarques Dec 15 '12 at 14:02
    
@ricmarques Certainly, sorry about that. –  mitchus Dec 15 '12 at 15:29
add comment

1 Answer 1

up vote 7 down vote accepted

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}
share|improve this answer
    
Thanks! Do you by chance know a way to get rid of the tiny line segment to the right of the closing bracket? Or is that an even blacker art? :) –  mitchus Dec 17 '12 at 13:33
1  
I noticed that, hoped you wouldn't comment:-) I haven't the faintest idea what blockarray is doing, it was all a long time ago. I may look later (but no promises) (if all else fails you could presumably add a fake last column to force more padding) –  David Carlisle Dec 17 '12 at 13:58
    
An extra column adds too much padding actually... One hacky approach is to replace \BAhhline{&-------} by \BAhhline{&-------||} to end up with a point rather than a line segment. Now if I can make that point take the color white somehow... :-P –  mitchus Dec 17 '12 at 17:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.