3

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.

4
  • 1
    I can't really help, but I think that in the title, instead of "horizontal", you want "vertical". (You already have a visible horizontal line.) Aug 5 at 20:25
  • You are correct, thank you for pointing this out @barbarabeeton
    – SPARSE
    Aug 5 at 20:27
  • It's not possible to compile your code. How is defined the macro \ve? Aug 5 at 20:38
  • I apologize I forgot to mention that \ve is my renewcommand shortcut for \varepsilon @F.Pantigny
    – SPARSE
    Aug 5 at 20:58
4

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}
0
3

For the vertical rule, it's possible to use {pNiceArray} which has a preamble as {array}.

For the diagonal dotted lines, you can disable parallelization with the key parallelize-diags=false.

\documentclass[12pt,english]{article}
\usepackage{nicematrix}

\NiceMatrixOptions{renew-dots,renew-matrix}

\newcommand{\ve}{\varepsilon}

\begin{document}

\[\NiceMatrixOptions{parallelize-diags=false}
\begin{bNiceArray}{ccc|ccc}[margin]
    \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{bNiceArray}\]

\end{document}

Output of the above code

0

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.