How to create a labelled matrix in LaTeX?

  • Context: LaTeX 
  • Thread starter Thread starter rwinston
  • Start date Start date
  • Tags Tags
    Latex Matrix
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 5K views
rwinston
Messages
36
Reaction score
0
Hi

does anybody know how to create a labelled matrix in LaTeX? By which I mean something like this:
a b
a [ 1 0 ]
b [ 0 1 ]

Where the inner elements are within the braces, but there are tabular label elements for the rows and columns (a and b). Cant get it too look right!

Cheers
 
Physics news on Phys.org
Hi rwinston,

If you don't mind parenthesis instead of braces you can use bordermatrix from plain TeX:

[tex] \bordermatrix{&a_1&a_2& a_3 \cr<br /> b_1 & 1 & 2 & 3 \cr<br /> b_2 & 2 & 3 & 4 \cr<br /> b_3 & 3 & 4 & 5 \cr}[/tex]


[tex] \bordermatrix{&a_1&a_2\cr<br /> b_1 & 1 & 2 \cr<br /> b_2 & 2 & 3 \cr}[/tex]


[tex] \bordermatrix{&a_1&a_2 \cr<br /> b_1 & 1 & 2 \cr<br /> b_2 & 2 & 3 \cr<br /> b_3 & 3 & 4 \cr}[/tex]

There is also a newer kbordermatrix package that you can use that gives more options (such as being able to change the delimiters).
 
Thanks! Thats exactly what I need!