# Two columns stretched more than the others in tabular

A year ago, I based on an example to produce a table adaptable to what I need. The table was displayed without errors when it was in a journal template. Now I moved it to another template, It went outside the page limit. So I added adjustbox but another thing happened, two columns (S4s in the picture) are more stretched than the others. Is there a way to solve this issue?

\begin{table}
\centering
\setlength\tabcolsep{2pt}
\caption{Mapping Precision of MedK} \label{tab:t3}
\begin{tabular}{ | l | l | l | l | l | l | l | l | l | l | c | l | l | l | c | l | }
\hline
\multirow{2}{*}{Keyword}  & \multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}Results Requested\\per source\end{tabular}} & \multicolumn{5}{c|}{Results available} & \multicolumn{4}{c|}{Properties retrieved}& \multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}Properties matched\\with \end{tabular}} & \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Overall\\Precision\end{tabular}} \\[1ex] \cline{3-15}
&  & S1 & S2 & S3 & S4 & overall & S1 & S2 & S3 & S4 & S1 & S2 & S3 & S4 &  \\ \hline
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
\end{tabular}
\end{table}


• \multicolumn adds all width to the last spanned column if it is wider than the columns it spans. Just put \makebox[3em]{} in one cell in each column to force a minimum width (replacing 3em by whatever is needed). Only apply scaling such as adjustbox to tables as a last resort, and even then don't do it:-) – David Carlisle Jul 14 '17 at 21:37
• the spacing of multicolumn is unrelated to adjustbox. – David Carlisle Jul 14 '17 at 21:38
• @DavidCarlisle thanks, can you post your comment an answer. – user5482015 Jul 14 '17 at 21:44

\multicolumn adds all width to the last spanned column if it is wider than the columns it spans. Just put \makebox[3em]{} in one cell in each column to force a minimum width (replacing 3em by whatever is needed). Only apply scaling such as adjustbox to tables as a last resort, and even then don't do it.

But here I think if you choose a smaller font, and line-break your headings, then you shouldn't have over-sized multicolumns, something like:

\documentclass{article}
\usepackage{multirow}
\begin{document}

\begin{table}
\centering
\small
\setlength\tabcolsep{1.7pt}
\caption{Mapping Precision of MedK} \label{tab:t3}

\begin{tabular}{@{}| l | l | l | l | l | l | l | l | l | l | c | l | l | l | c | l |@{}}
\hline
\multirow{2}{*}{Keyword}  &
\multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}Results Requested\\per source\end{tabular}} &
\multicolumn{5}{c|}{\begin{tabular}[c]{@{}c@{}}Results\\available\end{tabular}}&
\multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}Properties\\retrieved\end{tabular}}&
\multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}Properties\\matched\\with \end{tabular}} &
\multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Overall\\Precision\end{tabular}} \\[1ex] \cline{3-15}
&  & S1 & S2 & S3 & S4 & overall & S1 & S2 & S3 & S4 & S1 & S2 & S3 & S4 &  \\ \hline
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
\end{tabular}

\end{table}
\end{document}


As already explained, the excess width goes in the last spanned column.

Here I propose a different way of typesetting your table, with no vertical rule and with LaTeX doing the job of computing the intercolumn space.

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\begin{table}
\centering
\setlength\tabcolsep{0pt}
\small
\caption{Mapping Precision of MedK} \label{tab:t3}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l l l l l l l l l l c l l l c l @{}}
\toprule
Keyword &
\multicolumn{6}{c}{Results} &
\multicolumn{8}{c}{Properties} &
\multicolumn{1}{c@{}}{\smash{\begin{tabular}[t]{@{}c@{}}Overall\\precision\end{tabular}}}
\\
\cmidrule{2-7}\cmidrule{8-15}
&
\multicolumn{1}{c}{requested} &
\multicolumn{5}{c}{available} &
\multicolumn{4}{c}{retrieved} &
\multicolumn{4}{c}{matched} &
\multicolumn{1}{c}{}
\\
&
\multicolumn{1}{c}{per source} &
\multicolumn{5}{c}{} &
\multicolumn{4}{c}{} &
\multicolumn{4}{c}{with} &
\multicolumn{1}{c}{}
\\
\cmidrule{2-2}\cmidrule{3-7}\cmidrule{8-11}\cmidrule{12-15}
&  & S1 & S2 & S3 & S4 & overall & S1 & S2 & S3 & S4 & S1 & S2 & S3 & S4 &  \\
\midrule
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\
&  &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\
\bottomrule
\end{tabular*}

\end{table}

\end{document}