1

I'd like to extend vertically the \langle and \rangle -paranthesis in this code:

\documentclass{article}
\usepackage[customcolors,shade]{hf-tikz}
\usepackage{nicematrix}
\usepackage{diagbox}
\usepackage{tikz-cd}

[\begin{NiceMatrix}[columns-width=8.5mm] \diagbox{\small A_i} {\small 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\langle{2-2}{4-4}\rangle[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) ; %[line,shorten > = 2mm, shorten < = 2mm] \end{tikzpicture} \begin{tikzpicture} \draw (2-|5) -- (5-|5) ; \draw (5-|2) -- (5-|5) ; \end{tikzpicture} \end{NiceMatrix}]

\end{document}

Thank you so much

F. Pantigny
  • 40,250
Puck
  • 1,208

2 Answers2

1

The command \SubMatrix available in the \CodeAfter of the environments of nicematrix has a key extra-height to increase the vertical size of the delimiters.

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

\begin{document}

[\begin{NiceMatrix}[columns-width=8.5mm,hvlines] \diagbox{\scriptstyle A_i} {\scriptstyle A^j} & A^1 & A^2 & A^3 \ A_1 & \Block{3-3}{} 1 & 2 & 3 \ A_2 & 4 & 5 & 6 \ A_3 & 7 & 8 & 9 \CodeAfter \SubMatrix[{2-2}{4-4}][xshift=-0.85mm,extra-height=1mm] \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}

Output of the above code

However, the delimiters \langle and \rangle have a maximal size (see that question). In you example, the default size is yet the maximal size and that why extra-height won't have any effect.

You could try to change the mathematical font as explained in the question linked above...

F. Pantigny
  • 40,250
1

Here is a solution by drawing the angular brackets with Tikz.

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

\begin{document}

[ \begin{NiceMatrix}[columns-width=8.5mm,cell-space-limits=2pt,hvlines] \diagbox{\scriptstyle A_i} {\scriptstyle A^j} & A^1 & A^2 & A^3 \ A_1 & \Block{3-3}{} 1 & 2 & 3 \ A_2 & 4 & 5 & 6 \ A_3 & 7 & 8 & 9 \CodeAfter \begin{tikzpicture} \begin{scope} [dashed] \draw ([xshift=3mm]3-|2) -- ([xshift=-3mm]3-|5) ; \draw ([xshift=3mm]4-|2) -- ([xshift=-3mm]4-|5) ; \draw (2-|3) -- (5-|3) ; \draw (2-|4) -- (5-|4) ; \end{scope} \begin{scope} [line width=1pt] \draw ([xshift=-1mm]2-|2.5) -- ([xshift=1mm]3.5-|2) -- ([xshift=-1mm]5-|2.5) ; \draw ([xshift=1mm]2-|4.5) -- ([xshift=-1mm]3.5-|5) -- ([xshift=1mm]5-|4.5) ; \end{scope} \end{tikzpicture} \end{NiceMatrix} ]

\end{document}

Comments

  • The command \Block{3-3}{} creates a empty block. With that block, the key hvlines will draw all the rules excepted in the blocks (in that block, in fact, here).
  • The command \diagbox is a built-in command of nicematrix. So, there is no need to load the package diagbox.
  • I have adjusted the positions of the points of the angular brackets by using [xshift=...] in the Tikz coordinates (this is a Tikz feature).
  • The environment {scope} is provided by Tikz. It's a way to limit the scope of the options in a Tikz picture.
  • As usual with nicematrix, you need several compilations.

Output of the above code

F. Pantigny
  • 40,250