# Vertical Line in \bordermatrix [duplicate]

Possible Duplicate:
bordermatrix with blocks

I need to put a vertical line between two columns of a matrix in \bordermatrix. I know how to do it in the array environment, but \bordermatrix isn't the same. Does anyone know how?

-

## marked as duplicate by egreg, Werner, Joseph Wright♦Dec 19 '11 at 19:21

Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  Torbjørn T. Dec 14 '11 at 8:28

\documentclass{article}
\def\VR{\kern-\arraycolsep\strut\vrule &\kern-\arraycolsep}
\def\vr{\kern-\arraycolsep & \kern-\arraycolsep}
\begin{document}

$\bordermatrix{ & 0 & 1 & 2 \cr 0 & A & B & C \cr 1 & d & e & f \cr 2 & 1 & 2 & 3 }$
%
$\bordermatrix{ & 0 & \vr 1 & 2 \cr 0 & A & \VR B & C \cr 1 & d & \VR e & f \cr 2 & 1 & \VR 2 & 3 }$

\end{document}​


-

You can use the package kbordermatrix. You need to install manually because this package is not in TL or CTAN. The documentation is inside the package.

Complete code

\documentclass[11pt]{scrartcl}
\usepackage{kbordermatrix}

\begin{document}
\kbordermatrix{\mbox{indices}&
1&2&\vrule&3&4\\
1&M_{1,1}&M_{1,2}&\vrule&M_{1,3}&M_{1,4}\\
2&M_{2,1}&M_{2,2}&\vrule&M_{2,3}&M_{2,4}
}
\end{document}


-