13

Can someone explain the use of @{} in table formatting as in:

\begin{tabular}{@{}cp{0.45\columnwidth}p{0.25\columnwidth}@{}}
cgnieder
  • 66,645
N.M.
  • 133

2 Answers2

14

The text inside a column of the tabular is padded, on both sides, with \tabcolsep. When we put @{}, this space is removed. See the following figure.

enter image description here

\documentclass{article}
\usepackage{lipsum}
\begin{document}
  With \verb|@{}| on both ends:

  \medskip

  \begin{tabular}{|@{}p{0.45\columnwidth}|p{0.45\columnwidth}@{}|}
   \lipsum[2]  & \lipsum*[2]
  \end{tabular}

  \bigskip
  Without \verb|@{}| on both ends:
  \medskip

  \begin{tabular}{|p{0.45\columnwidth}|p{0.45\columnwidth}|}
   \lipsum[2]  & \lipsum*[2]
   \end{tabular}

\end{document}

Hope this helps.

13

As Harish says, the @{} removes the inter-column space. The reason the syntax is as it is with {} is that the argument is text that is typeset between each cell. If you have a column specification of cc@{hello}cc then you have a 4 column table with the word hello instead of space between columns 2 and 3.

David Carlisle
  • 757,742