[texhax] equal width tabular columns when using a long multicolumn heading

Donald Arseneau asnd at triumf.ca
Fri Dec 2 23:14:50 CET 2011


"jtzzaa11-texhax1 at yahoo.com" <jtzzaa11-texhax1 at yahoo.com> writes:

> I have a tabular with several columns preceded by a heading in a multicolumn. However, the heading is wider than the combined width of the columns, which results in the columns having different widths. Here is a minimal example:
> 
> \begin{tabular}{ c c c }
> \multicolumn{3}{c}{long heading}    \\    
> 1 & 2 & 3\\
> \end{tabular}
> 
> so the last column is much wider than the first two.
> Is there a way to automatically generate equal width columns whose combined width equals the width of the long heading?. I am trying to avoid manually fixing the width of the columns, for example, using p{2cm}.

There is the tabularx method already mentioned, which is 
like an automation of the "p{2cm}".

There is also shrinkable separation between columns, like 
\extracolsep{2cm minus 2cm}, but that likewise requires
an assigned overall width.  It might be helpful sometimes
in tables with partial-spanning headings.

Donald Arseneau                          asnd at triumf.ca



More information about the texhax mailing list