You can do it with blkarray
. A couple of dummy columns are necessary for accommodating the horizontal rules.
\documentclass{article}
\usepackage{amsmath}
\usepackage{blkarray}
\begin{document}
\[
\renewcommand\arraystretch{1.3}
\begin{blockarray}{rcccccccc}
&&& u & v & w & \rho & T & \\
&&& \downarrow & \downarrow & \downarrow & \downarrow & \downarrow & \\
\begin{block}{rc[c@{}c|c|c|c|c@{}c]}
\text{Cont.} & \to && A_{c,u} & A_{c,v} & A_{c,w} & A_{c,\rho} & A_{c,T} &\vphantom{\smash[b]{\bigg|}} \\
\BAhhline{~~~-----~}
x\text{-mom} & \to && A_{r,\rho} & A_{r,u_r} & A_{r,u_{\theta}} & A_{r,u_z} & A_{r,T} & \\
\BAhhline{~~~-----~}
A_{ij}=\quad
y\text{-mom} & \to && A_{\theta,\rho} & A_{\theta,u_r} & A_{\theta,u_{\theta}} & A_{\theta,u_z} & A_{u_{\theta},T} & \\
\BAhhline{~~~-----~}
z\text{-mom} & \to && A_{z,\rho} & A_{z,u_r} & A_{z,u_{\theta}} & A_{z,u_z} & A_{z,T} & \\
\BAhhline{~~~-----~}
\text{energy} & \to && A_{e,\rho} & A_{e,u_r} & A_{e,u_{\theta}} & A_{e,u_z} & A_{e,T} & \vphantom{\smash[t]{\bigg|}}\\
\end{block}
\end{blockarray}
\]
\end{document}
The \vphantom
trick is for getting slightly bigger brackets.
![enter image description here](https://i.stack.imgur.com/tYZ2S.png)
Here is how to do it with pst-node
. Another possibility would to use a grey continuous line. I give a code for both:
\documentclass[svgnames, x11names, table]{article}
\usepackage{amsmath}
\usepackage{blkarray, booktabs}
\usepackage{xcolor}
\usepackage{pst-node}
% \usepackage{auto-pst-pdf} % for pdflatex compilation. Requires pdflatex --enable-write18 (MiKTeX)
% or pdflatex -shell-escape (TeX Live, MacTeX)
\begin{document}
\begin{pspicture}$
\begin{blockarray}{ccc}
\begin{block}{(cc)c}
\rnode[l]{x1}{x_1}\pnode[1.4ex, 1.4ex]{T} & \rnode[r]{x2}{x_2} & r_1 \\
\rnode[l]{x3}{x_3}\pnode[1.4ex, -0.8ex]{B} & x_4 & r_2 \\
\end{block}
c_1 & c_2 &
\end{blockarray}$
\psset{linewidth=0.4pt, linestyle=dashed, dash=2pt 2pt}
\pcline[offset =-1.4ex]{-}(x1)(x2)
\ncline{T}{B}
\end{pspicture}
\vspace{1cm}
{\aboverulesep = 0pt\belowrulesep = 0pt
$\begin{blockarray}{ccc}
\begin{block}{(c!{\color{Snow3}\vrule}c)c}
\rnode[l]{x1}{x_1}\pnode[1.4ex, 1.4ex]{T} & \rnode[r]{x2}{x_2} & r_1 \\
\arrayrulecolor{Snow3}\cmidrule(lr){1-2}
\rnode[l]{x3}{x_3}\pnode[1.4ex, -0.8ex]{B} & x_4 & r_2 \\
\end{block}
c_1 & c_2 &
\end{blockarray}$}
\end{document}
![enter image description here](https://i.stack.imgur.com/5HF1r.png)
Best Answer
Leaders is optimal for this situation.
amsmath
provides\hdotsfor{<cols>}
that draws a dotted leader across<cols>
columns. It is also possible to overlay a row number by setting that specific row twice (once with\hdotsfor
and once with a row number, say). I've also added\numberrowwithline{<cols>}{<stuff>}
that draws a line (instead of dots) as a dash leader, and inserts<stuff>
in the middle of<cols>
columns. The default space on either side is\fboxsep
.The following is a modified example, taken from Herbert's
mathmode
document:With the addition of
xhfill
you can go crazy with the colours and types of leaders. See thexhfill
documentation for the different styles of lines as a sample.