# How to draw this matrix

Do you have any idea how to draw the attached matrix?

• Welcome to TeX.SE! Try with nicematrix package. What you try so far? – Zarko Aug 21 '20 at 7:21
• what is the font used to typeset a in the matrix -- the subscripts are slightly lower -- the d in the subscript is upright and not slanted as normal – js bibra Aug 22 '20 at 4:07

Here is a proposition with nicematrix. It's difficult to have a good result because of the width of the elements a_{n,n-d_1+1} and a_{n-d_u+1,n} which are much wider than the other elements.

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

\begin{document}

\NiceMatrixOptions
{
xdots =
{
color = gray ,
shorten = 3pt ,
}
}

$\begin{pNiceMatrix}[columns-width=8mm,first-row,first-col] & \Hdotsfor[line-style={solid,<->},color=black]{4}^{d_u} \\ \Vdotsfor[line-style={solid,<->},color=black]{4}_{d_1} & a_{11} & a_{12} & \Cdots & a_{1d_u} & 0 & \Cdots & & 0 \\[1.5mm] & a_{21} & a_{22} & & & & & & \Vdots \\[1.5mm] & \Vdots & & \Ddots & & & \Ddots & \Ddots & \\[1.5mm] & a_{d_11}& & & & & & & 0 \\[1.5mm] & 0 & \Ddots & & & & & & a_{n-d_u+1,n} \\[1.5mm] & \Vdots & \Ddots & & & & & & \\[1.5mm] & & & & & & & & \Vdots \\[1.5mm] & 0 & \Cdots & & 0 & a_{n,n-d_1+1} & \Cdots & & a_{nn}\\ \end{pNiceMatrix}$

\end{document}


• Excuse me very much if sometimes I done some comments: why the long dots from ad_11 are broken before a_n,n-d_1+1? – Sebastiano Aug 21 '20 at 9:10
• nicematrix parallelizes the diagonal dotted lines: the first \Ddots draws its line and the other lines are constructed parallel to the first one. In this aim, the lower right extremity of the dotted line is vertically translated as to have a line parallel to the first diagonal line. The result is not perfect... in particular when the elements have very different widths. It's also possible to disable parallelization with a key but, usually, the result seems strange... – F. Pantigny Aug 21 '20 at 9:27
• Thank you very much for the clear and exhaustive explanation. – Sebastiano Aug 21 '20 at 11:14