# Fixed width table with variable width columns [duplicate]

What I'm trying to achieve is a fixed width (full width of the page or column) table with variable column widths. Here's what I've got:

\usepackage{tabulary}

% Table Environment
\newenvironment{dndcustomtable}[1]{
\vspace*{8pt}
\fontfamily{lmss}\selectfont %Select font
\rowcolors{1}{bgtan}{commentgreen} % Alternate colors
\noindent\tabulary{\textwidth}{#1}
}
{
\endtabulary
\vspace{8pt plus 1pt}
\noindent
}

% Usage
\begin{dndcustomtable}{LLL}
lorem ipsum &   foo bar &   baz \\
lorem ipsum lorem ipsum &   foo bar &   baz \\
lorem ipsum &   foo bar &   baz \\
lorem ipsum &   foo bar lorem ipsum&    baz \\
\end{dndcustomtable}


What I'm getting:

Desired Result:

Any ideas?

• Use tabularx for that. B.t.w., use \linewidth rather than \textwidth, they may be different, and usually, it's the former one wants. May 7 '16 at 17:49
• the \noindent at the end of the environment looks very odd and will produce spurious results if you have a blank line in the source after the table. May 7 '16 at 19:10