1

Consider the code

\documentclass{report}
\usepackage[margin=2cm,showframe]{geometry}
\usepackage{longtable}
\usepackage{lipsum}

\begin{document}
\lipsum[1-2]
\begin{longtable}{p{8cm}}
\lipsum[3-5]
\end{longtable}
\lipsum[1-2]
\end{document}

producing

enter image description here

OK, no problem since the contents of the table is not enough to make the table pass to the next page.

So, inserting more dummy text inside the table (\lipsum[3-8] for example), we obtain

enter image description here

Why the result is not the derided one? Also, how to no indent the longtable, that is, how to flush it left?

  • 1
    The second question: use the optional argument: \begin{longtable}[l]{p{8cm}} or \begin{longtable}[r]{p{8cm}}. – Gonzalo Medina Feb 14 '14 at 19:39
  • @GonzaloMedina, thanks. So easy. How couldn't imagined it? – Sigur Feb 14 '14 at 19:41
  • It's longtable users, not longtable, that have strange behaviour. – David Carlisle Feb 14 '14 at 20:42
  • Well, after the explanation and the solution I have to agree with you, @DavidCarlisle. lol – Sigur Feb 14 '14 at 20:57
4
  1. LaTeX will never break a page within a p{<length>} row. Page breaks only occur between rows of the table or at \hline commands. In the seemingly odd case you mention with \lipsum[3-8], what happens is that all your six paragraphs are in the same row of the p{8cm} column, so no page break will be produced; the whole table gets pushed to the second page and typeset there, protruding to the bottom.

  2. Use the optional argument: \begin{longtable}[l]{p{8cm}} or \begin{longtable}[r]{p{8cm}}.

An example:

\documentclass{report}
\usepackage[margin=2cm,showframe]{geometry}
\usepackage{longtable}
\usepackage{lipsum}

\begin{document}
\lipsum[1-2]
\begin{longtable}[l]{p{8cm}}
\lipsum[3-5]
\end{longtable}
\lipsum[1-2]
\end{document}

enter image description here

  • So, the problem is that each paragraph coming from lipsum is p{} and then will not be broken? – Sigur Feb 14 '14 at 19:42
  • The problem is that all your paragraphs are inside one same p{...} row. – Gonzalo Medina Feb 14 '14 at 19:43
  • Ow, I see. I'm not using `\` to change line. So, the ideal in this case would be to use another kind of box, not long table. – Sigur Feb 14 '14 at 19:44
  • 1
    @Sigur A list or a mdframed or tcolorbox, perhaps? It depends on what you are trying to achieve. – Gonzalo Medina Feb 14 '14 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.