Suppose I have a table with 20 columns that should all be centered. Is there a way to declare the alignment without literally counting out 20 c's? Something like c{20} might be the syntax. I feel like I saw this once, but I can't find a reference anywhere.

  • 1
    Use the array package, and write the specifiers as {*{20}{c}} instead of {ccc…cc}.
    – Bernard
    Commented Jul 21, 2014 at 19:20
  • 1
    @Bernard: There is no need for array here, although it is a good addition to any document.
    – Werner
    Commented Jul 21, 2014 at 19:21
  • @Werner: ? I thought it was defined in array. Never checked though.
    – Bernard
    Commented Jul 21, 2014 at 19:22
  • @Bernard: Then check. :)
    – Werner
    Commented Jul 21, 2014 at 19:25
  • @Werner: 'f course, I trust you. I just meant never thought of checking:).
    – Bernard
    Commented Jul 21, 2014 at 19:28

1 Answer 1


Replication of column specifications is done using a *{<num>}{<col spec>} interface, which should repeat <col spec> a total of <num> times:

  % tabular content

will produce a table of 20 columns, each one centred. To add vertical column rules (which you should never do), you can use

  % tabular content

Note how the replication only includes a single right-side vertical rule with a single left-side rule at the beginning. One could also have used *{20}{|c}|.

  • The second form behaves slightly more oddly with \multicolumn?
    – cfr
    Commented Jul 22, 2014 at 2:23
  • 1
    @cfr: Yes; this is because of the insertion of the rules. I forget which (left/right), but they are associated with that particular column.
    – Werner
    Commented Jul 22, 2014 at 2:30
  • yet, be careful in using |. See the booktabs manual for a nice introduction into nice tables :) ctan.org/pkg/booktabs
    – Arne
    Commented Oct 24, 2022 at 18:08

You must log in to answer this question.

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