# Parallel texts with header on each page?

I have two English language texts that are translations of the same work and that I want to put in parallel: I do not plan to include the original, non-English text. This is for a document (of ca. 100 pages), by the way, rather than for a book. I have actually created said document using Open/Libre Office, so I have a sort of a working copy. But I want to recreate the same document using TeX/LaTeX.

With Open/Libre Office I used a table of two columns and three rows (the text of the translation occupies one row, while the other two rows are headings). I did some experimentation with LaTeX about a year ago and had some initial success using a table for the task, but eventually failed to complete the project. A description of the successful part, as well as the ultimate failure follows.

I used only about one page of text for the initial tests. The output looked superb--much better than my Open/Libre office document. But my enthusiasm was short-lived: I found that the table packages I tried all lacked the ability to produce page-spanning columns. In other words, any column that ends up being longer than one page in length simply gets cut off unceremoniously at the bottom of the page. In a case like mine, where I had a column that would end up being many pages long, I would wind up with only one page of output (overfull vbox error, as I recall); none of the subsequent pages would be produced.

I did look into other packages (ledpar, I believe?) that are made specifically for creating parallel texts and had some success with them as well. But in my view, the table solution output looked best. And as I recall, I had issues trying to introduce the material I had placed in the table headings using the parallel text packages, and I held it important to have a repeating header on each page (that would indicate which column contained which translation). So I got discouraged.

I still hope I might be able to use a table for this project, even though it is a bit of a violation of the intended use for tables. Can anyone offer suggestions about how to accomplish the task I've described in TeX/LaTeX? Will it really be impossible, as it seems to me, using a table?

UPDATE:

Thank you for the answers thus far provided. I had to go back and take another look at the experimental documents I created since this was done some time ago and my memory had gotten a bit vague.

I should start this reply by stating that I somewhat over-simplified the description of my document in the OP--apologies for that. And, having looked at my sample files again, I now realize that I had problems with both the table packages (and yes, I did try longtables) and with the parallel text package (which was, in fact, parcolumns, not ledpar). The final output looked a bit better using the table, but the look of the parcolumns experiment was nice as well.

The problem with the table packages I've described: no table column is allowed to exceed page length (seems to be a limitation coded into the packages--yes, even the longtable packge, I believe). That's a show-stopper for this project: I would have many columns in this document that would exceed page length--which brings me to the over-simplified description I gave in the OP and the problem I had with the parcolumns package.

The document actually could consist in many column chunks, and the parcolumns package does handle page-exceeding columns. The trouble I had with this package was inserting the table headings: they should appear on every page of the document, and I had trouble making that happen.

I should probably leave it at that for now since a more detailed description of the document here is likely to confuse and leave me open to being criticized for "moving the goal post." But I will note in closing that there are actually several sub-section in the document, and each sub-section needs to have a set of headers that repeats on every page.

Sorry for not having been more precise in my opening post.

ANOTHER UPDATE:

Wow, this forum is great--so many wonderful suggestions. Thank you so much for the helpful comments and questions. I've struggled to understand and use TeX/LaTeX for years and only recently did I meet with any success. Had this forum existed when I first started studying TeX/LaTeX (about 10 years ago), I'd be much further along by now.

Yes, it's true that the two translations can vary--sometimes wildly--in paragraph length. This is because one translation seems sometimes to give what seems more like a summary of a paragraph rather than an actual translation. So keeping the two in sync was a challenge. A table works well for that, since each paragraph of each translation is placed in a cell. That technique has the undesirable effect of introducing at some points a great deal of extraneous white space, but it does keep the paragraphs in sync.

With parcolumns, I used paragraphs to keep the two translations in sync--to pretty much the same effect as with the table. It would be nice to be able to have the longer translation somehow flow around the shorter one in cases where one is significantly longer than the other, but with the headers I'm talking about using, that would probably not be feasible.

The header suggestion provided by rdhs inspires me to resume my experiments using parcolumns--thanks so much for that. The header layout I implemented in my Open/Libre Office document is quite complex but results in the appearance I need. Implementing it in TeX/LaTeX is bound to be a challenge. What's needed is actually 3 sets of headers: one for the page (gives the title of the work); one for each section of the work (should contain a title like chapter 1, chapter 2, and should span both columns); and one for each column (containing titles something like translation 1, translation 2). With a table the last two can be easily done by specifying that the first two table rows are table headings to be repeated on each page, and the first row's columns get merged and the text centered. The first header described is just a standard page header.

Those headers should all repeat on every page, and there might be more than one set of headers on any given page (where there is, say, an extremely short chapter than takes up less than a page). I actually managed to get that look using the table package. But, as I said, the page-exceeding cells (I said page-exceeding columns earlier, but it's probably more precise to say cells of the table) are not allowed by any table package. So the experiment failed and I turned to parcolumns to try and recreate the layout I'd achieved in Open/Libre Office.

Again thanks for all the tips. This forum is really great (though a little confusing to use, at least for me)

James

-
Have you tried parcolumns? What about its appearance looks inferior to a table? Also, if you have to implement this in a table, where will you put your row breaks? –  rdhs Dec 22 '11 at 3:03
@wayover13 how do you want the two texts to keep synchronized? On a 100 page document, I'd expect that to be a problem, if the translations do not have the exact same length? If you want paragraphs to match, for instance, you could make a new line in your table for each paragraph. Something like \begin{longtable} ...First paragraph of text A... & First paragraph of text B... \\ ...Second par of text A... & Second par of text B... \end{longtable} –  Bruno Le Floch Dec 22 '11 at 6:24

Okay, here's a hack that uses atbegshi to add a header to parcolumns:

\documentclass{article}
\usepackage{parcolumns}
\usepackage{atbegshi}

\begin{document}
\section{Latin and Piglatin}
\vspace{0.5ex}\hrule\vspace{1.5ex}}
\begin{parcolumns}{2}
%
\colchunk{Latin}
%
\colchunk{Piglatin}
\colplacechunks
%
\colchunk{Latin}
%
\colchunk{Piglatin}
%
\end{parcolumns}
\section{English and Pigenglish}
\vspace{0.5ex}\hrule\vspace{1.5ex}}
\begin{parcolumns}{2}
%
\colchunk{English}
%
\colchunk{Pigenglish}
%
\end{parcolumns}
\end{document}

-
This looks a very promising solution, rdhs. I've experimented with it and the results are very encouraging. Thank you so much for offering this. It would've taken me weeks of struggling on my own to come up with anything like this--if I hadn't just given up first in frustration. –  JMiller Dec 23 '11 at 13:10

The parcolumns package might be useful here. A MWE follows- there are many options that can be tweaked (such as colwidths); see the documentation for more examples.

\documentclass{article}
\usepackage{parcolumns}
\usepackage{lipsum}

\begin{document}

\begin{parcolumns}{2}
\colchunk{\section{1st column}
\lipsum }

\colchunk{\section{2nd column}
\lipsum}
\end{parcolumns}

\end{document}


You might also find the following post helpful:

How do I create separate columns in LaTeX without text flow?

-
If you use parcolumns, I think you'd also need to add \colplacechunks after every 2nd column. In fact, this may have been the OP's problem with ledpar, since there you need to use \Columns similarly. –  rdhs Dec 22 '11 at 5:00

I'm not sure I fully understand the requirements of your question, but it seems to me that you might want to try the longtable package along with the fancyhdr package.

\documentclass{article}
\usepackage{longtable}
\usepackage{fancyhdr}
\usepackage{lipsum}

\def\chapterName{}
\def\leftName{}
\def\rightName{}
\newcommand*{\Chapter}[3]{%
\endlongtable%
\gdef\chapterName{#1}%
\gdef\leftName{#2}%
\gdef\rightName{#3}%
%% ELIMINATE THE || characters to remove the vertical rules
\longtable[c]{||p{0.45\textwidth}|p{0.45\textwidth}||}
\multicolumn{2}{c}{\Large\chapterName} \tabularnewline
\textbf{\leftName} & \textbf{\rightName} \endhead
}
% \renewcommand{\headrulewidth}{0pt}  %% OPTIONAL

\begin{document}
\pagestyle{fancy}
\Title{A Polyglot Tale}
\begin{longtable}[c]{||p{0.45\textwidth}|p{0.45\textwidth}||}
\Chapter{The taming of Lipsum}{Language A}{Language B}
\lipsum[1] & \lipsum[2] \\
\lipsum[3] & \lipsum[4] \\
\Chapter{The breaking of Lipsum}{Language C}{Language D}
\lipsum[5] & \lipsum[6] \\
\lipsum[7] & \lipsum[8]
\end{longtable}

\end{document}


This will show "A Polyglot Tale" centered on every page header, then have a running table head of the chapter name, followed by the language names. The one restriction it currently has (baked into longtable) is that no individual row---which here corresponds to a pair of paragraphs---can span pages. If that is your requirement, then longtable can't help you. But if that's acceptable, then there's no limit on how long a longtable can grow...and in any case, this particular solution finishes and restarts the longtable environment at the close of each chapter. (Also, the various rules are entirely optional; they're there to show the extent of the page and the table.)

-
Would you be able to mock up an example of how to define the different components of a longtable so that it displays some text "in parallel" as in the OP's description? It will definitely add more value to your answer rather than just suggesting with a question. –  Werner Dec 22 '11 at 4:36
Yes, Ben Lerner, I do need for individual rows to span pages: in many instances the paragraphs I'm trying to keep in sync are longer than one page. The table really seemed the most elegant solution and gave the best preliminary test results--that is, until I put in one of the paragraphs that exceeds page length. Then the results were, of course, unacceptable. It's a shame that limitation is "baked in" to these table packages. Another, less severe, limitation I ran into using table packages was that it seemed page breaks could only occur at table-row boundaries. atbegshi is the better solution –  JMiller Dec 23 '11 at 13:05
@JamesMiller, I guess I don't see then how "synced" your paragraphs are. In any case it sounds like parcolumns is designed with your scenario in mind, and rdhs's solution may be better. If so, you should probably upvote or accept the answer :) –  Ben Lerner Dec 23 '11 at 15:34
Thanks for the pointers Ben Lerner. I've done as you suggested. You helped me figure out a bit more about how this site works by your suggestions. I don't understand what you don't understand about sync'ed paragraphs :) But as you've observed, it seems the atbegshi solution will work well for me –  JMiller Dec 23 '11 at 18:00