StartLaTeX faqLaTeX for Beginners F.A.Q.LaTeX topicsLaTeX courseSearch

tabularx is a package that offers users the flexibility to specify tables with fixed widths, as well as introducing a new table type called X-columns. These X-columns are left-aligned with automatic line breaks within the column, a feature not available in standard table environments. Additionally, tabularx allows for the use of footnotes within tables, which is not possible in regular table environments.

The package introduces a new environment named tabularx, mirroring its name. The structure of this environment closely resembles that of a regular table environment, with the added requirement of specifying the table width. The width can be specified as a relative measure, such as 0.8 times the text width (80% of the text width), or as an absolute measure, such as 6 cm.

In addition to the usual left-aligned (l), right-aligned (r), and centered (c) columns, tabularx introduces a new column type denoted by the uppercase letter X, representing a dynamically sized, left-aligned column with automatic line breaks.

Here's an example illustrating the usage of tabularx:


    Column 1 & Column 2 \\
    A & This is a lot of meaningless text that demonstrates automatic line wrapping \\
    B & Another meaningless text that fills the column \\


We begin with the document class declaration (\documentclass{article}) and include the tabularx package with \usepackage{tabularx}.

Within the document environment, we use the tabularx environment to create a table. The syntax for the tabularx environment is similar to the tabular environment, but it allows for automatic line wrapping in specified columns.

In the example, we specify the width of the table to be 80% of the text width using the 0.8\textwidth argument.

The table has two columns, specified as {lX} in the \begin{tabularx} command. The first column (l) is left-aligned, while the second column (X) is a paragraph column (also left-aligned) that automatically wraps text.

Within the tabularx environment, we use \hline to draw horizontal lines between rows of the table.

The table content consists of two rows. In the first row, "Column 1" and "Column 2" are the headers for the respective columns. In the second row, we have "A" in the first column and a long text in the second column to demonstrate automatic line wrapping. Similarly, the third row contains "B" in the first column and another long text in the second column.

Finally, we end the tabularx environment and the document with \end{tabularx} and \end{document}, respectively.

Furthermore, tabularx allows for tables composed entirely of X-columns, enabling the creation of tables where the content is distributed evenly across multiple columns.

It's important to note that X-columns are left-aligned by default, and the use of the \verb|\| command within tabularx tables is only partially supported.

Additionally, the package offers the option infoshow, which provides insights into how the space allocation within the table occurs. When this option is enabled, the package generates log files showcasing the calculation of column widths.

Moreover, in a similar vein to tabularx, overlong tables can be set using LTX-Table.

Contact   Privacy Policy   disclosures

accept decline

This website uses cookies and pixel tags to ensure you get the best experience on our website. By using this website, you consent to the use of cookies.learn more about cookies see also our privacy policy