Centering \vdots in a sparse matrix with an even number of rows
Two possibilities: the first one uses an additional column and the @{...}
construct to decrease the inter-column spacing; the second one uses \tikzmark
to place some marks and then places the \vdots
using the marks.
\documentclass{article}
\usepackage{blkarray}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\tikzmark[1]{%
\tikz[remember picture,overlay] \node (#1) {};}
\begin{document}
\[
\begin{blockarray}{cccc}
\begin{block}{[c@{\hspace{3pt}}c@{\hspace{3pt}}c]l}
&\vdots& \\
a & & b & /K-1 \\
c & & d & /K \\
&\vdots& \\
\end{block}
\end{blockarray}
\]
\[
\begin{blockarray}{ccc}
\begin{block}{[cc]l}
\tikzmark{a} & \tikzmark{b} \\
a & b & /K-1 \\
c & d & /K \\
\tikzmark{c} & \tikzmark{d} \\
\end{block}
\end{blockarray}
\]
\begin{tikzpicture}[remember picture,overlay]
\node[yshift=0.5ex] at ( $ (a)!0.5!(b) $ ) {$\vdots$};
\node[yshift=1.7ex] at ( $ (c)!0.5!(d) $ ) {$\vdots$};
\end{tikzpicture}
\end{document}
blkarray
is able to do it without extra packages, just use \BAmulticolumn
, which is the specific command for a blockarray
:
\documentclass{article}
\usepackage{blkarray}
\begin{document}
\[
\begin{blockarray}{ccc}
\begin{block}{[cc]l}
\BAmulticolumn{2}{c}{\vdots} & \\
a & b & /K-1 \\
c & d & /K \\
\BAmulticolumn{2}{c}{\vdots} & \\
\end{block}
\end{blockarray}
\]
\end{document}