The tabulary package

Sets a table to a target width and gives each L, C, R or J column a width in proportion to the amount of text in it.

Loading the package

\usepackage{tabulary}

tabularx gives all X columns the same width, which wastes space when one column holds sentences and another single words. tabulary measures the natural width of each column and divides the target width in that proportion, so the column with the most text gets the most room.

The capital letters mark the columns that are balanced and wrapped: L left-aligned, C centred, R right-aligned, J justified. The lowercase l, c, r and p{...} keep their usual meaning. The package loads array.

Main commands

\begin{tabulary}{\textwidth}{lLLr} ... \end{tabulary}Table with a target width; the two L columns share the space by content.
L, C, R, JBalanced columns: left-aligned, centred, right-aligned, justified.
\setlength{\tymin}{1.5cm}Smallest width a balanced column may get; the default is 10 pt.
\setlength{\tymax}{8cm}Upper limit for the natural width that counts in the calculation, so one long cell does not take all the space.

Complete example

\documentclass{article}
\usepackage{tabulary}
\usepackage{booktabs}
\begin{document}
\noindent
\begin{tabulary}{\textwidth}{l L L r}
\toprule
Step & What happens & Remark & Minutes \\
\midrule
Mix  & Stir flour, water, yeast and salt until no dry flour is
       left, then cover the bowl and let the dough rest. & Use
       lukewarm water. & 15 \\
Bake & Put the loaf into the hot oven. & Do not open the door
       early. & 40 \\
\bottomrule
\end{tabulary}
\end{document}
Result
The compiled example

Open in the editor

Compiled with pdfLaTeX from TeX Live 2023.

Pitfalls

Related pages