Matrix Row & Column Labels in Latex

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
5 replies · 18K views
Moonshine
Messages
31
Reaction score
0
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.
 
Physics news on Phys.org
This might be overkill, but you could use http://en.wikipedia.org/wiki/PGF/TikZ" .
 
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} \]
 
Dear D.H may be you could help me?
Could you say how I could automatically numerate matrices as equations. Beforehand thank you.
 
A 2x2 matrix with column labels on top and row labels on the right:

[tex]\begin{array}{cc|l}<br /> \text{Col 1} & \text{Col 2} & \\<br /> \hline<br /> 1 & 2 & \text{Row 1} \\<br /> 3 & 4 & \text{Row 2}<br /> \end{array}[/tex]

Versus on the left:

[tex]\begin{array}{l|cc}<br /> & \text{Col 1} & \text{Col 2} \\<br /> \hline<br /> \text{Row 1} & 1 & 2 \\<br /> \text{Row 2} & 3 & 4<br /> \end{array}[/tex]

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