Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How to add label to index the rows and columns of the matrix ? because I want to number the line outside the matrix

     \[
    \begin{array}{lc}
      \ Mat_{\varPhi to M} & \left(\begin{array}{@{}ccccc@{}}
            1 & 1 & 1 & 1 & 1 \\
            0 & 1 & 0 & 0 & 1 \\
            0 & 0 & 1 & 0 & 1 \\
            0 & 0 & 0 & 1 & 1 \\
            0 & 0 & 0 & 0 & 1
              \end{array}\right) \\[15pt]
    \end{array}
    \]
share|improve this question
1  
May I ask you why did you unaccept my answer? Are you experiencing any problems with it? Is it something else you are looking for? –  Gonzalo Medina Jun 13 '12 at 11:31
add comment

2 Answers 2

up vote 1 down vote accepted

Here is an option using kbordermatrix:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{kbordermatrix}% http://www.hss.caltech.edu/~kcb/TeX/kbordermatrix.sty
\begin{document}
\[
  \begin{array}{l@{{}={}}c}
  \text{Mat}_{\varphi\text{ to }M} & \left(\begin{array}{@{}ccccc@{}}
    1 & 1 & 1 & 1 & 1 \\
    0 & 1 & 0 & 0 & 1 \\
    0 & 0 & 1 & 0 & 1 \\
    0 & 0 & 0 & 1 & 1 \\
    0 & 0 & 0 & 0 & 1
  \end{array}\right)
  \end{array}
\]

\renewcommand{\kbldelim}{(}% Left delimiter
\renewcommand{\kbrdelim}{)}% Right delimiter
\[
  \text{Mat}_{\varphi\text{ to }M} = \kbordermatrix{
    & c_1 & c_2 & c_3 & c_4 & c_5 \\
    r_1 & 1 & 1 & 1 & 1 & 1 \\
    r_2 & 0 & 1 & 0 & 0 & 1 \\
    r_3 & 0 & 0 & 1 & 0 & 1 \\
    r_4 & 0 & 0 & 0 & 1 & 1 \\
    r_5 & 0 & 0 & 0 & 0 & 1
  }
\]

\end{document}

For more options and styles, including the usage of \bordermatrix, see Where is the \matrix command?

share|improve this answer
add comment

You can use the blkarray package:

\documentclass[12pt]{report}
\usepackage{blkarray}
\usepackage{amsmath}

\begin{document}

\[
\begin{blockarray}{cccccc}
a & b & c & d & e \\
\begin{block}{(ccccc)c}
  1 & 1 & 1 & 1 & 1 & f \\
  0 & 1 & 0 & 0 & 1 & g \\
  0 & 0 & 1 & 0 & 1 & h \\
  0 & 0 & 0 & 1 & 1 & i \\
  0 & 0 & 0 & 0 & 1 & j \\
\end{block}
\end{blockarray}
 \]

\end{document}

enter image description here

share|improve this answer
    
This approach is way more flexible and intuitive, +1, plus available through CTAN. –  matty T pain Oct 8 '13 at 17:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.