LaTeX Code for Study-Matrix

I'd like to have the TeX code of this matrix in the photo, please:

Study-Matrix

I state that I know something of nicematrix and tikz-packages and I use stix.

I'd like to have the TeX code of the same matrix with the difference that pmatrix is contained in a box, this is, I'd like the TeX code of the photo with completed (closed) box and the TeX code of \diagbox{A_i}{A_j} only, too.

I hope have been clear.

• What have you tried so far? Have you tried with nicematrix? Jun 29 at 18:05
• Welcome to TeX.SX! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are either "off topic", "too broad", or "unclear". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. Jun 29 at 18:14

Here is a solution with nicematrix.

\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}

\begin{document}

\renewcommand{\arraystretch}{1.4}
$\begin{NiceMatrix}[columns-width=5mm] \diagbox{\scriptstyle A_i}{\scriptstyle A^j} \Block[hvlines]{1-4}{} \Block[hvlines]{4-1}{} & A^1 & A^2 & A^3 \\ A_1 & 1 & 2 & 3 \\ A_2 & 4 & 5 & 6 \\ A_3 & 7 & 8 & 9 \CodeAfter \SubMatrix({2-2}{4-4})[xshift=-0.85mm] \begin{tikzpicture} [dashed,shorten > = 2mm, shorten < = 2mm] \draw (3-|2) -- (3-|5) ; \draw (4-|2) -- (4-|5) ; \draw (2-|3) -- (5-|3) ; \draw (2-|4) -- (5-|4) ; \end{tikzpicture} \end{NiceMatrix}$

\end{document}


Ok. I've started with this code:

\documentclass{article}
\usepackage{nicematrix}
\usepackage{stix}
\usepackage{mathtools}
\usepackage{amsmat}
\begin{document}
$$\begin{NiceMatrix}[columns-width=5mm] \diagbox{\scriptstyle A_i}{\scriptstyle A^j} \Block[hvlines]{1-4}{} \Block[hvlines]{4-1}{} & A^1 & A^2 & A^3 \\ A_1 & 1 & 2 & 3 \\ A_2 & 4 & 5 & 6 \\ A_3 & 7 & 8 & 9 \CodeAfter \boxed{\SubMatrix({2-2}{4-4})[xshift=-0.85mm] \begin{tikzpicture} [dashed,shorten > = 2mm, shorten < = 2mm] \draw (3-|2) -- (3-|5) ; \draw (4-|2) -- (4-|5) ; \draw (2-|3) -- (5-|3) ; \draw (2-|4) -- (5-|4) ; \end{tikzpicture}} \end{NiceMatrix}$$

\end{document}


I'd like also tex-code of this photo:

Study Matrix, complete

Furthermore, Does a way exist to change the ( ) of the matrix in [ ], { }, | |, || ||, ||| ||| or any type of brackets?

• Thanks for editing my tex-code. I've tried with \boxed{\SubMatrix{...}} but the result is a \square next to the matrix. How could I improve it?
– Puck
Jun 29 at 19:51
• Put this code in your question and delete this no-answer. Jun 29 at 19:53
• @projetmbc. I have already done
– Puck
Jun 29 at 20:20
• Furthermore, Does a way exist to change the ( ) of the matrix in [ ], { }, | |, || ||, ||| ||| or any type of brackets? Thx.
– Puck
Jun 29 at 21:12