[Tex/LaTex] Lots of text in one table cell

formattinglongtabletables

I need to place lots of text in one table cell. I tried to use longtable, but it seems to work, say, only on a row basis and gives terrible result in case when one row isn't fit in a page.

Something like this

\documentclass {article}

\usepackage [utf8] {inputenc}
\usepackage [english] {babel}
\usepackage{lipsum}

\begin{document}

\clearpage
\section{My section}

\begin{longtable}{| c | p{3cm} | p{5cm} | p{3cm} |}
\hline
1   & 2
    & \lipsum 
    & 3 \\ \hline
\hline
\end{longtable}

\section{Another section}

\end{document}

gives a result close to this
longtable with long text in a cell

EDIT: If it is completely impossible to have a table with a cell like this, how would you suggest to layout such a data (that is without table-like environment). This is just an ordinary table with heading, specifying the meaning of each column (four of them). One column tend to have lots of text in its cells. That's it.

Best Answer

If only one column needs to break that can be on the main vertical list with the other columns treated as parboxes hung to the side:

\documentclass {article}

\usepackage [utf8] {inputenc}
\usepackage [latin] {babel}
\usepackage{lipsum}

\newenvironment{foo}[3]
{\list{}{\leftmargin6cm\rightmargin3cm
\itemindent0cm
\labelsep0pt
\labelwidth0cm}%
                \item[\rlap{\hspace{-6cm}\smash{%
\parbox[t]{2.9cm}{#1}%
\hspace{.2cm}%
\parbox[t]{2.9cm}{#2}%
\hspace{\dimexpr\textwidth-8.1cm}%
\parbox[t]{2.9cm}{#3}%
}}]}
 {\endlist}


\begin{document}

\clearpage
\section{My section}

\noindent X\dotfill X

\begin{foo}{1}{2}{3}
\lipsum
\end{foo}
\begin{foo}{11}{22}{33}
\lipsum
\end{foo}



\section{Another section}

\end{document}
Related Question