1

I am trying to achieve something like the following

    ( ) text
(  )( ) text

my attempt using blkarray fails:

\documentclass{article}
\usepackage{blkarray}
\begin{document}

\begin{blockarray}{cc(cc)}
\begin{block}{cc(cc)}
  &   & 1 & 3\\
  &   & 2 & -5 \\
\end{block}
\begin{block}{(cc)(cc)}
11 & 22 & 33 & $x^2+ 1$ \\
25121 & 2 & 3 & -5\\
\end{block}
\end{blockarray}
\end{document}

  • the code snippet yields extra empty matrices, which I can't figure out how to get rid of.
  • the actual use case stacks matrices in both directions. The above layout is the simplest one
  • I would like to use tikz to add decorations, as well as a text paragraph to the right of each level in the stack of matrices
  1. The blkarray package might do what I want by e.g., adding the tikzmark package if I could figure out the extra bracket problem.
  2. The nicematrix package looks promising, but I can't figure out how to add brackets to the submatrices.

Could anybody point me to a workable solution
(hopefully not too clumsy, I need to produce a lot of such figures)?
I am not tied to using any particular package...

0

Use the parentheses only in the preambles of the blocks. I added some spacing improvements:

\documentclass{article}
\usepackage{blkarray}

\begin{document}

\begin{blockarray}{cccc}
\begin{block}{cc(cc)}
  & & 1 & 3\\
  & & 2 & $ -5 $ \\
\end{block}
\noalign{\vspace{1ex}}
\begin{block}{(cc)!{\,}(cc)}
11 & 22 & 33 & $x^2+ 1$ \\
25121 & 2 & 3 & $ -5 $\\
\end{block}
\end{blockarray}

\end{document}

enter image description here

1

Here is a solution with {NiceArray} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

$\begin{NiceArray}{cc!{\;}cc}
  & & 1 & 3\\
  & & 2 & -5 \\
\noalign{\vspace{1ex}}
11 & 22 & 33 & x^2+ 1 \\
25121 & 2 & 3 & -5 \\
\CodeAfter 
\SubMatrix({1-3}{2-4})
\SubMatrix({3-1}{4-2})
\SubMatrix({3-3}{4-4})
\end{NiceArray}$

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