21

I want to use the longtable environment for a table. However, I do not know how to place it at the top of the next page, as I can do with the table environment. Do you know how to do it?

1
  • Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question.
    – Werner
    Commented May 8, 2013 at 14:09

1 Answer 1

21

You could use the afterpage package and its command \afterpage to defer typesetting of the longtable environment to the top of the next page.

\documentclass{article} % or whatever document class you use
... % rest of preamble
\usepackage{afterpage}  % load the afterpage package
\usepackage{longtable}  % load the longtable package
\begin{document}
... % stuff
\afterpage{%
   % Contents of "longtable" environment:
   \begin{longtable}
   ...
   \end{longtable}
}% end of scope of afterpage directive 
... % remainder of document
\end{document}
5
  • afterpage always renders the table in the next page. table environment behave a little bit different as it a a float environemt. As the major difference between a longtable and a table is the spacing. Therefore, I found another solution to make a table look like a longtable: add the command \renewcommand{\arraystretch}{1.5} inside the table environment. Commented May 23, 2013 at 21:42
  • @AnCongTran - Thanks for providing this clarification. I had gone by the question in the original posting, viz., how to place [a longtable environment] at the top of the page. I see now that you want to make a table (and its tabular environment, right?) look like a longtable.
    – Mico
    Commented May 24, 2013 at 0:16
  • 2
    I have the opposite problem: my longtable starts at the top of the next page, but I want to start it straight away. What is the opposite of \afterpage?
    – Chris Peh
    Commented Jun 5, 2020 at 6:16
  • @ChrisPeh - How close are you to the bottom of the page when the longtable environment starts? How large is the longtable's header, i.e., how many rows does it have?
    – Mico
    Commented Jun 5, 2020 at 8:02
  • @Mico: Thanks for your clarifying questions. No header, but a list of options - therefore table format. I tried it at top of page (where it leaves a page blank, but takes the /subsection with it), then 3 lines of text down: Where it jumps to the next page after the /subsection, leaving 5/6 of the page blank. (I since found out that it does that when the first row is more than a quarter of the page (would still fit), because when I delete the first option, it doesn't do it...
    – Chris Peh
    Commented Jun 7, 2020 at 6:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .