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.

After some trouble I have managed to make a table in landscape orientation that breaks over three pages. I used tabularx and the landscape package. Now my problem is that the thing won't float like normal but instead breaks the text where it is, causing a premature page break. I have tried using sidewaystable and hvfloat but can't get it to work (are they incompatible with tabularx? Any help appreciated.

share|improve this question
    
Welcome to TeX.SX! You don't need to sign with your name, as it will automatically appear in the lower right corner of your post. Please add a fully compilable minimal working example (MWE) that illustrates your problem. Also you may want to try the longtable package. –  canaaerus Aug 1 '12 at 5:41
add comment

1 Answer

If I understand correctly the description of the problem, you (i) have some material of the form

% lots of material
\begin{landscape}
\begin{longtable}{...}
% content of longtable
\end{longtable}
\end{landscape}
% lots more material

and (ii) don't want (pdf)LaTeX to create a page break immediately upon encountering the \begin{landscape} instruction. Instead, you want LaTeX to defer switching to landscape mode until the current page is filled up by typesetting some of the "lots more material" group.

If this interpretation is correct, you may want to take a look at the instruction \afterpage. All you would need to do is to load the afterpage package (in the preamble) and encase the entire landscape group (which, in this case, contains a longtable environment) in an \afterpage{...} instruction. As the instruction's name suggests, LaTeX defers the typesetting of the material in its argument until the current page comes to an end by some other means (most likely because some additional material is being typeset, causing a natural page break at some point).

Note that it is very important to remember to use a right curly brace, }, to mark the end of the material that forms the argument of the \afterpage instruction. (If you forget the }, LaTeX will keep running until it encounters \end{document} and then issue one of its cryptic error messages.) In an answer to a related question that was posted recently, David Carlisle has suggested doing the following to simplify the process of making sure not to forget the closing curly brace: Place the entire landscape-longtable material in a separate file, say landlong.tex, and then issue the instruction

\afterpage{\input landlong} 

in the main file. That way, one is almost surely not going to forget that pesky right curly brace, right?

share|improve this answer
add comment

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.