Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matrix Row & Column Labels in Latex

  1. Apr 26, 2009 #1
    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.
  2. jcsd
  3. Apr 27, 2009 #2
    This might be overkill, but you could use http://en.wikipedia.org/wiki/PGF/TikZ" [Broken].
    Last edited by a moderator: May 4, 2017
  4. Jan 17, 2010 #3
    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} \]
  5. Jan 17, 2010 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    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.
  6. Jan 17, 2010 #5
    Dear D.H may be you could help me?
    Could you say how I could automatically numerate matrices as equations. Beforehand thank you.
  7. Jan 17, 2010 #6

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    A 2x2 matrix with column labels on top and row labels on the right:

    \text{Col 1} & \text{Col 2} & \\
    1 & 2 & \text{Row 1} \\
    3 & 4 & \text{Row 2}

    Versus on the left:

    & \text{Col 1} & \text{Col 2} \\
    \text{Row 1} & 1 & 2 \\
    \text{Row 2} & 3 & 4

    The tabular environment is also an option. (The tabular environment does not work in this forum; the LaTeX here is aimed at mathematics only.)
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Matrix Row & Column Labels in Latex