TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found writing matrix's code is a boring work. There is one, you can see in pic below.

Can anybody help?

share|improve this question
This would be a good start: Where is the \matrix command? – Werner Feb 23 '12 at 3:27
Thanks. I found only the blkarray package may provide help (Was I wrong?) from your links. But there is a large warning in its PDF document's. Can I use it without leading to any incompatibility? – may you Feb 23 '12 at 3:38
up vote 7 down vote accepted

This is definitely possible when using the blkarray package. Here's a mock-up with some index styling (in \scriptsize):

enter image description here

\usepackage{blkarray}% http://ctan.org/pkg/blkarray
\newcommand{\matindex}[1]{\mbox{\scriptsize#1}}% Matrix index
    \matindex{1} & \matindex{2} & \\
      a & b & \matindex{3} \\
      c & d & \matindex{4} \\
      e & f &   \\

This would also be doable using a plain array, but would require additional vertical alignment/compensation, perhaps removing some of the code readability that exists via blkarray.

share|improve this answer
Hi Werner. I found your answer helpful. How does one selectively adjust the spacing between the block and the elements exterior to the block? – user001 Mar 21 '12 at 1:12
@user001: Just on one side, or both (right and above)? – Werner Mar 25 '12 at 21:29
Preferably I would like to adjust the spacing between the top elements and the matrix and the right elements and the matrix to different extents. – user001 Mar 26 '12 at 1:20

Your Answer


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.