# How can I have a tabular flush with the margins? [duplicate]

Consider the following:

\documentclass{article}

\setlength\parindent{0pt}

\begin{document}
content \hfill content

\begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}r}
one   & two \\
three & four
\end{tabular*}

content \hfill content
\end{document}


How can I remove the whitespace at either side of the tabular?

## marked as duplicate by user11232, Jesse, Guido, karlkoeller, Martin SchröderJan 8 '14 at 7:32

• Of course I find the problem as soon as I guts up and post: while I'm not specifying to display them, LaTeX is leaving room for separator lines. Adding \setlength{\tabcolsep}{0pt} solves this issue. ('Doh!) – Sean Allred Jan 8 '14 at 6:07
• While it won't make a difference in the present case, it's better in general to insert @{} in front of the first column and after the final column to eliminate the extra whitespace. I.e., one would write something like \begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}r@{}}. One reason this it better is because it works with all other tabular-type environments, viz., tabular, tabularx, tabulary, etc. – Mico Jan 8 '14 at 6:28
• @Mico Your right. Sounds like an answer (before the potential closing I started…) :-) – Sean Allred Jan 8 '14 at 6:39
• Related/duplicate: Column and row padding in tables – Werner Jan 8 '14 at 7:01

While \setlength{\tabcolsep}{0pt} will do the job in your example, it's better in general to insert @{} in front of the first column and after the final column to eliminate the whitespace (in the amount of \tabcolsep) that LaTeX inserts by default in these locations.

For the case of your example, you'd write

\begin{tabular*}{\textwidth}{@{} l @{\extracolsep{\fill}} r @{}}


\setlength{\tabcolsep}{0pt}

The approach based on inserting @{} particles is better because it works not only with tabular* but also with tabular, tabularx, tabulary, and so on.