How to force long lines to automatically split into several to fit on the page? [duplicate]

Intro

I have a list of elements in a tabular, where some elements of the last (3rd) column sometimes are long enough to overpass the width of the page. It is quite boring to have to go line by line and adjust accordingly.

For example one line of my tabular might be:

First column & second column & my long, way too long third column that overpass the width of the page.\\


and here is what I do to solve this issue

First column & second column & my long, way too long third column\\
& & that overpass the width of the page.\\


Question

Is there a solution to set the width of the page (indicating the page is an A4 for example) to the whole tabular, so that LaTex does the trick automatically. We might eventually have to indicate whether we want the line break to occur in the middle of the words or only at spaces or only after comas.

• Try the tabularx package. – Arash Esbati Jun 23 '15 at 17:09

\begin{table}[ht]
\as{1.3}
\caption{xxxxxx}
\label{tabAtklst}
\centering
\begin{tabular}{l p{7cm}}
\toprule
\textbf{DoS} & \parbox[t]{7cm}{Your text here}}\\ \hline

\end{tabular}
\end{table}


This worked for me.

• Since the second column is set to have type p, it shouldn't be necessary to specify a \parbox to contain the cell's contents, right? Incidentally, what does the \as macro do? – Mico Jun 23 '15 at 18:07