# Internal delimiters for matrix and array

I would like to customize the array environment in such a way that I can write arrays with dashed delimiters that are internal to the arrays as in the figure below.

Question. How do I place the vertical and horizontal delimiters on the inside of the arrays? Is it possible to have control over the customization of the delimiters? Like can I control the delimiters so that they are dashed or continuous or colored?

My attempt. The best I got was using the code below.

    \begin{center}
\left[\begin{array}{c|c|c}
\underline{\displaystyle{A}_{\vspace{5mm}}}
&
\underline{\displaystyle{B}_{\vspace{5mm}}}
&
\underline{\displaystyle{E}_{\vspace{5mm}}}
\\
\underline{\displaystyle{C}_{\vspace{5mm}}}
&
\underline{\displaystyle{D}_{\vspace{5mm}}}
&
\underline{\displaystyle{F}_{\vspace{5mm}}}
\\
\underline{\displaystyle{G}_{\vspace{5mm}}}
&
\underline{\displaystyle{H}_{\vspace{5mm}}}
&
\underline{\displaystyle{L}_{\vspace{5mm}}}
\end{array}\right]
\end{center}


And the result was somewhat unsatisfactory as can be seen in the figure below.

• Take a look at the arydshln package. – leandriis May 22 at 16:37
• Does this solve your problem? tex.stackexchange.com/a/20141 – antshar May 22 at 17:12
• @antshar Yes+1. Answer my question. It helped a lot. But is there an alternative without using the "arydshln" package? – MathOverview May 22 at 17:16
• @MathOverview: With nicematrix you can do that with dotted lines. And you can use both nicematrix and arydshln. – F. Pantigny May 22 at 17:22

As from suggestion of the creator F. Pantigny of nicematrix package, I add the differents output considering also the comments.

\documentclass[a4paper,12pt]{article}
\usepackage{amssymb}
\usepackage{nicematrix}
\usepackage{arydshln}

\begin{document}
\setlength{\extrarowheight}{1mm}
\renewcommand{\arraystretch}{1}
$\left[\,\begin{NiceArray}{c:c:c} A & B & C \\ \hdashline D & E & F \\ \hdashline G & H & O \end{NiceArray}\,\right]$

$\left[\,\begin{NiceArray}{c:c} A & B \\ \hdashline D & E \\ \end{NiceArray}\,\right]$

$\left[\,\begin{NiceArray}{c} A \\ \hdashline D \\ \end{NiceArray}\,\right]$

$\left[\begin{NiceArray}{c:c} A & V\\ \end{NiceArray}\right]$

\end{document}