TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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. – Peter Grill Jun 2 '12 at 23:41
up vote 9 down vote accepted

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

share|improve this answer

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

share|improve this answer
I am quite unconvinced with this answer though. But, I appreciate your efforts. – kan Jun 26 '12 at 10:41

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

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.