I want to emphasize a block structure in a matrix by both, vertical and horizontal lines. Since I am using bmatrix as matrix environment I had the issues as in How to shorten \hline in a matrix.
I very much liked the first solution mentioned there using booktabs, because it calculates vertical spacings in a nice fashion and centers the horizontal lines correctly (e.g. with 2 rows the middle of the equal sign before the matrix will exactly be at the same height as the line drawn by cmidrule).
However, I still want to add vertical lines, therefore I use [cc|cc] as optional argument. But then the vertical line is interrupted by the vertical line.
Is there an easy way out? As far as I could figure out, the clue about cmidrule is the trim option which I couldn't find for hline or cline.
\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs} % required for the first solution
%matrix environment redef
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\makeatother
\begin{document}
\begin{equation*}
\begin{bmatrix}[c|c]
a & b\\ \cmidrule(lr){1-2}
c & d
\end{bmatrix}
\end{equation*}
\end{document}


[bpv]matrixenvironments can take an optional environment of the formcc|cc. – Mico May 25 '15 at 13:46\begin{bmatrix}[c|c]. At least that's what I think the intent is, since the body of the matrix contains just two columns, not four. – Mico May 25 '15 at 15:00