Generaltable spanning two pages in portrait format

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
greengrass
Posts: 12
Joined: Sun Oct 26, 2008 1:22 am

table spanning two pages in portrait format

Post by greengrass »

Is it possible to have a table span 2 pages in portrait format? i.e. if I have a table with 10 columns, can I have 5 columns on the left hand page and 5 columns on the right hand page, in a continuous fashion so that their row heights would match up?
Last edited by greengrass on Mon Oct 27, 2008 1:12 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

table spanning two pages in portrait format

Post by localghost »

Have a look at the longtable package.


Best regards
Thorsten¹
greengrass
Posts: 12
Joined: Sun Oct 26, 2008 1:22 am

Re: table spanning two pages in protrait format

Post by greengrass »

I am actually using the longtable package, but I don't think it allows for a column-wise split across pages (I'll be really happy if it actually does as that's exactly what I need!!) As I understand, it allows a row-wise split, e.g. a table of 15 rows can have 10 rows on one page and the remaining 5 rows on the next, in either landscape or portrait.
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

table spanning two pages in portrait format

Post by Juanjo »

I've had an idea that perhaps may work. It is not an automatic, nor elegant solution, but, well, see if it may help. The idea basically consists in storing the whole table in a box and then printing it two times, cropping, in order, the right and the left parts with the help of Tikz/pgf:

Code: Select all

\documentclass{article}

\usepackage{booktabs}
\usepackage{tikz}
\usepackage{caption}

\begin{document}

% New box register where the whole table will be stored
\newsavebox{\MyBox}

% Store the table
\begin{lrbox}{\MyBox}
\Large
\begin{tabular}{ccccc}
   \toprule
   AAAAAAAAAA & BBBBBBBBBB & CCCCCCCCCC & DDDDDDDDDD & EEEEEEEEEE \\
   aaaaaaaaaa & bbbbbbbbbb & cccccccccc & dddddddddd & eeeeeeeeee \\
   AAAAAAAAAA & BBBBBBBBBB & CCCCCCCCCC & DDDDDDDDDD & EEEEEEEEEE \\
   aaaaaaaaaa & bbbbbbbbbb & cccccccccc & dddddddddd & eeeeeeeeee \\
   \midrule
   AAAAAAAAAA & BBBBBBBBBB & CCCCCCCCCC & DDDDDDDDDD & EEEEEEEEEE \\
   aaaaaaaaaa & bbbbbbbbbb & cccccccccc & dddddddddd & eeeeeeeeee \\
   AAAAAAAAAA & BBBBBBBBBB & CCCCCCCCCC & DDDDDDDDDD & EEEEEEEEEE \\
   aaaaaaaaaa & bbbbbbbbbb & cccccccccc & dddddddddd & eeeeeeeeee \\
   \midrule
   AAAAAAAAAA & BBBBBBBBBB & CCCCCCCCCC & DDDDDDDDDD & EEEEEEEEEE \\
   aaaaaaaaaa & bbbbbbbbbb & cccccccccc & dddddddddd & eeeeeeeeee \\
   AAAAAAAAAA & BBBBBBBBBB & CCCCCCCCCC & DDDDDDDDDD & EEEEEEEEEE \\
   aaaaaaaaaa & bbbbbbbbbb & cccccccccc & dddddddddd & eeeeeeeeee \\
   \bottomrule
\end{tabular}
\end{lrbox}

% This shows the complete table, scaled down
\scalebox{0.6}{\usebox{\MyBox}}

% Coefficient between 0 and 1 which determines the ratio between
% the left and  right parts of the table
\newcommand{\Coefficient}{0.6}

% Left part
\begin{table}[p]
   \centering
   \begin{tikzpicture}
      \clip (0,-\dp\MyBox) rectangle (\Coefficient\wd\MyBox,\ht\MyBox);
      \pgftext[left,base]{\usebox{\MyBox}};
   \end{tikzpicture}
   \caption{An example of wide table}
\end{table}

% Right part
\begin{table}
   \ContinuedFloat
   \centering
   \begin{tikzpicture}
      \clip (\Coefficient\wd\MyBox,-\dp\MyBox) rectangle (\wd\MyBox,\ht\MyBox);
      \pgftext[left,base]{\usebox{\MyBox}};
   \end{tikzpicture}
   \caption{An example of wide table (cont.)}
\end{table}

\end{document}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Post Reply