3

How one can create the following matrix?

enter image description here

4

Two variants. I have to use a \raisebox command, adjusted by trial and errors, because it seems blockarray environment, for some reason, is not centred on the mathaxis. The blockarray is not raised at all (0pt), but the optional arguments are here to fool LaTeX and make it believe the contents of the environment is slightly higher and less deep than it is really:

\documentclass{article}
\usepackage{amsmath}
\usepackage{blkarray}

\begin{document}

\[ A =
    \begin{bmatrix}\raisebox{0pt}[\dimexpr\height + 1ex\relax][\dimexpr\depth- 2ex\relax]{$%
    \begin{blockarray}{c c c c}
        \begin{block}{[cc]cc}
        1 & 2 & 0 & 0 \\
        3 & 4 & 0 & 0\\
        \end{block}
        \begin{block}{cc[c] c}
        0 & 0 & {\,3\,} & 0\\
        \end{block}
        \begin{block}{ccc[c]}
        0 & 0 & 0 & \,4\, \\
        \end{block}
    \end{blockarray} $}\!
    \end{bmatrix}
 \]


\[ A =
    \begin{bmatrix}\raisebox{0pt}[\dimexpr\height + 1ex\relax][\dimexpr\depth- 2ex\relax]{$%
     \begin{blockarray}{c c c c}
        \begin{block}{[cc\Right{]}{\hskip2.333em \raisebox{-0.4\height}[\height][\depth]{\rlap{\Large 0}}}cc}
        1 & 2 & \\
        3 & 4 &\\
        \end{block}
        \begin{block}{cc[c] c}
       & & {\,3\,} & \\
        \end{block}
        \begin{block}{ccc[c]}
           \BAmulticolumn{3}{c}{\raisebox{0.2\height}[\height][\depth]{\smash[t]{\llap{\Large 0}}\enspace }} & \,4\, \\
        \end{block}
    \end{blockarray} $}\!
    \end{bmatrix}
 \]

\end{document} 

enter image description here

  • 2
    +1. For the benefit of any not-yet-expert-TeXnician readers of your answer, you may want to add a couple of explanatory sentences regarding the use of (a) the \raisebox "wrapper" around the blkarray environment and (b){\,3\,} instead of "just" 3. – Mico May 7 '16 at 10:54
  • 2
    @Mico: Done, Mylord! Hope it's clear enough for no-experts. – Bernard May 7 '16 at 12:28
  • there's a slight difference in the two results: the brackets around the "4" in the lower right corner are taller in the second version. no doubt unintended. (i haven't tested to determine why the difference, but i assume it has something to to with the height of the \Large zero.) i'd be inclined to center at least the left large 0 horizontally; an \llap could be used for this. – barbara beeton May 7 '16 at 15:55
  • @barbara beeton: my intention was to have the Large 0s symmetrical w.r.t. [3]. I smashed and lapped 'em. Is it more to your taste? – Bernard May 7 '16 at 16:18
5
\documentclass{article}

\usepackage{blkarray}

\begin{document}

\[
  \left[\begin{blockarray}{cccc}
\begin{block}{[cc]cc}
1 & 2 & \cdot & \cdot\\
3 & 4 & \cdot & \cdot\\
\end{block}
\cdot & \cdot & [3] &\cdot\\
\cdot & \cdot & \cdot & [4]\\
\end{blockarray}\right]
\]

\end{document}

One can use \circ instead of \cdot . Nice package blkarray!

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.