How to add extra space between the left-side legend and the left parenthesis of a matrix in the presence of a vertical line?
Insert a space within the column specification of your blockarray
:
\documentclass{article}
\usepackage{booktabs}
\usepackage{blkarray}
\begin{document}
\[
\mathbf{R} =
\begin{blockarray}{ cccccc }
& \lambda_1 & \lambda_2 & \lambda_3 & \lambda_4 \\
\cmidrule{2-6}
\begin{block}{@{} c @{\hspace{1ex}} | @{\quad} (ccccc) }
\tau_1 & -1 & \phantom{-}1 & \phantom{-}0 & \phantom{-}0 \\
\tau_2 & \phantom{-}0 & -1 & \phantom{-}1 & \phantom{-}0 \\
\tau_3 & \phantom{-}0 & \phantom{-}0 & \phantom{-}1 & -1 \\
\tau_4 & -1 & \phantom{-}0 & \phantom{-}0 & \phantom{-}1 \\
\end{block}
\end{blockarray}
\]
\end{document}
Also note the removal of the inter-column space (using @{}
) at the beginning of the nested block
.
With {pNiceArray}
of nicematrix
.
\documentclass{article}
\usepackage{nicematrix,tikz}
\begin{document}
\[\mathbf{R}=
\begin{pNiceArray}{cccc}[first-col,first-row]
& \lambda_1 & \lambda_2 & \lambda_3 & \lambda_4 \\
\hline
\noalign{\vskip2pt}
\tau_1 & -1 & \phantom{-}1 & \phantom{-}0 & \phantom{-}0 \\
\tau_2 & \phantom{-}0 & -1 & \phantom{-}1 & \phantom{-}0 \\
\tau_3 & \phantom{-}0 & \phantom{-}0 & \phantom{-}1 & -1 \\
\tau_4 & -1 & \phantom{-}0 & \phantom{-}0 & \phantom{-}1 \\
\CodeAfter
\tikz \draw ([xshift=-2pt]row-1-|col-1) -- ([xshift=-2pt]row-5-|col-1) ;
\end{pNiceArray}\]
\end{document}