I have 5 columns in my table. So I want to reduce distance between two columns to make it look good. In the following figure, I want to reduce distance between column 1 and 2.
I tried \setlength{\tabcolsep}{5pt}
but it didn't look good. I want top row to take only two rows, not three. how do I do that?
\usepackage{tabularx,booktabs}
\usepackage{array}
\newcolumntype{Z}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}X}
\newcolumntype{C}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p}
\begin{table}[t]
\caption{Case studies}
\centering
\begin{tabularx}{\textwidth}{C{3cm}*5{Z}}
\toprule
Nature of unreliability & Sender SST & Receiver SST & Implementation SST & Retransmission Bound \\
\midrule
Noisy (Single fixed error message) & DSST & DSST & DSST & Unbounded \\
\bottomrule
\end{tabularx}
\label{case-studies}
\end{table}
Best Answer
To set the amount of intercolumn white-space between any two columns -- say, between columns 1 and 2 -- to
0
, you can insert@{}
in the corresponding spot in the second argument of thetabularx
environment.Note that because the column type of column 2 is "Z" (which, in turn, is based on the "X" column type) and the first column has a fixed width, the total intercolumn whitespace between columns 1 and 2 will nevertheless nonzero in your example code. This happens because (i) the
tabularx
environment expands the associated column widths in order to fill up the allocated width and (ii) the width of the first column is probably wider than absolutely necessary to typeset its contents on a single line.The following modified form of your MWE implements this idea and also applies a few further refinements. E.g., I'd get rid of the unnecessary whitespace ahead of the first column and after the final column, and I'd also left-align (using
\raggedright
) rather than center-set the first column, to make it visually more distinct from the data columns.