I would like to spread my vertical table over multiple pages.
I tried it with sidewaystable
and longtable
, but that put everything on one page. Another idea would be just to create x tables, where x stands for the number of needed pages. That would work, but I would like to have a more convenient solution. Is there any?
\documentclass[11pt,paper=a4,]{scrbook}
\usepackage{longtable}
\usepackage{rotating}
\begin{document}
\begin{sidewaystable}
\begin{longtable}[c]{|p{5cm}|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \\
\hline
\end{longtable}
\end{sidewaystable}
\end{document}
Best Answer
The
sidewaystable
environment does not let you split its contents across multiple pages. Since you're using alongtable
environment, which has its own\caption
commands, etc., there's no real need to embed it in asidewaystable
environment anyway. Instead, consider loading thepdflscape
package and using that package'slandscape
environment to rotate the material by 90 degrees.Addendum to address a comment by @pauljohn32: If the
longtable
andpdflscape
packages are loaded and if a halfway-competent pdf viewer is in use, thelandscape
/longtable
combination (a) rotates the tabular material 90 degrees counterclockwise to landscape format and (b) ensures that the onscreen display of the pages with the tabular material is also rotated, so that readers don't have to crane their necks in order to take in the tabular information. However, this combination does not make the pages into "landscape pages"; i.e., the header and footer lines are still placed where they'd go in portrait mode. In the following screenshot, I've highlighted the MWE's header and footer lines in yellow to demonstrate this fact. (Of course, what exactly is placed on the header and footer lines depends on factors such as the document class in use. However, that's a separate issue, isn't it?)