# Matrix Row & Column Labels in Latex

• LaTeX
Moonshine
Hello, I'm new to Latex and I'm having some problems creating a 5 x 5 matrix. I need to label each column 1 through 5 and I need to label each row 1 through 5. I need the row labels to be on the right side. I've found a couple of links online, but they only show how to label rows on the left side of the matrix.

Also, I need to write some text to the right of the matrix.

I'm new to all of this so any help would be greatly appreciated.

las3rjock
This might be overkill, but you could use http://en.wikipedia.org/wiki/PGF/TikZ" [Broken].

Last edited by a moderator:
Artemida
"Also, I need to write some text to the right of the matrix. "

If you need to write text anywhere in the matrices use \mbox{the text you need}
for example
$\left( \begin{array}{cc} a & b \\ c & d \end{array} \right),\mbox{the text you need}$

Staff Emeritus
One obvious solution is to make your matrix a 6x6 matrix, with the first row containing the column labels and the last column in each row containing the row labels.

Artemida
Dear D.H may be you could help me?
Could you say how I could automatically numerate matrices as equations. Beforehand thank you.

Staff Emeritus
$$\begin{array}{cc|l} \text{Col 1} & \text{Col 2} & \\ \hline 1 & 2 & \text{Row 1} \\ 3 & 4 & \text{Row 2} \end{array}$$
$$\begin{array}{l|cc} & \text{Col 1} & \text{Col 2} \\ \hline \text{Row 1} & 1 & 2 \\ \text{Row 2} & 3 & 4 \end{array}$$