I have a table whose column headings (centre aligned with \multicolumn{1}{c}{Foobar here}) are wider than the left-aligned data. This looks somewhat odd, as there are large right-margins in each column.

It is probably easiest to illustrate my query with an example. Let say that the column heading is 10em and the data in the column varies from 2em to 3em. Currently each row of data will have a right margin of between 8em and 7em (as the data is left aligned so the right margin picks up any slack).

What I want is a means of evening this out; so the left margin is (10em - 3em) / 2 = 3.5em and the right margin varying between 3.5em and 4.5em.

How can I go about this? I know the text of each column heading and the text of the widest piece of data in the table.

2 Answers 2


The eqparbox package will solve this. Here is an example (modified from the eqparbox documentation to have left-aligned data like you described, and to be more aesthetic by using booktabs). (You have to run it through latex twice, for the box widths to converge.)

\begin{tabular}{@{}lccc@{}} \toprule
& \multicolumn{3}{c}{Sales (in millions)} \\ \cmidrule{2-4}
Product &
October & November & December \\ \midrule
Widgets & \eqparbox{oct}{55.2} &
\eqparbox{nov}{\textbf{89.2}} &
\eqparbox{dec}{57.9} \\
Doohickeys & \eqparbox{oct}{\textbf{65.0}} &
\eqparbox{nov}{64.1} &
\eqparbox{dec}{9.3} \\
Thingamabobs & \eqparbox{oct}{10.4} &
\eqparbox{nov}{8.0} &
\eqparbox{dec}{\textbf{109.7}} \\ \bottomrule

To make the wrapping in eqparbox more automatic, you can do some trickery with the array package

    & \multicolumn{3}{c}{Sales (in millions)} \\ 
Product      & 
\multicolumn{1}{c}{October} & 
\multicolumn{1}{c}{November} & 
\multicolumn{1}{c}{December} \\
Widgets      & 55.2 & 89.2 & 57.9 \\
Doohickeys   & 65.0 & 64.1 & 9.3 \\
Thingamabobs & 10.4 & 8.0  & 109.7 \\
  • Brilliant, that worked a treat. Does LaTeX provide any neat ways of automatically encasing a column with \eqparbox{foo}{#1}? Just to save on the typing. Aug 20, 2010 at 10:32
  • I edited to show how to automatically wrap a column.
    – Lev Bishop
    Aug 20, 2010 at 14:43
  • @Freddie Witherder you could use \newcommand{} to create a function which represents one line, and in this command you can add the \eqparbox. for the above example: \newcommand{\salesline}[4]{#1 & \eqparbox{oct}{#2} & \eqparbox{nov}{#3} & \eqparbox{dec}{#4} \\ } you can than use in your table: \salesline{Widgets}{55.2}{89.2}{57.9} and the rest is easy :) Nov 13, 2010 at 13:14

I have simply created multiple columns (and used a multi-column heading). Then inside the table body, I just need to replace & -> &&; not too much typing. In the first row you can add some spacing commands that ensures that the empty columns aren't too narrow.

If you want to keep your table body very simple, here is another trick:

    \multicolumn{1}{c}{Long heading} &
    \multicolumn{1}{c}{Long heading} &
    \multicolumn{1}{c}{Long heading} \\
      1 &  2 & 123 \\
    111 & 12 &  23 \\
     21 &  2 &   3 \\
      1 & 22 &  13

You must log in to answer this question.

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