I want a environment for displaying rows and columns of mathematical expressions, such that the contents of each column is centered, and the columns are equally spaced. Rows must have optional equation numbers, as with the align* environment.

I posted a similar question a few months ago, answered here: Standard math environment for equally-spaced columns of expressions?

Although I accepted the answer there at the time, it has some shortcomings: I have to specify in advance how many columns I'm going to need (unlike the existing align* environment, for example), and it doesn't allow me to have equation numbers for rows in a straightforward way.

Edit on 3rd April 2012: The syntax has to be like this:

A & B & C
f & g & h

This should produce two lines of displayed mathematics in three columns, all equally-spaced from the page margins and from each other. The first line should have an equation number, the second shouldn't.

  • Have you tried looking at equationarray enviornment? Commented Mar 23, 2012 at 13:15
  • I have now. It doesn't seem to provide the spacing that I need. Commented Apr 3, 2012 at 10:48

2 Answers 2


Ok, the following is probably as dirty as it could ever get, and I have to admit I patched it together by trial&error, but at least it might invoke the spirits-that-be to find a better solution.







  A & \min(B,Z) & C
f & g & h


calign example

  • I had tried something like that, but I didn't find the right trick. Nice job.
    – egreg
    Commented Apr 3, 2012 at 14:24
  • Hi Stephen. Having played with this, it seems the spacing is only correct if there are an even number of columns. Try with a single column to see the effect at its most extreme. But it's looking great! Commented Apr 3, 2012 at 15:40
  • @JamieVicary Can you describe the problem you are seeing in a little more detail? Btw, the example you gave doesn't have an even number of columns. Commented Apr 3, 2012 at 16:03
  • You can see the issue in the screenshot you posted; there is more space between the rightmost column and the right-hand margin than between the leftmost column and the left-hand margin. Commented Apr 3, 2012 at 16:38
  • Ok, found one more ;-) Unfortunately amsmath goes out of its way to catch if you've forgotten a trailing & :-) Try the updated code. Commented Apr 3, 2012 at 16:50

Try this. Although you still need to specify beforehand how many columns you need, adding equation number is easy.


\newcolumntype{E}{@{}c@{\phantom{(1)}}} %Provision for eq number
\arraycolsep 0.2em
  & x+y & e^{2 \pi i} & \sigma & \\
  & \text{First} & \text{Second} & \text{Third} & \yesnumber \\
  & \sqrt{x+y+z} & \int{x^2} dx & \Omega & \\


You then just use \yesnumber for each row(s) you want equation numbers inserted. If you want extra height between rows, you can use \setlength{\extrarowheight}{10pt} for example, but I would personally append to where the phantom command is with \vspace*{*max height*} because that'd ensure every row is the same height regardless of content. E.g. in above the integral stretches the vertical space. Redefining E with \newcolumntype{E}{@{}c@{\phantom{\int{x^2}}\vspace*{0.1cm}}} solves it.

  • Thanks Mobius Pizza! (Is that your real name?) I accept that this is an improvement on the status quo. But what I want is clearly possible, even if it might require something quite low level to achieve it - so I'm going to hold out in the hope that someone produces a full answer. Commented Mar 23, 2012 at 17:14
  • lol no isn't my real name. May I ask what is it you want that the above couldn't achieve? Changing column size really doesn't take much work. The only problem is you can't mix different number of columns within one environment, but to that end you can always use multiple arrays. Commented Mar 23, 2012 at 19:36
  • 1
    The difficulty is not achieving what I want; it's implementing it in a way that exposes an effortless syntax to the user, just like the amsmath align environment. In particular I don't want to have to specify the number of columns beforehand! Commented Apr 3, 2012 at 10:28

You must log in to answer this question.

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