22

I'm writing some sort of book and i've got a very large table.

I was wondering if there was a way to span a table not in the length but in the width.

In the end, i would like to be able to divide the table in two parts such that once the book is printed, it would be possible to follow a line through 2 pages.

Is there a way or a package to do that ?

Thanks !

Caramdir
  • 89,023
  • 26
  • 255
  • 291

3 Answers3

13

I don't think there's an automatic way to do this, but, if your table has fixed height rows, you can split it into two tables and use the dpfloat package to pair the two tables on adjacent pages.

Example:

\documentclass{article}
\usepackage{dpfloat, booktabs}
\begin{document}
\begin{table}[p]
\begin{leftfullpage}
\begin{tabular}{llllll}

\toprule
1 & 2 & 3 & 4 & 5 & 6 \\
\midrule
0.598064154 & 0.339685582 & 0.19396861 & 0.213309634 & 0.075210499 & 0.332646254 \\
0.078241148 & 0.792167857 & 0.219108081 & 0.201291187 & 0.431479589 & 0.667717852 \\
0.469795242 & 0.33942751 & 0.420695486 & 0.82740107 & 0.738145761 & 0.031280146 \\
0.753119695 & 0.951982884 & 0.785708805 & 0.818329289 & 0.359288584 & 0.290605686 \\
0.803870396 & 0.731847731 & 0.899035306 & 0.8203372 & 0.762518297 & 0.025427827 \\

\bottomrule
\end{tabular}

\end{leftfullpage}
\end{table}
\begin{table}[p]
\begin{fullpage}
\begin{tabular}{llllll}

\toprule
7 & 8 & 9 & 10 & 11 & 12 \\
\midrule
0.060659362 & 0.594518703 & 0.735081007 & 1.735081007 & 2.735081007 & 3.735081007 \\
0.494861845 & 0.452771499 & 0.6161709 & 1.6161709 & 2.6161709 & 3.6161709 \\
0.685467538 & 0.929017242 & 0.866804413 & 1.866804413 & 2.866804413 & 3.866804413 \\
0.557379459 & 0.670159594 & 0.252399841 & 1.252399841 & 2.252399841 & 3.252399841 \\
0.303340706 & 0.958921469 & 0.339461931 & 1.339461931 & 2.339461931 & 3.339461931 \\

\bottomrule
\end{tabular}

\end{fullpage}
\end{table}
\end{document}

The big downside with this solution is that if you have columns in which the lines wrap in one table, you will need to manually add struts in the corresponding rows of the other table to make them line up.

It also restricts you to having the split table on pages by themselves; you can't split a table across just the top part of two pages, for example.

David Carlisle
  • 757,742
Alan Munn
  • 218,180
11

only possible with ConTeXt, with LaTeX it is some kind of handy craft ... The code for context mkiv of Alans example:

\starttext
\setuplinetable[width=.19\textwidth]

\startlinetable
\NC 1           \NC2           \NC3           \NC4           \NC5           \NC6 
\NC7            \NC 8          \NC9           \NC10          \NC11          \NC12 \NR
\NC 0.598064154 \NC0.339685582 \NC0.19396861  \NC0.213309634 \NC0.075210499 \NC0.332646254 
\NC 0.078241148 \NC0.792167857 \NC0.219108081 \NC0.201291187 \NC0.431479589 \NC0.667717852 \NR
\NC 0.469795242 \NC0.33942751  \NC0.420695486 \NC0.82740107  \NC0.738145761 \NC0.031280146 
\NC 0.753119695 \NC0.951982884 \NC0.785708805 \NC0.818329289 \NC0.359288584 \NC0.290605686 \NR
\NC 0.803870396 \NC0.731847731 \NC0.899035306 \NC0.8203372   \NC0.762518297 \NC0.025427827 
\NC 0.060659362 \NC0.594518703 \NC0.735081007 \NC1.735081007 \NC2.735081007 \NC3.735081007 \NR
\NC 0.494861845 \NC0.452771499 \NC0.6161709   \NC1.6161709   \NC2.6161709   \NC3.6161709 
\NC 0.685467538 \NC0.929017242 \NC0.866804413 \NC1.866804413 \NC2.866804413 \NC3.866804413 \NR
\NC 0.557379459 \NC0.670159594 \NC0.252399841 \NC1.252399841 \NC2.252399841 \NC3.252399841 
\NC 0.303340706 \NC0.958921469 \NC0.339461931 \NC1.339461931 \NC2.339461931 \NC3.339461931 \NR
\stoplinetable

\stoptext

And here the output of the two pages 1 and 2 alt text

-2

Everyone's answers seem way too convoluted... how about the longtable package? It breaks over pages automatically, you just set it up like a normal table and it takes care of everything for you.

Andrew
  • 1,514
  • 1
    it breaks the tabular vertically but not in horizontal direction. –  Jan 14 '11 at 20:53
  • @Herbert - gah, I've been lied to. Well, in that case, you could rotate the table contents by 90°, then rotate the table itself 90° back... if you were masochistic, anyway. – Andrew Jan 14 '11 at 21:04
  • 1
    I was tempted to do it this way, but was hoping for a ... cleaner solution. – Thomas Schwery Jan 15 '11 at 11:36