# Better positioning of ddots in matrix

How can i improve the representation of this matrix? The problem is that the \ddots in the middle are not properly aligned. It should say that a and b gets succesively gets moved one column further to the right.

Maybe there is \ddots with a smaller slope?

\documentclass[]{article}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
%opening

\begin{document}

$\left(\begin{array}[c]{c|cccccc} & & c & \ldots & c & c \\ \hline & 0 & & & & 0 \\ d & a & b & & & \\ \vdots & & \ddots & & \ddots & \\ d & & & & a & b \end{array}\right)$

\end{document}

• Move the first \ddots to the next cell and it looks just fine. If you align all the & it is easier to see where everything goes. You might even want to remove the last \ddots – daleif Apr 6 at 20:02
• there an automatic way to do this? – user3680510 Apr 6 at 20:49
• What are you referring to? – daleif Apr 6 at 20:50
• the alignment of the & – user3680510 Apr 6 at 20:55
• My editor (emacs) has a build in feature for it. There might be other editors who can do the same – daleif Apr 6 at 20:57

Here's a different suggestion: simplify the matrix from a 5x5 to a 4x4 structure, to emphasize that the lower-right block of the full-matrix is (to my understanding) a triangular matrix, with zeroes above the diagonal.

There seems to be an implicit assumption that your readers "know" what's in the top-left block and in the first positions of row- and column vectors. Is this assumption justified?

\documentclass{article}
\usepackage{array}
\begin{document}
$\left(\begin{array}{c|cccc} & & c & \ldots & c \\ \hline & 0 & & & 0\\ d & a & b & & \\ \vdots & & \ddots & \ddots & \\ d & & & a & b \end{array}\right)$
\end{document}


You can also use nicematrix:

\documentclass[]{article}
\usepackage{graphicx}
\usepackage{nicematrix}

\begin{document}
$\begin{pNiceArray}[c]{C|CCCCCC} & & c & \Ldots & c & c \\ \hline & 0 & & & & 0 \\ d & a & b & & & \\ \Vdots & & \Ddots & \Ddots \\ \\ d & & & & a & b \end{pNiceArray}$
\end{document}


You can rotate the dots a bit and possibly put them higher using the \rotatebox and \raisebox commands from the graphicx package. Note that this requires the dots to be put in math mode explicitly, even if they are already in a math environment. With \smash you can prevent the rotated/raised boxes from increasing the height of the array row.

However, I agree with the comments that a single \ddots is probably better.

MWE:

\documentclass[]{article}
\usepackage{graphicx}

\begin{document}

$\left(\begin{array}[c]{c|cccccc} & & c & \ldots & c & c \\ \hline & 0 & & & & 0 \\ d & a & b & & & \\ \vdots & & \smash{\rotatebox{20}{\ddots}} & \smash{\raisebox{3pt}{\rotatebox{20}{\ddots}}} & & \\ d & & & & a & b \end{array}\right)$

$\left(\begin{array}[c]{c|cccccc} & & c & \ldots & c & c \\ \hline & 0 & & & & 0 \\ d & a & b & & & \\ \vdots & & & \ddots & & \\ d & & & & a & b \end{array}\right)$
\end{document}


Result: