1

I would like to modify this matrix in such a way that the labels of the rows are on the right side rather than on the left side. Do you know how to do that?

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath,kbordermatrix,amsthm,amssymb,rotating,array}
\begin{document}

 \begin{eqnarray*}

  \mathbf{D}=\kbordermatrix{
    & t_1 & t_2 & t_3 & t_4 & t_5 \\
    t_1 & 0 & 2 & 3 & 3 & 2 \\
    t_2 & 2 & 0 & 2 & 2 & 3 \\
    t_3 & 3 & 2 & 0 & 2 & 3 \\
    t_4 & 3 & 2 & 2 & 0 & 2 \\
    t_5 & 2 & 3 & 3 & 2 & 0
  }

 \end{eqnarray*}

\end{document}
  • The eqnarray environment shouldn't be used any more. It gives bad spacings. Use the amsmath align environment, which has a simpler syntax. – Bernard Oct 28 '16 at 14:58
2

You can obtain this layout easily with blkarray:

\documentclass[11pt, a4paper]{article}

\usepackage{amsmath,blkarray, bigstrut}

\begin{document}

 \[ \mathbf{D}= \begin{blockarray}{*{6}{>{\scriptstyle}c}}
       t_1 & t_2 & t_3 & t_4 & t_5\\
        \begin{block}{[ccccc] >{\scriptstyle}c}
         \bigstrut[t] 0 & 2 & 3 & 3 & 2 & t_1 \\
          2 & 0 & 2 & 2 & 3 & t_2 \\
          3 & 2 & 0 & 2 & 3 & t_3 \\
          3 & 2 & 2 & 0 & 2 & t_4 \\
          2 & 3 & 3 & 2 & 0 & t_5 \\
        \end{block}
      \end{blockarray}\]%

 \end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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