# Submatrix in LaTeX

I would like to create something like this:

       i
(           )
(           )
(______     )
j(      |    )
(      |    )


The matrix including its submatrix can be created by using multicolumn

$\left( \begin{array}{p{3mm}p{3mm}p{3mm}p{3mm}p{3mm}} &&&&\\ &&&&\\ \cline{1-3} &&\multicolumn{1}{c|}{}&&\\ &&\multicolumn{1}{c|}{}&&\\ &&\multicolumn{1}{c|}{}&&\\ &&\multicolumn{1}{c|}{}&& \end{array} \right)$


but this doesn't work with bordermatrix.

-

A flexible way of creating bordermatrix is the blkarray package. It allows to position delimiters in arbitrary positions only on some lines with a {block} environment. Here’s the same example as in Herbert’s answer:

\documentclass{article}

\usepackage{blkarray}

\begin{document}

$\begin{blockarray}{cccccc} & & & i & & \\ \begin{block}{c\Left{}{(\mkern1mu}ccccc<{\mkern1mu})} & 0 & a & b & c & d \\ & 0 & A & B & C & D \\ \cline{2-4} \begin{block*}{c(ccc|cc)} j & s & t & u & v & w \\ & t & & v & & \\ & u & & w & & \\ & V & W & z & Y & Z \\ \end{block*} \end{block} \end{blockarray}$

\end{document}


To avoid the \cline to go past the left parenthesis, I had to use \Left{}{(\mkern1mu} instead of ( as the left delimiter and, for symmetry, I added on the right a <{\mkern1mu}.

-
Looks nice in principle, but the manual correction of the \cline doesn't really make it hassle-free. – Hendrik Vogt Jan 15 '11 at 10:13
@Hendrik: You are right, but compared to other solutions where you must put a multicolumn in each cell, I would consider this probably to be less of a hassle. – Philippe Goutet Jan 15 '11 at 14:16
That's why I said "looks nice". It would be even nicer to have the best of both worlds. – Hendrik Vogt Jan 15 '11 at 14:18

Here's a skeleton of an idea without having to guess position for the put command...but I wasn't sure what you wanted to do with the lines.... I thought you can add them with addpath (an easymat command) but I was having trouble...anyhow, I'll put the answer here and see if it is helpful...

\documentclass{minimal}

\usepackage{easybmat}

\begin{document}
$$\begin{BMAT}{cc}{cc} & \begin{BMAT}(b){ccccc}{c} 1&2&3&4&5 \end{BMAT} \\ \begin{BMAT}(b){c}{ccccc} 1\\2\\3\\4\\5\\ \end{BMAT} & \left[\begin{BMAT}(b){ccccc}{ccccc} 1&2&3&4&5\\ 1&2&3&4&5\\ 1&2&3&4&5\\ 1&2&3&4&5\\ 1&2&3&4&5 \end{BMAT}\right] \end{BMAT}$$
\end{document}][1]


which gives:

-
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\def\mc#1{\multicolumn{1}{c|}{#1}}

$\begin{array}{cc} & i \\ \put(0,-10){\makebox(0,0){j}} & \left( \begin{array}{p{3mm}p{3mm}p{3mm}p{3mm}p{3mm}} 0&a&b&c&d\\ 0&A&B&C&D\\\cline{1-3} s&t&\mc{u}&v&w\\ t&&\mc{v}&&\\ u&&\mc{w}&&\\ V&W&\mc{x}&Y&Z \end{array} \right) \end{array}$

\end{document}


-