Long tables (spanning multiple pages), put side by side

I have looked in all previously related questions but I have not yet found the solution. The problem is the following: For a business report, the requirement is to report the data in two different tables as follows: - The tables will be put side by side. - The tables will span multiple pages. - On each table, one of the columns will have a wrapping content (e.g. defined as p{4cm}). As a consequence the lines of the two tables will not be aligned, so I cannot use a single table with the column doubled.

Ideally, the report creating program, should output the first table on the left of each page, and then go back to the first page and output the second table on the right of the pages.

How is this possible in Latex?

The accepted sloution leaves a large bottom margin as it can be seen by the following:

\documentclass[9pt]{article}
\usepackage{xtab}
\usepackage{paracol}
\def\rowcontenta{%
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
}
\def\rowcontentb{%
b & 0 \\
b & 1 \\
b & 2 \\
b & 3 \\
b & 4 \\
b & 5 \\
b & 6 \\
b & 7 \\
b & 8 \\
b & 9 \\
}
\begin{document}
\begin{paracol}{2}
\begin{xtabular}{|l|l|}
\rowcontenta
\rowcontenta
\rowcontenta
\rowcontenta
\rowcontenta
\rowcontenta
\end{xtabular}
\switchcolumn
\begin{xtabular}{|l|l|}
\rowcontentb
\rowcontentb
\rowcontentb
\rowcontentb
\rowcontentb
\rowcontentb
\end{xtabular}
\end{paracol}
\end{document}

• The accepted solution has a problem. A page break is prematurally added, leaving a large bottom margin. See for example the following: – Aggelos Chariatis Sep 25 '15 at 5:40

Here is an option using xtab (since longtable is not happy with column layout) and paracol:

\documentclass{article}
\usepackage{xtab}
\usepackage{paracol}
\def\rowcontent{%
1 & 2 \\
1 & 2 \\
1 & 2 \\
1 & 2 \\
1 & 2 \\
1 & 2 \\
1 & 2 \\
1 & 2 \\
1 & 2 \\
end & here
}

\setlength{\textheight}{3cm}
\begin{document}
\begin{paracol}{2}
\begin{xtabular}{ll}
\rowcontent
\end{xtabular}
\switchcolumn
\begin{xtabular}{ll}
\rowcontent
\end{xtabular}

\end{paracol}
\end{document}


• Sorry for low quality picture. – user11232 Sep 23 '15 at 9:15
• The accepted solution has a problem. A page break is prematurally added, leaving a large bottom margin. See for example the edit in my post – Aggelos Chariatis Sep 25 '15 at 5:45
• @AggelosChariatis It is not the problem with this method but the length of your table. You are supposed to put 2 equally long tables. Or fill the empty space with text. Or move \switchcolumn to a suitable place. Please don't put unequal tables side by side. – user11232 Sep 25 '15 at 5:54
• Thank you very much for your help. The problem is that in reality, the two tables have fifferent size and I do not know their sizes ahead of time. So I cannot add empty lines. Of course if no solution exist then I will be obliged to do such preprocessing. Is there any other solution? – Aggelos Chariatis Sep 25 '15 at 5:59
• Actually the problem persists even with same length tables. I will edit my question to give a sample... – Aggelos Chariatis Sep 25 '15 at 6:07