LaTeX Matrix Row & Column Labels in Latex

AI Thread Summary
Creating a 5x5 matrix in LaTeX with column labels 1 through 5 and row labels on the right side can be achieved by using a 6x6 matrix format. The first row can contain the column labels, while the last column of each row can hold the row labels. For example, a simple structure can be established using the array environment, where the matrix is defined with the necessary formatting to include labels appropriately. Additionally, to write text to the right of the matrix, the \mbox command can be utilized. For automatic numbering of matrices as equations, users can explore specific LaTeX commands or environments designed for this purpose. The tabular environment is another option, although it may not be supported in all forums focused on mathematical LaTeX.
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} \]
 
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.
 
A 2x2 matrix with column labels on top and row labels on the right:

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

Versus on the left:

\begin{array}{l|cc}<br /> &amp; \text{Col 1} &amp; \text{Col 2} \\<br /> \hline<br /> \text{Row 1} &amp; 1 &amp; 2 \\<br /> \text{Row 2} &amp; 3 &amp; 4<br /> \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.)
 
Back
Top