3

I have a matrix

\documentclass{standalone}
\usepackage{amsmath}
$
P= 
\begin{pmatrix}
0 & \gamma & \gamma & \gamma \\
0 & -2\tau -\gamma & 0& 0 
\end{pmatrix}
$

Which looks like

a matrix

It has some submatrices we can identify.

\documentclass{standalone}
\usepackage{amsmath}
$
P = 
\begin{pmatrix}
%
\begin{pmatrix} 0 \end{pmatrix}  & 
\begin{pmatrix} \gamma & \gamma & \gamma\end{pmatrix} \\
%
%
\begin{pmatrix} 0\\ 0\\ 0 \end{pmatrix} & 
\begin{pmatrix}-2\tau -\gamma & 0& 0\\  
                         0 & -2\tau -\gamma & 0\\
                         0 & 0 & -2\tau -\gamma 
\end{pmatrix} 
\end{pmatrix}
$

So that it looks like

new matrix with sub-blocks

But the columns don't line up between the submatrices, and the parentheses overlap. Fixing the parentheses should be easy by just adding a bit more space between lines, but I haven't found a good way to control the columns.

I'm looking for a good option to fix this. I'd prefer to stick to pmatrix if possible. Is it possible to use pmatrix so that the columns align?

2 Answers 2

2

You can insert the \gamma elements inside a box of width -2\tau-\gamma so they take up the same space horizontally as needed:

enter image description here

\documentclass{article}

\usepackage{amsmath,calc}

\begin{document}

\[
  P = 
  \begin{pmatrix}
    %
    \begin{pmatrix} 0 \end{pmatrix}  & 
    \begin{pmatrix}
      \makebox[\widthof{$-2\tau-\gamma$}]{$\gamma$} & 
      \makebox[\widthof{$-2\tau-\gamma$}]{$\gamma$} & 
      \makebox[\widthof{$-2\tau-\gamma$}]{$\gamma$}
    \end{pmatrix} \\[.5\normalbaselineskip]
    %
    \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix} & 
    \begin{pmatrix}
      -2\tau -\gamma & 0 & 0 \\
      0 & -2\tau -\gamma & 0 \\
      0 & 0 & -2\tau -\gamma 
    \end{pmatrix} 
  \end{pmatrix}
\]

\end{document}

I've emphasized a gap between the first and second row; something you can tweak to suit your needs.

2

Here is a solution with the blkarray package and some fine-tuning:

\documentclass{article}
\usepackage{mathtools}
\usepackage{blkarray}

\begin{document}

$ P =
\begin{pmatrix}
  \begin{blockarray}{c ccc}%
  \BAnoalign{\vspace*{-2ex}}
  \begin{block}{(c)@{\hspace*{1em}}(ccc)}
  0 & \gamma & \gamma & \gamma \\
  \end{block}
  \begin{block}{(c)@{\hspace*{1.333em}} (ccc)}%
  \BAnoalign*{\vspace*{-2ex}}
  0 & -2\tau -\gamma & 0 & 0 \\
  0 & 0 & \mathclap{-2\tau -\gamma} & 0 \\
  0 & 0 & 0 & -2\tau -\gamma \\
  \end{block}
  \BAnoalign{\vspace*{-5ex}}
  \end{blockarray}%
\end{pmatrix} $

\end{document} 

enter image description here

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.