summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/eledmac/eledpar.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/eledmac/eledpar.dtx
Initial commit
Diffstat (limited to 'macros/latex/contrib/eledmac/eledpar.dtx')
-rw-r--r--macros/latex/contrib/eledmac/eledpar.dtx6357
1 files changed, 6357 insertions, 0 deletions
diff --git a/macros/latex/contrib/eledmac/eledpar.dtx b/macros/latex/contrib/eledmac/eledpar.dtx
new file mode 100644
index 0000000000..69103fa6e9
--- /dev/null
+++ b/macros/latex/contrib/eledmac/eledpar.dtx
@@ -0,0 +1,6357 @@
+% \iffalse meta-comment
+%
+% eledpar.dtx
+% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net
+% Maintainer:Maïeul Rouquette maieul at maieul dot net
+% Copyright 2004, 2005 Peter R. Wilson / 2011-.. Maïeul Rouquette
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3 of this license or (at your option) any
+% later version.
+% The latest version of the license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of
+% LaTeX version 2003/06/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This work consists of the files listed in the README file.
+%
+%
+%<*driver>
+\documentclass[twoside]{ltxdoc}
+\usepackage{url}
+\usepackage{xr-hyper}
+ \usepackage[draft=false,
+ plainpages=false,
+ pdfpagelabels,
+ bookmarksnumbered,
+% hyperindex=true
+ hyperindex=false
+ ]{hyperref}
+\usepackage{fontspec}
+\usepackage[english]{babel}
+\usepackage[noreledmac]{eledmac}
+\usepackage{graphicx,eledpar,metalogo}
+\makeatletter
+ \renewenvironment{theglossary}{%
+ \@restonecoltrue\if@twocolumn\@restonecolfalse\fi
+ \columnseprule \z@ \columnsep 35\p@
+ \glossary@prologue%
+ \GlossaryParms \let\item\@idxitem \ignorespaces}
+ {\if@restonecol\onecolumn\else\clearpage\fi}
+ \def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
+ \columnseprule \z@ \columnsep 35\p@
+ \index@prologue%
+ \IndexParms \let\item\@idxitem \ignorespaces}
+ \def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
+ \@mparswitchfalse
+\makeatother
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\renewcommand{\MakeUppercase}[1]{#1}
+\pagestyle{headings}
+\setcounter{StandardModuleDepth}{1}
+% Some commands are defined here, and not in the commented part, because \externaldocument is required
+ \newcommand{\Lpack}[1]{\textsf{#1}}
+ \newcommand{\Lclass}[1]{\textsf{#1}}
+ \newcommand{\file}[1]{\texttt{#1}}
+ \newcommand{\eledpar}{eledpar}
+ \newcommand{\eledmac}{eledmac}
+ \newcommand{\Eledmac}{\Lpack{\eledmac}}
+ \newcommand{\Eledpar}{\Lpack{\eledpar}}
+ \newcommand{\edmac}{\texttt{EDMAC}}
+ \newcommand{\tabmac}{\texttt{TABMAC}}
+ \newcommand{\edstanza}{\texttt{EDSTANZA}}
+ \newcommand{\texbook}{\textit{TeXbook}}
+ \newcommand{\thetexbook}{\textit{The TeXbook}}
+\externaldocument[eledmac-]{eledmac}
+\begin{document}
+ \raggedbottom
+ \DocInput{eledpar.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+% \newcommand{\reff}[1]{\ref{#1} p.~\pageref{#1}}
+% \CheckSum{5224}
+%
+% \makeatletter
+% \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
+% \Describe@It}
+% \newcommand*{\Describe@It}[1]{\endgroup
+% \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
+% \SpecialItIndex{#1}\@esphack\ignorespaces}
+% \newcommand*{\SpecialItIndex}[1]{\@bsphack
+% \index{#1\actualchar{\protect\ttfamily#1}\encapchar usage}\@esphack}
+% \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
+% \DoNotIndex{\@flushglue,\@input}
+% \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
+% \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
+% \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
+% \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
+% \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
+% \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
+% \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
+% \DoNotIndex{\mathcal,\csname,\def,\documentstyle,\dospecials,\edef}
+% \DoNotIndex{\egroup}
+% \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
+% \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
+% \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
+% \DoNotIndex{\ifcase}
+% \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
+% \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
+% \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
+% \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
+% \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
+% \DoNotIndex{\strutbox}
+% \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
+% \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
+% \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
+% \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
+% \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
+% \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
+% \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
+% \DoNotIndex{\nopagebreak}
+% \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
+% \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
+% \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
+% \DoNotIndex{\[,\{,\},\]}
+% \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
+% \DoNotIndex{\baselineskip,\begin,\tw@}
+% \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
+% \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
+% \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
+% \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
+% \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
+% \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
+% \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
+% \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
+% \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
+% \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
+% \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
+% \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
+% \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
+% \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
+% \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
+% \DoNotIndex{\bfdefault}
+% \DoNotIndex{\newcommand,\renewcommand,\providecommand}
+% \DoNotIndex{\ ,\to}
+%
+% \newcommand{\dtxfilename}{\texttt{eledpar.dtx}}
+% \GetFileInfo{eledpar.sty}
+% ^^A Put changes in the right order : see http://tex.stackexchange.com/a/74113/7712
+% \let\org@changes@\changes@
+% \def\my@changes v#1.#2.#3\@nil{%
+% \org@changes@{v#1.\six@digits{#2}.#3=v#1.#2.#3}%
+% }%
+% \newcommand*{\six@digits}[1]{%
+% \ifnum#1<100000 0\fi
+% \ifnum#1<10000 0\fi
+% \ifnum#1<1000 0\fi
+% \ifnum#1<100 0\fi
+% \two@digits{#1}%
+% }%
+% \renewcommand*{\changes@}[1]{%
+% \my@changes#1.\@nil
+% }%
+%\makeatother
+%
+% \changes{v0.1.0}{2004/12/10}{First public release}
+% \changes{v0.2.0}{2005/01/01}{Fix babel problems}
+% \changes{v0.3.0}{2005/03/24}{Reorganize for ledarab}
+% \changes{v0.3.a}{2005/03/30}{Minor \cs{linenummargin} fix}
+% \changes{v0.3.b}{2005/04/08}{Improved parallel page balancing}
+% \changes{v0.3.c}{2011/06/16}{Compatibilty with Polyglossia}
+% \changes{v0.4.0}{2011/08/03}{No more ledparpatch. All patches are now in the main file.}
+% \changes{v0.5.0}{2011/08/21}{Corrections about \cs{section} and other titles in numbered sections}
+% \changes{v0.6.0}{2011/08/22}{Be able to us \cs{chapter} in parallel pages.}
+% \changes{v0.7.0}{2011/08/31}{Option `shiftedverses' which make there is no blank between two parallel verses with inequal length.}
+% \changes{v0.8.0}{2011/09/16}{Possibility to have a symbol on each hanging of verses, like in the french typography. Redefine the commande \cs{hangingsymbol} to define the character.}
+% \changes{v0.9.0}{2011/10/01}{Possibilty to number the pstart with the commands \cs{numberpstarttrue}.}
+% \changes{v0.9.1}{2011/10/02}{The numbering of the pstarts restarts on each \cs{beginnumbering}.}
+% \changes{v0.9.2}{2011/11/08}{Debug : with \cs{Columns}, the hanging indentation now runs on the left columns and the hanging symbol is shown only when \cs{stanza} is used.}
+% \changes{v0.9.3}{2011/11/18}{\cs{thepstartL} and \cs{thepstartR} use now \cs{bfseries} and not \cs{bf}, which is deprecated and makes conflicts with memoir class.}
+% \changes{v0.10.0}{2012/04/04}{\cs{edlabel} commands which start a paragraph are now put in the right place.}
+% \changes{v0.10.0}{2012/04/04}{\cs{edlabel} commands on the right side are now correctly indicated.}
+% \changes{v1.0.0}{2012/09/14}{Compatibility with eledmac. Change name to eledpar.}
+% \changes{v1.0.1}{2012/09/16}{Correction on \cs{numberonlyfirstinline} with lineation by pstart or by page.}
+% \changes{v1.1.0}{2012/09/25}{Shiftedverses becomes shiftedpstarts.}
+% \changes{v1.2.0}{2012/10/15}{Support for \cs{led}\meta{section} commands in parallel texts.}
+% \changes{v1.3.2}{2012/12/11}{Debug with some classes.}
+% \changes{v1.4.3}{2013/10/27}{Corrects a false hanging verse when a verse is exactly the length of a line.}
+% \changes{v1.5.0}{2013/11/08}{Add, as in eledmac, features to manage page breaks.}
+% \changes{v1.7.0}{2014/04/14}{Add, as in eledmac, features to make crossrefs with pstart numbers.}
+% \changes{v1.8.0}{2014/08/05}{Debug eledmac sectioning command after using \cs{resumenumbering}.}
+% \changes{v1.8.0}{2014/08/05}{Compatibility with \Lpack{musixtex}.}
+% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, option to insert something after \cs{pend}s / verses.}
+% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, option to insert something between \cs{pstart}s / verse.}
+% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, new system of sectioning commands.}
+% \changes{v1.8.2}{2014/08/15}{Debug left and side note (bugs added by 1.8.0)}
+% \changes{v1.8.2}{2014/08/15}{Debug \cs{eledxxx} with some paper sizes}
+% \changes{v1.8.3}{2014/08/31}{Add \cs{noeledxxx}, as in eledmac}
+% \changes{v1.9.0}{2014/09/16}{Compatibility with \cs{Xnoteswidthliketwocolumns} and \cs{notesXwidthliketwocolumns}}
+% \changes{v1.10.0}{2015/01/12}{Restore critical notes in \cs{eledsection} in parallel columns (this bug was added in 1.8.2).}
+% \changes{v1.10.0}{2015/01/12}{Compatibility with \cs{AtEveryPstart} and \cs{AtEveryPend}}
+% \changes{v1.11.0}{2015/01/23}{Compatibility of standard footnotes with some biblatex styles.}
+% \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
+% \changes{v1.13.0}{2015/03/06}{With parallel pages, long notes can now flow from the Left to the right side and from the Right to the left side.}
+% \changes{v1.13.0}{2015/03/06}{Fix bug in shiftedpstarts when size difference between pstarts is very important.}
+% \changes{v1.14.0}{2015/03/22}{The \cs{newif}s are not followed by boolean values set to false, because it is the \TeX\ default setting.}
+% \changes{v1.14.0}{2015/03/22}{Fix bug with line number position when using \cs{eledsection} and similar commands for RTL texts with \LuaLaTeX.}
+% \changes{v1.15.0}{2015/04/13}{Add \cs{AtEveryPstartCall}.}
+% \changes{v1.15.0}{2015/04/13}{Fix vertical spurious space before right \cs{eledchapter} (bug added in v1.13.0).}
+% \changes{v1.15.0}{2015/04/13}{Prevent vertical space when using \cs{AtEveryPstart} or \cs{AtEveryPend} with a command which prints nothing}
+% \changes{v1.16.0}{2015/05/18}{Fix bug with nofamiliar / nocritical option of eledmac.}
+% \changes{v1.16.0}{2015/05/18}{Error message when using \cs{beginnumbering}…\cs{endnumbering} without \cs{pstart}.}
+% \changes{v1.16.0}{2015/05/18}{Error message when starting a Leftside/a Rightside while the previous one has not been yet typeset.}
+% \changes{v1.16.0}{2015/05/18}{Error message when calling \cs{Pages} inside `pages' environment and \cs{Columns} inside `pairs' environment.}
+% \changes{v1.16.0}{2015/05/18}{New package option sameparallelpagenumber to have the same page number for both left and right side.}
+% \changes{v1.16.1}{2015/05/20}{Write information about line-list file version in the correct file.}
+% \changes{v1.16.2}{2015/05/29}{Fix bug when adding empty lines before a \cs{pend} in combination with some specific penalties setting.}
+% \changes{v1.17.0}{2015/06/02}{Add compatibility of optional argument of \cs{pstart}/\cs{pend} and \cs{AtEveryPstart}/\cs{AtEveryPend} with two columns mode.}
+% \changes{v1.17.0a}{2015/07/19}{Eledpar support ends. Migrate to reledpar.}
+% \changes{v1.17.1}{2015/09/01}{Changes some internal code in order to provide compatibility with \LaTeX\ release of october 2015}
+% \hyphenation{man-u-script man-u-scripts}
+%
+%
+% ^^A PW added following as the definitions are at some unknown elsewhere
+% \newcommand{\egstart}{}
+% \newcommand{\egmid}{}
+% \newcommand{\egend}{}
+%
+% \renewcommand{\egstart}{%
+% \par
+% \begingroup
+% \centering
+% \begin{minipage}{0.45\textwidth}}
+% \renewcommand{\egmid}{%
+% \end{minipage}\hfill\begin{minipage}{0.45\textwidth}}
+% \renewcommand{\egend}{%
+% \end{minipage}\par\endgroup}
+%
+% \title{Parallel typesetting for critical editions: \\
+% the \Lpack{\eledpar} package\thanks{This file (\dtxfilename)
+% has version number \fileversion, last revised \filedate.}}
+% \author{%
+% Ma\"ieul Rouquette\thanks{\texttt{maieul at maieul dot net}}
+% {\small based on the original \Lpack{ledpar} by}
+% Peter Wilson \\
+% Herries Press\thanks{\texttt{herries dot press at earthlink dot net}}\\
+% }
+%
+% \date{}
+%
+%
+% \maketitle
+%
+% \textbf{This is documentation of deprecated eledmac package. If you are beginning a new project, we suggest that you use reledmac instead. If for old projects you can't migrate to reledmac, you can continue to use this documentation and the eledmac package. You should add noreledmac option when loading package, to disable message about reledmac.}
+%
+% \begin{abstract}
+% The \Eledmac{} package, which is based on the \PlainTeX\ set of
+% \edmac\ macros, has been used for some time for typesetting critical
+% editions. The \Eledpar{} package is an extension to \Eledmac{}
+% which enables texts and their critical apparatus to be typeset in
+% parallel, either in two columns or on pairs of facing pages.
+%
+% Note that before September 2012, eledpar was called ledpar. The changes from ledmac/ledpar to eledmac/eledpar is explained in ledmac documentation.
+%
+% \Lpack{eledpar} provides many tools and options. Normally, they are all documented in this file.
+% Also provided is a help folder, ``\href{examples/.}{examples}''. The folder contains additional examples (although not for all cases).
+% Examples starting by ``3-'' are for basic uses, those starting by ``4-'' are for advanced uses.
+%
+% To report bugs, please go to ledmac's GitHub page and click ``New Issue'': \url{https://github.com/maieul/ledmac/issues/}. You must open an account with github.com to access my page (maieul/ledmac). GitHub accounts are free for open-source users. You can report bug in English or in French (better).
+%
+% You can subscribe to the eledmac email list in:\\ \url{http://geekographie.maieul.net/146}
+% \end{abstract}
+% \renewcommand{\numberline}[1]{#1~}
+% \tableofcontents
+%
+%
+%
+% \section{Introduction}
+%
+% The \edmac{} macros \cite{EDMACTUG} for typesetting critical editions
+% of texts
+% have been available for use with TeX for some years. Since \edmac{}
+% became available there had been a small but constant demand for a
+% version of \edmac{} that could be used with \LaTeX. The \Eledmac{}
+% package was introduced in 2003 in an attempt to satisfy that request.
+%
+% Some critical editions contain texts in more than one form, such as
+% a set of verses in one language and their translations in another. In
+% such cases there is a desire to be able to typeset the two texts, together
+% with any critical apparatus, in parallel. The \Eledpar{} package
+% is an extension to \Eledmac{} that enables two texts and their
+% apparatus to be set in parallel, either in two columns or on pairs of
+% facing pages.
+%
+% The package has to try and coerce \TeX{} into paths it was not designed
+% for. Use of the package, therefore, may produce some surprising results.
+%
+% This manual contains a general description of how to use
+% \Eledpar{} starting in section~\ref{howto};
+% the complete source code for the package,
+% with extensive documentation (in sections~\ref{overview}
+% through \ref{end});
+% and an Index to the source code. As \Eledpar{} is an adjunct to \Eledmac{}
+% I assume that you have read the \Eledmac{} manual. Also \Eledpar{} requires
+% \Eledmac{} to be used, preferably at least version 0.10 (2011/08/22).
+% You do not need to read the source code for this package in order to
+% use it but doing so may help to answer any questions you might have.
+% On a first reading,
+% I suggest that you should skip anything after the general documentation in
+% sections~\ref{howto} until~\ref{overview},
+% unless you are particularly interested in the innards of \Eledpar.
+%
+%
+% \section{The \Lpack{\eledpar} package}\label{howto}
+%
+% A file may mix \emph{numbered} and \emph{unnumbered} text.
+% Numbered text is printed with marginal line numbers and can include
+% footnotes and endnotes that are referenced to those line numbers:
+% this is how you'll want to print the text that you're editing.
+% Unnumbered text is not printed with line numbers, and you can't
+% use \Eledmac's note commands with it: this is appropriate for
+% introductions and other material added by the editor around the
+% edited text.
+%
+% The \Eledpar{} package lets you typeset two \emph{numbered} texts in
+% parallel. This can be done either as setting the `Leftside' and `Rightside'
+% texts in two columns or on facing pages.
+% In the paired pages case footnotes are placed at the bottom of the page
+% on which they are called out --- that is, footnotes belonging to the left
+% are set at the foot of a left (even numbered) page, and those for right
+% texts are at the bottom of the relevant right (odd numbered) page. However,
+% in the columnar case, all footnotes are set at the bottom left of the
+% page on which they are called out --- they are not set below the
+% relevant column.
+% The line numbering schemes need not be the same for the two texts.
+%
+% \subsection{General}
+%
+% \Eledmac{} essentially puts each chunk of numbered text
+% (the text within a \cs{pstart} \ldots \cs{pend}) into a box and then
+% following the \cs{pend} extracts the text line by line from the box
+% to number and print it. More precisely, the text is first put into the
+% the box as though it was being typeset as normal onto a page and
+% any notes are stored without being typeset. Then each typeset line
+% is extracted from the box and any notes for that line are recalled.
+% The line, with any notes, is then output for printing, possibly with
+% a line number attached. Effectively, all the text is typeset and then
+% afterwards all the notes are typeset.
+%
+%
+% \Eledpar{} similarly puts the left and right chunks into boxes but can't
+% immediately output the text after a \cs{pend} --- it has to wait until
+% after both the left and right texts have been collected before it can
+% start processing. This means that several boxes are required and possibly
+% TeX has to store a lot of text in its memory; both the number of potential
+% boxes and memory are limited. If TeX's memory is overfilled the recourse is
+% to reduce the amount of text stored before printing.
+%
+% \DescribeMacro{\maxchunks}
+% It is possible to have multiple chunks in the left and right texts before
+% printing them. The macro \cs{maxchunks}\marg{num} specifies the maximum
+% number of chunks within the left or right texts. This is initially set as: \\
+% \verb?\maxchunks{5120}? \\
+% meaning that there can be up to 5120 chunks in the left text and up to
+% 5120 chunks in
+% the right text, requiring a total of 10240 boxes. If you need more chunks
+% then you can increase \cs{maxchunks}. The \cs{maxchunks} must be called in the preamble.
+%
+% If you \cs{maxchunks} is too little
+%you can get a \Eledmac{} error message along the
+% lines: `Too many \cs{pstart} without printing. Some text will be lost.'
+% then you will have to either increase \cs{maxchunks} or use the
+% parallel printing commands (\cs{Columns} or \cs{Pages}) more frequently.
+%
+% When typesetting verse using \cs{syntax}, each line is treated as a chunk,
+% so be warned that if you are setting parallel verses you might have to
+% increase \cs{maxchunks} much more than it appears at first sight.
+%
+% In general, \Eledmac{} is a TeX resource hog, and \Eledpar{} only
+% makes things worse in this respect.
+%
+% \section{Parallel columns}\label{columns}
+%
+% \DescribeEnv{pairs}
+% Numbered text that is to be set in columns must be within a \verb?pairs?
+% environment. Within the environment the text for the lefthand and righthand
+% columns is placed within the \verb?Leftside? and \verb?Rightside?
+% environments, respectively; these are described in more detail below
+% in section~\ref{leftright}.
+%
+% \DescribeMacro{\Columns}
+% The command \cs{Columns} typesets the texts in the previous pair of
+% \verb?Leftside? and \verb?Rightside? environments.
+% The general scheme for parallel columns looks like this:
+% \begin{verbatim}
+% \begin{pairs}
+% \begin{Leftside} ... \end{Leftside}
+% \begin{Rightside} ... \end{Rightside}
+% \end{pairs}
+% \Columns
+% \begin{pairs}
+% \begin{Leftside} ... \end{Leftside}
+% ...
+% \end{pairs}
+% \Columns
+% \end{verbatim}
+%
+%
+% Keep in mind that the \cs{Columns} \textbf{must be} outside of the \verb+pairs+ environment.
+% \DescribeMacro{\AtBeginPairs}
+% \changes{v1.9.0}{2014/09/16}{Add \cs{AtBeginPairs} macro.}
+% You can use the macro \cs{AtBeginPairs} to insert a code at the begining of each \verb+pairs+ environments.
+% That could be useful to add the \cs{sloppy} macro to prevent overfull hboxes in two columns.
+% \begin{verbatim}
+% \AtBeginPairs{\sloppy}
+% \end{verbatim}
+% There is no required pagebreak before or after the columns.
+%
+% \DescribeMacro{\Lcolwidth}
+% \DescribeMacro{\Rcolwidth}
+% The lengths \cs{Lcolwidth} and \cs{Rcolwidth} are the widths of the left
+% and right columns, respectively. By default, these are: \\
+% \verb?\setlength{\Lcolwidth}{0.45\textwidth}? \\
+% \verb?\setlength{\Rcolwidth}{0.45\textwidth}? \\
+% They may be adjusted if one text tends to be `bulkier' than the other.
+%
+% \DescribeMacro{\columnrulewidth}
+% \DescribeMacro{\columnseparator}
+% The macro \cs{columnseparator} is called between each left/right pair
+% of lines. By default it inserts a vertical rule of width
+% \cs{columnrulewidth}. As this is initially defined to be 0pt the rule
+% is invisible. For a visible rule between the columns you could try: \\
+% \verb?\setlength{\columnrulewidth}{0.4pt}? \\
+% You can also modify \cs{columnseparator} if you want more control.
+%
+% \DescribeMacro{\columnsposition}
+% \changes{v1.8.0}{2014/08/05}{Add \cs{columnsposition}.}
+% By default, columns are positioned to the right of the page.
+% However, you use \cs{columnsposition}\verb+{L}+ to align them to the left,
+% or \cs{columnsposition}\verb+{C}+ to center them.
+%
+% When you use \cs{stanza}, the visible rule may shift when a verse has a hanging indent. To prevent shifting, use \cs{setstanzaindents} outside the \verb|Leftside| or \verb|Rightside| environment.
+%
+%
+% \DescribeMacro{\beforecolumnseparator}\DescribeMacro{\aftercolumnseparator}
+% \changes{v1.8.0}{2014/08/05}{Add \cs{beforecolumnseparator} and \cs{aftercolumnseparator}.}
+% By default, the spaces around column separator are the same as the space:
+% \begin{itemize}
+% \item On the left of columns, if columns are aligned right.
+% \item On the right of columns, if columns are aligned left.
+% \item On both the Left and Right columns, if columns are centered.
+% \end{itemize}
+% You can redefine \cs{beforecolumnseparator} and \cs{aftercolumnseparator} length to define spaces before or after the column separator, instead of letting eledpar calculate them automatically.
+% \begin{verbatim}
+% \setlength{\beforecolumseparator}{length}
+% \setlength{\aftercolumseparator}{length}
+% \end{verbatim}
+% If you want to revert to the previous behavior, just set with a negative value.
+% \DescribeMacro{\widthliketwocolumns}
+% If you want to mix two-column with single-column text, you can align horizontally single-column text to two-column text with \cs{widthliketwocolumnstrue}. To reset this feature, use \cs{widthliketwocolumnsfalse}.
+% You can also call \cs{widthliketwocolumns} as a global option when loading \Lpack{eledmac} or \Lpack{eledpar}
+%
+% \DescribeMacro{\Xnoteswidthliketwocolumns}
+% \DescribeMacro{\notesXwidthliketwocolumns}
+% In most cases, you should use \cs{widthliketwocolumns} in combination with \cs{Xnoteswidthliketwocolumns} and \cs{notesXwidthliketwocolumns} to align the critical/familiar footnotes with the two colums.
+% See \Lpack{eledmac}'s handbook for more details.
+% \section{Facing pages}\label{pages}
+% \subsection{Basic usage}
+% \DescribeEnv{pages}
+% Numbered text that is to be set on facing pages must be within a \verb?pages?
+% environment. Within the environment the text for the lefthand and righthand
+% pages is placed within the \verb?Leftside? and \verb?Rightside?
+% environments, respectively.
+%
+% \DescribeMacro{\Pages}
+% The command \cs{Pages} typesets the texts in the previous pair of
+% \verb?Leftside? and \verb?Rightside? environments.
+% The general scheme for parallel pages looks like this:
+% \begin{verbatim}
+% \begin{pages}
+% \begin{Leftside} ... \end{Leftside}
+% \begin{Rightside} ... \end{Rightside}
+% \begin{Leftside} ... \end{Leftside}
+% ...
+% \end{pages}
+% \Pages
+% \end{verbatim}
+% The \verb?Leftside? text is set on lefthand (even numbered) pages and
+% the \verb?Rightside? text is set on righthand (odd numbered) pages.
+% Each \cs{Pages} command starts a new even numbered page. After parallel
+% typesetting is finished, a new page is started.
+% Note that the \cs{Pages} \textbf{must be} outside of the \verb+pages+ environment.
+% \subsection{Text width}
+% \DescribeMacro{\Lcolwidth}
+% \DescribeMacro{\Rcolwidth}
+% Within the \verb?pages? environment the lengths \cs{Lcolwidth} and
+% \cs{Rcolwidth} are the widths of the left
+% and right pages, respectively. By default, these are set to the normal
+% textwidth for the document, but can be changed within the environment if
+% necessary.
+% \subsection{Page number}
+% \changes{v1.15.0}{2015/05/18}{Add sameparallelpagenumber option.}
+% By default, \cs{Pages} use the standard \LaTeX\ page number scheme.
+% This means that pages are numbered continuously following printed-book conventions: from left-hand to right-hand side, left-hand pages having even numbers, right-hand pages having odd numbers.
+%
+% \DescribeMacro{\sameparallelpagenumbertrue}\DescribeMacro{\sameparallelpagenumbertrue}However, you can use the package option \verb+sameparallelpagenumber+ to have the same page number for both left and right side.
+% In this case, this setting will apply only for pages typeset by \cs{Pages}, not for ``normal'' pages.
+%
+% You can also switch the two system using \cs{sameparallelpagenumbertrue} and \cs{sameparallelpagenumberfalse}.
+%
+% \subsection{Setting the page breaking}
+% \DescribeMacro{\goalfraction}
+% When doing parallel pages \Eledpar{} has to guess where TeX is going to
+% put pagebreaks and hopefully get there first in order to put the pair of
+% texts on their proper pages. When it thinks that the fraction
+% \cs{goalfraction} of a page has been filled, it finishes that page and
+% starts on the other side's text. The definition is: \\
+% \verb?\newcommand*{\goalfraction}{0.9}? \\
+% If you think you can get more on a page, increase this. On the other hand,
+% if some left text overflows onto an odd numbered page or some right text
+% onto an even page, try reducing it, for instance by: \\
+% \verb?\renewcommand*{\goalfraction}{0.8}?
+% \subsection{Critical and familiar footnotes}
+% Of course, in ``Facing pages'', the \Lpack{eledmac} both critical and familiar footnotes can be used.
+% However, some specific points must be taken into consideration.
+% \subsubsection{Note size setting}
+% Since \Lpack{eledpar} v.1.13.0, long notes in facing pages can flow from left to right pages, and \emph{vice-versa}.
+% However, the \Lpack{eledmac} default setting for the maximum alloted size to notes is greater than \cs{textheight}. That makes impossible for long notes to flow across pages.
+% \footnote{The same applies to \LaTeX\ normal notes. Read \url{http://tex.stackexchange.com/a/228283/7712} for technical informations.}
+% We have not changed this default setting, because we don't want to break compatibility with older version of \Lpack{eledmac}.
+% So, you MUST change the default setting via \cs{maxhXnotes} (for critical notes)\cs{maxhnotesX} (for familiar notes).
+% Both commands are explained in \Lpack handbook (\reff{eledmac-maxhXnotes}).
+% As an advisable setting:
+% \begin{verbatim}
+% \maxhXnotes{0.6\textheight}
+% \maxhnotesX{0.6\textheight}
+% \end{verbatim}
+% \subsubsection{Notes for one side only}
+% \DescribeMacro{\onlyXside}
+% \DescribeMacro{\onlysideX}
+% You may want to typeset notes on one side only (either left or right).
+% Use \cs{onlyXside}\oarg{s}\marg{p} to set critical notes, and \cs{onlysideX}\oarg{s}\marg{p} to set familiar notes.
+% \marg{p} must be set to \verb+L+ for notes to be confined only on the left side and to \verb+R+ for notes to be confined only on the right side.
+% \subsubsection{Familiar notes called in the right side, but to be printed in the left side}
+% \DescribeMacro{\footnoteXnomk}
+% \DescribeMacro{\footnoteXmk}
+% As often happens, the left side has less room for text.
+% We may want to call familiar notes in the right side while using at the same time the available space in the left side to print them.
+%
+% To achieve this, we call \cs{footnoteXnomk}\marg{notecontent} in the left side. X is to be replaced by the series letter. We do this call in the left side after the word which matches up to the one in the right side after which we want to insert the actual footnote mark.
+%
+% In the right side, we call \cs{footnoteXmk} at the place we want to have the footnote mark. X is to be replaced by the series letter.
+% For example:
+% \begin{verbatim}
+% \begin{Leftside}
+% \beginnumbering
+% \pstart
+% A little cat\footnoteAnomk{A note.}. And so one ...
+% \pend
+% \endnumbering
+% \end{Leftside}
+% \begin{Rightside}
+% \beginnumbering
+% \pstart
+% Un petit chat\footnotemk. And so one ...
+% \pend
+% \endnumbering
+% \end{Rightside}
+% \end{verbatim}
+% \section{Left and right texts}\label{leftright}
+% \subsection{Environments}
+% Parallel texts are divided into Leftside and Rightside. The form of the
+% contents of these two are independent of whether they will be set
+% in columns or pages.
+%
+% \DescribeEnv{Leftside}
+% \DescribeEnv{Rightside}
+% The left text is put within the \verb?Leftside? environment and the
+% right text likewise in the \verb?Rightside? environment. The number of
+% \verb?Leftside? and \verb?Rightside? environments must be the same.
+% \subsection{Line numbering scheme}
+% Within these environments you can designate the line numbering scheme(s)
+% to be used.
+% \DescribeMacro{\firstlinenum}
+% \DescribeMacro{\linenumincrement}
+% \DescribeMacro{\firstsublinenum}
+% \DescribeMacro{\sublinenumincrement}
+% \DescribeMacro{\firstlinenum*}
+% \DescribeMacro{\linenumincrement*}
+% \DescribeMacro{\firstsublinenum*}
+% \DescribeMacro{\sublinenumincrement*}
+% The \Eledmac{} package originally used counters for specifying the
+% numbering scheme; now both \Eledmac and
+% the \Eledpar{} package use macros instead. Following
+% \cs{firstlinenum}\marg{num} the first line number will be \meta{num}, and
+% following \cs{linenumincrement}\marg{num} only every \meta{num}th
+% line will have a printed number. Using these macros inside the
+% \verb?Leftside? and \verb?Rightside? environments gives you independent
+% control over the left and right numbering schemes. The \cs{firstsublinenum}
+% and \cs{sublinenumincrement} macros correspondingly set the numbering
+% scheme for sublines.
+% The starred versions change both left and right numbering schemes.
+%
+% Generally speaking, controls like \cs{firstlinenum} or \cs{linenummargin}
+% apply to sequential and left texts.
+% To effect right texts only, they have
+% to be within a \verb?Rightside? environment.
+% \DescribeMacro{\lineationR}
+% \cs{lineationR} macro is the equivalent of \Lpack{eledmac} \cs{lineation} macro for the right side.
+% \DescribeMacro{\lineation*}
+% \cs{lineation*} macro is the equivalent of \Lpack{eledmac} \cs{lineation} macro for both sides.
+% \subsection{chunk}
+% \DescribeMacro{\pstart}
+% \DescribeMacro{\pend}
+% In a serial (non-parallel) mode, each numbered paragraph, or chunk,
+% is contained
+% between the \cs{pstart} and \cs{pend} macros, and the paragraph is output
+% when the \cs{pend} macro occurs. The situation is somewhat different
+% with parallel typesetting as the left text (contained within \cs{pstart}
+% and \cs{pend} groups within the \verb?Leftside? environment) has to be
+% set in parallel with the right text (contained within its own \cs{pstart}
+% and \cs{pend} groups within the corresponding \verb?Rightside? environment)
+% the \cs{pend} macros cannot immediately initiate any typesetting ---
+% this has to be controlled by the \cs{Columns} or \cs{Pages} macros.
+% Several chunks may be specified within a \verb?Leftside? or
+% \verb?Rightside? environment.
+% A multi-chunk text then looks like:
+% \begin{verbatim}
+% \begin{...side}
+% % \beginnumbering
+% \pstart first chunk \pend
+% \pstart second chunk \pend
+% ...
+% \pstart last chunk \pend
+% % \endnumbering
+% \end{...side}
+% \end{verbatim}
+% Numbering, via \cs{beginnumbering} and \cs{endnumbering}, may extend
+% across several \verb?Leftside? or \verb?Rightside? environments.
+% Remember, though,
+% that the left/right sides are effectively independent of each other.
+%
+% \subsection{\cs{AtEveryPstart} and \cs{AtEveryPstartCall}}
+% In general, remember that the moment where a \cs{pstart} is called is different
+% from the moment when the \cs{pstart}\ldots\cs{pend} content is printed, which is when \cs{Pages} or \cs{Columns} is processed.
+%
+% Consequently:
+% \begin{itemize}
+% \item The argument of \cs{AtEveryPstart} (see \reff{eledmac-AtEveryPstart}) is called before every chunk is printed, except if you used an optional argument for the \cs{pstart}.
+% \item The argument of \cs{AtEveryPstartCall} is called before every \cs{pstart}.
+% \end{itemize}
+% \subsection{Language setting}
+% If you are using the
+% \Lpack{babel} package with different languages
+% (via, say, \cs{selectlanguage}) for the left and right texts it is
+% particularly important to select the appropriate language within the
+% \verb?Leftside? and \verb?Rightside? environments. The initial language
+% selected for the right text is the \Lpack{babel} package's default. Also,
+% it is the \emph{last} \cs{selectlanguage} in a side that controls the
+% language used in any notes for that side when they get printed. If
+% you are using multilingual notes then it is probably safest to explicitly
+% specify the language(s) for each note rather than relying on the language
+% selection for the side. The right side language is also
+% applied to the right side line numbers.
+%
+% \subsection{Shifting}
+% Corresponding left and right sides must have the same number of
+% paragraph chunks --- if there are four on the left there must be four
+% on the right, even if some are empty. The start of each pair of left and
+% right chunks are aligned horizontally on the page. The ends may
+% come at different positions --- if one chunk is shorter than the other
+% then blank lines are output on the shorter side until the end of the longer
+% chunk is reached.
+%
+% However, sometime if the left pstarts are much greater than right pstarts,
+% or \emph{vice-versa},
+% you can decide to shift the pstarts on the left and right side.
+% That means the start of pstarts are not aligned horizontally on the page,
+% the shift is offset at the end of each double pages.
+% To enable this function, load eledpar with the option \verb+shiftedpstarts+.
+% \section{Numbering text lines and paragraphs}
+%
+% \DescribeMacro{\beginnumbering}
+% \DescribeMacro{\endnumbering}
+% Each section of numbered text must be preceded by
+% \cs{beginnumbering} and followed by \cs{endnumbering}, like: \\
+% \cs{beginnumbering} \\
+% \meta{text} \\
+% \cs{endnumbering} \\
+% These have to be separately specified within \verb?Leftside? and
+% \verb?Rightside? environments.
+%
+% The \cs{beginnumbering} macro resets the line number to zero,
+% reads an auxiliary file called \meta{jobname}.\file{nn} (where
+% \meta{jobname} is the name of the main input file for this job,
+% and \file{nn} is 1 for the first numbered section, 2 for
+% the second section, and so on), and then creates a new version of
+% this auxiliary file to collect information during this run.
+% Separate auxiliary files are maintained for right hand texts and
+% these are named \meta{jobname}.\file{nnR}, using the `R' to distinguish
+% them from the left hand and serial (non-parallel) texts.
+%
+% \DescribeMacro{\memorydump}
+% The command \cs{memorydump} effectively performs an \cs{endumbering}
+% immediately followed by a \cs{beginnumbering} while not restarting the
+% numbering sequence. This has the effect of clearing TeX's memory of previous
+% texts and any associated notes, allowing
+% longer apparent streams of parallel texts. The command should be applied
+% to both left and right texts, and after making sure that all previous
+% notes have been output. For example, along the lines of:
+% \begin{verbatim}
+% \begin{pages}
+% \begin{Leftside}
+% \beginnumbering
+% ...
+% \end{Leftside}
+% \begin{Rightside}
+% \beginnumbering
+% ...
+% \end{Rightside}
+% \end{pages}
+% \Pages
+% \begin{pages}
+% \begin{Leftside}
+% \memorydump
+% ...
+% \end{Leftside}
+% \begin{Rightside}
+% \memorydump
+% ...
+% \end{pages}
+% \end{verbatim}
+% \DescribeMacro{\Rlineflag}
+% The value of \cs{Rlineflag} is appended to the line numbers of the
+% right texts. Its default definition is: \\
+% \verb?\newcommand*{\Rlineflag}{R}? \\
+% This may be useful for parallel columns but for parallel pages it might
+% be more appropriate to redefine it as: \\
+% \verb?\renewcommand*{\Rlineflag}{}?.
+% \DescribeMacro{\printlinesR}
+% \DescribeMacro{\ledsavedprintlines}
+% The \cs{printlines} macro is ordinarily used to print the line number
+% references for critical footnotes. For footnotes from right side texts
+% a special version is supplied, called \cs{printlinesR}, which incorporates
+% \cs{Rlineflag}. (The macro \cs{ledsavedprintlines} is a copy of the original
+% \cs{printlines}, just in case \ldots). As provided, the package makes no
+% use of \cs{printlinesR} but you may find it useful. For example, if you only
+% use the B footnote series in righthand texts then you may wish to flag
+% any line numbers in those footnotes with the value of \cs{Rlineflag}. You
+% could do this by putting the following code in your preamble:
+% \begin{verbatim}
+% \let\oldBfootfmt\Bfootfmt
+% \renewcommand{\Bfootfmt}[3]{%
+% \let\printlines\printlinesR
+% \oldBfootfmt{#1}{#2}{#3}}
+% \end{verbatim}
+%
+%
+%
+%\changes{v0.9.0}{2011/10/01}{Possibility to number \cs{pstart}.}
+% It's possible to insert a number at every \cs{pstart} command. You must use the \DescribeMacro{\numberpstarttrue}\cs{numberpstarttrue} command to have it. You can stop the numerotation with \DescribeMacro{\numberpstartfalse}\cs{numberpstartfalse}. You can redefine the commands \DescribeMacro{\thepstartL}\cs{thepstartL} and \DescribeMacro{\thepstartR}\cs{thepstartR} to change style. The numbering restarts on each \cs{beginnumbering}
+% \section{Verse}
+%
+% If you are typesetting verse with \Eledmac{} you can use the \cs{stanza}
+% construct, and you can also use this in right or left parallel texts.
+% In this case each verse line is a chunk which has two implications.
+% (1) you can unexpectedly exceed the \cs{maxchunks} limit or the overall
+% limit on the number of boxes, and (2) left and right verse lines are
+% matched, which may not be desirable if one side requires more print lines
+% for verse lines than the other does.
+%
+% \DescribeEnv{astanza}
+% \Eledpar{} provides an \verb?astanza? environment which you can use instead
+% of \cs{stanza} (simply replace \verb?\stanza? by \verb?\begin{astanza}? and
+% add \verb?\end{astanza}? after the ending \verb?\&?). Within the
+% \verb?astanza? environment each verse line is treated as a paragraph,
+% so there must be no blank lines in the environment otherwise there will
+% be some extraneous vertical spacing.
+%
+% If you get an error message along the lines of `Missing number,
+% treated as zero \cs{sza@0@}' it is because you have forgotten to use
+% \cs{setstanzaindents} to set the stanza indents.
+%
+% \DescribeMacro{\skipnumbering}
+% The command \cs{skipnumbering} when inserted in a line of parallel text
+% causes the numbering of that particular line to be skipped. This can
+% useful if you are putting some kind of marker (even if it is only a
+% blank line) between stanzas. Remember, parallel texts must be numbered
+% and this provides a way to slip in an `unnumbered' line.
+%
+% The \verb?astanza? environment forms a chunk but you may want to
+% have more than one stanza within the chunk. Here are a couple of ways of
+% doing that with a blank line between each internal stanza, and with
+% each stanza numbered. First some preliminary definitions:
+% \begin{verbatim}
+% \newcommand*{\stanzanum}[2][\stanzaindentbase]{%
+% \hskip -#1\llap{\textbf{#2}}\hskip #1\ignorespaces}
+% \newcommand{\interstanza}{\par\mbox{}\skipnumbering}
+% \end{verbatim}
+% And now for two stanzas in one. In this first example the line numbering
+% repeats for each stanza.
+% \begin{verbatim}
+% \setstanzaindents{1,0,1,0,1,0,1,0,1,0,1}
+% \begin{pairs}
+% \begin{Leftside}
+% \firstlinenum{2}
+% \linenumincrement{1}
+% \beginnumbering
+% \begin{astanza}
+% \stanzanum{1} First in first stanza &
+% Second in first stanza &
+% Second in first stanza &
+% Third in first stanza &
+% Fourth in first stanza &
+% \interstanza
+% \setline{2}\stanzanum{2} First in second stanza &
+% Second in second stanza &
+% Second in second stanza &
+% Third in second stanza &
+% Fourth in second stanza \&
+% \end{astanza}
+% ...
+% \end{verbatim}
+% And here is a slightly different way of doing the same thing, but with
+% the line numbering being continuous.
+% \begin{verbatim}
+% \setstanzaindents{1,0,1,0,1,0,0,1,0,1,0,1}
+% \begin{pairs}
+% \begin{Leftside}
+% \firstlinenum{2}
+% \linenumincrement{1}
+% \beginnumbering
+% \begin{astanza}
+% \stanzanum{1} First in first stanza &
+% Second in first stanza &
+% Second in first stanza &
+% Third in first stanza &
+% Fourth in first stanza &
+% \strut &
+% \stanzanum{2}\advanceline{-1} First in second stanza &
+% Second in second stanza &
+% Second in second stanza &
+% Third in second stanza &
+% Fourth in second stanza \&
+% \end{astanza}
+% ...
+% \end{verbatim}
+%
+%
+%
+% \DescribeMacro{\hangingsymbol}Like in eledmac, you could redefine the command \cmd{\hangingsymbol} to insert a character in each hanging line. If you use it, you must run \LaTeX\ two time. Example for the French typography
+%\begin{verbatim}
+%\renewcommand{\hangingsymbol}{[\,}
+%\end{verbatim}
+% You can also use it to force hanging verse to be flush right:
+% \begin{verbatim}
+% \renewcommand{\hangingsymbol}{\protect\hfill}
+% \end{verbatim}
+%
+%
+% When you use \cs{lednopb} make sure to use it on both sides in the corresponding
+% verses to keep the pages in sync.
+% \section{Side notes}
+% As in \Lpack{eledmac}, you must use one of the following commands to add side notes: \cs{ledsidenote}, \cs{ledleftnote}, \cs{ledrightnote}, \cs{ledouterote}, \cs{ledinnerrote}.
+%
+% The \cs{sidenotemargin} defines the margin of the sidenote for either left or right side, depending on the current environment.
+% You can use \cs{sidenotemargin*} to define it for both sides.
+% \section{Parallel ledgroups}
+% \changes{v1.6.0}{2013/12/13}{Add tool and documentation for parallel ledgroups}
+% You can also make parallel ledgroups (see the documentation of eledmac about ledgroups).
+% To do it you have:
+% \begin{itemize}
+% \item To load \Lpack{eledpar} package with the \verb+parledgroup+ option, or to add \cs{parledgrouptrue}.
+% \item To push each ledgroup between \cs{pstart}…\cs{pend} command.
+% \end{itemize}
+% See the following example:
+% \begin{verbatim}
+% \begin{pages}
+% \begin{Leftside}
+% \beginnumbering
+% \pstart
+% \begin{ledgroup}
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \pstart
+% \begin{ledgroup}
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \endnumbering
+% \end{Leftside}
+% \begin{Rightside}
+% \beginnumbering
+% \pstart
+% \begin{ledgroup}
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \pstart
+% \begin{ledgroup}
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \endnumbering
+% \end{Rightside}
+% \end{pages}
+% \Pages
+% \end{verbatim}
+% You can add sectioning a sectioning command, following this scheme:
+% \begin{verbatim}
+% \begin{..side}
+% \beginnumbering
+% \pstart
+% \section{First ledgroup title}
+% \pend
+% \pstart
+% \begin{ledgroup}\skipnumbering
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \pstart
+% \section{Second ledgroup title}
+% \pend
+% \pstart
+% \begin{ledgroup}\skipnumbering
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \endnumbering
+% \end{..side}
+% \end{verbatim}
+% \subsection{Parallel ledgroups and \Lpack{setspace} package}
+% If you use the \Lpack{setspace} package and want your notes in parallel ledgroups to be single-spaced (not half-spaced or double-spaced), just add to your preamble:
+% \begin{verbatim}
+% \let\parledgroupnotespacing\singlespacing
+% \end{verbatim}
+% \emph{In effect, to have correct spacing, don't change the font size of your notes}.
+% \StopEventually{}
+%
+% \section{Sectioning commands}
+% \changes{v1.8.0}{2014/08/05}{New sectioning commands, as in eledmac.}
+% The standard sectioning commands of eledmac are available, and provide parallel sectionings, for both two-column and two-page layout.
+% \DescribeMacro{\eledsectnotoc}
+% By default, the section commands of the right side are not added to the table of contents.
+% But you can change it, using \cs{eledsectnotoc}\marg{arg}, where \meta{arg} could be \verb+L+ (for left side) or \verb+R+ (for right side).
+%
+% \DescribeMacro{\eledsectmark}
+% By default, the \LaTeX\ marks for header are token from left side. You can change it, using \cs{eledsectmark}\marg{arg}, where \meta{arg} could be \verb+L+ (for left side) or \verb+R+ (for right side).
+% \section{Implementation overview}\label{overview}
+%
+% TeX is designed to process a single stream of text, which may include
+% footnotes, tables, and so on. It just keeps converting its input into
+% a stream typeset pages. It was not designed for typesetting two texts
+% in parallel, where it has to alternate from one to the other. Further,
+% TeX essentially processes its input one paragraph at a time --- it is
+% very difficult to get at the `internals' of a paragraph such as the
+% individual lines in case you want to number them or put some mark at the
+% start or end of the lines.
+%
+% \Eledmac{} solves the problem of line numbering by putting the paragraph
+% in typeset form into a box, and then extracting the lines one by one
+% from the box for TeX to put them onto the page with the appropriate page
+% breaks. Most of the \Eledmac{} code is concerned with handling this box
+% and its contents.
+%
+% \Eledpar's solution to the problem of parallel texts is to put the two
+% texts into separate boxes, and then appropriately extract the pairs of
+% lines from the boxes. This involves duplicating
+% much of the original box code for an extra right text box. The other,
+% smaller,
+% part of the code is concerned with coordinating the line extractions from
+% the boxes.
+%
+% The package code is presented in roughly in the same order as in \Eledmac.
+%
+% \section{Preliminaries}
+% \label{preliminaries}\relax
+%
+% Announce the name and version of the package, which is
+% targetted for LaTeX2e. The package also requires the \Eledmac{}
+% package.
+%
+% \begin{macrocode}
+%<*code>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{eledpar}[2015/09/01 v1.17.1 eledmac extension for parallel texts]%
+
+% \end{macrocode}
+% Few commands use \cs{xspace} command.
+% \begin{macrocode}
+\RequirePackage{xspace}%
+% \end{macrocode}
+% With the option `shiftedpstarts' a long pstart one the left side (or in the right side) doesn't make a blank on the corresponding pstart, but the blank is put on the bottom of the page. Consequently, the pstarts on the parallel pages are shifted, but the shift stops at every end of pages.
+% The \cs{shiftedverses} is kept for backward compatibility.
+% \begin{macro}{\ifshiftedpstarts}
+% \begin{macrocode}
+\newif\ifshiftedpstarts
+\let\shiftedversestrue\shiftedpstartstrue
+\let\shiftedversesfalse\shiftedpstartsfalse
+\DeclareOption{shiftedverses}{\shiftedpstartstrue}
+\DeclareOption{shiftedpstarts}{\shiftedpstartstrue}
+% \end{macrocode}
+% \end{macro}
+% The \verb+parledgroup+ can be called either on \Eledmac or \Eledpar.
+% \begin{macrocode}
+\DeclareOption{parledgroup}{\parledgrouptrue}
+% \end{macrocode}
+% \begin{macro}{\ifwidthliketwocolumns}
+% The \cs{widthliketwocolumns} option can be called both in eledpar and eledmac.
+% \changes{v1.9.0}{2014/09/16}{Added widthliketwocolumns option}
+% \begin{macrocode}
+\DeclareOption{widthliketwocolumns}{\widthliketwocolumnstrue}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifsameparallelpagenumber}
+% \begin{macrocode}
+\newif\ifsameparallelpagenumber%
+\DeclareOption{sameparallelpagenumber}{\sameparallelpagenumbertrue}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\ProcessOptions%
+% \end{macrocode}
+% As noted above, much of the code is a duplication of the original
+% \Eledmac{} code to handle the extra box(es) for the right hand side text,
+% and sometimes for the left hand side as well. In order to distinguish
+% we use `R' or `L' in the names of macros for the right and left code.
+% The specifics of `L' and `R' are normally hidden from the user by
+% letting the \verb?Leftside? and \verb?Rightside? environments set things
+% up appropriately.
+%
+% \begin{macro}{\ifl@dpairing}
+% \begin{macro}{\ifl@dpaging}
+% \begin{macro}{\ifledRcol}
+% \cs{ifl@dpairing} is set TRUE if we are processing parallel texts and
+% \cs{ifl@dpaging} is also set TRUE if we are doing parallel pages.
+% \cs{ifledRcol} is set TRUE if we are doing the right hand text.
+% They are defined in \Lpack{eledmac}.
+% \changes{v0.3.0}{2005/02/24}{Moved \cs{ifl@dpairing} to eledmac}
+% \changes{v0.9.0}{2005/10/01}{Moved \cs{iflledRcol} and \cs{ifnumberingR} to eledmac}
+% \changes{v1.9.1}{2014/09/30}{Moved \cs{ifl@dpaging} to eledmac}
+% \changes{v1.13.0}{2015/03/06}{Remove false boolean settings which are not needed.}
+% \begin{macrocode}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\Lcolwidth}
+% \begin{macro}{\Rcolwidth}
+% The widths of the left and right parallel columns (or pages).
+% \begin{macrocode}
+\newdimen\Lcolwidth
+ \Lcolwidth=0.45\textwidth
+\newdimen\Rcolwidth
+ \Rcolwidth=0.45\textwidth
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Messages}
+%
+% All the error and warning messages are collected here as macros.
+%
+% \begin{macro}{\eledpar@error}
+% \changes{v1.8.2}{2014/08/15}{Errors specific to eledpar send to eledpar handbook}
+% \begin{macrocode}
+\newcommand{\eledpar@error}[2]{\PackageError{eledpar}{#1}{#2}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\led@err@TooManyPstarts}
+% \begin{macrocode}
+\newcommand*{\led@err@TooManyPstarts}{%
+ \eledpar@error{Too many \string\pstart\space without printing.
+ Some text will be lost}{\@ehc}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\led@err@BadLeftRightPstarts}
+% \begin{macrocode}
+\newcommand*{\led@err@BadLeftRightPstarts}[2]{%
+ \eledpar@error{The numbers of left (#1) and right (#2)
+ \string\pstart s do not match}{\@ehc}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\led@err@LeftOnRightPage}
+% \begin{macro}{\led@err@RightOnLeftPage}
+% \begin{macrocode}
+\newcommand*{\led@err@LeftOnRightPage}{%
+ \eledpar@error{The left page has ended on a right page}{\@ehc}}
+\newcommand*{\led@err@RightOnLeftPage}{%
+ \eledpar@error{The right page has ended on a left page}{\@ehc}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\led@err@Leftside@PreviousNotPrinted}
+% \begin{macro}{\led@err@Rightside@PreviousNotPrinted}
+% \begin{macrocode}
+\newcommand*{\led@err@Leftside@PreviousNotPrinted}{%
+ \eledpar@error{You call a new Leftside environment while the previous one has not been typeset by \string\Pages\space or \string\Columns}{\@ehc}}
+\newcommand*{\led@err@Rightside@PreviousNotPrinted}{%
+ \eledpar@error{You call a new Rightside environment while the previous one has not been typeset by \string\Pages\space or \string\Columns}{\@ehc}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\led@err@Pages@InsideEnv}
+% \begin{macro}{\led@err@Columns@InsideEnv}
+% \begin{macrocode}
+\newcommand*{\led@err@Pages@InsideEnv}{%
+ \eledpar@error{\string\Pages\space must be called *outside* of the `pages` environment}{\@ehc}}
+\newcommand*{\led@err@Columns@InsideEnv}{%
+ \eledpar@error{\string\Columns\space must be called *outside* of the `pairs` environment}{\@ehc}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \section{Sectioning commands}
+%
+% \begin{macro}{\section@numR}
+% This is the right side equivalent of \cs{section@num}.
+%
+% Each section will read and write an associated `line-list
+% file', containing information used to do the numbering. Normally
+% the file will be called \meta{jobname}\file{.nn}, where \file{nn} is the
+% section number. However, for right side texts the file is called
+% \meta{jobname}\file{.nnR}. The \cs{extensionchars} applies to the
+% right side files just as it does to the normal files.
+% \begin{macrocode}
+\newcount\section@numR
+ \section@numR=\z@
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\ifpst@rtedL}
+% \begin{macro}{\ifpst@rtedR}
+% \cs{ifpst@rtedL} is set FALSE at the start of left side numbering, and
+% similarly for \cs{ifpst@rtedR}.
+% \cs{ifpst@rtedL} is defined in \Lpack{eledmac}.
+% \changes{v0.3.0}{2005/02/24}{Moved \cs{ifpst@rtedL} to eledmac}
+% \begin{macrocode}
+ \pst@rtedLfalse
+\newif\ifpst@rtedR
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v1.8.0}{2014/07/24}{\cs{beginnumbering} is defined only on \Lpack{eledmac}, not on \Lpack{eledpar}.}
+%
+% \begin{macro}{\beginnumberingR}
+% This is the right text equivalent of \cs{beginnumbering}, and begins
+% a section of numbered text.
+% \begin{macrocode}
+\newcommand*{\beginnumberingR}{%
+ \ifnumberingR
+ \led@err@NumberingStarted
+ \endnumberingR
+ \fi
+ \global\l@dnumpstartsR \z@
+ \global\pst@rtedRfalse
+ \global\numberingRtrue
+ \global\advance\section@numR \@ne
+ \global\absline@numR \z@
+ \gdef\normal@page@breakR{}
+ \gdef\l@prev@pbR{}
+ \gdef\l@prev@nopbR{}
+ \global\line@numR \z@
+ \global\@lockR \z@
+ \global\sub@lockR \z@
+ \global\sublines@false
+ \global\let\next@page@numR\relax
+ \global\let\sub@change\relax
+ \message{Section \the\section@numR R }%
+ \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
+ \l@dend@stuff
+ \setcounter{pstartR}{1}
+ \begingroup
+ \initnumbering@sectcountR
+ \gdef\eled@sectionsR@@{}%
+ \if@noeled@sec\else%
+ \makeatletter\InputIfFileExists{\jobname.eledsec\the\section@numR R}{}{}\makeatother%
+ \immediate\openout\eled@sectioningR@out=\jobname.eledsec\the\section@numR R\relax%
+ \fi%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\endnumbering}
+% This is the left text version of the regular \cs{endnumbering} and must
+% follow the last text for a left text numbered section.
+% It sets \cs{ifpst@rtedL} to FALSE. It is fully defined in \Lpack{eledmac}.
+% \end{macro}
+%
+% \begin{macro}{\endnumberingR}
+% This is the right text equivalent of \cs{endnumbering} and must follow the
+% last text for a right text numbered section.
+% \begin{macrocode}
+\def\endnumberingR{%
+ \ifnumberingR
+ \global\numberingRfalse
+ \normal@pars
+ \ifnum\l@dnumpstartsR=0%
+ \led@err@NumberingWithoutPstart%
+ \fi%
+ \ifl@dpairing
+ \global\pst@rtedRfalse
+ \else
+ \ifx\insertlines@listR\empty\else
+ \global\noteschanged@true
+ \fi
+ \ifx\line@listR\empty\else
+ \global\noteschanged@true
+ \fi
+ \fi
+ \ifnoteschanged@
+ \led@mess@NotesChanged
+ \fi
+ \else
+ \led@err@NumberingNotStarted
+ \fi
+ \endgroup
+ \if@noeled@sec\else%
+ \immediate\closeout\eled@sectioningR@out%
+ \fi%
+ }
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\initnumbering@sectcountR}
+% \changes{v1.2.1}{2012/11/01}{For the right section, the counter is defined only once.}
+% We don't want the numbering of the right-side section commands to be continuous with the numbering of the left side,
+% we switch the \LaTeX\ counter in \cs{numberingR}.
+% \begin{macrocode}
+\newcounter{chapterR}
+\newcounter{sectionR}
+\newcounter{subsectionR}
+\newcounter{subsubsectionR}
+\newcommand{\initnumbering@sectcountR}{
+ \let\c@chapter\c@chapterR
+ \let\c@section\c@sectionR
+ \let\c@subsection\c@subsectionR
+ \let\c@subsubsection\c@subsubsectionR
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pausenumberingR}
+% \begin{macro}{\resumenumberingR}
+% These are the right text equivalents of \cs{pausenumbering} and
+% \cs{resumenumbering}.
+% \changes{v1.8.3}{2014/08/31}{Debug \cs{resumenumberingR}}
+% \begin{macrocode}
+\newcommand*{\pausenumberingR}{%
+ \endnumberingR\global\numberingRtrue}
+\newcommand*{\resumenumberingR}{%
+ \ifnumberingR
+ \global\pst@rtedRtrue
+ \global\advance\section@numR \@ne
+ \led@mess@SectionContinued{\the\section@numR R}%
+ \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
+ \l@dend@stuff
+ \begingroup%
+ \initnumbering@sectcountR%
+ \else
+ \led@err@numberingShouldHaveStarted
+ \endnumberingR
+ \beginnumberingR
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\memorydumpL}
+% \begin{macro}{\memorydumpR}
+% \cs{memorydump} is a shorthand for \cs{pausenumbering}\cs{resumenumbering}.
+% This will clear the memorised stuff for the previous chunks while
+% keeping the numbering going.
+% \begin{macrocode}
+\newcommand*{\memorydumpL}{%
+ \endnumbering
+ \numberingtrue
+ \global\pst@rtedLtrue
+ \global\advance\section@num \@ne
+ \led@mess@SectionContinued{\the\section@num}%
+ \line@list@stuff{\jobname.\extensionchars\the\section@num}%
+ \l@dend@stuff}
+\newcommand*{\memorydumpR}{%
+ \endnumberingR
+ \numberingRtrue
+ \global\pst@rtedRtrue
+ \global\advance\section@numR \@ne
+ \led@mess@SectionContinued{\the\section@numR R}%
+ \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
+ \l@dend@stuff}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \section{Line counting}
+% \label{lineation}\relax
+%
+% \subsection{Choosing the system of lineation}
+% \changes{v0.11.0}{2012/06/11}{Lineation can be by pstart (like in eledmac 0.15).}
+% \changes{v1.0.0}{2012/09/14}{Debug in lineation by pstart}
+% Sometimes you want line numbers that start at $1$ at the top of each
+% page; sometimes you want line numbers that start at $1$ at each \cs{pstart}; other times you want line numbers that start at $1$ at the start
+% of each section and increase regardless of page breaks.
+% \Eledpar{} lets you choose different schemes for the left and right texts.
+%
+% \begin{macro}{\ifbypstart@R}
+% \begin{macro}{\bypstart@Rtrue}
+% \begin{macro}{\bypstart@Rfalse}
+% \begin{macro}{\ifbypage@R}
+% \begin{macro}{\bypage@Rtrue}
+% \begin{macro}{\bypage@Rfalse}
+% The \cs{ifbypage@R} and \cs{ifbypstart@R} flag specifie the current lineation
+% system: \begin{itemize}
+% \item line-of-page : \verb|bypstart@R = false| and \verb|bypage@R = true|.
+% \item line-of-pstart : \verb|bypstart@R = true| and \verb|bypage@R = false|.
+% \end{itemize}
+% \Eledpar{} will use the line-of-section system unless instructed otherwise.
+% \begin{macrocode}
+\newif\ifbypage@R
+\newif\ifbypstart@R
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lineationR}
+% \cs{lineationR}\marg{word} is the macro used to select the
+% lineation system for right texts.
+% Its argument is a string: either \texttt{page}, \texttt{pstart} or \texttt{section}.
+% \changes{v1.15.0}{2015/04/13}{As \cs{lineation}, \cs{lineationR} automatically set the \cs{pstartinfootnote}.}
+% \begin{macrocode}
+\newcommand*{\lineationR}[1]{{%
+ \ifnumbering
+ \led@err@LineationInNumbered
+ \else
+ \def\@tempa{#1}\def\@tempb{page}%
+ \ifx\@tempa\@tempb
+ \global\bypage@Rtrue
+ \global\bypstart@Rfalse
+ \unless\ifnocritical@%
+ \pstartinfootnote[][false]%
+ \fi%
+ \else
+ \def\@tempb{pstart}%
+ \ifx\@tempa\@tempb
+ \global\bypage@Rfalse
+ \global\bypstart@Rtrue
+ \unless\ifnocritical@%
+ \pstartinfootnote%
+ \fi%
+ \else
+ \def@tempb{section}
+ \ifx\@tempa\@tempb
+ \global\bypage@Rfalse%
+ \global\bypstart@Rfalse%
+ \unless\ifnocritical@%
+ \pstartinfootnote[][false]%
+ \fi%
+ \else
+ \led@warn@BadLineation
+ \fi%
+ \fi
+ \fi
+ \fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lineation*}
+% \changes{v1.8.2}{2014/08/15}{Add \cs{lineation*}}
+% \cs{lineation*} change the lineation system for the side.
+% \begin{macrocode}
+\WithSuffix\newcommand\lineation*[1]{%
+ \lineation{#1}%
+ \lineationR{#1}%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\linenummargin}
+% \begin{macro}{\line@marginR}
+% You call \cs{linenummargin}\marg{word} to specify which margin you want your
+% right text's line numbers in; it takes one argument, a string.
+% You can put the line numbers in the same margin on every page using
+% \texttt{left} or \texttt{right}; or you can use \texttt{inner} or
+% \texttt{outer} to get them in the inner or outer margins.
+% You can change this within a numbered section, but the
+% change may not take effect just when you'd like; if it's done between
+% paragraphs nothing surprising should happen.
+%
+% For right texts the selection is recorded in the count \cs{line@marginR},
+% otherwise in the count \cs{line@margin}:
+% $0$ for left, $1$ for right, $2$ for outer, and $3$ for inner.
+% \changes{v0.3.a}{2005/03/30}{Don't just set \cs{line@marginR} in \cs{linenummargin}}
+% \begin{macrocode}
+\newcount\line@marginR
+\renewcommand*{\linenummargin}[1]{{%
+ \l@dgetline@margin{#1}%
+ \ifnum\@l@dtempcntb>\m@ne
+ \ifledRcol
+ \global\line@marginR=\@l@dtempcntb
+ \else
+ \global\line@margin=\@l@dtempcntb
+ \fi
+ \fi}}
+% \end{macrocode}
+% By default put right text numbers at the right.
+% \begin{macrocode}
+\line@marginR=\@ne
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\c@firstlinenumR}
+% \begin{macro}{\c@linenumincrementR}
+% The following counters tell \Eledmac{} which right text lines should be
+% printed with line numbers. \texttt{firstlinenum} is the number of the
+% first line in each section that gets a number;
+% \texttt{linenumincrement}
+% is the difference between successive numbered lines. The initial
+% values of these counters produce labels on lines $5$, $10$, $15$, etc.
+% \texttt{linenumincrement} must be at least $1$.
+%
+% \begin{macrocode}
+\newcounter{firstlinenumR}
+ \setcounter{firstlinenumR}{5}
+\newcounter{linenumincrementR}
+ \setcounter{linenumincrementR}{5}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\c@firstsublinenumR}
+% \begin{macro}{\c@sublinenumincrementR}
+% The following parameters are just like \texttt{firstlinenumR} and
+% \texttt{linenumincrementR}, but for sub-line numbers.
+% \texttt{sublinenumincrementR} must be at least $1$.
+%
+% \begin{macrocode}
+\newcounter{firstsublinenumR}
+ \setcounter{firstsublinenumR}{5}
+\newcounter{sublinenumincrementR}
+ \setcounter{sublinenumincrementR}{5}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\firstlinenum}
+% \begin{macro}{\linenumincrement}
+% \begin{macro}{\firstsublinenum}
+% \begin{macro}{\sublinenumincrement}
+% \begin{macro}{\firstlinenum*}
+% \begin{macro}{\linenumincrement*}
+% \begin{macro}{\firstsublinenum*}
+% \begin{macro}{\sublinenumincrement*}
+% \changes{v1.5.0}{2013/11/08}{Add starred version of \cs{firstlinenum}, \cs{linenumincrement}, \cs{firstsublinenum}, \cs{sublinenumincrement} to change both Left and Rightside.}
+% These are the user's macros for changing (sub) line numbers. They are
+% defined in \Lpack{eledmac} v0.7, but just in case
+% I have started by \cs{provide}ing them.
+% The starred versions are specifi to \Lpack{eledpar}.
+% \begin{macrocode}
+\providecommand*{\firstlinenum}{}
+\providecommand*{\linenumincrement}{}
+\providecommand*{\firstsublinenum}{}
+\providecommand*{\sublinenumincrement}{}
+\renewcommand*{\firstlinenum}[1]{%
+ \ifledRcol \setcounter{firstlinenumR}{#1}%
+ \else \setcounter{firstlinenum}{#1}%
+ \fi}
+\renewcommand*{\linenumincrement}[1]{%
+ \ifledRcol \setcounter{linenumincrementR}{#1}%
+ \else \setcounter{linenumincrement}{#1}%
+ \fi}
+\renewcommand*{\firstsublinenum}[1]{%
+ \ifledRcol \setcounter{firstsublinenumR}{#1}%
+ \else \setcounter{firstsublinenum}{#1}%
+ \fi}
+\renewcommand*{\sublinenumincrement}[1]{%
+ \ifledRcol \setcounter{sublinenumincrementR}{#1}%
+ \else \setcounter{sublinenumincrement}{#1}%
+ \fi}
+\WithSuffix\newcommand\firstlinenum*[1]{\setcounter{firstlinenumR}{#1}\setcounter{firstlinenum}{#1}}
+\WithSuffix\newcommand\linenumincrement*[1]{\setcounter{linenumincrementR}{#1}\setcounter{linenumincrement}{#1}}
+\WithSuffix\newcommand\firstsublinenum*[1]{\setcounter{subfirstlinenumR}{#1}\setcounter{subfirstlinenum}{#1}}
+\WithSuffix\newcommand\sublinenumincrement*[1]{\setcounter{sublinenumincrementR}{#1}\setcounter{sublinenumincrement}{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\Rlineflag}
+% This is appended to the line numbers of right text.
+% \begin{macrocode}
+\newcommand*{\Rlineflag}{R}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\linenumrepR}
+% \begin{macro}{\sublinenumrepR}
+% \cs{linenumrepR}\marg{ctr} typesets the right line number \meta{ctr}, and
+% similarly \cs{sublinenumrepR} for subline numbers.
+% \changes{v0.3.0}{2005/02/10}{Added \cs{linenumrepR} and \cs{sublinenumrepR}}
+% \begin{macrocode}
+\newcommand*{\linenumrepR}[1]{\@arabic{#1}}
+\newcommand*{\sublinenumrepR}[1]{\@arabic{#1}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\leftlinenumR}
+% \begin{macro}{\rightlinenumR}
+% \begin{macro}{\l@dlinenumR}
+% \cs{leftlinenumR} and \cs{rightlinenumR} are the macros that are
+% called to print the right text's marginal line numbers. Much of the
+% code for these is common and is maintained in \cs{l@dlinenumR}.
+% \changes{v0.3.0}{2005/02/10}{Simplified \cs{leftlinenumR} and
+% \cs{rightlinenumR} by introducing \cs{l@dlinenumR}}
+% \begin{macrocode}
+\newcommand*{\leftlinenumR}{%
+ \l@dlinenumR
+ \kern\linenumsep}
+\newcommand*{\rightlinenumR}{%
+ \kern\linenumsep
+ \l@dlinenumR}
+\newcommand*{\l@dlinenumR}{%
+ \numlabfont\linenumrepR{\line@numR}\Rlineflag%
+ \ifsublines@
+ \ifnum\subline@num>\z@
+ \unskip\fullstop\sublinenumrepR{\subline@numR}%
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsection{Line-number counters and lists}
+% \subsubsection{Correspond to those in \Lpack{eledmac} for regular or left text}
+% We need another set of counters and lists for the right text,
+% corresponding to those in \Lpack{eledmac} for regular or left text.
+%
+% \begin{macro}{\line@numR}
+% \begin{macro}{\subline@numR}
+% \begin{macro}{\absline@numR}
+% The count \cs{line@numR} stores the line number that's used in
+% the right text's marginal line numbering and in notes.
+% The count \cs{subline@numR} stores
+% a sub-line number that qualifies \cs{line@numR}.
+% The count \cs{absline@numR} stores the
+% absolute number of lines since the start
+% of the right text section: that is, the number we've actually printed,
+% no matter what numbers we attached to them.
+%
+% \begin{macrocode}
+\newcount\line@numR
+\newcount\subline@numR
+\newcount\absline@numR
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\line@listR}
+% \begin{macro}{\insertlines@listR}
+% \begin{macro}{\actionlines@listR}
+% \begin{macro}{\actions@listR}
+% Now we can define the list macros that will be created from the
+% line-list file. They are directly analagous to the left text ones.
+% The full list of action codes and their meanings is given in the \Eledmac{}
+% manual.
+%
+% Here are the commands to create these lists:
+%
+% \begin{macrocode}
+\list@create{\line@listR}
+\list@create{\insertlines@listR}
+\list@create{\actionlines@listR}
+\list@create{\actions@listR}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\page@numR}
+% The right text page number.
+% \begin{macrocode}
+\newcount\page@numR
+
+% \end{macrocode}
+% \end{macro}
+% \subsubsection{Specific to \Lpack{eledpar}}
+% \begin{macro}{\linesinpar@listL}
+% \begin{macro}{\linesinpar@listR}
+% \begin{macro}{\maxlinesinpar@list}
+% In order to synchonise left and right chunks in parallel processing
+% we need to know how many lines are in each left and right text chunk,
+% and the maximum of these for each pair of chunks.
+% \begin{macrocode}
+\list@create{\linesinpar@listL}
+\list@create{\linesinpar@listR}
+\list@create{\maxlinesinpar@list}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsection{Reading the line-list file}
+%
+%
+% \begin{macro}{\read@linelist}
+% \cs{read@linelist}\marg{file} is the control sequence
+% that's called by \cs{beginnumbering}
+% (via \cs{line@list@stuff}) to open and process a
+% line-list file; its argument is the name of the file.
+% \phantomsection\label{readlinelist}
+% \begin{macrocode}
+\renewcommand*{\read@linelist}[1]{%
+% \end{macrocode}
+% We do do different things depending whether or not we are processing
+% right text
+% \begin{macrocode}
+ \ifledRcol
+ \list@clear{\line@listR}%
+ \list@clear{\insertlines@listR}%
+ \list@clear{\actionlines@listR}%
+ \list@clear{\actions@listR}%
+ \list@clear{\linesinpar@listR}%
+ \list@clear{\linesonpage@listR}
+ \else
+ \list@clearing@reg
+ \list@clear{\linesinpar@listL}%
+ \list@clear{\linesonpage@listL}%
+ \fi
+% \end{macrocode}
+%
+% Make sure that the \cs{maxlinesinpar@list} is empty (otherwise things
+% will be thrown out of kilter if there is any old stuff still hanging
+% in there).
+% \begin{macrocode}
+ \list@clear{\maxlinesinpar@list}
+% \end{macrocode}
+% Now get the file and interpret it.
+% \begin{macrocode}
+ \get@linelistfile{#1}%
+ \endgroup
+% \end{macrocode}
+%
+% When the reading is done, we're all through with the
+% line-list file. All the information we needed
+% from it will now be encoded in our list macros.
+% Finally, we
+% initialize the \cs{next@actionline} and \cs{next@action} macros,
+% which specify where and what the next action to be taken is.
+% \begin{macrocode}
+ \ifledRcol
+ \global\page@numR=\m@ne
+ \ifx\actionlines@listR\empty
+ \gdef\next@actionlineR{1000000}%
+ \else
+ \gl@p\actionlines@listR\to\next@actionlineR
+ \gl@p\actions@listR\to\next@actionR
+ \fi
+ \else
+ \global\page@num=\m@ne
+ \ifx\actionlines@list\empty
+ \gdef\next@actionline{1000000}%
+ \else
+ \gl@p\actionlines@list\to\next@actionline
+ \gl@p\actions@list\to\next@action
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% This version of \cs{read@linelist} creates list macros
+% containing data for the entire section, so they could get rather
+% large. The \cs{memorydump} macro is available if you run into
+% macro memory limitations.
+%
+% \subsection{Commands within the line-list file}
+%
+% This section defines the commands that can appear within a
+% line-list file, except for \cs{@lab} which is in a
+% later section among the cross-referencing commands it is
+% associated with.
+%
+% The macros with \verb"action" in their names contain all the code
+% that modifies the action-code list.
+% \begin{macro}{\@nl@regR}
+% \begin{macro}{\@nl}
+% \cs{@nl} does everything related to the start of a
+% new line of numbered text. Exactly what it does depends
+% on whether right text is being processed.
+%
+% \begin{macrocode}
+\newcommand{\@nl@regR}{%
+ \ifx\l@dchset@num\relax \else
+ \advance\absline@numR \@ne
+ \set@line@action
+ \let\l@dchset@num\relax
+ \advance\absline@numR \m@ne
+ \advance\line@numR \m@ne% % do we need this?
+ \fi
+ \advance\absline@numR \@ne
+ \ifx\next@page@numR\relax \else
+ \page@action
+ \let\next@page@numR\relax
+ \fi
+ \ifx\sub@change\relax \else
+ \ifnum\sub@change>\z@
+ \sublines@true
+ \else
+ \sublines@false
+ \fi
+ \sub@action
+ \let\sub@change\relax
+ \fi
+ \ifcase\@lockR
+ \or
+ \@lockR \tw@
+ \or\or
+ \@lockR \z@
+ \fi
+ \ifcase\sub@lockR
+ \or
+ \sub@lockR \tw@
+ \or\or
+ \sub@lockR \z@
+ \fi
+ \ifsublines@
+ \ifnum\sub@lockR<\tw@
+ \advance\subline@numR \@ne
+ \fi
+ \else
+ \ifnum\@lockR<\tw@
+ \advance\line@numR \@ne \subline@numR \z@
+ \fi
+ \fi}
+
+\renewcommand*{\@nl}[2]{%
+ \fix@page{#1}%
+ \ifledRcol
+ \@nl@regR
+ \else
+ \@nl@reg
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\last@page@numR}
+% \begin{macro}{\fix@page}
+% We have to adjust \cs{fix@page} to handle parallel texts.
+%
+% \begin{macrocode}
+\newcount\last@page@numR
+ \last@page@numR=-10000
+\renewcommand*{\fix@page}[1]{%
+ \ifledRcol
+ \ifnum #1=\last@page@numR
+ \else
+ \ifbypage@R
+ \line@numR \z@ \subline@numR \z@
+ \fi
+ \page@numR=#1\relax
+ \last@page@numR=#1\relax
+ \def\next@page@numR{#1}%
+ \fi
+ \else
+ \ifnum #1=\last@page@num
+ \else
+ \ifbypage@
+ \line@num \z@ \subline@num \z@
+ \fi
+ \page@num=#1\relax
+ \last@page@num=#1\relax
+ \def\next@page@num{#1}%
+ \listxadd{\normal@page@break}{\the\absline@num}
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\@adv}
+% The \cs{@adv}\marg{num} macro advances
+% the current visible line number by the amount specified as
+% its argument. This is used to implement \cs{advanceline}.
+% \begin{macrocode}
+\renewcommand*{\@adv}[1]{%
+ \ifsublines@
+ \ifledRcol
+ \advance\subline@numR by #1\relax
+ \ifnum\subline@numR<\z@
+ \led@warn@BadAdvancelineSubline
+ \subline@numR \z@
+ \fi
+ \else
+ \advance\subline@num by #1\relax
+ \ifnum\subline@num<\z@
+ \led@warn@BadAdvancelineSubline
+ \subline@num \z@
+ \fi
+ \fi
+ \else
+ \ifledRcol
+ \advance\line@numR by #1\relax
+ \ifnum\line@numR<\z@
+ \led@warn@BadAdvancelineLine
+ \line@numR \z@
+ \fi
+ \else
+ \advance\line@num by #1\relax
+ \ifnum\line@num<\z@
+ \led@warn@BadAdvancelineLine
+ \line@num \z@
+ \fi
+ \fi
+ \fi
+ \set@line@action}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@set}
+% The \cs{@set}\marg{num} macro sets
+% the current visible line number to the value specified as
+% its argument. This is used to implement \cs{setline}.
+% \begin{macrocode}
+\renewcommand*{\@set}[1]{%
+ \ifledRcol
+ \ifsublines@
+ \subline@numR=#1\relax
+ \else
+ \line@numR=#1\relax
+ \fi
+ \set@line@action
+ \else
+ \ifsublines@
+ \subline@num=#1\relax
+ \else
+ \line@num=#1\relax
+ \fi
+ \set@line@action
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@d@set}
+% \begin{macro}{\l@dchset@num}
+% The \cs{l@d@set}\marg{num} macro sets
+% the line number for the next \verb?\pstart...? to the value specified as
+% its argument. This is used to implement \cs{setlinenum}.
+%
+% \verb?\l@dchset@num? is a flag to the \verb?\@l? macro. If it is not
+% \verb?\relax? then a linenumber change is to be done.
+% \begin{macrocode}
+\renewcommand*{\l@d@set}[1]{%
+ \ifledRcol
+ \line@numR=#1\relax
+ \advance\line@numR \@ne
+ \def\l@dchset@num{#1}
+ \else
+ \line@num=#1\relax
+ \advance\line@num \@ne
+ \def\l@dchset@num{#1}
+ \fi}
+\let\l@dchset@num\relax
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\page@action}
+% \cs{page@action}
+% adds an entry to the action-code list to change the page number.
+% \begin{macrocode}
+\renewcommand*{\page@action}{%
+ \ifledRcol
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \xright@appenditem{\next@page@numR}\to\actions@listR
+ \else
+ \xright@appenditem{\the\absline@num}\to\actionlines@list
+ \xright@appenditem{\next@page@num}\to\actions@list
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\set@line@action}
+% \cs{set@line@action} adds an entry to the action-code
+% list to change the visible line number.
+% \begin{macrocode}
+\renewcommand*{\set@line@action}{%
+ \ifledRcol
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \ifsublines@
+ \@l@dtempcnta=-\subline@numR
+ \else
+ \@l@dtempcnta=-\line@numR
+ \fi
+ \advance\@l@dtempcnta by -5000\relax
+ \xright@appenditem{\the\@l@dtempcnta}\to\actions@listR
+ \else
+ \xright@appenditem{\the\absline@num}\to\actionlines@list
+ \ifsublines@
+ \@l@dtempcnta=-\subline@num
+ \else
+ \@l@dtempcnta=-\line@num
+ \fi
+ \advance\@l@dtempcnta by -5000\relax
+ \xright@appenditem{\the\@l@dtempcnta}\to\actions@list
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sub@action}
+% \cs{sub@action}
+% adds an entry to the action-code list to turn sub-lineation on or
+% off, according to the current value of the \cs{ifsublines@} flag.
+% \begin{macrocode}
+\renewcommand*{\sub@action}{%
+ \ifledRcol
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \ifsublines@
+ \xright@appenditem{-1001}\to\actions@listR
+ \else
+ \xright@appenditem{-1002}\to\actions@listR
+ \fi
+ \else
+ \xright@appenditem{\the\absline@num}\to\actionlines@list
+ \ifsublines@
+ \xright@appenditem{-1001}\to\actions@list
+ \else
+ \xright@appenditem{-1002}\to\actions@list
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\do@lockon}
+% \begin{macro}{\do@lockonR}
+% \cs{lock@on}
+% adds an entry to the action-code list to turn line number
+% locking on. The current setting of the sub-lineation flag tells us
+% whether this applies to line numbers or sub-line numbers.
+% \begin{macrocode}
+\newcount\@lockR
+\newcount\sub@lockR
+
+\newcommand*{\do@lockonR}{%
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \ifsublines@
+ \xright@appenditem{-1005}\to\actions@listR
+ \ifnum\sub@lockR=\z@
+ \sub@lockR \@ne
+ \else
+ \ifnum\sub@lockR=\thr@@
+ \sub@lockR \@ne
+ \fi
+ \fi
+ \else
+ \xright@appenditem{-1003}\to\actions@listR
+ \ifnum\@lockR=\z@
+ \@lockR \@ne
+ \else
+ \ifnum\@lockR=\thr@@
+ \@lockR \@ne
+ \fi
+ \fi
+ \fi}
+
+\renewcommand*{\do@lockon}{%
+ \ifx\next\lock@off
+ \global\let\lock@off=\skip@lockoff
+ \else
+ \ifledRcol
+ \do@lockonR
+ \else
+ \do@lockonL
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lock@off}
+% \begin{macro}{\do@lockoff}
+% \begin{macro}{\do@lockoffR}
+% \begin{macro}{\skip@lockoff}
+% \cs{lock@off} adds an entry to the action-code list
+% to turn line number locking off.
+% \begin{macrocode}
+
+
+\newcommand{\do@lockoffR}{%
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \ifsublines@
+ \xright@appenditem{-1006}\to\actions@listR
+ \ifnum\sub@lockR=\tw@
+ \sub@lockR \thr@@
+ \else
+ \sub@lockR \z@
+ \fi
+ \else
+ \xright@appenditem{-1004}\to\actions@listR
+ \ifnum\@lockR=\tw@
+ \@lockR \thr@@
+ \else
+ \@lockR \z@
+ \fi
+ \fi}
+
+\renewcommand*{\do@lockoff}{%
+ \ifledRcol
+ \do@lockoffR
+ \else
+ \do@lockoffL
+ \fi}
+\global\let\lock@off=\do@lockoff
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\n@num}
+% \changes{v1.15.0}{2015/04/13}{\cs{n@num} defined only one time for both \Eledmac{} and \Eledpar{}.}
+% \end{macro}
+%
+% \begin{macro}{\@ref}
+% \begin{macro}{\insert@countR}
+% \cs{@ref}
+% marks the start of a passage, for creation of a footnote reference.
+% It takes two arguments:
+% \begin{itemize}\addtolength{\itemsep}{-1ex}
+% \item \verb"#1", the number of entries to add to \cs{insertlines@list}
+% for this reference. \SpecialMainIndex{\insert@count}
+% This value for right text, here and within \cs{edtext},
+% which computes it and writes it to the line-list file,
+% will be stored in the count \cs{insert@countR}.
+% \begin{macrocode}
+\newcount\insert@countR
+% \end{macrocode}
+%
+% \item \verb"#2", a sequence of other line-list-file commands, executed to
+% determine the ending line-number. (This may also include other
+% \cs{@ref} commands, corresponding to uses of \cs{edtext}
+% within the first argument of another instance of \cs{edtext}.)
+% \end{itemize}
+%
+% The first thing \cs{@ref} itself does is to add the specified number
+% of items to the \cs{insertlines@list} list.
+% \begin{macrocode}
+\renewcommand*{\@ref}[2]{%
+ \ifledRcol
+ \global\advance\@edtext@level by 1%
+ \global\insert@countR=#1\relax
+ \loop\ifnum\insert@countR>\z@
+ \xright@appenditem{\the\absline@numR}\to\insertlines@listR
+ \global\advance\insert@countR \m@ne
+ \repeat
+% \end{macrocode}
+%
+% Next, process the second argument to determine the page
+% and line numbers for the end of this lemma.
+% We temporarily equate \cs{@ref} to a different macro that just executes
+% its argument, so that nested \cs{@ref} commands are just skipped
+% this time. Some other macros need to be temporarily redefined to
+% suppress their action.
+% \begin{macrocode}
+ \begingroup
+ \let\@ref=\dummy@ref
+ \let\@lopR\@gobble
+ \let\page@action=\relax
+ \let\sub@action=\relax
+ \let\set@line@action=\relax
+ \let\@lab=\relax
+ \let\@lemma=\relax
+ \let\@sw\@gobblethree%
+ #2
+ \global\endpage@num=\page@numR
+ \global\endline@num=\line@numR
+ \global\endsubline@num=\subline@numR
+ \endgroup
+% \end{macrocode}
+%
+% Now store all the information about the location of the lemma's
+% start and end in \cs{line@list}.
+% \begin{macrocode}
+ \xright@appenditem%
+ {\the\page@numR|\the\line@numR|%
+ \ifsublines@ \the\subline@numR \else 0\fi|%
+ \the\endpage@num|\the\endline@num|%
+ \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@listR
+% \end{macrocode}
+% Create a list which will store all the second argument of each \cs{@sw}
+% in this lemma, at this level.
+% \begin{macrocode}
+ \expandafter\list@create\expandafter{\csname sw@list@edtext@tmp@\the\@edtext@level\endcsname}%
+% \end{macrocode}
+% Declare and init boolean for lemma in this level.
+% \begin{macrocode}
+ \providebool{lemmacommand@\the\@edtext@level}%
+ \boolfalse{lemmacommand@\the\@edtext@level}%
+% \end{macrocode}
+% Execute the second argument of \cs{@ref} again,
+% to perform for real all the commands within it.
+% \begin{macrocode}
+ #2
+% Now, we store the list of \cs{@sw} of this current \cs{edtext} as an element of
+% the global list of list of \cs{@sw} for a \cs{edtext} depth.
+% \begin{macrocode}
+ \ifnum\@edtext@level>0%
+ \def\create@this@edtext@level{\expandafter\list@create\expandafter{\csname sw@list@edtextR@\the\@edtext@level\endcsname}}%
+ \ifcsundef{sw@list@edtextR@\the\@edtext@level}{\create@this@edtext@level}{}%
+ \letcs{\@tmp}{sw@list@edtextR@\the\@edtext@level}%
+ \letcs{\@tmpp}{sw@list@edtext@tmp@\the\@edtext@level}%
+ \xright@appenditem{\expandonce\@tmpp}\to\@tmp%
+ \global\cslet{sw@list@edtextR@\the\@edtext@level}{\@tmp}%
+ \fi%
+% \end{macrocode}
+% Decrease edtext level counter.
+% \begin{macrocode}
+ \global\advance\@edtext@level by -1%
+% \end{macrocode}
+% \begin{macrocode}
+ \else
+% \end{macrocode}
+% And when not in right text
+% \begin{macrocode}
+ \@ref@reg{#1}{#2}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@pend}
+% \begin{macro}{\@pendR}
+% \cs{@pend}\marg{num} adds its argument to the \cs{linesinpar@listL}
+% list, and analagously for \cs{@pendR}. If needed, it resets line number. We start off with a
+% \cs{providecommand} just in case an older version of \Eledmac{} is being
+% used which does not define these macros.
+% \begin{macrocode}
+\providecommand*{\@pend}[1]{}
+\renewcommand*{\@pend}[1]{%
+ \ifbypstart@\global\line@num=0\fi%
+ \xright@appenditem{#1}\to\linesinpar@listL}
+\providecommand*{\@pendR}[1]{}
+\renewcommand*{\@pendR}[1]{%
+ \ifbypstart@R\global\line@numR=0\fi
+ \xright@appenditem{#1}\to\linesinpar@listR}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@lopL}
+% \begin{macro}{\@lopR}
+% \cs{@lopL}\marg{num} adds its argument to the \cs{linesonpage@listL}
+% list, and analagously for \cs{@lopR}. We start off with a
+% \cs{providecommand} just in case an older version of \Eledmac{} is being
+% used which does not define these macros.
+% \begin{macrocode}
+\providecommand*{\@lopL}[1]{}
+\renewcommand*{\@lopL}[1]{%
+ \xright@appenditem{#1}\to\linesonpage@listL}
+\providecommand*{\@lopR}[1]{}
+\renewcommand*{\@lopR}[1]{%
+ \xright@appenditem{#1}\to\linesonpage@listR}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Writing to the line-list file}
+%
+% We've now defined all the counters, lists, and commands involved in
+% reading the line-list file at the start of a section. Now we'll
+% cover the commands that \Eledmac{} uses within the text of a
+% section to write commands out to the line-list.
+%
+% \begin{macro}{\linenum@outR}
+% The file for right texts will be opened on output stream \cs{linenum@outR}.
+% \begin{macrocode}
+\newwrite\linenum@outR
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\iffirst@linenum@out@R}
+% \begin{macro}{\first@linenum@out@Rtrue}
+% \begin{macro}{\first@linenum@out@Rfalse}
+% Once any file is opened on this stream, we keep it open forever, or
+% else switch to another file that we keep open.
+% \begin{macrocode}
+\newif\iffirst@linenum@out@R
+ \first@linenum@out@Rtrue
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\line@list@stuffR}
+% This is the right text version of the \cs{line@list@stuff}\marg{file}
+% macro. It is called by \cs{beginnumberingR} and performs
+% all the line-list operations needed at the start of a section.
+% Its argument is the name of the line-list file.
+% \changes{v1.10.1}{2015/01/16}{Revert modification of 1.4.2, which makes bugs with numbering. Leave vertical mode to solve spurious space before minipage.}
+% \begin{macrocode}
+\newcommand*{\line@list@stuffR}[1]{%
+ \read@linelist{#1}%
+ \iffirst@linenum@out@R
+ \immediate\closeout\linenum@outR
+ \global\first@linenum@out@Rfalse
+ \immediate\openout\linenum@outR=#1
+ \immediate\write\linenum@outR{\string\line@list@version{\this@line@list@version}}%
+ \else
+ \if@minipage%
+ \leavevmode%
+ \fi%
+ \closeout\linenum@outR%
+ \openout\linenum@outR=#1%
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\new@lineL}
+% The \cs{new@lineL} macro sends the \cs{@nl} command to the left text
+% line-list file, to mark the start of a new text line.
+% \begin{macrocode}
+\newcommand*{\new@lineL}{%
+ \write\linenum@out{\string\@nl[\the\c@page][\thepage]}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\new@lineR}
+% The \cs{new@lineR} macro sends the \cs{@nl} command to the right text
+% line-list file, to mark the start of a new text line.
+% \begin{macrocode}
+\newcommand*{\new@lineR}{%
+ \write\linenum@outR{\string\@nl[\the\c@page][\thepage]}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\flag@start}
+% \begin{macro}{\flag@end}
+% We enclose a lemma marked by \cs{edtext} in
+% \cs{flag@start} and \cs{flag@end}: these send the \cs{@ref}
+% command to the line-list file.
+% \changes{v0.3.0}{2005/02/04}{Removed extraneous spaces from\cs{flag@end}}
+% \changes{v1.8.2}{2014/08/15}{\cs{flag@start} and \cs{flag@end} are now defined only one time for eledmac and eledpar}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\startsub}
+% \begin{macro}{\endsub}
+% \cs{startsub} and \cs{endsub}
+% turn sub-lineation on and off, by writing
+% appropriate instructions to the line-list file.
+% \begin{macrocode}
+\renewcommand*{\startsub}{\dimen0\lastskip
+ \ifdim\dimen0>0pt \unskip \fi
+ \ifledRcol \write\linenum@outR{\string\sub@on}%
+ \else \write\linenum@out{\string\sub@on}%
+ \fi
+ \ifdim\dimen0>0pt \hskip\dimen0 \fi}
+\def\endsub{\dimen0\lastskip
+ \ifdim\dimen0>0pt \unskip \fi
+ \ifledRcol \write\linenum@outR{\string\sub@off}%
+ \else \write\linenum@out{\string\sub@off}%
+ \fi
+ \ifdim\dimen0>0pt \hskip\dimen0 \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\advanceline}
+% You can use \cs{advanceline}\marg{num}
+% in running text to advance the current visible
+% line-number by a specified value, positive or negative.
+% \begin{macrocode}
+\renewcommand*{\advanceline}[1]{%
+ \ifledRcol \write\linenum@outR{\string\@adv[#1]}%
+ \else \write\linenum@out{\string\@adv[#1]}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setline}
+% You can use \cs{setline}\marg{num}
+% in running text (i.e., within \verb?\pstart...\pend?) to set the
+% current visible
+% line-number to a specified positive value.
+% \begin{macrocode}
+\renewcommand*{\setline}[1]{%
+ \ifnum#1<\z@
+ \led@warn@BadSetline
+ \else
+ \ifledRcol \write\linenum@outR{\string\@set[#1]}%
+ \else \write\linenum@out{\string\@set[#1]}%
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setlinenum}
+% You can use \cs{setlinenum}\marg{num}
+% before a \verb?\pstart? to set the visible line-number to a specified
+% positive value. It writes a \verb?\l@d@set? command to the line-list file.
+% \begin{macrocode}
+\renewcommand*{\setlinenum}[1]{%
+ \ifnum#1<\z@
+ \led@warn@BadSetlinenum
+ \else
+ \ifledRcol \write\linenum@outR{\string\l@d@set[#1]}
+ \else \write\linenum@out{\string\l@d@set[#1]} \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\startlock}
+% \begin{macro}{\endlock}
+% You can use \cs{startlock} or \cs{endlock}
+% in running text to start or end line number locking at
+% the current line. They decide whether line numbers or sub-line numbers
+% are affected, depending on the current state of the sub-lineation flags.
+% \begin{macrocode}
+\renewcommand*{\startlock}{%
+ \ifledRcol \write\linenum@outR{\string\lock@on}%
+ \else \write\linenum@out{\string\lock@on}%
+ \fi}
+\def\endlock{%
+ \ifledRcol \write\linenum@outR{\string\lock@off}%
+ \else \write\linenum@out{\string\lock@off}%
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\skipnumbering}
+% \changes{v1.15.0}{2015/04/13}{\cs{skipnumbering} defined only one time for both \Eledmac{} and \Eledpar{}}
+% \end{macro}
+%
+%
+% \section{Marking text for notes}
+% \label{text}\relax
+%
+% The \cs{edtext} (or \cs{critext}) macro is used to create all
+% footnotes and endnotes,
+% as well as to print the portion of the main text to which a given note
+% or notes is keyed. The idea is to have that lemma appear only once in
+% the \file{.tex} file: all instances of it in the main text and in the
+% notes are copied from that one appearance.
+%
+% \cs{critext} requires two arguments. At any point within numbered
+% text, you use it by saying:
+% \begin{verbatim}
+% \critext{#1}#2/
+% \end{verbatim}
+% Similarly \cs{edtext} requires the same two arguments
+% but you use it by saying:
+% \begin{verbatim}
+% \edtext{#1}{#2}
+% \end{verbatim}
+%
+
+% \begin{macro}{\critext}
+% \begin{macro}{\edtext}
+% \changes{v1.3.0}{2012/11/16}{Manage RTL language.}
+% \changes{v1.11.0}{2014/01/22}{\cs{critext} and \cs{edtext} are now defined only in eledmac.}
+% And similarly for \cs{edtext}.
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\set@line}
+% The \cs{set@line} macro
+% is called by \cs{edtext} to put the line-reference field and
+% font specifier for the current block of text into \cs{l@d@nums}.
+% \begin{macrocode}
+\renewcommand*{\set@line}{%
+ \ifledRcol
+ \ifx\line@listR\empty
+ \global\noteschanged@true
+ \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}%
+ \else
+ \gl@p\line@listR\to\@tempb
+ \xdef\l@d@nums{\@tempb|\edfont@info}%
+ \global\let\@tempb=\undefined
+ \fi
+ \else
+ \ifx\line@list\empty
+ \global\noteschanged@true
+ \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}%
+ \else
+ \gl@p\line@list\to\@tempb
+ \xdef\l@d@nums{\@tempb|\edfont@info}%
+ \global\let\@tempb=\undefined
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \subsection{Specific hooks and commands for notes}
+% The \Lpack{eledmac} \cs{newseries@} initalizes commands which are linked to notes series.
+% However, to keep \Lpack{eledmac} as light as possible, it does not define commands which are specific to \Lpack{eledpar}.
+% This is what does \cs{newseries@eledpar}. The specific hooks are also defined here.
+% \begin{macro}{\newseries@eledpar}
+% \begin{macrocode}
+\newcommand{\newseries@eledpar}[1]{%
+% \end{macrocode}
+% \subsubsection{Notes to be printed on one side only}
+% \Lpack{eledpar} allows notes to be printed on one side only.
+% We need to declare these options.
+% We also need boolean flags, and to set them to true when a note series is not printed on one side.
+% We check the \verb+nofamiliar+ and \verb+nocritical+ \Eledmac{} options.
+% \changes{v1.16.0}{2015/05/18}{Fix bug with \cs{onlysideX}.}
+% \begin{macrocode}
+ \unless\ifnofamiliar@%
+ \csgdef{onlysideX@#1}{}%
+ \global\newbool{keepforsideX@#1}%
+ \fi%
+ \unless\ifnocritical@%
+ \global\newbool{keepforXside@#1}%
+ \csgdef{onlyXside@#1}{}%
+ \fi%
+% \end{macrocode}
+% \subsubsection{Familiar footnotes without marks}
+% The \cs{footnoteXnomk} commands are for notes which are printed on the left side, while they are called in the right side.
+% Basically, they set first toggle \cs{nomark@} to true, then call the \cs{footnoteX}.
+% and finally add the footnote counter in the footnote counter list.
+%
+% First, check the \verb+nofamiliar+ option of \Eledmac{}
+% \begin{macrocode}
+ \unless\ifnofamiliar@%
+% So declare the list.
+% \begin{macrocode}
+ \expandafter\list@create\csname footnote#1@mk\endcsname%
+% \end{macrocode}
+% Then, declare the \cs{footnoteXnomk} command.
+% \begin{macrocode}
+ \expandafter\newcommand\csname footnote#1nomk\endcsname[1]{%
+% \end{macrocode}
+% First step: just call the normal \cs{footnoteX}, saying that we don't want to print the mark.
+% \begin{macrocode}
+ \toggletrue{nomk@}%
+ \csuse{footnote#1}{##1}%
+ \togglefalse{nomk@}%
+% \end{macrocode}
+% Second, and last, step: store the footnote counter in the footnote counters list.
+% We use some \cs{let}, because \cs{xright@appenditem} is difficult to use with \cs{expandafter}.
+% \begin{macrocode}
+ \letcs{\@tmp}{footnote#1@mk}%
+ \numdef\@tmpa{\csuse{c@footnote#1}}%
+ \global\xright@appenditem{\@tmpa}\to\@tmp%
+ \global\cslet{footnote#1@mk}{\@tmp}%
+ }%
+% \end{macrocode}
+% Then, declare the command which inserts the footnotemark in the right side.
+% \begin{macrocode}
+ \expandafter\newcommand\csname footnote#1mk\endcsname{%
+% \end{macrocode}
+% Get the first element of the footnote mark list.
+% As \cs{gl@p} is difficult to use with dynamic name macro, we use \cs{let} commands.
+% \begin{macrocode}
+ \letcs{\@tmp}{footnote#1@mk}%
+ \gl@p\@tmp\to\@tmpa%
+ \global\cslet{footnote#1@mk}{\@tmp}%
+% \end{macrocode}
+% Set the footnotecounter with it.
+% For the sake of security, we make a backup of the previous value.
+% \begin{macrocode}
+ \letcs{\old@footnote}{c@footnote#1}%
+ \setcounter{footnote#1}{\@tmpa}%
+% \end{macrocode}
+% Define the footnote mark and print it
+% \begin{macrocode}
+ \protected@csxdef{@thefnmark#1}{\csuse{thefootnote#1}}%
+ \csuse{@footnotemark#1}%
+% \end{macrocode}
+% Restore previous footnote counter and finally add space.
+% \begin{macrocode}
+ \setcounter{footnote#1}{\old@footnote}%
+ \xspace%
+ }%
+% \end{macrocode}
+% End of tools for familiar notes without marks
+% \begin{macrocode}
+ \fi
+% \end{macrocode}
+% End of \cs{newseries@eledpar}.
+% \begin{macrocode}
+}%
+% \end{macrocode}
+% \end{macro}
+% \subsubsection{Create hooks}
+% Read the eledmac code handbook about \cs{newhookcommand@series}.
+% Here, we create hooks which are specific to \Lpack{eledpar}.
+% \begin{macrocode}
+\unless\ifnocritical@%
+ \newhookcommand@series{onlyXside}%
+\fi%
+\unless\ifnofamiliar@%
+ \newhookcommand@series{onlysideX}%
+\fi
+
+
+% \end{macrocode}
+% \subsubsection{Init standards series (A,B,C,D,E,Z)}
+% \begin{macro}{\init@series@eledpar}
+% \cs{newseries@eledpar} is called by \cs{newseries@}.
+% However, this command is called before \Lpack{eledpar} is loaded.
+% Thus, we need to initiate a specific series hook for eledpar.
+% \begin{macrocode}
+\newcommand{\init@series@eledpar}{%
+ \def\do##1{\newseries@eledpar{##1}}%
+ \dolistloop{\@series}%
+}%
+\init@series@eledpar%
+% \end{macrocode}
+% \end{macro}
+% \section{Pstart numbers dumping and restoration}
+% While in \Lpack{eledmac} the footnotes are inserted in the same time as the \cs{pstart} …\cs{pend} are read, in \Lpack{eledpar} they are inserted when the \cs{Columns} or \cs{Pages} commands are called.
+% Consequently, if we do nothing, the value of the PstartL and PstartR counters are not the same in the main text and in the notes.
+% To solve this problem, we dump the values in two list (one by side) when processing \cs{pstart} and restore these at each \cs{pstart} when calling \cs{Columns} or \cs{Pages}.
+% We also dump and restore the value of the boolean \cs{ifnumberpstart}.
+
+% So, first step, creating the lists.
+% Here, ``pc'' means ``public counters''.
+% \begin{macro}{\list@pstartL@pc}
+% \begin{macro}{\list@pstartR@pc}
+% \begin{macrocode}
+\list@create{\list@pstartL@pc}%
+\list@create{\list@pstartR@pc}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% Two commands to dump current pstarts.
+% We prefer two commands to one with argument indicating the side,
+% because the commands are short, and so we save one test (or a \cs{csname} construction).
+% \begin{macro}{\dump@pstartL@pc}
+% \begin{macro}{\dump@pstartR@pc}
+% \begin{macrocode}
+\def\dump@pstartL@pc{%
+ \xright@appenditem{\the\c@pstartL}\to\list@pstartL@pc%
+ \global\cslet{numberpstart@L\the\l@dnumpstartsL}{\ifnumberpstart}%
+}%
+
+\def\dump@pstartR@pc{%
+ \xright@appenditem{\the\c@pstartR}\to\list@pstartR@pc%
+ \global\cslet{numberpstart@R\the\l@dnumpstartsR}{\ifnumberpstart}%
+}%
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\restore@pstartL@pc}
+% \begin{macro}{\restore@pstartR@pc}
+% And so, the commands to restore them
+% \begin{macrocode}
+\def\restore@pstartL@pc{%
+ \ifx\list@pstartL@pc\empty\else%
+ \gl@p\list@pstartL@pc\to\@temp%
+ \global\c@pstartL=\@temp%
+ \fi%
+}%
+\def\restore@pstartR@pc{%
+ \ifx\list@pstartR@pc\empty\else%
+ \gl@p\list@pstartR@pc\to\@temp%
+ \global\c@pstartR=\@temp%
+ \fi%
+}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \section{Parallel environments}
+%
+% The initial set up for parallel processing is deceptively simple.
+%
+%
+% \begin{environment}{pairs}
+% \begin{environment}{pages}
+% \begin{macro}{chapterinpages}
+% The \verb?pairs? environment is for parallel columns and the \verb?pages?
+% environment for parallel pages.
+% \begin{macrocode}
+\newenvironment{pairs}{%}
+ \l@dpairingtrue
+ \l@dpagingfalse
+ \initnumbering@sectcmd
+ \at@begin@pairs%
+}{%
+ \l@dpairingfalse
+}
+
+% \end{macrocode}
+% \begin{macro}{\AtBeginPairs}
+% The \cs{AtBeginPairs} macro just define a \cs{at@begin@pairs} macro, called at the begining of each \verb+pairs+ environments.
+% \begin{macrocode}
+\newcommand{\AtBeginPairs}[1]{\xdef\at@begin@pairs{#1}}%
+\def\at@begin@pairs{}%
+
+% \end{macrocode}
+% \end{macro}
+% The \verb?pages? environment additionally sets the `column' widths to the
+% \cs{textwidth} (as known at the time the package is called). In this environment, there are two text in parallel on 2 pages. To prevent chapters starting on a lefthand page, the \cs{chapter} command is redefined to not clear pages.
+% \begin{macrocode}
+\newenvironment{pages}{%
+ \let\oldchapter\chapter
+ \let\chapter\chapterinpages
+ \l@dpairingtrue
+ \l@dpagingtrue
+ \initnumbering@sectcmd
+ \setlength{\Lcolwidth}{\textwidth}%
+ \setlength{\Rcolwidth}{\textwidth}%
+}{%
+ \l@dpairingfalse
+ \l@dpagingfalse
+ \let\chapter\oldchapter
+}
+\newcommand{\chapterinpages}{\thispagestyle{plain}%
+ \global\@topnum\z@
+ \@afterindentfalse
+ \secdef\@chapter\@schapter}
+
+% \end{macrocode}
+% \end{macro}
+% \end{environment}
+% \end{environment}
+%
+%
+% \begin{macro}{ifinstanzaL}
+% \begin{macro}{ifinstanzaR}
+% These boolean tests are switched by the \cs{stanza} command, using either the left or right side.
+% \begin{macrocode}
+ \newif\ifinstanzaL
+ \newif\ifinstanzaR
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{environment}{Leftside}
+% Within the \verb?pairs? and \verb?pages? environments the left and
+% right hand texts are within \verb?Leftside? and \verb?Rightside?
+% environments, respectively. The \verb?Leftside? environment is simple,
+% indicating that right text is not within its purview and using some
+% particular macros.
+% \changes{v0.3.0}{2005/02/10}{Added hooks into Leftside environment}
+% \begin{macrocode}
+\newenvironment{Leftside}{%
+ \expandafter\ifvoid\csname l@dLcolrawbox1\endcsname\else%
+ \led@err@Leftside@PreviousNotPrinted%
+ \fi%
+ \ledRcolfalse
+ \setcounter{pstartL}{1}
+ \let\pstart\pstartL
+ \let\thepstart\thepstartL
+ \let\pend\pendL
+ \let\memorydump\memorydumpL
+ \Leftsidehook
+ \let\old@startstanza\@startstanza
+ \def\@startstanza[##1]{\global\instanzaLtrue\old@startstanza[##1]}
+}{
+ \Leftsidehookend}
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\Leftsidehook}
+% \begin{macro}{\Leftsidehookend}
+% \begin{macro}{\Rightsidehook}
+% \begin{macro}{\Rightsidehookend}
+% Hooks into the start and end of the \texttt{Leftside} and \texttt{Rightside}
+% environments. These are initially empty.
+% \changes{v0.3.0}{2005/02/10}{Added \cs{Leftsidehook}, \cs{Leftsidehookend},
+% \cs{Rightsidehook} and \cs{Rightsidehookend}}
+% \begin{macrocode}
+\newcommand*{\Leftsidehook}{}
+\newcommand*{\Leftsidehookend}{}
+\newcommand*{\Rightsidehook}{}
+\newcommand*{\Rightsidehookend}{}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{environment}{Rightside}
+% The \verb?Rightside? environment is only slightly more complicated
+% than the \verb?Leftside?.
+% Apart from indicating that right text is being provided it
+% ensures that the right right text code will be used.
+% \begin{macrocode}
+\newenvironment{Rightside}{%
+ \expandafter\ifvoid\csname l@dRcolrawbox1\endcsname\else%
+ \led@err@Rightside@PreviousNotPrinted%
+ \fi%
+ \ledRcoltrue
+ \let\beginnumbering\beginnumberingR
+ \let\endnumbering\endnumberingR
+ \let\pausenumbering\pausenumberingR
+ \let\resumenumbering\resumenumberingR
+ \let\memorydump\memorydumpR
+ \let\thepstart\thepstartR
+ \let\pstart\pstartR
+ \let\pend\pendR
+ \let\ledpb\ledpbR
+ \let\lednopb\lednopbR
+ \let\lineation\lineationR
+ \Rightsidehook
+ \let\old@startstanza\@startstanza
+ \def\@startstanza[##1]{\global\instanzaRtrue\old@startstanza[##1]}
+}{%
+ \ledRcolfalse
+ \Rightsidehookend
+}
+
+% \end{macrocode}
+% \end{environment}
+%
+%
+%
+% \section{Paragraph decomposition and reassembly}
+% \label{paragraph}\relax
+%
+% In order to be able to count the lines of text and affix line
+% numbers, we add an extra stage of processing for each paragraph.
+% We send the paragraph into a box
+% register, rather than straight onto the vertical list, and when
+% the paragraph ends we
+% slice the paragraph into its component lines; to each line we
+% add any notes or line numbers, add a command to write to the
+% line-list, and then at last send the line to the vertical list.
+% This section contains all the code for this processing.
+%
+% \subsection{Boxes, counters, {\tt\protect\bslash pstart}
+% and {\tt\protect\bslash pend}}
+%
+% \begin{macro}{\num@linesR}
+% \begin{macro}{\one@lineR}
+% \begin{macro}{\par@lineR}
+% Here are numbers and flags that are used internally in the course
+% of the paragraph decomposition.
+%
+% When we first form the paragraph, it goes into a box register,
+% \cs{l@dLcolrawbox} or \cs{l@dRcolrawbox} for right text, instead of onto the
+% current vertical list.
+% The \cs{ifnumberedpar@} flag will be \verb"true" while a paragraph is
+% being processed in that way.
+% \cs{num@lines(R)} will store the number of lines in the paragraph
+% when it's complete. When we chop it up into lines, each line
+% in turn goes into the
+% \cs{one@line} or \cs{one@lineR} register, and \cs{par@line(R)}
+% will be the number
+% of that line within the paragraph.
+% \begin{macrocode}
+\newcount\num@linesR
+\newbox\one@lineR
+\newcount\par@lineR
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\pstartL}
+% \begin{macro}{\pstartR}
+% \changes{v1.1.0}{2012/09/25}{Add \cs{labelpstarttrue} (from eledmac).}
+% \changes{v1.1.1}{2012/10/01}{Correct \cs{pstartR} bug introduced by 1.1.}
+% \changes{v1.4.3}{2013/10/27}{Spurious spaces in \cs{pstartL} and \cs{pstartR}.}
+% \changes{v1.8.0}{2014/08/05}{As in \Lpack{eledmac}, \cs{pendL} and \cs{pendR} can have an optional argument.}
+% \cs{pstart} starts the paragraph by
+% clearing the \cs{inserts@list} list and other
+% relevant variables, and then arranges for the
+% subsequent text to go into the appropriate box.
+% \cs{pstart} needs to appear at the start of
+% every paragraph that's to be numbered.
+%
+% Beware: everything that occurs between \cs{pstart} and \cs{pend}
+% is happening within a group; definitions must be global if you want
+% them to survive past the end of the paragraph.
+%
+% We have to have specific left and right \cs{pstart} when parallel processing;
+% among other things because of potential changes in the linewidth.
+%
+% \begin{macrocode}
+
+\newcounter{pstartL}
+\renewcommand{\thepstartL}{{\bfseries\@arabic\c@pstartL}. }
+\newcounter{pstartR}
+\renewcommand{\thepstartR}{{\bfseries\@arabic\c@pstartR}. }
+
+\newcommandx*{\pstartL}[1][1]{%
+ \if@nobreak%
+ \let\@oldnobreak\@nobreaktrue%
+ \else%
+ \let\@oldnobreak\@nobreakfalse%
+ \fi%
+ \@nobreaktrue%
+ \ifluatex%
+ \xdef\l@luatextextdir@L{\the\textdir}%
+ \xdef\l@luatexpardir@L{\the\pardir}%
+ \xdef\l@luatexbodydir@L{\the\bodydir}%
+ \fi%
+ \ifnumbering \else%
+ \led@err@PstartNotNumbered%
+ \beginnumbering%
+ \fi%
+ \ifnumberedpar@%
+ \led@err@PstartInPstart%
+ \pend%
+ \fi%
+% \end{macrocode}
+% If this is the first \cs{pstart} in a numbered section, clear any inserts
+% and set \cs{ifpst@rtedL} to FALSE.
+% \begin{macrocode}
+ \ifpst@rtedL\else%
+ \list@clear{\inserts@list}%
+ \global\let\next@insert=\empty%
+ \global\pst@rtedLtrue%
+ \fi%
+ \begingroup\normal@pars%
+% \end{macrocode}
+% When parallel processing we check that we haven't exceeded
+% the maximum number of chunks. In any event we grab a box for the
+% forthcoming text.
+% \begin{macrocode}
+ \global\advance\l@dnumpstartsL \@ne%
+ \ifnum\l@dnumpstartsL>\l@dc@maxchunks%
+ \led@err@TooManyPstarts%
+ \global\l@dnumpstartsL=\l@dc@maxchunks%
+ \fi%
+ \global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup%
+% \end{macrocode}
+% We set all the usual interline penalties to zero; this ensures that there'll
+% be no large interline penalties to prevent us from slicing the
+% paragraph into pieces. These penalties revert to the values
+% that you set when the group for the \cs{vbox} ends.
+% \begin{macrocode}
+ \l@dzeropenalties%
+ \ifautopar\else%
+ \ifnumberpstart%
+ \ifsidepstartnum%
+ \else%
+ \thepstartL%
+ \fi%
+ \fi%
+ \fi%
+ \hsize=\Lcolwidth%
+ \numberedpar@true%
+ \iflabelpstart\protected@edef\@currentlabel%
+ {\p@pstartL\thepstartL}\fi%
+% \end{macrocode}
+% Dump the optional arguments
+% \begin{macrocode}
+ \ifstrempty{#1}%
+ {\csgdef{before@pstartL@\the\l@dnumpstartsL}{\at@every@pstart}}%
+ {\csgdef{before@pstartL@\the\l@dnumpstartsL}{\noindent#1}}%
+ \at@every@pstart@call%
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommandx*{\pstartR}[1][1]{%
+ \if@nobreak%
+ \let\@oldnobreak\@nobreaktrue%
+ \else%
+ \let\@oldnobreak\@nobreakfalse%
+ \fi%
+ \@nobreaktrue%
+ \ifluatex%
+ \xdef\l@luatextextdir@R{\the\textdir}%
+ \xdef\l@luatexpardir@R{\the\pardir}%
+ \xdef\l@luatexbodydir@R{\the\bodydir}%
+ \fi%
+ \ifnumberingR \else%
+ \led@err@PstartNotNumbered%
+ \beginnumberingR%
+ \fi%
+ \ifnumberedpar@%
+ \led@err@PstartInPstart%
+ \pendR%
+ \fi%
+ \ifpst@rtedR\else%
+ \list@clear{\inserts@listR}%
+ \global\let\next@insertR=\empty%
+ \global\pst@rtedRtrue%
+ \fi%
+ \begingroup\normal@pars%
+ \global\advance\l@dnumpstartsR \@ne%
+ \ifnum\l@dnumpstartsR>\l@dc@maxchunks%
+ \led@err@TooManyPstarts%
+ \global\l@dnumpstartsR=\l@dc@maxchunks%
+ \fi%
+ \global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup%
+ \l@dzeropenalties%
+ \ifautopar\else%
+ \ifnumberpstart%
+ \ifsidepstartnum\else%
+ \thepstartR%
+ \fi%
+ \fi%
+ \fi%
+ \hsize=\Rcolwidth%
+ \numberedpar@true%
+ \iflabelpstart\protected@edef\@currentlabel%
+ {\p@pstartR\thepstartR}\fi%
+ \ifstrempty{#1}%
+ {\csgdef{before@pstartR@\the\l@dnumpstartsR}{\at@every@pstart}}%
+ {\csgdef{before@pstartR@\the\l@dnumpstartsR}{\noindent#1}}%
+ \at@every@pstart@call%
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\pendL}
+% \changes{v1.4.3}{2013/10/27}{Spurious spaces in \cs{pendL}.}
+% \changes{v1.8.0}{2014/08/05}{As in \Lpack{eledmac}, \cs{pendL} can have an optional argument.}
+% \cs{pend} must be used to end a numbered paragraph. Again we need
+% a version
+% that knows about left parallel texts.
+%
+% \begin{macrocode}
+\newcommandx*{\pendL}[1][1]{%
+ \ifnumbering \else%
+ \led@err@PendNotNumbered%
+ \fi%
+ \ifnumberedpar@ \else%
+ \led@err@PendNoPstart%
+ \fi%
+% \end{macrocode}
+% We immediately
+% call \cs{endgraf} to end the paragraph; this ensures that there'll
+% be no large interline penalties to prevent us from slicing the
+% paragraph into pieces.
+% \begin{macrocode}
+ \endgraf\global\num@lines=\prevgraf\egroup%
+ \global\par@line=0%
+% \end{macrocode}
+% End the group that was begun in the \cs{pstart}.
+% \begin{macrocode}
+ \endgroup%
+ \ignorespaces%
+ \@oldnobreak%
+ \dump@pstartL@pc%
+ \ifnumberpstart%
+ \addtocounter{pstartL}{1}%
+ \fi
+ \parledgroup@beforenotes@save{L}%
+% \end{macrocode}
+% Dump content of the optional argument.
+% \begin{macrocode}
+ \ifstrempty{#1}%
+ {\csgdef{after@pendL@\the\l@dnumpstartsL}{\at@every@pend}}%
+ {\csgdef{after@pendL@\the\l@dnumpstartsL}{\noindent#1}}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pendR}
+% \changes{v1.4.3}{2013/10/27}{Spurious spaces in \cs{pstartR}.}
+% \changes{v1.8.0}{2014/08/05}{As in \Lpack{eledmac}, \cs{pendR} can have an optional argument.}
+% The version of \cs{pend} needed for right texts.
+%
+% \begin{macrocode}
+\newcommandx*{\pendR}[1][1]{%
+ \ifnumberingR \else%
+ \led@err@PendNotNumbered%
+ \fi%
+ \ifnumberedpar@ \else%
+ \led@err@PendNoPstart%
+ \fi%
+ \endgraf\global\num@linesR=\prevgraf\egroup%
+ \global\par@lineR=0%
+ \endgroup%
+ \ignorespaces%
+ \@oldnobreak%
+ \dump@pstartR@pc%
+ \ifnumberpstart%
+ \addtocounter{pstartR}{1}%
+ \fi%
+ \parledgroup@beforenotes@save{R}%
+ \ifstrempty{#1}%
+ {\csgdef{after@pendR@\the\l@dnumpstartsR}{\at@every@pend}}%
+ {\csgdef{after@pendR@\the\l@dnumpstartsR}{\noindent#1}}%
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\AtEveryPstartCall}
+% The \cs{AtEveryPstartCall} argument is called when the \cs{pstartL} or \cs{pstartR} is called.
+% That is different of \cs{AtEveryPstart} the argument of which is called when the \cs{pstart}s are printed.
+% \begin{macrocode}
+\newcommand{\AtEveryPstartCall}[1]{\xdef\at@every@pstart@call{\unexpanded{#1}}}%
+\gdef\at@every@pstart@call{}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifprint@last@after@pendL}
+% \begin{macro}{\ifprint@last@after@pendR}
+% Two booleans set to true, when the time is to print the last optional argument of a \cs{pend}.
+% \begin{macrocode}
+\newif\ifprint@last@after@pendL%
+\newif\ifprint@last@after@pendR%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \subsection{Processing one line}
+%
+% For parallel texts we have to be able to process left and right lines
+% independently. For sequential text we happily use the
+% original \cs{do@line}. Otherwise \ldots
+%
+% \begin{macro}{\l@dleftbox}
+% \begin{macro}{\l@drightbox}
+% A line of left text will be put in the box \cs{l@dleftbox}, and analagously
+% for a line of right text.
+% \begin{macrocode}
+\newbox\l@dleftbox
+\newbox\l@drightbox
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\countLline}
+% \begin{macro}{\countRline}
+% We need to know the number of lines processed.
+% \begin{macrocode}
+\newcount\countLline
+ \countLline \z@
+\newcount\countRline
+ \countRline \z@
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@donereallinesL}
+% \begin{macro}{\@donetotallinesL}
+% \begin{macro}{\@donereallinesR}
+% \begin{macro}{\@donetotallinesR}
+% We need to know the number of `real' lines output (i.e., those that
+% have been input by the user), and the total lines output (which includes
+% any blank lines output for synchronisation).
+% \begin{macrocode}
+\newcount\@donereallinesL
+\newcount\@donetotallinesL
+\newcount\@donereallinesR
+\newcount\@donetotallinesR
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \changes{v0.11.0}{2012/06/11}{Change \cs{do@lineL} and \cs{do@lineR} to allow line numbering by pstart (like in eledmac 0.15).}
+% \changes{v1.8.0}{2014/08/05}{Change \cs{do@lineR} and \cs{do@lineR} to allow new sectioning commands.}
+% \begin{macro}{\do@lineL}
+% \changes{v1.8.1}{2014/08/07}{Fix a bug with critical notes a the begining of a page, (maybe added by v1.8.0) (?).}
+% The \cs{do@lineL} macro is called to
+% do all the processing for a single line of left text.
+% \changes{v0.3.0}{2005/02/10}{Added \cs{do@lineLhook} to \cs{do@lineL}}
+% \changes{v0.3.0}{2005/02/10}{Simplified \cs{do@lineL} by using macros for
+% some common code}
+% \begin{macrocode}
+\newcommand*{\do@lineL}{%
+ \letcs{\ifnumberpstart}{numberpstart@L\the\l@dpscL}%
+ \advance\countLline \@ne%
+ \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}%
+ {\vbadness=10000%
+ \splittopskip=\z@%
+ \do@lineLhook%
+ \l@demptyd@ta%
+ \global\setbox\one@line=\vsplit\namebox{l@dLcolrawbox\the\l@dpscL}%
+ to\baselineskip}%
+ \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startL}{}%
+ \unvbox\one@line \global\setbox\one@line=\lastbox%
+ \getline@numL%
+ \ifnum\@lock>\@ne%
+ \inserthangingsymboltrue%
+ \else%
+ \inserthangingsymbolfalse%
+ \fi%
+ \setbox\l@dleftbox%
+ \hb@xt@ \Lcolwidth{%
+ \ifl@dhidenumber%
+ \global\l@dhidenumberfalse%
+ \f@x@l@cks%
+ \else%
+ \affixline@num%
+ \fi%
+ \xifinlist{\the\l@dpscL}{\eled@sections@@}%
+ {\add@inserts\affixside@note}%
+ {\print@lineL}}%
+ \add@penaltiesL%
+ \global\advance\@donereallinesL\@ne%
+ \global\advance\@donetotallinesL\@ne%
+\else%
+ \setbox\l@dleftbox \hb@xt@ \Lcolwidth{\hspace*{\Lcolwidth}}%
+ \global\advance\@donetotallinesL\@ne%
+\fi}
+
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\print@lineL}
+% \cs{print@lineL} is for lines without a sectioning command. See \Lpack{eledmac} definition of \cs{print@line} for handbook.
+% \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
+% \begin{macrocode}
+\def\print@lineL{%
+ \affixpstart@numL%
+ \l@dld@ta %space kept for backward compatibility
+ \add@inserts\affixside@note%
+ \l@dlsn@te %space kept for backward compatibility
+ {\ledllfill\hb@xt@ \Lcolwidth{%
+ \do@insidelineLhook%
+ \ifluatex%
+ \textdir\l@luatextextdir@L%
+ \fi%
+ \new@lineL%
+ \inserthangingsymbolL%
+ \l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta%
+ \l@drsn@te}}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\print@eledsectionL}
+% \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
+% \changes{v1.12.1}{2015/02/27}{Fixes bug with \LuaLaTeX\ RTL \cs{eledsection}.}
+% \cs{print@eledsectionL} is for line with macro code.
+% \begin{macrocode}
+\def\print@eledsectionL{%%
+ \addtocounter{pstartL}{-1}%
+ \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{}
+ \ifdefstring{\@eledsectmark}{L}{}{\ledsectnomark}
+ \numdef{\temp@}{\l@dpscL-1}%
+ \xifinlist{\temp@}{\eled@sections@@}{\@nobreaktrue}{\@nobreakfalse}%
+ \@eled@sectioningtrue%
+ \bgroup%
+ \ifluatex%
+ \textdir\l@luatextextdir@L%
+ \pardir\l@luatexpardir@L%
+ \bodydir\l@luatexbodydir@L%
+ \ifdefstring{\l@luatextextdir@L}{TRT}{\@RTLtrue}{}%
+ \fi%
+ \csuse{eled@sectioning@\the\l@dpscL}%
+ \egroup%
+ \@eled@sectioningfalse%
+ \global\csundef{eled@sectioning@\the\l@dpscL}%
+ \if@RTL%
+ \hspace{-3\paperwidth}%
+ {\hbox{\l@dunhbox@line{\one@line}} \new@line}%
+ \else%
+ \hspace{3\paperwidth}%
+ {\new@line \hbox{\l@dunhbox@line{\one@line}}}%
+ \fi%
+ \vskip\eledsection@correcting@skip%
+}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\dolineLhook}
+% \begin{macro}{\dolineRhook}
+% \begin{macro}{\doinsidelineLhook}
+% \begin{macro}{\doinsidelineRhook}
+% \changes{v1.8.3}{2014/08/31}{Added \cs{dolineLhook}, \cs{dolineRhook}, \cs{doinsidelineLhook} and \cs{doinsidelineRhook}}
+% These high-level commands just redefine the low-level commands.
+% They have to be used be user, without \cs{makeatletter}.
+% \begin{macrocode}
+\newcommand*{\dolineLhook}[1]{\gdef\do@lineLhook{#1}}%
+\newcommand*{\dolineRhook}[1]{\gdef\do@lineRhook{#1}}%
+\newcommand*{\doinsidelineLhook}[1]{\gdef\do@insidelineLhook{#1}}%
+\newcommand*{\doinsidelineRhook}[1]{\gdef\do@insidelineRhook{#1}}%
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \changes{v0.3.0}{2005/02/10}{Added \cs{do@lineLhook} and \cs{do@lineRhook}}
+% \changes{v1.4.0}{2013/07/11}{Added \cs{do@insidelineLhook} and \cs{do@insidelineRhook}}
+% \begin{macro}{\do@lineLhook}
+% \begin{macro}{\do@lineRhook}
+% \begin{macro}{\do@insidelineLhook}
+% \begin{macro}{\do@insidelineRhook}
+% Hooks, initially empty, into the respective \cs{do@line(L/R)} macros.
+% \begin{macrocode}
+\newcommand*{\do@lineLhook}{}
+\newcommand*{\do@lineRhook}{}
+\newcommand*{\do@insidelineLhook}{}
+\newcommand*{\do@insidelineRhook}{}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\do@lineR}
+% The \cs{do@lineR} macro is called to
+% do all the processing for a single line of right text.
+% \changes{v0.3.0}{2005/02/10}{Changed \cs{do@lineR} similarly to \cs{do@lineL}}
+% \changes{v1.8.1}{2014/08/07}{Fix a bug with critical notes a the begining of a page, added by v1.8.0 (?).}
+% \begin{macrocode}
+\newcommand*{\do@lineR}{%
+ \letcs{\ifnumberpstart}{numberpstart@R\the\l@dpscR}%
+ \ledRcol@true%
+ \advance\countRline \@ne%
+ \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}%
+ {\vbadness=10000%
+ \splittopskip=\z@%
+ \do@lineRhook%
+ \l@demptyd@ta%
+ \global\setbox\one@lineR=\vsplit\namebox{l@dRcolrawbox\the\l@dpscR}%
+ to\baselineskip}%
+ \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startR}{}%
+ \unvbox\one@lineR \global\setbox\one@lineR=\lastbox%
+ \getline@numR%
+ \ifnum\@lockR>\@ne%
+ \inserthangingsymbolRtrue%
+ \else%
+ \inserthangingsymbolRfalse%
+ \fi%
+ \setbox\l@drightbox%
+ \hb@xt@ \Rcolwidth{%
+ \ifl@dhidenumber%
+ \global\l@dhidenumberfalse%
+ \f@x@l@cksR%
+ \else%
+ \affixline@numR%
+ \fi%
+ \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}%
+ {\add@insertsR\affixside@noteR}%
+ {\print@lineR}%
+ }%
+ \add@penaltiesR%
+ \global\advance\@donereallinesR\@ne%
+ \global\advance\@donetotallinesR\@ne%
+\else%
+ \setbox\l@drightbox \hb@xt@ \Rcolwidth{\hspace*{\Rcolwidth}}%
+ \global\advance\@donetotallinesR\@ne%
+\fi%
+\ledRcol@false%
+}
+
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\print@lineR}{}
+% \begin{macro}{\print@eledsectionR}{}
+% \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
+\def\print@lineR{%
+ \affixpstart@numR%
+ \l@dld@ta %space kept for backward compatibility
+ \add@insertsR\affixside@noteR%
+ \l@dlsn@te %space kept for backward compatibility
+ \ledllfill\hb@xt@ \Rcolwidth{%
+ \do@insidelineRhook%
+ \new@lineR%
+ \inserthangingsymbolR%
+ \ifluatex%
+ \textdir\l@luatextextdir@R%
+ \fi%
+ \l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta%
+ \l@drsn@te%
+ }
+
+\def\print@eledsectionR{%
+ \addtocounter{pstartR}{-1}%
+ \initnumbering@sectcountR%
+ \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{}%
+ \ifdefstring{\@eledsectmark}{R}{}{\ledsectnomark}%
+ \numdef{\temp@}{\l@dpscR-1}%
+ \xifinlist{\temp@}{\eled@sectionsR@@}{\@nobreaktrue}{\@nobreakfalse}%
+ \@eled@sectioningtrue%
+ \bgroup%
+ \ifluatex%
+ \textdir\l@luatextextdir@R%
+ \pardir\l@luatexpardir@R%
+ \bodydir\l@luatexbodydir@R%
+ \ifdefstring{\l@luatextextdir@L}{TRT}{\@RTLtrue}{}%
+ \fi%
+ \csuse{eled@sectioning@\the\l@dpscR R}%
+ \egroup%
+ \@eled@sectioningfalse%
+ \global\csundef{eled@sectioning@\the\l@dpscR R}%
+ \if@RTL%
+ \hspace{-\paperwidth}%
+ {\hbox{\l@dunhbox@line{\one@lineR}} \new@lineR}%
+ \else%
+ \hspace{\paperwidth}%
+ {\new@lineR \hbox{\l@dunhbox@line{\one@lineR}}}%
+ \fi%
+ \vskip\eledsection@correcting@skip
+}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Line and page number computation}
+%
+% \begin{macro}{\getline@numR}
+% The \cs{getline@numR} macro
+% determines the page and line numbers for the right text line we're about to
+% send to the vertical list.
+% \begin{macrocode}
+\newcommand*{\getline@numR}{%
+ \global\advance\absline@numR \@ne
+ \do@actionsR
+ \do@ballastR
+ \ifledgroupnotesR@\else
+ \ifnumberline
+ \ifsublines@
+ \ifnum\sub@lockR<\tw@
+ \global\advance\subline@numR \@ne
+ \fi
+ \else
+ \ifnum\@lockR<\tw@
+ \global\advance\line@numR \@ne
+ \global\subline@numR \z@
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand*{\getline@numL}{%
+ \global\advance\absline@num \@ne
+ \do@actions
+ \do@ballast
+ \ifledgroupnotesL@\else
+ \ifnumberline
+ \ifsublines@
+ \ifnum\sub@lock<\tw@
+ \global\advance\subline@num \@ne
+ \fi
+ \else
+ \ifnum\@lock<\tw@
+ \global\advance\line@num \@ne
+ \global\subline@num \z@
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\do@ballastR}
+% \phantomsection\label{do@ballastR}\relax
+% The real work in the line macros above is done in \cs{do@actions}, but
+% before we plunge into that, let's get \cs{do@ballastR} out of the
+% way.
+% \begin{macrocode}
+\newcommand*{\do@ballastR}{\global\ballast@count=\z@
+ \begingroup
+ \advance\absline@numR \@ne
+ \ifnum\next@actionlineR=\absline@numR
+ \ifnum\next@actionR>-1001
+ \global\advance\ballast@count by -\c@ballast
+ \fi
+ \fi
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\l@dskipversenumberR}
+% \begin{macro}{\do@actionsR}
+% \begin{macro}{\do@actions@fixedcodeR}
+% \begin{macro}{\do@actions@nextR}
+%
+% The \cs{do@actionsR} macro
+% looks at the list of actions to take at particular right text absolute line
+% numbers, and does everything that's specified for the current line.
+%
+% It may call itself recursively and we use tail recursion, via
+% \cs{do@actions@nextR} for this.
+% \changes{v0.3.0}{2005/02/24}{Used \cs{do@actions@fixedcode} in \cs{do@actionsR}}
+% \changes{v1.15.0}{2015/04/13}{Add action 1008 and 1009}
+% \begin{macrocode}
+
+\newif\ifl@dskipversenumberR
+\newcommand*{\do@actions@fixedcodeR}{%
+ \ifcase\@l@dtempcnta%
+ \or% % 1001
+ \global\sublines@true
+ \or% % 1002
+ \global\sublines@false
+ \or% % 1003
+ \global\@lockR=\@ne
+ \or% % 1004%
+ \ifnum\@lockR=\tw@
+ \global\@lockR=\thr@@
+ \else
+ \global\@lockR=\z@
+ \fi
+ \or% % 1005
+ \global\sub@lockR=\@ne
+ \or% % 1006
+ \ifnum\sub@lockR=\tw@
+ \global\sub@lockR=\thr@@
+ \else
+ \global\sub@lockR=\z@
+ \fi
+ \or% % 1007
+ \l@dskipnumbertrue
+ \or% % 1008
+ \l@dskipversenumberRtrue%
+ \or% % 1009
+ \l@dhidenumbertrue%
+ \else%
+ \led@warn@BadAction
+ \fi%
+}
+
+
+\newcommand*{\do@actionsR}{%
+ \global\let\do@actions@nextR=\relax
+ \@l@dtempcntb=\absline@numR
+ \ifnum\@l@dtempcntb<\next@actionlineR\else
+ \ifnum\next@actionR>-1001\relax
+ \global\page@numR=\next@actionR
+ \ifbypage@R
+ \global\line@numR \z@ \global\subline@numR \z@
+ \fi
+ \else
+ \ifnum\next@actionR<-4999\relax % 9/05 added relax here
+ \@l@dtempcnta=-\next@actionR
+ \advance\@l@dtempcnta by -5001\relax
+ \ifsublines@
+ \global\subline@numR=\@l@dtempcnta
+ \else
+ \global\line@numR=\@l@dtempcnta
+ \fi
+ \else
+ \@l@dtempcnta=-\next@actionR
+ \advance\@l@dtempcnta by -1000\relax
+ \do@actions@fixedcodeR
+ \fi
+ \fi
+ \ifx\actionlines@listR\empty
+ \gdef\next@actionlineR{1000000}%
+ \else
+ \gl@p\actionlines@listR\to\next@actionlineR
+ \gl@p\actions@listR\to\next@actionR
+ \global\let\do@actions@nextR=\do@actionsR
+ \fi
+ \fi
+ \do@actions@nextR}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Line number printing}
+%
+% \begin{macro}{\l@dcalcnum}
+% \begin{macro}{\ch@cksub@l@ckR}
+% \begin{macro}{\ch@ck@l@ckR}
+% \begin{macro}{\f@x@l@cksR}
+% \begin{macro}{\affixline@numR}
+% \cs{affixline@numR} is the right text version of the
+% \cs{affixline@num} macro.
+% \changes{v0.3.0}{2005/02/24}{Changed \cs{affixline@numR} to match new eledmac}
+% \changes{v0.11.0}{2012/06/11}{Changed \cs{affixline@numR} to allow to disable line numbering (like in eledmac 0.15).}
+% \begin{macrocode}
+
+\providecommand*{\l@dcalcnum}[3]{%
+ \ifnum #1 > #2\relax
+ \@l@dtempcnta = #1\relax
+ \advance\@l@dtempcnta by -#2\relax
+ \divide\@l@dtempcnta by #3\relax
+ \multiply\@l@dtempcnta by #3\relax
+ \advance\@l@dtempcnta by #2\relax
+ \else
+ \@l@dtempcnta=#2\relax
+ \fi}
+
+\newcommand*{\ch@cksub@l@ckR}{%
+ \ifcase\sub@lockR
+ \or
+ \ifnum\sublock@disp=\@ne
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \or
+ \ifnum\sublock@disp=\tw@
+ \else
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \or
+ \ifnum\sublock@disp=\z@
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \fi}
+
+\newcommand*{\ch@ck@l@ckR}{%
+ \ifcase\@lockR
+ \or
+ \ifnum\lock@disp=\@ne
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \or
+ \ifnum\lock@disp=\tw@
+ \else
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \or
+ \ifnum\lock@disp=\z@
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \fi}
+
+\newcommand*{\f@x@l@cksR}{%
+ \ifcase\@lockR
+ \or
+ \global\@lockR \tw@
+ \or \or
+ \global\@lockR \z@
+ \fi
+ \ifcase\sub@lockR
+ \or
+ \global\sub@lockR \tw@
+ \or \or
+ \global\sub@lockR \z@
+ \fi}
+
+
+\newcommand*{\affixline@numR}{%
+\ifledgroupnotesR@\else\ifnumberline
+\ifl@dskipnumber
+ \global\l@dskipnumberfalse
+\else
+ \ifsublines@
+ \@l@dtempcntb=\subline@numR
+ \l@dcalcnum{\subline@numR}{\c@firstsublinenumR}{\c@sublinenumincrementR}%
+ \ch@cksub@lockR
+ \else
+ \@l@dtempcntb=\line@numR
+ \ifx\linenumberlist\empty
+ \l@dcalcnum{\line@numR}{\c@firstlinenumR}{\c@linenumincrementR}%
+ \else
+ \@l@dtempcnta=\line@numR
+ \edef\rem@inder{,\linenumberlist,\number\line@numR,}%
+ \edef\sc@n@list{\def\noexpand\sc@n@list
+ ####1,\number\@l@dtempcnta,####2|{\def\noexpand\rem@inder{####2}}}%
+ \sc@n@list\expandafter\sc@n@list\rem@inder|%
+ \ifx\rem@inder\empty\advance\@l@dtempcnta\@ne\fi
+ \fi
+ \ch@ck@l@ckR
+ \fi
+ \ifnum\@l@dtempcnta=\@l@dtempcntb
+ \ifl@dskipversenumberR\else
+ \if@twocolumn
+ \if@firstcolumn
+ \gdef\l@dld@ta{\llap{{\leftlinenumR}}}%
+ \else
+ \gdef\l@drd@ta{\rlap{{\rightlinenumR}}}%
+ \fi
+ \else
+ \@l@dtempcntb=\line@marginR
+ \ifnum\@l@dtempcntb>\@ne
+ \advance\@l@dtempcntb by\page@numR
+ \fi
+ \ifodd\@l@dtempcntb
+ \gdef\l@drd@ta{\rlap{{\rightlinenumR}}}%
+ \else
+ \gdef\l@dld@ta{\llap{{\leftlinenumR}}}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \f@x@l@cksR
+\fi
+\fi
+\fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \subsection{Pstart number printing in side}
+% The printing of the pstart number is like in eledmac, with two differences :
+%\begin{itemize}
+%\item Some commands have versions suffixed by R or L.
+%\item The \cs{affixpstart@num} and \cs{affixpstart@numR} commands are called in the \cs{Pages} command. Consequently, the \verb|pstartL| and \verb|pstartR| counters must be reset at the begining of this command.
+%\end{itemize}
+% \begin{macro}{\affixpstart@numL}
+% \begin{macro}{\affixpstart@numR}
+% \begin{macro}{\leftpstartnumR}
+% \begin{macro}{\rightpstartnumR}
+% \begin{macro}{\leftpstartnumL}
+% \begin{macro}{\rightpstartnumL}
+% \begin{macro}{\ifpstartnumR}
+% \begin{macrocode}
+
+\newcommand*{\affixpstart@numL}{%
+\ifsidepstartnum
+\if@twocolumn
+ \if@firstcolumn
+ \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}%
+ \else
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}%
+ \fi
+ \else
+ \@l@dtempcntb=\line@margin
+ \ifnum\@l@dtempcntb>\@ne
+ \advance\@l@dtempcntb \page@num
+ \fi
+ \ifodd\@l@dtempcntb
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}%
+ \else
+ \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}%
+ \fi
+ \fi
+\fi
+}
+\newcommand*{\affixpstart@numR}{%
+\ifsidepstartnum
+\if@twocolumn
+ \if@firstcolumn
+ \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}%
+ \else
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}%
+ \fi
+ \else
+ \@l@dtempcntb=\line@marginR
+ \ifnum\@l@dtempcntb>\@ne
+ \advance\@l@dtempcntb \page@numR
+ \fi
+ \ifodd\@l@dtempcntb
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}%
+ \else
+ \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}%
+ \fi
+ \fi
+\fi
+}
+
+\newcommand*{\leftpstartnumL}{
+\ifpstartnum
+\thepstartL
+\kern\linenumsep\global\pstartnumfalse\fi
+}
+\newcommand*{\rightpstartnumL}{
+\ifpstartnum\kern\linenumsep
+\thepstartL
+\global\pstartnumfalse\fi
+}
+\newif\ifpstartnumR
+\pstartnumRtrue
+\newcommand*{\leftpstartnumR}{
+\ifpstartnumR
+\thepstartR
+\kern\linenumsep\global\pstartnumRfalse\fi
+}
+\newcommand*{\rightpstartnumR}{
+\ifpstartnumR\kern\linenumsep
+\thepstartR
+\global\pstartnumRfalse\fi
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \subsection{Add insertions to the vertical list}
+%
+% \begin{macro}{\inserts@listR}
+% \cs{inserts@listR} is the list macro that contains the inserts that
+% we save up for one right text paragraph.
+%
+% \begin{macrocode}
+\list@create{\inserts@listR}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\add@insertsR}
+% \begin{macro}{\add@inserts@nextR}
+% The right text version.
+% \begin{macrocode}
+\newcommand*{\add@insertsR}{%
+ \global\let\add@inserts@nextR=\relax
+ \ifx\inserts@listR\empty \else
+ \ifx\next@insertR\empty
+ \ifx\insertlines@listR\empty
+ \global\noteschanged@true
+ \gdef\next@insertR{100000}%
+ \else
+ \gl@p\insertlines@listR\to\next@insertR
+ \fi
+ \fi
+ \ifnum\next@insertR=\absline@numR
+ \gl@p\inserts@listR\to\@insertR
+ \@insertR
+ \global\let\@insertR=\undefined
+ \global\let\next@insertR=\empty
+ \global\let\add@inserts@nextR=\add@insertsR
+ \fi
+ \fi
+ \add@inserts@nextR}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Penalties}
+%
+% \begin{macro}{\add@penaltiesL}
+% \begin{macro}{\add@penaltiesR}
+% \cs{add@penaltiesL} is
+% the last macro used by \cs{do@lineL}. It adds up the club,
+% widow, and interline penalties, and puts a single penalty
+% of the appropriate size
+% back into the paragraph; these penalties get
+% removed by the \cs{vsplit} operation. \cs{displaywidowpenalty} and
+% \cs{brokenpenalty} are not restored, since we have no easy way to
+% find out where we should insert them.
+%
+% \phantomsection\label{add@penalties}
+% In the code below, which is a virtual copy of the original
+% \cs{add@penalties}, \cs{num@lines} is the number of lines in the whole
+% paragraph, and \cs{par@line} is the line we're working on at the
+% moment. The count \cs{@l@dtempcnta} is used to calculate and
+% accumulate the penalty; it is initially set to the value of
+% \cs{ballast@count}, which has been worked out in \cs{do@ballast}.
+% Finally, the penalty is
+% checked to see that it doesn't go below $-10000$.
+% \begin{verbatim}
+% \newcommand*{\add@penaltiesR}{\@l@dtempcnta=\ballast@count
+% \ifnum\num@linesR>\@ne
+% \global\advance\par@lineR \@ne
+% \ifnum\par@lineR=\@ne
+% \advance\@l@dtempcnta by \clubpenalty
+% \fi
+% \@l@dtempcntb=\par@lineR \advance\@l@dtempcntb \@ne
+% \ifnum\@l@dtempcntb=\num@linesR
+% \advance\@l@dtempcnta by \widowpenalty
+% \fi
+% \ifnum\par@lineR<\num@linesR
+% \advance\@l@dtempcnta by \interlinepenalty
+% \fi
+% \fi
+% \ifnum\@l@dtempcnta=\z@
+% \relax
+% \else
+% \ifnum\@l@dtempcnta>-10000
+% \penalty\@l@dtempcnta
+% \else
+% \penalty -10000
+% \fi
+% \fi}
+% \end{verbatim}
+% This is for a single chunk. However, as we are probably dealing
+% with several chunks at a time, the above is nor really relevant. Peter Wilson thinks
+% that it is likely with parallel text that there is no real need to add
+% back any penalties; even if there was, they would have to match across the
+% left and right lines. So, Peter Wilson ends up with the following.
+%
+% \begin{macrocode}
+\newcommand*{\add@penaltiesL}{}
+\newcommand*{\add@penaltiesR}{}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Printing leftover notes}
+%
+% \begin{macro}{\flush@notesR}
+% The \cs{flush@notesR}
+% macro is called after the entire right text has been sliced up
+% and sent on to the vertical list.
+% \begin{macrocode}
+\newcommand*{\flush@notesR}{%
+ \@xloop
+ \ifx\inserts@listR\empty \else
+ \gl@p\inserts@listR\to\@insertR
+ \@insertR
+ \global\let\@insertR=\undefined
+ \repeat}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Footnotes}
+% \label{footnotes}\relax
+%
+% \subsection{Normal footnote formatting} \label{sec:nfootformat}
+%
+% The \cs{printlines} macro prints the line
+% numbers for a note---which, in the
+% general case, is a rather complicated task.
+% The seven parameters of the
+% argument are the line numbers as stored in \cs{l@d@nums}, in the
+% form described on \reff{eledmac-linenumbers} of \Eledmac{}' handbook: the starting
+% page, line, and sub-line numbers, followed by the ending page,
+% line, and sub-line numbers, and then the font specifier for
+% the lemma.
+%
+%
+% \begin{macro}{\printlinesR}
+% \begin{macro}{\ledsavedprintlines}
+% This is the right text version of \cs{printlines} and takes account
+% of \cs{Rlineflag}. Just in case, \cs{ledsavedprintlines} is a copy
+% of the original \cs{printlines}.
+%
+% Just a reminder of the arguments: \\
+% \verb?\printlinesR #1 | #2 | #3 | #4 | #5 | #6 | #7? \\
+% \verb?\printlinesR start-page | line | subline | end-page | line | subline | font ?
+% \changes{v0.3.0}{2005/02/10}{Simplified \cs{printlinesR} by using
+% \cs{setprintlines}}
+% \begin{macrocode}
+\def\printlinesR#1|#2|#3|#4|#5|#6|#7|{\begingroup
+ \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
+ \ifl@d@pnum #1\fullstop\fi
+ \ifledplinenum \linenumr@p{#2}\Rlineflag\else \symplinenum\fi
+ \ifl@d@ssub \fullstop \sublinenumr@p{#3}\fi
+ \ifl@d@dash \endashchar\fi
+ \ifl@d@pnum #4\fullstop\fi
+ \ifl@d@elin \linenumr@p{#5}\Rlineflag\fi
+ \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumr@p{#6}\fi
+\endgroup}
+
+\let\ledsavedprintlines\printlines
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Footnotes output specific to \cs{Pages}}
+% \begin{macro}{\print@Xnotes@forpages}
+% \begin{macro}{\correct@Xfootins@box}
+% \begin{macro}{\print@notesX@forpages}
+% \begin{macro}{\correct@footinsX@box}
+% \changes{v1.13.1}{2015/03/12}{Correct \cs{correct@footinsX@box} and \cs{correct@Xfootins@box}}
+% \changes{v1.13.1}{2015/03/12}{Call \cs{correct@footinsX@box} and \cs{correct@Xfootins@box} directly in \cs{print@notesX@forpages} and \cs{print@Xnotes@forpages}.}
+% The \cs{onlyXside} and \cs{onlysideX} hooks for \cs{Pages}
+% allow notes to be printed either in left or right pages only.
+% The implementation of such features is delegated to \cs{print@Xnotes@forpages},
+% which replaces \cs{print@Xnotes} inside \cs{Pages}.
+% Here is how we proceed\footnote{See \url{http://tex.stackexchange.com/a/230332/7712}.}:
+% \begin{itemize}
+% \item If notes are to be printed in both sides, we just proceed the usual way: print the foot starts for the series, then the foot group.
+% \item If notes are to be printed in the left side, we do these prints only for even pages ; if notes are to be printed in the right side, we do these prints only for odd pages.
+% \item However, that is not enough. Because the problem does not only consists in printing notes in any particular page. It is also not to put aside room for notes in the pages where we don't want to print them.
+% To take an example: if some note in the left side is too long by 160pt to be printed in full in the left page, we do not want to put aside 160pt a space for it in the following right page.
+% \item To solve this problem, we change the magnification factor associated with notes before going to the next page.
+% If we start a page where no notes are supposed to be printed, the magnification counter is set to 0. We also set the note skip to 0pt. Before starting a new page where these notes are supposed to be printed, we reset these counter and skip to their default values. (About these counter and skip, read \texbook\ p.~122-125).
+% \item There still remains a last problem. This problem is quite complex to understand, so an example will speak for itself. Suppose we allow 10 lines of notes by page.
+% Suppose a long note, be it 25 lines, which needs three pages to be printed. Suppose it must be printed only on left pages, namely odd pages.
+%
+% On p.~2, the first 10 lines of the notes are printed.
+% On p.~3, the box associated to the notes contains 10 lines. However, as we are in a right page, we don't void this box. So \TeX\ will keep its content for the pages to come. However, on p.~4 it will also add one line in the footnote box, because in any case, \TeX adds some content in the box when preparing the output routines, even if there is some content left in this box from the previous pages.
+% So the lines in the note box at p.~4 will be $10+1=11$. There is one line which should not be there. Furthermore, as the box size is for 10~lines and not for 11~lines, this last line will be glued to the previous one.
+%
+% To fix this double issue:
+% \begin{itemize}
+% \item For the pages where notes must be NOT printed, we allow to every note box one line less than it ought to be.
+% In our example, that means that we allow \TeX\ to add only $10-1=9$ line in the note box on p.~3.
+% Before shifting to the pages where notes must be printed, we allow to every notes the expected number of lines. In our example, that means that we allow \TeX to add 10~lines in the note box on p.~4. As on p.~3 only 9 lines were allowed, that means note box of p.~4 will contain $9+1=10$ lines. So the ``one line too many'' problem is solved.
+% \item Still remains the ``glue'' problem. We solve it by recreating a clean note box. We split the one which is created by \TeX\ to get the next line printed. Then, we create the new box, by bringing together the first part and the last part of the splitted box, adding some skip between them. That is achieved by \cs{correct@Xfootins@box} (or \cs{correct@footinsX@box} for familiar notes).
+% \end{itemize}
+% \end{itemize}
+% The code to print critical notes, when processing \cs{Pages}
+% \begin{macrocode}
+\newcommand\print@Xnotes@forpages[1]{%
+% \end{macrocode}
+% First case: notes are for both sides. Just print the note start and the note group
+% \begin{macrocode}
+ \ifcsempty{onlyXside@#1}{%
+ \csuse{#1footstart}{#1}%
+ \csuse{#1footgroup}{#1}%
+ }%
+% \end{macrocode}
+% Second case: notes are for one side only.
+% First test if we are in a page where they must be printed.
+% \begin{macrocode}
+ {%
+ \ifboolexpr{%
+ ((test {\ifcsstring{onlyXside@#1}{L}} and not test{\ifnumodd{\c@page}})%
+ or%
+ (test {\ifcsstring{onlyXside@#1}{R}} and test{\ifnumodd{\c@page}}))%
+ }%
+% \end{macrocode}
+% If we are in a page where notes must be printed, print the notes, after having made the corrections which are needed for boxes.
+% \begin{macrocode}
+ {%
+ \correct@Xfootins@box{#1}%
+ \csuse{#1footstart}{#1}%
+ \csuse{#1footgroup}{#1}%
+% \end{macrocode}
+% Then, say not to keep room for notes in the next page.
+% \begin{macrocode}
+ \global\count\csuse{#1footins}=0%
+ \global\skip\csuse{#1footins}=0pt%
+% \end{macrocode}
+% And also, allow one line less for notes in the next page.
+% \begin{macrocode}
+ \csuse{Xnotefontsize@#1}%
+ \global\advance\dimen\csuse{#1footins} by -\baselineskip%
+% \end{macrocode}
+% Now we have printed the notes. So we put aside this fact.
+% \begin{macrocode}
+ \global\boolfalse{keepforXside@#1}%
+ }%
+% \end{macrocode}
+% In case we are on a page where notes must NOT be printed.
+% First, memorize that we have not printed the notes, despite having some to print.
+% \begin{macrocode}
+ {%
+ \global\booltrue{keepforXside@#1}%
+% \end{macrocode}
+% Then restore expected rooms for notes on the next page.
+% \begin{macrocode}
+ \global\count\csuse{#1footins}=\csuse{default@#1footins}%
+ \global\skip\csuse{#1footins}=\csuse{beforeXnotes@#1}%
+% \end{macrocode}
+% Last but not least, restore the normal line number allowed to notes for the following page.
+% \begin{macrocode}
+ \bgroup%
+ \csuse{Xnotefontsize@#1}%
+ \global\advance\dimen\csuse{#1footins} by \baselineskip%
+ \egroup%
+% \end{macrocode}
+% \begin{macrocode}
+% End of \cs{print@Xnotes@forpages}.
+ }%
+ }%
+}%
+% \end{macrocode}
+% Now, \cs{correct@Xfootins@box}, to fix problem of last line being glued to the previous one.
+% \begin{macrocode}
+\newcommand{\correct@Xfootins@box}[1]{%
+% \end{macrocode}
+% We need to make correction only in case we have not printed any note in the previous page,
+% although there was to be ``normally'' printed.
+% \begin{macrocode}
+ \ifbool{keepforXside@#1}{%
+% \end{macrocode}
+% Some setting needed to do the right splitting.
+% \begin{macrocode}
+ \csuse{Xnotefontsize@#1}%
+ \splittopskip=0pt%
+% \end{macrocode}
+% And now, split the last line, and push in the right place.
+% \begin{macrocode}
+ \global\setbox\csuse{#1footins}=\vbox{%
+ \vsplit\csuse{#1footins} to \dimexpr\ht\csuse{#1footins}-1pt\relax%
+ \vskip \dimexpr-0.5\baselineskip-0.5\lineskip-0.5pt\relax%
+ \unvbox\csuse{#1footins}%
+ }%
+% \end{macrocode}
+% End of the macro.
+% \begin{macrocode}
+ }{}%
+}%
+% \end{macrocode}
+% And now, the same for familiar footnotes.
+% \begin{macrocode}
+\newcommand\print@notesX@forpages[1]{%
+ \ifcsempty{onlysideX@#1}{%
+ \csuse{footstart#1}{#1}%
+ \csuse{footgroup#1}{#1}%
+ }%
+ {%
+ \ifboolexpr{%
+ ((test {\ifcsstring{onlysideX@#1}{L}} and not test{\ifnumodd{\c@page}})%
+ or%
+ (test {\ifcsstring{onlysideX@#1}{R}} and test{\ifnumodd{\c@page}}))%
+ }%
+ {%
+ \correct@footinsX@box{#1}%
+ \csuse{footstart#1}{#1}%
+ \csuse{footgroup#1}{#1}%
+ \global\count\csuse{footins#1}=0%
+ \global\skip\csuse{footins#1}=0pt%
+ \csuse{notefontsizeX@#1}%
+ \global\advance\dimen\csuse{footins#1} by -\baselineskip%
+ \global\boolfalse{keepforsideX@#1}%
+ }%
+ {%
+ \global\booltrue{keepforsideX@#1}%
+ \global\count\csuse{footins#1}=\csuse{default@footins#1}%
+ \global\skip\csuse{footins#1}=\csuse{beforenotesX@#1}%
+ \bgroup%
+ \csuse{notefontsizeX@#1}%
+ \global\advance\dimen\csuse{footins#1} by \baselineskip%
+ \egroup%
+ }%
+ }%
+}%
+\newcommand{\correct@footinsX@box}[1]{%
+ \ifbool{keepforsideX@#1}{%
+ \csuse{notefontsizeX@#1}%
+ \splittopskip=0pt%
+ \global\setbox\csuse{footins#1}=\vbox{%
+ \vsplit\csuse{footins#1} to \dimexpr\ht\csuse{footins#1}-1pt\relax%
+ \vskip \dimexpr-0.5\baselineskip-0.5\lineskip-0.5pt\relax%
+ \unvbox\csuse{footins#1}%
+ }%
+ }{}%
+}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \section{Cross referencing}
+% \label{xref}\relax
+%
+%
+% \begin{macro}{\labelref@listR}
+% Set up a new list, \cs{labelref@listR}, to hold the page, line and
+% sub-line numbers for each label in right text.
+% \begin{macrocode}
+\list@create{\labelref@listR}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\edlabel}
+% Since version 1.18.0, this command is defined only one time in eledmac, including features for eledpar.
+% \changes{v1.12.0}{2015/02/23}{\cs{edlabel} is now defined only one time for both eledmac and eledpar}
+% \changes{v1.12.0}{2015/02/23}{\cs{edlabel} and \cs{edindex} works now with hyperref when using \Lpack{eledpar}.}
+% \end{macro}
+%
+% \begin{macro}{\l@dmake@labelsR}
+% This is the right text version of \cs{l@dmake@labels}, taking account
+% of \cs{Rlineflag}.
+%
+% \begin{macrocode}
+\def\l@dmake@labelsR#1|#2|#3|#4|#5{%
+ \expandafter\ifx\csname the@label#5\endcsname \relax\else
+ \led@warn@DuplicateLabel{#4}%
+ \fi
+ \expandafter\gdef\csname the@label#5\endcsname{#1|#2\Rlineflag|#3|#4}%
+ \ignorespaces}
+\AtBeginDocument{%
+ \def\l@dmake@labelsR#1|#2|#3|#4|#5{}%
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@lab}
+% The \cs{@lab} command, which appears in the \cs{linenum@out} file,
+% appends the current values of page, line and sub-line to the
+% \cs{labelref@list}. These values are defined by the earlier
+% \cs{@page}, \cs{@nl}, and the \cs{sub@on} and \cs{sub@off} commands
+% appearing in the \cs{linenum@out} file.
+%
+% \begin{macrocode}
+\renewcommand*{\@lab}{%
+ \ifledRcol
+ \xright@appenditem{\linenumr@p{\line@numR}|%
+ \ifsublines@ \sublinenumr@p{\subline@numR}\else 0\fi}%
+ \to\labelref@listR
+ \else
+ \xright@appenditem{\linenumr@p{\line@num}|%
+ \ifsublines@ \sublinenumr@p{\subline@num}\else 0\fi}%
+ \to\labelref@list
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Side notes}
+%
+% Regular \verb?\marginpar?s do not work inside numbered text --- they
+% don't produce any note but do put an extra unnumbered blank line into
+% the text.
+% \begin{macro}{\sidenote@marginR}
+% \begin{macro}{\sidenotemargin*}
+% \changes{v1.8.0}{2014/08/05}{\cs{sidenotemargin} is now directly defined in \Lpack{eledmac} to be able to manage \Lpack{eledpar}.}
+% \changes{v1.8.0}{2014/08/05}{Add \cs{sidenotemargin*}}
+% Specifies which margin sidenotes can be in.
+% \begin{macrocode}
+\WithSuffix\newcommand\sidenotemargin*[1]{%
+ \l@dgetsidenote@margin{#1}
+ \global\sidenote@marginR=\@l@dtempcntb
+ \global\sidenote@margin=\@l@dtempcntb
+}
+\newcount\sidenote@marginR
+\global\sidenote@margin=\@ne
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+
+% \changes{v1.3.3}{2012/12/19}{Debugging the left notes of the right column.}
+% \changes{v1.3.4}{2013/07/03}{Allow use of commands in sidenotes, as introduced by eledmac 1.0.}
+% \changes{v1.8.0}{2014/08/05}{\cs{l@dlsnote},\cs{l@drsnote} and \cs{l@dcsnote} defined only one time, in \Lpack{eledmac}. }
+% \begin{macro}{\affixside@noteR}
+% The right text version of \cs{affixside@note}.
+% \changes{v1.1.2}{2012/10/06}{Remove spurious space between line number and line content}
+% \begin{macrocode}
+\newcommand*{\affixside@noteR}{%
+ \def\sidenotecontent@{}%
+ \numgdef{\itemcount@}{0}%
+ \def\do##1{%
+ \ifnumequal{\itemcount@}{0}%
+ {%
+ \appto\sidenotecontent@{##1}}% Not print not separator before the 1st note
+ {\appto\sidenotecontent@{\sidenotesep ##1}%
+ }%
+ \numgdef{\itemcount@}{\itemcount@+1}%
+ }%
+ \dolistloop{\l@dcsnotetext}%
+ \ifnumgreater{\itemcount@}{1}{\led@err@ManySidenotes}{}%
+ \gdef\@templ@d{}%
+ \gdef\@templ@n{\l@dcsnotetext\l@dcsnotetext@l\l@dcsnotetext@r}%
+ \ifx\@templ@d\@templ@n \else%
+ \if@twocolumn%
+ \if@firstcolumn%
+ \setl@dlp@rbox{##1}{\sidenotecontent@}%
+ \else%
+ \setl@drp@rbox{\sidenotecontent@}%
+ \fi%
+ \else%
+ \@l@dtempcntb=\sidenote@marginR%
+ \ifnum\@l@dtempcntb>\@ne%
+ \advance\@l@dtempcntb by\page@numR%
+ \fi%
+ \ifodd\@l@dtempcntb%
+ \setl@drp@rbox{\sidenotecontent@}%
+ \gdef\sidenotecontent@{}%
+ \numdef{\itemcount@}{0}%
+ \dolistloop{\l@dcsnotetext@l}%
+ \ifnumgreater{\itemcount@}{1}{\led@err@ManyLeftnotes}{}%
+ \setl@dlp@rbox{\sidenotecontent@}%
+ \else%
+ \setl@dlp@rbox{\sidenotecontent@}%
+ \gdef\sidenotecontent@{}%
+ \numdef{\itemcount@}{0}%
+ \dolistloop{\l@dcsnotetext@r}%
+ \ifnumgreater{\itemcount@}{1}{\led@err@ManyRightnotes}{}%
+ \setl@drp@rbox{\sidenotecontent@}%
+ \fi%
+ \fi%
+ \fi%
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Familiar footnotes}
+%
+%
+% \begin{macro}{\l@dbfnote}
+% \verb?\l@dbfnote? adds the footnote to the insert list, and
+% \verb?\vl@dbfnote? calls the original \verb?\@footnotetext?.
+% \changes{v1.3.1}{2012/11/16}{Compatibility of standard footnotes with eledmac when theses footnotes contain any commands.}
+% \changes{v1.3.3}{2012/11/19}{Spurious space with footnote in right column.}
+% \begin{macrocode}
+\renewcommand{\l@dbfnote}[1]{%
+ \ifnumberedpar@
+ \gdef\@tag{#1\relax}%
+ \ifledRcol%
+ \xright@appenditem{\noexpand\vl@dbfnote{{\expandonce\@tag}}{\@thefnmark}}%
+ \to\inserts@listR
+ \global\advance\insert@countR \@ne%
+ \else%
+ \xright@appenditem{\noexpand\vl@dbfnote{{\expandonce\@tag}}{\@thefnmark}}%
+ \to\inserts@list
+ \global\advance\insert@count \@ne%
+ \fi
+ \fi\ignorespaces}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\normalbfnoteX}
+% \changes{v0.3.0}{2005/02/04}{Removed extraneous spaces from \cs{normalbfnoteX}}
+% \changes{v1.3.5}{2013/07/10}{Allows one to redefine \cs{thefootnoteX} with \c{alph} when some packages are loaded.}
+% \changes{v1.4.1}{2013/08/16}{Fix bug with normal familiar footnotes when mixing RTL and LTR text.}
+% \begin{macrocode}
+\renewcommand{\normalbfnoteX}[2]{%
+ \ifnumberedpar@
+ \ifledRcol%
+ \ifluatex
+ \footnotelang@lua[R]%
+ \fi
+ \@ifundefined{xpg@main@language}%if polyglossia
+ {}%
+ {\footnotelang@poly[R]}%
+ \protected@xdef\thisfootnote{\csuse{thefootnote#1}}%
+ \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\expandonce\thisfootnote}}%
+ \to\inserts@listR
+ \global\advance\insert@countR \@ne%
+ \else%
+ \ifluatex
+ \footnotelang@lua%
+ \fi
+ \@ifundefined{xpg@main@language}%if polyglossia
+ {}%
+ {\footnotelang@poly}%
+ \protected@xdef\thisfootnote{\csuse{thefootnote#1}}%
+ \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\expandonce\thisfootnote}}%
+ \to\inserts@list
+ \global\advance\insert@count \@ne%
+ \fi
+ \fi\ignorespaces}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+
+% \section{Verse}
+%\changes{v0.11.0}{2012/06/11}{New management of hangingsymbol insertion, preventing undesirable insertions.}
+%\changes{v0.12.0}{2012/08/03}{New management of hangingsymbol insertion, preventing undesirable insertions.}
+% Like in eledmac, the insertion of hangingsymbol is base on \cs{ifinserthangingsymbol}, and, for the right side, on \cs{ifinserthangingsymbolR}.
+% Both commands also include the hanging space, to be sure the \cs{one@line} of hanging lines has the same width that the \cs{one@line} of normal lines and to prevent the column separator from shifting.
+% \begin{macro}{\inserthangingsymbolL}
+% \begin{macro}{\inserthangingsymbolR}
+% \changes{v0.11.0}{2012/06/11}{Prevent the column separator for hanging verse from shifting}
+% \changes{v1.4.3}{2013/10/27}{Hanging verse is no longer automatically flush right.}
+% \changes{v1.15.0}{2015/04/13}{Prevent more efficiently the column separator from shifting when a verse is hanging}
+% \begin{macrocode}
+\newif\ifinserthangingsymbolR
+\newcommand{\inserthangingsymbolL}{%
+ \ifinserthangingsymbol%
+ \ifinstanzaL%
+ \hskip \@ifundefined{sza@0@}{0}{\expandafter%
+ \noexpand\csname sza@0@\endcsname}\stanzaindentbase%
+ \hangingsymbol%
+ \fi%
+ \fi%
+}%
+\newcommand{\inserthangingsymbolR}{%
+ \ifinserthangingsymbolR%
+ \ifinstanzaR%
+ \hskip \@ifundefined{sza@0@}{0}{\expandafter%
+ \noexpand\csname sza@0@\endcsname}\stanzaindentbase%
+ \hangingsymbol%
+ \fi%
+ \fi%
+}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+
+% Before we can define the main stanza macros we need to be able to save
+% and reset
+% the category code for \&. To save the current value we use
+% \verb+\next+ from the \verb+\loop+ macro.
+% \begin{macrocode}
+ \chardef\next=\catcode`\&
+ \catcode`\&=\active
+
+% \end{macrocode}
+%
+%
+%
+% \begin{environment}{astanza}
+% \changes{v1.4.1}{2013/08/16}{Enable the use of stanzaindentsrepetition within astanza environment.}
+% \changes{v1.13.0}{2015/03/06}{Enable the use of optional argument of \& in astanza environment.}
+% This is roughly an environmental form of \cs{stanza}, which treats
+% its stanza-like contents as a single chunk.
+%
+% \begin{macrocode}
+\newenvironment{astanza}{%
+ \startstanzahook
+ \catcode`\&\active
+ \global\stanza@count\@ne\stanza@modulo\@ne
+ \ifnum\usenamecount{sza@0@}=\z@
+ \let\stanza@hang\relax
+ \let\endlock\relax
+ \else
+ \rightskip\z@ plus 1fil\relax
+ \fi
+ \ifnum\usenamecount{szp@0@}=\z@
+ \let\sza@penalty\relax
+ \fi
+ \def&{%
+ \endlock\mbox{}%
+ \sza@penalty
+ \global\advance\stanza@count\@ne
+ \@astanza@line}%
+ \def\&{\@stopastanza}%
+ \pstart
+ \@astanza@line
+}{}
+
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\@stopastanza}
+% This command is called by \verb+\&+ in astanza environment.
+% It allows optional arguments.
+% \begin{macrocode}
+\newcommandx{\@stopastanza}[1][1,usedefault]{%
+ \endlock\mbox{}%
+ \pend[#1]%
+ \endstanzaextra%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@astanza@line}
+% This gets put at the start of each line in the environment. It sets up
+% the paragraph style --- each line is treated as a paragraph.
+% \begin{macrocode}
+\newcommand*{\@astanza@line}{%
+ \ifnum\value{stanzaindentsrepetition}=0
+ \parindent=\csname sza@\number\stanza@count
+ @\endcsname\stanzaindentbase
+ \else
+ \parindent=\csname sza@\number\stanza@modulo
+ @\endcsname\stanzaindentbase
+ \managestanza@modulo
+ \fi
+ \par
+ \stanza@hang%\mbox{}%
+ \ignorespaces}
+
+% \end{macrocode}
+% \end{macro}
+%
+% Lastly reset the modified category codes.
+% \begin{macrocode}
+ \catcode`\&=\next
+
+% \end{macrocode}
+%
+% \section{Naming macros}
+%
+% The \LaTeX\ kernel provides \cs{@namedef} and \cs{@namuse} for defining
+% and using macros that may have non-letters in their names. We need
+% something similar here as we are going to need and use some numbered
+% boxes and counters.
+%
+% \begin{macro}{\newnamebox}
+% \begin{macro}{\setnamebox}
+% \begin{macro}{\unhnamebox}
+% \begin{macro}{\unvnamebox}
+% \begin{macro}{\namebox}
+% A set of macros for creating and using `named'boxes; the macros are called
+% after the regular box macros, but including the string `name'.
+% \begin{macrocode}
+\providecommand*{\newnamebox}[1]{%
+ \expandafter\newbox\csname #1\endcsname}
+\providecommand*{\setnamebox}[1]{%
+ \expandafter\setbox\csname #1\endcsname}
+\providecommand*{\unhnamebox}[1]{%
+ \expandafter\unhbox\csname #1\endcsname}
+\providecommand*{\unvnamebox}[1]{%
+ \expandafter\unvbox\csname #1\endcsname}
+\providecommand*{\namebox}[1]{%
+ \csname #1\endcsname}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\newnamecount}
+% \begin{macro}{\usenamecount}
+% Macros for creating and using `named' counts.
+% \begin{macrocode}
+\providecommand*{\newnamecount}[1]{%
+ \expandafter\newcount\csname #1\endcsname}
+\providecommand*{\usenamecount}[1]{%
+ \csname #1\endcsname}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \section{Counts and boxes for parallel texts}
+%
+% In sequential text, each chunk (that enclosed by \cs{pstart} \ldots
+% \cs{pend}) is put into a box called \cs{raw@text} and then immediately
+% printed, resulting in the box being emptied and ready for the next chunk.
+% For parallel processing multiple boxes are needed as printing is delayed.
+% We also need extra counters for various things.
+%
+% \begin{macro}{\maxchunks}
+% \begin{macro}{\l@dc@maxchunks}
+% The maximum number of chunk pairs before printing has to be called for.
+% The default is 5120 chunk pairs.
+% \begin{macrocode}
+\newcount\l@dc@maxchunks
+\newcommand{\maxchunks}[1]{\l@dc@maxchunks=#1}
+ \maxchunks{5120}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@dnumpstartsL}
+% \begin{macro}{\l@dnumpstartsR}
+% The numbers of left and right chunks. \cs{l@dnumpstartsL} is defined
+% in \Lpack{eledmac}.
+% \changes{v0.3.0}{2005/02/24}{Moved \cs{l@dnumpstartsL} to eledmac}
+% \begin{macrocode}
+\newcount\l@dnumpstartsR
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@pscL}
+% \begin{macro}{\l@pscR}
+% A couple of scratch counts for use in left and right texts, respectively.
+% \begin{macrocode}
+\newcount\l@dpscL
+\newcount\l@dpscR
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@dsetuprawboxes}
+% This macro creates \cs{maxchunks} pairs of boxes for left and right
+% chunks. The boxes are called \cs{l@dLcolrawbox1}, \cs{l@dLcolrawbox2}, etc.
+% \begin{macrocode}
+\newcommand*{\l@dsetuprawboxes}{%
+ \@l@dtempcntb=\l@dc@maxchunks
+ \loop\ifnum\@l@dtempcntb>\z@
+ \newnamebox{l@dLcolrawbox\the\@l@dtempcntb}
+ \newnamebox{l@dRcolrawbox\the\@l@dtempcntb}
+ \advance\@l@dtempcntb \m@ne
+ \repeat}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@dsetupmaxlinecounts}
+% \begin{macro}{\l@dzeromaxlinecounts}
+% To be able to synchronise left and right texts we need
+% to know the maximum number of text lines there are in each pair of chunks.
+% \cs{l@dsetupmaxlinecounts} creates \cs{maxchunks} new counts
+% called \cs{l@dmaxlinesinpar1}, etc., and
+% \cs{l@dzeromaxlinecounts} zeroes all of them.
+% \begin{macrocode}
+\newcommand*{\l@dsetupmaxlinecounts}{%
+ \@l@dtempcntb=\l@dc@maxchunks
+ \loop\ifnum\@l@dtempcntb>\z@
+ \newnamecount{l@dmaxlinesinpar\the\@l@dtempcntb}
+ \advance\@l@dtempcntb \m@ne
+ \repeat}
+\newcommand*{\l@dzeromaxlinecounts}{%
+ \begingroup
+ \@l@dtempcntb=\l@dc@maxchunks
+ \loop\ifnum\@l@dtempcntb>\z@
+ \global\usenamecount{l@dmaxlinesinpar\the\@l@dtempcntb}=\z@
+ \advance\@l@dtempcntb \m@ne
+ \repeat
+ \endgroup}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% Make sure that all these are set up. This has to be done after the
+% user has had an opportunity to change \cs{maxchunks}.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \l@dsetuprawboxes
+ \l@dsetupmaxlinecounts
+ \l@dzeromaxlinecounts
+ \l@dnumpstartsL=\z@
+ \l@dnumpstartsR=\z@
+ \l@dpscL=\z@
+ \l@dpscR=\z@}
+
+% \end{macrocode}
+%
+% \section{Fixing babel}
+%
+% With parallel texts there is the possibility that the two sides
+% might use different languages via \verb?babel?. On the other hand,
+% \verb?babel? might not be called at all (even though it might be already
+% built into the format).
+% \changes{v0.2.0}{2004/12/20}{Added section of babel related code}
+%
+% With the normal sequential text each line is initially typeset
+% in the current language environment, and then it is output at which
+% time its attachments are typeset (in the same language environment.
+% In the parallel case lines are typeset in their current language but
+% an attachment might be typeset outside the language environment
+% of its line if the left and right side languages are different.
+% To counter this, we have to make sure that the correct language is
+% used at the proper times.
+%
+% \begin{macro}{\ifl@dusedbabel}
+% \begin{macro}{\l@dusedbabelfalse}
+% \begin{macro}{\l@dusedbabeltrue}
+% A flag for checking if \verb?babel? has been used as a package.
+% \begin{macrocode}
+\newif\ifl@dusedbabel
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ifl@dsamelang}
+% Suppress \cs{ifl@dsamelang} which didn't work and was not logical, because both columns could have the same language but not the main language of the document.
+% \end{macro}
+%
+% \begin{macro}{\l@dchecklang}
+% \changes{v1.8.0}{2014/08/05}{Suppress \cs{l@dchecklang} which didn't work and was not logical, because both columns could have the same language but not the main language of the document.}
+% \end{macro}
+% \begin{macro}{\l@dbbl@set@language}
+% In \verb?babel? the macro \cs{bbl@set@language}\marg{lang} does the work when
+% the language \meta{lang} is changed via \cs{selectlanguage}.
+% Unfortunately for me, if it is given
+% an argument in the form of a control sequence it strips off the \verb?\?
+% character rather than expanding the command. I need a version that accepts
+% an argument in the form \cs{lang} without it stripping the \verb?\?.
+% \begin{macrocode}
+\newcommand*{\l@dbbl@set@language}[1]{%
+ \edef\languagename{#1}%
+ \select@language{\languagename}%
+ \if@filesw
+ \protected@write\@auxout{}{\string\select@language{\languagename}}%
+ \addtocontents{toc}{\string\select@language{\languagename}}%
+ \addtocontents{lof}{\string\select@language{\languagename}}%
+ \addtocontents{lot}{\string\select@language{\languagename}}%
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% The rest of the setup has to be postponed until the end of the preamble
+% when we know if \verb?babel? has been used or not. However, for now assume
+% that it has not been used.
+%
+% \begin{macro}{\selectlanguage}
+% \begin{macro}{\l@duselanguage}
+% \begin{macro}{\theledlanguageL}
+% \begin{macro}{\theledlanguageR}
+% \cs{selectlanguage} is a \verb?babel? command. \cs{theledlanguageL} and
+% \cs{theledlanguageR} are the names of the languages of the left and right
+% texts. \cs{l@duselanguage} is similar to \cs{selectlanguage}.
+% \begin{macrocode}
+\providecommand{\selectlanguage}[1]{}
+\newcommand*{\l@duselanguage}[1]{}
+\gdef\theledlanguageL{}
+\gdef\theledlanguageR{}
+
+% \end{macrocode}
+%
+% Now do the \verb?babel? fix or \verb?polyglossia?, if necessary.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \@ifundefined{xpg@main@language}{%
+ \@ifundefined{bbl@main@language}{%
+% \end{macrocode}
+% Either \verb?babel? has not been used or it has been used with no
+% specified language.
+% \begin{macrocode}
+ \l@dusedbabelfalse
+ \renewcommand*{\selectlanguage}[1]{}}{%
+% \end{macrocode}
+% Here we deal with the case where babel has been used. \cs{selectlanguage}
+% has to be redefined to use our version of \cs{bbl@set@language} and to
+% store the left or right language.
+% \begin{macrocode}
+ \l@dusedbabeltrue
+ \let\l@doldselectlanguage\selectlanguage
+ \let\l@doldbbl@set@language\bbl@set@language
+ \let\bbl@set@language\l@dbbl@set@language
+ \renewcommand{\selectlanguage}[1]{%
+ \l@doldselectlanguage{#1}%
+ \ifledRcol \gdef\theledlanguageR{#1}%
+ \else \gdef\theledlanguageL{#1}%
+ \fi}
+% \end{macrocode}
+% \cs{l@duselanguage} simply calls the original \cs{selectlanguage} so
+% that \cs{theledlanguageL} and \cs{theledlanguageR} are unaltered.
+% \begin{macrocode}
+ \renewcommand*{\l@duselanguage}[1]{%
+ \l@doldselectlanguage{#1}}
+% \end{macrocode}
+% Lastly, initialise the left and right languages to the current \verb?babel?
+% one.
+% \begin{macrocode}
+ \gdef\theledlanguageL{\bbl@main@language}%
+ \gdef\theledlanguageR{\bbl@main@language}%
+ }%
+ }
+% \end{macrocode}
+% If on Polyglossia
+% \changes{v1.8.0}{2014/08/05}{Correct left/right language setting with polyglossia.}
+% \changes{v1.9.0}{2014/09/16}{Debug left/right language switching with polyglossia. Don't write in .aux file when setting left/right lines.}
+% \begin{macrocode}
+ { \let\old@otherlanguage\otherlanguage%
+ \renewcommand{\otherlanguage}[2][]{%
+ \selectlanguage[#1]{#2}%
+ \ifledRcol \gdef\theledlanguageR{#2}%
+ \else \gdef\theledlanguageL{#2}%
+ \fi}%
+ \let\l@duselanguage\select@language%
+ \gdef\theledlanguageL{\xpg@main@language}%
+ \gdef\theledlanguageR{\xpg@main@language}%
+% \end{macrocode}
+% That's it.
+% \begin{macrocode}
+}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\if@pstarts}
+% \begin{macro}{\@pstartstrue}
+% \begin{macro}{\@pstartsfalse}
+% \begin{macro}{\check@pstarts}
+% \cs{check@pstarts} returns \cs{@pstartstrue} if there are any unprocessed
+% chunks.
+% \begin{macrocode}
+\newif\if@pstarts
+\newcommand*{\check@pstarts}{%
+ \@pstartsfalse
+ \ifnum\l@dnumpstartsL>\l@dpscL
+ \@pstartstrue
+ \else
+ \ifnum\l@dnumpstartsR>\l@dpscR
+ \@pstartstrue
+ \fi
+ \fi
+}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ifaraw@text}
+% \begin{macro}{\araw@texttrue}
+% \begin{macro}{\araw@textfalse}
+% \begin{macro}{\checkraw@text}
+% \cs{checkraw@text} checks whether the current Left or Right box is
+% void or not. If one or other is not void it sets \cs{araw@texttrue},
+% otherwise both are void and it sets \cs{araw@textfalse}.
+% \begin{macrocode}
+\newif\ifaraw@text
+\newcommand*{\checkraw@text}{%
+ \araw@textfalse
+ \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}
+ \araw@texttrue
+ \else
+ \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}
+ \araw@texttrue
+ \fi
+ \fi
+}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\@writelinesinparL}
+% \begin{macro}{\@writelinesinparR}
+% These write the number of text lines in a chunk to the section files,
+% and then afterwards zero the counter.
+% \begin{macrocode}
+\newcommand*{\@writelinesinparL}{%
+ \edef\next{%
+ \write\linenum@out{\string\@pend[\the\@donereallinesL]}}%
+ \next
+ \global\@donereallinesL \z@}
+\newcommand*{\@writelinesinparR}{%
+ \edef\next{%
+ \write\linenum@outR{\string\@pendR[\the\@donereallinesR]}}%
+ \next
+ \global\@donereallinesR \z@}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \section{Parallel columns}
+%
+% \begin{macro}{\@eledsectionL}
+% \begin{macro}{\@eledsectionR}
+% The parbox \cs{@eledsectionL} and \cs{@eledsectionR} will keep the sections' title.
+% \begin{macrocode}
+\newsavebox{\@eledsectionL}%
+\newsavebox{\@eledsectionR}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\Columns}
+% \changes{v1.8.0}{2014/07/28}{Modify \cs{Columns} to enable to add section's title.}
+% The \cs{Columns} command results in the previous Left and
+% Right texts being typeset in matching columns. There should
+% be equal numbers of chunks in the left and right texts.
+%
+% \changes{v1.12.0}{2015/02/23}{Add \cs{l@dprintingcolumnstrue}}
+% \begin{macrocode}
+\newcommand*{\Columns}{%
+ \ifl@dpairing%
+ \led@err@Columns@InsideEnv%
+ \fi%
+ \l@dprintingcolumnstrue%
+ \eledsection@correcting@skip=-\baselineskip% Correction for sections' titles
+ \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else
+ \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}%
+ \fi
+% \end{macrocode}
+% Start a group and zero counters, etc.
+% \begin{macrocode}
+ \begingroup
+ \l@dzeropenalties
+ \endgraf\global\num@lines=\prevgraf
+ \global\num@linesR=\prevgraf
+ \global\par@line=\z@
+ \global\par@lineR=\z@
+ \global\l@dpscL=\z@
+ \global\l@dpscR=\z@
+% \end{macrocode}
+% Check if there are chunks to be processed, and process them
+% two by two (left and right pairs).
+% \begin{macrocode}
+ \check@pstarts
+ \loop\if@pstarts
+ \global\pstartnumtrue
+ \global\pstartnumRtrue
+% \end{macrocode}
+% Increment \cs{l@dpscL} and \cs{l@dpscR} which here count
+% the numbers of left and right chunks.
+% Also restore the value of the public pstart counters.
+% \begin{macrocode}
+ \global\advance\l@dpscL \@ne
+ \global\advance\l@dpscR \@ne
+ \restore@pstartL@pc%
+ \restore@pstartR@pc%
+% \end{macrocode}
+% We print the optional argument of \cs{pstart} or the argument of \cs{AtEveryPstart}.
+% \begin{macrocode}
+ \Columns@print@before@pstart%
+% \end{macrocode}
+% Check if there is text yet to be processed in at least one of
+% the two current chunks, and also whether the left and right languages
+% are the same
+% \changes{v0.2.0}{2004/12/20}{Added \cs{l@dchecklang} and \cs{l@duselanguage}
+% to \cs{Columns}}
+% \changes{v1.8.0}{2014/08/05}{Suppress \cs{l@dchecklang} from \cs{Columns}.}
+% \begin{macrocode}
+ \checkraw@text
+{ \loop\ifaraw@text
+% \end{macrocode}
+% Grab the next pair of left and right text lines and output them, swapping
+% languages if they differ, adding section title if needed.
+% \begin{macrocode}
+ \l@duselanguage{\theledlanguageL}%
+ \do@lineL
+ \xifinlist{\the\l@dpscL}{\eled@sections@@}
+ {%
+ \ifdefstring{\@eledsectmark}{L}%
+ {\csuse{eled@sectmark@\the\l@dpscL}%
+ }{}%
+ \global\csundef{eled@sectmark@\the\l@dpscL}%
+ \savebox{\@eledsectionL}{\parbox[t][][t]{\Lcolwidth}{\vbox{}\print@eledsectionL}}%\vbox{}-> prevent alignment troubles with RTL language
+ }%
+ {}%
+ \l@duselanguage{\theledlanguageR}%
+ \do@lineR
+ \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}
+ {%
+ \ifdefstring{\@eledsectmark}{R}%
+ {\csuse{eled@sectmark@\the\l@dpscR R}%
+ }{}%
+ \global\csundef{eled@sectmark@\the\l@dpscR R}%
+ \savebox{\@eledsectionR}{\parbox[t][][t]{\Rcolwidth}{\vbox{}\print@eledsectionR}}}%\vbox{}-> prevent alignment troubles with RTL language
+ {}%
+ \hb@xt@ \hsize{%
+ \ifdefstring{\columns@position}{L}{}{\hfill }%
+ \unhbox\l@dleftbox%
+ \ifhbox\@eledsectionL%
+ \usebox{\@eledsectionL}%
+ \fi%
+ \print@columnseparator%
+ \unhbox\l@drightbox%
+ \ifhbox\@eledsectionR%
+ \usebox{\@eledsectionR}%
+ \fi%
+ \ifdefstring{\columns@position}{R}{}{\hfill}%
+ }%
+ \checkraw@text
+ \checkverseL
+ \checkverseR
+ \checkpb@columns
+ \repeat}
+% \end{macrocode}
+% Having completed a pair of chunks, write the number of lines
+% in each chunk to the respective section files. Increment pstart counters and reset line numbering if it's by pstart.
+% \changes{v0.11.0}{2012/06/11}{Line numbering by pstart.}
+% \begin{macrocode}
+ \@writelinesinparL
+ \@writelinesinparR
+ \check@pstarts
+ \ifbypstart@%
+ \write\linenum@out{\string\@set[1]}
+ \resetprevline@
+ \fi
+ \ifbypstart@R
+ \write\linenum@outR{\string\@set[1]}
+ \resetprevline@
+ \fi
+ \Columns@print@after@pend%
+ \repeat
+% \end{macrocode}
+% Having output all chunks, make sure all notes have been output,
+% then zero counts ready for the next set of texts. The boolean tests for stanza are switched to false.
+% \begin{macrocode}
+ \flush@notes
+ \flush@notesR
+ \endgroup
+% \end{macrocode}
+% \begin{macrocode}
+ \global\l@dpscL=\z@
+ \global\l@dpscR=\z@
+ \global\l@dnumpstartsL=\z@
+ \global\l@dnumpstartsR=\z@
+ \l@dprintingcolumnsfalse%
+ \ignorespaces
+ \global\instanzaLfalse
+ \global\instanzaRfalse}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\print@columnseparator}
+% \changes{v1.8.0}{2014/08/05}{Move some code of \cs{Columns} to \cs{print@columnseparator}.}
+% \cs{print@columnseparator} prints the column separator, with surrounding spaces (as the user has set them).
+% We use the \TeX\ \cs{ifdim} instead of \Lpack{etoolbox}
+% to avoid having \cs{hfill} in a \verb+{}+, which deletes some space (but not much).
+% \begin{macrocode}
+\def\print@columnseparator{%
+ \ifdim\beforecolumnseparator<0pt%
+ \hfill%
+ \else%
+ \hspace{\beforecolumnseparator}%
+ \fi%
+ \columnseparator%
+ \ifdim\aftercolumnseparator<0pt%
+ \hfill%
+ \else%
+ \hspace{\beforecolumnseparator}%
+ \fi%
+}%
+%\end{macrocode}
+% \end{macro}
+% \begin{macro}{\checkpb@columns}
+% \cs{checkpb@columns} prevent or make pagebreaking in columns, depending of the use of \cs{ledpb} or \cs{lednopb}.
+% \begin{macrocode}
+
+\newcommand{\checkpb@columns}{%
+ \newif\if@pb
+ \newif\if@nopb
+ \IfStrEq{\led@pb@setting}{before}{
+ \numdef{\next@absline}{\the\absline@num+1}%
+ \numdef{\next@abslineR}{\the\absline@numR+1}%
+ \xifinlistcs{\next@absline}{l@prev@pb}{\@pbtrue}{}%
+ \xifinlistcs{\next@abslineR}{l@prev@pbR}{\@pbtrue}{}
+ \xifinlistcs{\next@absline}{l@prev@nopb}{\@nopbtrue}{}%
+ \xifinlistcs{\next@abslineR}{l@prev@nopbR}{\@nopbtrue}{}
+ }{}
+ \IfStrEq{\led@pb@setting}{after}{
+ \xifinlistcs{\the\absline@num}{l@prev@pb}{\@pbtrue}{}%
+ \xifinlistcs{\the\absline@numR}{l@prev@pbR}{\@pbtrue}{}
+ \xifinlistcs{\the\absline@num}{l@prev@nopb}{\@nopbtrue}{}%
+ \xifinlistcs{\the\absline@numR}{l@prev@nopbR}{\@nopbtrue}{}
+ }{}
+\if@nopb\nopagebreak[4]\enlargethispage{\baselineskip}\fi
+\if@pb\pagebreak[4]\fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\columnseparator}
+% \begin{macro}{\columnrulewidth}
+% The separator between line pairs in parallel columns is in the form
+% of a vertical rule extending a little below the baseline and with a height
+% slightly greater than the \cs{baselineskip}. The width of the rule
+% is \cs{columnrulewidth} (initially 0pt so the rule is invisible).
+% \begin{macrocode}
+\newcommand*{\columnseparator}{%
+ \smash{\rule[-0.2\baselineskip]{\columnrulewidth}{1.05\baselineskip}}}
+\newdimen\columnrulewidth
+ \columnrulewidth=\z@
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\columnsposition}
+% \begin{macro}{\columns@position}
+% The position of the \cs{Columns} in a page. Default value is R.
+% Stored in \cs{columns@position}.
+% \begin{macrocode}
+\newcommand*{\columnsposition}[1]{%
+ \xdef\columns@position{#1}%
+ }%
+\xdef\columns@position{R}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\beforecolumnseparator}
+% \begin{macro}{\aftercolumnseparator}
+% \cs{beforecolumnseparator} and \cs{aftercolumnseparator} lengths are defined to \verb+-1pt+. If user changes them to a positive length, the lengths are used to define blank spaces before / after the column separator, instead of \cs{hfill}.
+% \begin{macrocode}
+\newlength{\beforecolumnseparator}%
+\setlength{\beforecolumnseparator}{-2pt}%
+
+\newlength{\aftercolumnseparator}%
+\setlength{\aftercolumnseparator}{-2pt}%
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{setwidthliketwocolumns@L}
+% \begin{macro}{setpositionliketwocolumns@L}
+% \begin{macro}{setnotepositionliketwocolumns@L}
+% \begin{macro}{setwidthliketwocolumns@C}
+% \begin{macro}{setpositionliketwocolumns@C}
+% \begin{macro}{setnotepositionliketwocolumns@C}
+% \begin{macro}{setwidthliketwocolumns@R}
+% \begin{macro}{setpositionliketwocolumns@R}
+% \begin{macro}{setnotepositionliketwocolumns@R}
+% The \cs{setwidth…} macros are called in \cs{beginnumbering} in a \textbf{non-parallel}
+% typesetting context, to fix the width of the lines to be vertically aligned with parallel columns. They are also called at the beginning of a note's group, if some options are enabled.
+% The \cs{setposition…} macros are called in \cs{beginnumbering} in a \textbf{non- parallel} typesetting context to fix the position of the lines.
+% The \cs{setnoteposition…} macros are called in \cs{xxxfootstart} in a \textbf{non- parallel} typesetting context to fix the position of notes block.
+% \begin{macrocode}
+\newcommand{\setwidthliketwocolumns@L}{%
+% Temporary dimension, initially equal to the standard hsize, i.e. text width
+% \begin{macrocode}
+ \newdimen\temp%
+ \temp=\hsize%
+% \end{macrocode}
+% Hsize : Left + Right width
+% \begin{macrocode}
+ \hsize=\Lcolwidth%
+ \advance\hsize\Rcolwidth%
+% \end{macrocode}
+% Now, calculating the remaining space
+% \begin{macrocode}
+ \advance\temp-\hsize%
+% \end{macrocode}
+% And multiply the hsize by 2/3 of this space
+% \begin{macrocode}
+ \multiply\temp by 2%
+ \divide\temp by 3%
+ \advance\hsize\temp%
+}%
+
+\newcommand{\setpositionliketwocolumns@L}{%
+ \renewcommand{\ledrlfill}{\hfill}%
+}%
+
+\newcommand{\setnotespositionliketwocolumns@L}{%
+}%
+
+
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\setwidthliketwocolumns@C}{%
+% Temporary dimension, initially equal to the standard hsize, i.e. text width
+% \end{macrocode}
+% \begin{macrocode}
+ \newdimen\temp%
+ \temp=\hsize%
+% Hsize : Left + Right width
+% \end{macrocode}
+% \begin{macrocode}
+ \hsize=\Lcolwidth%
+ \advance\hsize\Rcolwidth%
+% Now, calculating the remaining space
+% \end{macrocode}
+% \begin{macrocode}
+ \advance\temp-\hsize%
+% \end{macrocode}
+% And multiply the hsize by 1/2 of this space
+% \begin{macrocode}
+ \divide\temp by 2%
+ \advance\hsize\temp%
+}%
+
+\newcommand{\setpositionliketwocolumns@C}{%
+ \doinsidelinehook{\hfill}%
+ \renewcommand{\ledrlfill}{\hfill}%
+}%
+
+\newcommand{\setnotespositionliketwocolumns@C}{%
+ \newdimen\temp%
+ \newdimen\tempa%
+ \temp=\hsize%
+ \tempa=\Lcolwidth%
+ \advance\tempa\Rcolwidth%
+ \advance\temp-\tempa%
+ \divide\temp by 2%
+ \leftskip=\temp%
+ \rightskip=-\temp%
+}%
+
+\newcommand{\setwidthliketwocolumns@R}{%
+% \end{macrocode}
+% Temporary dimension, initially equal to the standard hsize, i.e. text width
+% \begin{macrocode}
+ \newdimen\temp%
+ \temp=\hsize%
+% \end{macrocode}
+% Hsize : Left + Right width
+% \begin{macrocode}
+ \hsize=\Lcolwidth%
+ \advance\hsize\Rcolwidth%
+% \end{macrocode}
+% Now, calculating the remaining space
+% \begin{macrocode}
+ \advance\temp-\hsize%
+% \end{macrocode}
+% And multiply the hsize by 2/3 of this space
+% \begin{macrocode}
+ \multiply\temp by 2%
+ \divide\temp by 3%
+ \advance\hsize\temp%
+}%
+
+\newcommand{\setpositionliketwocolumns@R}{%
+ \doinsidelinehook{\hfill}%
+}%
+
+\newcommand{\setnotespositionliketwocolumns@R}{%
+ \newdimen\temp%
+ \newdimen\tempa%
+ \temp=\hsize%
+ \tempa=\Lcolwidth%
+ \advance\tempa\Rcolwidth%
+ \advance\temp-\tempa%
+ \divide\temp by 2%
+ \leftskip=\temp%
+ \rightskip=-\temp%
+}%
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\Columns@print@before@pstart}
+% \begin{macro}{\Columns@print@after@pend}
+% The \cs{Columns@print@before@pstart} and \cs{Columns@print@after@pend} print the content of the optional argument of \cs{pstart} / \cs{pend}. If this content is not empty, it also print the separator.
+% \begin{macrocode}
+\newcommand{\Columns@print@before@pstart}{%
+ \ifboolexpr{%
+ test{\ifcsstring{before@pstartL@\the\l@dpscL}{\at@every@pstart}}%
+ and test {\ifcsstring{before@pstartR@\the\l@dpscR}{\at@every@pstart}}%
+ and test {\ifdefempty{\at@every@pstart}}}%
+ {}%
+ {%
+ \hb@xt@ \hsize{%
+ \ifdefstring{\columns@position}{L}{}{\hfill }%
+ \par\parbox[t][][t]{\Lcolwidth}{%
+ \csuse{before@pstartL@\the\l@dpscL}%
+ }%
+ \print@columnseparator%
+ \parbox[t][][t]{\Rcolwidth}{%
+ \csuse{before@pstartR@\the\l@dpscR}%
+ }%
+ \ifdefstring{\columns@position}{R}{}{\hfill}%
+ }%
+ }%
+ \global\csundef{before@pstartL@\the\l@dpscL}%
+ \global\csundef{before@pstartR@\the\l@dpscR}%
+}%
+\newcommand{\Columns@print@after@pend}{%
+ \ifboolexpr{%
+ test{\ifcsstring{after@pendL@\the\l@dpscL}{\at@every@pend}}%
+ and test {\ifcsstring{after@pendR@\the\l@dpscR}{\at@every@pend}}%
+ and test {\ifdefempty{\at@every@pend}}}%
+ {}%
+ {%
+ \hb@xt@ \hsize{%
+ \ifdefstring{\columns@position}{L}{}{\hfill }%
+ \parbox[t][][t]{\Lcolwidth}{%
+ \csuse{after@pendL@\the\l@dpscL}%
+ }%
+ \print@columnseparator%
+ \parbox[t][][t]{\Rcolwidth}{%
+ \csuse{after@pendR@\the\l@dpscR}%
+ }%
+ \ifdefstring{\columns@position}{R}{}{\hfill}%
+ }%
+ }%
+ \global\csundef{after@pendL@\the\l@dpscL}%
+ \global\csundef{after@pendR@\the\l@dpscR}%
+}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \section{Parallel pages}
+%
+% This is considerably more complicated than parallel columns.
+%
+% \subsection{Specific counters}
+% \begin{macro}{\numpagelinesL}
+% \begin{macro}{\numpagelinesR}
+% \begin{macro}{\l@dminpagelines}
+% Counts for the number of lines on a left or right page, and the smaller
+% of the number of lines on a pair of facing pages.
+% \begin{macrocode}
+\newcount\numpagelinesL
+\newcount\numpagelinesR
+\newcount\l@dminpagelines
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \subsection{Main macro}
+% \begin{macro}{\Pages}
+% \changes{v1.8.0}{2014/07/28}{Modify \cs{Pages} to enable to add section's title.}
+% \changes{v1.8.3}{2014/08/31}{Debug blank pages when using optional argument in the last \cs{pend}.}
+% \changes{v1.10.0}{2015/01/12}{Debug wrong pages splitting when no optional argument is used in last \cs{pend} (bug was added in v.1.8.3).}
+% \changes{v1.10.0}{2015/01/12}{Debug wrong parallel pages synchronization when an \cs{edtext} falls accross two pages.}
+% \changes{v1.13.0}{2015/03/06}{When using shiftedpstarts option, a \cs{l@dleftbox} with a null height will advance the \cs{pagetotal} in any case.}
+% \changes{v1.13.1}{2015/03/12}{Prevent false empty page after \cs{Pages} (bug added in 1.13.0)}
+% The \cs{Pages} command results in the previous Left and
+% Right texts being typeset on matching facing pages. There should
+% be equal numbers of chunks in the left and right texts.
+%
+% \changes{v1.12.0}{2015/02/23}{Add \cs{l@dprintingpagestrue}}
+% \begin{macrocode}
+\newcommand*{\Pages}{%
+ \l@dprintingpagestrue%
+ \ifl@dpairing%
+ \led@err@Pages@InsideEnv%
+ \fi%
+ \eledsection@correcting@skip=-2\baselineskip% line correcting for section titles.
+ \parledgroup@notespacing@set@correction%
+ \typeout{}%
+ \typeout{*************************** PAGES ***************************}%
+ \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else%
+ \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}%
+ \fi%
+% \end{macrocode}
+% \changes{v1.13.0}{2015/03/06xx}{Prevent false overfull hboxes when using \cs{Pages} outside of pages environment.}
+% As \cs{Pages} must be called outside of the pages environment, we have to redefine the \cs{Lcolwidth} and \cs{Rcolwidth} lengths, to prevent false overfull hboxes.
+% \begin{macrocode}
+ \setlength{\Lcolwidth}{\textwidth}%
+ \setlength{\Rcolwidth}{\textwidth}%
+% \end{macrocode}
+% Get onto an empty even (left) page, then initialise counters, etc.
+% \begin{macrocode}
+ \cleartol@devenpage%
+ \begingroup%
+ \l@dzeropenalties%
+ \endgraf\global\num@lines=\prevgraf%
+ \global\num@linesR=\prevgraf%
+ \global\par@line=\z@%
+ \global\par@lineR=\z@%
+ \global\l@dpscL=\z@%
+ \global\l@dpscR=\z@%
+ \writtenlinesLfalse%
+ \writtenlinesRfalse%
+% \end{macrocode}
+% Sometimes, people what to have the same page number on both left and right sides. To do this, use the \cs{init@sameparallelpage@number} command.
+% \begin{macrocode}
+ \init@sameparallelpage@number
+% \end{macrocode}
+% The footnotes are printed in a different way from expected in \Lpack{eledmac}, as we may want to print the notes on one side only.
+% \begin{macrocode}
+ \let\print@Xnotes\print@Xnotes@forpages%
+ \let\print@notesX\print@notesX@forpages%
+% \end{macrocode}
+% Check if there are chunks to be processed.
+% \begin{macrocode}
+ \check@pstarts%
+ \loop\if@pstarts%
+% \end{macrocode}
+% Loop over the number of chunks, incrementing the chunk counts
+% (\cs{l@dpscL}
+% and \cs{l@dpscR} are chunk (box) counts.)
+% \begin{macrocode}
+ \global\advance\l@dpscL \@ne%
+ \global\advance\l@dpscR \@ne%
+% \end{macrocode}
+% Calculate the maximum number of real text lines in the chunk pair,
+% storing the result in the relevant \cs{l@dmaxlinesinpar}.
+% \begin{macrocode}
+ \getlinesfromparlistL%
+ \getlinesfromparlistR%
+ \l@dcalc@maxoftwo{\@cs@linesinparL}{\@cs@linesinparR}%
+ {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
+ \check@pstarts%
+ \repeat%
+% \end{macrocode}
+% Zero the counts again, ready for the next bit.
+% \begin{macrocode}
+ \global\l@dpscL=\z@%
+ \global\l@dpscR=\z@%
+% \end{macrocode}
+% Get the number of lines on the first pair of pages and store
+% the minumum in \cs{l@dminpagelines}.
+% \begin{macrocode}
+ \getlinesfrompagelistL%
+ \getlinesfrompagelistR%
+ \l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}%
+ {\l@dminpagelines}%
+% \end{macrocode}
+% Now we start processing the left and right chunks (\cs{l@dpscL} and
+% \cs{l@dpscR} count the left and right chunks), starting with the first pair.
+% \begin{macrocode}
+ \check@pstarts%
+ \if@pstarts%
+% \end{macrocode}
+% Increment the chunk counts to get the first pair.
+% Restore also the value of public pstart counters.
+% \begin{macrocode}
+ \global\advance\l@dpscL \@ne%
+ \global\advance\l@dpscR \@ne%
+ \restore@pstartL@pc%
+ \restore@pstartR@pc%
+% \end{macrocode}
+% We haven't processed any lines from these chunks yet, so zero the
+% respective line counts.
+% \begin{macrocode}
+ \global\@donereallinesL=\z@%
+ \global\@donetotallinesL=\z@%
+ \global\@donereallinesR=\z@%
+ \global\@donetotallinesR=\z@%
+% \end{macrocode}
+% Start a loop over the boxes (chunks).
+% \begin{macrocode}
+ \checkraw@text%
+% \end{macrocode}
+% \begin{macrocode}
+% \begingroup
+{ \loop\ifaraw@text%
+% \end{macrocode}
+% See if there is more that can be done for the left page and set up the
+% left language.
+% \changes{v0.2.0}{2004/12/20}{Added \cs{l@duselanguage} to \cs{Pages}}
+% \begin{macrocode}
+ \checkpageL%
+ \l@duselanguage{\theledlanguageL}%
+{ \loop\ifl@dsamepage%
+% \end{macrocode}
+% Process the next (left) text line, adding it to the page.
+% Eventually, adds the optional argument of pstart.
+% \changes{v0.3.0}{2005/02/10}{Added \cs{ledstrutL} to \cs{Pages}}
+% \begin{macrocode}
+ \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{}%
+ \csuse{before@pstartL@\the\l@dpscL}%
+ \global\csundef{before@pstartL@\the\l@dpscL}%
+ \do@lineL%
+ \xifinlist{\the\l@dpscL}{\eled@sections@@}
+ {\print@eledsectionL}%
+ {}%
+ \advance\numpagelinesL \@ne%
+% \end{macrocode}
+% When using shiftedpstarts option, a \cs{l@dleftbox} with a null height is not printed.
+% That means we do not insert blank lines at the end of a left chunk lower than the corresponding right chunk.
+% However, a \cs{l@dleftbox} with a null height will advance the \cs{pagetotal} in any case.
+% Because if we do not do this, the \cs{checkpageL} could let \cs{ifl@pagefull} to false,
+% and consequently a \cs{@lopL} equal to 1000 could be written in the numbered file,
+% even if all the lines actually needed for the current page have been printed.
+% \l@dleftbox
+% \begin{macrocode}
+ \ifshiftedpstarts%
+ \ifdim\ht\l@dleftbox>0pt\hb@xt@%
+ \hsize{\ledstrutL\unhbox\l@dleftbox}%
+ \else%
+ \dimen0=\pagetotal%
+ \advance\dimen0 by \baselineskip%
+ \global\pagetotal=\dimen0%
+ \fi%
+ \else%
+ \parledgroup@correction@notespacing{L}
+ \hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}%
+ \fi%
+% \end{macrocode}
+% Perhaps we have to move to the next (left) box. Check if we have got all
+% we can onto the page. If not, repeat for the next line.
+% Check if we have to print the optional argument of the last pend.
+% Check if the page is full.
+% Check if the verse is split in two subsequent pages.
+% Check there is any forced page breaks.
+% Reset the verse skipnumber boolean
+% \begin{macrocode}
+ \get@nextboxL%
+ \global\l@dskipversenumberfalse%
+ \ifprint@last@after@pendL%
+ \csuse{after@pendL@\the\l@dpscL}%
+ \global\csundef{after@pendL@\the\l@dpscL}%
+ \fi%
+ \checkpageL%
+ \checkverseL%
+ \checkpbL%
+ \repeat%
+% \end{macrocode}
+% That (left) page has been filled. Output the number of real lines
+% on the page --- if the page break is because the page has been
+% filled with lines, use the actual number, otherwise the page has been
+% ended early in order to synchronise with the facing page so use an
+% impossibly large number.
+% \begin{macrocode}
+ \ifl@dpagefull%
+ \@writelinesonpageL{\the\numpagelinesL}%
+ \else%
+ \@writelinesonpageL{1000}%
+ \fi%
+% \end{macrocode}
+% Reset to zero the left-page line count, clear the page to get onto the facing
+% (odd, right) page, and reinitialize the accumulated dimension of interline correction for notes in parallel ledgroup.
+% \begin{macrocode}
+ \numpagelinesL \z@%
+ \parledgroup@correction@notespacing@init%
+ \clearl@dleftpage }%
+% \end{macrocode}
+% Now do the same for the right text.
+% \changes{v0.3.0}{2005/02/10}{Added \cs{ledstrutR} to \cs{Pages}}
+% \begin{macrocode}
+ \checkpageR%
+ \l@duselanguage{\theledlanguageR}%
+{ \loop\ifl@dsamepage%
+ \initnumbering@sectcountR%
+ \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{}%
+ \csuse{before@pstartR@\the\l@dpscR}%
+ \global\csundef{before@pstartR@\the\l@dpscR}%
+ \do@lineR%
+ \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}%
+ {\print@eledsectionR}%
+ {}%
+ \advance\numpagelinesR \@ne%
+ \ifshiftedpstarts%
+ \ifdim\ht\l@drightbox>0pt\hb@xt@%
+ \hsize{\ledstrutR\unhbox\l@drightbox}%
+ \else%
+ \dimen0=\pagetotal%
+ \advance\dimen0 by \baselineskip%
+ \global\pagetotal=\dimen0%
+ \fi%
+ \else%
+ \parledgroup@correction@notespacing{R}%
+ \hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}%
+ \fi%
+ \get@nextboxR%
+ \global\l@dskipversenumberRfalse%
+ \ifprint@last@after@pendR%
+ \csuse{after@pendR@\the\l@dpscR}%
+ \global\csundef{after@pendR@\the\l@dpscR}%
+ \fi%
+ \checkpageR%
+ \checkverseR%
+ \checkpbR%
+ \repeat%
+ \ifl@dpagefull%
+ \@writelinesonpageR{\the\numpagelinesR}%
+ \else%
+ \@writelinesonpageR{1000}%
+ \fi%
+ \numpagelinesR=\z@%
+ \parledgroup@correction@notespacing@init%
+% \end{macrocode}
+% The page is full, so move onto the next (left, odd) page and repeat left
+% text processing.
+% \begin{macrocode}
+ \clearl@drightpage}%
+% \end{macrocode}
+% More to do? If there is we have to get the number of lines for the next
+% pair of pages before starting to output them.
+% \changes{v0.3.b}{2005/04/08}{Added \cs{l@dminpagelines} calculation
+% for succeeding page pairs}
+% \begin{macrocode}
+ \checkraw@text%
+ \ifaraw@text%
+ \getlinesfrompagelistL%
+ \getlinesfrompagelistR%
+ \l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}%
+ {\l@dminpagelines}%
+ \fi%
+ \repeat}%
+% \end{macrocode}
+% We have now output the text from all the chunks.
+% \begin{macrocode}
+ \fi%
+% \end{macrocode}
+% Make sure that there are no inserts hanging around.
+% \begin{macrocode}
+ \flush@notes%
+ \flush@notesR%
+ \endgroup%
+% \end{macrocode}
+% Zero counts ready for the next set of left/right text chunks. The boolean tests for stanza are switched to false.
+% \begin{macrocode}
+ \global\l@dpscL=\z@%
+ \global\l@dpscR=\z@%
+ \global\l@dnumpstartsL=\z@%
+ \global\l@dnumpstartsR=\z@%
+ \global\instanzaLfalse%
+ \global\instanzaRfalse%
+ \l@dprintingpagesfalse%
+ \finish@sameparallelpage@number%In order to have continuous page number
+ \finish@Pages@notes%Needed to prevent final notes overlap line number
+ \ignorespaces}
+
+
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Ensure all notes be printed at the end of parallel pages}
+% \begin{macro}{\finish@Pages@notes}
+% This macro ensures that all long notes are printed at the end of \cs{Pages} typessetting, and that there is no more long notes left for the next pages.
+% \begin{macrocode}
+\newcommand{\finish@Pages@notes}{%
+ \def\do##1{%
+% \end{macrocode}
+% First, declare footnote box if there was no previous declared.
+% E.g. if familiar or critical notes were disabled by \eledmac{} options.
+% \begin{macrocode}
+ \ifnocritical@%
+ \global\newnamebox{##1footins}
+ \fi
+ \ifnofamiliar@%
+ \global\newnamebox{footins##1}
+ \fi
+% \end{macrocode}
+% And now, add a \cs{newpage} if there is no more footnote to print.
+% \begin{macrocode}
+ \ifvoid\csuse{##1footins}%
+ \ifvoid\csuse{footins##1}\else%
+ \newpage\null%
+ \listbreak%
+ \fi%
+ \else%
+ \newpage\null%
+ \listbreak%
+ \fi%
+ }%
+ \dolistloop{\@series}%
+}%
+% \end{macrocode}
+% \end{macro}
+% \subsection{Struts}
+% \begin{macro}{\ledstrutL}
+% \begin{macro}{\ledstrutR}
+% Struts inserted into leftand right text lines.
+% \changes{v0.3.0}{2005/02/10}{Added \cs{ledtrutL} and \cs{ledstrutR}}
+% \begin{macrocode}
+\newcommand*{\ledstrutL}{\strut}
+\newcommand*{\ledstrutR}{\strut}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsection{Page clearing}
+% \begin{macro}{\cleartoevenpage}
+% \begin{macro}{\cleartol@devenpage}
+% \cs{cleartoevenpage}, which is defined in the memoir class,
+% is like \cs{clear(double)page} except that we
+% end up on an even page.
+% \cs{cleartol@devenpage} is similar except that it first checks to see
+% if it is already on an empty page.
+% \begin{macrocode}
+\providecommand{\cleartoevenpage}[1][\@empty]{%
+ \clearpage
+ \ifodd\c@page\hbox{}#1\clearpage\fi}
+\newcommand*{\cleartol@devenpage}{%
+ \ifdim\pagetotal<\topskip% on an empty page
+ \else
+ \clearpage
+ \fi
+ \ifodd\c@page\hbox{}\clearpage\fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\clearl@dleftpage}
+% \begin{macro}{\clearl@drightpage}
+% \cs{clearl@dleftpage} and \cs{clearl@drightpage} get us onto
+% an odd and even page, respectively, checking that we end up on
+% the subsquent page.
+% Both commands use \cs{newpage} and not \cs{clearpage}.
+% Because \cs{clearpage} prints all footnotes before the next page, even if it has to add new empty pages, while \cs{newpage} does not.
+% And as we want notes started in the left page continue in the right page and \emph{vice-versa}, we must use \cs{newpage} and not \cs{clearpage}
+%
+% \changes{v1.13.0}{2015/03/06x}{Use \cs{newpage} instead of \cs{clearpage}.}
+% \begin{macrocode}
+\newcommand*{\clearl@dleftpage}{%
+ \ifdim\pagetotal=0pt\hbox{}\fi%
+ \newpage%
+ \ifodd\c@page\else
+ \led@err@LeftOnRightPage
+ \hbox{}%
+ \cleardoublepage
+ \fi}
+
+\newcommand*{\clearl@drightpage}{%
+ \ifdim\pagetotal=0pt\hbox{}\fi%
+ \newpage%
+ \stepcounter{sameparallelpage@number}%
+ \ifodd\c@page
+ \led@err@RightOnLeftPage
+ \hbox{}%
+ \cleartoevenpage
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Lines managing}
+% \begin{macro}{\getlinesfromparlistL}
+% \begin{macro}{\@cs@linesinparL}
+% \begin{macro}{\getlinesfromparlistR}
+% \begin{macro}{\@cs@linesinparR}
+% \cs{getlinesfromparlistL} gets the next entry from the
+% \cs{linesinpar@listL} and puts it into \cs{@cs@linesinparL}; if the
+% list is empty, it sets \cs{@cs@linesinparL} to 0. Similarly
+% for \cs{getlinesfromparlistR}.
+% \begin{macrocode}
+\newcommand*{\getlinesfromparlistL}{%
+ \ifx\linesinpar@listL\empty
+ \gdef\@cs@linesinparL{0}%
+ \else
+ \gl@p\linesinpar@listL\to\@cs@linesinparL
+ \fi}
+\newcommand*{\getlinesfromparlistR}{%
+ \ifx\linesinpar@listR\empty
+ \gdef\@cs@linesinparR{0}%
+ \else
+ \gl@p\linesinpar@listR\to\@cs@linesinparR
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\getlinesfrompagelistL}
+% \begin{macro}{\@cs@linesonpageL}
+% \begin{macro}{\getlinesfrompagelistR}
+% \begin{macro}{\@cs@linesonpageR}
+% \cs{getlinesfrompagelistL} gets the next entry from the
+% \cs{linesonpage@listL} and puts it into \cs{@cs@linesonpageL}; if the
+% list is empty, it sets \cs{@cs@linesonpageL} to 1000. Similarly
+% for \cs{getlinesfrompagelistR}.
+% \begin{macrocode}
+\newcommand*{\getlinesfrompagelistL}{%
+ \ifx\linesonpage@listL\empty
+ \gdef\@cs@linesonpageL{1000}%
+ \else
+ \gl@p\linesonpage@listL\to\@cs@linesonpageL
+ \fi}
+\newcommand*{\getlinesfrompagelistR}{%
+ \ifx\linesonpage@listR\empty
+ \gdef\@cs@linesonpageR{1000}%
+ \else
+ \gl@p\linesonpage@listR\to\@cs@linesonpageR
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@writelinesonpageL}
+% \begin{macro}{\@writelinesonpageR}
+% These macros output the number of lines on a page to the section file
+% in the form of \cs{@lopL} or \cs{@lopR} macros.
+% \begin{macrocode}
+\newcommand*{\@writelinesonpageL}[1]{%
+ \edef\next{\write\linenum@out{\string\@lopL{#1}}}%
+ \next}
+\newcommand*{\@writelinesonpageR}[1]{%
+ \edef\next{\write\linenum@outR{\string\@lopR{#1}}}%
+ \next}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\l@dcalc@maxoftwo}
+% \begin{macro}{\l@dcalc@minoftwo}
+% \cs{l@dcalc@maxoftwo}\marg{num}\marg{num}\marg{count} sets \meta{count}
+% to the maximum of the two \meta{num}.
+%
+% Similarly
+% \cs{l@dcalc@minoftwo}\marg{num}\marg{num}\marg{count} sets \meta{count}
+% to the minimum of the two \meta{num}.
+%
+% \begin{macrocode}
+\newcommand*{\l@dcalc@maxoftwo}[3]{%
+ \ifnum #2>#1\relax
+ #3=#2\relax
+ \else
+ #3=#1\relax
+ \fi}
+\newcommand*{\l@dcalc@minoftwo}[3]{%
+ \ifnum #2<#1\relax
+ #3=#2\relax
+ \else
+ #3=#1\relax
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Page break managing}
+% \begin{macro}{\ifl@dsamepage}
+% \begin{macro}{\l@dsamepagetrue}
+% \begin{macro}{\l@dsamepagefalse}
+% \begin{macro}{\ifl@dpagefull}
+% \begin{macro}{\l@dpagefulltrue}
+% \begin{macro}{\l@dpagefullfalse}
+% \begin{macro}{\checkpageL}
+% \begin{macro}{\checkpageR}
+% \cs{checkpageL} tests if the space and lines already taken on the page by
+% text and footnotes is less than the constraints. If so, then
+% \cs{ifl@dpagefull} is set FALSE and \cs{ifl@dsamepage} is set TRUE.
+% If the page is spatially full
+% then \cs{ifl@dpagefull} is set TRUE and \cs{ifl@dsamepage} is set FALSE.
+% If it is not spatially full but the maximum number of lines have been
+% output then both \cs{ifl@dpagefull} and \cs{ifl@dsamepage}
+% are set FALSE.
+%
+% \begin{macrocode}
+\newif\ifl@dsamepage
+ \l@dsamepagetrue
+\newif\ifl@dpagefull
+
+\newcommand*{\checkpageL}{%
+ \l@dpagefulltrue
+ \l@dsamepagetrue
+ \check@goal
+ \ifdim\pagetotal<\ledthegoal
+ \ifnum\numpagelinesL<\l@dminpagelines
+ \else
+ \l@dsamepagefalse
+ \l@dpagefullfalse
+ \fi
+ \else
+ \l@dsamepagefalse
+ \l@dpagefulltrue
+ \fi%
+ \ifprint@last@after@pendL%
+ \l@dpagefullfalse%
+ \l@dsamepagefalse%
+ \print@last@after@pendLfalse%
+ \fi%
+ }%
+
+\newcommand*{\checkpageR}{%
+ \l@dpagefulltrue
+ \l@dsamepagetrue
+ \check@goal
+ \ifdim\pagetotal<\ledthegoal
+ \ifnum\numpagelinesR<\l@dminpagelines
+ \else
+ \l@dsamepagefalse
+ \l@dpagefullfalse
+ \fi
+ \else
+ \l@dsamepagefalse
+ \l@dpagefulltrue
+ \fi%
+ \ifprint@last@after@pendR%
+ \l@dpagefullfalse%
+ \l@dsamepagefalse%
+ \print@last@after@pendRfalse%
+ \fi%
+ }%
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\checkpbL}
+% \begin{macro}{\checkpbR}
+% \cs{checkpbL} and \cs{checkpbR} are called after each line is printed, and after the page is checked. These commands correct page breaks depending on \cs{ledpb} and \cs{lednopb}.
+% \begin{macrocode}
+\newcommand{\checkpbL}{
+ \IfStrEq{\led@pb@setting}{after}{
+ \xifinlistcs{\the\absline@num}{l@prev@pb}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\the\absline@num}{l@prev@nopb}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+ \IfStrEq{\led@pb@setting}{before}{
+ \numdef{\next@absline}{\the\absline@num+1}
+ \xifinlistcs{\next@absline}{l@prev@pb}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\next@absline}{l@prev@nopb}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+}
+
+\newcommand{\checkpbR}{
+ \IfStrEq{\led@pb@setting}{after}{
+ \xifinlistcs{\the\absline@numR}{l@prev@pbR}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\the\absline@numR}{l@prev@nopbR}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+ \IfStrEq{\led@pb@setting}{before}{
+ \numdef{\next@abslineR}{\the\absline@numR+1}
+ \xifinlistcs{\next@abslineR}{l@prev@pbR}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\next@abslineR}{l@prev@nopbR}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\checkverseL}
+% \begin{macro}{\checkverseR}
+% \cs{checkverseL} and \cs{checkverseR} are called after each line is printed.
+% They prevent page break inside verse.
+% \begin{macrocode}
+\newcommand{\checkverseL}{
+\ifinstanzaL
+ \iflednopbinverse
+ \ifinserthangingsymbol
+ \numgdef{\prev@abslineverse}{\the\absline@num-1}
+ \IfStrEq{\led@pb@setting}{after}{\lednopbnum{\prev@abslineverse}}{}
+ \IfStrEq{\led@pb@setting}{before}{\ifnum\numpagelinesL<3\ledpbnum{\prev@abslineverse}\fi}{}
+ \fi
+ \fi
+\fi
+}
+\newcommand{\checkverseR}{
+\ifinstanzaR
+ \iflednopbinverse
+ \ifinserthangingsymbolR
+ \numgdef{\prev@abslineverse}{\the\absline@numR-1}
+ \IfStrEq{\led@pb@setting}{after}{\lednopbnumR{\prev@abslineverse}}{}
+ \IfStrEq{\led@pb@setting}{before}{\ifnum\numpagelinesR<3\ledpbnumR{\prev@abslineverse}\fi}{}
+ \fi
+ \fi
+\fi
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\ledthegoal}
+% \begin{macro}{\goalfraction}
+% \begin{macro}{\check@goal}
+% \cs{ledthegoal} is the amount of space allowed to taken by text and
+% footnotes on a page before a forced pagebreak. This can be controlled via
+% \cs{goalfraction}. \cs{ledthegoal} is calculated via \cs{check@goal}.
+% \begin{macrocode}
+\newdimen\ledthegoal
+\ifshiftedpstarts
+ \newcommand*{\goalfraction}{0.95}
+\else
+ \newcommand*{\goalfraction}{0.9}
+\fi
+
+\newcommand*{\check@goal}{%
+ \ledthegoal=\goalfraction\pagegoal}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\ifwrittenlinesL}
+% \begin{macro}{\ifwrittenlinesL}
+% Booleans for whether line data has been written to the section file.
+% \begin{macrocode}
+\newif\ifwrittenlinesL
+\newif\ifwrittenlinesR
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Getting boxes content}
+% \begin{macro}{\get@nextboxL}
+% \begin{macro}{\get@nextboxR}
+% \changes{v0.11.0}{2012/06/11}{Change \cs{get@nextboxL} and \cs{get@nextboxR} to allow to disable line numbering (like in eledmac 0.15).}
+% If the current box is not empty (i.e., still contains some lines)
+% nothing is done. Otherwise if and only if a synchronisation point is
+% reached the next box is started.
+%
+% \begin{macrocode}
+\newcommand*{\get@nextboxL}{%
+ \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}% box is not empty
+% \end{macrocode}
+% The current box is not empty; do nothing.
+% \begin{macrocode}
+ \else% box is empty
+% \end{macrocode}
+% The box is empty.
+% Check if enough lines (real and blank) have been
+% output.
+% \begin{macrocode}
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>\@donetotallinesL
+ \parledgroup@notes@endL
+ \else
+% \end{macrocode}
+% Sufficient lines have been output.
+% \begin{macrocode}
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}=\@donetotallinesL
+ \parledgroup@notes@endL
+ \fi
+ \ifwrittenlinesL\else
+% \end{macrocode}
+% Write out the number of lines done, and set the boolean so this is only
+% done once.
+% \begin{macrocode}
+ \@writelinesinparL
+ \writtenlinesLtrue
+ \fi
+ \ifnum\l@dnumpstartsL>\l@dpscL
+% \end{macrocode}
+% \changes{v0.11.0}{2012/06/11}{Pstart number can be printed in side}
+% There are still unprocessed boxes. Recalculate the maximum number of
+% lines needed, and move onto the next box (by incrementing \cs{l@dpscL}). If needed, restart the line numbering.
+% \begin{macrocode}
+ \writtenlinesLfalse
+ \ifbypstart@
+ \global\line@num=0%
+ \resetprevline@%
+ \fi
+% Add the content of the optional argument of the previous \cs{pend}.
+% \begin{macrocode}
+ \csuse{after@pendL@\the\l@dpscL}%
+ \global\csundef{after@pendL@\the\l@dpscL}%
+% \end{macrocode}
+% Check the number of lines
+% \begin{macrocode}
+ \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
+ {\the\@donetotallinesL}%
+ {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
+ \global\@donetotallinesL \z@
+% \end{macrocode}
+% Go to the next pstart
+% \begin{macrocode}
+ \global\advance\l@dpscL \@ne
+ \global\pstartnumtrue%
+ \restore@pstartL@pc%
+% \end{macrocode}
+% Add notes of parallel ledgroup.
+% \begin{macrocode}
+ \parledgroup@notes@endL
+ \parledgroup@correction@notespacing@final{L}
+ \else
+% \end{macrocode}
+% \begin{macrocode}
+ \fi
+ \fi
+ \fi}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand*{\get@nextboxR}{%
+ \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% box is not empty
+ \else% box is empty
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>\@donetotallinesR
+ \parledgroup@notes@endR
+ \else
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}=\@donetotallinesR
+ \parledgroup@notes@endR
+ \fi
+ \ifwrittenlinesR\else
+ \@writelinesinparR
+ \writtenlinesRtrue
+ \fi
+ \ifnum\l@dnumpstartsR>\l@dpscR
+ \writtenlinesRfalse
+ \ifbypstart@R
+ \global\line@numR=0%
+ \resetprevline@%
+ \fi
+ \csuse{after@pendR@\the\l@dpscR}%
+ \global\csundef{after@pendR@\the\l@dpscR}%
+ \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%
+ {\the\@donetotallinesR}%
+ {\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%
+ \global\@donetotallinesR \z@
+ \global\advance\l@dpscR \@ne
+ \global\pstartnumRtrue%
+ \restore@pstartR@pc%
+ \parledgroup@notes@endR
+ \parledgroup@correction@notespacing@final{R}
+ \else
+ \print@last@after@pendRtrue%
+ \fi
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Same page number in both side}
+% The \verb+sameparallelpagenumber+ allow to have the same page number for the left and the right side
+% We can not do it by changing the value of the \verb|page| counter, since its value is used to determine whether a page is left or right.
+% Consequently, we have to do it by patching \cs{thepage} inside a \cs{Pages} macro.
+%
+%
+% \begin{macro}{\init@sameparallelpage@number}
+% This macro is called at the beginning of \cs{Pages}.
+% It patches the \cs{thepage} macro in order to
+% and to use the value of \verb+sameparallelpage@number+ \LaTeX counter instead of those of \verb+page+ \LaTeX counter.
+% As we are inside a group, the patch is local, and, consequently, the page printed after the \cs{Pages} will use the normal page number scheme.
+%
+% The value of \verb+sameparallelpage@number+ is increase by 1 when we change from right page to left page.
+% \begin{macrocode}
+\newcounter{sameparallelpage@number}
+\newcommand{\init@sameparallelpage@number}{%
+ \setcounter{sameparallelpage@number}{\c@page}%
+ \ifsameparallelpagenumber%
+ \patchcmd{\thepage}{page}{sameparallelpage@number}{}{}%
+ \fi%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\finish@sameparallelpage@number}
+% This macro is called at the end of \cs{Pages}.
+% If the \verb+sameparallelpage@number+ is enabled,
+% it set the page number to the last value of \verb+sameparallelpage@number+ counter, in order to have a continuity of page numbering between pages printed with \cs{Pages} and normal pages.
+% \begin{macrocode}
+\newcommand{\finish@sameparallelpage@number}{%
+ \ifsameparallelpagenumber%
+ \setcounter{page}{\c@sameparallelpage@number}%
+ \fi%
+}%
+% \end{macrocode}
+% \end{macro}
+% \section{Sections' titles' commands}
+% As switching from left to right pages does not clear the page since v1.13.0,
+% but only creates new pages, no \verb+\vbox{}+ is inserted, and consequently parallel chapters are mis-aligned.
+%
+% So we patch the \cs{chapter} command in order to prevent this problem.
+% \begin{macro}{\chapter}
+% \begin{macrocode}
+\pretocmd{\chapter}{%
+ \ifl@dprintingpages%
+ \vbox{}%
+ \fi%
+ }%
+ {}%
+ {}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\eledsectnotoc}
+% \cs{eledsectnotoc} just saves its content \cs{@eledsectnotoc}, which will be tested where sectioning commands will be printed.
+% \begin{macrocode}
+\newcommand{\eledsectnotoc}[1]{\xdef\@eledsectnotoc{#1}}
+\eledsectnotoc{R}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\eledsectmark}
+% \cs{eledsectmark} just saves its content \cs{@eledsectmark}, which will be tested where sectioning commands will be printed.
+% \begin{macrocode}
+\newcommand{\eledsectmark}[1]{\xdef\@eledsectmark{#1}}
+\eledsectmark{L}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\eledsection@correcting@skip}
+% Because the vertical correction needed after inserting a title in parallel depends whether we are in parallel columns or parallel pages, we stock its length in \cs{eledsection@correcting@skip}.
+% \begin{macrocode}
+\newskip\eledsection@correcting@skip
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\eled@sectioningR@out}
+% We save the sectioning commands of the right side in the \cs{eled@sectioningR@out} file.
+% \begin{macrocode}
+\newwrite\eled@sectioningR@out
+% \end{macrocode}
+% \end{macro}
+% \section{Page break/no page break, depending on the specific line}
+% We need to adapt the macro of the homonym section of eledmac to eledpar.
+% \begin{macro}{\prev@pbR}
+% \begin{macro}{\prev@nopbR}
+% The \cs{l@prev@pbR} macro is a etoolbox list, which contains the lines in which page breaks occur (before or after).
+% The \cs{l@prev@nopbR} macro is a etoolbox list, which contains the lines in which NO page breaks occur (before or after).
+% \begin{macrocode}
+\def\l@prev@pbR{}
+\def\l@prev@nopbR{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\ledpbR}
+% \begin{macro}{\ledpbnumR}
+% \begin{macro}{\lednopbnum}
+% \begin{macro}{\lednopbnumR}
+% The \cs{ledpbR} macro writes the call to \cs{led@pbR} in line-list file.
+% The \cs{ledpbnumR} macro writes the call to \cs{led@pbnumR} in line-list file.
+% The \cs{lednopbR} macro writes the call to \cs{led@nopbR} in line-list file.
+% The \cs{lednopbnumR} macro writes the call to \cs{led@nopbnumR} in line-list file.
+% \begin{macrocode}
+\newcommand{\ledpbR}{\write\linenum@outR{\string\led@pbR}}
+\newcommand{\ledpbnumR}[1]{\write\linenum@outR{\string\led@pbnumR{#1}}}
+\newcommand{\lednopbR}{\write\linenum@outR{\string\led@nopbR}}
+\newcommand{\lednopbnumR}[1]{\write\linenum@outR{\string\led@nopbnumR{#1}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\led@pbR}
+% \begin{macro}{\led@pbnumR}
+% \begin{macro}{\led@nopbR}
+% \begin{macro}{\led@nopbnumR}
+% The \cs{led@pbR} add the absolute line number in the \cs{prev@pbR} list.
+% The \cs{led@pbnumR} add the argument in the \cs{prev@pbR} list.
+% The \cs{led@nopbR} add the absolute line number in the \cs{prev@nopbR} list.
+% The \cs{led@nopbnumR} add the argument in the \cs{prev@nopbR} list.
+% \begin{macrocode}
+\newcommand{\led@pbR}{\listxadd{\l@prev@pbR}{\the\absline@numR}}
+\newcommand{\led@pbnumR}[1]{\listxadd{\l@prev@pbR}{#1}}
+\newcommand{\led@nopbR}{\listxadd{\l@prev@nopbR}{\the\absline@numR}}
+\newcommand{\led@nopbnumR}[1]{\listxadd{\l@prev@nopbR}{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \section{Parallel ledgroup}
+% \begin{macro}{\parledgroup@}
+% \begin{macro}{\parledgroupseries@}
+% \begin{macro}{\parledgrouptype@}
+% The marks \cs{parledgroup} contains information about the beginnings and endings of notes in a parallel ledgroup.
+% \cs{parledgroupseries} contains the footnote series.
+% \cs{parledgroupseries} contains the type of the footnote: critical (Xfootnote) or familiar (footnoteX).
+% \begin{macrocode}
+\newmarks\parledgroup@
+\newmarks\parledgroup@series
+\newmarks\parledgroup@type
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\parledgroup@notes@startL}
+% \begin{macro}{\parledgroup@notes@startR}
+% \cs{parledgroup@notes@startL} and \cs{parledgroup@notes@startR} are used to mark the begining of a note series in a parallel ledgroup.
+% \begin{macrocode}
+\newcommand{\parledgroup@notes@startL}{%
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>0%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{footnoteX}{\csuse{bhooknoteX@\splitfirstmarks\parledgroup@series}}{}%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{Xfootnote}{\csuse{bhookXnote@\splitfirstmarks\parledgroup@series}}{}%
+ \fi%
+ \global\ledgroupnotesL@true%
+ \insert@noterule@ledgroup{L}%
+}
+\newcommand{\parledgroup@notes@startR}{%
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>0%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{footnoteX}{\csuse{bhooknoteX@\splitfirstmarks\parledgroup@series}}{}%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{Xfootnote}{\csuse{bhookXnote@\splitfirstmarks\parledgroup@series}}{}%
+ \fi%
+ \global\ledgroupnotesR@true%
+ \insert@noterule@ledgroup{R}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\parledgroup@notes@startL}
+% \begin{macro}{\parledgroup@notes@startR}
+% \cs{parledgroup@notes@endL} and \cs{parledgroup@notes@endR} are used to mark the end of a note series in a parallel ledgroup.
+% \begin{macrocode}
+\newcommand{\parledgroup@notes@endL}{%
+ \global\ledgroupnotesL@false%
+}
+\newcommand{\parledgroup@notes@endR}{%
+ \global\ledgroupnotesR@false%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\insert@noterule@ledgroup}
+% A \cs{vskip} is not used when the boxes are constructed. So we insert it before ledgroup note series when paralling lines are constructed.
+% This is the goal of \cs{insert@noterule@ledgroup}
+% \begin{macrocode}
+\newcommand{\insert@noterule@ledgroup}[1]{
+ \IfStrEq{\splitbotmarks\parledgroup@}{begin}{%
+ \IfStrEq{\splitbotmarks\parledgroup@type}{Xfootnote}{
+ \csuse{ifledgroupnotes#1@}
+ \vskip\skip\csuse{mp\splitbotmarks\parledgroup@series footins}
+ \csuse{\splitbotmarks\parledgroup@series footnoterule}
+ \fi
+ }
+ {}
+ \IfStrEq{\splitbotmarks\parledgroup@type}{footnoteX}{
+ \csuse{ifledgroupnotes#1@}
+ \vskip\skip\csuse{mpfootins\splitbotmarks\parledgroup@series}
+ \csuse{footnoterule\splitbotmarks\parledgroup@series}
+ \fi
+ }{}
+ }
+ {}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\parledgroupnotespacing}
+% \cs{parledgroupnotespacing} can be redefined by the user to change the interline spacing of ledgroup notes.
+% \begin{macrocode}
+\newcommand{\parledgroupnotespacing}{}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\parledgroup@notespacing@correction}
+% \begin{macro}{\parledgroup@notespacing@set@correction}
+% \cs{parledgroup@notespacing@correction} is the difference between a normal line skip and a line skip in a note. It's set by \cs{parledgroup@notespacing@set@correction}, called at the begining of \cs{Pages}.
+% \begin{macrocode}
+\dimdef{\parledgroup@notespacing@correction}{0pt}
+\newcommand{\parledgroup@notespacing@set@correction}{%
+ {\notefontsetup\parledgroupnotespacing\dimgdef{\temp@spacing}{\baselineskip}}%
+ \dimgdef{\parledgroup@notespacing@correction}{\baselineskip-\temp@spacing}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\parledgroup@correction@notespacing@init}
+% \cs{parledgroup@correction@notespacing@init} sets the value of accumulated corrections of note spacing to 0~pt.
+% It's called at the begining of each pages AND at the end of each ledgroup.
+% \begin{macrocode}
+\newcommand{\parledgroup@correction@notespacing@init}{
+ \dimdef{\parledgroup@notespacing@correction@accumulated}{0pt}
+ \dimdef{\parledgroup@notespacing@correction@modulo}{0pt}
+}
+\parledgroup@correction@notespacing@init
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\parledgroup@correction@notespacing@final}
+% \cs{parledgroup@correction@notespacing@final} adds the total space deleted because of correction for notes, in a parallel ledgroup.
+% It also adds the space needed by the other side spaces between note rules and notes. It's called after the print of each pstart/pend.
+% \begin{macrocode}
+\newcommand{\parledgroup@correction@notespacing@final}[1]{
+ \ifparledgroup
+ \vspace{\parledgroup@notespacing@correction@accumulated}
+ \parledgroup@correction@notespacing@init%
+ \ifstrequal{#1}{L}{
+ \numdef{\@checking}{\the\l@dpscL-1}
+ }{
+ \numdef{\@checking}{\the\l@dpscR-1}
+ }
+ \dimdef{\@beforenotes@current@diff}{\csuse{@parledgroup@beforenotes@\@checking L}-\csuse{@parledgroup@beforenotes@\@checking R}}%
+ \ifstrequal{#1}{L}%
+ {% Left
+ \ifdimgreater{\@beforenotes@current@diff}{0pt}{}{\vspace{-\@beforenotes@current@diff}}%
+ }%
+ {% Right
+ \ifdimgreater{\@beforenotes@current@diff}{0pt}{\vspace{\@beforenotes@current@diff}}{}
+ }%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\parledgroup@correction@notespacing}
+% \cs{parledgroup@correction@notespacing} is used before each printed line.
+% If it's a line of notes in parallel ledgroup, the space \cs{parledgroup@notespacing@correction} is decreased, to make interline space correct.
+% The decreased space is added to \cs{parledgroup@notespacing@correction@accumulated} and \cs{parledgroup@notespacing@correction@modulo}.
+% If \cs{parledgroup@notespacing@correction@modulo} is equal or greater than \cs{baselineskip}:
+% \begin{itemize}
+% \item It is decreased by \cs{baselineskip}.
+% \item The total of line number in the current page is decreased by one.
+% \end{itemize}
+% For example, suppose an normal interline of 24~pt and interline for note of 12~pt.
+% That means that the two lines of notes take the place of one normal line. For every two lines of notes, the line total for the current place is decreased by one.
+% \begin{macrocode}{}
+\newcommand{\parledgroup@correction@notespacing}[1]{%
+ \csuse{ifledgroupnotes#1@}%
+ \vspace{-\parledgroup@notespacing@correction}%
+ \dimdef{\parledgroup@notespacing@correction@accumulated}{\parledgroup@notespacing@correction@accumulated+\parledgroup@notespacing@correction}%
+ \dimdef{\parledgroup@notespacing@correction@modulo}{\parledgroup@notespacing@correction@modulo+\parledgroup@notespacing@correction}%
+ \ifdimless{\parledgroup@notespacing@correction@modulo}{\baselineskip}{}{\advance\numpagelinesL -\@ne%
+ \dimdef{\parledgroup@notespacing@correction@modulo}{\parledgroup@notespacing@correction@modulo-\baselineskip}%
+ }% mean greater than equal
+ \fi%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\parledgroup@beforenotesL}
+% \begin{macro}{\parledgroup@beforenotesR}
+% \cs{parledgroup@beforenotesL} and \cs{parledgroup@beforenotesR} store the total of space before notes in the current parallel ledgroup.
+% \begin{macrocode}
+\dimdef\parledgroup@beforenotesL{0pt}
+\dimdef\parledgroup@beforenotesR{0pt}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\parledgroup@beforenotes@save}
+% The macro \cs{parledgroup@beforenotes@save} dumps the space befores notes of the current parallel ledgroup in a macro named with the current pstart number.
+% \begin{macrocode}
+\newcommand{\parledgroup@beforenotes@save}[1]{
+ \ifparledgroup
+ \csdimgdef{@parledgroup@beforenotes@\the\csuse{l@dnumpstarts#1}#1}{\csuse{parledgroup@beforenotes#1}}
+ \csdimgdef{parledgroup@beforenotes#1}{0pt}
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+
+
+% \section{The End}\label{end}
+%
+%
+%</code>
+%
+% \newpage
+% \appendix
+% \clearpage
+%
+% \let\oldthesection\thesection
+% \renewcommand{\thesection}{Appendix \oldthesection}
+% \section{Some things to do when changing version}
+% \subsection{Migration to eledpar 1.4.3}
+% Version 1.4.3 corrects a bug added in version 0.12, which made hanging verse automatically flush right, despite the given value of the first element of the \cs{setstanzaindents} command.
+%
+% If, however, you want to return to automatic flush-right margins for verses with hanging indents, you have to redefine the \cs{hangingsymbol} command.
+% \begin{verbatim}
+% \renewcommand{\hangingsymbol}{\protect\hfill}
+% \end{verbatim}
+% See the two following examples:
+%
+% With standard \cs{hangingsymbol}:
+% \setstanzaindents{4,0}
+% \beginnumbering
+% \stanza
+% A very long verse should be sometime hanged.
+% The position of the hanging verse is fixed.\&
+% \endnumbering
+%
+% With the modification of \cs{hangingsymbol}:
+% \renewcommand{\hangingsymbol}{\protect\hfill}
+% \setstanzaindents{4,0}
+% \beginnumbering
+% \stanza
+% A very long verse should sometimes be hanging. And we can see that an hanging verse is flush right.\&
+% \endnumbering
+% \bibliographystyle{alpha}
+% \begin{thebibliography}{WWW99}
+% \addcontentsline{toc}{section}{References}
+% \bibitem[LW90]{EDMACTUG}
+% John Lavagnino and Dominik Wujastyk.
+% \newblock `An overview of \edmac: a \textsc{Plain} TeX format for
+% critical editions'.
+% \newblock \emph{TUGboat}, \textbf{11}, 4, pp. 623--643, November 1990.
+% \newblock (Code available from CTAN in
+% \texttt{macros/plain/contrib/edmac})
+%
+%
+% \bibitem[Wil02]{MEMOIR}
+% Peter Wilson.
+% \newblock \emph{The \Lpack{memoir} class for configurable typesetting}.
+% \newblock November 2002.
+% \newblock (Available from CTAN in
+% \texttt{macros/latex/contrib/memoir})
+%
+% \bibitem[Wil04]{ELEDMAC}
+% Peter Wilson and Maïeul Rouquette.
+% \newblock \emph{\Lpack{eledmac} A presumptuous attempt to port
+% \Lpack{EDMAC},\Lpack{TABMAC} and \Lpack{EDSTANZA} to
+% LaTeX}.
+% \newblock December 2004.
+% \newblock (Available from CTAN in
+% \texttt{macros/latex/contrib/eledmac})
+%
+% \end{thebibliography}
+%
+% \Finale
+% \phantomsection
+% \addcontentsline{toc}{section}{Index}
+% \PrintIndex
+%
+% \phantomsection
+% \addcontentsline{toc}{section}{Change History}
+% \PrintChanges
+% \endinput
+\endinput
+
+%% \CharacterTabl
+%% Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%%