# how to label rows and columns of matrix? [duplicate]

i have a matrix as follows:

\begin{document}
$\begin{bmatrix} & S1 & S2 & S3 & S4 \\ W1 & 0 & 0 & 0 & 0 \\ % inserting body of the table W2 & 0 & 0 & 0 & 0 \end{bmatrix}$
\end{document}


i want to write labels S1,S2,S3,S4 and W1,W2 outside the brackets instead of inside, any help would be appreciated.

## marked as duplicate by Mico, egreg, Gonzalo Medina, user13907, Svend TveskægOct 5 '15 at 15:28

• actually this gives me an error kbordermatrix.sty missing, anyways i'll download the .sty file and give it a try – Afzaal Ahmad Oct 5 '15 at 14:57
• There was also the other answer there of course, which uses a package (blkarray) that is on CTAN and in TeX Live and MikTeX. – Torbjørn T. Oct 5 '15 at 16:50