[Tex/LaTex] Width of column after multicolumn header

multicolumntableswidth

When multicolumn headers in tables use more horizontal space than the columns they are 'heading', then the additional width is entirely allocated to the rightmost column. The following MWE:

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{lccc}\toprule
  & \multicolumn{3}{c}{Wide multicolumn cell}\\
  & x & y & z  \\ \midrule
A & 1 & 2 & 3  \\  \bottomrule
\end{tabular}
\end{document}

Produces:

enter image description here

I would like to allocate the same amount of horizontal space to column x,y, and z. I do realize that an easy fix would be to use fixed width columns for x, y, and z, but I am looking for a dynamic solution. So my questions are the following:

1) Is there an easy way to allocate the horizontal space equally to columns x,y, and z?

2) Assuming that the answer to 1) is no: What would be an elegant way to increase the width of a single variable-width column by a percentage, e.g., increase the width of column x to 150% of the default?

Best Answer

A few possibilities:

enter image description here

\documentclass{article}
\usepackage{booktabs,tabularx}
\begin{document}
\setlength\parskip{1cm}

\begin{tabular}{lccc}\toprule
  & \multicolumn{3}{c}{Wide multicolumn cell}\\
  & x & y & z  \\ \midrule
A & 1 & 2 & 3  \\  \bottomrule
\end{tabular}

\dotfill


\begin{tabular*}{.5\textwidth}
                {l!{\extracolsep{\textwidth minus \textwidth}}lccc}
\toprule
  & \multicolumn{3}{c}{Wide multicolumn cell}\\
  & x & y & z  \\ \midrule
A & 1 & 2 & 3  \\  \bottomrule
\end{tabular*}

\begin{tabular}{lc@{\hspace{4em}}c@{\hspace{4em}}c}\toprule
  & \multicolumn{3}{c}{Wide multicolumn cell}\\
  & x & y & z  \\ \midrule
A & 1 & 2 & 3  \\  \bottomrule
\end{tabular}

\begin{tabularx}{.5\textwidth}{l*{3}{>{\centering\arraybackslash}X}}\toprule
  & \multicolumn{3}{c}{Wide multicolumn cell}\\
  & x & y & z  \\ \midrule
A & 1 & 2 & 3  \\  \bottomrule
\end{tabularx}

\begin{tabular}{lccc}\toprule
  & &\makebox[60pt]{Wide multicolumn cell}&\\
  & x & y & z  \\ \midrule
A & 1 & 2 & 3  \\  \bottomrule
\end{tabular}


\end{document}
Related Question