5

I am trying to reproduce something like this:enter image description here

So far, I have got the matrix with the lines from the following code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mleftright}

\begin{document}
\[
\renewcommand\arraystretch{1.3}
A_{ij} = \mleft[
\begin{array}{c|c|c|c|c}
     A_{c,\rho} & A_{c,u_r} & A_{c,u_{\theta}} & A_{c,u_z} & A_{c,T}     \\ \hline
     A_{r,\rho} & A_{r,u_r} & A_{r,u_{\theta}} & A_{r,u_z} & A_{r,T}    \\ \hline
     A_{\theta,\rho} & A_{\theta,u_r} & A_{\theta,u_{\theta}} & A_{\theta,u_z} & A_{u_{\theta},T}   \\ \hline
     A_{z,\rho} & A_{z,u_r} & A_{z,u_{\theta}} & A_{z,u_z} & A_{z,T}   \\ \hline
     A_{e,\rho} & A_{e,u_r} & A_{e,u_{\theta}} & A_{e,u_z} & A_{e,T}   
\end{array}
\mright]
\]

\end{document}

Now, how do I add the labels to rows and columns with arrows?

3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.