[Tex/LaTex] Expand table columns proportionally to textwidth

fullwidthtableswidth

I have a simple table:

\begin{table}[h]
\begin{tabular}{|l|l|l|l|l|}
\hline
First entry & 2nd    & 3rd little longer & Forth & Fifth\\ \hline\hline
4.7\%  & 11.7\% & 2.5\%         & 80.5\%         & 0.7\%  \\ \hline
\end{tabular}
\caption{tabular}
\end{table}

I want it to use the whole page width by proportionally increasing the width of each column. So I do not want column widths to be spread equally; like this because the long line breaks:

\begin{table}[h]
\begin{tabu} to \textwidth {|*{5}{X[l]|}}
\hline
First entry & 2nd    & 3rd little longer & Forth & Fifth\\ \hline\hline
4.7\%  & 11.7\% & 2.5\%         & 80.5\%         & 0.7\%  \\ \hline
\end{tabu}
\caption{tabu}
\end{table}

Already tried tabulary but it only reduces the size of a table:

\begin{table}[h]
\begin{tabulary}{1.0\textwidth}{|l|l|l|l|l|}
\hline
First entry & 2nd    & 3rd little longer & Forth & Fifth\\ \hline\hline
4.7\%  & 11.7\% & 2.5\%         & 80.5\%         & 0.7\%  \\ \hline
\end{tabulary}
\caption{tabulary}
\end{table}

Here the output of a three samples (including a dummy text to see the page width):

enter image description here

Best Answer

With tabularx:

\documentclass{article}
\usepackage{tabularx}

\begin{document}
\begin{table}
\begin{tabularx}{\textwidth}{|*{2}{X|}l|*{2}{X|}}
\hline
First entry & 2nd    & 3rd little longer & Forth & Fifth\\ \hline\hline
4.7\%  & 11.7\% & 2.5\%         & 80.5\%         & 0.7\%  \\ \hline
\end{tabularx}
\caption{tabularx}
\noindent X\hrulefill X % just for showing text width
\end{table}
\end{document}

The longest column (3) is typeset with an l column. The remaining columns are evenly distributed among the remaining width by using X columns.

enter image description here

Related Question