Document 526

The LaTeX tabularx package

Version: 3.x, 4.x, 5.x - Scientific WorkPlace & Scientific Word

The tabularx package defines a tabular environment that generates a table with a specified width. The package automatically adjusts the widths of certain columns rather than adding space between columns. The basic command is similar to the standard LaTeX \tabular* command; please refer to the package documentation for complete instructions and to LaTeX sources for further information about using commands of this type.

How to create a tabular environment of a specified width

  1. Add the tabularx package to your document.
  2. Enter an encapsulated TeX field.
  3. Type \begin{tabularx}{w}{|X|X . . .|} where w is the desired width of the table and X marks each column for which the width is to be adjusted.
  4. Type the commands for the remainder of entire tabularx environment.
  5. Type \end{tabularx} and choose OK.

The single package option involves debugging. The package is installed in the TCITeX/TeX/LaTeX/required/tools directory as part of the Standard LaTeX Tools Bundle.

For example, to create a table that is overall four inches wide with the width of the second and fourth columns set automatically, the following would be the contents of the encapsulated TeX field:

\begin{tabularx}{4in}{|c|X|c|X|}
\hline
\multicolumn{2}{|c|}{Multicolumn entry!}&
THREE&
FOUR\\
\hline
one&
\arraybackslash The width of this column depends on the
overall width of the table.&
three&
\arraybackslash Column four will act in the same way as
column two, with the same width.\\
\hline
\end{tabularx}

Last revised 07/29/10

This document was created with Scientific WorkPlace.