LaTeX forum ⇒ Graphics, Figures & TablesWhy do people insert @{} in table preamble? Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
mado
Posts: 16
Joined: Thu Dec 10, 2015 5:55 am

Why do people insert @{} in table preamble?

Postby mado » Tue Jan 05, 2016 2:07 pm

It seems to make no difference in visual output. Why do people add @{}?

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 9194
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Tue Jan 05, 2016 6:31 pm

Hi mado,

@{code} stands for a command which inserts code between columns, also before the first column and after the last one. So you could insert a \hspace you like, a symbol, or nothing. {} means nothing, as the code is empty. The consequence is, that the default space between columns is removed. This can be desirable, for example to align left and right side of a table with a horizontal separation line.

Take a look:

  1. \documentclass{article}
  2. \begin{document}
  3. Text
  4. \begin{tabular}{ll}
  5. 1 & 2 \\
  6. 3 & 4
  7. \end{tabular}
  8. Text
  9.  
  10. \bigskip
  11.  
  12. Text
  13. \begin{tabular}{@{}l@{}l@{}}
  14. 1 & 2 \\
  15. 3 & 4
  16. \end{tabular}
  17. Text
  18. \end{document}


tabular1.png
tabular1.png (4.25 KiB) Viewed 2860 times


Or specifically using it for aligned margin:

  1. \documentclass{article}
  2. \pagestyle{empty}
  3. \begin{document}
  4. \begin{tabular}{lcr}
  5. One & Two & Three \\
  6. \hline
  7. yes & maybe & or no
  8. \end{tabular}
  9.  
  10. \bigskip
  11.  
  12. \begin{tabular}{@{}lcr@{}}
  13. One & Two & Three \\
  14. \hline
  15. yes & maybe & or no
  16. \end{tabular}
  17. \end{document}


tabular2.png
tabular2.png (7.35 KiB) Viewed 2860 times


Stefan
Site admin

mado
Posts: 16
Joined: Thu Dec 10, 2015 5:55 am

Postby mado » Wed Jan 06, 2016 1:42 am

Thanks. That clarifies things.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 8 guests