\begin{tabular*}{ \textwidth{l@{\extracolsep{\fill}}r} a & b \end{tabular*}

I need to fit a tabular to textwidth with zero left and right margins. The code above allows to fit the text to table width, but I don't know how to set the left and right margins to zero.

  • 1
    @{}l@{\extracolsep{\fill}}r@{} – Fran May 19 '20 at 8:12
  • 2
    Do you mean the whole page's margin, or just the table? – L. Nielsen May 19 '20 at 8:16
  • Thank you Fran and Nielsen. {\textwidth}{@{}l@{\extracolsep{\fill}}r@{}} is exactly what I wanted. – – ARUN KUMAR May 19 '20 at 12:26
\hline a&b\\\hline 

Of course, if the table is not in a float (a table environment) and \partindent is not 0pt (the default) as in this MWE, remember add \noindent before the tabular* environment to maintain it between the page margins.

If you refer to extend the table to the page margins, as L. Nielsen suspected, the trick is put the table in a centered box of zero space, and of course, make the table enough big:

\hline a&b\\\hline% 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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