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}