4

I have the following example:

\documentclass{article}

\usepackage[english]{babel}
\usepackage{booktabs}
\usepackage{array}
\usepackage{blkarray}

\begin{document}

\begin{equation}\label{cexA_Rmat}
\mathbf{R}=
\begin{blockarray}{cccccc}
& \lambda_1 & \lambda_2 & \lambda_3 & \lambda_4 \\
\cmidrule{2-6}
\begin{block}{c|(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{equation}

\end{document}

where I would like to add extra space between column $\tau_i$ (i=1,2,3,4) and the left-side matrix parenthesis. As you can see in the enclosed image, there the left parenthesis and the vertical line are totally overlapped. How can I increase their distance (as well as the distance between the $\tau_i$s and the vertical line)?

enter image description here

3

Insert a space within the column specification of your blockarray:

enter image description here

\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.

1
  • Thanks, you helped a lot! – TobiR Feb 8 at 18:24
2

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]1-|1) -- ([xshift=-2pt]5-|1) ;
\end{pNiceArray}\]

\end{document}

Output of the above code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.