1

Consider this example:

\documentclass{report}
\usepackage{lipsum}
\begin{document}
\begin{tabular}{lll}
  A & B & \lipsum[1][1-3]
\end{tabular}
\end{document}

In the output: enter image description here

the last column goes out of the bounds of the page. I could constrain the last column by using\begin{tabular}{llp{3cm}}. However, it would be more convenient to make the table span textwidth automatically. How to do it?

Viesturs
  • 7,895

1 Answers1

1

with tabularx package is simple:

\documentclass{report}
\usepackage{tabularx}             % <---
\usepackage{lipsum}

\noindent
\begin{document}
\begin{tabularx}{\linewidth}{llX}  % table width is determined with \linewidth
                                   % at least one column had to be `X` type
  A & B & \lipsum[66]
\end{tabularx}

\noindent
\begin{tabularx}{\linewidth}{@{} llX @{}} % border \tabcolsep is suppressed
  A & B & \lipsum[66]
\end{tabularx}

\begin{table}[htb]                      % table is in float environment
\begin{tabularx}{\linewidth}{@{}llX@{}} % border \tabcolsep is suppressed
  A & B & \lipsum[66]
\end{tabularx}
\end{table}

\end{document}

enter image description here

Zarko
  • 296,517