# Tabularx “auto” width?

I would like to create a table whose width should be the minimum possible (lines don't wrap). I see that tabularx wants a width parameter, is it possible to specify something like "auto", instead, for example, of \linewidth?

• that is done by a simple tabular environment – user2478 Sep 11 '12 at 13:42
• @Herbert I guess that should be made the answer:-) – David Carlisle Dec 13 '12 at 0:18
• Do you need to use tabularx or are you fine with some other table? – Mayou36 May 31 '17 at 19:03

You don't need tabularx for your specifications. tabular is enough here.

\begin{tabular}{l r c}
foo & bar & and so on
\end{tabular}


is a tabular with a minimum width and default column separation width

\begin{tabular}{@{} l r c @{}}
foo & bar & and so on
\end{tabular}


is a tabular with no column separation on the left and right

{\setlength\tabcolsep{0pt}%
\begin{tabular}{l r c}
foo & bar & and so on
\end{tabular}}


is a tabular with no column separation anyway

\begin{tabular}{l @{} r c }
foo & bar & and so on
\end{tabular}


is a tabular with no column separation between the first and second column

\begin{tabular}{l @{\hspace{5mm}} r c }
foo & bar & and so on
\end{tabular}


is a tabular with a column separation of 5mm between the first and second column

• The question was about tabularx. You used tabular. – buhtz Dec 11 '16 at 10:58
• Sure, but there is no need for a tabularx for what the original poster asked for! – user2478 Dec 11 '16 at 14:10
• You don't know what he wants. You only know he wants a tabularx, but everything else is unknown. Let's pretend the OP is clever and knows why he wants to use a tabularx but on the other hand does not spam us with all the reasons he needs one and only asks one specific question. Which you unfortunately failed to answer. – Mayou36 May 31 '17 at 16:08
• @Mayou36: You should read the question, then you know what he/she wants ... – user2478 May 31 '17 at 16:18
• @Herbert, I agree that his first sentence seems to be general. But on one hand, he asks for a possible argument and on the other hand, the title says it all... But to be sure, I just asked the OP ;) – Mayou36 May 31 '17 at 19:06