# How to have a dotted line separate a matrix into upper and lower part

So, here is what I want to do: I have created a matrix C and another Matrix D. And I have labelled the columns and rows. Now, I want to join these two matrices together, keeping the labels. But I want - I hope this is posssible - to have a dotted line go through the matrix, indicating where labels 'TX^C' end and where labels 'TX^D' start.

This is what I have so far:

\documentclass[a4paper12pt]{article}
\usepackage{geometry}
\usepackage{blkarray}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{graphicx}

\begin{document}

$\mathbf{J} = \begin{blockarray}{cccccc} RB_1 & RB_2 & RB_3 & \dots & RB_m \\ \begin{block}{(ccccc)c} 1 & 0 & 1 & \dots & 0 & TX_1^C \\ 0 & 1 & 0 & \dots & 0 & TX_2^C \\ \vdots & \vdots & \vdots & & \vdots & \\ & & & & & \\ 0 & 0 & 0 & \dots & 1 & TX_{max}^C \\ 1 & 0 & 1 & \dots & 0 & TX_1^D \\ 0 & 1 & 0 & \dots & 0 & TX_2^D \\ \vdots & \vdots & \vdots & & \vdots & \\ & & & & & \\ 0 & 0 & 0 & \dots & 1 & TX_{max}^D \\ \end{block} \end{blockarray}$

\end{document}


Only the dotted line is missing. Alternatively, shading the background of the upper matrix in a light color would be nice as well. I have just read a similar question here. But since I don't know LaTeX so well, I don't know if I want to overcomplicate things by making use of tikz.

Small Edit: What, if I want two vertical labels? I was trying this, for example:

$\mathbf{Pairs} = \begin{blockarray}{cc} Transmitter & Receiver \\ \begin{block}{c(cc)c} TX_1^C & (x,y) & (x,y) & BS \\ TX_2^C & (x,y) & (x,y) & BS \\ &\vdots & \vdots \\ TX_{max}^C & (x,y) & (x,y) & BS \\ \BAhhline{......} TX_1^D & (x,y) & (x,y) &RX_1^D \\ TX_2^D & (x,y) & (x,y) &RX_2^D \\ &\vdots & \vdots \\ TX_{ax}^D & (x,y) & (x,y) &RX_{max}^D \\ \end{block} \end{blockarray}$


The package blkarray already offers several commands for different lines. One of them is \BAhhline where you can define the kind of line

\documentclass[a4paper12pt]{article}
\usepackage{geometry}
\usepackage{blkarray}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{graphicx}

\begin{document}

$\mathbf{J} = \begin{blockarray}{cccccc} RB_1 & RB_2 & RB_3 & \dots & RB_m \\ \begin{block}{(ccccc)c} 1 & 0 & 1 & \dots & 0 & TX_1^C \\ 0 & 1 & 0 & \dots & 0 & TX_2^C \\ \vdots & \vdots & \vdots & & \vdots & \\ & & & & & \\ 0 & 0 & 0 & \dots & 1 & TX_{max}^C \\ \BAhhline{......} 1 & 0 & 1 & \dots & 0 & TX_1^D \\ 0 & 1 & 0 & \dots & 0 & TX_2^D \\ \vdots & \vdots & \vdots & & \vdots & \\ & & & & & \\ 0 & 0 & 0 & \dots & 1 & TX_{max}^D \\ \end{block} \end{blockarray}$

\end{document}


• Thx so much, Ignasi! This is exactly what I want. Just - see my edit - what if I only label the columns and not the rows? It doesn't seem to work the way I am trying to do it. I have included the extra & before the \ , because this is where usually there would be the labels. If I leave the &, at least I don't get an error. But the left bracket is far to much to the left
– Luk
Nov 10 '18 at 12:39
• hmm... actually, let me correct this: Can you tell me a way of how to have two vertical labels? One on the right and one on the left ?
– Luk
Nov 10 '18 at 12:48
• ok, nevermind. I have opened a new question for this. Thx so much for your help, again!
– Luk
Nov 10 '18 at 13:35