# Matrix Row & Column Labels in Latex

• LaTeX

## Main Question or Discussion Point

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.

Related MATLAB, Maple, Mathematica, LaTeX News on Phys.org
This might be overkill, but you could use http://en.wikipedia.org/wiki/PGF/TikZ" [Broken].

Last edited by a moderator:
"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}$

D H
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.

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

D H
Staff Emeritus
A 2x2 matrix with column labels on top and row labels on the right:

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

Versus on the left:

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

The tabular environment is also an option. (The tabular environment does not work in this forum; the LaTeX here is aimed at mathematics only.)