28

I'd like to change (reduce) the column separation between specific columns in my table. So far, I have only found ways to adjust the column separation for all columns (e.g., using \tabcolsep).

To get an idea about what I would like to achieve, consider the following small table:

\begin{center}
\begin{tabular}{ c c c }
 cell1 & cell2 & cell3 \\ 
 cell4 & cell5 & cell6 \\  
 cell7 & cell8 & cell9    
\end{tabular}
\end{center}

In this table I would for instance like to adjust the column separation between columns 2 and 3, but not between columns 1 and 2. Any help would be appreciated!

Additionally, would there be a handy way to apply such a custom column spacing to all tables? e.g. where the column spacing between uneven and even columns is the standard spacing, while the column spacing between even and uneven columns is reduced?

2
  • 3
    \begin{tabular}{c@{\hspace{2pt}c@{\hspace{2pt}c} for example?
    – user31729
    Jan 26, 2017 at 15:35
  • If you want to do something like this for any tabular environment, you should use a specialized column type, defined with array package.
    – user31729
    Jan 26, 2017 at 15:50

1 Answer 1

41

The column specification allows for the insertion of @{<stuff>} between columns. If <stuff> is empty (as in @{}), no column gap is inserted, while the "default" is @{\hspace{\tabcolsep}} around every column if nothing is specified at all (that is, a gap of 2\tabcolsep between two columns). Using this you can manipulate the column separation as you wish:

enter image description here

\documentclass{article}

\begin{document}

% Default
A: \begin{tabular}[t]{ c c c }
  cell1 & cell2 & cell3 \\ 
  cell4 & cell5 & cell6 \\  
  cell7 & cell8 & cell9    
\end{tabular}

% Standard gap between columns 2 and 3
B: \begin{tabular}[t]{ c c @{\hspace{2\tabcolsep}} c }
  cell1 & cell2 & cell3 \\ 
  cell4 & cell5 & cell6 \\  
  cell7 & cell8 & cell9    
\end{tabular}

% 75% of regular gap between columns 2 and 3 (1.5 x \tabcolsep)
C: \begin{tabular}[t]{ c c @{\hspace{1.5\tabcolsep}} c }
  cell1 & cell2 & cell3 \\ 
  cell4 & cell5 & cell6 \\  
  cell7 & cell8 & cell9    
\end{tabular}

% Fixed 2cm gap between columns 2 and 3
D: \begin{tabular}[t]{ c c @{\hspace{2cm}} c }
  cell1 & cell2 & cell3 \\ 
  cell4 & cell5 & cell6 \\  
  cell7 & cell8 & cell9    
\end{tabular}

% No gap between columns 2 and 3
E: \begin{tabular}[t]{ c c @{} c }
  cell1 & cell2 & cell3 \\ 
  cell4 & cell5 & cell6 \\  
  cell7 & cell8 & cell9    
\end{tabular}

% Negative/overlapping gap between columns 2 and 3
F: \begin{tabular}[t]{ c c @{\hspace{-1ex}} c }
  cell1 & cell2 & cell3 \\ 
  cell4 & cell5 & cell6 \\  
  cell7 & cell8 & cell9    
\end{tabular}

% Something other than a space between columns 2 and 3
G: \begin{tabular}[t]{ c c @{-\$-} c }
  cell1 & cell2 & cell3 \\ 
  cell4 & cell5 & cell6 \\  
  cell7 & cell8 & cell9    
\end{tabular}

\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .