# latex how to make table as the same width as the textwidth?

I have used \begin{tabularx} or \begin{tabular*} but neither of these two work, these two environment managed to increase the width of the table as the same as the text, while they cannot let the column contents inside the table increased associated with the table width.

-
You query is somehow confusing: the title asks for tables with a given width, but the description of the problem mentions column width. Can you please describe clearly and in more detail your intent? –  Gonzalo Medina Jun 8 '11 at 1:36

The tabular* environment is able only to act on the intercolumn space, while tabularx can decide the width of the columns via the column specifier X. If one uses the latter environment without X columns, no automatic enlargement will happen.

Suppose you have three columns, with the first listing the items, the second with descriptions and the third with comments; we want that the latter two enlarge proportionally to the desired table width

\usepackage{tabularx,booktabs}
...

\begin{tabularx}{\textwidth}{l X X}
\toprule
Item & Description & Comments \\
\midrule
Item 1 &
this is the description of item 1 &
these are the comments on item 1 \\
Item 2 &
this is the description of item 2 &
these are the comments on item 2 \\
...
\bottomrule
\end{tabularx}


(I've used the rules provided by the booktabs package). Put the environment inside a table environment with \centering and you're done. It's also possible to have X columns of different width, a method is explained in the manual of tabularx. There's also the tabu package, that should be able to manage this kind of tables.

-

I assume you mean the \tabskip-glue (example in plain-format):

\halign{\tabskip1em plus .2\hsize#\hfil&#\hfil&\tabskip0pt #\hfil\cr
A testing&table&with\cr Some&content&booyah\cr}
\smallskip\hrule\smallskip
\halign to \hsize{\tabskip1em plus .2\hsize#\hfil&#\hfil&\tabskip0pt #\hfil\cr
A testing&table&with\cr Some&content&booyah\cr}
\smallskip\hrule\smallskip
\halign to .5\hsize{\tabskip1em plus .2\hsize#\hfil&#\hfil&\tabskip0pt #\hfil\cr
A testing&table&with\cr Some&content&booyah\cr}
\bye


As you see, the only thing changing is the width of the \halign. The tabskip glues positive stretchability makes it possible for the columns to spread out to accommodate the available space.

-