3

since I'm missing the ability to pass some kind of "format"-string to the gmatrix environment of the gauss package, and I learnt that this is not possible with redefining some environemnts used by the gauss package (see gauss package set formatting (like the option for the array env)), I finally came to the point, when I decided to emulate some parts of the behaviour of the gauss package to be more flexible.

I just wanted to ask you if there is some way to attach tikz arrows onto elements of the array environment (and thus the pmatrix environment of the amsmath package) or if the only way to do something like this is by setting the whole array/matrix within tikz?

(If maybe someone has already done this (then I'd be glad if this one would share ;) ))

8

The package nicematrix provides environments {NiceArray}, {NiceMatrix}, {pNiceMatrix}, etc. similar to the environments of array and amsmath but with the creation of a PGF/Tikz nodes under the cells of the array.

It's possible to use these nodes with Tikz after the construction of the array.

\documentclass{article}    
\usepackage{nicematrix,tikz}    
\begin{document}
$\begin{bNiceMatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 
\CodeAfter
\tikz \draw (1-3.east)  -- ++ (3mm,0) node [anchor = west]{\tiny $-3$} |- (2-3.east) ; 
\end{bNiceMatrix}$    
\end{document}

Result of the above code

6
  • 2
    Excuse me very much for this disturb. Into your code there is \tiny $-4$ in the picture I see -3 :-). My regards. – Sebastiano Jun 4 '20 at 11:41
  • 2
    @Sabastiano: You are right. I have modified my answer. – F. Pantigny Jun 4 '20 at 13:44
  • Oh, thanks for the suggestion, actually this looks pretty nice! – atticus Jun 4 '20 at 17:27
  • @F.Pantigny I like very much your package and I think that many users have appreciated it. – Sebastiano Jun 4 '20 at 21:56
  • Oh, didn't knew you are the author ^^, (until now) I think it is a very nice package (especially for users like me, who like to insert tikz drawings into arrays/matrices). Thanks for writing ;) – atticus Jun 4 '20 at 22:07

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.