In the following code,



\newcommand*{\rowstyle}[1]{% sets the style of the next row
\newcolumntype{=}{% resets the row style
\newcolumntype{+}{% adds the current row style to the next column

 \spe{a} &  \spe{b} &  \spe{c} &  \spe{d} &  \spe{e} &  \spe{f} &  \spe{g}     &  \spe{h} \\
 \spe{a} &  \spe{b} &  {c} &  {d} &  {c} &  {d} &  \spe{e} &  \spe{f} &  \spe{g} &  \spe{h} \\

I need the table to be of equal width columns even in multicolumns. i. e. enter image description here

But the produced output neglects columns without any content. i. e. enter image description here

Even p{} does not achieve this. Also, the column content should be centre aligned. In most of the column types, the content alignment is not controlled or the width is not controlled.

Any ideas, guys?!


1 Answer 1


It's not clear to me if all ten rows should all be equally wide, or if you want the rows labelled a, b, e, f, g, and h to be twice as wide as the remaining ones.

To achieve the former goal, one could use the tabularx environment provided by the package with the same name. All columns of type X (and columns based on this column type) will have the same width by default.

To achieve that latter look, i.e., to produce a table in which columns 3 through 6 are half as wide as the others, one has to take into account the parameter \tabcolsep, which denotes half the width of the intercolumn whitespace. As there are ten columns, one has to subtract 20\tabcolsep from \textwidth to obtain the width that's left over for the columns themselves.

The column contents will be center-set in all cases.

enter image description here


% calculate column widths for case (b)

\setlength{\parindent}{0pt} % just for this MWE

(a) Ten equal-width columns:

a & b & \multicolumn{2}{c}{$\gamma$} & \multicolumn{2}{c}{$\delta$} & e & f & g & h \\
a & b & c & d & c & d & e & f & g & h \\

(b) Six columns that are twice as wide as the other four:

\begin{tabular}{*{2}{U} *{4}{V} *{4}{U}}
a & b & \multicolumn{2}{c}{$\gamma$} & \multicolumn{2}{c}{$\delta$} & e & f & g & h \\
a & b & c & d & c & d & e & f & g & h \\

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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