# How to create blocks matrix?

An example: (right matrix) • For this one, a simple array{ccc|cc} and a \hline will do. – Bernard Jun 13 '17 at 7:47

\documentclass{article}
\begin{document}
$\left(\begin{array}{@{}ccc|cc@{}} a_{11} & a_{12} & a_{13} & b_{11} & b_{12} \\ a_{21} & a_{22} & a_{23} & b_{21} & b_{22} \\\hline c_{11} & c_{12} & c_{13} & d_{11} & d_{12} \\ c_{21} & c_{22} & c_{23} & d_{21} & d_{22} \\ c_{31} & c_{32} & c_{33} & d_{31} & d_{32} \end{array}\right)$
\end{document}

• Aha, I just thought (from the start), that something like special-matrix env. exists – M.Mass Jun 13 '17 at 10:24
• @M.Mass There are special matrix environments, like matrix and pmatrix, defined in amsmath but they do not support the lines. See e.g. en.wikibooks.org/wiki/LaTeX/Mathematics (about halfway down the page) – StefanH Jun 13 '17 at 12:18

Here is a way to highlight blocks in a matrix environment easily with pstricks without increasing the column widths:

\documentclass[svgnames]{article}
\usepackage{mathtools}
\usepackage{pst-node}%

\begin{document}

$A = \begin{pmatrix} M_{11} & M_{12}\\\ M_{21} & M_{22} \end{pmatrix} = \begin{pspicture}  \begin{pmatrix} \pnode[-0.3ex, 1.5ex]{A} a_{11} & a_{12} & a_{13} & b_{11} & b_{12} \\ a_{21} & a_{22} & a_{23} & b_{21} & b_{22} \\ c_{11} & c_{12} & c_{13} \pnode[1.4ex, -0.8ex]{C} & d_{11} & d_{12} \\ c_{21} & c_{22} & c_{23} & d_{21} & d_{22} \\ c_{31} & c_{32} & c_{33} & d_{31} & d_{32}\pnode[0.2ex, -0.6ex]{D}\, \end{pmatrix}  \psset{linecolor = IndianRed} \psframe(A)(C) \psset{dimen = inner}\psframe(C)(D) \end{pspicture}$

\end{document} 