Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

enter image description here

\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}
share|improve this question
2  
C{3cm}@{\hspace{2pt}}*{5}{Z} –  egreg Feb 8 '13 at 17:43

1 Answer 1

up vote 4 down vote accepted

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 the tabularx 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.

enter image description here

\documentclass[a4paper]{article}  % change if you're not using A4 paper size
\usepackage[margin=1in]{geometry} % change margin settings to desired values
\usepackage{tabularx,booktabs}
\newcolumntype{Z}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}X}
\newcolumntype{L}{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p}

\begin{document}\pagestyle{empty}
\begin{table}[t]
\caption{Case studies} \label{case-studies}

\smallskip
\begin{tabularx}{\textwidth}{@{} L{4.5cm} @{} *4{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}
\end{table}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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