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.

On an A5 document, I want to print a long table, split on several pages (using longtable I know) but I also need the 2 columns of that table to be on each side of the document:

  • left column on even pages, spanning several pages
  • right column on odd pages, spanning several pages

There is of course text before and after that table, or I wouldn't ask. Ideally, the table would be framed. And repeat the header of each columns (on it's page), but that should be easy with longtable.

This thing is to compare features of 2 different somethings, therefore I don't absolutely need perfectly aligned tables, the 2 columns can be itemized. And the repeated header could be replaced with repeated captions. But if so, the borders would become important.

I could imagine one 1 column table printed on even pages, and another 1 column table printe on odd pages, but they need to be "nested", facing each other in the A5 book.


Alternatively, if there is no solution to have a table span several pages laterally, is there a way to have text flow only on even pages, and some other text flow on odd pages, facing each other ? May-be defining 2 floats, one for even pages and one for odd pages, and each would overflow into the next even-or-odd page ?

The question could then be reframed like this: is it possible to have a float spanning several pages, but restricting it to only even (or odd) pages ?

I can make it by hand, with page-jumps, but if text is added, or the page-layout changed, it would screw all up (and this would defeat the whole LaTeX philosophy). I know that such things are possible with Scribus.

share|improve this question
    
Welcome to TeX.sx! A tip: You can use backticks ` to mark your inline code as I did in my edit. Also, you don't have to sign with your name since it automatically appears in the lower right corner of your post. –  Corentin Feb 8 '13 at 15:44
    
Alternatively, if there is no solution to have a table span several pages laterally, is there a way to have text flow only on even pages, and some other text flow on odd pages, facing each other ? May-be defining 2 floats, one for even pages and one for odd pages, and each would overflow into the next even-or-odd page ? The question could then be reframed like this: is it possible to have a float spanning several pages, but restricting it to only even (or odd) pages ? –  Zolko Feb 10 '13 at 1:23
add comment

1 Answer 1

enter image description here

\documentclass[a5paper,twoside]{article}

\textheight.5\textheight
\paperheight.7\paperheight
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth

\usepackage{array,longtable,color}

\makeatletter

\def\LT@output{%
  \ifnum\outputpenalty <-\@Mi
    \ifnum\outputpenalty > -\LT@end@pen
      \LT@err{floats and marginpars not allowed in a longtable}\@ehc
    \else
      \setbox\z@\vbox{\unvbox\@cclv}%
      \ifdim \ht\LT@lastfoot>\ht\LT@foot
        \dimen@\pagegoal
        \advance\dimen@-\ht\LT@lastfoot
        \ifdim\dimen@<\ht\z@
    \setbox\zzz\vbox{\moveleft10in\vbox{\unvcopy\@cclv\copy\LT@foot}\vss}%
    \setbox\@cclv\vbox{\vbox{\unvbox\@cclv\copy\LT@foot}\vss}%
    \@makecol
    \@outputpage
     \setbox\@cclv\box\zzz
    \@makecol
    \@outputpage
          \setbox\z@\vbox{\box\LT@head}%
        \fi
      \fi
      \global\@colroom\@colht
      \global\vsize\@colht
%      \vbox
%      {\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}%
    \fi
  \else
    \setbox\zzz\vbox{\moveleft10in\vbox{\unvcopy\@cclv\copy\LT@foot}\vss}%
    \setbox\@cclv\vbox{\vbox{\unvbox\@cclv\copy\LT@foot}\vss}%
    \@makecol
    \@outputpage
     \setbox\@cclv\box\zzz
    \@makecol
    \@outputpage
      \global\vsize\@colroom
    \copy\LT@head\nobreak
  \fi}

\newbox\zzz



\def\a{%
one&&red\\
two&&green\\
three&&yellow\\
four&&brown\\
}
\def\b{%
111&&this\\
2&&that\\
333&&the other\\
44&&something\\}

\begin{document}

\begin{titlepage} testing longtable\end{titlepage}
\pagenumbering{arabic}

\clearpage\ifodd\value{page}\mbox{}\clearpage\fi
\setlength\LTright{-3\textwidth plus 1fill}
\begin{longtable}{cp{10in}c}
LEFT&&RIGHT\\
\endhead
first&&row\\
\a\uppercase{\a}\b
\a\uppercase{\a}\b\b
last&&row\\
\pagebreak% you need this
\end{longtable}

\end{document}
share|improve this answer
    
Care to explain the answer a bit? –  Martin Schröder May 15 '13 at 12:28
    
@MartinSchröder What it's doing is setting the two column table with a big (arbitrary) gap between the columns. Then inside the output routine it ships out each "page" twice once with a copy of that fragment of the table with the right column off-page then it ships out a second page with a copy of the same box shifted so the left column is off page. –  David Carlisle May 15 '13 at 12:40
    
You can edit your answer, you know? :-) –  Martin Schröder May 15 '13 at 12:58
    
@MartinSchröder so can you:-) –  David Carlisle May 15 '13 at 13:03
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.