Insert a vertical line on a block partitioned nice matrix

matricesnicematrix

I have the following algorithm

\documentclass[12pt,english]{article}
\usepackage{nicematrix}
\NiceMatrixOptions{renew-dots}
\NiceMatrixOptions{renew-matrix}

\begin{document}
$$
\begin{bNiceMatrix}
\ve_{1,1}   & \cdots  &\ve_{1,k}&\ve_{1,k+1} &\cdots   & \ve_{1,n} \\
    &      \Ddots&     \vdots   & \vdots     & \Ddots &   \vdots  \\
    &       &      \ve_{k,k} &\ve_{k,k+1}      &\cdots&   \ve_{k,n}    \\
\hline
   &       &      & \ve_{k+1,k+1} &  \cdots & \ve_{k+1,n}           \\
\Block{2-3}<\huge>{0}
    &       &       && \Ddots  &   \vdots  \\
    &       &       &      & &  \ve_{n,n}  \\
\end{bNiceMatrix}
$$
\end{document}

which produces :
enter image description here

I have two issues, which I have highlighted below :

enter image description here

The first thing I want is to have that vertical line to achieve a look of having a block partioned matrix.

The second issue I have is the overlapping of the dots in the highlighted area, is it possible to fix this?

Honestly, dealing with block matrices even with powerful packages such as nicematrix are exhaustive I wish there was some online software that could create block matrices easily and generate a code.

Best Answer

Use \CodeAfter to draw the dotted diagonal and the vertical line.

b

\documentclass[12pt,english]{article}
\usepackage{nicematrix}
\usepackage{tikz} % added <<<

\NiceMatrixOptions{renew-dots}
\NiceMatrixOptions{renew-matrix}

\newcommand{\ve}{\varepsilon}

\begin{document}

    $$
    \begin{bNiceMatrix}[margin]
        \ve_{1,1}   & \cdots    &\ve_{1,k}  &\ve_{1,k+1}    &\cdots     & \ve_{1,n}     \\
                    & \Ddots    &\vdots     & \vdots        &           & \vdots        \\
                    &           &\ve_{k,k}  &\ve_{k,k+1}    &\cdots     & \ve_{k,n}     \\  \hline
                    &           &           & \ve_{k+1,k+1} &  \cdots   & \ve_{k+1,n}   \\
    \Block{2-3}<\huge>{0}&      &           &               & \Ddots    & \vdots        \\
                    &           &           &               &           & \ve_{n,n}     \\
         \CodeAfter  % added <<<<<<<<<<<<
        \line{1-4}{3-6} 
        \tikz \draw  (1-|4) -- (7-|4);  
    \end{bNiceMatrix}
    $$
\end{document}