can somebody tell me how to get homogeneous spacing between the elements of my matrix? Here is the code I'm using but it is not working as I was expecting.
\documentclass[12pt]{scrartcl}
\usepackage{amsmath,tikz}
\usepackage{tabstackengine}
\usetikzlibrary{matrix}
\setcounter{MaxMatrixCols}{20}
\begin{document}
\begin{equation}
\fixTABwidth{T}
\begin{tikzpicture}
\matrix (m) [baseline=(current bounding box.center),matrix of math nodes,nodes in empty cells,right delimiter={]},left delimiter={[} ]
{-4 & 1 & 0 & 0 & .. & 0 & 1 & 0 & 0 & 0 & 0 & ... & & &&&&\\
1 & -4 & 1 & 0 & .. & 0 & 0 & 1 & 0 & 0 & 0 & ... & & &&&&\\
& & & & & & & & & & & & & &&&&\\
& & & & & & & & & & & & & &&&&\\
& & & & & & & & & & & & & &&&&\\
& & & & & & & & & & & & & &&&&\\
1 & 0 & 0 & 0 & .. & 0 & -4 & 1 & 0 & 0 & 0&...&0&1&0&0&0&...\\
0 & 1 & 0 & 0 & .. & 0 & 1 & -4 & 1 & 0& 0&...&0&0&1&0&0&...\\
0 & 0 & 1 & 0 & .. & 0 & 0 & 1 & -4 & 1& 0&...&0&0&0&1&0&...\\
& & & & & & & & & & & & & &&&&\\
& & & & & & & & & & & & & &&&&\\
& & & & & & & & & & & & & &&&&\\
& & & & & & & & & & & & & &&&&\\
0 & 0 & 0 & 0 & .. & 0 & 0 & 1 & 0 & 0& ...&0&1&-4&1&0&0&...\\
0 & 0 & 0 & 0 & .. & 0 & 0 & 0 & 1 & 0& ...&0&0&1&-4&1&0&...\\} ;
\draw[line width=0.4mm, loosely dotted] (m-2-2)-- (m-7-7);
\draw[line width=0.4mm,loosely dotted] (m-2-3)-- (m-7-8);
\draw[line width=0.4mm,loosely dotted] (m-2-1)-- (m-7-6);
\draw[line width=0.4mm,loosely dotted] (m-2-8)-- (m-7-14);
\draw[line width=0.4mm,loosely dotted] (m-9-8)-- (m-14-13);
\draw[line width=0.4mm,loosely dotted] (m-9-9)-- (m-14-14);
\draw[line width=0.4mm,loosely dotted] (m-9-10)-- (m-14-15);
\draw[line width=0.4mm,loosely dotted] (m-9-3)-- (m-14-8);
\end{tikzpicture}
\end{equation}
\end{document}
But it looks like this: And I see that the spacing between neighbouring elements is not the same.
I'd appreciate any suggestion!
nicematrix
package.