Hi. I'm rather new to LaTeX so pardon me if my posts seem rather naive..
I'm writing a paper which has long and wide tables (of numerical results). I used the longtable and pdflscape packages, to make my multi-page wide tables. Everything about the table works well, but the main text does not flow around the two landscape-pages on which the table appears. That is, in my .tex file, I have some text (blah blah blah-1), then the table, and then I have some text (blah blah blah-2) after the table. I do not intend for the (blah blah blah-2) to necessarily come after the table in the paper. I do not mind whether it comes before or after the table. I would like LaTeX to typeset it nicely as appropriate. My problem though is that the text does not get typeset properly. The landscaped-longtable seems to cause a page break exactly where it is placed, and any text that comes after the landscaped-longtable gets put after the longtable in the typesetted text.
Is there a way for me to be able to make the text flow around the longtable, or am I doomed to have to manually try to fit in my text so that I do not end up with ugly big empty spaces before the landcsaped-longtable in my final typesetted paper ?
I would really appreciate any advice, comments, suggestions, anything ! By the way, I'm using TeXShop on a Mac.
Thanks !
Document Classes ⇒ Text does not flow around a landscape-oriented longtable
NEW: TikZ book now 40% off at Amazon.com for a short time.
Text does not flow around a landscape-oriented longtable
Try this minimal example:
The \lipsum command produces blind text. As you can see, the text written by the \lipsum command after the table flows to the first page. The trick is the use of the \afterpage command, which delays the execution of the code included in its mandatory argument until the corresponding page is completed.
Code: Select all
\documentclass{article}
\usepackage{array,longtable,lipsum,afterpage,pdflscape}
\begin{document}
\lipsum[1]
\afterpage{
\begin{landscape}
\begin{longtable}{|c|>{\raggedright}p{0.7\linewidth}|}
\hline
A & \lipsum[1] \tabularnewline \hline
B & \lipsum[2] \tabularnewline \hline
C & \lipsum[3] \tabularnewline \hline
D & \lipsum[4] \tabularnewline \hline
\end{longtable}
\end{landscape}
}
\lipsum[2-8]
\end{document}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.