Plain LaTeX tabular
Every column takes its space, the total width
of the table is the sum of the columns (plus inter-column space).
***%
\begin{tabular}{p{2cm}p{2cm}p{2cm}}
a a a a a a a a a a a a a a a
& b b b b b b b b b b b b b b b
& c c c c c c c c c c c c c c c
\end{tabular}%
***
Plain LaTeX tabular*
Every column takes its space, but the table will have a fixed
width to the outside.
If this width is too small (3cm
), then the following material will
overwrite the columns.
***%
\begin{tabular*}{3cm}{p{2cm}p{2cm}p{2cm}}
a a a a a a a a a a a a a a a
& b b b b b b b b b b b b b b b
& c c c c c c c c c c c c c c c
\end{tabular*}%
***
If this width is too wide (0.8\linewidth
), then the extra space will be to
the right of the table.
***%
\begin{tabular*}{0.8\textwidth}{p{2cm}p{2cm}p{2cm}}
a a a a a a a a a a a a a a a
& b b b b b b b b b b b b b b b
& c c c c c c c c c c c c c c c
\end{tabular*}%
***
It is possible to distribute the extra space between the
columns using \extracolsep
, but the columns keep their width.
***%
\begin{tabular*}{0.8\textwidth}{@{\extracolsep{\fill} }p{2cm}p{2cm}p{2cm}}
a a a a a a a a a a a a a a a
& b b b b b b b b b b b b b b b
& c c c c c c c c c c c c c c c
\end{tabular*}%
***
tabularx from the package with the same name
The table has a fixed width to the outside. The space not needed
by columns of fixed width is distributed evenly to the columns
of type X
.
\usepackage{tabularx}
...
***%
\begin{tabularx}{3cm}{XXX}
a a a a a a a a a a a a a a a
& b b b b b b b b b b b b b b b
& c c c c c c c c c c c c c c c
\end{tabularx}%
***
\usepackage{tabularx}
...
***%
\begin{tabularx}{0.8\textwidth}{XXX}
a a a a a a a a a a a a a a a
& b b b b b b b b b b b b b b b
& c c c c c c c c c c c c c c c
\end{tabularx}%
***
tabularx
andtabular*
as table-like environments that take as their first argument the intended width of the table.array
,table
,tabular
,tabularx
,longtable
,supertabular
,longtabu