[texhax] difference between tabular and tabularx?

Paul Tremblay phthenry at iglou.com
Sat Apr 15 20:36:18 CEST 2006


On Thu, Apr 13, 2006 at 11:04:26PM +0200, Herbert Voss wrote:
> 
> Paul Tremblay wrote:
> >Could someone explain the major differences between the tabular and
> >tabularx environments? I looked at the documentation for the memoir
> >class, but the examples and results seem so similar that I don't know
> >why I shouldn't just always use \tabular and \tabular*. 
> 
> \documentclass[12pt]{article}
> \usepackage{tabularx,array}
> \setlength\parindent{0pt}
> \begin{document}
> 
> \begin{tabular}{|l|l|}\hline
> first & second\\\hline
> \end{tabular}
> 
> \begin{tabular*}{\linewidth}{|l|@{\extracolsep{\fill}}l|}\hline
> first & second\\\hline
> \end{tabular*}
> 
> \vspace{1cm}
> \begin{tabularx}{\linewidth}{|l|X|}\hline
> first & second\\\hline
> \end{tabularx}
> 
> \begin{tabularx}{\linewidth}{|X|l|}\hline
> first & second\\\hline
> \end{tabularx}
> 
> \begin{tabularx}{.5\linewidth}{|l|X|}\hline
> first & second\\\hline
> \end{tabularx}
> 
> 
> \end{document}
> 
> 

Thanks.  Nothing like seeing an example to really make things clear.

Paul

-- 

************************
*Paul Tremblay         *
*phthenry at iglou.com    *
************************


More information about the texhax mailing list