This is quite a technically involved question. Of which the essence is how XeLaTeX handles page-breaking.
I need to produce a bilingual book. With one language on the left hand side page and another language covering the same text on the right hand side page.
There are a few points to bear in mind:
- The book being produced is the Holy Bible, so it is a very large text, therefore as much of the work as possible should be automated..
- It needs to end the same verse for both languages for every set of pages.
- All the packages included in the MWE below are actually used by other features in the final product.
So bearing this all in mind, the question is; Does XeLaTeX have the ability to find out how much of my text have been used on the page. Or which is the last Section
/ Subsection
used on the page. So that it can be used for the second language to produce the same content on that page.
MWE:
\documentclass[pagesize=pdftex, fontsize=12]{scrbook}
\usepackage[paperwidth=11.2cm, paperheight=17.4cm, top=2cm,bottom=1cm, left=1cm, right=1cm]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{lettrine}
\usepackage{xltxtra}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage[toc]{multitoc}
\usepackage{setspace}
\usepackage{needspace}
\usepackage{calc}
\usepackage{fix2col} %fixes numbering of the sections in the header for two columns
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Times New Roman}
\usepackage{polyglossia}
\setmainlanguage{spanish}
\newcommand{\Sectionnumber}{%
\sbox\Sectionbox{\smash{\raisebox{-\baselineskip}{%
\fontsize{2.2\baselineskip}{0}\selectfont\theSection}}\enspace}}
\newcounter{Section}
\newcounter{Subsection}[Section]
\newlength{\Sectionwidth}
\newif\ifFirstSubsection
\newsavebox{\Sectionbox}
\makeatletter
\newcommand{\Section}{%
\par\vskip\z@ \@plus 2\p@
\FirstSubsectiontrue\clubpenalty\@M
\refstepcounter{Section}\stepcounter{Subsection}%
\Sectionnumber\setlength{\Sectionwidth}{\wd\Sectionbox}%
\hangindent\Sectionwidth\hangafter-2
\leavevmode\llap{\box\Sectionbox}\ignorespaces}
\newcommand{\Subsection}{%
\par\clubpenalty\@clubpenalty
\ifFirstSubsection
\ifnum\prevgraf=\@ne\nobreak\hspace*{\Sectionwidth}\fi
\FirstSubsectionfalse
\fi
\refstepcounter{Subsection}\textbf{\theSubsection}\enspace\ignorespaces}
\makeatother
\parindent=0pt
\parskip=0pt
\begin{document}
\frontmatter
\mainmatter
\setcounter{section}{0}
\Section EN el principio crió Dios los cielos y la tierra.
\Subsection Y la tierra estaba desordenada y vacía, y las tinieblas estaban sobre la haz del abismo, y el Espíritu de Dios se movía sobre la haz de las aguas.
\Subsection Y dijo Dios: Sea la luz: y fué la luz.
\Subsection Y vió Dios que la luz era buena: y apartó Dios la luz de las tinieblas.
\Section Y FUERON acabados los cielos y la tierra, y todo su ornamento.
\Subsection Y acabó Dios en el día séptimo su obra que hizo, y reposó el día séptimo de toda su obra que había hecho.
\Subsection Y bendijo Dios al día séptimo, y santificólo, porque en él reposó de toda su obra que había Dios criado y hecho.
\Section EN el principio crió Dios los cielos y la tierra.
\Subsection Y la tierra estaba desordenada y vacía, y las tinieblas estaban sobre la haz del abismo, y el Espíritu de Dios se movía sobre la haz de las aguas.
\Subsection Y dijo Dios: Sea la luz: y fué la luz.
\Subsection Y vió Dios que la luz era buena: y apartó Dios la luz de las tinieblas.
\Section Y FUERON acabados los cielos y la tierra, y todo su ornamento.
\clearpage
\setcounter{Section}{0}
\Section In the beginning God created the heaven and the earth.
\Subsection And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.
\Subsection And God said, Let there be light: and there was light.
\Subsection And God saw the light, that it was good: and God divided the light from the darkness.
\Section Thus the heavens and the earth were finished, and all the host of them.
\Subsection And on the seventh day God ended his work which he had made; and he rested on the seventh day from all his work which he had made.
\Subsection And God blessed the seventh day, and sanctified it: because that in it he had rested from all his work which God created and made.
\Section In the beginning God created the heaven and the earth.
\Subsection And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.
\Subsection And God said, Let there be light: and there was light.
\Subsection And God saw the light, that it was good: and God divided the light from the darkness.
\Section Thus the heavens and the earth were finished, and all the host of them.
\clearpage
\end{document}
parallel
package?ledpar
is another good option, though it is geared more towards critical editions with facing page translations.eledpar
! You should probably consult theledpar
andledmac
manuals for basic set-up stuff. But I haven't had occasion to use newer versions yet. If the existing answer does what you need, I won't bother providing aneledpar
example. But note that you should usepdfcolparallel
in place of theparallel
package, as the former fixes bugs of the latter and provides colour support (which may not be necessary in your case). As for your fonts, you could use (IMHO) a freer and yet nicer font, likeLinux Libertine
, or the TeX-Gyre fonts.eled*
, but I think there are workarounds for now.