TransWikia.com

Need help getting stack of matrices with entry alignment across all matrix rows and columns

TeX - LaTeX Asked on December 27, 2020

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…

One Answer

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

Correct answer by Bernard on December 27, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP