Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

There is some text and now I want to insert some pages containing a longtable. How can I achieve this goal?

To state my question clearly, I want

(Main text A)

-----------page break----------

longtable begins

-----------page break----------

longtable ends
(And although here is some space for text, but just leave it blank.)

-----------page break----------

(Main text A continues ...)

If I simply use longtable under Main text A, the table will adjoin it; if I add a \newpage under Main text A, there will be some unpleasant blank under Main text A -- furthermore, other floating objects still annoyingly break the long table.

So how to make longtable occupy its own standalone pages? Thank you for your help!

EDIT

I've tried to put the long table in a standalone tex file and \include{} it in the expected place. It works fine partly: the longtable now can have its standalone pages perfectly, however, there's still some unpleasant blank under Main text A.

PS: I have to sleep now. Thanks for any possible help. I will check them tomorrow :)

share|improve this question

1 Answer 1

up vote 5 down vote accepted

The afterpage package and its command \afterpage may be your friend. As the command's name suggests, its main (only?) use is to defer the execution of some code block until after the end of the current page.

(Main text A)

\afterpage{% defer execution of the followng material until start of next page

longtable begins
--- page break ---
longtable continues
--- page break ---
longtable ends

\clearpage % omit if you want the material from the main text to continue on this page
} % end of afterpage material

(Main text A continues ...)
share|improve this answer
2  
If the table is really big (or long:) it's probably better to stick it in a file and use \afterpage{\clearpage\input{file}} (the clearpage is just to stop any pending floats landing on the same page). –  David Carlisle Oct 9 '13 at 16:19
    
@DavidCarlisle It works like a charm! Thank you all :D –  Stan Oct 10 '13 at 1:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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