5
             BAC  GM  IBM  TRW
      JOHN   200 300  100  200
A =
      PAUL   100 200  400    0

I would like to create an array that looks like what appears above, except that square brackets should enclose (only) the array of numbers, whose rows and columns should nonetheless be aligned with the things set in letters. The "A" should not be aligned with a blank middle row of the array of numbers, but rather, centered as if one had written this:

A = \left[ \begin{array}{cccc} .... \end{array} \right]

How can that be done?

1 Answers1

5

Consider using kbordermatrix:

enter image description here

\documentclass{article}

\usepackage{kbordermatrix,amsmath}

\begin{document}

\[
  A = \kbordermatrix{
    & \text{BAC} & \text{GM} & \text{IBM} & \text{TRW} \\
    \text{JOHN} & 200 & 300 & 100 & 200 \\
    \text{PAUL} & 100 & 200 & 400 & \phantom{00}0
  }
\]

\end{document}
Werner
  • 603,163