[texhax] difference between tabular and tabularx?
Herbert Voss
LaTeX at zedat.fu-berlin.de
Thu Apr 13 23:04:26 CEST 2006
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}
Herbert
More information about the texhax
mailing list