I'd like to typeset a matrix of the following kind: When the symbols involved are big, like, in place of $r$, suppose we had $\mu(k-1)$ and in place of $\lambda$, we had $\mu(k-2)$, the matrix B below becomes very ugly, especially due to the $\ddots$ looking so ugly.

Is there a nicer way to typeset a matrix like the one below.


I have seen that the off diagonal entries are often replaced by a big and prominent entry if they are all same. I'd be happy if someone comes up with a trick to do that as well. Probably, it is something standard and I am unaware of it.

  • 6
    Well, people here can only give a nicer way, if there is something to compare to. So, I would suggest you compose a fully compilable MWE that produces the matrix you think looks very ugly, including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. Jun 2, 2012 at 23:41

5 Answers 5


This is a very common problem with matrix patterns and to be honest, I don't like that \<>dots solutions at all. I have a strong opinionated view about such use and I tend to think that they don't work at super- and sub- diagonals of the matrix.

So no matter what the solution is, one should always choose to carry the message across as opposed to complying with some ugly standard. Therefore I usually go with one of the following solutions

  1. Bite the bullet and typeset the matrix properly such that the dots are unambiguous.

    \[ AA^T = B = rI + 
    0       &\lambda &\ldots  &\lambda\\
    \lambda & 0      &\ddots  &\vdots\\
    \vdots  &\ddots  &0       &\lambda\\
    \lambda &\ldots  &\lambda &0

    enter image description here

  2. Avoid confusing drawings and define meaningful (hopefully!) shortcuts, e.g. you can define all ones matrix with blackboard 1 and subtract I from that instead of J. You don't gain a lot by replacing (1-I) by J in terms of document space.

    \[ AA^T = B = rI + \lambda(\mathbbm{1}-I) \]

    enter image description here

  3. Draw it properly with any graphics package, TikZ, PSTricks, METAPOST etc. as given in Diagonal dots spanning multiple lines/columns of a matrix


Here's an idea. I sort of threw it together so manual adjustments to p{3.5ex} and \scalebox{2} will probably be necessary to get what you want. There are likely better ways to accomplish the same thing.


r   &   &   &\multicolumn{2}{c}{\multirow{2}{*}{\scalebox{2}{$\lambda$}}}   \\
    &   r   &   &   &\\
    &   &\ddots &   &\\
    &   &   &   &r


Which gives the following

The result

  • I am quite unconvinced with this answer though. But, I appreciate your efforts.
    – kan
    Jun 26, 2012 at 10:41
  • This was what I was looking for when coming into this page. But I'm not fully convinced by the answer. Nice job though
    – Argemione
    Nov 9, 2020 at 9:52

You want to convey the idea that the \mu(k-1) coefficients are repeated on the diagonal and that the other coefficients are all equal to \mu(k-2). So why don't you try the following?

\mu(k-1) & \mu(k-2) & \mu(k-2) & \dots & \mu(k-2) \\
\mu(k-2) & \mu(k-1) & \mu(k-2) & \dots & \mu(k-2)\\
\hdotsfor{5} \\
\mu(k-2) & \dots & \mu(k-2) & \mu(k-2) & \mu(k-1)

(which probably will need to be split into two lines)

enter image description here

You might want to add a supplementary line of the form

\mu(k-2) & \dots & \mu(k-2) & \mu(k-1) & \mu(k-2) \

just before the last line.

enter image description here


Instead of using $\mu(k-1)$, you could use $\mu_{k-1}$ to save some space in each entry of your matrix.

As Peter has suggested, create a sample and let us know how you would like it changed. Then we could help you better.


I suggest to use the package nicematrix which has functionalities for this problem. Tikz nodes are automatically created for each cell of the matrix and the dotted lines are drawn with Tikz.

\mu(k-1) & \mu(k-2) & \Cdots   & \mu(k-2) \\
\mu(k-2) & \Ddots   & \Ddots   & \Vdots   \\
\Vdots   & \Ddots   &          & \mu(k-2) \\
\mu(k-2) & \Cdots   & \mu(k-2) & \mu(k-1)       

enter image description here

  • Too many dots. It is visually overwhelming. I suggest the usage of the three ordinary dots.
    – Cragfelt
    Aug 4, 2018 at 21:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .