[Tex/LaTex] Latex \kbordermatrix with row labels on the right side

bordermatrixlabelsmath-mode

I'm needing to create a matrix enclosed with brackets [], not parentheses (), with row labels on right side. Is this possible using \kbordermatrix?

For instance, in the following:

\kbordermatrix{\mbox{}& C_1 & C_2& C_3\\
R_1&1&2&7\\
R_2&2&1&8
}

I would like the labels R_1 and R_2 to be on the right side of the matrix not the left.

Best Answer

% arara: pdflatex

\documentclass{article}
\usepackage{blkarray}
\newcommand{\mLabel}[1]{\mbox{$\scriptstyle{#1}$}}

\begin{document}
\[
\begin{blockarray}{c@{}ccc@{\hspace{4pt}}cl}
    & \mLabel{C_1} & \mLabel{C_2} & \mLabel{C_3} & & \\
    \begin{block}{[c@{\hspace{5pt}}ccc@{\hspace{5pt}}c]l}
      & 1 & 2 & 7 & & \mLabel{R_1} \\
      & 2 & 1 & 8 & & \mLabel{R_2} \\
    \end{block}
  \end{blockarray}
\]
\end{document}

enter image description here

Related Question