Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Row and column labelling of matrixes in LaTeX

Tags:

How to add labels to the columns and rows (such as a, b, c, d and the like) which go above and to the left (both outside) of the matrix, but are obviously aligned with said columns and rows?

An example matrix:

\[
\begin{pmatrix}
t   & 1-t &  -1 &  0  &  0  \\
0   &  t  & 1-t &  -1 &  0  \\
0   &  0  &  t  & 1-t &  -1 \\
-1  &  0  &  0  &  t  & 1-t \\
1-t &  -1 &  0  &  0  &  t
\end{pmatrix}
\]
like image 262
bowenthebeard Avatar asked Mar 20 '09 02:03

bowenthebeard


1 Answers

You may want to try the kbordermatrix package. Its documentation can be found here (note that the package is not part of CTAN). It is more modern and advanced than good old bordermatrix. An example follows below:

\usepackage{kbordermatrix} % include package @ document preamble
\renewcommand{\kbldelim}{(} % change default array delimiters to parentheses
\renewcommand{\kbrdelim}{)}

% ...

\[
\kbordermatrix{
    \mbox{corner_text}&\alpha & \beta & \gamma & \delta \\ % column indices
    1 & t   & 1-t &  -1 &  0  &  0  \\
    2 & 0   &  t  & 1-t &  -1 &  0  \\
    3 & 0   &  0  &  t  & 1-t &  -1 \\
    4 & -1  &  0  &  0  &  t  & 1-t \\
    5 & 1-t &  -1 &  0  &  0  &  t
    % 1, 2, 3, 4, 5 are row indices
}
\]
like image 54
Renelvon Avatar answered Sep 17 '22 14:09

Renelvon