TransWikia.com

How to fix this block matrix in a way that the dotted line appears inside the matrix?

TeX - LaTeX Asked by Ofelia y Orquesta on May 22, 2021

I would like to fix this next block matrix in a way that the dotted line appears inside the matrix: Block Matrix using nicematrix

Here is the code:

documentclass{article}
usepackage{nicematrix,tikz}

NewDocumentCommand{MyMatrixA}{m}
  {
    begin{pNiceMatrix}
    1 & 0  & Block{2-2}<Large>{A_{#1}} &  
    1 & 0  &                            & 
    1 &  0     & 1  & 0 
    CodeAfter 
        tikz draw [dotted] (1-|3) -- (4-|3) 
                             (1-|5) -- (4-|5) 
                             (1-|3) -- (1-|5) 
                (3-|3) -- (3 -|5);
    end{pNiceMatrix}
  }

begin{document}

$MyMatrixA{i}$

end{document}

I tried changing (3-|3) -- (3 -|5) to (3-|3) -- (3 -|4.5) , but apparently it only accepts integer numbers.

THANKS

One Answer

This is one way.

b

documentclass{article}
usepackage{nicematrix,tikz}

NewDocumentCommand{MyMatrixA}{m}
  {%
begin{pNiceMatrix}
    1 & 0  & Block{2-2}<Large>{A_{#1}}    &   &   
    1 & 0  &                                &   &   
    1 & 0  & 1                              & 0 &   
  CodeAfter 
         tikz draw [dotted] (row-1-|col-3) -- (row-1-|col-5)  -- (row-3-|col-5) -- (row-3-|col-3) ; 
         tikz draw [dotted] (row-1-|col-3) -- (row-4-|col-3); 
 end{pNiceMatrix}
  }

begin{document}

$MyMatrixA{i}$

end{document}

Correct answer by Simon Dispa on May 22, 2021

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