Why does \rowcolors cut matrix delimiter?

Here's what happens: bmatrix typesets the left delimiter, then the body of the matrix, with a backspace in between; now, the body is an array, so it inherits the current background color which each cell is printed with, including the padding normally done by colortbl.

The backspacing is the cause of the disappearance of the left delimiter, because it is covered by the new layer. Ah, the joys of color in TeX! ;-) The issue becomes apparent if pmatrix is used instead: we can clearly see that only part of the parenthesis is overprinted.

enter image description here

How to remedy? Define a colorbmatrix environment that reprints the missing delimiter.

\documentclass[border=2pt]{standalone}

\usepackage{amsmath}
\usepackage[natural,table]{xcolor}

\newsavebox{\bmatrixbox}
\newenvironment{colorbmatrix}
  {\begin{lrbox}{\bmatrixbox}
   \mathsurround=0pt
   $\displaystyle
   \begin{bmatrix}}
  {\end{bmatrix}$%
   \end{lrbox}%
   \usebox{\bmatrixbox}%
   \kern-\wd\bmatrixbox
   \makebox[0pt][l]{$\left[\vphantom{\usebox{\bmatrixbox}}\right.$}%
   \kern\wd\bmatrixbox
}

\begin{document}
    \rowcolors{1}{}{black!5}
    \begin{tabular}[t]{ll}
        \rowcolor{gray!50}{\bfseries SKP} & \\ \hline
        $A$ & $\begin{colorbmatrix}-0.25 & 1 \\ 0 & 0.5  \end{colorbmatrix}$\\
        $b=g$ & $\begin{colorbmatrix}0 \\ 1\end{colorbmatrix}$ \\ \hline
        $A$ & $\begin{colorbmatrix}-0.25 & 1 \\ 0 & 0.5  \end{colorbmatrix}$\\
    \end{tabular}
\end{document}

enter image description here

In the row with the white background the (visible) left delimiter will be also overprinted, but I'm confident in TeX's accuracy.

The best would be avoiding colored background in tables altogether. But it's just my personal opinion.


With the enviroment {NiceTabular} of nicematrix, you have directly the expected output.

    \documentclass{article}
    \usepackage{xcolor}
    \usepackage{nicematrix}

    \begin{document}
    \NiceMatrixOptions{cell-space-top-limit=2pt,cell-space-bottom-limit=2pt}
    \begin{NiceTabular}[t]{ll}[colortbl-like,code-before = \rowcolors{1}{}{black!5}]%
    \rowcolor{gray!50}\bfseries SKP & \\ \Hline
    $A$ & $\begin{bmatrix}-0.25 & 1 \\ 0 & 0.5  \end{bmatrix}$\\
    $b=g$ & $\begin{bmatrix}0 \\ 1\end{bmatrix}$    
    \end{NiceTabular}
    \end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes).

Output of the above code