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.

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.

share|improve this question
1  
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Christian Hupfer Jul 25 at 7:41

2 Answers 2

% 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

share|improve this answer

If you need it only for the 2x3 matrix:

\documentclass{article}
\usepackage{array}
\let\SC\scriptstyle
\def\Biggg#1{\makebox(0,0){\put(0,-20){\bigg#1}}}
\begin{document}
$ \begin{array}{r@{\kern5pt}ccc@{}l>{\SC}l} 
        & \SC C_1 &\SC C_2 &\SC C_3\\
\Biggg[ & 1       & 2      & 7      & \Biggg] & R_1 \\
        & 2       & 1      & 8      &         & R_2
\end{array} $

\end{document}

enter image description here

share|improve this answer

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.