Debian Codegraph @

texmf-dist/source/latex/reledmac/reledpar.dtx

raw
1 % \iffalse meta-comment
2 %
3 % reledpar.dtx
4 % Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net
5 % Maintainer:Maïeul Rouquette maieul at maieul dot net
6 % Copyright 2004, 2005 Peter R. Wilson / 2011-.. Maïeul Rouquette
7 %
8 % This work may be distributed and/or modified under the
9 % conditions of the LaTeX Project Public License, either
10 % version 1.3 of this license or (at your option) any
11 % later version.
12 % The latest version of the license is in
13 % http://www.latex-project.org/lppl.txt
14 % and version 1.3 or later is part of all distributions of
15 % LaTeX version 2003/06/01 or later.
16 %
17 % This work has the LPPL maintenance status "maintained".
18 %
19 % This work consists of the files listed in the README file.
20 %
21 %
22 %<*driver>
23 \documentclass[twoside]{ltxdoc}
24 \usepackage[T1]{fontenc}
25 \usepackage{url}
26 \usepackage{xr-hyper}
27 \usepackage[draft=false,
28 plainpages=false,
29 pdfpagelabels,
30 bookmarksnumbered,
31 % hyperindex=true
32 hyperindex=false
33 ]{hyperref}
34 \addtolength\marginparwidth{30pt}
35 \usepackage{doctools}
36 \usepackage[mono=false]{libertine}
37 \usepackage[series={A,B},noend,noeledsec,nofamiliar]{reledmac}
38 \usepackage{reledpar}
39 \usepackage{suffix}
40 \usepackage{csquotes}
41 \usepackage[english]{babel}
42 \usepackage{xstring}
43 \usepackage{graphicx,metalogo,longtable}
44 \makeatletter
45 \renewenvironment{theglossary}{%
46 \@restonecoltrue\if@twocolumn\@restonecolfalse\fi
47 \columnseprule \z@ \columnsep 35\p@
48 \glossary@prologue%
49 \GlossaryParms \let\item\@idxitem \ignorespaces}
50 {\if@restonecol\onecolumn\else\clearpage\fi}
51 \def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
52 \columnseprule \z@ \columnsep 35\p@
53 \index@prologue%
54 \IndexParms \let\item\@idxitem \ignorespaces}
55 \def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
56 \@mparswitchfalse
57 \makeatother
58 \EnableCrossrefs
59 \CodelineIndex
60 \RecordChanges
61 \renewcommand{\MakeUppercase}[1]{#1}
62 \newcommand{\edmac}{\protect\package{EDMAC}\xspace}
63 \newcommand{\tabmac}{\protect\package{tabmac}\xspace}
64 \newcommand{\edstanza}{\protect\package{edstanza}\xspace}
65
66 \newcommand{\ledmac}{\protect\package{ledmac}\xspace}
67 \newcommand{\Ledmac}{\protect\package{Ledmac}\xspace}
68 \newcommand{\ledpar}{\protect\package{ledpar}\xspace}
69 \newcommand{\Ledpar}{\protect\package{Ledpar}\xspace}
70
71
72 \newcommand{\eledmac}{\protect\package{eledmac}\xspace}
73 \newcommand{\Eledmac}{\protect\package{Eledmac}\xspace}
74 \newcommand{\eledpar}{\protect\package{eledpar}\xspace}
75 \newcommand{\Eledpar}{\protect\package{Eledpar}\xspace}
76
77 \newcommand{\reledmac}{\protect\package{reledmac}\xspace}
78 \newcommand{\Reledmac}{\protect\package{Reledmac}\xspace}
79 \newcommand{\reledpar}{\protect\package{reledpar}\xspace}
80 \newcommand{\Reledpar}{\protect\package{Reledpar}\xspace}
81
82 \let\macpackage\reledmac
83 \let\parpackage\reledpar
84 \let\Macpackage\reledmac
85 \let\Parpackage\reledpar
86
87 \newcommand{\texbook}{\textit{TeXbook}\xspace}
88 \newcommand{\thetexbook}{\textit{The TeXbook}\xspace}
89 \pagestyle{headings}
90 \setcounter{StandardModuleDepth}{1}
91 % Some commands are defined here, and not in the commented part, because \externaldocument require them.
92 \externaldocument[reledmac-]{reledmac}
93 \begin{document}
94 \raggedbottom
95 \DocInput{reledpar.dtx}
96 \end{document}
97 %</driver>
98 %
99 % \fi
100 % \newcommand{\reff}[1]{\ref{#1} p.~\pageref{#1}}
101 % \newcommand\reffsamefile[1]{\reff{#1}}
102 % \makeatletter
103 % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
104 % \Describe@It}
105 % \newcommand*{\Describe@It}[1]{\endgroup
106 % \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
107 % \SpecialItIndex{#1}\@esphack\ignorespaces}
108 % \newcommand*{\SpecialItIndex}[1]{\@bsphack
109 % \index{#1\actualchar{\protect\ttfamily#1}\encapchar usage}\@esphack}
110 % \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
111 % \DoNotIndex{\@flushglue,\@input}
112 % \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
113 % \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
114 % \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
115 % \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
116 % \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
117 % \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
118 % \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
119 % \DoNotIndex{\mathcal,\csname,\def,\documentstyle,\dospecials,\edef}
120 % \DoNotIndex{\egroup}
121 % \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
122 % \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
123 % \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
124 % \DoNotIndex{\ifcase}
125 % \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
126 % \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
127 % \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
128 % \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
129 % \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
130 % \DoNotIndex{\strutbox}
131 % \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
132 % \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
133 % \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
134 % \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
135 % \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
136 % \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
137 % \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
138 % \DoNotIndex{\nopagebreak}
139 % \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
140 % \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
141 % \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
142 % \DoNotIndex{\[,\{,\},\]}
143 % \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
144 % \DoNotIndex{\baselineskip,\begin,\tw@}
145 % \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
146 % \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
147 % \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
148 % \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
149 % \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
150 % \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
151 % \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
152 % \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
153 % \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
154 % \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
155 % \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
156 % \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
157 % \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
158 % \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
159 % \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
160 % \DoNotIndex{\bfdefault}
161 % \DoNotIndex{\newcommand,\renewcommand,\providecommand}
162 % \DoNotIndex{\ ,\to}
163 %
164 % \newcommand{\dtxfilename}{\texttt{reledpar.dtx}}
165 % \GetFileInfo{reledpar.sty}
166 % ^^A Put changes in the right order: see http://tex.stackexchange.com/a/74113/7712
167 % \let\org@changes@\changes@
168 % \def\my@changes v#1.#2.#3.\@nil{%
169 % \org@changes@{v#1.\six@digits{#2}.\six@digits{#3}.=v#1.#2.#3}%
170 % }%
171 % \newcommand*{\six@digits}[1]{%
172 % \ifnum#1<100000 0\fi
173 % \ifnum#1<10000 0\fi
174 % \ifnum#1<1000 0\fi
175 % \ifnum#1<100 0\fi
176 % \two@digits{#1}%
177 % }%
178 % \renewcommand*{\changes@}[1]{%
179 % \my@changes#1.\@nil
180 % }%
181 %\makeatother
182 %
183 % \changes{v0.1.0}{2004/12/10}{First public release}
184 % \changes{v0.2.0}{2005/01/01}{Fix babel problems}
185 % \changes{v0.3.0}{2005/03/24}{Reorganize for ledarab}
186 % \changes{v0.3.1}{2005/03/30}{Minor \protect\cs{linenummargin} fix}
187 % \changes{v0.3.2}{2005/04/08}{Improved parallel page balancing}
188 % \changes{v0.3.3}{2011/06/16}{Compatibilty with Polyglossia}
189 % \changes{v0.4.0}{2011/08/03}{No more ledparpatch. All patches are now in the main file.}
190 % \changes{v0.5.0}{2011/08/21}{Corrections about \protect\cs{section} and other titles in numbered sections}
191 % \changes{v0.6.0}{2011/08/22}{Be able to us \protect\cs{chapter} in parallel pages.}
192 % \changes{v0.7.0}{2011/08/31}{Add \protect\option{shiftedverses} option which makes there is no blank between two parallel verses with inequal length.}
193 % \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 \protect\cs{hangingsymbol} to define the character.}
194 % \changes{v0.9.0}{2011/10/01}{Possibilty to number the pstart with the commands \protect\cs{numberpstarttrue}.}
195 % \changes{v0.9.1}{2011/10/02}{The numbering of the pstarts restarts on each \protect\cs{beginnumbering}.}
196 % \changes{v0.9.2}{2011/11/08}{Debug: with \protect\cs{Columns}, the hanging indentation now runs on the left columns and the hanging symbol is shown only when \protect\cs{stanza} is used.}
197 % \changes{v0.9.3}{2011/11/18}{\protect\cs{thepstartL} and \protect\cs{thepstartR} use now \protect\cs{bfseries} and not \protect\cs{bf}, which is deprecated and makes conflicts with memoir class.}
198 % \changes{v0.10.0}{2012/04/04}{\protect\cs{edlabel} commands which start a paragraph are now put in the right place.}
199 % \changes{v0.10.0}{2012/04/04}{\protect\cs{edlabel} commands on the right side are now correctly indicated.}
200 % \changes{v1.0.0}{2012/09/14}{Compatibility with eledmac. Change name to eledpar.}
201 % \changes{v1.0.1}{2012/09/16}{Correction on \protect\cs{numberonlyfirstinline} with lineation by pstart or by page.}
202 % \changes{v1.1.0}{2012/09/25}{The \protect\option{shiftedverses} options becomes \protect\option{shiftedpstarts}.}
203 % \changes{v1.2.0}{2012/10/15}{Support for \protect\cs{led}\meta{section} commands in parallel texts.}
204 % \changes{v1.3.2}{2012/12/11}{Debug with some classes.}
205 % \changes{v1.4.3}{2013/10/27}{Corrects a false hanging verse when a verse is exactly the length of a line.}
206 % \changes{v1.5.0}{2013/11/08}{Add, as in eledmac, features to manage page breaks.}
207 % \changes{v1.7.0}{2014/04/14}{Add, as in eledmac, features to make crossrefs with pstart numbers.}
208 % \changes{v1.8.0}{2014/08/05}{Debug eledmac sectioning command after using \protect\cs{resumenumbering}.}
209 % \changes{v1.8.0}{2014/08/05}{Compatibility with \protect\package{musixtex}.}
210 % \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, option to insert something after \protect\cs{pend}s / verses.}
211 % \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, option to insert something between \protect\cs{pstart}s / verse.}
212 % \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, new system of sectioning commands.}
213 % \changes{v1.8.2}{2014/08/15}{Debug left and side note (bugs added by 1.8.0)}
214 % \changes{v1.8.2}{2014/08/15}{Debug \protect\cs{eledxxx} with some paper sizes}
215 % \changes{v1.8.3}{2014/08/31}{Add \protect\cs{noeledxxx}, as in eledmac}
216 % \changes{v1.9.0}{2014/09/16}{Compatibility with \protect\cs{Xnoteswidthliketwocolumns} and \protect\cs{notesXwidthliketwocolumns}}
217 % \changes{v1.10.0}{2015/01/12}{Restore critical notes in \protect\cs{eledsection} in parallel columns (this bug was added in 1.8.2).}
218 % \changes{v1.10.0}{2015/01/12}{Compatibility with \protect\cs{AtEveryPstart} and \protect\cs{AtEveryPend}}
219 % \changes{v1.11.0}{2015/01/23}{Compatibility of standard footnotes with some biblatex styles.}
220 % \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
221 % \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.}
222 % \changes{v1.13.0}{2015/03/06}{Fix a bug in shiftedpstarts when size difference between pstarts is very important.}
223 % \changes{v1.14.0}{2015/03/22}{The \protect\cs{newif}s are not followed by boolean values set to false, because it is the \TeX\ default setting.}
224 % \changes{v1.14.0}{2015/03/22}{Fix a bug with line number position when using \protect\cs{eledsection} and similar commands for RTL texts with \LuaLaTeX.}
225 % \changes{v1.15.0}{2015/04/13}{Add \protect\cs{AtEveryPstartCall}.}
226 % \changes{v1.15.0}{2015/04/13}{Fix vertical spurious space before right \protect\cs{eledchapter} (bug added in v1.13.0).}
227 % \changes{v1.15.0}{2015/04/13}{Prevent vertical space when using \protect\cs{AtEveryPstart} or \protect\cs{AtEveryPend} with a command which prints nothing}
228 % \changes{v1.16.0}{2015/05/18}{Fix a bug with nofamiliar / nocritical option of eledmac.}
229 % \changes{v1.16.0}{2015/05/18}{Error message when using \protect\cs{beginnumbering}\ldots\protect\cs{endnumbering} without \protect\cs{pstart}.}
230 % \changes{v1.16.0}{2015/05/18}{Error message when starting a Leftside/a Rightside while the previous one has not been yet typeset.}
231 % \changes{v1.16.0}{2015/05/18}{Error message when calling \protect\cs{Pages} inside \protect\env{pages} environment and \protect\cs{Columns} inside \protect\env{pairs} environment.}
232 % \changes{v1.16.0}{2015/05/18}{New package option sameparallelpagenumber to have the same page number for both left and right side.}
233 % \changes{v1.16.1}{2015/05/20}{Write information about line-list file version in the correct file.}
234 % \changes{v1.16.2}{2015/05/29}{Fix a bug when adding empty lines before a \protect\cs{pend} in combination with some specific penalties setting.}
235 % \changes{v1.17.0}{2015/06/02}{Add compatibility of optional argument of \protect\cs{pstart}/\protect\cs{pend} and \protect\cs{AtEveryPstart}/\protect\cs{AtEveryPend} with two columns mode.}
236 % \changes{v2.0.0}{2015/07/19}{Many code refactored and moved to \reledmac.}
237 % \changes{v2.0.0}{2015/07/19}{Package's name becomes \reledpar.}
238 % \changes{v2.0.0}{2015/07/19}{Fix some bugs with \protect\option{sameparallelpagenumber} option.}
239 % \changes{v2.0.0}{2015/07/19}{Totally new implementation of \protect\option{sameparallelpagenumber} option.}
240 % \changes{v2.1.0}{2015/07/27}{Fix a bug with \protect\cs{setparledgroupnotespacing} with the shiftedpstarts option.}
241 % \changes{v2.1.0}{2015/07/27}{Fix incompatibility between optional argument of \protect\cs{pstart} and \protect\cs{numberpstarttrue}}
242 % \changes{v2.1.0}{2015/07/27}{Options to custom empty right page before \protect\cs{Pages}.}
243 % \changes{v2.1.0}{2015/07/27}{Fix a bug when using \protect\cs{pagenumbering} with memoir (bug added in v2.0.0).}
244 % \changes{v2.1.0}{2015/07/27}{Fix a bug when using \protect\cs{eledsection} and related on right pages when page width is short.}
245 % \changes{v2.2.0}{2015/08/08}{\protect\env{astanza} environment can take an optional argument, which will be the optional argument of \protect\cs{pstart} started by this environment.}
246 % \changes{v2.2.0}{2015/08/08}{New tools to number stanza}
247 % \changes{v2.2.1}{2015/08/13}{Fix a bug with optional argument of last left \protect\cs{pend}}
248 % \changes{v2.3.0}{2015/09/05}{Fix a bug with title number in parallel columns}
249 % \changes{v2.3.0}{2015/09/05}{Change some internal codes in order to provide compatibility with \LaTeX\ release of october~2015}
250 % \changes{v2.3.0}{2015/09/05}{New line setting command suffixed by R to set only the right side.}
251 % \changes{v2.4.0}{2015/09/29}{New way of (not) synchronizing the parallel pages.}
252 % \changes{v2.4.0}{2015/09/29}{Option to switch to \protect\cs{mainmatter} when calling \protect\cs{Pages}}
253 % \changes{v2.5.0}{2015/10/14}{New commands \protect\cs{linenummarginR} and \protect\cs{linenummargin*}}
254 % \changes{v2.5.0}{2015/10/14}{Fix a bug introduced in v1.15.0 which made hanging indentation in verse not work anymore.}
255 % \changes{v2.5.0}{2015/10/14}{Disable empty lines as paragraph in astanza.}
256 % \changes{v2.5.1}{2015/10/19}{Fix spurious space when using optional argument of \protect\env{astanza} environment (introduced in v2.5.0).}
257 % \changes{v2.5.2}{2015/10/26}{Fix a bug introduced in v2.5.0 with \protect\cs{linenummargin}, \protect\cs{firstlinenum}, \protect\cs{linenumincrement}, \protect\cs{firstsublinenum}, \protect\cs{sublinenumincrement}.}
258 % \changes{v2.6.0}{2015/11/13}{\protect\cs{printlinesR} deleted}
259 % \changes{v2.6.0}{2015/11/13}{\protect\cs{Xlineflag} and \protect\cs{Xendlineflag} added}
260 % \changes{v2.6.0}{2015/11/13}{Fix a bug with footnote numbering when using the same series of familiar footnotes on both sides.}
261 % \changes{v2.6.0}{2015/11/13}{Error message when calling \protect\cs{Pages} or \protect\cs{Columns} without previous \protect\env{pages} or \protect\env{pairs} environnment.}
262 % \changes{v2.6.0}{2015/11/13}{Fix compatibility with \protect\package{babel} (broken in v2.0.0).}
263 % \changes{v2.6.0}{2015/11/13}{No error messages about ends of left / right page when using the \protect\cs{syntaxonly} command of the \protect\package{syntonly} package.}
264 % \hyphenation{man-u-script man-u-scripts}
265 % \changes{v2.6.0}{2015/11/13}{Fix a bug with right side title number when using title commands before \protect\env{pages} or \protect\env{columns} environments.}
266 % \changes{v2.6.1}{2015/11/20}{Fix a bug, introduced in v2.6.0, with footnote numbering when using \protect\package{perpage} package.}
267 % \changes{v2.6.2}{2015/11/29}{Fix (again) bugs with footnote numbering in parallel typesetting while using \protect\env{ledgroup} environments (bug added in v2.6.0).}
268 % \changes{v2.6.2}{2015/11/29}{Fix a bug (added in v2.6.0) with footnote numbering in parallel typesetting while using \protect\package{polyglossia} with specific numbering systems (like Greek).}
269 % \changes{v2.6.3}{2015/12/13}{Fix spurious dot when using \protect\cs{linenummargin} on right side (introduced in v2.5.0).}
270 % \changes{v2.7.0}{2016/01/15}{\protect\macpackage cross-referencing can take advantage of \protect\package{xr} package.}
271 % \changes{v2.7.1}{2016/03/06}{Fix a bug added in \protect\reledmac~2.8.2, when typesetting parallel text just after a sectioning command}
272 % \changes{v2.8.0}{2016/03/23}{{Allow continuing line numbering between normal text and parallel text, using \protect\cs{pausenumbering} and \protect\cs{resumenumbering} and the \protect\option{continuousnumberingwithcolumns} options.}}
273 % \changes{v2.8.0}{2016/03/23}{Fix a bug when the right line number style is not the same to the left line number style}
274 % \changes{v2.8.0}{2016/03/23}{Add \protect\cs{linenumberLevenifblanktrue} and \protect\cs{linenumberRevenifblank} commands}
275 % \changes{v2.9.0}{2016/05/08}{Add \protect\cs{AtEveryStanza} and \protect\cs{AtEveryStopStanza}.}
276 % \changes{v2.9.0}{2016/05/08}{More specific error messages.}
277 % \changes{v2.9.1}{2016/05/25}{Prevent \protect\cs{Xtxtbeforenotes} hook from causing notes to go beyond the bottom margin}
278 % \changes{v2.10.0}{2016/06/02}{Add new tools to make apparatuses of manuscripts}
279 % \changes{v2.11.0}{2016/06/16}{Compatibility with \protect\reledmac's \protect\option{auxdir} option.}
280 % \changes{v2.12.0}{2016/07/01}{Add \protect\cs{edtextlater} and \protect\cs{edtextnow}.}
281 % \changes{v2.12.0}{2016/07/01}{Fix a bug with \protect\cs{lineationR}.}
282 % \changes{v2.12.0}{2016/07/01}{Fix a bug with \protect\cs{AtBeginPairs}.}
283 % \changes{v2.13.0}{2016/07/22}{Compatibility with the new features of \protect\macpackage 2.15.0}
284 % \changes{v2.13.1}{2016/09/26}{Simplification of the code concerning the sectioning command}
285 % \changes{v2.14.0}{2016/10/02}{New commands to have specific line margins for text running in parallel columns}
286 % \changes{v2.14.0}{2016/10/02}{Add \protect\cs{linenumberlistR}, equivalent to \protect\cs{linenumberlist} for the right side.}
287 % \changes{v2.14.0}{2016/10/02}{When indexing texts in sidenotes with \protect\cs{edtext}, referring to the line number where the sidenote is called.}
288 % \changes{v2.14.0}{2016/10/02}{More explicit error message when the stanza indentation is not defined.}
289 % \changes{v2.14.0}{2016/10/02}{Error message when left / right side are not defined.}
290 % \changes{v2.14.1}{2016/10/16}{Fix a bug with vertical space before sectioning command in optional argument of \protect\cs{pstart} (bug added in v2.13.1).}
291 % \changes{v2.14.1}{2016/10/16}{Fix a bug when using \protect\cs{markboth} on \protect\cs{doinsidelineLhook} and \protect\cs{doinsidelineRhook}.}
292 % \changes{v2.14.2}{2016/10/31}{Fix spurious space with \protect\cs{edtextlater}.}
293 % \changes{v2.14.3}{2016/11/04}{Fix a bug in \protect\cs{edtextnow}.}
294 % \changes{v2.14.4}{2016/11/14}{Take into account \protect\cs{linenumberstyle} when using \protect\cs{edlineref}.}
295 % \changes{v2.15.0}{2016/12/12}{Add \protect\option{movecolumnspositiononrightpage} option.}
296 % \changes{v2.15.0}{2016/12/12}{New macro \protect\cs{sidenotemarginR}, fix default value to right.}
297 % \changes{v2.15.0}{2016/12/12}{Fix a bug with \protect\cs{msdata} when using multiple \protect\cs{beginnumbering}\ldots\protect\cs{endnumbering}}
298 % \changes{v2.15.0}{2016/12/12}{Fix a bug about space before sectioning commands after a pairs environment (bug added in v.~2.14.4).}
299 % \changes{v2.15.0}{2016/12/12}{Fix a bug with page break when using \protect\cs{columns} (bug added in v.~2.14.1).}
300 % \changes{v2.16.0}{2016/12/23}{Compatibility with \protect\cs{setmsdataposition}}
301 % \changes{v2.16.1}{2017/01/03}{Restore sidenotes on left side, deleted by mistake in v2.16.0}
302 % \changes{v2.16.2}{2017/01/25}{Change log message when numbered files still don't exist, in order to improve compatibility with \protect\emph{latexmk}.}
303 % \changes{v2.16.3}{2017/02/10}{Fix a bug when setting \protect\cs{aftercolumnseparator}.}
304 % \changes{v2.17.0}{2017/02/22}{Change code for compatibility with \protect\reledmac 2.18.0}
305 % \changes{v2.17.1}{2017/03/26}{Fix a bug with \protect\option{prevpgstyle} option when not using \protect\option{prevpgnotnumbered}.}
306 % \changes{v2.17.3}{2017/04/20}{Fix a bug when using multiple sidenotes on the same line, on right side.}
307 % \changes{v2.17.4}{2017/04/28}{Fix bugs with sublines in parallel typesetting.}
308 % \changes{v2.18.0}{2017/05/04}{Compatibility with v2.20.0 of \protect\reledmac.}
309 % \changes{v2.19.0}{2017/06/08}{Compatibility with v2.22.0 of \protect\reledmac.}
310 % \changes{v2.19.1}{2017/06/15}{Fix a bug with \protect\cs{edtext} in sectioning command with shiftedpstarts mode.}
311 % \changes{v2.19.2}{2017/07/07}{\protect\option{continuousnumberingwithcolumns} also works for the pstart number.}
312 % \changes{v2.19.3}{2017/07/17}{Fix a bug with \protect\option{nopbinverse} when using consecutive \protect\cs{Pages}.}
313 % \changes{v2.19.3}{2017/07/17}{Do not print footnotes at the first run.}
314 % \changes{v2.19.4}{2017/07/31}{Optimisation of the code in order to not print footnotes at the first run.}
315 % \changes{v2.19.5}{2017/08/10}{Fix a bug added in \protect\environment{astanza} in v.~2.18.0}
316 % \changes{v2.20.0}{2017/10/15}{Add \protect\option{sidenotesmarginpage} option to make the sidenotes refer to page margins and not column margins.}
317 % \changes{v2.20.0}{2017/08/17}{Fix incompatibility between \protect\cs{lineation}\protect\arg{page} and \protect\option{continuousnumberingwithcolumns} option}
318 % \changes{v2.20.0}{2017/08/17}{Fix a bug with \protect\cs{continuousnumberingwithcolumns} when using multiple series of continued numbering text. Now, the line number are correctly reset at each \protect\cs{beginnumbering}.}
319 % \changes{v2.20.0}{2017/08/17}{Fix a bug with \protect\option{continuousnumberingwithcolumns} and inner / outer notes and line numbering.}
320 % \changes{v2.20.0}{2017/08/17}{Add \protect\cs{linenumOnlyPagesForColumns} and \protect\cs{linenumOnlyPagesForColumnsR} to tell to print the line numbers associated with a column only on some specific pages (for example, only on right pages).}
321 % \changes{v2.20.0}{2017/08/17}{Fix a bug with \protect\option{continuousnumberingwithcolumns} when a \protect\cs{beginnumbering} is called after another \protect\cs{beginnumbering}\ldots\protect\cs{endnumbering}.}
322 % \changes{v2.20.0}{2017/08/17}{Fix a bug with \protect\option{widthliketwocolumns} when manually setting \protect\cs{beforecolumnseparator} and \protect\cs{aftercolumnseparator}.}
323 % \changes{v2.20.0}{2017/08/17}{Fix compatibility between \protect\option{continuousnumberingwithcolumns} and \protect\cs{numberpstartfalse}.}
324 % \changes{v2.20.1}{2017/08/23}{Fix bug with \protect\option{continuousnumberingwithcolumns} when left column and right column have not the same size.}
325 % \changes{v2.20.2}{2017/08/31}{Fix bugs with \protect\option{continuousnumberingwithcolumns} when going to a new page}
326 % \changes{v2.21.0}{2017/11/11}{Add compatibility with new features of \protect\reledmac 2.26.0}
327 % \changes{v2.21.1}{2017/11/22}{Fix bug with \protect\cs{linenumberannotation}}
328 % \changes{v2.21.2}{2018/01/08}{Fix bug with \protect\cs{Xpstart} and \protect\cs{edtextlater}}
329 % \changes{v2.21.3}{2018/01/18}{Fix bug when using \protect\cs{numberpstarttrue} and alterning between manual \protect\cs{pstart} and automatic \protect\cs{pstart} produced by \protect\cs{autopar}}
330 % \changes{v2.21.4}{2018/01/18}{Fix bug with using \protect\cs{eledsection} and related when alternate normal typesetting and parallel typesetting}
331 % \changes{v2.21.5}{2018/02/28}{Compatibility with reledmac v.~2.26.6}
332 % \changes{v2.21.6}{2018/04/06}{Fix page number in footnote and endnotes when using \protect\option{sameparallelpagenumber} option}
333 % \changes{v2.21.7}{2018/04/07}{Compatibility with \protect\macpackage 2.26.7}
334 % \changes{v2.21.8}{2018/05/02}{Fix bug with critical footnotes line number when alternating between \protect\cs{numberlinefalse} and \protect\cs{numberlinetrue}.}
335 % \changes{v2.21.8}{2018/05/02}{Fix bug with marginal line number in parallel typesetting when alternating between \protect\cs{numberlinefalse} and \protect\cs{numberlinetrue}.}
336 % \changes{v2.21.8}{2018/05/02}{Workaround with a bug of \protect\LaTeX 2018/04/01 patch level 3 to generate the .sty file from a .ins file}
337 % \changes{v2.21.9}{2018/07/19}{Fix (little) bug when using \protect\package{calc} package.}
338 % \changes{v2.22.0}{2018/09/13}{Compatibility with \protect\cs{doinsidethislinehook} macro.}
339 % \changes{v2.22.1}{2019/01/08}{Really reset line number annotation at each line}
340 % \changes{v2.22.2}{2019/01/22}{Fix bug with \protect\cs{Xonlyside} and \protect\cs{onlysideX}}
341 % \changes{v2.22.3}{2019/07/21}{When using \protect\cs{parindentX} or \protect\cs{Xparindent} and stanza, use the normal indentation in the footnote, not the verse indentation.}
342 % \changes{v2.23.0}{2020/03/08}{Add \protect\cs{Leftpagehook} and \protect\cs{Rightpagehook}.}
343 % \changes{v2.23.0}{2020/03/08}{Add hanging symbol feature to \protect\env{astanza}.}
344 % \changes{v2.23.1}{2020/04/19}{Fix bug when using \protect\package{polyglossia} v1.45 or later.}
345 % \changes{v2.24.0}{2020/05/31}{Add startstanzaindentsrepetition feature.}
346 % \changes{v2.24.0}{2020/05/31}{Add antilabe feature.}
347 % \changes{v2.24.1}{2020/08/19}{Makes \protect\cs{numberstantzatrue} working with \protect\env{astanza}.}
348 % \changes{v2.24.1}{2020/08/19}{Fix incompatibility between lineation by \protect\cs{pstart} and (a)stanza.}
349 % \changes{v2.24.2}{2020/09/16}{Fix some bugs with lineation by page, when a numbered section starts at the very beginning of page.}
350 % \changes{v2.24.3}{2020/11/08}{Fix bug with hanging verse in parallel typesetting.}
351 % \changes{v2.25.0}{2020/11/29}{Add compatibility with \protect\cs{linenumannotationothersidetrue} of \protect\macpackage.}
352 % \changes{v2.25.1}{2021/01/21}{\protect\cs{ifsublines@R} migrated to \protect\macpackage}
353 % \changes{v2.25.2}{2021/09/27}{Fix incompatibility with \protect\package{babel} v3.61}
354 % \changes{v2.25.3}{2022/04/22}{Fix incompatibility with \protect\package{polyglossia} v1.55}
355 % \changes{v2.25.4}{2023/07/04}{Fix bug with \protect\cs{linenumOnlyPagesForColumnsR} and multiple numbered sections}
356 % \changes{v2.25.5}{2023/07/20}{Fix bug with hyperlink when using \protect\cs{footnoteXnomk}}
357 % \changes{v2.25.6}{2024/02/26}{Make \protect\cs{doinsidethislinehook} working on right side}
358 % \changes{v2.25.8}{2025/02/09}{Fix compatibility with \protect\package{polyglossia} 2.4}
359 % \changes{v2.25.9}{2025/04/13}{Fix bug with \protect\cs{lockon} immediately following a (explicit or implicit) \protect\cs{lockoff}.}
360 % \changes{v2.25.10}{2025/05/13}{Fix detection of left/right side language with polyglossia when using implicitly the main language of document}
361 %% PW added following as the definitions are at some unknown elsewhere
362 %
363 % \newcommand{\egstart}{%
364 % \par
365 % \begingroup
366 % \centering
367 % \begin{minipage}{0.45\textwidth}}
368 % \newcommand{\egmid}{%
369 % \end{minipage}\hfill\begin{minipage}{0.45\textwidth}}
370 % \newcommand{\egend}{%
371 % \end{minipage}\par\endgroup}
372 %
373 % \title{Parallel typesetting for critical editions: \\
374 % the \parpackage package\thanks{This file (\dtxfilename)
375 % has version number \fileversion, last revised \filedate.}}
376 % \author{%
377 % Ma\"ieul Rouquette\thanks{\texttt{maieul at maieul dot net}}
378 % {\small based on the original \ledpar by}
379 % Peter Wilson \\
380 % Herries Press\thanks{\texttt{herries dot press at earthlink dot net}}\\
381 % }
382 %
383 % \date{}
384 %
385 %
386 % \maketitle
387 %
388 %
389 % \begin{abstract}
390 % The \macpackage package has been used for some time for typesetting critical
391 % editions. The \parpackage package is an extension to \macpackage
392 % which enables texts and their critical apparatus to be typeset in
393 % parallel, either in two columns or on pairs of facing pages.
394 %
395 %
396 % \Parpackage provides many tools and options. Normally, they are all documented in this file.
397 % Also provided is a help folder, \enquote{\href{examples/.}{examples}}. The folder contains additional examples (although not for all cases).
398 % Examples starting by \enquote{3-} are for basic uses, those starting by \enquote{4-} are for advanced uses.
399 %
400 % To report bugs, please go to ledmac's GitHub page and click \enquote{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).
401 %
402 % You can subscribe to the \macpackage email list in:\\ \url{http://geekographie.maieul.net/146}
403 % \end{abstract}
404 % \renewcommand{\numberline}[1]{#1~}
405 % \tableofcontents
406 %
407 %
408 %
409 % \section{Introduction}
410 %
411 %
412 % \subsection{Aim of this package}
413 %
414 % Some critical editions contain texts in more than one form, such as
415 % a set of verses in one language and their translations in another. In
416 % such cases there is a desire to be able to typeset the two texts, together
417 % with any critical apparatus, in parallel. The \parpackage package
418 % is an extension to \macpackage that enables two texts and their
419 % apparatus to be set in parallel, either in two columns or on pairs of
420 % facing pages.
421 %
422 % The package has to try and coerce \TeX{} into paths it was not designed
423 % for. Use of the package, therefore, may produce some surprising results.
424 % In this case, please reports them to the author via github's issues: \url{https://github.com/maieul/ledmac/issues/}.
425
426 % This manual contains a general description of how to use
427 % \parpackage starting in section~\ref{howto};
428 % the complete source code for the package,
429 % with extensive documentation (in sections~\ref{overview}
430 % through \ref{end});
431 % and an Index to the source code. As \parpackage is an adjunct to \macpackage
432 % we assume that you have read the \macpackage manual. Also \parpackage requires
433 % \macpackage to be used, in the version distributed with version.
434 %
435 % You do not need to read the source code for this package in order to
436 % use it but doing so may help to answer any questions you might have. The documentation's sections are numbered in roman numeral.
437 %
438 % On a first reading,
439 % We suggest that you should skip anything after the general documentation in
440 % first sections until~\ref{overview},
441 % unless you are particularly interested in the innards of \parpackage.
442 %
443 % \subsection{Historical overview}
444 % Many of the code of this package is based on the \eledpar package, which was based on the \ledpar, created as an extension of the \ledmac package.
445 %
446 % Names of the package related to parallel typesetting have moved in parallel of names of the package related to critical edition.
447 %
448 % Please read \macpackage's handbook in order to understand this evolution.
449 %
450 % \section{Options}
451 % The package can be loaded with a number of global options which are listed
452 % here. Those options are fully described in the paragraphs devoted to their feature.
453 % \subsection{Synchronization's options}
454 % Please read the paragraph on synchronization's option on \reff{syncoption} to understand better those options.
455 % \begin{description}
456 % \item [shiftedpstarts] prevents white space between paragraphs on facing pages,
457 % the white space necessary to sync pages is collected at the bottom of
458 % the page instead.
459 % \item [advancedshiftedpstarts] does the same as \option{shiftedpstarts}, but
460 % the pstart shift are not counted to determine when cutting the page. That
461 % could help to avoid page with blank lines at the bottom.
462 % \item [nomaxlines] allows facing pages to have different numbers of lines.
463 % \item [nosyncpstarts] disables syncing on facing pages. In that case the pages
464 % are filled as two streams normal.
465 % \end{description}
466 % \subsection{Other options}
467 % \begin{description}
468 % \item [parledgroup] allows the use of \env{ledgroup} environment with \parpackage.\footnote{This option can either be used on \macpackage or \parpackage.}
469 % \item [widthliketwocolumns] set the width of the text printed in a single
470 % column to be the same as the width of the text printed in two parallel
471 % columns with \parpackage. This is useful when alternating between normal and
472 % parallel typesetting.\footnote{This option can either be used on \macpackage or \parpackage.}
473 % \item [continuousnumberingwithcolumns] allow you to alternate between normal typesetting and parallel column typesetting without resetting the line number (see \reff{continuousnumberingwithcolumns}).
474 % \item [sidenotesmarginpage] makes the sidenotes be placed on the margin of the page and not on the margin of the columns.
475 % \item [sameparallelpagenumber] sets page numbers on facing pages to the same value.
476 % \item [prevpgnotnumbered] enables that the page before facing pages (the one
477 % automatically inserted to start parallel pages on a left page) is not
478 % counted. This applies only if the page is empty.
479 % \item[movecolumnspositiononrightpage] make the left column on the right page become the right column, and the left column become the right column.
480 % It allows to have a text running on the inner column, and an other one on the outer column.
481 % \end{description}
482 %
483 %
484 % \section{General}\label{howto}
485 %
486 % A file may mix \emph{numbered} and \emph{unnumbered} text.
487 % Numbered text is printed with marginal line numbers and can include
488 % footnotes and endnotes that are referenced to those line numbers:
489 % this is how you will want to print the text that you are editing.
490 % Unnumbered text is not printed with line numbers, and you can't
491 % use \macpackage's note commands with it: this is appropriate for
492 % introductions and other material added by the editor around the
493 % edited text.
494 %
495 % The \parpackage package lets you typeset two \emph{numbered} texts in
496 % parallel\footnote{You can use, anyway, \protect\cs{numberlinefalse} to disable printing of line numbers.}.
497 % This can be done either as setting the \enquote{Leftside} and \enquote{Rightside}
498 % texts in two columns or on facing pages.
499 % In the paired pages case footnotes are placed at the bottom of the page
500 % on which they are called out --- that is, footnotes belonging to the left
501 % are set at the foot of a left (even numbered) page, and those for right
502 % texts are at the bottom of the relevant right (odd numbered) page. However,
503 % in the columnar case, all footnotes are set at the bottom left of the
504 % page on which they are called out --- they are not set below the
505 % relevant column.
506 %
507 %
508 %
509 % \Macpackage essentially puts each chunk of numbered text
510 % (the text within a \protect\cs{pstart} \ldots \protect\cs{pend}) into a box and then
511 % following the \protect\cs{pend} extracts the text line by line from the box
512 % to number and print it. More precisely, the text is first put into the
513 % the box as though it was being typeset as normal onto a page and
514 % any notes are stored without being typeset. Then each typeset line
515 % is extracted from the box and any notes for that line are recalled.
516 % The line, with any notes, is then output for printing, possibly with
517 % a line number attached. Effectively, all the text is typeset and then
518 % afterwards all the notes are typeset.
519 %
520 %
521 % \Parpackage similarly puts the left and right chunks into boxes but can't
522 % immediately output the text after a \protect\cs{pend} --- it has to wait until
523 % after both the left and right texts have been collected before it can
524 % start processing. This means that several boxes are required and possibly
525 % \TeX\ has to store a lot of text in its memory; both the number of potential
526 % boxes and memory are limited. If \TeX's memory is overfilled the recourse is
527 % to reduce the amount of text stored before printing.
528 %
529 % \DescribeMacro{\maxchunks}
530 % It is possible to have multiple chunks in the left and right texts before
531 % printing them. The macro \protect\cs{maxchunks}\marg{num} specifies the maximum
532 % number of chunks within the left or right texts. This is initially set as: \\
533 % \verb?\maxchunks{5120}? \\
534 % meaning that there can be up to 5120 chunks in the left text and up to
535 % 5120 chunks in
536 % the right text, requiring a total of 10240 boxes. If you need more chunks
537 % then you can increase \protect\cs{maxchunks}. The \protect\cs{maxchunks} must be called in the preamble.
538 %
539 % If you \protect\cs{maxchunks} is too little
540 %you can get a \parpackage{} error message along the
541 % lines: \enquote{Too many \protect\cs{pstart} without printing. Some text will be lost.}
542 % then you will have to either increase \protect\cs{maxchunks} or use the
543 % parallel printing commands (\protect\cs{Columns} or \protect\cs{Pages}) more frequently.
544 %
545 % When typesetting verse using \protect\cs{stanza}, each line is treated as a chunk,
546 % so be warned that if you are setting parallel verses you might have to
547 % increase \protect\cs{maxchunks} much more than it appears at first sight.
548 %
549 % In general, \macpackage is a \TeX\ resource hog, and \parpackage{} only
550 % makes things worse in this respect.
551 %
552 % \section{Parallel columns}\label{columns}
553 % \subsection{Basic use}
554 % \DescribeEnv{pairs}
555 % Numbered text that is to be set in columns must be within a \verb?pairs?
556 % environment. Within the environment the text for the lefthand and righthand
557 % columns is placed within the \verb?Leftside? and \verb?Rightside?
558 % environments, respectively; these are described in more detail below
559 % in section~\ref{leftright}.
560 %
561 % \DescribeMacro{\Columns}
562 % The command \protect\cs{Columns} typesets the texts in the previous pair of
563 % \verb?Leftside? and \verb?Rightside? environments.
564 % The general scheme for parallel columns looks like this:
565 % \begin{verbatim}
566 % \begin{pairs}
567 % \begin{Leftside} reledmac numbered text commands \end{Leftside}
568 % \begin{Rightside} reledmac numbered text commands \end{Rightside}
569 % \end{pairs}
570 % \Columns
571 % \begin{pairs}
572 % \begin{Leftside} reledmac numbered text commands \end{Leftside}
573 % ...
574 % \end{pairs}
575 % \Columns
576 % \end{verbatim}
577 %
578 %
579 % Keep in mind that the \protect\cs{Columns} \textbf{must be} outside of the \verb+pairs+ environment.
580 % \DescribeMacro{\AtBeginPairs}
581 % \changes{v1.9.0}{2014/09/16}{Add \protect\cs{AtBeginPairs} macro.}
582 % You can use the macro \protect\cs{AtBeginPairs} to insert a code at the beginning of each \verb+pairs+ environments.
583 % That could be useful to add the \protect\cs{sloppy} macro to prevent overfull hboxes in two columns.
584 % \begin{verbatim}
585 % \AtBeginPairs{\sloppy}
586 % \end{verbatim}
587 % There is no required pagebreak before or after the columns.
588 % \subsection{Setting}
589 % \subsubsection{Column's width}
590 % \DescribeMacro{\Lcolwidth}
591 % \DescribeMacro{\Rcolwidth}
592 % The lengths \protect\cs{Lcolwidth} and \protect\cs{Rcolwidth} are the widths of the left
593 % and right columns, respectively. By default, these are: \\
594 % \verb?\setlength{\Lcolwidth}{0.45\textwidth}? \\
595 % \verb?\setlength{\Rcolwidth}{0.45\textwidth}? \\
596 % They may be adjusted if one text tends to be \enquote{bulkier} than the other.
597 % \subsubsection{Column's separator}
598 % \DescribeMacro{\columnrulewidth}
599 % \DescribeMacro{\columnseparator}
600 % The macro \protect\cs{columnseparator} is called between each left/right pair
601 % of lines. By default it inserts a vertical rule of width
602 % \protect\cs{columnrulewidth}. As this is initially defined to be 0pt the rule
603 % is invisible. For a visible rule between the columns you could try: \\
604 % \verb?\setlength{\columnrulewidth}{0.4pt}? \\
605 % You can also modify \protect\cs{columnseparator} if you want more control.
606 % \subsubsection{Column's positions}
607 % \DescribeMacro{\columnsposition}
608 % \changes{v1.8.0}{2014/08/05}{Add \protect\cs{columnsposition}.}
609 % By default, columns are positioned to the right of the page.
610 % However, you can use \protect\cs{columnsposition}\verb+{L}+ to align them to the left,
611 % or \protect\cs{columnsposition}\verb+{C}+ to center them.
612 %
613 % When you use \protect\cs{stanza}, the visible rule may shift when a verse has a hanging indent. To prevent shifting, use \protect\cs{setstanzaindents} outside the \verb|Leftside| or \verb|Rightside| environment.
614 %
615 %
616 % \DescribeMacro{\beforecolumnseparator}\DescribeMacro{\aftercolumnseparator}
617 % \changes{v1.8.0}{2014/08/05}{Add \protect\cs{beforecolumnseparator} and \protect\cs{aftercolumnseparator}.}
618 % By default, the spaces around column separator are the same as the space:
619 % \begin{itemize}
620 % \item On the left of columns, if columns are aligned right.
621 % \item On the right of columns, if columns are aligned left.
622 % \item On both the left and right columns, if columns are centered.
623 % \end{itemize}
624 % You can redefine \protect\cs{beforecolumnseparator} and \protect\cs{aftercolumnseparator} length to define spaces before or after the column separator, instead of letting \parpackage calculate them automatically.
625 % \begin{verbatim}
626 % \setlength{\beforecolumnseparator}{length}
627 % \setlength{\aftercolumnseparator}{length}
628 % \end{verbatim}
629 % If you want to revert to the previous behavior, just set with a negative value.
630 % \subsubsection{Mixing two columns and one column texts}
631 % \DescribeMacro{\widthliketwocolumns}
632 % If you want to mix two-column with single-column text, you can align horizontally single-column text to two-column text with \protect\cs{widthliketwocolumnstrue}. To reset this feature, use \protect\cs{widthliketwocolumnsfalse}.
633 % You can also use \option{widthliketwocolumns} as a global option when loading \macpackage or \parpackage.
634
635 %
636 % \DescribeMacro{\Xnoteswidthliketwocolumns}
637 % \DescribeMacro{\notesXwidthliketwocolumns}
638 % In most cases, you should use \protect\cs{widthliketwocolumns} in combination with \protect\cs{Xnoteswidthliketwocolumns} and \protect\cs{notesXwidthliketwocolumns} to align the critical/familiar footnotes with the two colums.
639 % See \macpackage's handbook for more details.
640 %
641 % \subsubsection{Schemas of column typesetting}
642 % Domenico Cufalo wrote a schema of the parallel column typesetting parameters, with explanations.
643 % You can read the file \href{run:doc-more/page-typesetting-columns.pdf}{doc-more/page-typesetting-columns.pdf}.
644 %
645 % \subsubsection{Continuous numbering between single and double column texts}
646 % \label{continuousnumberingwithcolumns}If you want to have continuous line
647 % numbers between multiple columns and single columns, use the
648 % \option{continuousnumberingwithcolumns} option when loading \macpackage
649 % or \parpackage.
650 % You will need to use \cs{pausenumbering}\ldots
651 % \cs{resumenumbering} in addition to \cs{beginnumbering}\ldots
652 % \cs{endnumbering} (see \reff{reledmac-pause}).
653 %
654 % The best way to understand the behaviour of \cs{pausenumbering} and
655 % \cs{resumenumbering} is to think of the left-column text as a continuation of
656 % single-column text (or, vice versa, to think of single-column text as
657 % left-column text), and of the right-column as independent text, which needs to be
658 % synchronised with the left one manually. The numbering commands in a
659 % right column are interconnected with each other, and not with the respective
660 % left-column commands.
661 %
662 % This means that you must switch between single-column and left-column
663 % text using \cs{beginnumbering}\ldots\cs{pausenumbering}\ldots
664 % \cs{resumenumbering}\ldots\cs{pausenumbering}\ldots
665 % \cs{resumenumbering}\ldots\cs{endnumbering}.
666 %
667 % On the other side, the first right column must always begin with
668 % \cs{beginnumbering}, no matter if the corresponding left-column started
669 % with \cs{resumenumbering} or not; this is because numbering in the right
670 % column has not been started yet. Then, for consecutive chunks of
671 % right-column text you should use \cs{pausenumbering}\ldots
672 % \cs{resumenumbering}.
673 %
674 % You must use \cs{endnumbering} in a right column in the following cases:
675 % \begin{itemize}
676 % \item there is also a \cs{endnumbering} in the left column, because the line numbering ends with a two columns mode (e.g. at the end of a document);
677 % \item there will be a \cs{endnumbering} in a text after the columns, in a single column mode, because the ligne numbering finishes with single column mode text.
678 % \end{itemize}
679 % Without this, you will
680 % get wrong numbering when a right column reappears next time.
681 %
682 % The file
683 % \file{examples/4-reledpar_column_mix_with_not_column-continuous-numbering.tex}
684 % covers all these cases.
685 % \subsection{Note about \cs{AtEveryPstart*} and \cs{AtEveryPend*}}
686 % The content of \cs{AtEveryPstart} / \cs{AtEveryPend} (without star) is added before every \cs{pstart} / after every \cs{pend}, distinguishing between the left and the right side.
687 %
688 % The content of \cs{AtEveryPstart*} / \cs{AtEveryPend*} (with star) is added before every \cs{pstart} / after every \cs{pend}, but there is no distinction between the left and right sides: the content is inserted \enquote{for the two columns as a whole}.
689 %
690 % However, as this content is also added when we typeset pages in parallel, \reledmac must add it once for left \cs{pstart} and once for right \cs{pstart}.
691 % So if you use it to add vertical spacing, it will be problematic in parallel columns, as you will have the vertical spacing two times (vertical spacing will be twice as large as expected).
692 % A solution is to add a test inside to distinguish between parallel typesetting in columns or on pages.
693 % \begin{verbatim}
694 %\AtEveryPstart*{%
695 %\ifl@dprintingcolumns
696 % \vspace{0.125\baselineskip}
697 %\else
698 % \vspace{0.25\baselineskip}
699 %\fi
700 %}
701 % \end{verbatim}
702 % \section{Keeping translation in the outside/inside column}
703 % By default, \parpackage works with left and right columns.
704 % However, it is possible to work with inner and outer column.
705 % In this case, use the \option{movecolumnspositiononrightpage} at loading time of the package.
706 %
707 % The \env{Leftside} environment will correspond to the inner column, and the \env{Rightside} environment will correspond to the outer column.
708 %
709 % \section{Facing pages}\label{pages}
710 % \subsection{Basic usage}
711 % \DescribeEnv{pages}
712 % Numbered text that is to be set on facing pages must be within a \verb?pages?
713 % environment. Within the environment the text for the lefthand and righthand
714 % pages is placed within the \verb?Leftside? and \verb?Rightside?
715 % environments, respectively.
716 %
717 % \DescribeMacro{\Pages}
718 % The command \protect\cs{Pages} typesets the texts in the previous pair of
719 % \verb?Leftside? and \verb?Rightside? environments.
720 % The general scheme for parallel pages looks like this:
721 % \begin{verbatim}
722 % \begin{pages}
723 % \begin{Leftside} reledmac numberied text commands \end{Leftside}
724 % \begin{Rightside} reledmac numbered text commands \end{Rightside}
725 % \begin{Leftside} reledmac numbered text commands \end{Leftside}
726 % ...
727 % \end{pages}
728 % \Pages
729 % \end{verbatim}
730 % The \verb?Leftside? text is set on lefthand (even numbered) pages and
731 % the \verb?Rightside? text is set on righthand (odd numbered) pages.
732 % Each \protect\cs{Pages} command starts a new even numbered page. After parallel
733 % typesetting is finished, a new page is started.
734 % Note that the \protect\cs{Pages} \textbf{must be} outside of the \verb+pages+ environment.
735 % \subsection{Setting}
736 % \subsubsection{Text width}
737 % \DescribeMacro{\Lcolwidth}
738 % \DescribeMacro{\Rcolwidth}
739 % Within the \verb?pages? environment the lengths \protect\cs{Lcolwidth} and
740 % \protect\cs{Rcolwidth} are the widths of the left
741 % and right pages, respectively. By default, these are set to the normal
742 % textwidth for the document, but can be changed within the environment if
743 % necessary.
744 % \subsubsection[Way of synchronizing]{Way of synchronizing\footnote{There is a French version of this article on \url{http://geekographie.maieul.net/185}.}}\label{syncoption}
745 % Synchronization of left and right texts in parallel processing
746 % requires some \enquote{numbered} auxiliary files to be written (namely \verb+.1+,
747 %\verb+.1R+, \verb+.2+, \verb+.2R+, and so forth), the content of which may change as long
748 %as synchronization is not complete. This usually requires \LaTeX\ to be
749 %run several times. Therefore, it is advised to use in conjunction
750 %utilities such as latexmk to ensure that synchronization is complete.
751 %
752 %Numbered paragraphs which are contained between the \cs{pstart} and \cs{pend}
753 %macros are thereafter called \enquote{chunks}.
754 %
755 %In short, the default setting is designed in such a way that
756 %corresponding chunks of text are always kept in synchronization, even
757 %at the cost of page padding, as it may result in leaving blank lines
758 %between chunks of text. Conversely, using in conjunction
759 %\option{advancedshiftedpstarts} and \option{nomaxlines} settings ensures that pages
760 %are filled with text to full advantage—at the cost of the chunks not
761 %being kept in synchronization—and every chunk starts on the facing
762 %page of its corresponding chunk.
763 %
764 %To understand better how each of the synchronization settings of
765 %\parpackage works, one must first understand how the default setting of
766 %\parpackage synchronizes the left and right chunks.
767 %
768 %The aim of the default setting is twofold:
769 %\begin{itemize}
770 %\item To ensure that left pages contain what is to be on left side and
771 %that right pages contain what is to be on right side.
772 %\item To ensure that every chunk starts on the page that is facing its
773 %corresponding chunk.
774 %\end{itemize}
775 %
776 %As regards the latter, \parpackage checks that both of the following
777 %rules are respected:
778 %\begin{itemize}
779 %\item The numbers of lines of every pair of chunks must be identical. To
780 %keep this rule, \parpackage may insert some blank lines at the bottom of
781 %the chunk that is shorter so that it may eventually have the same
782 %number of lines as the one that is longer.
783 %\item The main content of two facing pages, apart from critical and
784 %familiar footnotes, must have the same numbers of lines, including
785 %those that may be blank. Consequently, if one left page contains more
786 %notes than the corresponding right page, the bottom of the right page
787 %must be left blank.
788 %\end{itemize}
789 %
790 %Each of these rules can be modified by a number of optional
791 %synchronization settings in \parpackage:
792 %\begin{enumerate}
793 %\item Regarding the number of lines a pair of chunks may have:
794 % \begin{enumerate}
795 % \item 'shiftedpstarts' setting merely moves any added blank lines from
796 %the bottom of the chunks to the bottom of the page. It does not allow
797 %to have more lines on a given page as it just removes the blank lines
798 %between the chunks and does nothing more. To understand better how
799 %this work, you may compare the total amounts of lines of text on a
800 %given page whether you have activated this setting or not: you will
801 %see that both amounts are the same.
802 % \item 'advancedshiftedpstarts' prevents any blank lines from being
803 %inserted at the bottom of the chunks, also taking them away from the
804 %total amount of lines the page may have. This allows to get more lines
805 %on the pages. However, please note that:
806 % \begin{itemize}
807 % \item Blank lines are taken into account as \parpackage moves from one to
808 %the following chunk of text, so that every pair of chunks may always
809 %start on the same facing pages.
810 % \item Consequently, blank lines continue to be taken into account in
811 %the calculation of the amount of lines a given pair of pages may have.
812 %This is why when a longer chunk runs from one page to another the
813 %shorter corresponding one also runs across pages, even if this may
814 %result in some blank vertical space being left on the first page.
815 % \end{itemize}
816 % \end{enumerate}
817 % \item As regards the number of lines per page, including blank ones, the
818 %\option{nomaxlines} setting disregards the rule that forces two facing pages
819 %to have the same numbers of lines. So it allows to have more text on
820 %the pages. Then, by a complex mechanism it is ensured that two
821 %corresponding chunks may always start on the same facing pages,
822 %provided that \option{shiftedpstarts} or \option{advancedshiftedpstarts} settings
823 %shall not be activated.
824 %\end{enumerate}
825 %
826 %Lastly, one may disregard all of the synchronization rules and content
827 %himself with parallel texts typesetting. To achieve this, please use
828 %the \option{nosyncpstarts} setting.
829 %
830 %Please note that every change of synchronization setting resets the
831 %content of the \enquote{numbered} auxiliary files to make sure that \parpackage
832 %does not try to make the synchronization with wrong calculations.
833 % \subsubsection{Page number}\label{sameparallelpagenumber}
834 % \changes{v1.15.0}{2015/05/18}{Add sameparallelpagenumber option.}
835 % By default, \protect\cs{Pages} use the standard \LaTeX\ page number scheme.
836 % 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.
837 %
838 % However, you can use the package option \verb+sameparallelpagenumber+ to have the same page number for both left and right side.
839 % In this case, this setting will apply only for pages typeset by \protect\cs{Pages}, not for \enquote{normal} pages.
840 %
841 % Please also read advising in \reff{par@page}.
842 %
843 %
844 % \subsubsection{Page breaking}
845 % \DescribeMacro{\setgoalfraction}
846 % When doing parallel pages \parpackage{} has to guess where \TeX\ is going to
847 % put pagebreaks and hopefully get there first in order to put the pair of
848 % texts on their proper pages. When it thinks that the fraction
849 % \protect\cs{@goalfraction} of a page has been filled, it finishes that page and
850 % starts on the other side's text. The standard value is 0.9.
851 %
852 %
853 % If you think you can get more on a page, increase this. On the other hand,
854 % if some left text overflows onto an odd numbered page or some right text
855 % onto an even page, try reducing it.
856 % You can change it using \cs{setgoalfraction}\marg{newvalue}.
857 % \subsubsection{Right page before \cs{Pages}}
858 % When \cs{Pages} are called, it starts at a new left page, in order to have parallel pages.
859 % Consequently, if it is called on a left page, it clears the current page and then lets
860 % a right void page.
861 %
862 % \Parpackage provides two options to customize this (eventual) right page.
863 % \label{prevpgnotnumbered}
864 % \begin{description}
865 % \item[prevpgstyle=\meta{style}] in order to set the style of this page. A common value of \meta{style} is \verb+empty+.
866 % Use \verb+prevpgstyle=empty+ will suppress header and footer in this page.
867 % Please also read advising in \reff{par@page}.
868 % \item[prevpgnotnumbered] will make this page won't be counted in the page counter.
869 %
870 % \end{description}
871 % \subsubsection{Notes about \protect\cs{mainmatter}}
872 % If you use \cs{frontmatter}, do not use \cs{mainmatter} directly before \cs{Pages} because it could create spurious empty pages.
873 %
874 % Use instead \cs{pages} with the optional argument \verb+[mainmatter]+.
875 % In this case, the content of \cs{Pages} will start on a left side, without any spurious empty page, and the left pages will be odd (and not event like in normal way), the first one being \verb+1+.
876 %
877 % \subsection{Critical and familiar footnotes}
878 % Of course, in \enquote{Facing pages}, the \macpackage's both critical and familiar footnotes can be used.
879 % However, some specific points must be taken into consideration.
880 % \subsubsection{Notes height setting}
881 % Since \protect\package{eledpar} v1.13.0, long notes in facing pages can flow from left to right pages, and \emph{vice-versa}.
882 %
883 % However, the \macpackage default setting for the maximum alloted size to notes is greater than \protect\cs{textheight}. That makes impossible for long notes to flow across pages.%
884 % \footnote{The same applies to \LaTeX\ normal notes. Read \url{http://tex.stackexchange.com/a/228283/7712} for technical informations.}
885 % We have not changed this default setting, because we do not want to break compatibility with older version of \macpackage and we want to be as close as possible to default \LaTeX's feature.
886 %
887 % So, you MUST change the default setting via \protect\cs{Xmaxhnotes} (for critical notes) and \protect\cs{maxhnotesX} (for familiar notes).
888 % Both commands are explained in \macpackage handbook (\reff{reledmac-Xmaxhnotes}).
889 % As an advisable setting:
890 % \begin{verbatim}
891 % \AtBeginDocument{%
892 % \Xmaxhnotes{0.6\textheight}
893 % \maxhnotesX{0.6\textheight}
894 % }
895 % \end{verbatim}
896 % \subsubsection{About the numbering of familiar footnotes}
897 % If you use the same series of familiar footnotes on both sides, the numbers won't be correct in the first run. There will be a continuous numbering for left notes, and a continuous numbering for right notes.
898 % However, after the second run, the numbering will be continuous, alternating between the left and right side.
899 % For example if you have two left pages and two right pages, with one note by page, you will obtain the following numbering at the first run: 1 (left page), 3 (right page), 2 (left page), 4 (right page). But at the next run, you will obtain: 1 (left page), 2 (right page), 3 (left page), 4 (right page).
900 %
901 % If you use parallel columns, during the second of run of typesetting the footnote numbering will not run down the columns. Instead, it will read both column lines completely across the page, and number footnotes from left to right.
902 % \subsubsection{Using \protect\package{perpage} package}\label{perpage}
903 %
904 % It follows from what has been said in the preceding paragraph that if you use the \cs{MakePerPage} command of the \cs{perpage} package for footnotes called in parallel typesetting, you must append to the counter the suffix \verb+@typeset+.
905 %
906 % So do not set:
907 % \begin{verbatim}
908 % \MakePerPage{footnote}
909 % \MakePerPage{footnoteA}
910 % \MakePerPage{footnoteB}
911 % \end{verbatim}
912 % But set:
913 % \begin{verbatim}
914 % \MakePerPage{footnote@typeset}
915 % \MakePerPage{footnoteA@typeset}
916 % \MakePerPage{footnoteB@typeset}
917 % \end{verbatim}
918
919 % \subsubsection{Notes for one side only}
920 % \DescribeMacro{\Xonlyside}
921 % \DescribeMacro{\onlysideX}
922 % You may want to typeset notes on one side only (either left or right).
923 % Use \protect\cs{Xonlyside}\oarg{s}\marg{p} to set critical notes, and \protect\cs{onlysideX}\oarg{s}\marg{p} to set familiar notes.
924 % \meta{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.
925 %
926 % Notice that these options just tell you \LaTeX\ to not continue long notes on the other side.
927 % It is not designed to allow you to call footnotes on one side but print them on the other side.
928 % \subsubsection{Familiar notes called on the right side, but to be printed on the left side}\label{reledpar-nomk}
929 % \DescribeMacro{\footnoteXnomk}
930 % \DescribeMacro{\footnoteXmk}
931 % As often happens, the left side has less room for text.
932 % 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.
933 %
934 % To achieve this, we call \protect\cs{footnoteXnomk}\marg{notecontent} in the left side. \verb+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.
935 %
936 % In the right side, we call \protect\cs{footnoteXmk} at the place we want to have the footnote mark. X is to be replaced by the series letter.
937 % For example:
938 % \begin{verbatim}
939 % \begin{Leftside}
940 % \beginnumbering
941 % \pstart
942 % A little cat\footnoteAnomk{A note.}. And so one ...
943 % \pend
944 % \endnumbering
945 % \end{Leftside}
946 % \begin{Rightside}
947 % \beginnumbering
948 % \pstart
949 % Un petit chat\footnoteAmk. And so one ...
950 % \pend
951 % \endnumbering
952 % \end{Rightside}
953 % \end{verbatim}
954 % \subsection{Critical notes called on leftside but printed on right side}
955 % Sometimes, you need to print the critical notes on the right side, despite the fact that they refer to the lemmas on the left side.
956 % In this case, you must use \cs{edtextlater} and \cs{edtextnow}.
957 % \DescribeMacro{\edtextlater}
958 % The \cs{edtextlater}\marg{lemma}\marg{footnote command} command must be called on the same side as the lemma.
959 % It is similar to the standard \cs{edtext} command, but does not add the footnote immediately on the page, keeping it for later.
960 % \DescribeMacro{\edtextnow}
961 % \cs{edtextnow} must be called on the side on which you want to print the lemma, approximately at the point corresponding to the equivalent \cs{edtextlater} command.
962 % It will add the notes stored by the equivalent \cs{edtextlater} command.
963 %
964 % The relationship between the \cs{edtextlater} and \cs{edtextnow} commands is determined by the order of calling: the first \cs{edtextnow} corresponds to the first \cs{edtextlater}, the second \cs{edtextnow} corresponds to the second \cs{edtextlater} etc.
965 %
966 %
967 % \cs{edtextnow} is a parameterless macro, so it gobbles the following space.
968 % If you want to keep it, add \verb+{}+ or backslash followed by a space.
969 %
970 % \subsection{Using line flag}
971 % \DescribeMacro{\Xlineflag}
972 % \DescribeMacro{\Xendlineflag}
973 % Use \cs{Xlineflag}\oarg{s} to add right line flag (\reff{Rlineflag}) to right critical footnotes and \cs{Xendlineflag}\oarg{s} to add it to right critical endnotes.
974 % \section{Left and right texts}\label{leftright}
975 % \subsection{Environments}
976 % Parallel texts are divided into Leftside and Rightside. The form of the
977 % contents of these two are independent of whether they will be set
978 % in columns or pages.
979 %
980 % \DescribeEnv{Leftside}
981 % \DescribeEnv{Rightside}
982 % The left text is put within the \verb?Leftside? environment and the
983 % right text likewise in the \verb?Rightside? environment. The number of
984 % \verb?Leftside? and \verb?Rightside? environments must be the same.
985 % \subsection{Numbering text lines and paragraphs}
986 %
987 % \DescribeMacro{\beginnumbering}
988 % \DescribeMacro{\endnumbering}
989 % Each section of numbered text must be preceded by
990 % \protect\cs{beginnumbering} and followed by \protect\cs{endnumbering}, like: \\
991 % \protect\cs{beginnumbering} \\
992 % \meta{text} \\
993 % \protect\cs{endnumbering} \\
994 % These have to be separately specified within \verb?Leftside? and
995 % \verb?Rightside? environments.
996 %
997 % The \protect\cs{beginnumbering} macro resets the line number to zero,
998 % reads an auxiliary file called \meta{jobname}.\file{nn} (where
999 % \meta{jobname} is the name of the main input file for this job,
1000 % and \file{nn} is 1 for the first numbered section, 2 for
1001 % the second section, and so on), and then creates a new version of
1002 % this auxiliary file to collect information during this run.
1003 % Separate auxiliary files are maintained for right hand texts and
1004 % these are named \meta{jobname}.\file{nnR}, using the \enquote{R} to distinguish
1005 % them from the left hand and serial (non-parallel) texts.
1006 %
1007 % \DescribeMacro{\memorydump}
1008 % The command \protect\cs{memorydump} effectively performs an \protect\cs{endumbering}
1009 % immediately followed by a \protect\cs{beginnumbering} while not restarting the
1010 % numbering sequence. This has the effect of clearing \TeX's memory of previous
1011 % texts and any associated notes, allowing
1012 % longer apparent streams of parallel texts. The command should be applied
1013 % to both left and right texts, and after making sure that all previous
1014 % notes have been output. For example, along the lines of:
1015 % \begin{verbatim}
1016 % \begin{pages}
1017 % \begin{Leftside}
1018 % \beginnumbering
1019 % ...
1020 % \end{Leftside}
1021 % \begin{Rightside}
1022 % \beginnumbering
1023 % ...
1024 % \end{Rightside}
1025 % \end{pages}
1026 % \Pages
1027 % \begin{pages}
1028 % \begin{Leftside}
1029 % \memorydump
1030 % ...
1031 % \end{Leftside}
1032 % \begin{Rightside}
1033 % \memorydump
1034 % ...
1035 % \end{pages}
1036 % \end{verbatim}
1037 %
1038 %
1039 %\changes{v0.9.0}{2011/10/01}{Possibility to number \protect\cs{pstart}.}
1040 % It is possible to insert a number at every \protect\cs{pstart} command.
1041 % You must use the \DescribeMacro{\numberpstarttrue}\protect\cs{numberpstarttrue} command to have it.
1042 % You can stop the numbering with \DescribeMacro{\numberpstartfalse}\protect\cs{numberpstartfalse}.
1043 %
1044 % You can modify the number by changing the values of the \verb+pstartL+ and \verb+pstartR+ counters (for left and right side, respectively). For example:
1045 % \begin{verbatim}
1046 % \setcounter{pstartL}{0}% To reset the counter of pstart for the left side.
1047 % \end{verbatim}
1048 % You can redefine the commands \DescribeMacro{\thepstartL}\protect\cs{thepstartL} and \DescribeMacro{\thepstartR}\protect\cs{thepstartR} to change style.
1049 % The numbering restarts on each \protect\cs{beginnumbering}.
1050 %
1051 % \DescribeMacro{\skipnumbering}
1052 % The command \protect\cs{skipnumbering} when inserted in a line of parallel text
1053 % causes the numbering of that particular line to be skipped. This can
1054 % useful if you are putting some kind of marker (even if it is only a
1055 % blank line) between stanzas. Remember, parallel texts must be numbered
1056 % and this provides a way to slip in an \enquote{unnumbered} line.
1057 %
1058 % \changes{v1.21.0}{2015/04/13}{Add \protect\cs{hidenumbering}}
1059 % \DescribeMacro{\hidenumbering}
1060 % When inserted into a numbered line the macro \protect\cs{hidenumbering} causes
1061 % the number for that particular line to be hidden; namely, no line number will print.
1062 % Note that if you use it in \protect\cs{stanza}, you must call it at the beginning of the verse.
1063 % \subsection{First line number and line number increment}
1064 % \DescribeMacro{\firstlinenum}
1065 % \DescribeMacro{\linenumincrement}
1066 % \DescribeMacro{\firstsublinenum}
1067 % \DescribeMacro{\sublinenumincrement}
1068 % Following
1069 % \protect\cs{firstlinenum}\marg{num} the first line number will be \meta{num}, and
1070 % following \protect\cs{linenumincrement}\marg{num} only every \meta{num}th
1071 % line will have a printed number.
1072 %
1073 %
1074 % The lineation commands which finish by a \verb+R+ apply for right text.
1075 % The lineation commands which are starred apply for both left and right texts.
1076 % The lineation command which does not finish by a \verb+R+ and who are not starred apply for the left side.
1077 % \textbf{%
1078 % However, these commands apply to right side when they are called inside a \environment{left} environment.
1079 % However, such features should not be used any more. The recommended practice is to add all setting commands to the preamble.
1080 %}
1081 % \DescribeMacro{\firstlinenum*}
1082 % \DescribeMacro{\linenumincrement*}
1083 % \DescribeMacro{\firstsublinenum*}
1084 % \DescribeMacro{\sublinenumincrement*}
1085 % The starred versions change both left and right numbering schemes.
1086 %
1087 % \DescribeMacro{\firstlinenumR}
1088 % \DescribeMacro{\linenumincrementR}
1089 % \DescribeMacro{\firstsublinenumR}
1090 % \DescribeMacro{\sublinenumincrementR}
1091 % The suffixed version change the right side, without regard to the position they are called.
1092 % \subsection{Lineation system}
1093 % \DescribeMacro{\lineationR}
1094 % \protect\cs{lineationR} macro is the equivalent of \macpackage \protect\cs{lineation} macro for the right side.
1095 % \DescribeMacro{\lineation*}
1096
1097 % \protect\cs{lineation*} macro is the equivalent of \macpackage \protect\cs{lineation} macro for both sides.
1098 %
1099 % \Macpackage allows you to define a \cs{linenumberlist} to explicitly define (\reff{reledmac-linenumberlist}) in which line the line number will be printed.
1100 % In parallel typesetting, this command affects only left side.
1101 % For right side, you have to define \cs{linenumberlistR}.
1102 % \subsection{Line number style}
1103 % \DescribeMacro{\linenumberstyleR}
1104 % \DescribeMacro{\sublinenumberstyleR}
1105 % \DescribeMacro{\linenumberstyle*}
1106 % \DescribeMacro{\sublinenumberstyle*}
1107 % \cs{linenumberstyleR} is the equivalent of \macpackage \cs{linenumberstyle} for right text.
1108 % \cs{sublinenumberstyleR} is the equivalent of \macpackage \cs{sublinenumberstyle} right text.
1109 % The starred version are for both side.
1110 % \subsection{Line number margin}
1111 % \DescribeMacro{\linenummarginR}
1112 % \DescribeMacro{\linenummargin*}
1113 % \cs{linenummarginR}\marg{margin} sets the line margin for right side.
1114 % \cs{linenummargin*}\marg{margin} sets for both side.
1115 % \meta{margin} can be, as for \macpackage's \cs{linenummargin} one of these values: \verb+left+, \verb+right+, \verb+inner+, \verb+outer+.
1116 %
1117 % \DescribeMacro{\linenummarginColumns}
1118 % \DescribeMacro{\linenummarginColumnsR}
1119 % \DescribeMacro{\linenummarginColumns*}
1120 % Suppose you typeset texts both in parallel pages (or in normal typesetting) and in parallel columns.
1121 % In this case, your setting of line margin in parallel pages (or in normal typesetting) could be different from your setting of line margin in parallel columns.
1122 % For example, you could want to have line numbers on the right when your are in parallel pages (or in normal typesetting), but when you are in parallel columns, to have them on the left for the left column and on the right for the right column.
1123 %
1124 % In this case, you can use \cs{linenummarginColumns}, which overrides the default setting for the left column, \cs{linenummarginColumnsR} which overrides the default setting for the right column, and \cs{linenummarginColumns*}, which overrides the default for both left and right columns.
1125 %
1126 % \DescribeMacro{\linenumOnlyPagesForColumns}
1127 % \DescribeMacro{\linenumOnlyPagesForColumnsR}
1128 % Another usual case is when you have text in parallel columns and want to get line numbers only on the outer margin.
1129 % In this case, you need to get line numbers on the left side of the left column on left pages and on the right side of the right column on the right pages.
1130 %
1131 % Reciprocally, if you want line numbers only in the inner margin, you need to get line numbers on the right side of the right column on left pages and on the left side of the left column on the right pages.
1132 %
1133 % In both cases, you need, for one column, to have line numbers only on one page of a double page.
1134 %
1135 % You can use \cs{linenumOnlyPagesForColumns} and \cs{linenumOnlyPagesForColumnsR} to get this result:
1136 % \begin{verbatim}
1137 % \linenummargin{left}
1138 % \linenummarginR{right}
1139 % % To get only on the outer margin
1140 % \linenumOnlyPagesForColumns{left}
1141 % \linenumOnlyPagesForColumnsR{right}
1142 % % To get only on the inner margin
1143 % \linenumOnlyPagesForColumns{right}
1144 % \linenumOnlyPagesForColumnsR{left}
1145 % % To get on the inner or the outer margin
1146 % \linenumOnlyPagesForColumns{}
1147 % \linenumOnlyPagesForColumnsR{}
1148 % \end{verbatim}
1149 % Note that these settings only apply when we are typesetting columns (as, if we are not typesetting columns, the \enquote{inner} and \enquote{outer} setting of \cs{linenummargin} and \cs{linenummarginR} are enough).
1150 %
1151 % \DescribeMacro{\linenumberLevenifblanktrue}
1152 % \DescribeMacro{\linenumberRevenifblanktrue}
1153 % By default, when a blank line is printed on one side, no line number is printed for the sake of synchronizing with the other side.
1154 % However, line numbers can be printed for blank lines as well.
1155 % Use \cs{linenumberLevenifblanktrue} to enable this on the left side and \cs{linenumberRevenifblanktrue} for the right side.
1156 %
1157 % \subsection{Line flag}
1158 % \DescribeMacro{\setRlineflag}\label{Rlineflag}
1159 % A \enquote{R} is appended to the line numbers of the
1160 % right texts.
1161 % This may be useful for parallel columns but for parallel pages it might
1162 % be more appropriate to redefine it using \protect\cs{setRlineflag}\marg{flag}.
1163 % Use \verb?\setRlineflag{}? to empty it.
1164 %
1165 % \subsection{Chunks}
1166 % \DescribeMacro{\pstart}
1167 % \DescribeMacro{\pend}
1168 % In a serial (non-parallel) mode, each numbered paragraph, or chunk,
1169 % is contained
1170 % between the \protect\cs{pstart} and \protect\cs{pend} macros, and the paragraph is output
1171 % when the \protect\cs{pend} macro occurs. The situation is somewhat different
1172 % with parallel typesetting as the left text (contained within \protect\cs{pstart}
1173 % and \protect\cs{pend} groups within the \verb?Leftside? environment) has to be
1174 % set in parallel with the right text (contained within its own \protect\cs{pstart}
1175 % and \protect\cs{pend} groups within the corresponding \verb?Rightside? environment)
1176 % the \protect\cs{pend} macros cannot immediately initiate any typesetting ---
1177 % this has to be controlled by the \protect\cs{Columns} or \protect\cs{Pages} macros.
1178 % Several chunks may be specified within a \verb?Leftside? or
1179 % \verb?Rightside? environment.
1180 % A multi-chunk text then looks like:
1181 % \begin{verbatim}
1182 % \begin{...side}
1183 % % \beginnumbering
1184 % \pstart first chunk \pend
1185 % \pstart second chunk \pend
1186 % ...
1187 % \pstart last chunk \pend
1188 % % \endnumbering
1189 % \end{...side}
1190 % \end{verbatim}
1191 % Numbering, via \protect\cs{beginnumbering} and \protect\cs{endnumbering}, may extend
1192 % across several \verb?Leftside? or \verb?Rightside? environments.
1193 % Remember, though,
1194 % that the left/right sides are effectively independent of each other.
1195 %
1196 % \DescribeMacro{\autopar}
1197 % The \protect\cs{autopar} macro can be used, instead of manually inserting \protect\cs{pstart}\ldots\protect\cs{pends}. Please read \macpackage's handbook (\reff{reledmac-autopar}).
1198
1199
1200 % \subsection{\protect\cs{AtEveryPstart} and \protect\cs{AtEveryPstartCall}}
1201 % In general, remember that the moment where a \protect\cs{pstart} is called is different
1202 % from the moment when the \protect\cs{pstart}\ldots\protect\cs{pend} content is printed, which is when \protect\cs{Pages} or \protect\cs{Columns} is processed.
1203 %
1204 % Consequently:
1205 % \begin{itemize}
1206 % \item The argument of \protect\cs{AtEveryPstart} (see \reff{reledmac-AtEveryPstart}) is called before every chunk is printed, except if you used an optional argument for the \protect\cs{pstart}.
1207 % \item The argument of \protect\cs{AtEveryPstartCall} is called before every \protect\cs{pstart}.
1208 % \end{itemize}
1209 % \subsection{Language setting}
1210 % If you are using the
1211 % \protect\package{babel} package or the \protect\package{polyglossia} package ,with different languages
1212 % (via, say, \protect\cs{selectlanguage}) for the left and right texts it is
1213 % particularly important to select the appropriate language within the
1214 % \verb?Leftside? and \verb?Rightside? environments. The initial language
1215 % selected for the right text is the \protect\package{babel} package's default. Also,
1216 % it is the \emph{last} language setting in a side that controls the
1217 % language used in any notes for that side when they get printed. If
1218 % you are using multilingual notes then it is probably safest to explicitly
1219 % specify the language(s) for each note rather than relying on the language
1220 % selection for the side. The right side language is also
1221 % applied to the right side line numbers.
1222 %
1223 % \subsection{Executing code at each line}
1224 % \DescribeMacro{\dolineLhook}
1225 % \DescribeMacro{\dolineRhook}
1226 % \cs{dolineLhook} and \cs{dolineRhook} are the equivalent to the \macpackage \cs{dolinehook}, respectively for left and right side.
1227 %
1228 % \DescribeMacro{\doinsidelineLhook}
1229 % \DescribeMacro{\doinsidelineRhook}
1230 % \cs{doinsidelineLhook} and \cs{doinsidelineRhook} are the equivalent to the \macpackage \cs{doinsidelinehook}, for the left and the right sides respectively.
1231 %
1232 % About these two hooks, read \macpackage's handbook (\reff{reledmac-linehook}).
1233 %
1234 % \subsection{Executing code at each page}
1235 % \DescribeMacro{\Rightpagehook}
1236 % \DescribeMacro{\Leftpagehook}
1237 % When typesetting parallel pages, the \cs{Leftpagehook} and \cs{Rightpagehook} macros
1238 % are executed each time \Parpackage switches to Left / Right page.
1239 %
1240 % These macro are initially void. You can redefine them using \cs{renewcommand}.
1241 % \section{Verse}
1242 %
1243 % If you are typesetting verses with \macpackage you can use the \protect\cs{stanza}
1244 % construct, and you can also use this in right or left parallel texts.
1245 % In this case each verse line is a chunk which has two implications.
1246 % (1) you can unexpectedly exceed the \protect\cs{maxchunks} limit or the overall
1247 % limit on the number of boxes, and (2) left and right verse lines are
1248 % matched, which may not be desirable if one side requires more print lines
1249 % for verse lines than the other does.
1250 %
1251 % \DescribeEnv{astanza}
1252 % \Parpackage provides an \env{astanza} environment which you can use instead
1253 % of \cs{stanza}. A \env{astanza} environment is a chunk. Consequently left and right \emph{verse} are matched, and not, as with standard \cs{stanza}, left and right \emph{verse lines}.
1254 %
1255 % Within the
1256 % \env{astanza} environment each verse line is treated as an individual paragraph,
1257 % so there must be no blank lines in the environment otherwise there will
1258 % be some extraneous vertical spacing.
1259 % To use \env{astanza}, simply replace \cs{stanza} by \cs{begin}\arg{astanza} and
1260 % add \cs{end}\arg{astanza} after the ending \expandafter\cs\expandafter{\&}.
1261 %
1262 % The difference between \env{astanza} and \cs{stanza} is, that the latter syncs
1263 % verse by verse, while the environment syncs stanza by stanza.
1264 %
1265 % If you get an error message along the lines of \enquote{Missing number,
1266 % treated as zero \protect\cs{sza@0@}} it is because you have forgotten to use
1267 % \protect\cs{setstanzaindents} to set the stanza indents.
1268 %
1269 % As \env{astanza} is a specific type of \cs{pstart}\ldots\cs{pend} structure, you can:
1270 % \begin{itemize}
1271 % \item Add optional argument (in brackets) after \cs{begin}\arg{astanza}, as the optional argument of \cs{pstart}.
1272 % \item Use optional argument after the last \expandafter\cs\expandafter{\&} as optional argument of \cs{pend}.
1273 %
1274 % \end{itemize}
1275 %
1276 %
1277 % \DescribeMacro{\sethangingsymbol}Like in \macpackage, you could use the \protect\cs{sethangingsymbol} command to insert a character in each hanging line. If you use it, you must run \LaTeX\ two time. Example for the French typography
1278 %\begin{verbatim}
1279 %\sethangingsymbol{[\,}
1280 %\end{verbatim}
1281 % You can also use it to force hanging verse to be flush right:
1282 % \begin{verbatim}
1283 % \sethangingsymbol{\protect\hfill}
1284 % \end{verbatim}
1285 %
1286 %
1287 % When you use \protect\cs{lednopb} make sure to use it on both sides in the corresponding
1288 % verses to keep the pages in sync.
1289 %
1290 % \DescribeMacro{\thestanzaL}
1291 % \DescribeMacro{\thestanzaR}
1292 % When using \cs{stanzanumtrue} (\reff{reledmac-numbering-stanza}) in parallel typesetting, \verb+stanza+ counter is replaced by \verb+stanzaL+ counter in left side and by \verb+stanzaR+ counter in right side. Consequently, you can redefine \cs{thestanzaL} and \cs{thestanzaR} to change their aspect.
1293 %
1294 % \section{Side notes}
1295 % As in \macpackage, you must use one of the following commands to add side notes: \protect\cs{ledsidenote}, \protect\cs{ledleftnote}, \protect\cs{ledrightnote}, \protect\cs{ledouternote}, \protect\cs{ledinnernote}.
1296 %
1297 % The \protect\cs{sidenotemargin} defines the margin of the sidenote for either left or right side, depending on the current environment.
1298 %
1299 % The \cs{sidenotemarginR} defines the margin of the sidenote for the right side.
1300 %
1301 % You can use \protect\cs{sidenotemargin*} to define it for both sides.
1302 %
1303 % When typesetting parallel columns, the margin where a sidenote is placed is one of the margins of the column the sidenote is called.
1304 % However, you can load \parpackage with the \option{sidenotesmarginpage} to use the margin of the page, and not of the column.
1305 % \section{Parallel ledgroups}
1306 % \subsection{General}
1307 % \changes{v1.6.0}{2013/12/13}{Add tool and documentation for parallel ledgroups}
1308 % You can also make parallel ledgroups (see the documentation of \macpackage about ledgroups, \reff{reledmac-ledgroup}).
1309 % To do it you have:
1310 % \begin{itemize}
1311 % \item To load \parpackage package with the \verb+parledgroup+ option, or to add \protect\cs{parledgrouptrue}.
1312 % \item To push each ledgroup between \protect\cs{pstart}\ldots\protect\cs{pend} command.
1313 % \end{itemize}
1314 % See the following example:
1315 % \begin{verbatim}
1316 % \begin{pages}
1317 % \begin{Leftside}
1318 % \beginnumbering
1319 % \pstart
1320 % \begin{ledgroup}
1321 % ledgroup content
1322 % \end{ledgroup}
1323 % \pend
1324 % \pstart
1325 % \begin{ledgroup}
1326 % ledgroup content
1327 % \end{ledgroup}
1328 % \pend
1329 % \endnumbering
1330 % \end{Leftside}
1331 % \begin{Rightside}
1332 % \beginnumbering
1333 % \pstart
1334 % \begin{ledgroup}
1335 % ledgroup content
1336 % \end{ledgroup}
1337 % \pend
1338 % \pstart
1339 % \begin{ledgroup}
1340 % ledgroup content
1341 % \end{ledgroup}
1342 % \pend
1343 % \endnumbering
1344 % \end{Rightside}
1345 % \end{pages}
1346 % \Pages
1347 % \end{verbatim}
1348 % \subsection{Parallel ledgroups and \protect\package{setspace} package}
1349 % If you use the \protect\package{setspace} package and want your notes in parallel ledgroups to be single-spaced (not half-spaced or double-spaced), just add to your preamble:
1350 % \begin{verbatim}
1351 % \setparledgroupnotespacing{\singlespacing}
1352 % \end{verbatim}
1353 % \emph{In effect, to have correct spacing, do not change the font size of your notes}.
1354 %
1355 % \section{Sectioning commands}
1356 % \changes{v1.8.0}{2014/08/05}{New sectioning commands, as in eledmac.}
1357 % The standard sectioning commands of \macpackage are available, and provide parallel sectioning, for both two-column and two-page layout.
1358 %
1359 % \DescribeMacro{\eledsectnotoc}
1360 % By default, the section commands of the right side are not added to the table of contents.
1361 % But you can change it, using \protect\cs{eledsectnotoc}\marg{arg}, where \meta{arg} could be \verb+L+ (for left side) or \verb+R+ (for right side).
1362 %
1363 % \DescribeMacro{\eledsectmark}
1364 % By default, the headers are tokens from the left side. You can change them, using \cs{eledsectmark}\marg{arg}, where \meta{arg} could be \verb+L+ (for left side) or \verb+R+ (for right side).
1365 % \section{Notes about page number}\label{par@page}
1366 % If you use \verb+sameparallepagenumber+ option (\reff{sameparallelpagenumber} or \verb+prevpgnotnumbered+ option (\reff{prevpgnotnumbered}), please read the following paragraph if you want to manipulate page numbers manually.
1367 %
1368 % In order to implement these two options, \parpackage uses its own page counter, called \verb+par@page+.
1369 % Consequently, if you use at least one of these options:
1370 % \begin{enumerate}
1371 % \item If you modify \cs{thepage} command, use the value of \verb+par@page+ counter inside and not the value of \verb+page+ counter.
1372 % \item If you want to modify a page number, modify the value of \verb+page+ counter AND the value \verb+par@page+ counter.
1373 % \end{enumerate}
1374 % Notes that \parpackage automatically do it when you use \protect\cs{frontmatter} and \protect\cs{mainmatter} commands.
1375 %
1376 % \StopEventually{}
1377 % \clearpage
1378 % \renewcommand{\thesection}{\Roman{section}}
1379 % \renewcommand\theHsection{\Roman{section}}
1380 % \setcounter{section}{0}
1381 % \section{Implementation overview}\label{overview}
1382 %
1383 % \TeX\ is designed to process a single stream of text, which may include
1384 % footnotes, tables, and so on. It just keeps converting its input into
1385 % a stream typeset pages. It was not designed for typesetting two texts
1386 % in parallel, where it has to alternate from one to the other. Further,
1387 % \TeX essentially processes its input one paragraph at a time --- it is
1388 % very difficult to get at the \enquote{internals} of a paragraph such as the
1389 % individual lines in case you want to number them or put some mark at the
1390 % start or end of the lines.
1391 %
1392 % \Macpackage solves the problem of line numbering by putting the paragraph
1393 % in typeset form into a box, and then extracting the lines one by one
1394 % from the box for \TeX\ to put them onto the page with the appropriate page
1395 % breaks. Most of the \macpackage code is concerned with handling this box
1396 % and its contents.
1397 %
1398 % \Parpackage's solution to the problem of parallel texts is to put the two
1399 % texts into separate boxes, and then appropriately extract the pairs of
1400 % lines from the boxes. This involves duplicating
1401 % much of the original box code for an extra right text box. The other,
1402 % smaller,
1403 % part of the code is concerned with coordinating the line extractions from
1404 % the boxes.
1405 %
1406 %
1407 % \section{Preliminaries}
1408 % \label{preliminaries}\relax
1409 % \subsection{Package's meta-data}
1410 % Announce the name and version of the package, which is
1411 % targeted for \LaTeX 2e. The package also requires the \macpackage
1412 % package, however we do not load it automatically, because we prefer users to know it.
1413 %
1414 % \begin{macrocode}
1415 %<*code>
1416 \NeedsTeXFormat{LaTeX2e}
1417 \ProvidesPackage{reledpar}[2025/05/13 v2.25.10 reledmac extension for parallel texts]%
1418
1419 % \end{macrocode}
1420 % \subsection{Package's requirement}
1421 % Few commands use \protect\cs{xspace} command.
1422 % \begin{macrocode}
1423 \RequirePackage{xspace}%
1424 % \end{macrocode}
1425 % \subsection{Package's options}
1426 % We use \package{xkeyval} in order to manage options with arguments.
1427 %
1428 % \begin{macrocode}
1429 \RequirePackage{xkeyval}
1430 % \end{macrocode}
1431 % \subsection{Package's options}
1432 % \subsubsection{Synchronization's options}
1433 % \begin{macro}{\@par@this@sync@option}
1434 % The \cs{par@sync@option} stores the options of synchronization.
1435 % It use to ensure these options do not change between two run.
1436 % \begin{macrocode}
1437 \def\@par@this@sync@option{}%
1438 % \end{macrocode}
1439 % \end{macro}
1440 % With the \option{shiftedpstarts} option a long pstart on the left side (or on the right side) does not 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.
1441 % \begin{macro}{\ifshiftedpstarts}
1442 % \begin{macrocode}
1443 \newif\ifshiftedpstarts
1444 \DeclareOptionX{shiftedpstarts}{%
1445 \shiftedpstartstrue%
1446 \apptocmd{\@par@this@sync@option}{shifted}{}{}%
1447 }%
1448 % \end{macrocode}
1449 % \end{macro}
1450 % With the \option{advancedshiftedpstarts} option a long pstart on the left side (or on the right side) does not 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.
1451 % Differing to \option{shiftedpstarts}, the pstart shift are not counted to determine when cutting the page. That could help to avoid page with blank lines at the bottom.
1452 % \begin{macro}{\ifshiftedpstarts}
1453 % \begin{macrocode}
1454 \newif\ifadvancedshiftedpstarts
1455 \DeclareOptionX{advancedshiftedpstarts}{%
1456 \advancedshiftedpstartstrue%
1457 \shiftedpstartstrue%
1458 \apptocmd{\@par@this@sync@option}{advancedshifted}{}{}%
1459 }%
1460 % \end{macrocode}
1461 % \end{macro}
1462 % With the option \option{nomaxlines}, \parpackage allows facing pages to have not the same number of lines.
1463 % \begin{macro}{\ifnomaxlines}
1464 % \begin{macrocode}
1465 \newif\ifnomaxlines%
1466 \DeclareOptionX{nomaxlines}{%
1467 \nomaxlinestrue%
1468 \apptocmd{\@par@this@sync@option}{nomax}{}{}%
1469 }%
1470 % \end{macrocode}
1471 % \end{macro}
1472 % With the option \option{nosyncpstarts}, \parpackage only alternate between left and right side, and does not try to obtain the same number of line in corresponding page.
1473 % \begin{macro}{\ifnosyncpstarts}
1474 % \begin{macrocode}
1475 \newif\ifnosyncpstarts%
1476 \DeclareOptionX{nosyncpstarts}{%
1477 \shiftedpstartstrue%
1478 \nomaxlinestrue%
1479 \nosyncpstartstrue%
1480 \apptocmd{\@par@this@sync@option}{nosync}{}{}%
1481 }%
1482 % \end{macrocode}
1483 % \end{macro}
1484 % \subsubsection{Position options}
1485 % \begin{macro}{\ifmovecolumnspositiononrightpage}
1486 % The \cs{ifmovecolumnspositiononrightpage} boolean is set to true if, for a right page, we want the left column become a right column and the right column become a left column.
1487 % \begin{macrocode}
1488 \newif\ifmovecolumnspositiononrightpage%
1489 \DeclareOptionX{movecolumnspositiononrightpage}{%
1490 \movecolumnspositiononrightpagetrue%
1491 }%
1492 % \end{macrocode}
1493 % \end{macro}
1494 % \begin{macro}{if@sidenotesmarginpage}
1495 % With the \option{sidenotesmarginpage}, a left sidenote called in a right column will be printed at the left of the page, and a right sidenote called in a left column will be printed at the right of the page.
1496 % \begin{macrocode}
1497 \newif\if@sidenotesmarginpage%
1498 \DeclareOptionX{sidenotesmarginpage}{%
1499 \@sidenotesmarginpagetrue%
1500 }%
1501 % \end{macrocode}
1502 % \end{macro}
1503 % \subsubsection{Other options}
1504 % The \verb+parledgroup+ can be called either on \macpackage or \parpackage.
1505 % \begin{macrocode}
1506 \DeclareOptionX{parledgroup}{\parledgrouptrue}
1507 % \end{macrocode}
1508 % \begin{macro}{\ifwidthliketwocolumns}
1509 % The \verb|widthliketwocolumns| and \verb+continuousnumberingwithcolumns+ options can be called either on \macpackage or \parpackage.
1510 % \changes{v1.9.0}{2014/09/16}{Added widthliketwocolumns option}
1511 % \begin{macrocode}
1512 \DeclareOptionX{widthliketwocolumns}{\widthliketwocolumnstrue}%
1513 \DeclareOptionX{continuousnumberingwithcolumns}{\continuousnumberingwithcolumnstrue}%
1514 % \end{macrocode}
1515 % \end{macro}
1516 % Options related to page numbering.
1517 % The booleans are defined in \macpackage.
1518 % \begin{macrocode}
1519 \DeclareOptionX{sameparallelpagenumber}{\sameparallelpagenumbertrue}
1520 \DeclareOptionX{prevpgnotnumbered}{\prevpgnotnumberedtrue}
1521 % \end{macrocode}
1522 % \begin{macro}{\prevpgstyle}
1523 % We store on \protect\cs{prevpgstyle} the argument of the option \verb+prevpgstyle+.
1524 % \begin{macrocode}
1525 \DeclareOptionX{prevpgstyle}{\gdef\prevpgstyle{#1}}%
1526 % \end{macrocode}
1527 % \end{macro}
1528 % \begin{macrocode}
1529 \ProcessOptionsX%
1530 % \end{macrocode}
1531 % \subsection{Determining side and category of parallel processing}
1532 % As noted above, much of the code is a duplication of the original
1533 % \macpackage{} code to handle the extra box(es) for the right hand side text,
1534 % and sometimes for the left hand side as well. In order to distinguish
1535 % we use \enquote{R} or \enquote{L} in the names of macros for the right and left code.
1536 % The specifics of \enquote{L} and \enquote{R} are normally hidden from the user by
1537 % letting the \verb?Leftside? and \verb?Rightside? environments set things
1538 % up appropriately.
1539 %
1540 % \begin{macro}{\ifl@dpairing}
1541 % \begin{macro}{\ifl@dpaging}
1542 % \begin{macro}{\ifledRcol}
1543 % \protect\cs{ifl@dpairing} is set TRUE if we are processing parallel texts and
1544 % \protect\cs{ifl@dpaging} is also set TRUE if we are doing parallel pages.
1545 % \protect\cs{ifledRcol} is set TRUE if we are doing the right hand text.
1546 % They are defined in \macpackage.
1547 % \changes{v0.3.0}{2005/02/24}{Moved \protect\cs{ifl@dpairing} to eledmac}
1548 % \changes{v0.9.0}{2005/10/01}{Moved \protect\cs{iflledRcol} and \protect\cs{ifnumberingR} to eledmac}
1549 % \changes{v1.9.1}{2014/09/30}{Moved \protect\cs{ifl@dpaging} to eledmac}
1550 % \changes{v1.13.0}{2015/03/06}{Remove false boolean settings which are not needed.}
1551 % \end{macro}
1552 % \end{macro}
1553 % \end{macro}
1554 % \subsection{Text's width}
1555 % \begin{macro}{\Lcolwidth}
1556 % \begin{macro}{\Rcolwidth}
1557 % The widths of the left and right parallel columns (or pages).
1558 % The suffixed versions are not manipulated directly by user, but we use them to be certain to have the same coldwitdh in the \env{pages} environment and in the \cs{Pages} command.
1559 % \begin{macrocode}
1560 \newdimen\Lcolwidth
1561 \Lcolwidth=0.45\textwidth
1562 \newdimen\Rcolwidth
1563 \Rcolwidth=0.45\textwidth
1564 \newdimen\Lcolwidth@pages
1565 \newdimen\Rcolwidth@pages
1566 % \end{macrocode}
1567 % \end{macro}
1568 % \end{macro}
1569 %
1570 % \subsection{Messages}
1571 %
1572 % All the error and warning messages are collected here as macros.
1573 %
1574 % \begin{macro}{\reledpar@error}
1575 % \changes{v1.8.2}{2014/08/15}{Errors specific to eledpar send to eledpar handbook}
1576 % \begin{macrocode}
1577 \newcommand{\reledpar@error}[2]{\PackageError{reledpar}{#1}{#2}}
1578 % \end{macrocode}
1579 % \end{macro}
1580 % \begin{macro}{\reledpar@warning}
1581 % \begin{macrocode}
1582 \newcommand{\reledpar@warning}[1]{\PackageWarning{reledpar}{#1}}%
1583 % \end{macrocode}
1584 % \end{macro}
1585 % \begin{macro}{\led@err@TooManyPstarts}
1586 % \begin{macrocode}
1587 \newcommand*{\led@err@TooManyPstarts}{%
1588 \reledpar@error{Too many \string\pstart\space without printing.
1589 Some text will be lost}{\@ehc}}
1590 % \end{macrocode}
1591 % \end{macro}
1592 %
1593 % \begin{macro}{\led@err@polyglossiaTooOld}
1594 % \begin{macrocode}
1595 \newcommand{\led@err@polyglossiaTooOld}{%
1596 \reledpar@error{You use the polyglosia package.%
1597 \MessageBreak However, reledpar requires version 2022/04/10 v1.55 or later of the polyglossia package.%
1598 \MessageBreak Please update your polyglossia version}{\@ehc}%
1599 }%
1600 % \end{macrocode}
1601 % \end{macro}
1602 % \begin{macro}{\led@err@BadLeftRightPstarts}
1603 % \begin{macrocode}
1604 \newcommand*{\led@err@BadLeftRightPstarts}[2]{%
1605 \reledpar@error{The numbers of left (#1) and right (#2)
1606 \string\pstart s do not match}{\@ehc}}
1607 % \end{macrocode}
1608 % \end{macro}
1609 %
1610 % \begin{macro}{\led@err@LeftOnRightPage}
1611 % \begin{macro}{\led@err@RightOnLeftPage}
1612 % \begin{macrocode}
1613 \providebool{syntax@}
1614 \newcommand*{\led@err@LeftOnRightPage}{%
1615 \notbool{syntax@}%
1616 {\reledpar@error{The left page has ended on a right page}{\@ehc}}%
1617 {}%
1618 }
1619 \newcommand*{\led@err@RightOnLeftPage}{%
1620 \notbool{syntax@}%
1621 {\reledpar@error{The right page has ended on a left page}{\@ehc}}
1622 {}%
1623 }%
1624 % \end{macrocode}
1625 % \end{macro}
1626 % \end{macro}
1627 %
1628 % \begin{macro}{\led@err@Leftside@PreviousNotPrinted}
1629 % \begin{macro}{\led@err@Rightside@PreviousNotPrinted}
1630 % \begin{macrocode}
1631 \newcommand*{\led@err@Leftside@PreviousNotPrinted}{%
1632 \reledpar@error{You call a new Leftside environment while the previous one has not been typeset by \string\Pages\space or \string\Columns}{\@ehc}}
1633 \newcommand*{\led@err@Rightside@PreviousNotPrinted}{%
1634 \reledpar@error{You call a new Rightside environment while the previous one has not been typeset by \string\Pages\space or \string\Columns}{\@ehc}}
1635 % \end{macrocode}
1636 % \end{macro}
1637 % \end{macro}
1638 % \begin{macro}{\led@err@Pages@InsideEnv}
1639 % \begin{macro}{\led@err@Columns@InsideEnv}
1640 % \begin{macrocode}
1641 \newcommand*{\led@err@Pages@InsideEnv}{%
1642 \reledpar@error{\string\Pages\space must be called *outside* of the `pages` environment}{\@ehc}}
1643 \newcommand*{\led@err@Columns@InsideEnv}{%
1644 \reledpar@error{\string\Columns\space must be called *outside* of the `pairs` environment}{\@ehc}}
1645 % \end{macrocode}
1646 % \end{macro}
1647 % \end{macro}
1648 % \begin{macro}{\led@err@Pages@WithoutEnv}
1649 % \begin{macro}{\led@err@Columns@WithoutEnv}
1650 % \begin{macrocode}
1651 \newcommand*{\led@err@Pages@WithoutEnv}{%
1652 \reledpar@error{\string\Pages\space called without previous `pages` environment}{\@ehc}}
1653 \newcommand*{\led@err@Columns@WithoutEnv}{%
1654 \reledpar@error{\string\Columns\space called without previous `pairs` environment}{\@ehc}}
1655 % \end{macrocode}
1656 % \end{macro}
1657 % \end{macro}
1658 % \begin{macro}{\led@err@Pages@WithoutRightside}
1659 % \begin{macro}{\led@err@Pages@WithoutLeftside}
1660 % \begin{macro}{\led@err@Columns@WithoutRightside}
1661 % \begin{macro}{\led@err@Columns@WithoutLeftside}
1662 % \begin{macrocode}
1663 \newcommand*{\led@err@Pages@WithoutRightside}{%
1664 \reledpar@error{\string\Pages\space called without any preceding `Rightside` environment (or environment without content)}{\@ehc}}%
1665 \newcommand*{\led@err@Pages@WithoutLeftside}{%
1666 \reledpar@error{\string\Pages\space called without any preceding `Leftside` environment (or environment without content)}{\@ehc}}%
1667 \newcommand*{\led@err@Columns@WithoutRightside}{%
1668 \reledpar@error{\string\Columns\space called without any preceding `Rightside` environment (or environment without content)}{\@ehc}}%
1669 \newcommand*{\led@err@Columns@WithoutLeftside}{%
1670 \reledpar@error{\string\Columns\space called without any preceding `Leftside` environment (or environment without content)}{\@ehc}}%
1671 % \end{macrocode}
1672 % \end{macro}
1673 % \end{macro}
1674 % \end{macro}
1675 % \end{macro}
1676 %
1677 % \begin{macro}{\led@error@fail@patch@thepage}
1678 % \begin{macrocode}
1679 \newcommand{\led@error@fail@patch@thepage}{%
1680 \reledpar@error{Fail to patch \string\@thepage\space command.}{\@ehc}%
1681 }%
1682 % \end{macrocode}
1683 % \end{macro}
1684 % \begin{macro}{\led@error@fail@patch@pagenumbering}
1685 % \begin{macrocode}
1686 \newcommand{\led@error@fail@patch@pagenumbering}{%
1687 \reledpar@error{Fail to patch \string\pagenumbering\space command.}{\@ehc}%
1688 }%
1689 % \end{macrocode}
1690 % \end{macro}
1691 % \begin{macro}{\led@error@note@called@onrightside}
1692 % \begin{macro}{\led@error@note@called@onleftside}
1693 % \begin{macrocode}
1694 \newcommand{\led@error@note@called@onrightside}[1]{%
1695 \reledpar@error{#1 called on right side, despite your configuring it to be for the left side only}{\@ehc}%
1696 }%
1697 \newcommand{\led@error@note@called@onleftside}[1]{%
1698 \reledpar@error{#1 called on left side, despite your configuring it to be for the right side only}{\@ehc}%
1699 }%
1700 % \end{macrocode}
1701 % \end{macro}
1702 % \end{macro}
1703 % \begin{macro}{\led@error@fail@patch@@mempnum}
1704 % \begin{macrocode}
1705 \newcommand{\led@error@fail@patch@@mempnum}{%
1706 \reledpar@error{Fail to patch \string\@mempnum\space command.}{\@ehc}%
1707 }%
1708 % \end{macrocode}
1709 % \end{macro}
1710 % \begin{macro}{\led@error@fail@patch@@outputpage}
1711 % \begin{macrocode}
1712 \newcommand{\led@error@fail@patch@@outputpage}{%
1713 \reledpar@error{Fail to patch \string\@outputpage\space command.}{\@ehc}%
1714 }%
1715 % \end{macrocode}
1716 % \end{macro}
1717 % \begin{macro}{\led@error@edtext@later@now}
1718 % \begin{macrocode}
1719 \newcommand{\led@error@edtext@later@now}{%
1720 \reledpar@error{You call \the\edtext@later\space \string\edtextlater\space commands, but \the\edtext@now\space \string\edtextnow\space commands}{\@ehc}% (did I follow your intent correctly here?)
1721 }%
1722 % \end{macrocode}
1723 % \end{macro}
1724 % \begin{macro}{\led@warn@ChangeSyncOption}
1725 % \begin{macrocode}
1726 \newcommand*{\led@warn@ChangeSyncOption}[1]{%
1727 \reledpar@warning{You have changed synchronization's options since the last run. We have not read line-list file #1. Please run LaTeX again.}%
1728 }%
1729 % \end{macrocode}
1730 % \end{macro}
1731 % \begin{macro}{\led@warn@setting@in@rightside}
1732 % \begin{macrocode}
1733 \newcommand{\led@warn@setting@in@rightside}[1]{%
1734 \reledpar@warning{You use #1 inside rightside environment.\MessageBreak%
1735 Such behavior is deprecated.\MessageBreak%
1736 Use instead #1R or #1* in your preamble.}%
1737 }
1738 % \end{macrocode}
1739 % \end{macro}
1740 % \begin{macro}{\led@error@missing@numbering}
1741 % \begin{macrocode}
1742 \newcommand{\led@error@missing@numbering}[1]{%
1743 \reledpar@error{Missing \string\pstart\space ...\space\string\pend\space inside `#1` environment}{\@ehc}%
1744 }%
1745 % \end{macrocode}
1746 % \end{macro}
1747 % \subsection{Naming macros}
1748 %
1749 % The \LaTeX\ kernel provides \protect\cs{@namedef} and \protect\cs{@namuse} for defining
1750 % and using macros that may have non-letters in their names. We need
1751 % something similar here as we are going to need and use some numbered
1752 % boxes and counters.
1753 %
1754 % \begin{macro}{\newnamebox}
1755 % \begin{macro}{\setnamebox}
1756 % \begin{macro}{\unhnamebox}
1757 % \begin{macro}{\unvnamebox}
1758 % \begin{macro}{\namebox}
1759 % A set of macros for creating and using \enquote{named} boxes; the macros are called
1760 % after the regular box macros, but including the string \enquote{name}.
1761 % \begin{macrocode}
1762 \providecommand*{\newnamebox}[1]{%
1763 \expandafter\newbox\csname #1\endcsname}
1764 \providecommand*{\setnamebox}[1]{%
1765 \expandafter\setbox\csname #1\endcsname}
1766 \providecommand*{\unhnamebox}[1]{%
1767 \expandafter\unhbox\csname #1\endcsname}
1768 \providecommand*{\unvnamebox}[1]{%
1769 \expandafter\unvbox\csname #1\endcsname}
1770 \providecommand*{\namebox}[1]{%
1771 \csname #1\endcsname}
1772
1773 % \end{macrocode}
1774 % \end{macro}
1775 % \end{macro}
1776 % \end{macro}
1777 % \end{macro}
1778 % \end{macro}
1779 % \begin{macro}{\ifcsboxvoid}
1780 % The \cs{ifcsboxvoid} command comes on top of the \package{etoolbox} package.
1781 % The first argument is a box name, the second is the \meta{true} value, the third the \meta{false} value.
1782 % If the first argument refers to a non-existing box, or if it refers to a box that is void, the \meta{true} value is returned. otherwise, \meta{false} is returned.
1783 % \begin{macrocode}
1784 \newcommand*{\ifcsboxvoid}[1]{%
1785 \ifcsname#1\endcsname%
1786 \expandafter\ifvoid\csname #1\endcsname%
1787 \expandafter\expandafter%
1788 \expandafter\@firstoftwo%
1789 \else%
1790 \expandafter\expandafter%
1791 \expandafter\@secondoftwo%
1792 \fi%
1793 \else%
1794 \expandafter\@firstoftwo%
1795 \fi%
1796 }%
1797 % \end{macrocode}
1798 % \end{macro}
1799 %
1800 % \begin{macro}{\newnamecount}
1801 % \begin{macro}{\usenamecount}
1802 % Macros for creating and using \enquote{named} counts.
1803 % \begin{macrocode}
1804 \providecommand*{\newnamecount}[1]{%
1805 \expandafter\newcount\csname #1\endcsname}
1806 \providecommand*{\usenamecount}[1]{%
1807 \csname #1\endcsname}
1808
1809 % \end{macrocode}
1810 % \end{macro}
1811 % \end{macro}
1812 %
1813 % \section{Sectioning commands}
1814 %
1815 % \begin{macro}{\section@numR}
1816 % This is the right side equivalent of \protect\cs{section@num}.
1817 %
1818 % Each section will read and write an associated \enquote{line-list
1819 % file}, containing information used to do the numbering. Normally
1820 % the file will be called \meta{jobname}\file{.nn}, where \file{nn} is the
1821 % section number. However, for right side texts the file is called
1822 % \meta{jobname}\file{.nnR}. The \protect\cs{extensionchars} applies to the
1823 % right side files just as it does to the normal files.
1824 % \begin{macrocode}
1825 \newcount\section@numR
1826 \section@numR=\z@
1827 % \end{macrocode}
1828 % \end{macro}
1829 %
1830 %
1831 % \begin{macro}{\ifpst@rtedL}
1832 % \begin{macro}{\ifpst@rtedR}
1833 % \protect\cs{ifpst@rtedL} is set FALSE at the start of left side numbering, and
1834 % similarly for \protect\cs{ifpst@rtedR}.
1835 % \protect\cs{ifpst@rtedL} is defined in \macpackage.
1836 % \changes{v0.3.0}{2005/02/24}{Moved \protect\cs{ifpst@rtedL} to eledmac}
1837 % \begin{macrocode}
1838 \pst@rtedLfalse
1839 \newif\ifpst@rtedR
1840
1841 % \end{macrocode}
1842 % \end{macro}
1843 % \end{macro}
1844 %
1845 % \changes{v1.8.0}{2014/07/24}{\protect\cs{beginnumbering} is defined only on \protect\package{eledmac}, not on \protect\package{eledpar}.}
1846 %
1847 % \begin{macro}{\beginnumberingR}
1848 % This is the right text equivalent of \protect\cs{beginnumbering}, and begins
1849 % a section of numbered text.
1850 % \begin{macrocode}
1851 \newcommand*{\beginnumberingR}{%
1852 \ifnumberingR
1853 \led@err@NumberingStarted
1854 \endnumberingR
1855 \fi
1856 \global\l@dnumpstartsR \z@
1857 \global\pst@rtedRfalse
1858 \global\numberingRtrue
1859 \global\afterendnumberingRfalse%
1860 \global\advance\section@numR \@ne
1861 \global\absline@numR \z@
1862 \gdef\normal@page@breakR{}
1863 \gdef\l@prev@pbR{}
1864 \gdef\l@prev@nopbR{}
1865 \global\line@numR \z@
1866 \global\@lockR \z@
1867 \global\sub@lockR \z@
1868 \global\sublines@Rfalse
1869 \global\let\next@page@numR\relax
1870 \global\let\this@section@next@page@numR\relax%
1871 \global\let\sub@change\relax
1872 \global\last@page@numR=-10000%
1873 \global\stopmsdata@inserted@true%
1874 \global\let\@msdata@list\relax%
1875 \global\csundef{@msdata@\add@msd@cR @dataR}%
1876 \ifcontinuousnumberingwithcolumns%
1877 \ifnumbering%
1878 \global\resumenumberingR@starttrue%
1879 \fi%
1880 \ifnumberpstart%
1881 \addtocounter{pstartR}{1}%
1882 \fi%
1883 \else%
1884 \setcounter{pstartR}{1}%
1885 \fi%
1886 \message{Section \the\section@numR R }%
1887 \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
1888 \l@dend@stuff
1889 \begingroup
1890 \initnumbering@sectcountR
1891 \gdef\eled@sectionsR@@{}%
1892 \if@noeled@sec\else%
1893 \makeatletter%
1894 \InputIfFileExists%
1895 {\l@auxdir\jobname.eledsec\the\section@numR R}%
1896 {}%
1897 {\led@warn@NoFile{\l@auxdir\jobname.eledsec\the\section@numR R}}%
1898 \makeatother%
1899 \immediate\openout\eled@sectioningR@out=\l@auxdir\jobname.eledsec\the\section@numR R\relax%
1900 \fi%
1901 }
1902 % \end{macrocode}
1903 % \end{macro}
1904 %
1905 % \begin{macro}{\endnumbering}
1906 % This is the left text version of the regular \protect\cs{endnumbering} and must
1907 % follow the last text for a left text numbered section.
1908 % It sets \protect\cs{ifpst@rtedL} to FALSE. It is fully defined in \macpackage.
1909 % \end{macro}
1910 %
1911 % \begin{macro}{\endnumberingR}
1912 % This is the right text equivalent of \protect\cs{endnumbering} and must follow the
1913 % last text for a right text numbered section.
1914 % \begin{macrocode}
1915 \def\endnumberingR{%
1916 \ifnumberingR
1917 \global\numberingRfalse
1918 \global\afterendnumberingRtrue%
1919 \normal@pars
1920 \ifnum\l@dnumpstartsR=0%
1921 \led@err@NumberingWithoutPstart%
1922 \fi%
1923 \global\page@numR=\this@section@page@numR%
1924 \global\last@page@numR=\this@section@last@page@numR%
1925 \global\let\next@page@numR\this@section@next@page@numR%
1926 \ifl@dpairing
1927 \global\pst@rtedRfalse
1928 \else
1929 \ifx\insertlines@listR\empty\else
1930 \global\noteschanged@true
1931 \fi
1932 \ifx\line@listR\empty\else
1933 \global\noteschanged@true
1934 \fi
1935 \fi
1936 \ifnoteschanged@
1937 \led@mess@NotesChanged
1938 \fi
1939 \else
1940 \led@err@NumberingNotStarted
1941 \fi
1942 \endgroup
1943 \if@noeled@sec\else%
1944 \immediate\closeout\eled@sectioningR@out%
1945 \fi%
1946 }
1947
1948 % \end{macrocode}
1949 % \end{macro}
1950 % \begin{macro}{\initnumbering@sectcountR}
1951 % \begin{macro}{\save@section@number}
1952 % \begin{macro}{\set@sectcountR}
1953 % \changes{v1.2.1}{2012/11/01}{For the right section, the counter is defined only once.}
1954 % We do not want the right side section commands to be numbered after the left side ones,
1955 % instead we want them numbered after which is typeset before the \env{pages} or \env{columns} environments.
1956 % we switch the \LaTeX\ counter in \protect\cs{numberingR}.
1957 %
1958 % \begin{macrocode}
1959 \newcounter{chapterR}
1960 \newcounter{sectionR}
1961 \newcounter{subsectionR}
1962 \newcounter{subsubsectionR}
1963
1964 \newcount\old@chapter%
1965 \newcount\old@section%
1966 \newcount\old@subsection%
1967 \newcount\old@subsubsection%
1968 \newcommand{\save@section@number}{%
1969 \ifdefined\c@chapter%
1970 \global\old@chapter\value{chapter}%
1971 \fi%
1972 \global\old@section\value{section}%
1973 \global\old@subsection\value{subsection}%
1974 \global\old@subsubsection\value{subsubsection}%
1975 }%
1976 \newcommand{\initnumbering@sectcountR}{
1977 \ifdefined\c@chapter%
1978 \setcounter{chapterR}{\old@chapter}%
1979 \fi%
1980 \setcounter{sectionR}{\old@section}%
1981 \setcounter{subsectionR}{\old@subsection}%
1982 \setcounter{subsubsectionR}{\old@subsubsection}%
1983 \set@sectcountR%
1984 }
1985 \newcommand{\set@sectcountR}{%
1986 \let\c@chapter\c@chapterR%
1987 \let\c@section\c@sectionR%
1988 \let\c@subsection\c@subsectionR%
1989 \let\c@subsubsection\c@subsubsectionR%
1990 }%
1991 % \end{macrocode}
1992 % \end{macro}
1993 % \end{macro}
1994 % \end{macro}
1995 %
1996 % \begin{macro}{\pausenumberingR}
1997 % \begin{macro}{\resumenumberingR}
1998 % \begin{macro}{\ifresumenumberingR@start}
1999 % \begin{macro}{\pausenumbering@page@numR}
2000 % These are the right text equivalents of \protect\cs{pausenumbering} and
2001 % \protect\cs{resumenumbering}.
2002 % \changes{v1.8.3}{2014/08/31}{Debug \protect\cs{resumenumberingR}}
2003 % \begin{macrocode}
2004 \newcount\pausenumbering@page@numR%
2005 \newcommand*{\pausenumberingR}{%
2006 \ifx\this@section@next@page@numR\relax%
2007 \global\pausenumbering@page@numR=0%
2008 \else%
2009 \global\pausenumbering@page@numR=\this@section@next@page@numR%
2010 \fi%
2011 \endnumberingR%
2012 \global\numberingRtrue%
2013 \global\afterendnumberingRfalse%
2014 }%
2015 \newif\ifresumenumberingR@start%
2016 \newcommand*{\resumenumberingR}{%
2017 \ifnumberingR
2018 \global\pst@rtedRtrue
2019 \global\advance\section@numR \@ne
2020 \global\resumenumberingR@starttrue%
2021 \led@mess@SectionContinued{\the\section@numR R}%
2022 \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
2023 \l@dend@stuff
2024 \begingroup%
2025 \initnumbering@sectcountR%
2026 \else
2027 \led@err@NumberingShouldHaveStarted
2028 \endnumberingR
2029 \beginnumberingR
2030 \fi}
2031
2032 % \end{macrocode}
2033 % \end{macro}
2034 % \end{macro}
2035 % \end{macro}
2036 % \end{macro}
2037 %
2038 % \begin{macro}{\memorydumpL}
2039 % \begin{macro}{\memorydumpR}
2040 % \protect\cs{memorydump} is a shorthand for \protect\cs{pausenumbering}\protect\cs{resumenumbering}.
2041 % This will clear the memorised stuff for the previous chunks while
2042 % keeping the numbering going.
2043 % \begin{macrocode}
2044 \newcommand*{\memorydumpL}{%
2045 \endnumbering
2046 \numberingtrue
2047 \global\pst@rtedLtrue
2048 \global\advance\section@num \@ne
2049 \led@mess@SectionContinued{\the\section@num}%
2050 \line@list@stuff{\jobname.\extensionchars\the\section@num}%
2051 \l@dend@stuff}
2052
2053 \newcommand*{\memorydumpR}{%
2054 \endnumberingR
2055 \numberingRtrue
2056 \global\pst@rtedRtrue
2057 \global\advance\section@numR \@ne
2058 \led@mess@SectionContinued{\the\section@numR R}%
2059 \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
2060 \l@dend@stuff}
2061
2062 % \end{macrocode}
2063 % \end{macro}
2064 % \end{macro}
2065 %
2066 %
2067 %
2068 % \section{Line counting}
2069 % \label{lineation}
2070 %
2071
2072 % \subsection{Setting lineation reset}
2073 % \changes{v0.11.0}{2012/06/11}{Lineation can be by pstart (like in eledmac 0.15).}
2074 % \changes{v1.0.0}{2012/09/14}{Debug in lineation by pstart}
2075 % Sometimes you want line numbers that start at $1$ at the top of each
2076 % page; sometimes you want line numbers that start at $1$ at each \protect\cs{pstart}; other times you want line numbers that start at $1$ at the start
2077 % of each section and increase regardless of page breaks.
2078 % \Parpackage lets you choose different schemes for the left and right texts.
2079 % \changes{v2.0.0}{2015/07/19}{\protect\cs{ifbypage@} and \protect\cs{ifbypstart@R} defined in \eledmac.}
2080
2081 %
2082 % \begin{macro}{\lineationR}
2083 % \protect\cs{lineationR}\marg{word} is the macro used to select the
2084 % lineation system for right texts.
2085 % Its argument is a string: either \verb+page+, \verb+pstart+ or \verb+section+.
2086 % \changes{v1.15.0}{2015/04/13}{As \protect\cs{lineation}, \protect\cs{lineationR} automatically set the \protect\cs{pstartinfootnote}.}
2087 % \begin{macrocode}
2088 \newcommand*{\lineationR}[1]{{%
2089 \ifnumbering
2090 \led@err@LineationInNumbered
2091 \else
2092 \def\@tempa{#1}\def\@tempb{page}%
2093 \ifx\@tempa\@tempb
2094 \global\bypage@Rtrue
2095 \global\bypstart@Rfalse
2096 \unless\ifnocritical@%
2097 \Xpstart[][false]%
2098 \fi%
2099 \else
2100 \def\@tempb{pstart}%
2101 \ifx\@tempa\@tempb
2102 \global\bypage@Rfalse
2103 \global\bypstart@Rtrue
2104 \unless\ifnocritical@%
2105 \Xpstart%
2106 \fi%
2107 \else
2108 \def\@tempb{section}
2109 \ifx\@tempa\@tempb
2110 \global\bypage@Rfalse%
2111 \global\bypstart@Rfalse%
2112 \unless\ifnocritical@%
2113 \Xpstart[][false]%
2114 \fi%
2115 \else
2116 \led@warn@BadLineation
2117 \fi%
2118 \fi
2119 \fi
2120 \fi}}
2121 % \end{macrocode}
2122 % \end{macro}
2123 %
2124 % \begin{macro}{\lineation*}
2125 % \changes{v1.8.2}{2014/08/15}{Add \protect\cs{lineation*}}
2126 % \protect\cs{lineation*} change the lineation system for both sides.
2127 % \begin{macrocode}
2128 \WithSuffix\newcommand\lineation*[1]{%
2129 \lineation{#1}%
2130 \lineationR{#1}%
2131 }%
2132 % \end{macrocode}
2133 % \end{macro}
2134
2135 % \subsection{Setting line number margin}
2136 % \begin{macro}{\linenummargin}
2137 % \begin{macro}{\line@marginR}
2138 % You call \protect\cs{linenummargin}\marg{word} to specify which margin you want your
2139 % right text's line numbers in; it takes one argument, a string.
2140 % You can put the line numbers in the same margin on every page using
2141 % \verb+left+ or \verb+right+; or you can use \verb+inner+ or
2142 % \verb+outer+ to get them in the inner or outer margins.
2143 % You can change this within a numbered section, but the
2144 % change may not take effect just when you would like; if it is done between
2145 % paragraphs nothing surprising should happen.
2146 %
2147 % For right texts the selection is recorded in the count \protect\cs{line@marginR},
2148 % otherwise in the count \protect\cs{line@margin}:
2149 % $0$ for left, $1$ for right, $2$ for outer, and $3$ for inner.
2150 %
2151 % It is defined only once time, in \reledmac.
2152 %
2153 % \changes{v0.3.1}{2005/03/30}{Do not just set \protect\cs{line@marginR} in \protect\cs{linenummargin}}
2154 % \changes{v2.0.0}{2015/07/19}{\protect\cs{linenummargin} now defined only once time in \reledmac.}
2155 % \begin{macrocode}
2156 \newcount\line@marginR
2157 % \end{macrocode}
2158 % By default put right text numbers at the right.
2159 % \begin{macrocode}
2160 \line@marginR=\@ne
2161
2162 % \end{macrocode}
2163 % \end{macro}
2164 % \end{macro}
2165 % \begin{macro}{\linenummarginR}
2166 % \begin{macro}{\linenummargin*}
2167 % \cs{linenummarginR} applies directly for right side, while \cs{linenummargin*} applies for both side.
2168 % \begin{macrocode}
2169 \newcommand{\linenummarginR}[1]{%
2170 \l@dgetline@margin{#1}%
2171 \ifnum\@l@dtempcntb>\m@ne%
2172 \global\line@marginR=\@l@dtempcntb%
2173 \fi%
2174 }
2175 \WithSuffix\newcommand\linenummargin*[1]{%
2176 \l@dgetline@margin{#1}%
2177 \ifnum\@l@dtempcntb>\m@ne%
2178 \global\line@marginR=\@l@dtempcntb%
2179 \global\line@margin=\@l@dtempcntb%
2180 \fi%
2181 }
2182 \ifmovecolumnspositiononrightpage%
2183 \linenummargin{inner}%
2184 \linenummarginR{outer}%
2185 \fi%
2186 % \end{macrocode}
2187 % \end{macro}
2188 % \end{macro}
2189 % \begin{macro}{\linenummarginColumns*}
2190 % \begin{macro}{\linenummarginColumns}
2191 % \begin{macro}{\linenummarginColumnsR}
2192 % The \cs{linenummarginColumns} macro overrides the definition of the line margin when typesetting in parallel columns.
2193 % \begin{macrocode}
2194
2195 \newcount\line@margin@columnsR%
2196 \line@margin@columnsR=\m@ne%
2197
2198 \newcommand{\linenummarginColumns}[1]{%
2199 \l@dgetline@margin{#1}%
2200 \ifnum\@l@dtempcntb>\m@ne%
2201 \global\line@margin@columns=\@l@dtempcntb%
2202 \fi%
2203 }%
2204
2205 \WithSuffix\newcommand\linenummarginColumns*[1]{%
2206 \l@dgetline@margin{#1}%
2207 \ifnum\@l@dtempcntb>\m@ne%
2208 \global\line@margin@columns=\@l@dtempcntb%
2209 \global\line@margin@columnsR=\@l@dtempcntb%
2210 \fi%
2211 }%
2212
2213 \newcommand{\linenummarginColumnsR}[1]{%
2214 \l@dgetline@margin{#1}%
2215 \ifnum\@l@dtempcntb>\m@ne%
2216 \global\line@margin@columnsR=\@l@dtempcntb%
2217 \fi%
2218 }%
2219
2220 % \end{macrocode}
2221 % \end{macro}
2222 % \end{macro}
2223 % \end{macro}
2224 % \begin{macro}{\linenumOnlyPagesForColumns}
2225 % \begin{macro}{\linenumOnlyPagesForColumnsR}
2226 % \cs{linenumOnlyPagesForColumns} and \cs{linenumOnlyPagesForColumnsR} make the line numbers be printed only on left/right page for the left/right column.
2227 % \begin{macrocode}
2228 \def\linenum@OnlyPages@ForColumns{}%
2229 \newcommand{\linenumOnlyPagesForColumns}[1]{%
2230 \gdef\linenum@OnlyPages@ForColumns{#1}%
2231 }%
2232
2233 \def\linenum@OnlyPages@ForColumnsR{}%
2234 \newcommand{\linenumOnlyPagesForColumnsR}[1]{%
2235 \gdef\linenum@OnlyPages@ForColumnsR{#1}%
2236 }%
2237 % \end{macrocode}
2238 % \end{macro}
2239 % \end{macro}
2240 % \subsection{Setting lineation start and step}
2241 % \begin{macro}{\c@firstlinenumR}
2242 % \begin{macro}{\c@linenumincrementR}
2243 % The following counters tell \macpackage which right text lines should be
2244 % printed with line numbers. \verb+firstlinenumR+ is the number of the
2245 % first line in each section that gets a number;
2246 % \verb+linenumincrementR+
2247 % is the difference between successive numbered lines. The initial
2248 % values of these counters produce labels on lines $5$, $10$, $15$, etc.
2249 % \verb+linenumincrementR+ must be at least $1$.
2250 %
2251 % \begin{macrocode}
2252 \newcounter{firstlinenumR}
2253 \setcounter{firstlinenumR}{5}
2254 \newcounter{linenumincrementR}
2255 \setcounter{linenumincrementR}{5}
2256 % \end{macrocode}
2257 % \end{macro}
2258 % \end{macro}
2259 %
2260 % \begin{macro}{\c@firstsublinenumR}
2261 % \begin{macro}{\c@sublinenumincrementR}
2262 % The following parameters are just like \verb+firstlinenumR+ and
2263 % \verb+linenumincrementR+, but for sub-line numbers.
2264 % \verb+sublinenumincrementR+ must be at least $1$.
2265 %
2266 % \begin{macrocode}
2267 \newcounter{firstsublinenumR}
2268 \setcounter{firstsublinenumR}{5}
2269 \newcounter{sublinenumincrementR}
2270 \setcounter{sublinenumincrementR}{5}
2271
2272 % \end{macrocode}
2273 % \end{macro}
2274 % \end{macro}
2275 %
2276 % \begin{macro}{\firstlinenum}
2277 % \begin{macro}{\linenumincrement}
2278 % \begin{macro}{\firstsublinenum}
2279 % \begin{macro}{\sublinenumincrement}
2280 % \begin{macro}{\firstlinenum*}
2281 % \begin{macro}{\linenumincrement*}
2282 % \begin{macro}{\firstsublinenum*}
2283 % \begin{macro}{\sublinenumincrement*}
2284 % \changes{v1.5.0}{2013/11/08}{Add starred version of \protect\cs{firstlinenum}, \protect\cs{linenumincrement}, \protect\cs{firstsublinenum}, \protect\cs{sublinenumincrement} to change both Left and Rightside.}
2285 % These are the user's macros for changing (sub) line numbers. They are
2286 % defined in \macpackage.
2287 % The starred versions are specific to \protect\package{eledpar}.
2288 % \changes{v2.0.0}{2015/07/19}{\protect\cs{firstlinenum}, \protect\cs{linenumincrement}, \protect\cs{firstsublinenum}, \protect\cs{sublinenumincrement} are now defined only in \macpackage.}
2289 % \begin{macrocode}
2290 \WithSuffix\newcommand\firstlinenum*[1]{%
2291 \setcounter{firstlinenumR}{#1}%
2292 \setcounter{firstlinenum}{#1}%
2293 }
2294 \WithSuffix\newcommand\linenumincrement*[1]{%
2295 \setcounter{linenumincrementR}{#1}%
2296 \setcounter{linenumincrement}{#1}%
2297 }
2298 \WithSuffix\newcommand\firstsublinenum*[1]{%
2299 \setcounter{firstsublinenumR}{#1}%
2300 \setcounter{firstsublinenum}{#1}%
2301 }
2302 \WithSuffix\newcommand\sublinenumincrement*[1]{%
2303 \setcounter{sublinenumincrementR}{#1}%
2304 \setcounter{sublinenumincrement}{#1}%
2305 }
2306 % \end{macrocode}
2307 % \end{macro}
2308 % \end{macro}
2309 % \end{macro}
2310 % \end{macro}
2311 % \end{macro}
2312 % \end{macro}
2313 % \end{macro}
2314 % \end{macro}
2315 %
2316 % \begin{macro}{\firstlinenumR}
2317 % \begin{macro}{\linenumincrementR}
2318 % \begin{macro}{\firstsublinenumR}
2319 % \begin{macro}{\sublinenumincrementR}
2320 % And the \enquote{R} suffixed version.
2321 % \begin{macrocode}
2322 \newcommand\firstlinenumR[1]{%
2323 \setcounter{firstlinenumR}{#1}%
2324 }
2325 \newcommand\linenumincrementR[1]{%
2326 \setcounter{linenumincrementR}{#1}%
2327 }
2328 \newcommand\firstsublinenumR[1]{%
2329 \setcounter{subfirstlinenumR}{#1}%
2330 }
2331 \newcommand\sublinenumincrementR[1]{%
2332 \setcounter{sublinenumincrementR}{#1}%
2333 }
2334 % \end{macrocode}
2335 % \end{macro}
2336 % \end{macro}
2337 % \end{macro}
2338 % \end{macro}
2339 % \subsection{Setting line flag}
2340 % \begin{macro}{\Rlineflag}
2341 % This is appended to the line numbers of right text.
2342 % \begin{macrocode}
2343 \newcommand{\setRlineflag}[1]{%
2344 \gdef\@Rlineflag{#1}%
2345 }
2346 \setRlineflag{R}
2347 % \end{macrocode}
2348 % \end{macro}
2349 % \subsection{Setting line number style}
2350 % \begin{macro}{\linenumrepR}
2351 % \begin{macro}{\sublinenumrepR}
2352 % \protect\cs{linenumrepR}\marg{ctr} typesets the right line number \meta{ctr}, and
2353 % similarly \protect\cs{sublinenumrepR} for subline numbers.
2354 % \changes{v0.3.0}{2005/02/10}{Added \protect\cs{linenumrepR} and \protect\cs{sublinenumrepR}}
2355 % \begin{macrocode}
2356 \newcommand*{\linenumrepR}[1]{\@arabic{#1}}
2357 \newcommand*{\sublinenumrepR}[1]{\@arabic{#1}}
2358
2359 % \end{macrocode}
2360 % \end{macro}
2361 % \end{macro}
2362 % \begin{macro}{\linenumberstyleR}
2363 % \begin{macro}{\sublinenumberstyleR}
2364 % The style can be changed by some user level command
2365 % \begin{macrocode}
2366 \newcommand*{\linenumberstyleR}[1]{%
2367 \def\linenumrepR##1{\@nameuse{@#1}{##1}}}
2368 \newcommand*{\sublinenumberstyleR}[1]{%
2369 \def\sublinenumrepR##1{\@nameuse{@#1}{##1}}}
2370 % \end{macrocode}
2371 % \end{macro}
2372 % \end{macro}
2373 % \begin{macro}{\linenumberstyle*}
2374 % \begin{macro}{\sublinenumberstyle*}
2375 % And for both side.
2376 % \begin{macrocode}
2377 \WithSuffix\newcommand\linenumberstyle*[1]{%
2378 \linenumberstyle{#1}%
2379 \linenumberstyleR{#1}%
2380 }%
2381
2382 \WithSuffix\newcommand\sublinenumberstyle*[1]{%
2383 \sublinenumberstyle{#1}%
2384 \sublinenumberstyleR{#1}%
2385 }%
2386 %
2387 % \end{macrocode}
2388 % \end{macro}
2389 % \end{macro}
2390 % \subsection{Print marginal line number}
2391 % \begin{macro}{\iflinenumberLevenifblank}
2392 % \begin{macro}{\iflinenumberRevenifblank}
2393 % \cs{iflinenumberLevenifblank} and \cs{iflinenumberRevenifblank} can be switched to TRUE if we want to print the line number, even if the line is blank.
2394 % \begin{macrocode}
2395 \newif\iflinenumberLevenifblank
2396 \newif\iflinenumberRevenifblank
2397 % \end{macrocode}
2398 % \end{macro}
2399 % \end{macro}
2400 % \begin{macro}{\leftlinenumR}
2401 % \begin{macro}{\rightlinenumR}
2402 % \begin{macro}{\l@dlinenumR}
2403 % \protect\cs{leftlinenumR} and \protect\cs{rightlinenumR} are the macros that are
2404 % called to print the right text's marginal line numbers.
2405 % Much of the
2406 % code for these is common and is maintained in \protect\cs{l@dlinenumR}.
2407 % \changes{v0.3.0}{2005/02/10}{Simplified \protect\cs{leftlinenumR} and
2408 % \protect\cs{rightlinenumR} by introducing \protect\cs{l@dlinenumR}}
2409 % \begin{macrocode}
2410 \newcommand*{\leftlinenumR}{%
2411 \l@dlinenumR%
2412 \kern\linenumsep%
2413 }%
2414 \newcommand*{\rightlinenumR}{%
2415 \kern\linenumsep%
2416 \l@dlinenumR%
2417 }%
2418
2419
2420 \newcommand*{\l@dlinenumR}{%
2421 \numlabfont%
2422 \unless\iflinenumannotationotherside%
2423 \ifdefstring{\Xlinenumannotationposition@side}{before}{%
2424 \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{%
2425 \csuse{annotR@\the\absline@numR @\the\section@numR}%
2426 }%
2427 }{}%
2428 \fi%
2429 \linenumrepR{\line@numR}\@Rlineflag%
2430 \ifsublines@R
2431 \ifnum\subline@numR>\z@
2432 \unskip\fullstop\sublinenumrepR{\subline@numR}%
2433 \fi
2434 \fi%
2435 \unless\iflinenumannotationotherside%
2436 \ifdefstring{\Xlinenumannotationposition@side}{after}{%
2437 \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{%
2438 \csuse{annotR@\the\absline@numR @\the\section@numR}%
2439 }%
2440 }{}%
2441 \fi%
2442 }%
2443
2444 % \end{macrocode}
2445 % \end{macro}
2446 % \end{macro}
2447 % \end{macro}
2448 % \begin{macro}{\leftlinenumannotationR}
2449 % \begin{macro}{\rightlinenumannotationR}
2450 % \cs{rightlinenumannotationR} and \cs{leftlinenumannotationR} are the same as not suffixed version, but for right side.
2451 % \begin{macrocode}
2452 \newcommand*{\leftlinenumannotationR}{%
2453 \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{%
2454 \csuse{annot@\the\absline@numR @\the\section@numR}%
2455 }%
2456 \kern\linenumsep%
2457 }%
2458 \newcommand*{\rightlinenumannotationR}{%
2459 \kern\linenumsep%
2460 \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{%
2461 \csuse{annot@\the\absline@numR @\the\section@numR}%
2462 }%
2463 }%
2464 % \end{macrocode}
2465 % \end{macro}
2466 % \end{macro}
2467 % \subsection{Line-number counters and lists}
2468 % \subsubsection{Correspond to those in \macpackage for regular or left text}
2469 % We need another set of counters and lists for the right text,
2470 % corresponding to those in \parpackage for regular or left text.
2471 %
2472 % \begin{macro}{\line@numR}
2473 % \begin{macro}{\subline@numR}
2474 % \begin{macro}{\absline@numR}
2475 % The count \protect\cs{line@numR} stores the line number that is used in
2476 % the right text's marginal line numbering and in notes.
2477 % The count \protect\cs{subline@numR} stores
2478 % a sub-line number that qualifies \protect\cs{line@numR}.
2479 % The count \protect\cs{absline@numR} stores the
2480 % absolute number of lines since the start
2481 % of the right text section: that is, the number we have actually printed,
2482 % no matter what numbers we attached to them.
2483 %
2484 % \begin{macrocode}
2485 \newcount\line@numR
2486 \newcount\subline@numR
2487 \newcount\absline@numR
2488
2489 % \end{macrocode}
2490 % \end{macro}
2491 % \end{macro}
2492 % \end{macro}
2493 %
2494 % \begin{macro}{\line@listR}
2495 % \begin{macro}{\insertlines@listR}
2496 % \begin{macro}{\actionlines@listR}
2497 % \begin{macro}{\actions@listR}
2498 % \begin{macro}{\annot@listR}
2499 % Now we can define the list macros that will be created from the
2500 % line-list file. They are directly analogous to the left text ones.
2501 % The full list of action codes and their meanings is given in the \macpackage
2502 % manual.
2503 %
2504 % Here are the commands to create these lists:
2505 %
2506 % \begin{macrocode}
2507 \list@create{\line@listR}
2508 \list@create{\insertlines@listR}
2509 \list@create{\actionlines@listR}
2510 \list@create{\actions@listR}
2511 \list@create{\annot@listR}%
2512 % \end{macrocode}
2513 % \end{macro}
2514 % \end{macro}
2515 % \end{macro}
2516 % \end{macro}
2517 % \end{macro}
2518 %
2519 % \begin{macro}{\page@numR}
2520 % \begin{macro}{\this@section@page@numR}
2521 % The right text page numbers.
2522 % \begin{macrocode}
2523 \newcount\page@numR
2524 \newcount\this@section@page@numR%
2525 % \end{macrocode}
2526 % \end{macro}
2527 % \end{macro}
2528 % \subsubsection{Specific to \parpackage}
2529 % \begin{macro}{\linesinpar@listL}
2530 % \begin{macro}{\linesinpar@listR}
2531 % \begin{macro}{\maxlinesinpar@list}
2532 % In order to synchronise left and right chunks in parallel processing
2533 % we need to know how many lines are in each left and right text chunk,
2534 % and the maximum of these for each pair of chunks.
2535 % \begin{macrocode}
2536 \list@create{\linesinpar@listL}
2537 \list@create{\linesinpar@listR}
2538 \list@create{\maxlinesinpar@list}
2539
2540 % \end{macrocode}
2541 % \end{macro}
2542 % \end{macro}
2543 % \end{macro}
2544 %
2545 %
2546 %
2547 % \subsection{Reading the line-list file}
2548 %
2549 %
2550 % \begin{macro}{\list@clearing@regR}
2551 % \protect\cs{Clear the right lines for \protect\cs{read@linelist}}
2552 % \begin{macrocode}
2553 \newcommand{\list@clearing@regR}{%
2554 \list@clear{\line@listR}%
2555 \list@clear{\insertlines@listR}%
2556 \list@clear{\actionlines@listR}%
2557 \list@clear{\actions@listR}%
2558 \list@clear{\linesinpar@listR}%
2559 \list@clear{\linesonpage@listR}
2560 }
2561 % \end{macrocode}
2562 % \end{macro}
2563 % \begin{macro}{\@par@sync@option}
2564 % When typesetting parallel pages, \cs{@par@sync@option} check if we have changed the synchronization's option since the last run.
2565 % If true, we just not read the numbered file.
2566 % \begin{macrocode}
2567 \newcommand{\@par@sync@option}[1]{%
2568 \IfStrEq{#1}{\@par@this@sync@option}%
2569 {}%
2570 {\ifledRcol%
2571 \led@warn@ChangeSyncOption{\jobname.\extensionchars\the\section@num}%
2572 \else%
2573 \led@warn@ChangeSyncOption{\jobname.\extensionchars\the\section@num}%
2574 \fi%
2575 \endinput%
2576 }%
2577 }%
2578 % \end{macrocode}
2579 % \end{macro}
2580 % \begin{macro}{\read@linelist}
2581 % \protect\cs{read@linelist}\marg{file} is the control sequence
2582 % that is called by \protect\cs{beginnumbering}
2583 % (via \protect\cs{line@list@stuff}) to open and process a
2584 % line-list file; its argument is the name of the file.
2585 % \label{readlinelist}.
2586 % It is defined only once time in \reledmac.
2587 % \changes{v2.0.0}{2015/07/19}{\protect\cs{read@linelist} is defined only once time in \protect\cs{reledmac}.}
2588 %
2589 % \end{macro}
2590 % \subsection{Commands within the line-list file}
2591 %
2592 % This section defines the commands that can appear within a
2593 % line-list file, except for \protect\cs{@lab} which is in a
2594 % later section among the cross-referencing commands it is
2595 % associated with.
2596 %
2597 % The macros with \verb"action" in their names contain all the code
2598 % that modifies the action-code list.
2599 % \changes{v2.0.0}{2015/07/19}{\protect\cs{@nl} is now defined only in \reledmac.}
2600 % \begin{macro}{\@nl@regR}
2601 % \begin{macro}{\@nl}
2602 % \protect\cs{@nl@regR} is called by \protect\cs{@nl} if we are on a right side.
2603 % It does everything related to the start of a
2604 % new line of numbered text on a right side.
2605 %
2606 % \begin{macrocode}
2607 \newcommand{\@nl@regR}{%
2608 \ifx\l@dchset@num\relax \else
2609 \advance\absline@numR \@ne
2610 \csgdef{l@dchset@num@R\the\absline@numR}{}%To remember this line have been marked by a \setlinenum
2611 \set@line@action
2612 \let\l@dchset@num\relax
2613 \advance\absline@numR \m@ne
2614 \advance\line@numR \m@ne% % do we need this?
2615 \fi
2616 \reset@current@annot%
2617 \advance\absline@numR \@ne
2618 \ifx\next@page@numR\relax \else
2619 \page@action
2620 \let\next@page@numR\relax
2621 \fi
2622 \ifx\sub@change\relax \else
2623 \ifnum\sub@change>\z@
2624 \sublines@Rtrue
2625 \else
2626 \sublines@Rfalse
2627 \fi
2628 \sub@action
2629 \let\sub@change\relax
2630 \fi
2631 \ifcase\@lockR
2632 \or
2633 \@lockR \tw@
2634 \or\or
2635 \@lockR \z@
2636 \fi
2637 \ifcase\sub@lockR
2638 \or
2639 \sub@lockR \tw@
2640 \or\or
2641 \sub@lockR \z@
2642 \fi
2643 \ifsublines@R
2644 \ifnum\sub@lockR<\tw@
2645 \advance\subline@numR \@ne
2646 \fi
2647 \else
2648 \ifnum\@lockR<\tw@
2649 \advance\line@numR \@ne \subline@numR \z@
2650 \fi
2651 \fi}
2652
2653
2654 % \end{macrocode}
2655 % \end{macro}
2656 % \end{macro}
2657 % \begin{macro}{\last@page@numR}
2658 % \begin{macro}{\this@section@last@page@numR}
2659 % \begin{macro}{\fix@page}
2660 % \protect\cs{last@page@numR} holds the page number of the last right page.
2661 % \protect\cs{this@section@last@page@numR} holds the page number of the last right page of the current section. Its value is modified globally, contrary to \cs{last@page@numR}.
2662 % Both are modified by \protect\cs{fix@page}, defined by \reledmac.
2663 %
2664 % \changes{v2.0.0}{2105/06/28}{\protect\cs{fix@page} is defined only once in \reledmac}
2665 %
2666 % \begin{macrocode}
2667 \newcount\last@page@numR
2668 \last@page@numR=-10000
2669 \newcount\this@section@last@page@numR%
2670 \this@section@last@page@numR=-10000%
2671
2672 % \end{macrocode}
2673 % \end{macro}
2674 % \end{macro}
2675 % \end{macro}
2676 %
2677 %
2678 % \begin{macro}{\@adv}
2679 % The \protect\cs{@adv}\marg{num} macro advances
2680 % the current visible line number by the amount specified as
2681 % its argument. This is used to implement \protect\cs{advanceline}.
2682 % It is defined in \macpackage.
2683 % \changes{v2.0.0}{2015/07/19}{\protect\cs{@adv} defined only in \reledmac.}
2684 % \end{macro}
2685 %
2686 % \begin{macro}{\@set}
2687 % The \protect\cs{@set}\marg{num} macro sets
2688 % the current visible line number to the value specified as
2689 % its argument. This is used to implement \protect\cs{setline}.
2690 % It is defined in \macpackage.
2691 %
2692 % \changes{v2.0.0}{2015/07/19}{\protect\cs{@set} defined only in \reledmac.}
2693 % \end{macro}
2694 %
2695 % \begin{macro}{\l@d@set}
2696 % The \protect\cs{l@d@set}\marg{num} macro sets
2697 % the line number for the next \cs{pstart}\ldots\ to the value specified as
2698 % its argument. This is used to implement \protect\cs{setlinenum}.
2699 % It is defined in \macpackage.
2700 % \changes{v2.0.0}{2015/07/19}{\protect\cs{l@d@set} defined only in \reledmac.}
2701
2702 % \end{macro}
2703 %
2704 % \begin{macro}{\page@action}
2705 % \protect\cs{page@action}
2706 % adds an entry to the action-code list to change the page number.
2707 % It is defined in \macpackage.
2708
2709 % \changes{v2.0.0}{2015/07/19}{\protect\cs{page@action} defined only in \reledmac.}
2710 % \end{macro}
2711 %
2712 % \begin{macro}{\set@line@action}
2713 % \protect\cs{set@line@action} adds an entry to the action-code
2714 % list to change the visible line number.
2715 % It is defined in \macpackage.
2716 % \changes{v2.0.0}{2015/07/19}{\protect\cs{set@line@action} defined only in \reledmac.}
2717 % \end{macro}
2718 %
2719 % \begin{macro}{\sub@action}
2720 % \protect\cs{sub@action}
2721 % adds an entry to the action-code list to turn sub-lineation on or
2722 % off, according to the current value of the \protect\cs{ifsublines@} flag.
2723 % It is defined in \macpackage.
2724 %
2725 % \changes{v2.0.0}{2015/07/19}{\protect\cs{sub@action} defined only in \reledmac.}
2726 % \end{macro}
2727 %
2728 % \begin{macro}{\do@lockon}
2729 % \begin{macro}{\do@lockonR}
2730 % \protect\cs{lock@on}
2731 % adds an entry to the action-code list to turn line number
2732 % locking on. The current setting of the sub-lineation flag tells us
2733 % whether this applies to line numbers or sub-line numbers.
2734 % It is defined in \macpackage, however the code specific to right side is defined here, in \protect\cs{do@lockonR}.
2735
2736 % \changes{v2.0.0}{2015/07/19}{\protect\cs{do@lockon} defined only in \reledmac.}
2737 % \begin{macrocode}
2738 \newcount\@lockR
2739 \newcount\sub@lockR
2740
2741 \newcommand*{\do@lockonR}{%
2742 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
2743 \ifsublines@R
2744 \xright@appenditem{-1005}\to\actions@listR
2745 \ifnum\sub@lockR=\z@
2746 \sub@lockR \@ne
2747 \else
2748 \ifnum\sub@lockR=\thr@@
2749 \sub@lockR \@ne
2750 \fi
2751 \fi
2752 \else
2753 \xright@appenditem{-1003}\to\actions@listR
2754 \ifnum\@lockR=\z@
2755 \@lockR \@ne
2756 \else
2757 \ifnum\@lockR=\thr@@
2758 \@lockR \@ne
2759 \fi
2760 \fi
2761 \fi}
2762
2763 % \end{macrocode}
2764 % \end{macro}
2765 % \end{macro}
2766 %
2767 % \begin{macro}{\lock@off}
2768 % \begin{macro}{\do@lockoff}
2769 % \begin{macro}{\do@lockoffR}
2770 % \begin{macro}{\skip@lockoff}
2771 % \protect\cs{lock@off} adds an entry to the action-code list
2772 % to turn line number locking off.
2773 % It is defined in \macpackage, however the code specific to right side is defined here, in \protect\cs{do@lockoffR}.
2774 % \changes{v2.0.0}{2015/07/19}{\protect\cs{do@lockoff} defined only in \reledmac.}
2775 % \begin{macrocode}
2776
2777
2778 \newcommand{\do@lockoffR}{%
2779 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
2780 \ifsublines@R
2781 \xright@appenditem{-1006}\to\actions@listR
2782 \ifnum\sub@lockR=\tw@
2783 \sub@lockR \thr@@
2784 \else
2785 \sub@lockR \z@
2786 \fi
2787 \else
2788 \xright@appenditem{-1004}\to\actions@listR
2789 \ifnum\@lockR=\tw@
2790 \@lockR \thr@@
2791 \else
2792 \@lockR \z@
2793 \fi
2794 \fi}
2795
2796
2797 % \end{macrocode}
2798 % \end{macro}
2799 % \end{macro}
2800 % \end{macro}
2801 % \end{macro}
2802 %
2803 % \begin{macro}{\n@num}
2804 % \changes{v1.15.0}{2015/04/13}{\protect\cs{n@num} defined only one time for both \Eledmac{} and \Eledpar{}.}
2805 % \end{macro}
2806 %
2807 % \begin{macro}{\@ref}
2808 % \begin{macro}{\@ref@regR}
2809 % \changes{v2.0.0}{2015/07/19}{\protect\cs{@ref} defined only in \reledmac, code specific to right side moved in \protect\cs{ref@regR}.}
2810 % \begin{macro}{\insert@countR}
2811 % \protect\cs{@ref}
2812 % marks the start of a passage, for creation of a footnote reference.
2813 % It takes two arguments:
2814 % \begin{itemize}
2815 % \item \verb"#1", the number of entries to add to \protect\cs{insertlines@list}
2816 % for this reference.
2817 % This value for right text, here and within \protect\cs{edtext},
2818 % which computes it and writes it to the line-list file,
2819 % will be stored in the count \protect\cs{insert@countR}.
2820 % \begin{macrocode}
2821 \newcount\insert@countR
2822 % \end{macrocode}
2823 %
2824 % \item \verb"#2", a sequence of other line-list-file commands, executed to
2825 % determine the ending line-number. This may also include other
2826 % \protect\cs{@ref} commands, corresponding to uses of \protect\cs{edtext}
2827 % within the first argument of another instance of \protect\cs{edtext}.
2828 % \end{itemize}
2829 %
2830 % \protect\cs{@ref} itself is defined in \macpackage.
2831 % It calls \protect\cs{ref@reg} or \protect\cs{ref@regR}, depending weither we are in left or right side.
2832 % Here, we define only \protect\cs{ref@regR}, \protect\cs{ref@reg} is already defined in \macpackage.
2833 %
2834 % The first thing \protect\cs{@ref@regR} itself does is to add the specified number
2835 % of items to the \protect\cs{insertlines@listR} list.
2836 % \begin{macrocode}
2837 \newcommand*{\@ref@regR}[2]{%
2838 \global\advance\@edtext@level by 1%
2839 \global\insert@countR=#1\relax
2840 \loop\ifnum\insert@countR>\z@
2841 \xright@appenditem{\the\absline@numR}\to\insertlines@listR
2842 \global\advance\insert@countR \m@ne
2843 \repeat
2844 % \end{macrocode}
2845 %
2846 % Next, process the second argument to determine the page
2847 % and line numbers for the end of this lemma.
2848 % We temporarily equate \protect\cs{@ref} to a different macro that just executes
2849 % its argument, so that nested \protect\cs{@ref} commands are just skipped
2850 % this time. Some other macros need to be temporarily redefined to
2851 % suppress their action.
2852 % \begin{macrocode}
2853 \begingroup
2854 \let\@ref=\dummy@ref
2855 \let\@lopR\@gobble
2856 \let\page@action=\relax
2857 \let\sub@action=\relax
2858 \let\set@line@action=\relax
2859 \let\@lab=\relax
2860 \let\@lemma=\relax
2861 \let\@sw\@gobblethree%
2862 \let\store@annot@to@absline\@gobble%
2863 #2
2864 \global\endpage@num=\page@numR
2865 \global\endline@num=\line@numR
2866 \global\endsubline@num=\subline@numR
2867 \global\let\endcurrent@annot=\current@annot%
2868 \endgroup
2869 % \end{macrocode}
2870 %
2871 % Now store all the information about the location of the lemma's
2872 % start and end in \protect\cs{line@list@R}.
2873 % \begin{macrocode}
2874 \xright@appenditem%
2875 {\the\page@numR|\the\line@numR|%
2876 \ifsublines@R \the\subline@numR \else 0\fi|%
2877 \the\endpage@num|\the\endline@num|%
2878 \ifsublines@R \the\endsubline@num \else 0\fi}\to\line@listR
2879 \xright@appenditem%
2880 {\current@annot|\endcurrent@annot}\to\annot@listR%
2881 % \end{macrocode}
2882 % Create a list which will store all the second argument of each \protect\cs{@sw}
2883 % in this lemma, at this level.
2884 % \begin{macrocode}
2885 \expandafter\list@create\expandafter{\csname sw@list@edtext@tmp@\the\@edtext@level\endcsname}%
2886 % \end{macrocode}
2887 % And now, call \cs{@ref@reg@parseargR}, which can be also called by \cs{@ref@later}
2888 % \begin{macrocode}
2889 \@ref@reg@parseR{#2}%
2890 % \end{macrocode}
2891 % Decrease edtext level counter.
2892 % \begin{macrocode}
2893 \global\advance\@edtext@level by -1%
2894 }
2895 % \end{macrocode}
2896 % \end{macro}
2897 % \end{macro}
2898 % \end{macro}
2899 % \begin{macro}{\@ref@reg@parseR}
2900 % \begin{macrocode}
2901 \newcommand{\@ref@reg@parseR}[1]{%
2902 % \end{macrocode}
2903 % Declare and init boolean for lemma in this level.
2904 % \begin{macrocode}
2905 \providebool{lemmacommand@\the\@edtext@level}%
2906 \boolfalse{lemmacommand@\the\@edtext@level}%
2907 % \end{macrocode}
2908 % Execute the second argument of \protect\cs{@ref} again,
2909 % to perform for real all the commands within it.
2910 % \begin{macrocode}
2911 #1%
2912 % Now, we store the list of \protect\cs{@sw} of this current \protect\cs{edtext} as an element of
2913 % the global list of list of \protect\cs{@sw} for a \protect\cs{edtext} depth.
2914 % \begin{macrocode}
2915 \ifnum\@edtext@level>0%
2916 \def\create@this@edtext@level{\expandafter\list@create\expandafter{\csname sw@list@edtextR@\the\@edtext@level\endcsname}}%
2917 \ifcsundef{sw@list@edtextR@\the\@edtext@level}{\create@this@edtext@level}{}%
2918 \letcs{\@tmp}{sw@list@edtextR@\the\@edtext@level}%
2919 \letcs{\@tmpp}{sw@list@edtext@tmp@\the\@edtext@level}%
2920 \xright@appenditem{\expandonce\@tmpp}\to\@tmp%
2921 \global\cslet{sw@list@edtextR@\the\@edtext@level}{\@tmp}%
2922 \fi%
2923 }%
2924 % \end{macrocode}
2925
2926 % \end{macro}
2927 % \begin{macro}{\@pend}
2928 % \begin{macro}{\@pendR}
2929 % \protect\cs{@pend}\marg{num} adds its argument to the \protect\cs{linesinpar@listL}
2930 % list, and analogously for \protect\cs{@pendR}. If needed, it resets line number.
2931 % Both are defined in \macpackage, but they are empty.
2932 % They are really defined only in \parpackage.
2933 %
2934 %
2935 % \begin{macrocode}
2936 \renewcommand*{\@pend}[1]{%
2937 \ifbypstart@%
2938 \unless\ifinstanza%
2939 \global\line@num=0%
2940 \fi%
2941 \fi%
2942 \xright@appenditem{#1}\to\linesinpar@listL%
2943 }%
2944 \renewcommand*{\@pendR}[1]{%
2945 \ifbypstart@R%
2946 \unless\ifinstanzaR%
2947 \global\line@numR=0%
2948 \fi%
2949 \fi%
2950 \xright@appenditem{#1}\to\linesinpar@listR%
2951 }%
2952
2953 % \end{macrocode}
2954 % \end{macro}
2955 % \end{macro}
2956 %
2957 % \begin{macro}{\@pstart}
2958 % \begin{macro}{\@pstartR}
2959 % \cs{@pstart} and cs{@pstartR} allows us to know, when using \cs{nomaxlines} option, in which page we should start a pstart, and also how many empty lines we should let before starting this pstart at the beginning of the page
2960 % \begin{macrocode}
2961 \newcommand{\@pstart}[3]{%
2962 \ifcsdef{minpage@pstart@#1}%
2963 {\ifnumgreater{#2}{\csuse{minpage@pstart@#1}}%
2964 {\csnumgdef{minpage@pstart@#1}{#2}}%
2965 {}%
2966 }%
2967 {\csnumgdef{minpage@pstart@#1}{#2}}
2968 \csnumgdef{afterlines@pstart@#1L}{#3}%
2969 }%
2970
2971 \newcommand{\@pstartR}[3]{%
2972 \numdef{\@tmp}{#2-1}%Because we have not to know in which page the pstart starts, but in which pair of facing page
2973 \ifcsdef{minpage@pstart@#1}%
2974 {\ifnumgreater{\@tmp}{\csuse{minpage@pstart@#1}}%
2975 {\csnumgdef{minpage@pstart@#1}{\@tmp}}%
2976 {}%
2977 }%
2978 {\csnumgdef{minpage@pstart@#1}{\@tmp}}
2979 \csnumgdef{afterlines@pstart@#1R}{#3}%
2980 }%
2981 % \end{macrocode}
2982 % \end{macro}
2983 % \end{macro}
2984 % \begin{macro}{\@lopL}
2985 % \begin{macro}{\@lopR}
2986 % \protect\cs{@lopL}\marg{num} adds its argument to the \protect\cs{linesonpage@listL}
2987 % list, and analagously for \protect\cs{@lopR}.
2988 % Both are defined in \macpackage, but they are empty.
2989 % They are really defined only in \parpackage.
2990 % \begin{macrocode}
2991 \renewcommand*{\@lopL}[1]{%
2992 \xright@appenditem{#1}\to\linesonpage@listL}
2993 \renewcommand*{\@lopR}[1]{%
2994 \xright@appenditem{#1}\to\linesonpage@listR}
2995
2996 % \end{macrocode}
2997 % \end{macro}
2998 % \end{macro}
2999 %
3000 % \subsection{Writing to the line-list file}
3001 %
3002 % We have now defined all the counters, lists, and commands involved in
3003 % reading the line-list file at the start of a section. Now we will
3004 % cover the commands that \macpackage{} uses within the text of a
3005 % section to write commands out to the line-list.
3006 %
3007 % \begin{macro}{\linenum@outR}
3008 % The file for right texts will be opened on output stream \protect\cs{linenum@outR}.
3009 % \begin{macrocode}
3010 \newwrite\linenum@outR
3011 % \end{macrocode}
3012 % \end{macro}
3013 %
3014 % \begin{macro}{\iffirst@linenum@out@R}
3015 % \begin{macro}{\first@linenum@out@Rtrue}
3016 % \begin{macro}{\first@linenum@out@Rfalse}
3017 % Once any file is opened on this stream, we keep it open forever, or
3018 % else switch to another file that we keep open.
3019 % \begin{macrocode}
3020 \newif\iffirst@linenum@out@R
3021 \first@linenum@out@Rtrue
3022 % \end{macrocode}
3023 % \end{macro}
3024 % \end{macro}
3025 % \end{macro}
3026 %
3027 % \begin{macro}{\line@list@stuffR}
3028 % \begin{macro}{\next@line@list@stuffR}
3029 % This is the right text version of the \protect\cs{line@list@stuff}\marg{file}
3030 % macro. It is called by \protect\cs{beginnumberingR} and performs
3031 % all the line-list operations needed at the start of a section.
3032 % Its argument is the name of the line-list file.
3033 % \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.}
3034 % \Macpackage and \parpackage can fill the \cs{next@line@list@stuffR} hook between a \cs{endnumberingR} (associated with numbered file $n$) and a \cs{beginnumberingR} (associated with numbered file $n+1$). It allows adding content to the numbered file $n+1R$ and not $nR$.
3035 % \changes{v2.20.0}{2017/08/17}{Add \protect\cs{next@line@list@stuffR} internal hook.}
3036 % \begin{macrocode}
3037
3038 \let\next@line@list@stuffR\relax%
3039 \newcommand*{\line@list@stuffR}[1]{%
3040 \global\newtoggle{notfirstrun@#1}%
3041 \IfFileExists{\l@auxdir#1}%
3042 {\global\toggletrue{notfirstrun@#1}}%
3043 {\global\togglefalse{notfirstrun@#1}}%
3044 \next@line@list@stuffR%
3045 \global\let\next@line@list@stuffR\relax%
3046 \read@linelist{#1}%
3047 \iffirst@linenum@out@R
3048 \global\first@linenum@out@Rfalse
3049 \immediate\openout\linenum@outR=\l@auxdir#1%
3050 \immediate\write\linenum@outR{\string\line@list@version{\this@line@list@version}}%
3051 \ifl@dpaging%
3052 \immediate\write\linenum@outR{\string\@par@sync@option{\@par@this@sync@option}}%
3053 \fi%
3054 \else
3055 \if@minipage%
3056 \leavevmode%
3057 \fi%
3058 \closeout\linenum@outR%
3059 \openout\linenum@outR=\l@auxdir#1%
3060 \fi%
3061 }%
3062
3063 % \end{macrocode}
3064 % \end{macro}
3065 % \end{macro}
3066 %
3067 % \begin{macro}{\new@lineL}
3068 % The \protect\cs{new@lineL} macro sends the \protect\cs{@nl} command to the left text
3069 % line-list file, to mark the start of a new text line.
3070 % \begin{macrocode}
3071 \newcommand*{\new@lineL}{%
3072 \ifnumberline%
3073 \write\linenum@out{\string\@nl[\the\@this@c@page][\thepage]}%
3074 \fi%
3075 }%
3076 % \end{macrocode}
3077 % \end{macro}
3078 % \begin{macro}{\new@lineR}
3079 % The \protect\cs{new@lineR} macro sends the \protect\cs{@nl} command to the right text
3080 % line-list file, to mark the start of a new text line.
3081 % \begin{macrocode}
3082 \newcommand*{\new@lineR}{%
3083 \ifnumberline%
3084 \write\linenum@outR{\string\@nl[\the\@this@c@page][\thepage]}%
3085 \fi%
3086 }%
3087 % \end{macrocode}
3088 % \end{macro}
3089 %
3090 % \begin{macro}{\flag@start}
3091 % \begin{macro}{\flag@end}
3092 % We enclose a lemma marked by \protect\cs{edtext} in
3093 % \protect\cs{flag@start} and \protect\cs{flag@end}: these send the \protect\cs{@ref}
3094 % command to the line-list file.
3095 % \changes{v0.3.0}{2005/02/04}{Removed extraneous spaces from\protect\cs{flag@end}}
3096 % \changes{v1.8.2}{2014/08/15}{\protect\cs{flag@start} and \protect\cs{flag@end} are now defined only one time for eledmac and eledpar}
3097 % They are both defined in \macpackage.
3098 %
3099 % \end{macro}
3100 % \end{macro}
3101 %
3102 % \begin{macro}{\startsub}
3103 % \begin{macro}{\endsub}
3104 % \protect\cs{startsub} and \protect\cs{endsub}
3105 % turn sub-lineation on and off, by writing
3106 % appropriate instructions to the line-list file.
3107 % There are both defined in \macpackage.
3108 % \changes{v2.0.0}{2015/07/19}{\protect\cs{startsub} and \protect\cs{endsub} defined only in \reledmac.}
3109 % \end{macro}
3110 % \end{macro}
3111 %
3112 % \begin{macro}{\advanceline}
3113 % You can use \protect\cs{advanceline}\marg{num}
3114 % in running text to advance the current visible
3115 % line-number by a specified value, positive or negative.
3116 % It is defined in \macpackage.
3117 % \changes{v2.0.0}{2015/07/19}{\protect\cs{advanceline} defined only in \reledmac.}
3118 % \end{macro}
3119 %
3120 % \begin{macro}{\setline}
3121 % You can use \protect\cs{setline}\marg{num}
3122 % in running text (i.e., within \cs{pstart}\ldots\cs{pend}) to set the
3123 % current visible
3124 % line-number to a specified positive value.
3125 % It is defined in \macpackage.
3126 % \changes{v2.0.0}{2015/07/19}{\protect\cs{setline} defined only in \reledmac.}
3127 %
3128 % \end{macro}
3129 %
3130 % \begin{macro}{\setlinenum}
3131 % You can use \protect\cs{setlinenum}\marg{num}
3132 % before a \protect\cs{pstart} to set the visible line-number to a specified
3133 % positive value. It writes a \protect\cs{l@d@set} command to the line-list file.
3134 % It is defined in \macpackage.
3135 %
3136 % \changes{v2.0.0}{2015/07/19}{\protect\cs{setlinenum} defined only in \reledmac.}
3137 % \end{macro}
3138 %
3139 % \begin{macro}{\startlock}
3140 % \begin{macro}{\endlock}
3141 % You can use \protect\cs{startlock} or \protect\cs{endlock}
3142 % in running text to start or end line number locking at
3143 % the current line. They decide whether line numbers or sub-line numbers
3144 % are affected, depending on the current state of the sub-lineation flags.
3145 % They are defined in \macpackage.
3146
3147 % \changes{v2.0.0}{2015/07/19}{\protect\cs{startlock} and \protect\cs{endlock} defined only in \reledmac.}
3148 % \end{macro}
3149 % \end{macro}
3150 %
3151 % \begin{macro}{\skipnumbering}
3152 % \changes{v1.15.0}{2015/04/13}{\protect\cs{skipnumbering} defined only one time for both \Eledmac{} and \Eledpar{}}
3153 % \end{macro}
3154 %
3155 %
3156 % \section{Marking text for notes}
3157 % \label{text}
3158 %
3159 % The \protect\cs{edtext} macro is used to create all
3160 % footnotes and endnotes,
3161 % as well as to print the portion of the main text to which a given note
3162 % or notes is keyed. The idea is to have that lemma appear only once in
3163 % the \file{.tex} file: all instances of it in the main text and in the
3164 % notes are copied from that one appearance.
3165 %
3166 % \begin{macro}{\critext}
3167 % \begin{macro}{\edtext}
3168 % \changes{v1.3.0}{2012/11/16}{Manage RTL language.}
3169 % \changes{v1.11.0}{2014/01/22}{\protect\cs{critext} and \protect\cs{edtext} are now defined only in eledmac.}
3170 % \end{macro}
3171 % \end{macro}
3172 %
3173 % \begin{macro}{\set@line}
3174 % The \protect\cs{set@line} macro
3175 % is called by \protect\cs{edtext} to put the line-reference field and
3176 % font specifier for the current block of text into \protect\cs{l@d@nums}.
3177 % It is defined in \macpackage.
3178 %
3179 % \changes{v2.0.0}{2015/07/19}{\protect\cs{set@line} defined only in \reledmac.}
3180 % \end{macro}
3181 % \subsection{Specific hooks and commands for notes}
3182 % The \macpackage \protect\cs{newseries@} initializes commands which are linked to notes series.
3183 % However, to keep \macpackage as light as possible, it does not define commands which are specific to \parpackage.
3184 % This is what does \protect\cs{newseries@par}. The specific hooks are also defined here.
3185 % \begin{macro}{\newseries@par}
3186 % \begin{macrocode}
3187 \newcommand{\newseries@par}[1]{%
3188 % \end{macrocode}
3189 % \subsubsection{Notes to be printed on one side only}
3190 % \Parpackage allows notes to be printed on one side only.
3191 % We need to declare these options.
3192 % We also need box to store temporary the footnote not printed.
3193 % We check the \verb+nofamiliar+ and \verb+nocritical+ \macpackage\ options.
3194 % \changes{v1.16.0}{2015/05/18}{Fix a bug with \protect\cs{onlysideX}.}
3195 % \begin{macrocode}
3196 \unless\ifnofamiliar@%
3197 \csgdef{onlysideX@#1}{}%
3198 \newnamebox{footins#1@kept}%
3199 \fi%
3200 \unless\ifnocritical@%
3201 \csgdef{Xonlyside@#1}{}%
3202 \newnamebox{#1footins@kept}%
3203 \fi%
3204 % \end{macrocode}
3205 % \subsubsection{Tools specific to familiar footnotes}
3206 % \begin{macrocode}
3207 \unless\ifnofamiliar@%
3208 % \end{macrocode}
3209 % \paragraph{Managing correct number}\label{familiarfootnotenumber}
3210 % One problem with using familiar footnotes in parallel typesetting is the fact that the order of reading notes is not the same as the order they are typeset, because \LaTeX\ reads first all the notes on one side, then all the notes on the other side.
3211 % Then, however, \LaTeX\ alternates between typesetting left-side note and right-side notes.
3212 % Consequently, if we do nothing special, the note numbers are sorted in the reading order, not in the typesetting order.
3213 % So we could obtain something like 1,3,2,5,4.
3214 %
3215 % To prevent this problem, we use a two new counters by series.
3216 % Every note, in parallel typesetting, has three associated counters.
3217 % \begin{enumerate}
3218 % \item A \LaTeX\ counter \verb+footnoteX+. This the only one manipulated by user, and the only one finally printed.
3219 % \item A \TeX\ counter \verb+footnoteX@reading+. Its value is incremented when reading the \cs{footnoteX} command in left or right side environments. It is used to get the correct footnote number from the \verb+.aux+ file to be typeset in the main text. This counter is already defined in \macpackage, as it is also used for hyperlink.
3220 % \changes{v2.6.2}{2015/11/29}{The \TeX\ counter \protect\cs{footnoteX@reading} is defined in \protect\reledmac.}
3221 % \item A \LaTeX\ counter \verb+footnoteX@typeset+. Its value is increased when inserting footnotes. Its value is directly used in the footnote, and is stored in the \verb+aux+ files to be used on the next run for the main text.
3222 % \end{enumerate}
3223 %
3224 %
3225 %
3226 % So here, we only defined the new counter.
3227 % \begin{macrocode}
3228 \newcounter{footnote#1@typeset}%
3229 % \end{macrocode}
3230 %
3231 % \paragraph{Familiar footnotes without marks}
3232 % The \protect\cs{footnoteXnomk} commands are for notes which are printed on the left side, while they are called in the right side.
3233 % Basically, they set first toggle \protect\cs{nomark@} to true, then call the \protect\cs{footnoteX}.
3234 % and finally add the footnote counter in the footnote counter list.
3235 %
3236 % First, check the \verb+nofamiliar+ option of \macpackage.
3237 %
3238 % So declare the list.
3239 % \begin{macrocode}
3240 \expandafter\list@create\csname footnote#1@mk\endcsname%
3241 % \end{macrocode}
3242 % Then, declare the \protect\cs{footnoteXnomk} command.
3243 % \begin{macrocode}
3244 \expandafter\newcommand\csname footnote#1nomk\endcsname[1]{%
3245 % \end{macrocode}
3246 % First step: just call the normal \protect\cs{footnoteX}, saying that we do not want to print the mark.
3247 % \begin{macrocode}
3248 \toggletrue{nomk@}%
3249 \csuse{footnote#1}{##1}%
3250 \togglefalse{nomk@}%
3251 % \end{macrocode}
3252 % Second, and last, step: store the footnote counter in the footnote counters list.
3253 % We use some \protect\cs{let}, because \protect\cs{xright@appenditem} is difficult to use with \protect\cs{expandafter}.
3254 % \begin{macrocode}
3255 \letcs{\@tmp}{footnote#1@mk}%
3256 \numdef\@tmpa{\csuse{c@footnote#1}}%
3257 \global\xright@appenditem{\@tmpa}\to\@tmp%
3258 \global\cslet{footnote#1@mk}{\@tmp}%
3259 \global\protected@csxdef{hr@thefnmark#1}{\noexpand\@tmpa @\the\csname footnote#1@series\endcsname}%
3260 }%
3261 % \end{macrocode}
3262 % Then, declare the command which inserts the footnotemark in the right side.
3263 % \begin{macrocode}
3264 \expandafter\newcommand\csname footnote#1mk\endcsname{%
3265 % \end{macrocode}
3266 % Get the first element of the footnote mark list.
3267 % As \protect\cs{gl@p} is difficult to use with dynamic name macro, we use \protect\cs{let} commands.
3268 % \begin{macrocode}
3269 \letcs{\@tmp}{footnote#1@mk}%
3270 \gl@p\@tmp\to\@tmpa%
3271 \global\cslet{footnote#1@mk}{\@tmp}%
3272 % \end{macrocode}
3273 % Set the footnotecounter with it.
3274 % For the sake of security, we make a backup of the previous value.
3275 % \begin{macrocode}
3276 \letcs{\old@footnote}{c@footnote#1}%
3277 \setcounter{footnote#1}{\@tmpa}%
3278 % \end{macrocode}
3279 % Define the footnote mark and print it
3280 % \begin{macrocode}
3281 \protected@csxdef{@thefnmark#1}{\csuse{thefootnote#1}}%
3282 \csuse{@footnotemark#1}%
3283 % \end{macrocode}
3284 % Restore previous footnote counter and finally add space.
3285 % \begin{macrocode}
3286 \setcounter{footnote#1}{\old@footnote}%
3287 \xspace%
3288 }%
3289 % \end{macrocode}
3290 % End of tools specific to familiar notes.
3291 % \begin{macrocode}
3292 \fi
3293 % \end{macrocode}
3294 % End of \protect\cs{newseries@par}.
3295 % \begin{macrocode}
3296 }%
3297 % \end{macrocode}
3298 % \end{macro}
3299 % \subsubsection{Get correct footnote number}
3300 % \begin{macro}{\get@familiarfootnote@number}
3301 % \begin{macro}{\save@familiarfootnote@number}
3302 % As users can insert footnotes between two \cs{Pairs} or \cs{Pages} commands, we have to set the \cs+footnoteX@typeset+ counter to the last value of the \verb+footnoteX+ counter at the beginning of these two commands.
3303 % \begin{macrocode}
3304 \newcommand{\save@familiarfootnote@number}{%
3305 \unless\ifnofamiliar@%
3306 \def\do##1{\csxdef{saved@footnote##1}{\the\csname c@footnote##1\endcsname}}%
3307 \dolistloop{\@series}%
3308 \fi%
3309 \xdef\saved@footnote{\the\c@footnote}%
3310 }
3311 \newcommand{\get@familiarfootnote@number}{%
3312 \unless\ifnofamiliar@%
3313 \def\do##1{\setcounter{footnote##1@typeset}{\csuse{saved@footnote##1}}}%
3314 \dolistloop{\@series}%
3315 \fi%
3316 \setcounter{footnote@typeset}{\saved@footnote}%
3317 }
3318 % \end{macrocode}
3319 % \end{macro}
3320 % \end{macro}
3321 % \subsection{Create hooks}
3322 % Read the \macpackage code handbook about \protect\cs{newhookcommand@series}.
3323 % Here, we create hooks which are specific to \parpackage.
3324 % \begin{macrocode}
3325 \unless\ifnocritical@%
3326 \newhookcommand@series{Xonlyside}%
3327 \fi%
3328 \unless\ifnofamiliar@%
3329 \newhookcommand@series{onlysideX}%
3330 \fi
3331
3332
3333 % \end{macrocode}
3334 % \subsection{Init standards series (A,B,C,D,E,Z)}
3335 % \begin{macro}{\init@series@par}
3336 % \protect\cs{newseries@par} is called by \protect\cs{newseries}.
3337 % However, this last command is called before \parpackage is loaded.
3338 % Thus, we need to initiate a specific series hook for \parpackage.
3339 % \begin{macrocode}
3340 \newcommand{\init@series@par}{%
3341 \def\do##1{\newseries@par{##1}}%
3342 \dolistloop{\@series}%
3343 }%
3344 \init@series@par%
3345 % \end{macrocode}
3346 % \end{macro}
3347 % \subsection{Tools specific to \LaTeX's classical footnotes}
3348 % As users can use classical footnotes of \LaTeX\ (\cs{footnote})
3349 % in parallel texts, we must integrate the same tools to get correct number as for \macpackage' footnotes (\reff{familiarfootnotenumber}).
3350 % \begin{macro}{\footnote@reading}
3351 % \begin{macro}{\footnote@typeset}
3352 % \begin{macrocode}
3353 \newcount\footnote@reading%
3354 \newcounter{footnote@typeset}%
3355 % \end{macrocode}
3356 % \end{macro}
3357 % \end{macro}
3358 % \section{Pstart numbers dumping and restoration}
3359 % While in \macpackage the footnotes are inserted at the same time as the \protect\cs{pstart}\ldots\protect\cs{pend} are read, in \parpackage they are inserted when the \protect\cs{Columns} or \protect\cs{Pages} commands are called.
3360 % Consequently, if we do nothing, the value of the \verb+PstartL+ and \verb+PstartR+ counters are not the same in the main text and in the notes.
3361 % To solve this problem, we dump the values in two list (one by side) when processing \protect\cs{pstart} and restore these at each \protect\cs{pstart} when calling \protect\cs{Columns} or \protect\cs{Pages}.
3362 % We also dump and restore the value of the booleans \protect\cs{ifnumberpstart} and \protect\cs{ifnumberline}.
3363
3364 % So, first step, creating the lists.
3365 % Here, \enquote{pc} means \enquote{public counters}.
3366 % \begin{macro}{\list@pstartL@pc}
3367 % \begin{macro}{\list@pstartR@pc}
3368 % \begin{macrocode}
3369 \list@create{\list@pstartL@pc}%
3370 \list@create{\list@pstartR@pc}%
3371 % \end{macrocode}
3372 % \end{macro}
3373 % \end{macro}
3374 % Two commands to dump current pstarts.
3375 % We prefer two commands to one with argument indicating the side,
3376 % because the commands are short, and so we save one test (or a \protect\cs{csname} construction).
3377 % \begin{macro}{\dump@pstartL@pc}
3378 % \begin{macro}{\dump@pstartR@pc}
3379 % \begin{macrocode}
3380 \def\dump@pstartL@pc{%
3381 \xright@appenditem{\the\c@pstartL}\to\list@pstartL@pc%
3382 \global\cslet{numberpstart@L\the\l@dnumpstartsL}{\ifnumberpstart}%
3383 \global\cslet{numberline@L\the\l@dnumpstartsL}{\ifnumberline}%
3384 \global\cslet{linenumannotationotherside@L\the\l@dnumpstartsL}{\iflinenumannotationotherside}%
3385 }%
3386
3387 \def\dump@pstartR@pc{%
3388 \xright@appenditem{\the\c@pstartR}\to\list@pstartR@pc%
3389 \global\cslet{numberpstart@R\the\l@dnumpstartsR}{\ifnumberpstart}%
3390 \global\cslet{numberline@R\the\l@dnumpstartsR}{\ifnumberline}%
3391 \global\cslet{linenumannotationotherside@R\the\l@dnumpstartsR}{\iflinenumannotationotherside}%
3392 }%
3393
3394 % \end{macrocode}
3395 % \end{macro}
3396 % \end{macro}
3397 % \begin{macro}{\restore@pstartL@pc}
3398 % \begin{macro}{\restore@pstartR@pc}
3399 % And so, the commands to restore them.
3400 % \begin{macrocode}
3401 \def\restore@pstartL@pc{%
3402 \ifx\list@pstartL@pc\empty\else%
3403 \gl@p\list@pstartL@pc\to\@temp%
3404 \global\c@pstartL=\@temp%
3405 \fi%
3406 }%
3407 \def\restore@pstartR@pc{%
3408 \ifx\list@pstartR@pc\empty\else%
3409 \gl@p\list@pstartR@pc\to\@temp%
3410 \global\c@pstartR=\@temp%
3411 \fi%
3412 }%
3413 % \end{macrocode}
3414 % \end{macro}
3415 % \end{macro}
3416 % \section{Parallel environments}
3417 %
3418 % The initial set up for parallel processing is deceptively simple.
3419 %
3420 %
3421 % \begin{environment}{pairs}
3422 % \begin{environment}{pages}
3423 % \begin{macro}{chapterinpages}
3424 % The \verb?pairs? environment is for parallel columns and the \verb?pages?
3425 % environment for parallel pages.
3426 % \begin{macrocode}
3427 \newenvironment{pairs}{%}
3428 \reledpar@init@language%
3429 \l@dpairingtrue
3430 \l@dpagingfalse
3431 \initnumbering@quote
3432 \save@familiarfootnote@number%
3433 \if@ledgroup%
3434 \get@familiarfootnote@number%
3435 \fi%
3436 \save@section@number%
3437 \at@begin@pairs%
3438 }{%
3439 \l@dpairingfalse
3440 }
3441
3442 % \end{macrocode}
3443 % \begin{macro}{\AtBeginPairs}
3444 % The \protect\cs{AtBeginPairs} macro just define a \protect\cs{at@begin@pairs} macro, called at the beginning of each \verb+pairs+ environments.
3445 % \begin{macrocode}
3446 \newcommand{\AtBeginPairs}[1]{\gdef\at@begin@pairs{#1}}%
3447 \def\at@begin@pairs{}%
3448
3449 % \end{macrocode}
3450 % \end{macro}
3451 % \changes{v2.0.0}{2015/07/19}{Deleting the old system of managing parallel chapter, keep only the new one with \protect\cs{patchcmd}.}
3452 % The \verb?pages? environment additionally sets the \enquote{column} widths to the
3453 % \protect\cs{textwidth} (as known at the time the package is called). In this environment, there are two text in parallel on 2 pages.
3454 % \begin{macrocode}
3455 \newenvironment{pages}{%
3456 \reledpar@init@language%
3457 \l@dpairingtrue
3458 \l@dpagingtrue
3459 \initnumbering@quote
3460 \save@familiarfootnote@number%
3461 \if@ledgroup%
3462 \get@familiarfootnote@number%
3463 \fi%
3464 \save@section@number%
3465 \Lcolwidth=\textwidth%
3466 \Rcolwidth=\textwidth%
3467 }{%
3468 \l@dpairingfalse
3469 \l@dpagingfalse
3470 \global\Lcolwidth@pages=\Lcolwidth%Does not use \setlength, in case of calc package redefiniton (cf. https://github.com/latex3/latex2e/issues/58)
3471 \global\Rcolwidth@pages=\Rcolwidth%
3472 }
3473
3474 % \end{macrocode}
3475 % \end{macro}
3476 % \end{environment}
3477 % \end{environment}
3478 %
3479 %
3480 % \begin{environment}{Leftside}
3481 % Within the \verb?pairs? and \verb?pages? environments the left and
3482 % right hand texts are within \verb?Leftside? and \verb?Rightside?
3483 % environments, respectively. The \verb?Leftside? environment is simple,
3484 % indicating that right text is not within its purview and using some
3485 % particular macros.
3486 % \changes{v0.3.0}{2005/02/10}{Added hooks into Leftside environment}
3487 % \begin{macrocode}
3488 \newenvironment{Leftside}{%
3489 \expandafter\ifvoid\csname l@dLcolrawbox1\endcsname\else%
3490 \led@err@Leftside@PreviousNotPrinted%
3491 \fi%
3492 \ledRcolfalse
3493 \setcounter{pstartL}{1}
3494 \let\pstart\pstartL
3495 \let\thepstart\thepstartL
3496 \let\pend\pendL
3497 \let\memorydump\memorydumpL
3498 \Leftsidehook
3499 \let\old@startstanza\@startstanza%
3500 \def\@startstanza[##1][##2]{\global\instanzaLtrue\old@startstanza[##1][##2]}%
3501 }{
3502 \expandafter\ifvoid\csname l@dLcolrawbox1\endcsname%
3503 \led@error@missing@numbering{Leftside}%
3504 \fi%
3505 \Leftsidehookend}
3506 % \end{macrocode}
3507 % \end{environment}
3508 %
3509 % \begin{macro}{\Leftsidehook}
3510 % \begin{macro}{\Leftsidehookend}
3511 % \begin{macro}{\Rightsidehook}
3512 % \begin{macro}{\Rightsidehookend}
3513 % Hooks into the start and end of the {Leftside} and {Rightside}
3514 % environments. These are initially empty.
3515 % \changes{v0.3.0}{2005/02/10}{Added \protect\cs{Leftsidehook}, \protect\cs{Leftsidehookend},
3516 % \protect\cs{Rightsidehook} and \protect\cs{Rightsidehookend}}
3517 % \begin{macrocode}
3518 \newcommand*{\Leftsidehook}{}
3519 \newcommand*{\Leftsidehookend}{}
3520 \newcommand*{\Rightsidehook}{}
3521 \newcommand*{\Rightsidehookend}{}
3522
3523 % \end{macrocode}
3524 % \end{macro}
3525 % \end{macro}
3526 % \end{macro}
3527 % \end{macro}
3528 % \begin{macro}{\Rightpagehook}
3529 % \begin{macro}{\Leftpagehook}
3530 % Hook at the start of Left/Right page, initially empty.
3531 % \begin{macrocode}
3532 \newcommand*{\Rightpagehook}{}%
3533 \newcommand*{\Leftpagehook}{}%
3534 % \end{macrocode}
3535 % \end{macro}
3536 % \end{macro}
3537 %
3538 % \begin{environment}{Rightside}
3539 % The \verb?Rightside? environment is only slightly more complicated
3540 % than the \verb?Leftside?.
3541 % Apart from indicating that right text is being provided it
3542 % ensures that the right right text code will be used.
3543 % \begin{macrocode}
3544 \newenvironment{Rightside}{%
3545 \expandafter\ifvoid\csname l@dRcolrawbox1\endcsname\else%
3546 \led@err@Rightside@PreviousNotPrinted%
3547 \fi%
3548 \ledRcoltrue
3549 \let\beginnumbering\beginnumberingR
3550 \let\endnumbering\endnumberingR
3551 \let\pausenumbering\pausenumberingR
3552 \let\resumenumbering\resumenumberingR
3553 \let\memorydump\memorydumpR
3554 \let\thepstart\thepstartR
3555 \let\pstart\pstartR
3556 \let\pend\pendR
3557 \let\ledpb\ledpbR
3558 \let\lednopb\lednopbR
3559 \let\lineation\lineationR
3560 \Rightsidehook
3561 \let\old@startstanza\@startstanza%
3562 \def\@startstanza[##1][##2]{\global\instanzaRtrue\old@startstanza[##1][##2]}%
3563 }{%
3564 \ledRcolfalse
3565 \expandafter\ifvoid\csname l@dRcolrawbox1\endcsname%
3566 \led@error@missing@numbering{Rightside}%
3567 \fi%
3568 \Rightsidehookend
3569 }
3570
3571 % \end{macrocode}
3572 % \end{environment}
3573 %
3574 %
3575 %
3576 % \section{Paragraph decomposition and reassembly}
3577 % \label{paragraph}\relax
3578 %
3579 % In order to be able to count the lines of text and affix line
3580 % numbers, we add an extra stage of processing for each paragraph.
3581 % We send the paragraph into a box
3582 % register, rather than straight onto the vertical list, and when
3583 % the paragraph ends we
3584 % slice the paragraph into its component lines; to each line we
3585 % add any notes or line numbers, add a command to write to the
3586 % line-list, and then at last send the line to the vertical list.
3587 % This section contains all the code for this processing.
3588 %
3589 % \subsection{Boxes, counters, \protect\cs{pstart}
3590 % and \protect\cs{pend}}
3591 %
3592 % \begin{macro}{\num@linesR}
3593 % \begin{macro}{\one@lineR}
3594 % \begin{macro}{\par@lineR}
3595 % Here are numbers and flags that are used internally in the course
3596 % of the paragraph decomposition.
3597 %
3598 % When we first form the paragraph, it goes into a box register,
3599 % \protect\cs{l@dLcolrawbox} or \protect\cs{l@dRcolrawbox} for right text, instead of onto the
3600 % current vertical list.
3601 % The \protect\cs{ifnumberedpar@} flag will be \verb"true" while a paragraph is
3602 % being processed in that way.
3603 % \protect\cs{num@lines(R)} will store the number of lines in the paragraph
3604 % when it is complete. When we chop it up into lines, each line
3605 % in turn goes into the
3606 % \protect\cs{one@line} or \protect\cs{one@lineR} register, and \protect\cs{par@line(R)}
3607 % will be the number
3608 % of that line within the paragraph.
3609 % \begin{macrocode}
3610 \newcount\num@linesR
3611 \newbox\one@lineR
3612 \newcount\par@lineR
3613 % \end{macrocode}
3614 % \end{macro}
3615 % \end{macro}
3616 % \end{macro}
3617 %
3618 % \begin{macro}{\pstartL}
3619 % \begin{macro}{\pstartR}
3620 % \changes{v1.1.0}{2012/09/25}{Add \protect\cs{labelpstarttrue} (from eledmac).}
3621 % \changes{v1.1.1}{2012/10/01}{Correct \protect\cs{pstartR} bug introduced by 1.1.}
3622 % \changes{v1.4.3}{2013/10/27}{Spurious spaces in \protect\cs{pstartL} and \protect\cs{pstartR}.}
3623 % \changes{v1.8.0}{2014/08/05}{As in \protect\package{eledmac}, \protect\cs{pendL} and \protect\cs{pendR} can have an optional argument.}
3624 % \protect\cs{pstart} starts the paragraph by
3625 % clearing the \protect\cs{inserts@list} list and other
3626 % relevant variables, and then arranges for the
3627 % subsequent text to go into the appropriate box.
3628 % \protect\cs{pstart} needs to appear at the start of
3629 % every paragraph that is to be numbered.
3630 %
3631 % Beware: everything that occurs between \protect\cs{pstart} and \protect\cs{pend}
3632 % is happening within a group; definitions must be global if you want
3633 % them to survive past the end of the paragraph.
3634 %
3635 % We have to have specific left and right \protect\cs{pstart} when parallel processing;
3636 % among other things because of potential changes in the linewidth.
3637 %
3638 % \begin{macrocode}
3639
3640 \newcounter{pstartL}
3641 \renewcommand{\thepstartL}{{\bfseries\@arabic\c@pstartL}. }
3642 \newcounter{pstartR}
3643 \renewcommand{\thepstartR}{{\bfseries\@arabic\c@pstartR}. }
3644
3645 \newcommandx*{\pstartL}[2][1,2,usedefault]{%
3646 \if@nobreak%
3647 \let\@oldnobreak\@nobreaktrue%
3648 \else%
3649 \let\@oldnobreak\@nobreakfalse%
3650 \fi%
3651 \@nobreaktrue%
3652 \ifluatex%
3653 \xdef\l@luatextextdir@L{\the\textdir}%
3654 \xdef\l@luatexpardir@L{\the\pardir}%
3655 \xdef\l@luatexbodydir@L{\the\bodydir}%
3656 \fi%
3657 \ifnumbering \else%
3658 \led@err@PstartNotNumbered%
3659 \beginnumbering%
3660 \fi%
3661 \ifnumberedpar@%
3662 \led@err@PstartInPstart%
3663 \pend%
3664 \fi%
3665 % \end{macrocode}
3666 % If this is the first \protect\cs{pstart} in a numbered section, clear any inserts
3667 % and set \protect\cs{ifpst@rtedL} to FALSE.
3668 % \begin{macrocode}
3669 \ifpst@rtedL\else%
3670 \list@clear{\inserts@list}%
3671 \global\let\next@insert=\empty%
3672 \global\pst@rtedLtrue%
3673 \fi%
3674 \begingroup\everypar{}%
3675 % \end{macrocode}
3676 % When parallel processing we check that we have not exceeded
3677 % the maximum number of chunks. In any event we grab a box for the
3678 % forthcoming text.
3679 % \begin{macrocode}
3680 \global\advance\l@dnumpstartsL \@ne%
3681 \global\advance\pstarts@read@L \@ne%
3682 \ifnum\l@dnumpstartsL>\l@dc@maxchunks%
3683 \led@err@TooManyPstarts%
3684 \global\l@dnumpstartsL=\l@dc@maxchunks%
3685 \fi%
3686 \global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup%
3687 % \end{macrocode}
3688 % We set all the usual interline penalties to zero; this ensures that there will
3689 % be no large interline penalties to prevent us from slicing the
3690 % paragraph into pieces. These penalties revert to the values
3691 % that you set when the group for the \protect\cs{vbox} ends.
3692 % \begin{macrocode}
3693 \l@dzeropenalties%
3694 \ifboolexpr{%
3695 bool{autopar}%
3696 and bool{by@autopar}%
3697 }%
3698 {}%
3699 {%
3700 \ifnumberpstart%
3701 \ifsidepstartnum%
3702 \else%
3703 \thepstartL%
3704 \fi%
3705 \fi%
3706 }%m
3707 \@at@start@every@pstart%
3708 \hsize=\Lcolwidth%
3709 \numberedpar@true%
3710 \iflabelpstart%
3711 \protected@edef\@currentlabel{\p@pstartL\thepstartL}%
3712 \fi%
3713 % \end{macrocode}
3714 % Dump the optional arguments
3715 % \begin{macrocode}
3716 \providetoggle{before@pstartL@\the\l@dnumpstartsL @par}%
3717 \ifboolexpr{%
3718 test {\ifstrempty{#1}}%
3719 and test {\ifstrempty{#2}}%
3720 }%
3721 {%
3722 \ifat@every@pstart@star@%
3723 \global\togglefalse{before@pstartL@\the\l@dnumpstartsL @par}%
3724 \else%
3725 \global\toggletrue{before@pstartL@\the\l@dnumpstartsL @par}%
3726 \fi%
3727 \csgdef{before@pstartL@\the\l@dnumpstartsL}{\at@every@pstart}%
3728 }%
3729 {%
3730 \ifstrempty{#1}{}{%
3731 \global\toggletrue{before@pstartL@\the\l@dnumpstartsL @par}%
3732 \csgdef{before@pstartL@\the\l@dnumpstartsL}{\noindent#1}%
3733 }%
3734 \ifstrempty{#2}{}%
3735 {%
3736 \csgdef{before@pstartL@\the\l@dnumpstartsL}{#2}%
3737 \global\togglefalse{before@pstartL@\the\l@dnumpstartsL @par}%
3738 }%
3739 }%
3740 \at@every@pstart@call%
3741 % \end{macrocode}
3742 % Let \cs{by@autopar} to FALSE.
3743 % \begin{macrocode}
3744 \global\by@autoparfalse%
3745 % \end{macrocode}
3746 % Gobble following space (automatically done if there is no optional argument)
3747 % \begin{macrocode}
3748 \ignorespaces%
3749 }
3750 % \end{macrocode}
3751 % The same for right side.
3752 %
3753 % \begin{macrocode}
3754 \newcommandx*{\pstartR}[2][1,2,usedefault]{%
3755 \if@nobreak%
3756 \let\@oldnobreak\@nobreaktrue%
3757 \else%
3758 \let\@oldnobreak\@nobreakfalse%
3759 \fi%
3760 \@nobreaktrue%
3761 \ifluatex%
3762 \xdef\l@luatextextdir@R{\the\textdir}%
3763 \xdef\l@luatexpardir@R{\the\pardir}%
3764 \xdef\l@luatexbodydir@R{\the\bodydir}%
3765 \fi%
3766 \ifnumberingR \else%
3767 \led@err@PstartNotNumbered%
3768 \beginnumberingR%
3769 \fi%
3770 \ifnumberedpar@%
3771 \led@err@PstartInPstart%
3772 \pendR%
3773 \fi%
3774 \ifpst@rtedR\else%
3775 \list@clear{\inserts@listR}%
3776 \global\let\next@insertR=\empty%
3777 \global\pst@rtedRtrue%
3778 \fi%
3779 \begingroup\everypar{}%
3780 \global\advance\l@dnumpstartsR \@ne%
3781 \ifnum\l@dnumpstartsR>\l@dc@maxchunks%
3782 \led@err@TooManyPstarts%
3783 \global\l@dnumpstartsR=\l@dc@maxchunks%
3784 \fi%
3785 \global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup%
3786 \l@dzeropenalties%
3787 \ifboolexpr{%
3788 bool{autopar}%
3789 and bool{by@autopar}%
3790 }%
3791 {}%
3792 {%
3793 \ifnumberpstart%
3794 \ifsidepstartnum\else%
3795 \thepstartR%
3796 \fi%
3797 \fi%
3798 }%
3799 \@at@start@every@pstart%
3800 \hsize=\Rcolwidth%
3801 \numberedpar@true%
3802 \iflabelpstart%
3803 \protected@edef\@currentlabel{\p@pstartR\thepstartR}%
3804 \fi%
3805 \providetoggle{before@pstartR@\the\l@dnumpstartsR @par}%
3806 \ifboolexpr{%
3807 test {\ifstrempty{#1}}%
3808 and test {\ifstrempty{#2}}%
3809 }%
3810 {%
3811 \ifat@every@pstart@star@%
3812 \global\togglefalse{before@pstartR@\the\l@dnumpstartsR @par}%
3813 \else%
3814 \global\toggletrue{before@pstartR@\the\l@dnumpstartsR @par}%
3815 \fi%
3816 \csgdef{before@pstartR@\the\l@dnumpstartsR}{\at@every@pstart}%
3817 }%
3818 {%
3819 \ifstrempty{#1}{}{%
3820 \global\toggletrue{before@pstartR@\the\l@dnumpstartsR @par}%
3821 \csgdef{before@pstartR@\the\l@dnumpstartsR}{\noindent#1}%
3822 }%
3823 \ifstrempty{#2}{}%
3824 {%
3825 \csgdef{before@pstartR@\the\l@dnumpstartsR}{#2}%
3826 \global\togglefalse{before@pstartR@\the\l@dnumpstartsR @par}%
3827 }%
3828 }%
3829 \at@every@pstart@call%
3830 \global\by@autoparfalse%
3831 \ignorespaces%
3832 }
3833 % \end{macrocode}
3834 % \end{macro}
3835 % \end{macro}
3836 %
3837 %
3838 % \begin{macro}{\pendL}
3839 % \changes{v1.4.3}{2013/10/27}{Spurious spaces in \protect\cs{pendL}.}
3840 % \changes{v1.8.0}{2014/08/05}{As in \protect\package{eledmac}, \protect\cs{pendL} can have an optional argument.}
3841 % \protect\cs{pend} must be used to end a numbered paragraph. Again we need
3842 % a version
3843 % that knows about left parallel texts.
3844 %
3845 % \begin{macrocode}
3846 \newcommandx*{\pendL}[2][1,2,usedefault]{%
3847 \ifnumbering \else%
3848 \led@err@PendNotNumbered%
3849 \fi%
3850 \ifnumberedpar@ \else%
3851 \led@err@PendNoPstart%
3852 \fi%
3853 % \end{macrocode}
3854 % We immediately
3855 % call \protect\cs{endgraf} to end the paragraph; this ensures that there will
3856 % be no large interline penalties to prevent us from slicing the
3857 % paragraph into pieces.
3858 % \begin{macrocode}
3859 \@at@end@every@pend%
3860 \endgraf\global\num@lines=\prevgraf\egroup%
3861 \global\par@line=0%
3862 \get@firsthalf@antilabe@wd%
3863 % \end{macrocode}
3864 % End the group that was begun in the \protect\cs{pstart}.
3865 % \begin{macrocode}
3866 \endgroup%
3867 \ignorespaces%
3868 \@oldnobreak%
3869 \dump@pstartL@pc%
3870 \ifnumberpstart%
3871 \addtocounter{pstartL}{1}%
3872 \ifcontinuousnumberingwithcolumns%
3873 \addtocounter{pstart}{1}%
3874 \fi%
3875 \fi
3876 \parledgroup@beforenotes@save{L}%
3877 % \end{macrocode}
3878 % Dump content of the optional argument.
3879 % \begin{macrocode}
3880 \providetoggle{after@pendL@\the\l@dnumpstartsL @par}%
3881 \ifboolexpr{%
3882 test {\ifstrempty{#1}}%
3883 and test {\ifstrempty{#2}}%
3884 }%
3885 {%
3886 \ifat@every@pend@star@%
3887 \global\togglefalse{after@pendL@\the\l@dnumpstartsL @par}%
3888 \else%
3889 \global\toggletrue{after@pendL@\the\l@dnumpstartsL @par}%
3890 \fi%
3891 \csgdef{after@pendL@\the\l@dnumpstartsL}{\at@every@pend}%
3892 }%
3893 {%
3894 \ifstrempty{#1}{}{%
3895 \global\toggletrue{after@pendL@\the\l@dnumpstartsL @par}%
3896 \csgdef{after@pendL@\the\l@dnumpstartsL}{\noindent#1}%
3897 }%
3898 \ifstrempty{#2}{}%
3899 {%
3900 \csgdef{after@pendL@\the\l@dnumpstartsL}{#2}%
3901 \global\togglefalse{after@pendL@\the\l@dnumpstartsL @par}%
3902 }%
3903 }%
3904 }%
3905 % \end{macrocode}
3906 % \end{macro}
3907 %
3908 % \begin{macro}{\pendR}
3909 % \changes{v1.4.3}{2013/10/27}{Spurious spaces in \protect\cs{pstartR}.}
3910 % \changes{v1.8.0}{2014/08/05}{As in \protect\package{eledmac}, \protect\cs{pendR} can have an optional argument.}
3911 % The version of \protect\cs{pend} needed for right texts.
3912 %
3913 % \begin{macrocode}
3914 \newcommandx*{\pendR}[2][1,2,usedefault]{%
3915 \ifnumberingR \else%
3916 \led@err@PendNotNumbered%
3917 \fi%
3918 \ifnumberedpar@ \else%
3919 \led@err@PendNoPstart%
3920 \fi%
3921 \@at@end@every@pend%
3922 \endgraf\global\num@linesR=\prevgraf\egroup%
3923 \global\par@lineR=0%
3924 \get@firsthalf@antilabe@wd%
3925 \endgroup%
3926 \ignorespaces%
3927 \@oldnobreak%
3928 \dump@pstartR@pc%
3929 \ifnumberpstart%
3930 \addtocounter{pstartR}{1}%
3931 \fi%
3932 \parledgroup@beforenotes@save{R}%
3933 \providetoggle{after@pendR@\the\l@dnumpstartsR @par}%
3934 \ifboolexpr{%
3935 test {\ifstrempty{#1}}%
3936 and test {\ifstrempty{#2}}%
3937 }%
3938 {%
3939 \ifat@every@pend@star@%
3940 \global\togglefalse{after@pendR@\the\l@dnumpstartsR @par}%
3941 \else%
3942 \global\toggletrue{after@pendR@\the\l@dnumpstartsR @par}%
3943 \fi%
3944 \csgdef{after@pendR@\the\l@dnumpstartsR}{\at@every@pend}}%
3945 {%
3946 \ifstrempty{#1}{}{%
3947 \csgdef{after@pendR@\the\l@dnumpstartsR}{\noindent#1}%
3948 \global\toggletrue{after@pendR@\the\l@dnumpstartsR @par}%
3949 }%
3950 \ifstrempty{#2}{}{%
3951 \csgdef{after@pendR@\the\l@dnumpstartsR}{#2}%
3952 \global\togglefalse{after@pendR@\the\l@dnumpstartsR @par}%
3953 }%
3954 }%
3955 }
3956
3957 % \end{macrocode}
3958 % \end{macro}
3959 %
3960 %
3961 % \begin{macro}{\AtEveryPstartCall}
3962 % The \protect\cs{AtEveryPstartCall} argument is called when the \protect\cs{pstartL} or \protect\cs{pstartR} is called.
3963 % That is different of \protect\cs{AtEveryPstart} the argument of which is called when the \protect\cs{pstart}s are printed.
3964 % \begin{macrocode}
3965 \newcommand{\AtEveryPstartCall}[1]{\gdef\at@every@pstart@call{#1}}%
3966 \gdef\at@every@pstart@call{}%
3967 % \end{macrocode}
3968 % \end{macro}
3969 % \begin{macro}{\ifprint@last@after@pendL}
3970 % \begin{macro}{\ifprint@last@after@pendR}
3971 % Two booleans set to true, when the time is to print the last optional argument of a \protect\cs{pend}.
3972 % \begin{macrocode}
3973 \newif\ifprint@last@after@pendL%
3974 \newif\ifprint@last@after@pendR%
3975 % \end{macrocode}
3976 % \end{macro}
3977 % \end{macro}
3978 % \subsection{Processing one line}
3979 %
3980 % For parallel texts we have to be able to process left and right lines
3981 % independently. For sequential text we happily use the
3982 % original \protect\cs{do@line}. Otherwise \ldots
3983 %
3984 % \begin{macro}{\l@dleftbox}
3985 % \begin{macro}{\l@drightbox}
3986 % A line of left text will be put in the box \protect\cs{l@dleftbox}, and analogously
3987 % for a line of right text.
3988 % \begin{macrocode}
3989 \newbox\l@dleftbox
3990 \newbox\l@drightbox
3991
3992 % \end{macrocode}
3993 % \end{macro}
3994 % \end{macro}
3995 %
3996 % \begin{macro}{\countLline}
3997 % \begin{macro}{\countRline}
3998 % We need to know the number of lines processed.
3999 % \begin{macrocode}
4000 \newcount\countLline
4001 \countLline \z@
4002 \newcount\countRline
4003 \countRline \z@
4004
4005 % \end{macrocode}
4006 % \end{macro}
4007 % \end{macro}
4008 %
4009 % \begin{macro}{\@donereallinesL}
4010 % \begin{macro}{\@donetotallinesL}
4011 % \begin{macro}{\@donereallinesR}
4012 % \begin{macro}{\@donetotallinesR}
4013 % We need to know the number of \enquote{real} lines output (i.e., those that
4014 % have been input by the user), and the total lines output (which includes
4015 % any blank lines output for synchronisation).
4016 % \begin{macrocode}
4017 \newcount\@donereallinesL
4018 \newcount\@donetotallinesL
4019 \newcount\@donereallinesR
4020 \newcount\@donetotallinesR
4021
4022 % \end{macrocode}
4023 % \end{macro}
4024 % \end{macro}
4025 % \end{macro}
4026 % \end{macro}
4027 %
4028 %
4029 % \changes{v0.11.0}{2012/06/11}{Change \protect\cs{do@lineL} and \protect\cs{do@lineR} to allow line numbering by pstart (like in eledmac 0.15).}
4030 % \changes{v1.8.0}{2014/08/05}{Change \protect\cs{do@lineR} and \protect\cs{do@lineR} to allow new sectioning commands.}
4031 % \begin{macro}{\do@lineL}
4032 % \changes{v1.8.1}{2014/08/07}{Fix a bug with critical notes a the beginning of a page, (maybe added by v1.8.0) (?).}
4033 % The \protect\cs{do@lineL} macro is called to
4034 % do all the processing for a single line of left text.
4035 % \changes{v0.3.0}{2005/02/10}{Added \protect\cs{do@lineLhook} to \protect\cs{do@lineL}}
4036 % \changes{v0.3.0}{2005/02/10}{Simplified \protect\cs{do@lineL} by using macros for
4037 % some common code}
4038 % \begin{macrocode}
4039 \newcommand*{\do@lineL}{%
4040 \letcs{\ifnumberpstart}{numberpstart@L\the\l@dpscL}%
4041 \letcs{\ifnumberline}{numberline@L\the\l@dpscL}%
4042 \letcs{\iflinenumannotationotherside}{linenumannotationotherside@L\the\l@dpscL}%
4043 \advance\countLline \@ne%
4044 \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}%
4045 {\vbadness=10000%
4046 \splittopskip=\z@%
4047 \do@lineLhook%
4048 \l@demptyd@ta%
4049 \global\setbox\one@line=\vsplit\namebox{l@dLcolrawbox\the\l@dpscL}%
4050 to\baselineskip}%
4051 \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startL}{}%
4052 \unvbox\one@line \global\setbox\one@line=\lastbox%
4053 \@writepageofparL%
4054 \getline@numL%
4055 \ifnum\@lock>\@ne%
4056 \inserthangingsymboltrue%
4057 \else%
4058 \inserthangingsymbolfalse%
4059 \fi%
4060 \setbox\l@dleftbox%
4061 \hb@xt@ \Lcolwidth{%
4062 \ifl@dhidenumber%
4063 \global\l@dhidenumberfalse%
4064 \f@x@l@cks%
4065 \else%
4066 \affixline@num%
4067 \fi%
4068 \xifinlist{\the\pstarts@typeset@L}{\eled@sections@@}%
4069 {\unless\ifshiftedpstarts%
4070 \add@apparatusL%
4071 \fi%
4072 }%
4073 {\print@lineL}%
4074 }%
4075 \add@penaltiesL%
4076 \global\advance\@donereallinesL\@ne%
4077 \global\advance\@donetotallinesL\@ne%
4078 \else%
4079 \iflinenumberLevenifblank
4080 \setbox\l@dleftbox \hb@xt@ \Lcolwidth{%
4081 \new@lineL%
4082 \l@demptyd@ta%
4083 \getline@numL%
4084 \affixline@num%
4085 \l@dld@ta%
4086 \hspace*{\Lcolwidth}%
4087 \ledrlfill\l@drd@ta%
4088 }%
4089 \else%
4090 \setbox\l@dleftbox \hb@xt@ \Lcolwidth{%
4091 \ifcontinuousnumberingwithcolumns%
4092 \new@lineL%
4093 \getline@numL%
4094 \fi%
4095 \hspace*{\Lcolwidth}%
4096 }%
4097 \fi%
4098 \global\advance\@donetotallinesL\@ne%
4099 \fi%
4100 }%
4101
4102
4103 % \end{macrocode}
4104 % \end{macro}
4105 %
4106 % \begin{macro}{\print@lineL}
4107 % \protect\cs{print@lineL} is for lines without a sectioning command. See \macpackage definition of \protect\cs{print@line} for handbook.
4108 % \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
4109 % \begin{macrocode}
4110 \def\print@lineL{%
4111 \affixpstart@numL%
4112 \l@dld@ta%
4113 \add@apparatusL%
4114 \l@dlsn@te%
4115 \do@insidelineLhook%
4116 \csuse{insidethis@\the\absline@num @\the\section@num}%
4117 \global\csundef{insidethis@\the\absline@num @\the\section@num}%
4118 \hb@xt@ \Lcolwidth{\ledllfill\hb@xt@ \wd\one@line{%
4119 \ifluatex%
4120 \textdir\l@luatextextdir@L%
4121 \fi%
4122 \new@lineL%
4123 \inserthangingsymbolL%
4124 \l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta%
4125 \l@drsn@te}}%
4126
4127 % \end{macrocode}
4128 % \end{macro}
4129 % \begin{macro}{\print@eledsectionL}
4130 % \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
4131 % \changes{v1.12.1}{2015/02/27}{Fix bug with \LuaLaTeX\ RTL \protect\cs{eledsection}.}
4132 % \protect\cs{print@eledsectionL} is for line with macro code.
4133 % \begin{macrocode}
4134 \def\print@eledsectionL{%%
4135 \disable@edindex%
4136 \addtocounter{pstartL}{-1}%
4137 \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{}
4138 \ifdefstring{\@eledsectmark}{L}{}{\ledsectnomark}
4139 \numdef{\temp@}{\pstarts@typeset@L-1}%
4140 \xifinlist{\temp@}{\eled@sections@@}{\@nobreaktrue}{\@nobreakfalse}%
4141 \@eled@sectioningtrue%
4142 \bgroup%
4143 \ifluatex%
4144 \textdir\l@luatextextdir@L%
4145 \pardir\l@luatexpardir@L%
4146 \bodydir\l@luatexbodydir@L%
4147 \ifdefstring{\l@luatextextdir@L}{TRT}{\@RTLtrue}{}%
4148 \fi%
4149 \csuse{eled@sectioning@\the\pstarts@typeset@L}%
4150 \egroup%
4151 \@eled@sectioningfalse%
4152 \global\csundef{eled@sectioning@\the\pstarts@typeset@L}%
4153 \if@RTL%
4154 \hspace{-3\paperwidth}%
4155 {\hbox{\l@dunhbox@line{\one@line}} \new@line}%
4156 \else%
4157 \hspace{3\paperwidth}%
4158 {\new@line \hbox{\l@dunhbox@line{\one@line}}}%
4159 \fi%
4160 \vskip\eledsection@correcting@skip%
4161 \restore@edindex%
4162 }
4163
4164 % \end{macrocode}
4165 % \end{macro}
4166 % \begin{macro}{\add@apparatusL}
4167 % The \cs{add@apparatusL} macro adds apparatus for the left lines, apparatus is both footnotes and sidenotes.
4168 % \begin{macrocode}
4169 \newcommand{\add@apparatusL}{%
4170 \if@firstlineofpage%
4171 \set@Xtxtbeforenotes%
4172 \set@txtbeforenotesX%
4173 \global\@firstlineofpagefalse%
4174 \fi%
4175 \ifdefstring{\ms@data@position}{msdata-regular}{%
4176 \insert@msdata%
4177 \add@inserts%
4178 \add@Xgroupbyline%
4179 }{%
4180 \add@inserts%
4181 \add@Xgroupbyline%
4182 \insert@msdata%
4183 }%
4184 \affixside@note%
4185 }%
4186 % \end{macrocode}
4187 % \end{macro}
4188 % \begin{macro}{\dolineLhook}
4189 % \begin{macro}{\dolineRhook}
4190 % \begin{macro}{\doinsidelineLhook}
4191 % \begin{macro}{\doinsidelineRhook}
4192 % \changes{v1.8.3}{2014/08/31}{Added \protect\cs{dolineLhook}, \protect\cs{dolineRhook}, \protect\cs{doinsidelineLhook} and \protect\cs{doinsidelineRhook}}
4193 % These high-level commands just redefine the low-level commands.
4194 % They have to be used by user, without \protect\cs{makeatletter}.
4195 % \begin{macrocode}
4196 \newcommand*{\dolineLhook}[1]{\gdef\do@lineLhook{#1}}%
4197 \newcommand*{\dolineRhook}[1]{\gdef\do@lineRhook{#1}}%
4198 \newcommand*{\doinsidelineLhook}[1]{\gdef\do@insidelineLhook{#1}}%
4199 \newcommand*{\doinsidelineRhook}[1]{\gdef\do@insidelineRhook{#1}}%
4200
4201 % \end{macrocode}
4202 % \end{macro}
4203 % \end{macro}
4204 % \end{macro}
4205 % \end{macro}
4206 % \changes{v0.3.0}{2005/02/10}{Added \protect\cs{do@lineLhook} and \protect\cs{do@lineRhook}}
4207 % \changes{v1.4.0}{2013/07/11}{Added \protect\cs{do@insidelineLhook} and \protect\cs{do@insidelineRhook}}
4208 % \begin{macro}{\do@lineLhook}
4209 % \begin{macro}{\do@lineRhook}
4210 % \begin{macro}{\do@insidelineLhook}
4211 % \begin{macro}{\do@insidelineRhook}
4212 % Hooks, initially empty, into the respective \protect\cs{do@line(L/R)} macros.
4213 % \begin{macrocode}
4214 \newcommand*{\do@lineLhook}{}
4215 \newcommand*{\do@lineRhook}{}
4216 \newcommand*{\do@insidelineLhook}{}
4217 \newcommand*{\do@insidelineRhook}{}
4218
4219 % \end{macrocode}
4220 % \end{macro}
4221 % \end{macro}
4222 % \end{macro}
4223 % \end{macro}
4224 % \begin{macro}{\do@lineR}
4225 % The \protect\cs{do@lineR} macro is called to
4226 % do all the processing for a single line of right text.
4227 % \changes{v0.3.0}{2005/02/10}{Changed \protect\cs{do@lineR} similarly to \protect\cs{do@lineL}}
4228 % \changes{v1.8.1}{2014/08/07}{Fix a bug with critical notes a the beginning of a page, added by v1.8.0 (?).}
4229 % \begin{macrocode}
4230 \newcommand*{\do@lineR}{%
4231 \let\linenumrepL\linenumrep%
4232 \let\sublinenumrepL\sublinenumrep%
4233 \let\linenumrep\linenumrepR%
4234 \let\sublinenumrep\sublinenumrepR%
4235 \letcs{\ifnumberpstart}{numberpstart@R\the\l@dpscR}%
4236 \letcs{\ifnumberline}{numberline@R\the\l@dpscR}%
4237 \letcs{\iflinenumannotationotherside}{linenumannotationotherside@R\the\l@dpscR}%
4238 \ledRcol@true%
4239 \advance\countRline \@ne%
4240 \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}%
4241 {\vbadness=10000%
4242 \splittopskip=\z@%
4243 \do@lineRhook%
4244 \l@demptyd@ta%
4245 \global\setbox\one@lineR=\vsplit\namebox{l@dRcolrawbox\the\l@dpscR}%
4246 to\baselineskip}%
4247 \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startR}{}%
4248 \unvbox\one@lineR \global\setbox\one@lineR=\lastbox%
4249 \@writepageofparR%
4250 \getline@numR%
4251 \ifnum\@lockR>\@ne%
4252 \inserthangingsymbolRtrue%
4253 \else%
4254 \inserthangingsymbolRfalse%
4255 \fi%
4256 \setbox\l@drightbox%
4257 \hb@xt@ \Rcolwidth{%
4258 \ifl@dhidenumber%
4259 \global\l@dhidenumberfalse%
4260 \f@x@l@cksR%
4261 \else%
4262 \affixline@numR%
4263 \fi%
4264 \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}%
4265 {\unless\ifshiftedpstarts%
4266 \add@apparatusR%
4267 \fi%
4268 }%
4269 {\print@lineR}%
4270 }%
4271 \add@penaltiesR%
4272 \global\advance\@donereallinesR\@ne%
4273 \global\advance\@donetotallinesR\@ne%
4274 \else%
4275 \iflinenumberRevenifblank%
4276 \setbox\l@drightbox \hb@xt@ \Rcolwidth{%
4277 \new@lineR%
4278 \l@demptyd@ta%
4279 \getline@numR%
4280 \affixline@numR%
4281 \l@dld@ta%
4282 \hspace*{\Rcolwidth}%
4283 \ledrlfill\l@drd@ta%
4284 }%
4285 \else%
4286 \setbox\l@drightbox \hb@xt@ \Rcolwidth{%
4287 \ifcontinuousnumberingwithcolumns%
4288 \new@lineR%
4289 \getline@numR%
4290 \fi%
4291 \hspace*{\Rcolwidth}%
4292 }%
4293 \fi%
4294 \global\advance\@donetotallinesR\@ne%
4295 \fi%
4296 \ledRcol@false%
4297 \let\linenumrep\linenumrepL%
4298 \let\sublinenumrep\sublinenumrepL%
4299 }
4300
4301
4302 % \end{macrocode}
4303 % \end{macro}
4304 %
4305 % \begin{macro}{\print@lineR}{}
4306 % \begin{macro}{\print@eledsectionR}{}
4307 % \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
4308 \def\print@lineR{%
4309 \affixpstart@numR%
4310 \l@dld@ta%
4311 \add@apparatusR%
4312 \l@dlsn@te%
4313 \do@insidelineRhook%
4314 \csuse{insidethisR@\the\absline@numR @\the\section@numR}%
4315 \global\csundef{insidethisR@\the\absline@numR @\the\section@numR}%
4316 \hb@xt@ \Rcolwidth{\ledllfill\hb@xt@ \wd\one@lineR{%
4317 \new@lineR%
4318 \inserthangingsymbolR%
4319 \ifluatex%
4320 \textdir\l@luatextextdir@R%
4321 \fi%
4322 \l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta%
4323 \l@drsn@te%
4324 }%
4325 }
4326
4327 \def\print@eledsectionR{%
4328 \disable@edindex%
4329 \addtocounter{pstartR}{-1}%
4330 \set@sectcountR%
4331 \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{}%
4332 \ifdefstring{\@eledsectmark}{R}{}{\ledsectnomark}%
4333 \numdef{\temp@}{\l@dpscR-1}%
4334 \xifinlist{\temp@}{\eled@sectionsR@@}{\@nobreaktrue}{\@nobreakfalse}%
4335 \@eled@sectioningtrue%
4336 \bgroup%
4337 \ifluatex%
4338 \textdir\l@luatextextdir@R%
4339 \pardir\l@luatexpardir@R%
4340 \bodydir\l@luatexbodydir@R%
4341 \ifdefstring{\l@luatextextdir@L}{TRT}{\@RTLtrue}{}%
4342 \fi%
4343 \csuse{eled@sectioning@\the\l@dpscR R}%
4344 \egroup%
4345 \@eled@sectioningfalse%
4346 \global\csundef{eled@sectioning@\the\l@dpscR R}%
4347 \if@RTL%
4348 \hspace{-3\paperwidth}%
4349 {\hbox{\l@dunhbox@line{\one@lineR}} \new@lineR}%
4350 \else%
4351 \hspace{3\paperwidth}%
4352 {\new@lineR \hbox{\l@dunhbox@line{\one@lineR}}}%
4353 \fi%
4354 \vskip\eledsection@correcting@skip%
4355 \restore@edindex%
4356 }
4357 % \end{macro}
4358 % \end{macro}
4359 %
4360 % \begin{macro}{\add@apparatusR}
4361 % The \cs{add@apparatusR} macro adds apparatus for the right lines, apparatus is both footnotes and sidenotes.
4362 % \begin{macrocode}
4363 \newcommand{\add@apparatusR}{%
4364 \if@firstlineofpageR%
4365 \set@Xtxtbeforenotes%
4366 \set@txtbeforenotesX%
4367 \global\@firstlineofpageRfalse%
4368 \fi%
4369 \ifdefstring{\ms@data@position}{msdata-regular}{%
4370 \insert@msdata%
4371 \add@insertsR%
4372 \add@Xgroupbyline%
4373 }{%
4374 \add@insertsR%
4375 \add@Xgroupbyline%
4376 \insert@msdata%
4377 }%
4378 \affixside@noteR%
4379 }%
4380 % \end{macrocode}
4381 % \end{macro}
4382 % \subsection{Line and page number computation}
4383 %
4384 % \begin{macro}{\getline@numR}
4385 % The \protect\cs{getline@numR} macro
4386 % determines the page and line numbers for the right text line we are about to
4387 % send to the vertical list. The \protect\cs{getline@numL} is the same for left text.
4388 %
4389 % \begin{macrocode}
4390 \newcommand*{\getline@numR}{%
4391 \global\advance\absline@numR \@ne
4392 \do@actionsR
4393 \do@ballastR
4394 \ifledgroupnotesR@\else
4395 \ifnumberline
4396 \ifsublines@R
4397 \ifnum\sub@lockR<\tw@
4398 \global\advance\subline@numR \@ne
4399 \fi
4400 \else
4401 \ifnum\@lockR<\tw@
4402 \global\advance\line@numR \@ne
4403 \global\subline@numR \z@
4404 \fi
4405 \fi
4406 \fi
4407 \fi
4408 }
4409 \newcommand*{\getline@numL}{%
4410 \global\advance\absline@num \@ne
4411 \do@actions
4412 \do@ballast
4413 \ifledgroupnotesL@\else
4414 \ifnumberline
4415 \ifsublines@
4416 \ifnum\sub@lock<\tw@
4417 \global\advance\subline@num \@ne
4418 \fi
4419 \else
4420 \ifnum\@lock<\tw@
4421 \global\advance\line@num \@ne
4422 \global\subline@num \z@
4423 \fi
4424 \fi
4425 \fi
4426 \fi
4427 }
4428
4429
4430 % \end{macrocode}
4431 % \end{macro}
4432 %
4433 % \begin{macro}{\do@ballastR}
4434 % \relax
4435 % The real work in the line macros above is done in \protect\cs{do@actions}, but
4436 % before we plunge into that, let is get \protect\cs{do@ballastR} out of the
4437 % way.
4438 % \begin{macrocode}
4439 \newcommand*{\do@ballastR}{\global\ballast@count=\z@
4440 \begingroup
4441 \advance\absline@numR \@ne
4442 \ifnum\next@actionlineR=\absline@numR
4443 \ifnum\next@actionR>-1001
4444 \global\advance\ballast@count by -\c@ballast
4445 \fi
4446 \fi
4447 \endgroup}
4448 % \end{macrocode}
4449 % \end{macro}
4450 %
4451 %
4452 % \begin{macro}{\l@dskipversenumberR}
4453 % \begin{macro}{\do@actionsR}
4454 % \begin{macro}{\do@actions@fixedcodeR}
4455 % \begin{macro}{\do@actions@nextR}
4456 %
4457 % The \protect\cs{do@actionsR} macro
4458 % looks at the list of actions to take at particular right text absolute line
4459 % numbers, and does everything that is specified for the current line.
4460 %
4461 % It may call itself recursively and we use tail recursion, via
4462 % \protect\cs{do@actions@nextR} for this.
4463 % \changes{v0.3.0}{2005/02/24}{Used \protect\cs{do@actions@fixedcode} in \protect\cs{do@actionsR}}
4464 % \changes{v1.15.0}{2015/04/13}{Add actions 1008 and 1009}
4465 % \changes{v2.10.0}{2016/06/02}{Add action 1010}
4466 % \begin{macrocode}
4467
4468 \newif\ifl@dskipversenumberR
4469 \newcommand*{\do@actions@fixedcodeR}{%
4470 \ifcase\@l@dtempcnta%
4471 \or% % 1001 = starting sublineation
4472 \global\sublines@Rtrue
4473 \or% % 1002 = ending sublineation
4474 \global\sublines@Rfalse
4475 \or% % 1003 = starting locking number
4476 \ifnum\@lockR=\thr@@% If there was a \endlock (implicit or explicit) just before
4477 \global\@lockR=\tw@%
4478 \else%
4479 \global\@lockR=\@ne%
4480 \fi%
4481 \or% % 1004 = ending locking number
4482 \ifnum\@lockR=\tw@
4483 \global\@lockR=\thr@@
4484 \else
4485 \global\@lockR=\z@
4486 \fi
4487 \or% % 1005 = starting locking subnumber
4488 \global\sub@lockR=\@ne
4489 \or% % 1006 = ending locking subnumber
4490 \ifnum\sub@lockR=\tw@
4491 \global\sub@lockR=\thr@@
4492 \else
4493 \global\sub@lockR=\z@
4494 \fi
4495 \or% % 1007 = skipping numbering
4496 \l@dskipnumbertrue
4497 \or% % 1008 = skipping numbering in stanza
4498 \l@dskipversenumberRtrue%
4499 \or% % 1009 = hiding number
4500 \l@dhidenumbertrue%
4501 \or% % 1010 = inserting msdata
4502 \add@msdata%
4503 \else%
4504 \led@warn@BadAction
4505 \fi%
4506 }
4507
4508
4509 \newcommand*{\do@actionsR}{%
4510 \global\let\do@actions@nextR=\relax
4511 \@l@dtempcntb=\absline@numR
4512 \ifnum\@l@dtempcntb<\next@actionlineR\else
4513 \ifnum\next@actionR>-1001\relax
4514 \ifboolexpr{%
4515 bool{resumenumberingR@start}%
4516 and test {\ifdimgreater{\pagedepth}{\z@}}%
4517 }%
4518 {}%
4519 {\@firstlineofpageRtrue}%
4520 \global\page@numR=\next@actionR
4521 \ifcsdef{reset@lineR\the\absline@numR @\the\section@numR}%
4522 {%
4523 \global\line@numR=\z@ \global\subline@numR=\z@%
4524 }%
4525 {}%
4526 \global\resumenumberingR@startfalse%
4527 \add@msdata@firstlineofpage%
4528 \else
4529 \ifnum\next@actionR<-4999\relax%
4530 \@l@dtempcnta=-\next@actionR
4531 \advance\@l@dtempcnta by -5001\relax
4532 \ifsublines@R
4533 \global\subline@numR=\@l@dtempcnta
4534 \else
4535 \global\line@numR=\@l@dtempcnta
4536 \fi
4537 \else
4538 \@l@dtempcnta=-\next@actionR
4539 \advance\@l@dtempcnta by -1000\relax
4540 \do@actions@fixedcodeR
4541 \fi
4542 \fi
4543 \ifx\actionlines@listR\empty
4544 \gdef\next@actionlineR{1000000}%
4545 \else
4546 \gl@p\actionlines@listR\to\next@actionlineR
4547 \gl@p\actions@listR\to\next@actionR
4548 \global\let\do@actions@nextR=\do@actionsR
4549 \fi
4550 \fi
4551 \do@actions@nextR}
4552
4553 % \end{macrocode}
4554 % \end{macro}
4555 % \end{macro}
4556 % \end{macro}
4557 % \end{macro}
4558 %
4559 % \subsection{Line number printing}
4560 %
4561 % \begin{macro}{\l@dcalcnum}
4562 % \begin{macro}{\ch@cksub@l@ckR}
4563 % \begin{macro}{\ch@ck@l@ckR}
4564 % \begin{macro}{\f@x@l@cksR}
4565 % \begin{macro}{\affixline@numR}
4566 % \protect\cs{affixline@numR} is the right text version of the
4567 % \protect\cs{affixline@num} macro.
4568 % \changes{v0.3.0}{2005/02/24}{Changed \protect\cs{affixline@numR} to match new eledmac}
4569 % \changes{v0.11.0}{2012/06/11}{Changed \protect\cs{affixline@numR} to allow to disable line numbering (like in eledmac 0.15).}
4570 % \begin{macrocode}
4571
4572 \newcommand*{\l@dcalcnum}[3]{%
4573 \ifnum #1 > #2\relax
4574 \@l@dtempcnta = #1\relax
4575 \advance\@l@dtempcnta by -#2\relax
4576 \divide\@l@dtempcnta by #3\relax
4577 \multiply\@l@dtempcnta by #3\relax
4578 \advance\@l@dtempcnta by #2\relax
4579 \else
4580 \@l@dtempcnta=#2\relax
4581 \fi}
4582
4583 \newcommand*{\ch@cksub@l@ckR}{%
4584 \ifcase\sub@lockR
4585 \or
4586 \ifnum\sublock@disp=\@ne
4587 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
4588 \fi
4589 \or
4590 \ifnum\sublock@disp=\tw@
4591 \else
4592 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
4593 \fi
4594 \or
4595 \ifnum\sublock@disp=\z@
4596 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
4597 \fi
4598 \fi}
4599
4600 \newcommand*{\ch@ck@l@ckR}{%
4601 \ifcase\@lockR
4602 \or
4603 \ifnum\lock@disp=\@ne
4604 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
4605 \fi
4606 \or
4607 \ifnum\lock@disp=\tw@
4608 \else
4609 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
4610 \fi
4611 \or
4612 \ifnum\lock@disp=\z@
4613 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
4614 \fi
4615 \fi}
4616
4617 \newcommand*{\f@x@l@cksR}{%
4618 \ifcase\@lockR
4619 \or
4620 \global\@lockR \tw@
4621 \or \or
4622 \global\@lockR \z@
4623 \fi
4624 \ifcase\sub@lockR
4625 \or
4626 \global\sub@lockR \tw@
4627 \or \or
4628 \global\sub@lockR \z@
4629 \fi}
4630
4631
4632 \let\linenumberlistR\empty%
4633 \newcommand*{\affixline@numR}{%
4634 \ifledgroupnotesR@\else\ifnumberline
4635 \ifl@dskipnumber
4636 \global\l@dskipnumberfalse
4637 \else
4638 \ifsublines@R
4639 \@l@dtempcntb=\subline@numR
4640 \l@dcalcnum{\subline@numR}{\c@firstsublinenumR}{\c@sublinenumincrementR}%
4641 \ch@cksub@l@ckR
4642 \else
4643 \@l@dtempcntb=\line@numR
4644 \ifx\linenumberlistR\empty%
4645 \l@dcalcnum{\line@numR}{\c@firstlinenumR}{\c@linenumincrementR}%
4646 \else
4647 \@l@dtempcnta=\line@numR
4648 \edef\rem@inderR{,\linenumberlistR,\number\line@numR,}%
4649 \edef\sc@n@list{\def\noexpand\sc@n@list
4650 ####1,\number\@l@dtempcnta,####2|{\def\noexpand\rem@inderR{####2}}}%
4651 \sc@n@list\expandafter\sc@n@list\rem@inderR|%
4652 \ifx\rem@inderR\empty\advance\@l@dtempcnta\@ne\fi%
4653 \fi
4654 \ch@ck@l@ckR
4655 \fi
4656 \ifnum\@l@dtempcnta=\@l@dtempcntb
4657 \ifl@dskipversenumberR\else
4658 \if@twocolumn
4659 \if@firstcolumn
4660 \gdef\l@dld@ta{\llap{{\leftlinenumR}}}%
4661 \iflinenumannotationotherside%
4662 \gdef\l@drd@ta{\rlap{{\rightlinenumannotationR}}}%
4663 \fi%
4664 \else
4665 \gdef\l@drd@ta{\rlap{{\rightlinenumR}}}%
4666 \iflinenumannotationotherside%
4667 \gdef\l@dld@ta{\llap{{\leftlinenumannotationR}}}%
4668 \fi%
4669 \fi
4670 \else
4671 \ifboolexpr{bool {l@dprintingcolumns} and test {\ifnumgreater{\line@margin@columnsR}{\m@ne}}}%
4672 {\@l@dtempcntb=\line@margin@columnsR}%
4673 {\@l@dtempcntb=\line@marginR}%
4674 \ifnum\@l@dtempcntb>\@ne
4675 \advance\@l@dtempcntb by \numexpr\csuse{@page@forlineR@\the\section@numR @\the\absline@numR}+0\relax%
4676 \fi
4677 \ifboolexpr{%
4678 bool {l@dprintingcolumns}%
4679 and (%
4680 (test {\ifdefstring{\linenum@OnlyPages@ForColumnsR}{left}}%
4681 and test {\ifnumodd{\csuse{@page@forlineR@\the\section@numR @\the\absline@numR}+0}}%
4682 )%
4683 or%
4684 (test {\ifdefstring{\linenum@OnlyPages@ForColumnsR}{right}}%
4685 and not test {\ifnumodd{\csuse{@page@forlineR@\the\section@numR @\the\absline@numR}+0}}%
4686 )%
4687 )%
4688 }%
4689 {}%
4690 {%
4691 \ifodd\@l@dtempcntb%
4692 \gdef\l@drd@ta{\rlap{{\rightlinenumR}}}%
4693 \iflinenumannotationotherside%
4694 \gdef\l@dld@ta{\llap{{\leftlinenumannotationR}}}%
4695 \fi%
4696 \else%
4697 \gdef\l@dld@ta{\llap{{\leftlinenumR}}}%
4698 \iflinenumannotationotherside%
4699 \gdef\l@drd@ta{\rlap{{\rightlinenumannotationR}}}%
4700 \fi%
4701 \fi%
4702 }%
4703 \fi
4704 \fi
4705 \fi
4706 \f@x@l@cksR
4707 \fi
4708 \fi
4709 \fi}
4710 % \end{macrocode}
4711 % \end{macro}
4712 % \end{macro}
4713 % \end{macro}
4714 % \end{macro}
4715 % \end{macro}
4716 % \subsection{Pstart number printing in side}
4717 % The printing of the pstart number is like in \macpackage, with two differences:
4718 %\begin{itemize}
4719 %\item Some commands have versions suffixed by R or L.
4720 %\item The \protect\cs{affixpstart@num} and \protect\cs{affixpstart@numR} commands are called in the \protect\cs{Pages} command. Consequently, the \verb|pstartL| and \verb|pstartR| counters must be reset at the beginning of this command.
4721 %\end{itemize}
4722 % \begin{macro}{\affixpstart@numL}
4723 % \begin{macro}{\affixpstart@numR}
4724 % \begin{macro}{\leftpstartnumR}
4725 % \begin{macro}{\rightpstartnumR}
4726 % \begin{macro}{\leftpstartnumL}
4727 % \begin{macro}{\rightpstartnumL}
4728 % \begin{macro}{\ifpstartnumR}
4729 % \begin{macrocode}
4730
4731 \newcommand*{\affixpstart@numL}{%
4732 \ifsidepstartnum
4733 \if@twocolumn
4734 \if@firstcolumn
4735 \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}%
4736 \else
4737 \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}%
4738 \fi
4739 \else
4740 \ifboolexpr{bool {l@dprintingcolumns} and test {\ifnumgreater{\line@margin@columns}{\m@ne}}}%
4741 {\@l@dtempcntb=\line@margin@columns}%
4742 {\@l@dtempcntb=\line@margin}%
4743 \ifnum\@l@dtempcntb>\@ne
4744 \advance\@l@dtempcntb \page@num
4745 \fi
4746 \ifodd\@l@dtempcntb
4747 \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}%
4748 \else
4749 \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}%
4750 \fi
4751 \fi
4752 \fi
4753 }
4754 \newcommand*{\affixpstart@numR}{%
4755 \ifsidepstartnum
4756 \if@twocolumn
4757 \if@firstcolumn
4758 \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}%
4759 \else
4760 \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}%
4761 \fi
4762 \else
4763 \ifboolexpr{bool {l@dprintingcolumns} and test {\ifnumgreater{\line@margin@columnsR}{\m@ne}}}%
4764 {\@l@dtempcntb=\line@margin@columnsR}%
4765 {\@l@dtempcntb=\line@marginR}%
4766 \ifnum\@l@dtempcntb>\@ne
4767 \advance\@l@dtempcntb \page@numR
4768 \fi
4769 \ifodd\@l@dtempcntb
4770 \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}%
4771 \else
4772 \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}%
4773 \fi
4774 \fi
4775 \fi
4776 }
4777
4778 \newcommand*{\leftpstartnumL}{
4779 \ifpstartnum
4780 \thepstartL
4781 \kern\linenumsep\global\pstartnumfalse\fi
4782 }
4783 \newcommand*{\rightpstartnumL}{
4784 \ifpstartnum\kern\linenumsep
4785 \thepstartL
4786 \global\pstartnumfalse\fi
4787 }
4788 \newif\ifpstartnumR
4789 \pstartnumRtrue
4790 \newcommand*{\leftpstartnumR}{
4791 \ifpstartnumR
4792 \thepstartR
4793 \kern\linenumsep\global\pstartnumRfalse\fi
4794 }
4795 \newcommand*{\rightpstartnumR}{
4796 \ifpstartnumR\kern\linenumsep
4797 \thepstartR
4798 \global\pstartnumRfalse\fi
4799 }
4800 % \end{macrocode}
4801 % \end{macro}
4802 % \end{macro}
4803 % \end{macro}
4804 % \end{macro}
4805 % \end{macro}
4806 % \end{macro}
4807 % \end{macro}
4808 % \subsection{Add insertions to the vertical list}
4809 %
4810 % \begin{macro}{\inserts@listR}
4811 % \protect\cs{inserts@listR} is the list macro that contains the inserts that
4812 % we save up for one right text paragraph.
4813 %
4814 % \begin{macrocode}
4815 \list@create{\inserts@listR}
4816 % \end{macrocode}
4817 % \end{macro}
4818 %
4819 %
4820 % \begin{macro}{\add@insertsR}
4821 % \begin{macro}{\add@inserts@nextR}
4822 % The right text version.
4823 % \begin{macrocode}
4824 \newcommand*{\add@insertsR}{%
4825 \global\let\add@inserts@nextR=\relax
4826 \ifx\inserts@listR\empty \else
4827 \ifx\next@insertR\empty
4828 \ifx\insertlines@listR\empty
4829 \global\noteschanged@true
4830 \gdef\next@insertR{100000}%
4831 \else
4832 \gl@p\insertlines@listR\to\next@insertR
4833 \fi
4834 \fi
4835 \ifnum\next@insertR=\absline@numR
4836 \gl@p\inserts@listR\to\@insertR
4837 \@insertR
4838 \global\let\@insertR=\undefined
4839 \global\let\next@insertR=\empty
4840 \global\let\add@inserts@nextR=\add@insertsR
4841 \fi
4842 \fi
4843 \add@inserts@nextR}
4844
4845 % \end{macrocode}
4846 % \end{macro}
4847 % \end{macro}
4848 %
4849 % \subsection{Penalties}
4850 %
4851 % \begin{macro}{\add@penaltiesL}
4852 % \begin{macro}{\add@penaltiesR}
4853 % \protect\cs{add@penaltiesL} is
4854 % the last macro used by \protect\cs{do@lineL}. It adds up the club,
4855 % widow, and interline penalties, and puts a single penalty
4856 % of the appropriate size
4857 % back into the paragraph; these penalties get
4858 % removed by the \protect\cs{vsplit} operation. \protect\cs{displaywidowpenalty} and
4859 % \protect\cs{brokenpenalty} are not restored, since we have no easy way to
4860 % find out where we should insert them.
4861 %
4862 % \label{add@penalties}
4863 % In the code below, which is a virtual copy of the original
4864 % \protect\cs{add@penalties}, \protect\cs{num@lines} is the number of lines in the whole
4865 % paragraph, and \protect\cs{par@line} is the line we are working on at the
4866 % moment. The count \protect\cs{@l@dtempcnta} is used to calculate and
4867 % accumulate the penalty; it is initially set to the value of
4868 % \protect\cs{ballast@count}, which has been worked out in \protect\cs{do@ballast}.
4869 % Finally, the penalty is
4870 % checked to see that it does not go below $-10000$.
4871 % \begin{verbatim}
4872 % \newcommand*{\add@penaltiesR}{\@l@dtempcnta=\ballast@count
4873 % \ifnum\num@linesR>\@ne
4874 % \global\advance\par@lineR \@ne
4875 % \ifnum\par@lineR=\@ne
4876 % \advance\@l@dtempcnta by \clubpenalty
4877 % \fi
4878 % \@l@dtempcntb=\par@lineR \advance\@l@dtempcntb \@ne
4879 % \ifnum\@l@dtempcntb=\num@linesR
4880 % \advance\@l@dtempcnta by \widowpenalty
4881 % \fi
4882 % \ifnum\par@lineR<\num@linesR
4883 % \advance\@l@dtempcnta by \interlinepenalty
4884 % \fi
4885 % \fi
4886 % \ifnum\@l@dtempcnta=\z@
4887 % \relax
4888 % \else
4889 % \ifnum\@l@dtempcnta>-10000
4890 % \penalty\@l@dtempcnta
4891 % \else
4892 % \penalty -10000
4893 % \fi
4894 % \fi}
4895 % \end{verbatim}
4896 % This is for a single chunk. However, as we are probably dealing
4897 % with several chunks at a time, the above is nor really relevant. Peter Wilson thinks
4898 % that it is likely with parallel text that there is no real need to add
4899 % back any penalties; even if there was, they would have to match across the
4900 % left and right lines. So, Peter Wilson ends up with the following.
4901 %
4902 % \begin{macrocode}
4903 \newcommand*{\add@penaltiesL}{}
4904 \newcommand*{\add@penaltiesR}{}
4905
4906 % \end{macrocode}
4907 % \end{macro}
4908 % \end{macro}
4909 %
4910 % \subsection{Printing leftover notes}
4911 %
4912 % \begin{macro}{\flush@notesR}
4913 % The \protect\cs{flush@notesR}
4914 % macro is called after the entire right text has been sliced up
4915 % and sent on to the vertical list.
4916 % \begin{macrocode}
4917 \newcommand*{\flush@notesR}{%
4918 \iftoggle{notfirstrun@\jobname.\extensionchars\the\section@numR R}{%
4919 \@xloop%
4920 \ifx\inserts@listR\empty \else%
4921 \gl@p\inserts@listR\to\@insertR%
4922 \@insertR%
4923 \global\let\@insertR=\undefined%
4924 \repeat%
4925 }{}%
4926 }%
4927
4928
4929 % \end{macrocode}
4930 % \end{macro}
4931 %
4932 %
4933 % \section{Footnotes}
4934 % \label{footnotes}
4935 %
4936
4937 % \subsection{Footnotes output specific to \protect\cs{Pages}}
4938 % \begin{macro}{\print@Xnotes@forpages}
4939 % \begin{macro}{\restore@Xnotes@settings}
4940 % \begin{macro}{\correct@Xfootins@box}
4941 % \begin{macro}{\print@notesX@forpages}
4942 % \begin{macro}{\restore@notesX@settings}
4943 % \begin{macro}{\correct@footinsX@box}
4944 % \changes{v1.13.1}{2015/03/12}{Correct \protect\cs{correct@footinsX@box} and \protect\cs{correct@Xfootins@box}}
4945 % \changes{v1.13.1}{2015/03/12}{Call \protect\cs{correct@footinsX@box} and \protect\cs{correct@Xfootins@box} directly in \protect\cs{print@notesX@forpages} and \protect\cs{print@Xnotes@forpages}.}
4946 % \changes{v2.11.0}{2016/06/16}{New implementation of \protect\cs{Xonlyside} and \protect\cs{onlysideX} hooks, prevent trouble with vertical spacing.}
4947 % \changes{v2.11.0}{2016/06/16}{Clarification in the handbook about the use of \protect\cs{Xonlyside} and \protect{onlysideX} and error message if mesuse.}
4948 % The \protect\cs{Xonlyside} and \protect\cs{onlysideX} hooks for \protect\cs{Pages}
4949 % allow notes to be printed either in left or right pages only.
4950 % The implementation of such features is delegated to \protect\cs{print@Xnotes@forpages},
4951 % which replaces \protect\cs{print@Xnotes} inside \protect\cs{Pages}.
4952 % Here is how we proceed\footnote{See \url{http://tex.stackexchange.com/a/230332/7712}.}:
4953 % \begin{itemize}
4954 % \item If notes are to be printed on both sides, we just proceed the usual way: print the foot starts for the series, then the foot group.
4955 % \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.
4956 % \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 do not want to print them.
4957 % 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.
4958 % \item To solve this problem, we change the magnification factor associated with notes before going to the next page.
4959 % If we start a page where no notes are supposed to be printed, the magnification counter is set to 0. The dimension associated to footnote is set to \cs{maxdimen}, and so we can keep all the notes we want, without any break inside 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, dimension and skip, read \thetexbook\ p.~122-125).
4960 % \item In the output macro of the page where notes must NOT be printed, we store the content of the footnote box produced by \TeX\ to a temporary box.
4961 % \item After going to the next page, before typesetting any thing in this page, we put the content of this temporary box the footnote insert box.
4962 % \end{itemize}
4963 % The code to print critical notes, when processing \protect\cs{Pages}, called in the output routine.
4964 % \begin{macrocode}
4965 \newcommand\print@Xnotes@forpages[1]{%
4966 % \end{macrocode}
4967 % First case: notes are for both sides. Just print the note start and the note group
4968 % \begin{macrocode}
4969 \ifcsempty{Xonlyside@#1}{%
4970 \csuse{#1footstart}{#1}%
4971 \csuse{#1footgroup}{#1}%
4972 }%
4973 % \end{macrocode}
4974 % Second case: notes are for one side only.
4975 % First test if we are in a page where they must be printed.
4976 % \begin{macrocode}
4977 {%
4978 \ifboolexpr{%
4979 ((test {\ifcsstring{Xonlyside@#1}{L}} and not test{\ifnumodd{\c@page}})%
4980 or%
4981 (test {\ifcsstring{Xonlyside@#1}{R}} and test{\ifnumodd{\c@page}}))%
4982 }%
4983 % \end{macrocode}
4984 % If we are in a page where notes must be printed, print the notes.
4985 % \begin{macrocode}
4986 {%
4987 \csuse{#1footstart}{#1}%
4988 \csuse{#1footgroup}{#1}%
4989 % \end{macrocode}
4990 % Then, set to not to keep room for notes in the next page.
4991 % Also set to that, in the next page, notes are not to be split, using \cs{maxdimen}.
4992 % \begin{macrocode}
4993 \global\count\csuse{#1footins}=\z@%
4994 \global\skip\csuse{#1footins}=\z@%
4995 \global\dimen\csuse{#1footins}=\maxdimen%
4996 }%
4997 % \end{macrocode}
4998 % In case we are on a page where notes must NOT be printed.
4999 % We reset the settings of the notes for one side.
5000 % \begin{macrocode}
5001 {%
5002 \restore@Xnotes@settings{#1}%
5003 }%
5004 % \end{macrocode}
5005 % End of \protect\cs{print@Xnotes@forpages}.
5006 % \begin{macrocode}
5007 }%
5008 }%
5009 % \end{macrocode}
5010 % The macro which restore the note settings.
5011 % \#1 = series
5012 % \begin{macrocode}
5013 \newcommand{\restore@Xnotes@settings}[1]{%
5014 \unless\ifnocritical@
5015 \global\count\csuse{#1footins}=\csuse{default@#1footins}%
5016 \global\skip\csuse{#1footins}=\csuse{Xbeforenotes@#1}%
5017 \bgroup%
5018 \csuse{Xnotefontsize@#1}%
5019 \global\dimen\csuse{#1footins}=\csuse{Xmaxhnotes@#1}%
5020 \egroup%
5021 \global\setnamebox{#1footins@kept}=\box\namebox{#1footins}%
5022 \fi
5023 }%
5024 % \end{macrocode}
5025 % And now, the same for familiar footnotes.
5026 % \begin{macrocode}
5027 \newcommand\print@notesX@forpages[1]{%
5028 \ifcsempty{onlysideX@#1}{%
5029 \csuse{footstart#1}{#1}%
5030 \csuse{footgroup#1}{#1}%
5031 }%
5032 {%
5033 \ifboolexpr{%
5034 ((test {\ifcsstring{onlysideX@#1}{L}} and not test{\ifnumodd{\c@page}})%
5035 or%
5036 (test {\ifcsstring{onlysideX@#1}{R}} and test{\ifnumodd{\c@page}}))%
5037 }%
5038 {%
5039 \csuse{footstart#1}{#1}%
5040 \csuse{footgroup#1}{#1}%
5041 \global\count\csuse{footins#1}=\z@%
5042 \global\skip\csuse{footins#1}=\z@%
5043 \global\dimen\csuse{footins#1}=\maxdimen%
5044 }%
5045 {%
5046 \restore@notesX@settings{#1}%
5047 }%
5048 }%
5049 }%
5050 \newcommand{\restore@notesX@settings}[1]{%
5051 \unless\ifnofamiliar@
5052 \global\count\csuse{footins#1}=\csuse{default@footins#1}%
5053 \global\skip\csuse{footins#1}=\csuse{beforenotesX@#1}%
5054 \bgroup%
5055 \csuse{Xnotefontsize@#1}%
5056 \global\dimen\csuse{footins#1}=\csuse{maxhnotesX@#1}%
5057 \egroup%
5058 \global\setnamebox{footins#1@kept}=\box\namebox{footins#1}%
5059 \fi
5060 }%
5061 % \end{macrocode}
5062 % \end{macro}
5063 % \end{macro}
5064 % \end{macro}
5065 % \end{macro}
5066 % \end{macro}
5067 % \end{macro}
5068 % \begin{macro}{\insert@notes@for@onlyside}
5069 % \cs{insert@notes@for@onlyside} is everytime \cs{Pages} go to the next side.
5070 % It just reinsert the notes note printed on the previous side because of \protect{Xonlyside} or \cs{onlysideX} setting.
5071 % \begin{macrocode}
5072 \newcommand{\insert@notes@for@onlyside}{%
5073 \def\do##1{%
5074 \unless\ifnocritical@%
5075 \ifvoid\csuse{##1footins@kept}\else%
5076 \expandafter\insert\csname ##1footins\endcsname%
5077 \bgroup%
5078 \unvnamebox{##1footins@kept}%
5079 \egroup%
5080 \fi%
5081 \restore@Xnotes@settings{##1}%
5082 \fi%
5083 \unless\ifnofamiliar@%
5084 \ifvoid\csuse{footins##1@kept}\else%
5085 \expandafter\insert\csname footins##1\endcsname%
5086 \bgroup%
5087 \unvnamebox{footins##1@kept}%
5088 \egroup%
5089 \fi%
5090 \restore@notesX@settings{##1}%
5091 \fi%
5092 }%
5093 \dolistloop{\@series}%
5094 }%
5095 % \end{macrocode}
5096 % \end{macro}
5097 % \subsection{Critical footnote printed in right side}
5098 % \changes{v2.12.0}{2016/07/01}{Add \protect\cs{edtextlater} and \protect\cs{edtextnow}.}
5099 % \begin{macro}{\edtext@later}
5100 % \begin{macro}{\edtext@now}
5101 % \begin{macro}{\edtextlater}
5102 % \begin{macro}{\edtextnow}
5103 % \cs{edtextlater} and \cs{edtextnow} are used to print critical footnotes on the right side, while refering to the text on the left side.
5104 % First, we create two counters, one for \cs{edtextlater} and the other for \cs{edtextnow}.
5105 % \begin{macrocode}
5106 \newcount\edtext@now%
5107 \newcount\edtext@later%
5108 % \end{macrocode}
5109 % \begin{macrocode}
5110 \newcommand{\edtextlater}[2]{%#1 lemma, #2 critical notes
5111 % \end{macrocode}
5112 % First, increase the \cs{edtext@later} counter.
5113 % \begin{macrocode}
5114 \global\advance\edtext@later by \@ne%
5115 % \end{macrocode}
5116 % \begin{macrocode}
5117 % As we are in a pseudo-\cs{edtext}, we now need to get the \cs{sameword} data stored in the auxiliary file for this \cs{edtextlater}.
5118 \advance\@edtext@level by \@ne%
5119 \ifcsvoid{sw@list@edtext@\the\@edtext@level}%
5120 {\global\let\sw@inthisedtext\empty}%
5121 {\expandafter\gl@p\csname sw@list@edtext@\the\@edtext@level\endcsname\to\sw@inthisedtext}%
5122 % \end{macrocode}
5123 % The main feature of \cs{edtextlater} is to create a macro which will be called on the equivalent \cs{edtextnow}.
5124 % \begin{macrocode}
5125 %
5126 \csxdef{edtext@later@\the\edtext@later}{%
5127 % \end{macrocode}
5128 % \cs{edtextnow} will insert a empty \cs{edtext}.
5129 % \begin{macrocode}
5130 \noexpand\edtext{%
5131 }%
5132 % \end{macrocode}
5133 % With a \cs{lemma} and \cs{linenum} defined by the current \cs{edtextlater}.
5134 % Also with \cs{sameword} data gotten from the current \cs{edtextlater}
5135 % \begin{macrocode}
5136 {%
5137 \unexpanded{%
5138 \lemma{\no@expands #1}%
5139 }%
5140 \noexpand\xxref{start:edtext:later:\the\edtext@later}{end:edtext:later:\the\edtext@later}%
5141 \noexpand\linenum{||||||\edfont@info}%
5142 \unexpanded{\def\sw@inthisedtext}{\expandonce{\sw@inthisedtext}}%
5143 % \end{macrocode}
5144 % As the \cs{edtextnow} is generally called on the other side than the corresponding \cs{edtextlater}, we need to store the side for a proper formatting of the footnote. We also need to store the pstartL / pstartR counter.
5145 % \begin{macrocode}
5146 \ifledRcol%
5147 \unexpanded{\appto\@beforeinsertofthisedtext{\ledRcol@true}}%
5148 {%
5149 \noexpand\setcounter{pstartR}{\noexpand\xpstartref{start:edtext:later:\the\edtext@later}}%
5150 }%
5151 \else%
5152 \unexpanded{\appto\@beforeinsertofthisedtext{\ledRcol@false}}%
5153 \unexpanded{\appto\@beforeinsertofthisedtext}%
5154 {%
5155 \noexpand\setcounter{pstartL}{\noexpand\xpstartref{start:edtext:later:\the\edtext@later}}%
5156 }%
5157 \fi%
5158 % \end{macrocode}
5159 % And the footnote command of this \cs{edtextlater}.
5160 % \begin{macrocode}
5161 \unexpanded{#2}%
5162 }%
5163 }%
5164 % \end{macrocode}
5165 % And now, we print the current lemma data.
5166 % But we save the beginning and the starting line using the crossref mechanism.
5167 % We also store information in the auxiliary file about the existence of a \cs{edtextlater} and, if required, about the use of a \cs{lemma}
5168 % \begin{macrocode}
5169 \edlabel{start:edtext:later:\the\edtext@later}%
5170 \flag@start@later%
5171 \bgroup%
5172 \def\lemma##1{%
5173 \ifledRcol%
5174 \write\linenum@outR{\string\@lemma}%
5175 \else%
5176 \write\linenum@out{\string\@lemma}%
5177 \fi%
5178 }%
5179 \renewcommand{\do}[1]{\expandafter\renewcommandx\csname ##1footnote\endcsname[2][1,usedefault]{}\unskip}%\unskip because of a spurious space in \newcommandx
5180 \dolistloop{\@series}%
5181 #2%
5182 \egroup%
5183 \showlemma{#1}%
5184 \edlabel{end:edtext:later:\the\edtext@later}%
5185 \flag@end@later%
5186 % \end{macrocode}
5187 % We decrease the counter increased at the beginning.
5188 % \begin{macrocode}
5189 \advance\@edtext@level by -\@ne%
5190 }%
5191 % \end{macrocode}
5192 % \cs{edtextnow} just calls the command defined as is, reading the \cs{edtext@later} list.
5193 % \begin{macrocode}
5194 \newcommand{\edtextnow}[0]{%
5195 \global\advance\edtext@now by \@ne
5196 \csuse{edtext@later@\the\edtext@now}%
5197 }%
5198 % \end{macrocode}
5199 % \end{macro}
5200 % \end{macro}
5201 % \end{macro}
5202 % \end{macro}
5203 % \section{Cross referencing}
5204 % \label{xref}
5205 %
5206 %
5207 % \begin{macro}{\labelref@listR}
5208 % Set up a new list, \protect\cs{labelref@listR}, to hold the page, line and
5209 % sub-line numbers for each label in right text.
5210 % \begin{macrocode}
5211 \list@create{\labelref@listR}
5212
5213 % \end{macrocode}
5214 % \end{macro}
5215 %
5216 %
5217 % \begin{macro}{\edlabel}
5218 % This command is defined only one time in \macpackage, including features for \parpackage.
5219 % \changes{v1.12.0}{2015/02/23}{\protect\cs{edlabel} is now defined only one time for both eledmac and eledpar}
5220 % \changes{v1.12.0}{2015/02/23}{\protect\cs{edlabel} and \protect\cs{edindex} works now with hyperref when using \protect\package{eledpar}.}
5221 % \end{macro}
5222 %
5223 % \begin{macro}{\l@dmake@labelsR}
5224 % This is the right text version of \protect\cs{l@dmake@labels}, taking account
5225 % of \protect\cs{@Rlineflag}.
5226 % \changes{v2.6.0}{2015/11/13}{\protect\cs{@Rlineflag} is not stored directly after the line number, but as a fith argument of \protect\cs{the@labelX}. Can be retrieved by \protect\cs{xflagref}.}
5227 %
5228 % \begin{macrocode}
5229 \def\l@dmake@labelsR#1|#2|#3|#4|#5|#6|#7{%
5230 \expandafter\ifx\csname the@label\csuse{XR@prefix}#7\endcsname%
5231 \relax%
5232 \else%
5233 \led@warn@DuplicateLabel{\csuse{XR@prefix}#7}%
5234 \fi%
5235 \csgdef{the@label\csuse{XR@prefix}#7}{#1|#2|#3|#4|#5|#6|\@Rlineflag}%
5236 \global\providetoggle{label@#7@ledRcol}%False is the default value of this toggle, which tells us whether a label is linked to the right or left side
5237 \global\toggletrue{label@#7@ledRcol}%
5238 \ignorespaces}
5239 \AtBeginDocument{%
5240 \def\l@dmake@labelsR#1|#2|#3|#4|#5|#6|#7{}%
5241 }
5242
5243 % \end{macrocode}
5244 % \end{macro}
5245 %
5246 %
5247 % \begin{macro}{\@lab}
5248 % The \protect\cs{@lab} command, which appears in the \protect\cs{linenum@out} file,
5249 % appends the current values of page, line and sub-line to the
5250 % \protect\cs{labelref@list}. These values are defined by the earlier
5251 % \protect\cs{@page}, \protect\cs{@nl}, and the \protect\cs{sub@on} and \protect\cs{sub@off} commands
5252 % appearing in the \protect\cs{linenum@out} file.
5253 %
5254 % It is defined on \macpackage.
5255 % \changes{v2.0.0}{2015/28/06}{\protect\cs{@lab} defined only in \eledmac.}
5256 % \end{macro}
5257 %
5258 %
5259 % \section{Sidenotes}
5260 %
5261 % Regular \verb?\marginpar?s do not work inside numbered text --- they
5262 % do not produce any note but do put an extra unnumbered blank line into
5263 % the text.
5264 % \begin{macro}{\sidenote@marginR}
5265 % \begin{macro}{\sidenotemargin*}
5266 % \begin{macro}{\sidenotemarginR}
5267 % \changes{v1.8.0}{2014/08/05}{\protect\cs{sidenotemargin} is now directly defined in \protect\package{eledmac} to be able to manage \protect\package{eledpar}.}
5268 % \changes{v1.8.0}{2014/08/05}{Add \protect\cs{sidenotemargin*}}
5269 % Specifies which margin sidenotes can be in.
5270 % \begin{macrocode}
5271 \WithSuffix\newcommand\sidenotemargin*[1]{%
5272 \l@dgetsidenote@margin{#1}
5273 \global\sidenote@marginR=\@l@dtempcntb
5274 \global\sidenote@margin=\@l@dtempcntb
5275 }
5276 \newcommand{\sidenotemarginR}[1]{%
5277 \l@dgetsidenote@margin{#1}%
5278 \global\sidenote@marginR=\@l@dtempcntb%
5279 }%
5280 \newcount\sidenote@marginR
5281 \global\sidenote@marginR=\@ne%
5282
5283 \ifmovecolumnspositiononrightpage%
5284 \sidenotemargin{inner}%
5285 \sidenotemarginR{outer}%
5286 \fi%
5287
5288 % \end{macrocode}
5289 % \end{macro}
5290 % \end{macro}
5291 % \end{macro}
5292 %
5293 % \begin{macro}{\@morespace@rightnote@leftcolumn}
5294 % \begin{macro}{\@morespace@leftnote@rightcolumn}
5295 % \begin{macro}{\get@sidenote@morespace@columns}
5296 % If we are typesetting parallel columns, we may want a left sidenote called on the right column be put on the left of the page and not on the left of the column,
5297 % and a right sidenote called on the left column be put on the right of the page and not on the right of the column. We store as an option in the \cs{if@sidenotesmarginpage} boolean.
5298 %
5299 % To do it, we need to add spaces, respectively defined on \cs{@morespace@leftnote@rightcolumn} and \cs{@morespace@rightnote@leftcolumn}.
5300 % The \cs{get@sidenote@morespace@columns} calculate there two lengths.
5301 % \begin{macrocode}
5302 \newdimen\@morespace@leftnote@rightcolumn%
5303 \newdimen\@morespace@rightnote@leftcolumn%
5304
5305
5306
5307 \newcommand{\get@sidenote@morespace@columns}{%
5308 % \end{macrocode}
5309 % The calculations are made only if \cs{if@sidenotesmarginpage} is TRUE.
5310 % \begin{macrocode}
5311 \if@sidenotesmarginpage%
5312 % \end{macrocode}
5313 % Now, we can calculate \cs{@morespace@leftnote@rightcolumn} and \cs{@morespace@rightnote@leftcolumn}.
5314 % \begin{macrocode}
5315 \global\@morespace@leftnote@rightcolumn=\dimexpr\intercolumns@width + \Lcolwidth\relax%
5316 \global\@morespace@rightnote@leftcolumn=\dimexpr\intercolumns@width + \Rcolwidth\relax%
5317 % \end{macrocode}
5318 % If \cs{if@sidenotesmarginpage} is False
5319 % \begin{macrocode}
5320 \else%
5321 \global\@morespace@leftnote@rightcolumn=\z@%
5322 \global\@morespace@rightnote@leftcolumn=\z@%
5323 % \end{macrocode}
5324 % End of \cs{get@sidenote@morespace@columns}.
5325 % \begin{macrocode}
5326 \fi%
5327 }%
5328 % \end{macrocode}
5329 % \end{macro}
5330 % \end{macro}
5331 % \end{macro}
5332 % \changes{v1.3.3}{2012/12/19}{Debugging the left notes of the right column.}
5333 % \changes{v1.3.4}{2013/07/03}{Allow use of commands in sidenotes, as introduced by eledmac 1.0.}
5334 % \changes{v1.8.0}{2014/08/05}{\protect\cs{l@dlsnote},\protect\cs{l@drsnote} and \protect\cs{l@dcsnote} defined only one time, in \protect\package{eledmac}. }
5335 % \begin{macro}{\affixside@noteR}
5336 % The right text version of \protect\cs{affixside@note}.
5337 % \changes{v1.1.2}{2012/10/06}{Remove spurious space between line number and line content}
5338 % \begin{macrocode}
5339 \newcommand*{\affixside@noteR}{%
5340 \prepare@edindex@fornote{\the\page@numR|\the\line@numR|\the\subline@numR|\the\page@numR|\the\line@numR|\the\subline@numR|}%
5341 \def\sidenotecontent@{}%
5342 \numgdef{\itemcount@}{0}%
5343 \def\do##1{%
5344 \ifnumequal{\itemcount@}{0}%
5345 {%
5346 \appto\sidenotecontent@{##1}}% Not print not separator before the 1st note
5347 {\appto\sidenotecontent@{\@sidenotesep ##1}%
5348 }%
5349 \numgdef{\itemcount@}{\itemcount@+1}%
5350 }%
5351 \dolistloop{\l@dcsnotetext}%
5352 \ifnumgreater{\itemcount@}{1}{\led@err@ManySidenotes}{}%
5353 \gdef\@templ@d{}%
5354 \gdef\@templ@n{\l@dcsnotetext\l@dcsnotetext@l\l@dcsnotetext@r}%
5355 \ifx\@templ@d\@templ@n \else%
5356 \if@twocolumn%
5357 \if@firstcolumn%
5358 \setl@dlp@rbox{##1}{\sidenotecontent@}%
5359 \else%
5360 \setl@drp@rbox{\sidenotecontent@}%
5361 \fi%
5362 \else%
5363 \@l@dtempcntb=\sidenote@marginR%
5364 \ifnum\@l@dtempcntb>\@ne%
5365 \advance\@l@dtempcntb by\page@numR%
5366 \fi%
5367 \ifodd\@l@dtempcntb%
5368 \setl@drp@rbox{\sidenotecontent@}%
5369 \gdef\sidenotecontent@{}%
5370 \numdef{\itemcount@}{0}%
5371 \dolistloop{\l@dcsnotetext@l}%
5372 \ifnumgreater{\itemcount@}{1}{\led@err@ManyLeftnotes}{}%
5373 \setl@dlp@rbox{\sidenotecontent@}%
5374 \else%
5375 \setl@dlp@rbox{\sidenotecontent@}%
5376 \gdef\sidenotecontent@{}%
5377 \numdef{\itemcount@}{0}%
5378 \dolistloop{\l@dcsnotetext@r}%
5379 \ifnumgreater{\itemcount@}{1}{\led@err@ManyRightnotes}{}%
5380 \setl@drp@rbox{\sidenotecontent@}%
5381 \fi%
5382 \fi%
5383 \fi%
5384 \advance\@edindex@fornote@\m@ne%
5385 }
5386
5387 % \end{macrocode}
5388 % \end{macro}
5389 %
5390 %
5391 % \section{Verse}
5392 %\changes{v0.11.0}{2012/06/11}{New management of hangingsymbol insertion, preventing undesirable insertions.}
5393 %\changes{v0.12.0}{2012/08/03}{New management of hangingsymbol insertion, preventing undesirable insertions.}
5394 % Like in \macpackage, the insertion of hangingsymbol is base on \protect\cs{ifinserthangingsymbol}, and, for the right side, on \protect\cs{ifinserthangingsymbolR}.
5395 % Both commands also include the hanging space, to be sure the \protect\cs{one@line} of hanging lines has the same width that the \protect\cs{one@line} of normal lines and to prevent the column separator from shifting.
5396 % \begin{macro}{\inserthangingsymbolL}
5397 % \begin{macro}{\inserthangingsymbolR}
5398 % \changes{v0.11.0}{2012/06/11}{Prevent the column separator for hanging verse from shifting}
5399 % \changes{v1.4.3}{2013/10/27}{Hanging verse is no longer automatically flush right.}
5400 % \changes{v1.15.0}{2015/04/13}{Prevent more efficiently the column separator from shifting when a verse is hanging}
5401 % \begin{macrocode}
5402 \newif\ifinserthangingsymbolR
5403 \newcommand{\inserthangingsymbolL}{%
5404 \ifinserthangingsymbol%
5405 \ifinstanzaL%
5406 \@hangingsymbol%
5407 \fi%
5408 \ifinastanzaL%
5409 \@hangingsymbol%
5410 \fi%
5411 \fi%
5412 }%
5413 \newcommand{\inserthangingsymbolR}{%
5414 \ifinserthangingsymbolR%
5415 \ifinstanzaR%
5416 \@hangingsymbol%
5417 \fi%
5418 \ifinastanzaR%
5419 \@hangingsymbol%
5420 \fi%
5421 \fi%
5422 }%
5423 % \end{macrocode}
5424 % \end{macro}
5425 % \end{macro}
5426
5427 % Before we can define the main stanza macros we need to be able to save
5428 % and reset
5429 % the category code for \&. To save the current value we use
5430 % \verb+\next+ from the \verb+\loop+ macro.
5431 % \begin{macrocode}
5432 \chardef\next=\catcode`\&
5433 \catcode`\&=\active
5434
5435 % \end{macrocode}
5436 %
5437 %
5438 %
5439 % \begin{environment}{astanza}
5440 % \changes{v1.4.1}{2013/08/16}{Enable the use of stanzaindentsrepetition within astanza environment.}
5441 % \changes{v1.13.0}{2015/03/06}{Enable the use of optional argument of \& in astanza environment.}
5442 % This is roughly an environmental form of \cs{stanza}, which treats
5443 % its stanza-like contents as a single chunk.
5444 %
5445 % \begin{macrocode}
5446 \newenvironmentx{astanza}[2][1,2,usedefault]{%
5447 \ifledRcol%
5448 \global\inastanzaRtrue%
5449 \else%
5450 \global\inastanzaLtrue%
5451 \fi%
5452 \catcode`\&\active
5453 \global\stanza@count\@ne\stanza@modulo\@ne
5454 \@advancestanzanumber%
5455 \newdimen\parindent@beforestanza%
5456 \parindent@beforestanza=\parindent%Keep in memory the standard \parindent
5457 \ifnum\usenamecount{sza@0@}=\z@
5458 \let\stanza@hang\relax
5459 \let\endlock\relax
5460 \else
5461 \rightskip\z@ plus 1fil\relax
5462 \fi
5463 \ifnum\usenamecount{szp@0@}=\z@
5464 \let\sza@penalty\relax
5465 \fi
5466 \def&{%
5467 \endlock\mbox{}%
5468 \sza@penalty
5469 \global\advance\stanza@count\@ne
5470 \@astanza@line}%
5471 \def\&{\@stopastanza}%
5472 \ifboolexpr{%
5473 not test{\ifdefvoid{\at@every@stanza}}%
5474 and test{\ifstrempty{#1}}%
5475 and test{\ifstrempty{#2}}}%
5476 {\pstart[][\at@every@stanza]\at@start@every@stanza}%
5477 {\pstart[#1][#2]\at@start@every@stanza}%
5478 \@astanza@line
5479 \@insertstanzanumber%
5480 \let\par\relax\ignorespaces%No paragraph in verses
5481 }{%
5482 \global\undef\parindent@beforestanza%
5483 }%
5484
5485 % \end{macrocode}
5486 % \end{environment}
5487 %
5488 % \begin{macro}{\@stopastanza}
5489 % This command is called by \verb+\&+ in \env{astanza} environment.
5490 % It allows optional arguments.
5491 % \begin{macrocode}
5492 \newcommandx{\@stopastanza}[2][1,2,usedefault]{%
5493 \endlock\mbox{}%
5494 \ifboolexpr{%
5495 not test{\ifdefvoid{\at@every@stop@stanza}}%
5496 and test{\ifstrempty{#1}}%
5497 and test{\ifstrempty{#2}}%
5498 }%
5499 {\before@every@stop@stanza\pend[][\at@every@stop@stanza]}%
5500 {\before@every@stop@stanza\pend[#1][#2]}%
5501 }%
5502 % \end{macrocode}
5503 % \end{macro}
5504 % \begin{macro}{\@astanza@line}
5505 % This gets put at the start of each line in the environment. It sets up
5506 % the paragraph style --- each line is treated as a paragraph.
5507 % \begin{macrocode}
5508 \newcommand*{\@astanza@line}{%
5509 \stanza@indent%
5510 \endgraf
5511 \stanza@hang%
5512 \ignorespaces}
5513
5514 % \end{macrocode}
5515 % \end{macro}
5516 %
5517 % Lastly reset the modified category codes.
5518 % \begin{macrocode}
5519 \catcode`\&=\next
5520
5521 % \end{macrocode}
5522 %
5523 % \begin{macro}{\thestanzaL}
5524 % \begin{macro}{\thestanzaR}
5525 % And now, the left and right stanza counter.
5526 % \begin{macrocode}
5527 \newcounter{stanzaL}
5528 \newcounter{stanzaR}
5529 \renewcommand{\thestanzaL}{%
5530 \textbf{\arabic{stanzaL}}%
5531 }
5532 \renewcommand{\thestanzaR}{%
5533 \textbf{\arabic{stanzaR}}%
5534 }
5535 %
5536 % \end{macrocode}
5537 % \end{macro}
5538 % \end{macro}
5539 % \section{Fixing babel and polyglossia}
5540 %
5541 % With parallel texts there is the possibility that the two sides
5542 % might use different languages via \protect\package{babel}. On the other hand,
5543 % nor \protect\package{babel} nor \protect\package{polyglossia} might not be called at all (even though it might be already
5544 % built into the format).
5545 % \changes{v0.2.0}{2004/12/20}{Added section of babel related code}
5546 %
5547 % With the normal sequential text each line is initially typeset
5548 % in the current language environment, and then it is output at which
5549 % time its attachments are typeset (in the same language environment.
5550 % In the parallel case lines are typeset in their current language but
5551 % an attachment might be typeset outside the language environment
5552 % of its line if the left and right side languages are different.
5553 % To counter this, we have to make sure that the correct language is
5554 % used at the proper times.
5555 %
5556 % \changes{v1.8.0}{2014/08/05}{Suppress \protect\cs{ifl@dsamelang} which did not work and was not logical, because both columns could have the same language but not the main language of the document.}
5557 %
5558 % \begin{macro}{\l@dchecklang}
5559 % \changes{v1.8.0}{2014/08/05}{Suppress \protect\cs{l@dchecklang} which did not work and was not logical, because both columns could have the same language but not the main language of the document.}
5560 % \end{macro}
5561 % \begin{macro}{\bbl@set@language}
5562 % In \protect\package{babel} the macro \protect\cs{bbl@set@language}\marg{lang} does the work when
5563 % the language \meta{lang} is changed via \protect\cs{selectlanguage}.
5564 % Unfortunately for us, if it is given
5565 % an argument in the form of a control sequence it strips off the \verb?\?
5566 % character rather than expanding the command. We need a version that accepts
5567 % an argument in the form \protect\cs{lang} without it stripping the \verb?\?.
5568 % \changes{v2.0.0}{2015/07/19}{Patch \protect\cs{bbl@set@language} instead of redefining it}
5569 % \begin{macrocode}
5570 \patchcmd{\bbl@set@language}%
5571 {\select@language{\languagename}}%
5572 {\edef\languagename{#1}\select@language{\languagename}}%
5573 {}%
5574 {}%
5575
5576 % \end{macrocode}
5577 % \end{macro}
5578 %
5579 % The rest of the setup has to be postponed until the end of the preamble
5580 % when we know if \protect\package{babel} or \protect\package{polyglossia} have been used or not. However, for now assume
5581 % that it has not been used.
5582 %
5583 % \begin{macro}{\selectlanguage}
5584 % \begin{macro}{\l@duselanguage}
5585 % \begin{macro}{\theledlanguageL}
5586 % \begin{macro}{\theledlanguageR}
5587 % \protect\cs{selectlanguage} is a \verb?babel? command. \protect\cs{theledlanguageL} and
5588 % \protect\cs{theledlanguageR} are the names of the languages of the left and right
5589 % texts. \protect\cs{l@duselanguage} is similar to \protect\cs{selectlanguage}.
5590 % \begin{macrocode}
5591 \newcommand*{\l@duselanguage}[1]{}
5592 \def\theledlanguageL{}%
5593 \def\theledlanguageR{}%
5594 \def\reledpar@init@language{}%Will be defined later, depending of language package (babel or polyglossia)
5595 % \end{macrocode}
5596 %
5597 % Now do the \protect\package{babel} or \protect\package{polyglossia} fix or, if necessary.
5598 % \begin{macrocode}
5599 \AtBeginDocument{%
5600 \@ifpackageloaded{babel}{%
5601 \@ifundefined{bbl@main@language}{%
5602 % \end{macrocode}
5603 % Either \protect\package{babel} has not been used or it has been used with no
5604 % specified language.
5605 % \begin{macrocode}
5606 }{%
5607 % \end{macrocode}
5608 % Here we deal with the case where babel has been used. \protect\cs{selectlanguage}
5609 % has to be redefined to use our version of \protect\cs{bbl@set@language} and to
5610 % store the left or right language.
5611 % \begin{macrocode}
5612 \let\l@doldselectlanguage\selectlanguage
5613 \let\l@doldbbl@set@language\bbl@set@language
5614 \renewcommand{\selectlanguage}[1]{%
5615 \l@doldselectlanguage{#1}%
5616 \ifledRcol \gdef\theledlanguageR{#1}%
5617 \else \gdef\theledlanguageL{#1}%
5618 \fi}
5619 % \end{macrocode}
5620 % \protect\cs{l@duselanguage} simply calls the original \protect\cs{selectlanguage} so
5621 % that \protect\cs{theledlanguageL} and \protect\cs{theledlanguageR} are unaltered.
5622 % \begin{macrocode}
5623 \renewcommand*{\l@duselanguage}[1]{%
5624 \let\bbl@savelastskip\relax% Babel 3.61, which provokes spurious vertical space
5625 \let\bbl@restorelastskip\relax%% Babel 3.61, which provokes spurious vertical space
5626 \expandafter\l@doldselectlanguage\expandafter{#1}%
5627 }%
5628 % \end{macrocode}
5629 % Lastly, define the macro who initialise the left and right languages to the current \protect\package{babel}
5630 % one.
5631 % \begin{macrocode}
5632 \renewcommand{\reledpar@init@language}{%
5633 \gdef\theledlanguageL{\bbl@main@language}%
5634 \gdef\theledlanguageR{\bbl@main@language}%
5635 }
5636 }%
5637 }{}%
5638 % \end{macrocode}
5639 % If use \protect\package{polyglossia}
5640 % \changes{v1.8.0}{2014/08/05}{Correct left/right language setting with polyglossia.}
5641 % \changes{v1.9.0}{2014/09/16}{Debug left/right language switching with polyglossia. Do not write in .aux file when setting left/right lines.}
5642 % \changes{v2.22.4}{2019/11/04}{Provide compatibility with the latest version of polyglossia (v1.45).}
5643 % \changes{v2.23.0}{2020/03/08}{Restore compatibility with versions of polyglossia prior to v1.45.}
5644 % \begin{macrocode}
5645 \@ifpackageloaded{polyglossia}{%
5646 \@ifpackagelater{polyglossia}{2025/01/31}{}{\led@err@polyglossiaTooOld}%
5647 \renewcommand{\l@duselanguage}[1]{%
5648 \csuse{no\languagename @numbers}%
5649 \selectlanguage{#1}%
5650 }%
5651 \AddToHook{env/Leftside/begin}{%
5652 \AddToHookNext{cmd/polyglossia@language@switched/after}{%
5653 \ifl@dpairing%Ensure we are still in leftside
5654 \unless\ifledRcol%
5655 \xdef\theledlanguageL{\languagename}%
5656 \fi%
5657 \fi%
5658 }%
5659 }%
5660 \AddToHook{env/Rightside/begin}{%
5661 \AddToHookNext{cmd/polyglossia@language@switched/after}{%
5662 \ifl@dpairing%Ensure we are still in rightside
5663 \ifledRcol%
5664 \xdef\theledlanguageR{\languagename}%
5665 \fi%
5666 \fi%
5667 }%
5668 }%
5669 \renewcommand{\reledpar@init@language}{%
5670 \xdef\theledlanguageL{\mainlanguagename}%
5671 \xdef\theledlanguageR{\mainlanguagename}%
5672 }
5673 % \end{macrocode}
5674 % That is it.
5675 % \begin{macrocode}
5676 }{}%
5677 }%
5678 % \end{macrocode}
5679 % \end{macro}
5680 % \end{macro}
5681 % \end{macro}
5682 % \end{macro}
5683 %
5684 %
5685 % \section{Counts and boxes for parallel texts}
5686 %
5687 % In sequential text, each chunk (that enclosed by \protect\cs{pstart} \ldots
5688 % \protect\cs{pend}) is put into a box called \protect\cs{raw@text} and then immediately
5689 % printed, resulting in the box being emptied and ready for the next chunk.
5690 % For parallel processing multiple boxes are needed as printing is delayed.
5691 % We also need extra counters for various things.
5692 %
5693 % \begin{macro}{\maxchunks}
5694 % \begin{macro}{\l@dc@maxchunks}
5695 % The maximum number of chunk pairs before printing has to be called for.
5696 % The default is 5120 chunk pairs.
5697 % \begin{macrocode}
5698 \newcount\l@dc@maxchunks
5699 \newcommand{\maxchunks}[1]{\l@dc@maxchunks=#1}
5700 \maxchunks{5120}
5701
5702 % \end{macrocode}
5703 % \end{macro}
5704 % \end{macro}
5705 %
5706 % \begin{macro}{\l@dnumpstartsL}
5707 % \begin{macro}{\l@dnumpstartsR}
5708 % The numbers of left and right chunks. \protect\cs{l@dnumpstartsL} is defined
5709 % in \protect\package{eledmac}.
5710 % \changes{v0.3.0}{2005/02/24}{Moved \protect\cs{l@dnumpstartsL} to eledmac}
5711 % \begin{macrocode}
5712 \newcount\l@dnumpstartsR
5713
5714 % \end{macrocode}
5715 % \end{macro}
5716 % \end{macro}
5717 %
5718 % \begin{macro}{\l@dpscL}
5719 % \begin{macro}{\l@dpscR}
5720 % A couple of scratch counts to count left and right \cs{pstart}, respectively.
5721 % \begin{macrocode}
5722 \newcount\l@dpscL
5723 \newcount\l@dpscR
5724
5725 % \end{macrocode}
5726 % \end{macro}
5727 % \end{macro}
5728 %
5729 % \begin{macro}{\l@dsetuprawboxes}
5730 % This macro creates \protect\cs{maxchunks} pairs of boxes for left and right
5731 % chunks. The boxes are called \protect\cs{l@dLcolrawbox1}, \protect\cs{l@dLcolrawbox2}, etc.
5732 % \begin{macrocode}
5733 \newcommand*{\l@dsetuprawboxes}{%
5734 \@l@dtempcntb=\l@dc@maxchunks
5735 \loop\ifnum\@l@dtempcntb>\z@
5736 \newnamebox{l@dLcolrawbox\the\@l@dtempcntb}
5737 \newnamebox{l@dRcolrawbox\the\@l@dtempcntb}
5738 \advance\@l@dtempcntb \m@ne
5739 \repeat}
5740
5741 % \end{macrocode}
5742 % \end{macro}
5743 %
5744 % \begin{macro}{\l@dsetupmaxlinecounts}
5745 % \begin{macro}{\l@dzeromaxlinecounts}
5746 % To be able to synchronise left and right texts we need
5747 % to know the maximum number of text lines there are in each pair of chunks.
5748 % \protect\cs{l@dsetupmaxlinecounts} creates \protect\cs{maxchunks} new counts
5749 % called \protect\cs{l@dmaxlinesinpar1}, etc., and
5750 % \protect\cs{l@dzeromaxlinecounts} zeroes all of them.
5751 % \begin{macrocode}
5752 \newcommand*{\l@dsetupmaxlinecounts}{%
5753 \@l@dtempcntb=\l@dc@maxchunks
5754 \loop\ifnum\@l@dtempcntb>\z@
5755 \newnamecount{l@dmaxlinesinpar\the\@l@dtempcntb}
5756 \advance\@l@dtempcntb \m@ne
5757 \repeat}
5758 \newcommand*{\l@dzeromaxlinecounts}{%
5759 \begingroup
5760 \@l@dtempcntb=\l@dc@maxchunks
5761 \loop\ifnum\@l@dtempcntb>\z@
5762 \global\usenamecount{l@dmaxlinesinpar\the\@l@dtempcntb}=\z@
5763 \advance\@l@dtempcntb \m@ne
5764 \repeat
5765 \endgroup}
5766
5767 % \end{macrocode}
5768 % \end{macro}
5769 % \end{macro}
5770 %
5771 % Make sure that all these are set up. This has to be done after the
5772 % user has had an opportunity to change \protect\cs{maxchunks}.
5773 % \begin{macrocode}
5774 \AtBeginDocument{%
5775 \l@dsetuprawboxes
5776 \l@dsetupmaxlinecounts
5777 \l@dzeromaxlinecounts
5778 \l@dnumpstartsL=\z@
5779 \l@dnumpstartsR=\z@
5780 \l@dpscL=\z@
5781 \l@dpscR=\z@}
5782
5783 % \end{macrocode}
5784 % \section{Checking text to be processed}
5785 % \begin{macro}{\if@pstarts}
5786 % \begin{macro}{\@pstartstrue}
5787 % \begin{macro}{\@pstartsfalse}
5788 % \begin{macro}{\check@pstarts}
5789 % \protect\cs{check@pstarts} returns \protect\cs{@pstartstrue} if there are any unprocessed
5790 % chunks.
5791 % \begin{macrocode}
5792 \newif\if@pstarts
5793 \newcommand*{\check@pstarts}{%
5794 \@pstartsfalse
5795 \ifnum\l@dnumpstartsL>\l@dpscL
5796 \@pstartstrue
5797 \else
5798 \ifnum\l@dnumpstartsR>\l@dpscR
5799 \@pstartstrue
5800 \fi
5801 \fi
5802 }
5803
5804 % \end{macrocode}
5805 % \end{macro}
5806 % \end{macro}
5807 % \end{macro}
5808 % \end{macro}
5809 %
5810 % \begin{macro}{\ifaraw@text}
5811 % \begin{macro}{\araw@texttrue}
5812 % \begin{macro}{\araw@textfalse}
5813 % \begin{macro}{\checkraw@text}
5814 % \protect\cs{checkraw@text} checks whether the current Left or Right box is
5815 % void or not. If one or other is not void it sets \protect\cs{araw@texttrue},
5816 % otherwise both are void and it sets \protect\cs{araw@textfalse}.
5817 % \begin{macrocode}
5818 \newif\ifaraw@text
5819 \newcommand*{\checkraw@text}{%
5820 \araw@textfalse
5821 \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}
5822 \araw@texttrue
5823 \else
5824 \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}
5825 \araw@texttrue
5826 \fi
5827 \fi
5828 }
5829
5830 % \end{macrocode}
5831 % \end{macro}
5832 % \end{macro}
5833 % \end{macro}
5834 % \end{macro}
5835 %
5836 %
5837 % \begin{macro}{\@writelinesinparL}
5838 % \begin{macro}{\@writelinesinparR}
5839 % These write the number of text lines in a chunk to the section files,
5840 % and then afterwards zero the counter.
5841 % \begin{macrocode}
5842 \newcommand*{\@writelinesinparL}{%
5843 \edef\next{%
5844 \write\linenum@out{\string\@pend[\the\@donereallinesL]}}%
5845 \next
5846 \global\@donereallinesL \z@}
5847 \newcommand*{\@writelinesinparR}{%
5848 \edef\next{%
5849 \write\linenum@outR{\string\@pendR[\the\@donereallinesR]}}%
5850 \next
5851 \global\@donereallinesR \z@}
5852
5853 % \end{macrocode}
5854 % \end{macro}
5855 % \end{macro}
5856 %
5857 % \begin{macro}{\@writepageofparL}
5858 % \begin{macro}{\@writepageofparR}
5859 % These write the pages where start the first line of a chunck.
5860 % \begin{macrocode}
5861 \newcommand*{\@writepageofparL}[0]{%
5862 \ifnum\@donereallinesL=\z@%
5863 \edef\next{%
5864 \write\linenum@out{\string\@pstart{\the\l@dpscL}{\the\c@page}{\the\numpagelinesL}}%
5865 }%
5866 \next%
5867 \fi%
5868 }%
5869 \newcommand*{\@writepageofparR}[0]{%
5870 \ifnum\@donereallinesR=\z@%
5871 \edef\next{%
5872 \write\linenum@outR{\string\@pstartR{\the\l@dpscR}{\the\c@page}{\the\numpagelinesR}}%
5873 }%
5874 \next%
5875 \fi%
5876 }%
5877 % \end{macrocode}
5878 % \end{macro}
5879 % \end{macro}
5880 %
5881 % \section{Parallel columns}
5882 %
5883 % \begin{macro}{\@eledsectionL}
5884 % \begin{macro}{\@eledsectionR}
5885 % The parbox \protect\cs{@eledsectionL} and \protect\cs{@eledsectionR} will keep the sections' title.
5886 % \begin{macrocode}
5887 \newsavebox{\@eledsectionL}%
5888 \newsavebox{\@eledsectionR}%
5889 % \end{macrocode}
5890 % \end{macro}
5891 % \end{macro}
5892 % \begin{macro}{\Columns}
5893 % \changes{v1.8.0}{2014/07/28}{Modify \protect\cs{Columns} to enable to add section's title.}
5894 % The \protect\cs{Columns} command results in the previous Left and
5895 % Right texts being typeset in matching columns. There should
5896 % be equal numbers of chunks in the left and right texts.
5897 %
5898 % \changes{v1.12.0}{2015/02/23}{Add \protect\cs{l@dprintingcolumnstrue}}
5899 % \begin{macrocode}
5900 \newcommand*{\Columns}{%
5901 \ifl@dpairing%
5902 \led@err@Columns@InsideEnv%
5903 \fi%
5904 \ifboolexpr{test{\ifcsboxvoid{l@dRcolrawbox1}} or test{\ifcsboxvoid{l@dLcolrawbox1}}}{%
5905 \ifcsboxvoid{l@dRcolrawbox1}{%
5906 \ifcsboxvoid{l@dLcolrawbox1}%
5907 {\led@err@Columns@WithoutEnv}%
5908 {\led@err@Columns@WithoutRightside}%
5909 }%
5910 {\led@err@Columns@WithoutLeftside}%
5911 }{%
5912 \global\l@dprintingcolumnstrue%
5913 \eledsection@correcting@skip=-\baselineskip% Correction for sections' titles
5914 \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else
5915 \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}%
5916 \fi
5917 % \end{macrocode}
5918 % Start a group and zero counters, etc.
5919 % \begin{macrocode}
5920 \begingroup
5921 \l@dzeropenalties
5922 \endgraf\global\num@lines=\prevgraf
5923 \global\num@linesR=\prevgraf
5924 \global\par@line=\z@
5925 \global\par@lineR=\z@
5926 \global\l@dpscL=\z@
5927 \global\l@dpscR=\z@
5928 \get@familiarfootnote@number%
5929 \get@intercolumns@width%
5930 \get@sidenote@morespace@columns%
5931 % \end{macrocode}
5932 % Check if there are chunks to be processed, and process them
5933 % two by two (left and right pairs).
5934 % \begin{macrocode}
5935 \check@pstarts
5936 \loop\if@pstarts
5937 \global\pstartnumtrue
5938 \global\pstartnumRtrue
5939 % \end{macrocode}
5940 % Increase \protect\cs{l@dpscL} and \protect\cs{l@dpscR} which here count
5941 % the numbers of left and right chunks.
5942 % Increase \cs{pstarts@typeset@L}, which counts the number of \cs{pstart} typeset both in not parallel mode and in the left side of parallel mode.
5943 % Also restore the value of the public pstart counters.
5944 % \begin{macrocode}
5945 \global\advance\l@dpscL \@ne
5946 \global\advance\l@dpscR \@ne
5947 \global\advance\pstarts@typeset@L\@ne%
5948 \restore@pstartL@pc%
5949 \restore@pstartR@pc%
5950 % \end{macrocode}
5951 % We print the optional argument of \protect\cs{pstart} or the argument of \protect\cs{AtEveryPstart}.
5952 % \begin{macrocode}
5953 \Columns@print@before@pstart%
5954 % \end{macrocode}
5955 % Check if there is text yet to be processed in at least one of
5956 % the two current chunks, and also whether the left and right languages
5957 % are the same
5958 % \changes{v0.2.0}{2004/12/20}{Added \protect\cs{l@dchecklang} and \protect\cs{l@duselanguage}
5959 % to \protect\cs{Columns}}
5960 % \changes{v1.8.0}{2014/08/05}{Suppress \protect\cs{l@dchecklang} from \protect\cs{Columns}.}
5961 % \begin{macrocode}
5962 \checkraw@text
5963 { \loop\ifaraw@text
5964 % \end{macrocode}
5965 % Grab the next pair of left and right text lines and output them, swapping
5966 % languages if they differ, adding section title if needed.
5967 % \begin{macrocode}
5968 \l@duselanguage{\theledlanguageL}%
5969 \do@lineL
5970 \xifinlist{\the\pstarts@typeset@L}{\eled@sections@@}%
5971 {%
5972 \ifdefstring{\@eledsectmark}{L}%
5973 {\csuse{eled@sectmark@\the\pstarts@typeset@L}%
5974 }{}%
5975 \global\csundef{eled@sectmark@\the\pstarts@typeset@L}%
5976 \savebox{\@eledsectionL}{\parbox[t][][t]{\Lcolwidth}{\vbox{}\print@eledsectionL}}%\vbox{}-> prevent alignment troubles with RTL language
5977 }%
5978 {}%
5979 \l@duselanguage{\theledlanguageR}%
5980 \do@lineR
5981 \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}
5982 {%
5983 \ifdefstring{\@eledsectmark}{R}%
5984 {\csuse{eled@sectmark@\the\l@dpscR R}%
5985 }{}%
5986 \global\csundef{eled@sectmark@\the\l@dpscR R}%
5987 \savebox{\@eledsectionR}{\parbox[t][][t]{\Rcolwidth}{\vbox{}\print@eledsectionR}}}%\vbox{}-> prevent alignment troubles with RTL language
5988 {}%
5989 \hb@xt@ \hsize{%
5990 \ifdefstring{\columns@position}{L}{}{\hfill }%
5991 \print@leftcolumn%
5992 \print@columnseparator%
5993 \print@rightcolumn%
5994 \ifdefstring{\columns@position}{R}{}{\hfill}%
5995 }%
5996 \checkraw@text
5997 \checkverseL
5998 \checkverseR
5999 \checkpb@columns
6000 \repeat}
6001 % \end{macrocode}
6002 % Having completed a pair of chunks, write the number of lines
6003 % in each chunk to the respective section files.
6004 % Increment pstart counters and reset line numbering if it is by pstart.
6005 % \changes{v0.11.0}{2012/06/11}{Line numbering by pstart.}
6006 % \begin{macrocode}
6007 \@writelinesinparL
6008 \@writelinesinparR
6009 \check@pstarts
6010 \ifbypstart@%
6011 \unless\ifinstanza%
6012 \write\linenum@out{\string\@set[1]}%
6013 \resetprevline@%
6014 \fi%
6015 \fi
6016 \ifbypstart@R
6017 \unless\ifinstanza%
6018 \write\linenum@outR{\string\@set[1]}%
6019 \resetprevline@%
6020 \fi%
6021 \fi
6022 \Columns@print@after@pend%
6023 \repeat
6024 % \end{macrocode}
6025 % Having output all chunks, make sure all notes have been output,
6026 % then zero counts ready for the next set of texts. The boolean tests for stanza are switched to false.
6027 % \begin{macrocode}
6028 \flush@notes
6029 \flush@notesR
6030 \endgroup
6031 % \end{macrocode}
6032 % \begin{macrocode}
6033 \global\l@dpscL=\z@
6034 \global\l@dpscR=\z@
6035 \global\l@dnumpstartsL=\z@
6036 \global\l@dnumpstartsR=\z@
6037 \global\l@dprintingcolumnsfalse%
6038 \ignorespaces
6039 \global\instanzaLfalse%
6040 \global\instanzaRfalse%
6041 }%
6042 }%
6043
6044 % \end{macrocode}
6045 % \end{macro}
6046 % \begin{macro}{\print@columnseparator}
6047 % \changes{v1.8.0}{2014/08/05}{Move some code of \protect\cs{Columns} to \protect\cs{print@columnseparator}.}
6048 % \protect\cs{print@columnseparator} prints the column separator, with surrounding spaces (as the user has set them).
6049 % We use the \TeX\ \protect\cs{ifdim} instead of \protect\package{etoolbox}
6050 % to avoid having \protect\cs{hfill} in a \verb+{}+, which deletes some space (but not much).
6051 % \begin{macrocode}
6052 \def\print@columnseparator{%
6053 \ifdim\beforecolumnseparator<0pt%
6054 \hfill%
6055 \else%
6056 \hspace{\beforecolumnseparator}%
6057 \fi%
6058 \columnseparator%
6059 \ifdim\aftercolumnseparator<0pt%
6060 \hfill%
6061 \else%
6062 \hspace{\aftercolumnseparator}%
6063 \fi%
6064 }%
6065 % \end{macrocode}
6066 % \end{macro}
6067 % \begin{macro}{\get@intercolumns@width}
6068 % \begin{macro}{\intercolumns@width}
6069 % The \cs{intercolumns@width} is calculated by \cs{get@intercolumns@width}.
6070 % This length depends of many parameters:
6071 % \begin{itemize}
6072 % \item Columns width;
6073 % \item columns position;
6074 % \item columns separator;
6075 % \item space between columns and columns separator, which can be fixed by user or automatically calculated by \parpackage.
6076 % \end{itemize}
6077 % This length is never used directly, but it is used to calculate some other lengths.
6078 % \begin{macrocode}
6079 \newdimen\intercolumns@width%
6080 \newcommand{\get@intercolumns@width}{%
6081 % \begin{macrocode}
6082 \global\intercolumns@width=\z@%
6083 \ifdefstring{\columns@position}{C}%
6084 % \end{macrocode}
6085 % First case, the columns are centered.
6086 % \begin{macrocode}
6087 {%
6088 % \end{macrocode}
6089 % First sub-case, the width between columns is automatically calculated.
6090 % \begin{macrocode}
6091 \ifboolexpr{%
6092 test {\ifdimless{\beforecolumnseparator}{\z@}}%
6093 and test {\ifdimless{\aftercolumnseparator}{\z@}}%
6094 }%
6095 {%
6096 \global\intercolumns@width=\dimexpr%
6097 \columnrulewidth +%
6098 (\textwidth - \Lcolwidth - \Rcolwidth - \columnrulewidth)*1/2% The total of the width before and after column separator
6099 \relax%
6100 }%
6101 {}%
6102 % \end{macrocode}
6103 % Second sub-case, the width between column is fully determined by user setting.
6104 % \begin{macrocode}
6105 \ifboolexpr{%
6106 test {\ifdimgreater{\beforecolumnseparator}{\z@}}%
6107 and test {\ifdimgreater{\aftercolumnseparator}{\z@}}%
6108 }%
6109 {%
6110 \global\intercolumns@width=\dimexpr%
6111 \columnrulewidth + \beforecolumnseparator + \aftercolumnseparator%
6112 \relax%
6113 }%
6114 {}%
6115 % \end{macrocode}
6116 % Third sub-case, the width before column separator is determined by user setting, but the width after column separator is automatically calculated.
6117 % \begin{macrocode}
6118 \ifboolexpr{%
6119 test {\ifdimgreater{\beforecolumnseparator}{\z@}}%
6120 and test {\ifdimless{\aftercolumnseparator}{\z@}}%
6121 }%
6122 {%
6123 \global\intercolumns@width=\dimexpr%
6124 \columnrulewidth + \beforecolumnseparator +%
6125 (\textwidth - \Lcolwidth - \Rcolwidth - \columnrulewidth - \beforecolumnseparator) * 1/3%
6126 \relax%
6127 }%
6128 {}%
6129 % \end{macrocode}
6130 % Fourth and last sub-case, the width before column separator is automatically calculated, but the width after column separator is determined by user setting.
6131 % \begin{macrocode}
6132 \ifboolexpr{%
6133 test {\ifdimless{\beforecolumnseparator}{\z@}}%
6134 and test {\ifdimgreater{\aftercolumnseparator}{\z@}}%
6135 }%
6136 {%
6137 \global\intercolumns@width=\dimexpr%
6138 \columnrulewidth + \aftercolumnseparator +%
6139 (\textwidth - \Lcolwidth - \Rcolwidth - \columnrulewidth - \aftercolumnseparator) * 1/3%
6140 \relax%
6141 }%
6142 {}%
6143 % \end{macrocode}
6144 % Now, we have finished with the case the columns are centered aligned.
6145 % \begin{macrocode}
6146 }%
6147 % \end{macrocode}
6148 % Other case, the columns are left or right aligned.
6149 % \begin{macrocode}
6150 {%
6151 % \end{macrocode}
6152 % First sub-case, the width between columns is automatically calculated.
6153 % \begin{macrocode}
6154 \ifboolexpr{%
6155 test {\ifdimless{\beforecolumnseparator}{\z@}}%
6156 and test {\ifdimless{\aftercolumnseparator}{\z@}}%
6157 }%
6158 {%
6159 \global\intercolumns@width=\dimexpr%
6160 \columnrulewidth +%
6161 (\textwidth - \Lcolwidth - \Rcolwidth - \columnrulewidth)*2/3% The total of the width before and after column separator
6162 \relax%
6163 }%
6164 {}%
6165 % \end{macrocode}
6166 % Second sub-case, the width between column is fully determined by user setting.
6167 % \begin{macrocode}
6168 \ifboolexpr{%
6169 test {\ifdimgreater{\beforecolumnseparator}{\z@}}%
6170 and test {\ifdimgreater{\aftercolumnseparator}{\z@}}%
6171 }%
6172 {%
6173 \global\intercolumns@width=\dimexpr%
6174 \columnrulewidth + \beforecolumnseparator + \aftercolumnseparator%
6175 \relax%
6176 }%
6177 {}%
6178 % \end{macrocode}
6179 % Third sub-case, the width before column separator is determined by user setting, but the width after column separator is automatically calculated.
6180 % \begin{macrocode}
6181 \ifboolexpr{%
6182 test {\ifdimgreater{\beforecolumnseparator}{\z@}}%
6183 and test {\ifdimless{\aftercolumnseparator}{\z@}}%
6184 }%
6185 {%
6186 \global\intercolumns@width=\dimexpr%
6187 \columnrulewidth + \beforecolumnseparator +%
6188 (\textwidth - \Lcolwidth - \Rcolwidth - \columnrulewidth - \beforecolumnseparator) * 1/2%
6189 \relax%
6190 }%
6191 {}%
6192 % \end{macrocode}
6193 % Fourth and last sub-case, the width before column separator is automatically calculated, but the width after column separator is determined by user setting.
6194 % \begin{macrocode}
6195 \ifboolexpr{%
6196 test {\ifdimless{\beforecolumnseparator}{\z@}}%
6197 and test {\ifdimgreater{\aftercolumnseparator}{\z@}}%
6198 }%
6199 {%
6200 \global\intercolumns@width=\dimexpr%
6201 \columnrulewidth + \aftercolumnseparator +%
6202 (\textwidth - \Lcolwidth - \Rcolwidth - \columnrulewidth - \aftercolumnseparator) * 1/2%
6203 \relax%
6204 }%
6205 {}%
6206 % \end{macrocode}
6207 % We have finished with the case the columns are left or right aligned.
6208 % \begin{macrocode}
6209 }%
6210 % \end{macrocode}
6211 % End of \cs{get@intercolumns@width}.
6212 % \begin{macrocode}
6213 }%
6214 % \end{macrocode}
6215 % \end{macro}
6216 % \end{macro}
6217 % \begin{macro}{\print@leftcolumn}
6218 % \begin{macro}{\print@rightcolumn}
6219 % \cs{print@leftcolumn} and \cs{print@rightcolumn} print the line number of the left or right column respectively.
6220 % Normally, it is defined by the content of the \env{Leftside} or \env{Rightside} environments.
6221 % But if \cs{movecolumnspositiononrightpage} is set to TRUE, it also depends on the page number.
6222 % \begin{macrocode}
6223 \newcommand{\print@leftcolumn}{%
6224 \if\page@num>\page@numR%
6225 \@l@dtempcntb=\page@num%
6226 \else%
6227 \@l@dtempcntb=\page@numR%
6228 \fi%
6229 \ifboolexpr{%
6230 not bool {movecolumnspositiononrightpage}%
6231 or test {\ifnumodd{\@l@dtempcntb}}%
6232 }%
6233 {%
6234 \unhbox\l@dleftbox%
6235 \ifhbox\@eledsectionL%
6236 \usebox{\@eledsectionL}%
6237 \fi%
6238 }%
6239 {%
6240 \unhbox\l@drightbox%
6241 \ifhbox\@eledsectionR%
6242 \usebox{\@eledsectionR}%
6243 \fi%
6244 }%
6245 }%
6246
6247
6248 \newcommand{\print@rightcolumn}{%
6249 \if\page@num>\page@numR%
6250 \@l@dtempcntb=\page@num%
6251 \else%
6252 \@l@dtempcntb=\page@numR%
6253 \fi%
6254 \ifboolexpr{%
6255 not bool {movecolumnspositiononrightpage}%
6256 or test {\ifnumodd{\@l@dtempcntb}}%
6257 }%
6258 {%
6259 \unhbox\l@drightbox%
6260 \ifhbox\@eledsectionR%
6261 \usebox{\@eledsectionR}%
6262 \fi%
6263 }%
6264 {%
6265 \unhbox\l@dleftbox%
6266 \ifhbox\@eledsectionL%
6267 \usebox{\@eledsectionL}%
6268 \fi%
6269 }%
6270 }%
6271 % \end{macrocode}
6272 % \end{macro}
6273 % \end{macro}
6274 % \begin{macro}{\checkpb@columns}
6275 % \protect\cs{checkpb@columns} prevent or make pagebreaking in columns, depending on the use of \protect\cs{ledpb} or \protect\cs{lednopb}.
6276 % \begin{macrocode}
6277
6278 \newcommand{\checkpb@columns}{%
6279 \newif\if@pb
6280 \newif\if@nopb
6281 \IfStrEq{\led@pb@setting}{before}{
6282 \numdef{\next@absline}{\the\absline@num+1}%
6283 \numdef{\next@abslineR}{\the\absline@numR+1}%
6284 \xifinlist{\next@absline}{\l@prev@pb}{\@pbtrue}{}%
6285 \xifinlist{\next@abslineR}{\l@prev@pbR}{\@pbtrue}{}
6286 \xifinlist{\next@absline}{\l@prev@nopb}{\@nopbtrue}{}%
6287 \xifinlist{\next@abslineR}{\l@prev@nopbR}{\@nopbtrue}{}
6288 }{}
6289 \IfStrEq{\led@pb@setting}{after}{
6290 \xifinlist{\the\absline@num}{\l@prev@pb}{\@pbtrue}{}%
6291 \xifinlist{\the\absline@numR}{\l@prev@pbR}{\@pbtrue}{}
6292 \xifinlist{\the\absline@num}{\l@prev@nopb}{\@nopbtrue}{}%
6293 \xifinlist{\the\absline@numR}{\l@prev@nopbR}{\@nopbtrue}{}
6294 }{}
6295 \if@nopb\nopagebreak[4]\enlargethispage{\baselineskip}\fi
6296 \if@pb\pagebreak[4]\fi
6297 }
6298 % \end{macrocode}
6299 % \end{macro}
6300 % \begin{macro}{\columnseparator}
6301 % \begin{macro}{\columnrulewidth}
6302 % The separator between line pairs in parallel columns is in the form
6303 % of a vertical rule extending a little below the baseline and with a height
6304 % slightly greater than the \protect\cs{baselineskip}. The width of the rule
6305 % is \protect\cs{columnrulewidth} (initially 0pt so the rule is invisible).
6306 % \begin{macrocode}
6307 \newcommand*{\columnseparator}{%
6308 \smash{\rule[-0.2\baselineskip]{\columnrulewidth}{1.05\baselineskip}}}
6309 \newdimen\columnrulewidth
6310 \columnrulewidth=\z@
6311
6312 % \end{macrocode}
6313 % \end{macro}
6314 % \end{macro}
6315 % \begin{macro}{\columnsposition}
6316 % \begin{macro}{\columns@position}
6317 % The position of the \protect\cs{Columns} in a page. Default value is R.
6318 % Stored in \protect\cs{columns@position}.
6319 % \begin{macrocode}
6320 \newcommand*{\columnsposition}[1]{%
6321 \xdef\columns@position{#1}%
6322 }%
6323 \xdef\columns@position{R}%
6324 % \end{macrocode}
6325 % \end{macro}
6326 % \end{macro}
6327 % \begin{macro}{\beforecolumnseparator}
6328 % \begin{macro}{\aftercolumnseparator}
6329 % \protect\cs{beforecolumnseparator} and \protect\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 \protect\cs{hfill}.
6330 % \begin{macrocode}
6331 \newlength{\beforecolumnseparator}%
6332 \setlength{\beforecolumnseparator}{-2pt}%
6333
6334 \newlength{\aftercolumnseparator}%
6335 \setlength{\aftercolumnseparator}{-2pt}%
6336
6337 % \end{macrocode}
6338 % \end{macro}
6339 % \end{macro}
6340 %
6341 % \begin{macro}{setwidthliketwocolumns}
6342 % \begin{macro}{setpositionliketwocolumns@L}
6343 % \begin{macro}{setnotepositionliketwocolumns@L}
6344 % \begin{macro}{setpositionliketwocolumns@C}
6345 % \begin{macro}{setnotepositionliketwocolumns@C}
6346 % \begin{macro}{setpositionliketwocolumns@R}
6347 % \begin{macro}{setnotepositionliketwocolumns@R}
6348 % The \protect\cs{setwidthliketwocolumns} macro is called in \protect\cs{beginnumbering} in a \textbf{non-parallel}
6349 % typesetting context, to fix the width of the lines to be vertically aligned with parallel columns. It is also called at the beginning of a note's group, if some options are enabled.
6350 % The \protect\cs{setposition\ldots} macros are called in \protect\cs{beginnumbering} in a \textbf{non-parallel} typesetting context to fix the position of the lines.
6351 % The \protect\cs{setnoteposition\ldots} macros are called in \protect\cs{xxxfootstart} in a \textbf{non-parallel} typesetting context to fix the position of the notes block.
6352 % \begin{macrocode}
6353 \newcommand{\setwidthliketwocolumns}{%
6354 \get@intercolumns@width%As \columns is not necessary called before \setwidthliketwocolumns
6355 \hsize=\dimexpr \Lcolwidth + \intercolumns@width + \Rcolwidth \relax%
6356 }%
6357
6358 \newcommand{\setpositionliketwocolumns@L}{%
6359 \renewcommand{\ledrlfill}{\hfill}%
6360 }%
6361
6362 \newcommand{\setnotespositionliketwocolumns@L}{%
6363 }%
6364
6365 \newcommand{\setpositionliketwocolumns@C}{%
6366 \doinsidelinehook{\hfill}%
6367 \renewcommand{\ledrlfill}{\hfill}%
6368 }%
6369
6370 \newcommand{\setnotespositionliketwocolumns@C}{%
6371 \newdimen\temp%
6372 \newdimen\tempa%
6373 \temp=\hsize%
6374 \tempa=\Lcolwidth%
6375 \advance\tempa\Rcolwidth%
6376 \advance\temp-\tempa%
6377 \divide\temp by 2%
6378 \leftskip=\temp%
6379 \rightskip=-\temp%
6380 }%
6381
6382 \newcommand{\setpositionliketwocolumns@R}{%
6383 \doinsidelinehook{\hfill}%
6384 }%
6385 % \end{macrocode}
6386 % \end{macro}
6387 % \end{macro}
6388 % \end{macro}
6389 % \end{macro}
6390 % \end{macro}
6391 % \end{macro}
6392 % \end{macro}
6393 %
6394 % \begin{macro}{\Columns@print@before@pstart}
6395 % \begin{macro}{\Columns@print@after@pend}
6396 % The \protect\cs{Columns@print@before@pstart} and \protect\cs{Columns@print@after@pend} print the content of the optional argument of \protect\cs{pstart} / \protect\cs{pend}. If this content is not empty, it also print the separator.
6397 % \begin{macrocode}
6398 \newcommand{\Columns@print@before@pstart}{%
6399 \ifboolexpr{%
6400 test{\ifcsstring{before@pstartL@\the\l@dpscL}{\at@every@pstart}}%
6401 and test {\ifcsstring{before@pstartR@\the\l@dpscR}{\at@every@pstart}}%
6402 and test {\ifdefempty{\at@every@pstart}}}%
6403 {}%
6404 {%
6405 \ifboolexpr{not togl{before@pstartR@\the\l@dpscR @par} and not togl{before@pstartL@\the\l@dpscL @par}}{%
6406 \csuse{before@pstartL@\the\l@dpscL}%
6407 \csuse{before@pstartR@\the\l@dpscR}%
6408 }{%
6409 \hb@xt@ \hsize{%
6410 \ifdefstring{\columns@position}{L}{}{\hfill }%
6411 \par\parbox[t][][t]{\Lcolwidth}{%
6412 \csuse{before@pstartL@\the\l@dpscL}%
6413 }%
6414 \print@columnseparator%
6415 \parbox[t][][t]{\Rcolwidth}{%
6416 \set@sectcountR%
6417 \csuse{before@pstartR@\the\l@dpscR}%
6418 }%
6419 \ifdefstring{\columns@position}{R}{}{\hfill}%
6420 }%
6421 }%
6422 }%
6423 \global\csundef{before@pstartL@\the\l@dpscL}%
6424 \global\csundef{before@pstartR@\the\l@dpscR}%
6425 }%
6426 \newcommand{\Columns@print@after@pend}{%
6427 \ifboolexpr{%
6428 test{\ifcsstring{after@pendL@\the\l@dpscL}{\at@every@pend}}%
6429 and test {\ifcsstring{after@pendR@\the\l@dpscR}{\at@every@pend}}%
6430 and test {\ifdefempty{\at@every@pend}}}%
6431 {}%
6432 {%
6433 \ifboolexpr{not togl{after@pendR@\the\l@dpscR @par} and not togl{after@pendL@\the\l@dpscL @par}}{%
6434 \csuse{after@pendL@\the\l@dpscL}%
6435 \csuse{after@pendR@\the\l@dpscR}%
6436 }{%
6437 \hb@xt@ \hsize{%
6438 \ifdefstring{\columns@position}{L}{}{\hfill }%
6439 \parbox[t][][t]{\Lcolwidth}{%
6440 \csuse{after@pendL@\the\l@dpscL}%
6441 }%
6442 \print@columnseparator%
6443 \parbox[t][][t]{\Rcolwidth}{%
6444 \set@sectcountR%
6445 \csuse{after@pendR@\the\l@dpscR}%
6446 }%
6447 \ifdefstring{\columns@position}{R}{}{\hfill}%
6448 }%
6449 }%
6450 }%
6451 \global\csundef{after@pendL@\the\l@dpscL}%
6452 \global\csundef{after@pendR@\the\l@dpscR}%
6453 }%
6454 % \end{macrocode}
6455 % \end{macro}
6456 % \end{macro}
6457 % \section{Parallel pages}
6458 %
6459 % This is considerably more complicated than parallel columns.
6460 %
6461 % \subsection{Specific counters}
6462 % \begin{macro}{\numpagelinesL}
6463 % \begin{macro}{\numpagelinesR}
6464 % \begin{macro}{\l@dminpagelines}
6465 % Counts for the number of lines on a left or right page, and the smaller
6466 % of the number of lines on a pair of facing pages.
6467 % \begin{macrocode}
6468 \newcount\numpagelinesL
6469 \newcount\numpagelinesR
6470 \newcount\l@dminpagelines
6471
6472 % \end{macrocode}
6473 % \end{macro}
6474 % \end{macro}
6475 % \end{macro}
6476 % \subsection{Main macro}
6477 % \begin{macro}{\Pages}
6478 % \changes{v1.8.0}{2014/07/28}{Modify \protect\cs{Pages} to enable to add section's title.}
6479 % \changes{v1.8.3}{2014/08/31}{Debug blank pages when using optional argument in the last \protect\cs{pend}.}
6480 % \changes{v1.10.0}{2015/01/12}{Debug wrong pages splitting when no optional argument is used in last \protect\cs{pend} (bug was added in v.1.8.3).}
6481 % \changes{v1.10.0}{2015/01/12}{Debug wrong parallel pages synchronization when an \protect\cs{edtext} falls across two pages.}
6482 % \changes{v1.13.0}{2015/03/06}{When using shiftedpstarts option, a \protect\cs{l@dleftbox} with a null height will advance the \protect\cs{pagetotal} in any case.}
6483 % \changes{v1.13.1}{2015/03/12}{Prevent false empty page after \protect\cs{Pages} (bug added in 1.13.0)}
6484 % The \protect\cs{Pages} command results in the previous Left and
6485 % Right texts being typeset on matching facing pages. There should
6486 % be equal numbers of chunks in the left and right texts.
6487 %
6488 % \changes{v1.12.0}{2015/02/23}{Add \protect\cs{l@dprintingpagestrue}}
6489 % \begin{macrocode}
6490 \newcommandx*{\Pages}[1][1,usedefault]{%
6491 \ifl@dpairing%
6492 \led@err@Pages@InsideEnv%
6493 \fi%
6494 \ifboolexpr{test{\ifcsboxvoid{l@dRcolrawbox1}} or test{\ifcsboxvoid{l@dLcolrawbox1}}}{%
6495 \ifcsboxvoid{l@dRcolrawbox1}{%
6496 \ifcsboxvoid{l@dLcolrawbox1}%
6497 {\led@err@Pages@WithoutEnv}%
6498 {\led@err@Pages@WithoutRightside}%
6499 }%
6500 {\led@err@Pages@WithoutLeftside}%
6501 }{%
6502 \ifstrequal{#1}{mainmatter}{\Pages@mainmattertrue}{\Pages@mainmatterfalse}%
6503 \eledsection@correcting@skip=-2\baselineskip% line correcting for section titles.
6504 \parledgroup@notespacing@set@correction%
6505 \typeout{}%
6506 \typeout{*************************** PAGES ***************************}%
6507 \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else%
6508 \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}%
6509 \fi%
6510 % \end{macrocode}
6511 % Get onto an empty even (left) page, then initialise counters, etc.
6512 % \begin{macrocode}
6513 \cleartol@devenpage%
6514 \global\l@dprintingpagestrue%
6515 \begingroup%
6516 % \end{macrocode}
6517 % As \protect\cs{Pages} must be called outside of the pages environment, we have to redefine the \protect\cs{Lcolwidth} and \protect\cs{Rcolwidth} lengths, to prevent false overfull hboxes.
6518 % \changes{v1.13.0}{2015/03/06}{Prevent false overfull hboxes when using \protect\cs{Pages} outside of pages environment.}
6519 % \changes{v2.3.0}{2015/09/05}{Fix a bug when calling \protect\cs{Columns} after a \protect\cs{Pages} (bug added in v1.13.0).}
6520 % \changes{v2.17.2}{2017/04/06}{Fix a bug when changing \protect\cs{Lcolwitdth} and \protect\cs{Rcolwitdth} in \protect\env{pages} environment.}
6521 % \begin{macrocode}
6522 \Lcolwidth=\Lcolwidth@pages%
6523 \Rcolwidth=\Rcolwidth@pages%
6524 % \end{macrocode}
6525 % \begin{macrocode}
6526 \l@dzeropenalties%
6527 \endgraf\global\num@lines=\prevgraf%
6528 \global\num@linesR=\prevgraf%
6529 \global\par@line=\z@%
6530 \global\par@lineR=\z@%
6531 \global\l@dpscL=\z@%
6532 \global\l@dpscR=\z@%
6533 \writtenlinesLfalse%
6534 \writtenlinesRfalse%
6535 \get@familiarfootnote@number%
6536 % \end{macrocode}
6537 % The footnotes are printed in a different way from expected in \macpackage, as we may want to print the notes on one side only.
6538 % \begin{macrocode}
6539 \let\print@Xnotes\print@Xnotes@forpages%
6540 \let\print@notesX\print@notesX@forpages%
6541 % \end{macrocode}
6542 % Check if there are chunks to be processed.
6543 % \begin{macrocode}
6544 \check@pstarts%
6545 \loop\if@pstarts%
6546 % \end{macrocode}
6547 % Loop over the number of chunks, incrementing the chunk counts
6548 % (\protect\cs{l@dpscL}
6549 % and \protect\cs{l@dpscR} are chunk (box) counts).
6550 %
6551 % \begin{macrocode}
6552 \global\advance\l@dpscL \@ne%
6553 \global\advance\l@dpscR \@ne%
6554 % \end{macrocode}
6555 % Calculate the maximum number of real text lines in the chunk pair,
6556 % storing the result in the relevant \protect\cs{l@dmaxlinesinpar}.
6557 % \begin{macrocode}
6558 \getlinesfromparlistL%
6559 \getlinesfromparlistR%
6560 \l@dcalc@maxoftwo{\@cs@linesinparL}{\@cs@linesinparR}%
6561 {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
6562 \check@pstarts%
6563 \repeat%
6564 % \end{macrocode}
6565 % Zero the counts again, ready for the next bit.
6566 % \begin{macrocode}
6567 \global\l@dpscL=\z@%
6568 \global\l@dpscR=\z@%
6569 % \end{macrocode}
6570 % Get the number of lines on the first pair of pages and store
6571 % the minimum in \protect\cs{l@dminpagelines}.
6572 % \begin{macrocode}
6573 \getlinesfrompagelistL%
6574 \getlinesfrompagelistR%
6575 \l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}%
6576 {\l@dminpagelines}%
6577 % \end{macrocode}
6578 % Now we start processing the left and right chunks (\protect\cs{l@dpscL} and
6579 % \protect\cs{l@dpscR} count the left and right chunks), starting with the first pair.
6580 % \begin{macrocode}
6581 \check@pstarts%
6582 \if@pstarts%
6583 % \end{macrocode}
6584 % Increment the chunk counts to get the first pair.
6585 % Restore also the value of public pstart counters.
6586 % \begin{macrocode}
6587 \global\advance\l@dpscL \@ne%
6588 \global\advance\l@dpscR \@ne%
6589 \global\advance\pstarts@typeset@L\@ne%
6590 \restore@pstartL@pc%
6591 \restore@pstartR@pc%
6592 % \end{macrocode}
6593 % We have not processed any lines from these chunks yet, so zero the
6594 % respective line counts.
6595 % \begin{macrocode}
6596 \global\@donereallinesL=\z@%
6597 \global\@donetotallinesL=\z@%
6598 \global\@donereallinesR=\z@%
6599 \global\@donetotallinesR=\z@%
6600 % \end{macrocode}
6601 % Start a loop over the boxes (chunks).
6602 % \begin{macrocode}
6603 \checkraw@text%
6604 % \end{macrocode}
6605 % \begin{macrocode}
6606 % \begingroup
6607 { \loop\ifaraw@text%
6608 % \end{macrocode}
6609 % See if there is more that can be done for the left page and set up the
6610 % left language.
6611 % \changes{v0.2.0}{2004/12/20}{Added \protect\cs{l@duselanguage} to \protect\cs{Pages}}
6612 % \begin{macrocode}
6613 \checkpageL%
6614 \Leftpagehook%
6615 \l@duselanguage{\theledlanguageL}%
6616 { \loop\ifl@dsamepage%
6617 % \end{macrocode}
6618 % Process the next (left) text line, adding it to the page.
6619 % Eventually, adds the optional argument of pstart.
6620 % \changes{v0.3.0}{2005/02/10}{Added \protect\cs{ledstrutL} to \protect\cs{Pages}}
6621 % \begin{macrocode}
6622 \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{}%
6623 \csuse{before@pstartL@\the\l@dpscL}%
6624 \global\csundef{before@pstartL@\the\l@dpscL}%
6625 \do@lineL%
6626 \xifinlist{\the\pstarts@typeset@L}{\eled@sections@@}%
6627 {\print@eledsectionL}%
6628 {}%
6629 \advance\numpagelinesL \@ne%
6630 % \end{macrocode}
6631 % When using shiftedpstarts option, a \protect\cs{l@dleftbox} with a null height is not printed.
6632 % That means we do not insert blank lines at the end of a left chunk lower than the corresponding right chunk.
6633 % However, a \protect\cs{l@dleftbox} with a null height will advance the \protect\cs{pagetotal} in any case.
6634 % Because if we do not do this, the \protect\cs{checkpageL} could let \protect\cs{ifl@pagefull} to false,
6635 % and consequently a \protect\cs{@lopL} equal to 1000 could be written in the numbered file,
6636 % even if all the lines actually needed for the current page have been printed.
6637 % \l@dleftbox
6638 % \begin{macrocode}
6639 \ifshiftedpstarts%
6640 \ifdim\ht\l@dleftbox>0pt%
6641 \parledgroup@correction@notespacing{L}%
6642 \hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}%
6643 \else%
6644 \xifinlist{\the\pstarts@typeset@L}{\eled@sections@@}%
6645 {\add@apparatusL}%
6646 {}%
6647 \unless\ifadvancedshiftedpstarts%
6648 \dimen0=\pagetotal%
6649 \advance\dimen0 by \baselineskip%
6650 \global\pagetotal=\dimen0%
6651 \else%
6652 \ifnomaxlines%
6653 \numdef{\@tmp}{\the\l@dpscL+1}%
6654 \ifcsdef{minpage@pstart@\@tmp}{%
6655 \ifnumless{\the\c@page}{\csuse{minpage@pstart@\@tmp}}%
6656 {\dimen0=\pagetotal%
6657 \advance\dimen0 by \baselineskip%
6658 \global\pagetotal=\dimen0%
6659 }%
6660 {}%
6661 }{}%
6662 \fi%
6663 \fi%
6664 \fi%
6665 \else%
6666 \parledgroup@correction@notespacing{L}%
6667 \hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}%
6668 \fi%
6669 % \end{macrocode}
6670 % Perhaps we have to move to the next (left) box. Check if we have got all
6671 % we can onto the page. If not, repeat for the next line.
6672 % Check if we have to print the optional argument of the last pend.
6673 % Check if the page is full.
6674 % Check if the verse is split in two subsequent pages.
6675 % Check there is any forced page breaks.
6676 % Reset the verse skipnumber boolean
6677 % \begin{macrocode}
6678 \get@nextboxL%
6679 \global\l@dskipversenumberfalse%
6680 \ifprint@last@after@pendL%
6681 \csuse{after@pendL@\the\l@dpscL}%
6682 \global\csundef{after@pendL@\the\l@dpscL}%
6683 \fi%
6684 \checkpageL%
6685 \checkverseL%
6686 \checkpbL%
6687 \repeat%
6688 % \end{macrocode}
6689 % That (left) page has been filled. Output the number of real lines
6690 % on the page --- if the page break is because the page has been
6691 % filled with lines, use the actual number, otherwise the page has been
6692 % ended early in order to synchronise with the facing page so use an
6693 % impossibly large number.
6694 % \begin{macrocode}
6695 \ifl@dpagefull%
6696 \@writelinesonpageL{\the\numpagelinesL}%
6697 \else%
6698 \@writelinesonpageL{1000}%
6699 \fi%
6700 % \end{macrocode}
6701 % Reset to zero the left-page line count, clear the page to get onto the facing
6702 % (odd, right) page, and reinitialize the accumulated dimension of interline correction for notes in parallel ledgroup.
6703 % \begin{macrocode}
6704 \numpagelinesL \z@%
6705 \parledgroup@correction@notespacing@init%
6706 \clearl@dleftpage }%
6707 % \end{macrocode}
6708 % Now do the same for the right text.
6709 % \changes{v0.3.0}{2005/02/10}{Added \protect\cs{ledstrutR} to \protect\cs{Pages}}
6710 % \begin{macrocode}
6711 \checkpageR%
6712 \Rightpagehook%
6713 \l@duselanguage{\theledlanguageR}%
6714 { \loop\ifl@dsamepage%
6715 \set@sectcountR%
6716 \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{}%
6717 \csuse{before@pstartR@\the\l@dpscR}%
6718 \global\csundef{before@pstartR@\the\l@dpscR}%
6719 \do@lineR%
6720 \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}%
6721 {\print@eledsectionR}%
6722 {}%
6723 \advance\numpagelinesR \@ne%
6724 \ifshiftedpstarts%
6725 \ifdim\ht\l@drightbox>0pt%
6726 \parledgroup@correction@notespacing{R}%
6727 \hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}%
6728 \else%
6729 \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}%
6730 {\add@apparatusR}%
6731 {}%
6732 \unless\ifadvancedshiftedpstarts%
6733 \dimen0=\pagetotal%
6734 \advance\dimen0 by \baselineskip%
6735 \global\pagetotal=\dimen0%
6736 \else%
6737 \ifnomaxlines%
6738 \numdef{\@tmp}{\the\l@dpscR+1}%
6739 \ifcsdef{minpage@pstart@\@tmp}{%
6740 \ifnumless{\the\c@page}{\csuse{minpage@pstart@\@tmp}}%
6741 {\dimen0=\pagetotal%
6742 \advance\dimen0 by \baselineskip%
6743 \global\pagetotal=\dimen0%
6744 }%
6745 {}%
6746 }{}%
6747 \fi%
6748 \fi%
6749 \fi%
6750 \else%
6751 \parledgroup@correction@notespacing{R}%
6752 \hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}%
6753 \fi%
6754 \get@nextboxR%
6755 \global\l@dskipversenumberRfalse%
6756 \ifprint@last@after@pendR%
6757 \csuse{after@pendR@\the\l@dpscR}%
6758 \global\csundef{after@pendR@\the\l@dpscR}%
6759 \fi%
6760 \checkpageR%
6761 \checkverseR%
6762 \checkpbR%
6763 \repeat%
6764 \ifl@dpagefull%
6765 \@writelinesonpageR{\the\numpagelinesR}%
6766 \else%
6767 \@writelinesonpageR{1000}%
6768 \fi%
6769 \numpagelinesR=\z@%
6770 \parledgroup@correction@notespacing@init%
6771 % \end{macrocode}
6772 % The page is full, so move onto the next (left, odd) page and repeat left
6773 % text processing.
6774 % \begin{macrocode}
6775 \clearl@drightpage}%
6776 % \end{macrocode}
6777 % More to do? If there is we have to get the number of lines for the next
6778 % pair of pages before starting to output them.
6779 % \changes{v0.3.2}{2005/04/08}{Added \protect\cs{l@dminpagelines} calculation
6780 % for succeeding page pairs}
6781 % \begin{macrocode}
6782 \checkraw@text%
6783 \ifaraw@text%
6784 \getlinesfrompagelistL%
6785 \getlinesfrompagelistR%
6786 \l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}%
6787 {\l@dminpagelines}%
6788 \fi%
6789 \repeat}%
6790 % \end{macrocode}
6791 % We have now output the text from all the chunks.
6792 % \begin{macrocode}
6793 \fi%
6794 % \end{macrocode}
6795 % Make sure that there are no inserts hanging around.
6796 % \begin{macrocode}
6797 \flush@notes%
6798 \flush@notesR%
6799 \endgroup%
6800 % \end{macrocode}
6801 % Zero counts ready for the next set of left/right text chunks. The boolean tests for stanza are switched to false.
6802 % \begin{macrocode}
6803 \global\l@dpscL=\z@%
6804 \global\l@dpscR=\z@%
6805 \global\l@dnumpstartsL=\z@%
6806 \global\l@dnumpstartsR=\z@%
6807 \global\instanzaLfalse%
6808 \global\instanzaRfalse%
6809 \global\inastanzaLfalse%
6810 \global\inastanzaRfalse%
6811 \global\l@dprintingpagesfalse%
6812 % \end{macrocode}
6813 % Check the consistency of \cs{edtext@later} and \cs{edtext@now}
6814 % \begin{macrocode}
6815 \ifnum\edtext@later=\edtext@now%
6816 \else%
6817 \led@error@edtext@later@now%
6818 \fi%
6819 \global\edtext@later=\z@%
6820 \global\edtext@now=\z@%
6821 % \end{macrocode}
6822 % Prevent final notes from overlapping the line number
6823 % \begin{macrocode}
6824 \finish@Pages@notes%
6825 \ignorespaces}}%
6826
6827
6828 % \end{macrocode}
6829 % \end{macro}
6830 %
6831 % \subsection{Ensure all notes are printed at the end of parallel pages}
6832 % \begin{macro}{\finish@Pages@notes}
6833 % This macro ensures that all long notes are printed at the end of \protect\cs{Pages} typesetting, and that there are no more long notes left for the next pages.
6834 % \begin{macrocode}
6835 \newcommand{\finish@Pages@notes}{%
6836 \def\do##1{%
6837 % \end{macrocode}
6838 % First, declare footnote box if there was no previous declared.
6839 % E.g. if familiar or critical notes were disabled by \macpackage's options.
6840 % \begin{macrocode}
6841 \ifnocritical@%
6842 \global\newnamebox{##1footins}%
6843 \fi
6844 \ifnofamiliar@%
6845 \global\newnamebox{footins##1}%
6846 \fi
6847 % \end{macrocode}
6848 % We must also restore the settings for the footnotes in case of using onlyside option.
6849 % \begin{macrocode}
6850 \restore@Xnotes@settings{##1}%
6851 \restore@notesX@settings{##1}%
6852 % \end{macrocode}
6853 % And now, add a \protect\cs{newpage} if there is no more footnote to print.
6854 % \begin{macrocode}
6855 \ifvoid\csuse{##1footins}%
6856 \ifvoid\csuse{footins##1}\else%
6857 \newpage\null%
6858 \listbreak%
6859 \fi%
6860 \else%
6861 \newpage\null%
6862 \listbreak%
6863 \fi%
6864 }%
6865 \dolistloop{\@series}%
6866 }%
6867 % \end{macrocode}
6868 % \end{macro}
6869 % \subsection{Struts}
6870 % \begin{macro}{\ledstrutL}
6871 % \begin{macro}{\ledstrutR}
6872 % Struts inserted into leftand right text lines.
6873 % \changes{v0.3.0}{2005/02/10}{Added \protect\cs{ledtrutL} and \protect\cs{ledstrutR}}
6874 % \changes{v2.4.0}{2015/09/29}{Deleted \protect\cs{ledtrutL} and \protect\cs{ledstrutR}}
6875 % \changes{v2.4.0}{2015/09/29}{Fix a bug with dotted letter}
6876 % \begin{macrocode}
6877 \newcommand*{\ledstrutL}{}
6878 \newcommand*{\ledstrutR}{}
6879
6880 % \end{macrocode}
6881 % \end{macro}
6882 % \end{macro}
6883 %
6884 %
6885 % \subsection{Page clearing}
6886 % \begin{macro}{\cleartoevenpage}
6887 % \begin{macro}{\cleartol@devenpage}
6888 % \protect\cs{cleartoevenpage}, which is defined in the memoir class,
6889 % is like \protect\cs{clear(double)page} except that we
6890 % end up on an even page.
6891 % \protect\cs{cleartol@devenpage} is similar except that it first checks to see
6892 % if it is already on an empty page.
6893 % \begin{macrocode}
6894 \providecommand{\cleartoevenpage}[1][\@empty]{%
6895 \clearpage
6896 \ifodd\c@page\hbox{}#1\clearpage\fi}
6897
6898 \newcommand*{\cleartol@devenpage}{%
6899 \ifdim\pagetotal<\topskip% on an empty page
6900 \else
6901 \clearpage
6902 \Pages@mainmatter%
6903 \fi
6904 \ifodd\c@page%
6905 \ifprevpgnotnumbered%
6906 \addtocounter{par@page}{-1}%
6907 \fi%
6908 \ifdef{\prevpgstyle}{\thispagestyle{\prevpgstyle}}{}%
6909 \hbox{}\clearpage%
6910 \fi%
6911 }%
6912 % \end{macrocode}
6913 % \end{macro}
6914 % \end{macro}
6915 % \begin{macro}{\clearl@dleftpage}
6916 % \begin{macro}{\clearl@drightpage}
6917 % \protect\cs{clearl@dleftpage} and \protect\cs{clearl@drightpage} get us onto
6918 % an odd and even page, respectively, checking that we end up on
6919 % the subsquent page.
6920 % Both commands use \protect\cs{newpage} and not \protect\cs{clearpage}.
6921 % Because \protect\cs{clearpage} prints all footnotes before the next page, even if it has to add new empty pages, while \protect\cs{newpage} does not.
6922 % And as we want notes started in the left page continue in the right page and \emph{vice-versa}, we must use \protect\cs{newpage} and not \protect\cs{clearpage}
6923 %
6924 % \changes{v1.13.0}{2015/03/06}{Use \protect\cs{newpage} instead of \protect\cs{clearpage}.}
6925 % \begin{macrocode}
6926 \newcommand*{\clearl@dleftpage}{%
6927 \ifdim\pagetotal=0pt\hbox{}\fi%
6928 \newpage%
6929 \insert@notes@for@onlyside%
6930 \ifodd\c@page\else
6931 \led@err@LeftOnRightPage
6932 \hbox{}%
6933 \cleardoublepage
6934 \fi}
6935
6936 \newcommand*{\clearl@drightpage}{%
6937 \ifdim\pagetotal=0pt\hbox{}\fi%
6938 \newpage%
6939 \insert@notes@for@onlyside%
6940 \ifodd\c@page
6941 \led@err@RightOnLeftPage
6942 \hbox{}%
6943 \cleartoevenpage
6944 \fi}
6945
6946 % \end{macrocode}
6947 % \end{macro}
6948 % \end{macro}
6949 %
6950 % \subsection{Lines managing}
6951 % \begin{macro}{\getlinesfromparlistL}
6952 % \begin{macro}{\@cs@linesinparL}
6953 % \begin{macro}{\getlinesfromparlistR}
6954 % \begin{macro}{\@cs@linesinparR}
6955 % \protect\cs{getlinesfromparlistL} gets the next entry from the
6956 % \protect\cs{linesinpar@listL} and puts it into \protect\cs{@cs@linesinparL}; if the
6957 % list is empty, it sets \protect\cs{@cs@linesinparL} to 0. Similarly
6958 % for \protect\cs{getlinesfromparlistR}.
6959 % \begin{macrocode}
6960 \newcommand*{\getlinesfromparlistL}{%
6961 \ifx\linesinpar@listL\empty
6962 \gdef\@cs@linesinparL{0}%
6963 \else
6964 \gl@p\linesinpar@listL\to\@cs@linesinparL
6965 \fi}
6966 \newcommand*{\getlinesfromparlistR}{%
6967 \ifx\linesinpar@listR\empty
6968 \gdef\@cs@linesinparR{0}%
6969 \else
6970 \gl@p\linesinpar@listR\to\@cs@linesinparR
6971 \fi}
6972
6973 % \end{macrocode}
6974 % \end{macro}
6975 % \end{macro}
6976 % \end{macro}
6977 % \end{macro}
6978 %
6979 % \begin{macro}{\getlinesfrompagelistL}
6980 % \begin{macro}{\@cs@linesonpageL}
6981 % \begin{macro}{\getlinesfrompagelistR}
6982 % \begin{macro}{\@cs@linesonpageR}
6983 % \protect\cs{getlinesfrompagelistL} gets the next entry from the
6984 % \protect\cs{linesonpage@listL} and puts it into \protect\cs{@cs@linesonpageL}; if the
6985 % list is empty, it sets \protect\cs{@cs@linesonpageL} to 1000. Similarly
6986 % for \protect\cs{getlinesfrompagelistR}.
6987 % \begin{macrocode}
6988 \newcommand*{\getlinesfrompagelistL}{%
6989 \ifx\linesonpage@listL\empty
6990 \gdef\@cs@linesonpageL{1000}%
6991 \else
6992 \gl@p\linesonpage@listL\to\@cs@linesonpageL
6993 \fi}
6994 \newcommand*{\getlinesfrompagelistR}{%
6995 \ifx\linesonpage@listR\empty
6996 \gdef\@cs@linesonpageR{1000}%
6997 \else
6998 \gl@p\linesonpage@listR\to\@cs@linesonpageR
6999 \fi}
7000
7001 % \end{macrocode}
7002 % \end{macro}
7003 % \end{macro}
7004 % \end{macro}
7005 % \end{macro}
7006 %
7007 % \begin{macro}{\@writelinesonpageL}
7008 % \begin{macro}{\@writelinesonpageR}
7009 % These macros output the number of lines on a page to the section file
7010 % in the form of \protect\cs{@lopL} or \protect\cs{@lopR} macros.
7011 % \begin{macrocode}
7012 \newcommand*{\@writelinesonpageL}[1]{%
7013 \edef\next{\write\linenum@out{\string\@lopL{#1}}}%
7014 \next}
7015 \newcommand*{\@writelinesonpageR}[1]{%
7016 \edef\next{\write\linenum@outR{\string\@lopR{#1}}}%
7017 \next}
7018
7019 % \end{macrocode}
7020 % \end{macro}
7021 % \end{macro}
7022 %
7023 %
7024 % \begin{macro}{\l@dcalc@maxoftwo}
7025 % \begin{macro}{\l@dcalc@minoftwo}
7026 % \protect\cs{l@dcalc@maxoftwo}\marg{num}\marg{num}\marg{count} sets \meta{count}
7027 % to the maximum of the two \meta{num}.
7028 %
7029 % Similarly
7030 % \protect\cs{l@dcalc@minoftwo}\marg{num}\marg{num}\marg{count} sets \meta{count}
7031 % to the minimum of the two \meta{num}.
7032 %
7033 % \begin{macrocode}
7034 \newcommand*{\l@dcalc@maxoftwo}[3]{%
7035 \ifnum #2>#1\relax
7036 #3=#2\relax
7037 \else
7038 #3=#1\relax
7039 \fi}
7040 \newcommand*{\l@dcalc@minoftwo}[3]{%
7041 \ifnum #2<#1\relax
7042 #3=#2\relax
7043 \else
7044 #3=#1\relax
7045 \fi}
7046
7047 % \end{macrocode}
7048 % \end{macro}
7049 % \end{macro}
7050 %
7051 % \subsection{Page break managing}
7052 % \begin{macro}{\ifl@dsamepage}
7053 % \begin{macro}{\l@dsamepagetrue}
7054 % \begin{macro}{\l@dsamepagefalse}
7055 % \begin{macro}{\ifl@dpagefull}
7056 % \begin{macro}{\l@dpagefulltrue}
7057 % \begin{macro}{\l@dpagefullfalse}
7058 % \begin{macro}{\checkpageL}
7059 % \begin{macro}{\checkpageR}
7060 % \protect\cs{checkpageL} tests if the space and lines already taken on the page by
7061 % text and footnotes is less than the constraints. If so, then
7062 % \protect\cs{ifl@dpagefull} is set FALSE and \protect\cs{ifl@dsamepage} is set TRUE.
7063 % If the page is spatially full
7064 % then \protect\cs{ifl@dpagefull} is set TRUE and \protect\cs{ifl@dsamepage} is set FALSE.
7065 % If it is not spatially full but the maximum number of lines have been
7066 % output then both \protect\cs{ifl@dpagefull} and \protect\cs{ifl@dsamepage}
7067 % are set FALSE.
7068 %
7069 % \begin{macrocode}
7070 \newif\ifl@dsamepage
7071 \l@dsamepagetrue
7072 \newif\ifl@dpagefull
7073
7074 \newcommand*{\checkpageL}{%
7075 \l@dpagefulltrue
7076 \l@dsamepagetrue
7077 \check@goal
7078 \ifdim\pagetotal<\ledthegoal
7079 \ifnum\numpagelinesL<\l@dminpagelines
7080 \else
7081 \ifnomaxlines%
7082 \else%
7083 \l@dsamepagefalse%
7084 \l@dpagefullfalse%
7085 \fi%
7086 \fi
7087 \else
7088 \l@dsamepagefalse
7089 \l@dpagefulltrue
7090 \fi%
7091 \ifprint@last@after@pendL%
7092 \l@dpagefullfalse%
7093 \l@dsamepagefalse%
7094 \print@last@after@pendLfalse%
7095 \fi%
7096 }%
7097
7098 \newcommand*{\checkpageR}{%
7099 \l@dpagefulltrue
7100 \l@dsamepagetrue
7101 \check@goal
7102 \ifdim\pagetotal<\ledthegoal
7103 \ifnum\numpagelinesR<\l@dminpagelines
7104 \else
7105 \ifnomaxlines%
7106 \else%
7107 \l@dsamepagefalse%
7108 \l@dpagefullfalse%
7109 \fi%
7110 \fi
7111 \else
7112 \l@dsamepagefalse
7113 \l@dpagefulltrue
7114 \fi%
7115 \ifprint@last@after@pendR%
7116 \l@dpagefullfalse%
7117 \l@dsamepagefalse%
7118 \print@last@after@pendRfalse%
7119 \fi%
7120 }%
7121
7122 % \end{macrocode}
7123 % \end{macro}
7124 % \end{macro}
7125 % \end{macro}
7126 % \end{macro}
7127 % \end{macro}
7128 % \end{macro}
7129 % \end{macro}
7130 % \end{macro}
7131 % \begin{macro}{\checkpbL}
7132 % \begin{macro}{\checkpbR}
7133 % \protect\cs{checkpbL} and \protect\cs{checkpbR} are called after each line is printed, and after the page is checked. These commands correct page breaks depending on \protect\cs{ledpb} and \protect\cs{lednopb}.
7134 % \begin{macrocode}
7135 \newcommand{\checkpbL}{
7136 \IfStrEq{\led@pb@setting}{after}{
7137 \xifinlist{\the\absline@num}{\l@prev@pb}{\l@dpagefulltrue\l@dsamepagefalse}{}
7138 \xifinlist{\the\absline@num}{\l@prev@nopb}{\l@dpagefullfalse\l@dsamepagetrue}{}
7139 }{}
7140 \IfStrEq{\led@pb@setting}{before}{
7141 \numdef{\next@absline}{\the\absline@num+1}
7142 \xifinlist{\next@absline}{\l@prev@pb}{\l@dpagefulltrue\l@dsamepagefalse}{}
7143 \xifinlist{\next@absline}{\l@prev@nopb}{\l@dpagefullfalse\l@dsamepagetrue}{}
7144 }{}
7145 }
7146
7147 \newcommand{\checkpbR}{
7148 \IfStrEq{\led@pb@setting}{after}{
7149 \xifinlist{\the\absline@numR}{\l@prev@pbR}{\l@dpagefulltrue\l@dsamepagefalse}{}
7150 \xifinlist{\the\absline@numR}{\l@prev@nopbR}{\l@dpagefullfalse\l@dsamepagetrue}{}
7151 }{}
7152 \IfStrEq{\led@pb@setting}{before}{
7153 \numdef{\next@abslineR}{\the\absline@numR+1}
7154 \xifinlist{\next@abslineR}{\l@prev@pbR}{\l@dpagefulltrue\l@dsamepagefalse}{}
7155 \xifinlist{\next@abslineR}{\l@prev@nopbR}{\l@dpagefullfalse\l@dsamepagetrue}{}
7156 }{}
7157 }
7158 % \end{macrocode}
7159 % \end{macro}
7160 % \end{macro}
7161 % \begin{macro}{\checkverseL}
7162 % \begin{macro}{\checkverseR}
7163 % \protect\cs{checkverseL} and \protect\cs{checkverseR} are called after each line is printed.
7164 % They prevent page break inside line of verse.
7165 % \begin{macrocode}
7166 \newcommand{\checkverseL}{%
7167 \ifinstanzaL%
7168 \iflednopbinverse%
7169 \ifinserthangingsymbol%
7170 \numgdef{\prev@abslineverse}{\the\absline@num-1}%
7171 \IfStrEq{\led@pb@setting}{after}{\lednopbnum{\prev@abslineverse}}{}%
7172 \IfStrEq{\led@pb@setting}{before}{%
7173 \ifnum\numpagelinesL<3%
7174 \ledpbnum{\prev@abslineverse}%
7175 \fi%
7176 }{}%
7177 \fi%
7178 \fi%
7179 \fi%
7180 }
7181 \newcommand{\checkverseR}{%
7182 \ifinstanzaR%
7183 \iflednopbinverse%
7184 \ifinserthangingsymbolR%
7185 \numgdef{\prev@abslineverse}{\the\absline@numR-1}%
7186 \IfStrEq{\led@pb@setting}{after}{\lednopbnumR{\prev@abslineverse}}{}%
7187 \IfStrEq{\led@pb@setting}{before}{%
7188 \ifnum\numpagelinesR<3%
7189 \ledpbnumR{\prev@abslineverse}%
7190 \fi%
7191 }{}%
7192 \fi%
7193 \fi%
7194 \fi%
7195 }
7196 % \end{macrocode}
7197 % \end{macro}
7198 % \end{macro}
7199 % \begin{macro}{\setgoalfraction}
7200 % \begin{macro}{\ledthegoal}
7201 % \begin{macro}{\goalfraction}
7202 % \begin{macro}{\check@goal}
7203 % \protect\cs{ledthegoal} is the amount of space allowed to taken by text and
7204 % footnotes on a page before a forced pagebreak. This can be controlled via
7205 % \protect\cs{@goalfraction}. \protect\cs{ledthegoal} is calculated via \protect\cs{check@goal}.
7206 % \begin{macrocode}
7207 \newdimen\ledthegoal
7208 \ifshiftedpstarts
7209 \newcommand*{\@goalfraction}{0.95}
7210 \else
7211 \newcommand*{\@goalfraction}{0.9}
7212 \fi
7213
7214 \newcommand*{\check@goal}{%
7215 \ledthegoal=\@goalfraction\pagegoal}
7216 \newcommand{\setgoalfraction}[1]{%
7217 \xdef\@goalfraction{#1}%
7218 }
7219 % \end{macrocode}
7220 % \end{macro}
7221 % \end{macro}
7222 % \end{macro}
7223 % \end{macro}
7224 %
7225 %
7226 % \begin{macro}{\ifwrittenlinesL}
7227 % \begin{macro}{\ifwrittenlinesL}
7228 % Booleans for whether line data has been written to the section file.
7229 % \begin{macrocode}
7230 \newif\ifwrittenlinesL
7231 \newif\ifwrittenlinesR
7232
7233 % \end{macrocode}
7234 % \end{macro}
7235 % \end{macro}
7236 %
7237 % \subsection{Getting boxes content}
7238 % \begin{macro}{\if@getnextbox}
7239 % The \cs{if@getnextbox} boolean is switched to true if we can get the next chunk in a page after finished previous chunk.
7240 % That is:
7241 % \begin{itemize}
7242 % \item If we use the \option{nosyncpstarts} option, in any case
7243 % \item If we do not use it, only when the number or real or blank line of the current chunk is equal or greater to the maximum number of line in the current pair of chunks.
7244 % \end{itemize}
7245 % \begin{macrocode}
7246 \newif\if@getnextbox%
7247 % \end{macrocode}
7248 % \end{macro}
7249 % \begin{macro}{\get@nextboxL}
7250 % \begin{macro}{\get@nextboxR}
7251 % \changes{v0.11.0}{2012/06/11}{Change \protect\cs{get@nextboxL} and \protect\cs{get@nextboxR} to allow to disable line numbering (like in eledmac 0.15).}
7252 % If the current box is not empty (i.e., still contains some lines)
7253 % nothing is done. Otherwise if and only if a synchronisation point is
7254 % reached the next box is started.
7255 %
7256 % \begin{macrocode}
7257 \newcommand*{\get@nextboxL}{%
7258 \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}% box is not empty
7259 % \end{macrocode}
7260 % The current box is not empty; do nothing.
7261 % \begin{macrocode}
7262 \else% box is empty
7263 % \end{macrocode}
7264 % The box is empty.
7265 % By default, we can get the next box
7266 % \begin{macrocode}
7267 \@getnextboxtrue%Should be local, but be cautious
7268 % \end{macrocode}
7269 % But not when sufficient lines for this page have been generated (except when we don't do any synchronization whatsoever).
7270 % output.
7271 % \begin{macrocode}
7272 \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>\@donetotallinesL
7273 \parledgroup@notes@endL%
7274 \unless\ifnosyncpstarts%
7275 \@getnextboxfalse%
7276 % \end{macrocode}
7277 % If we use the nomaxlines option, we will start at new page, but we take count of the lines to be typeset for the actual right chunk on the right page, before starting new chunk on the left page.
7278 % \begin{macrocode}
7279 \ifnomaxlines%
7280 \ifdim\pagetotal<\ledthegoal%
7281 \numdef{\@tmp}{\l@dpscL+1}%
7282 \ifcsdef{afterlines@pstart@\@tmp R}{%
7283 \ifnumless{\numpagelinesL}{\csuse{afterlines@pstart@\@tmp R}}%
7284 {}%
7285 {\ifcsdef{minpage@pstart@\@tmp}%
7286 {\ifnumless{\the\c@page}{\csuse{minpage@pstart@\@tmp}}%
7287 {\ifnum\numpagelinesL=\l@dminpagelines%
7288 \@getnextboxtrue%
7289 \fi%
7290 }%
7291 {\@getnextboxtrue}}%
7292 {\@getnextboxtrue}%
7293 }%
7294 }%
7295 {}%
7296 \fi%
7297 \fi%
7298 \fi%
7299 \else%
7300 \ifnomaxlines%
7301 \numdef{\@tmp}{\the\l@dpscL+1}%
7302 \ifcsdef{minpage@pstart@\@tmp}{%
7303 \ifnumless{\the\c@page}{\csuse{minpage@pstart@\@tmp}}%
7304 {\ifdimgreater{\pagetotal}{\ledthegoal}%
7305 {\@getnextboxtrue}%
7306 {\@getnextboxfalse}%
7307 }%
7308 {\@getnextboxtrue}%
7309 }{}%
7310 \fi%
7311 \fi%
7312 % \end{macrocode}
7313 % Sufficient lines have been output.
7314 % \begin{macrocode}
7315 \if@getnextbox%
7316 \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}=\@donetotallinesL
7317 \parledgroup@notes@endL
7318 \fi
7319 \ifwrittenlinesL\else
7320 % \end{macrocode}
7321 % Write out the number of lines done, and set the boolean so this is only
7322 % done once.
7323 % \begin{macrocode}
7324 \@writelinesinparL
7325 \writtenlinesLtrue
7326 \fi
7327 \ifnum\l@dnumpstartsL>\l@dpscL
7328 % \end{macrocode}
7329 % \changes{v0.11.0}{2012/06/11}{Pstart number can be printed in side}
7330 % There are still unprocessed boxes. Recalculate the maximum number of
7331 % lines needed, and move onto the next box (by incrementing \protect\cs{l@dpscL}). If needed, restart the line numbering.
7332 % \begin{macrocode}
7333 \writtenlinesLfalse
7334 \ifbypstart@
7335 \global\line@num=0%
7336 \resetprevline@%
7337 \fi
7338 % Add the content of the optional argument of the previous \protect\cs{pend}.
7339 % \begin{macrocode}
7340 \csuse{after@pendL@\the\l@dpscL}%
7341 \global\csundef{after@pendL@\the\l@dpscL}%
7342 % \end{macrocode}
7343 % Check the number of lines
7344 % \begin{macrocode}
7345 \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
7346 {\the\@donetotallinesL}%
7347 {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
7348 \global\@donetotallinesL \z@
7349 % \end{macrocode}
7350 % Go to the next pstart
7351 % \begin{macrocode}
7352 \global\advance\l@dpscL \@ne
7353 \global\advance\pstarts@typeset@L\@ne%
7354 \global\pstartnumtrue%
7355 \restore@pstartL@pc%
7356 % \end{macrocode}
7357 % Add notes of parallel ledgroup.
7358 % \begin{macrocode}
7359 \parledgroup@notes@endL
7360 \parledgroup@correction@notespacing@final{L}
7361 \else
7362 % \end{macrocode}
7363 % \begin{macrocode}
7364 \print@last@after@pendLtrue%
7365 \fi
7366 \fi
7367 \fi}
7368 % \end{macrocode}
7369 %
7370 % \begin{macrocode}
7371 \newcommand*{\get@nextboxR}{%
7372 \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% box is not empty
7373 \else% box is empty
7374 \@getnextboxtrue%
7375 \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>\@donetotallinesR
7376 \parledgroup@notes@endR
7377 \unless\ifnosyncpstarts%
7378 \@getnextboxfalse%
7379 \ifnomaxlines%
7380 \ifdim\pagetotal<\ledthegoal%
7381 \numdef{\@tmp}{\l@dpscR+1}%
7382 \ifcsdef{afterlines@pstart@\@tmp L}{%
7383 \ifnumless{\numpagelinesL}{\csuse{afterlines@pstart@\@tmp L}}%
7384 {}%
7385 {\ifcsdef{minpage@pstart@\@tmp}%
7386 {\ifnumless{\the\c@page}{\csuse{minpage@pstart@\@tmp}}%
7387 {\ifnum\numpagelinesR=\l@dminpagelines%
7388 \@getnextboxtrue%
7389 \fi%
7390 }%
7391 {\@getnextboxtrue}}%
7392 {\@getnextboxtrue}%
7393 }%%
7394 }%
7395 {}%
7396 \fi%
7397 \fi%
7398 \fi%
7399 \else%
7400 \ifnomaxlines%
7401 \numdef{\@tmp}{\the\l@dpscR+1}%
7402 \ifcsdef{minpage@pstart@\@tmp}{%
7403 \ifnumless{\the\c@page}{\csuse{minpage@pstart@\@tmp}}%
7404 {\ifdimgreater{\pagetotal}{\ledthegoal}%
7405 {\@getnextboxtrue}%
7406 {\@getnextboxfalse}%
7407 }%
7408 {\@getnextboxtrue}%
7409 }{}
7410 \fi%
7411 \fi%
7412 \if@getnextbox%
7413 \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}=\@donetotallinesR
7414 \parledgroup@notes@endR
7415 \fi
7416 \ifwrittenlinesR\else
7417 \@writelinesinparR
7418 \writtenlinesRtrue
7419 \fi
7420 \ifnum\l@dnumpstartsR>\l@dpscR
7421 \writtenlinesRfalse
7422 \ifbypstart@R
7423 \unless\ifinstanzaR%
7424 \global\line@numR=0%
7425 \resetprevline@%
7426 \fi%
7427 \fi
7428 \csuse{after@pendR@\the\l@dpscR}%
7429 \global\csundef{after@pendR@\the\l@dpscR}%
7430 \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%
7431 {\the\@donetotallinesR}%
7432 {\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%
7433 \global\@donetotallinesR \z@
7434 \global\advance\l@dpscR \@ne
7435 \global\pstartnumRtrue%
7436 \restore@pstartR@pc%
7437 \parledgroup@notes@endR
7438 \parledgroup@correction@notespacing@final{R}
7439 \else
7440 \print@last@after@pendRtrue%
7441 \fi
7442 \fi
7443 \fi}
7444
7445 % \end{macrocode}
7446 % \end{macro}
7447 % \end{macro}
7448 %
7449 % \section{The \option{mainmatter} option of \cs{Pages}}
7450 % The optional argument of \cs{Pages} could be equal to \verb+mainmatter+.
7451 % In this case the boolean \cs{ifPages@mainmatter} is set to true, and some special things are done in \cs{Pages@mainmatter}, called by \cs{cleartol@devenpage}.
7452 % \begin{macro}{\ifPages@mainmatter}
7453 % \begin{macro}{\Pages@mainmatter}
7454 % \begin{macrocode}
7455 \newif\ifPages@mainmatter
7456 \newcommand{\Pages@mainmatter}{%
7457 \ifPages@mainmatter%
7458 \pagenumbering{arabic}%
7459 \addtocounter{page}{1}%
7460 \addtocounter{par@page}{-1}%
7461 \patchcmd{\thepage}{page}{par@page}{}{}%
7462 \fi%
7463 }
7464 % \end{macrocode}
7465 % \end{macro}
7466 % \end{macro}
7467 % \section{Sections' titles' commands}
7468 % As switching from left to right pages does not clear the page since v1.13.0,
7469 % but only creates new pages, no \verb+\vbox{}+ is inserted, and consequently parallel chapters are mis-aligned.
7470 %
7471 % So we patch the \protect\cs{chapter} command in order to prevent this problem.
7472 % \begin{macro}{\chapter}
7473 % \begin{macrocode}
7474 \pretocmd{\chapter}{%
7475 \ifl@dprintingpages%
7476 \vbox{}%
7477 \fi%
7478 }%
7479 {}%
7480 {}%
7481 % \end{macrocode}
7482 % \end{macro}
7483 % \begin{macro}{\eledsectnotoc}
7484 % \protect\cs{eledsectnotoc} just saves its content \protect\cs{@eledsectnotoc}, which will be tested where sectioning commands will be printed.
7485 % \begin{macrocode}
7486 \newcommand{\eledsectnotoc}[1]{\xdef\@eledsectnotoc{#1}}
7487 \eledsectnotoc{R}
7488 % \end{macrocode}
7489 % \end{macro}
7490 % \begin{macro}{\eledsectmark}
7491 % \protect\cs{eledsectmark} just saves its content \protect\cs{@eledsectmark}, which will be tested where sectioning commands will be printed.
7492 % \begin{macrocode}
7493 \newcommand{\eledsectmark}[1]{\xdef\@eledsectmark{#1}}
7494 \eledsectmark{L}
7495 % \end{macrocode}
7496 % \end{macro}
7497 % \begin{macro}{\eledsection@correcting@skip}
7498 % 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 \protect\cs{eledsection@correcting@skip}.
7499 % \begin{macrocode}
7500 \newskip\eledsection@correcting@skip
7501 % \end{macrocode}
7502 % \end{macro}
7503 % \begin{macro}{\eled@sectioningR@out}
7504 % We save the sectioning commands of the right side in the \protect\cs{eled@sectioningR@out} file.
7505 % \begin{macrocode}
7506 \newwrite\eled@sectioningR@out
7507 % \end{macrocode}
7508 % \end{macro}
7509 % \section{Page break/no page break, depending on the specific line}
7510 % We need to adapt the macro of the homonym section of eledmac to eledpar.
7511 % \begin{macro}{\prev@pbR}
7512 % \begin{macro}{\prev@nopbR}
7513 % The \protect\cs{l@prev@pbR} macro is a \protect\package{etoolbox}'s list, which contains the lines in which page breaks occur (before or after).
7514 % The \protect\cs{l@prev@nopbR} macro is a \protect\package{etoolbox} list, which contains the lines in which NO page breaks occur (before or after).
7515 % \begin{macrocode}
7516 \def\l@prev@pbR{}
7517 \def\l@prev@nopbR{}
7518 % \end{macrocode}
7519 % \end{macro}
7520 % \end{macro}
7521 % \begin{macro}{\ledpbR}
7522 % \begin{macro}{\ledpbnumR}
7523 % \begin{macro}{\lednopbnum}
7524 % \begin{macro}{\lednopbnumR}
7525 % The \protect\cs{ledpbR} macro writes the call to \protect\cs{led@pbR} in line-list file.
7526 % The \protect\cs{ledpbnumR} macro writes the call to \protect\cs{led@pbnumR} in line-list file.
7527 % The \protect\cs{lednopbR} macro writes the call to \protect\cs{led@nopbR} in line-list file.
7528 % The \protect\cs{lednopbnumR} macro writes the call to \protect\cs{led@nopbnumR} in line-list file.
7529 % \begin{macrocode}
7530 \newcommand{\ledpbR}{\write\linenum@outR{\string\led@pbR}}
7531 \newcommand{\ledpbnumR}[1]{\write\linenum@outR{\string\led@pbnumR{#1}}}
7532 \newcommand{\lednopbR}{\write\linenum@outR{\string\led@nopbR}}
7533 \newcommand{\lednopbnumR}[1]{\write\linenum@outR{\string\led@nopbnumR{#1}}}
7534 % \end{macrocode}
7535 % \end{macro}
7536 % \end{macro}
7537 % \end{macro}
7538 % \end{macro}
7539 % \begin{macro}{\led@pbR}
7540 % \begin{macro}{\led@pbnumR}
7541 % \begin{macro}{\led@nopbR}
7542 % \begin{macro}{\led@nopbnumR}
7543 % The \protect\cs{led@pbR} add the absolute line number in the \protect\cs{prev@pbR} list.
7544 % The \protect\cs{led@pbnumR} add the argument in the \protect\cs{prev@pbR} list.
7545 % The \protect\cs{led@nopbR} add the absolute line number in the \protect\cs{prev@nopbR} list.
7546 % The \protect\cs{led@nopbnumR} add the argument in the \protect\cs{prev@nopbR} list.
7547 % \begin{macrocode}
7548 \newcommand{\led@pbR}{\listxadd{\l@prev@pbR}{\the\absline@numR}}
7549 \newcommand{\led@pbnumR}[1]{\listxadd{\l@prev@pbR}{#1}}
7550 \newcommand{\led@nopbR}{\listxadd{\l@prev@nopbR}{\the\absline@numR}}
7551 \newcommand{\led@nopbnumR}[1]{\listxadd{\l@prev@nopbR}{#1}}
7552 % \end{macrocode}
7553 % \end{macro}
7554 % \end{macro}
7555 % \end{macro}
7556 % \end{macro}
7557 % \section{Parallel ledgroup}
7558 % \begin{macro}{\parledgroup@}
7559 % \begin{macro}{\parledgroupseries@}
7560 % \begin{macro}{\parledgrouptype@}
7561 % The marks \protect\cs{parledgroup@} contains information about the beginnings and endings of notes in a parallel ledgroup.
7562 % \protect\cs{parledgroup@series} contains the footnote series.
7563 % \protect\cs{parledgroup@type} contains the type of the footnote: critical (Xfootnote) or familiar (footnoteX).
7564 % \begin{macrocode}
7565 \newmarks\parledgroup@
7566 \newmarks\parledgroup@series
7567 \newmarks\parledgroup@type
7568 % \end{macrocode}
7569 % \end{macro}
7570 % \end{macro}
7571 % \end{macro}
7572 % \begin{macro}{\parledgroup@notes@startL}
7573 % \begin{macro}{\parledgroup@notes@startR}
7574 % \protect\cs{parledgroup@notes@startL} and \protect\cs{parledgroup@notes@startR} are used to mark the beginning of a note series in a parallel ledgroup.
7575 % \begin{macrocode}
7576 \newcommand{\parledgroup@notes@startL}{%
7577 \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>0%
7578 \IfStrEq{\splitfirstmarks\parledgroup@type}{footnoteX}{\csuse{bhooknoteX@\splitfirstmarks\parledgroup@series}}{}%
7579 \IfStrEq{\splitfirstmarks\parledgroup@type}{Xfootnote}{\csuse{bhookXnote@\splitfirstmarks\parledgroup@series}}{}%
7580 \fi%
7581 \global\ledgroupnotesL@true%
7582 \insert@noterule@ledgroup{L}%
7583 }
7584 \newcommand{\parledgroup@notes@startR}{%
7585 \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>0%
7586 \IfStrEq{\splitfirstmarks\parledgroup@type}{footnoteX}{\csuse{bhooknoteX@\splitfirstmarks\parledgroup@series}}{}%
7587 \IfStrEq{\splitfirstmarks\parledgroup@type}{Xfootnote}{\csuse{bhookXnote@\splitfirstmarks\parledgroup@series}}{}%
7588 \fi%
7589 \global\ledgroupnotesR@true%
7590 \insert@noterule@ledgroup{R}%
7591 }
7592 % \end{macrocode}
7593 % \end{macro}
7594 % \end{macro}
7595 % \begin{macro}{\parledgroup@notes@startL}
7596 % \begin{macro}{\parledgroup@notes@startR}
7597 % \protect\cs{parledgroup@notes@endL} and \protect\cs{parledgroup@notes@endR} are used to mark the end of a note series in a parallel ledgroup.
7598 % \begin{macrocode}
7599 \newcommand{\parledgroup@notes@endL}{%
7600 \global\ledgroupnotesL@false%
7601 }
7602 \newcommand{\parledgroup@notes@endR}{%
7603 \global\ledgroupnotesR@false%
7604 }
7605 % \end{macrocode}
7606 % \end{macro}
7607 % \end{macro}
7608 % \begin{macro}{\insert@noterule@ledgroup}
7609 % A \protect\cs{vskip} is not used when the boxes are constructed. So we insert it before ledgroup note series when parallel lines are constructed.
7610 % This is the goal of \protect\cs{insert@noterule@ledgroup}
7611 % \begin{macrocode}
7612 \newcommand{\insert@noterule@ledgroup}[1]{
7613 \IfStrEq{\splitbotmarks\parledgroup@}{begin}{%
7614 \IfStrEq{\splitbotmarks\parledgroup@type}{Xfootnote}{
7615 \csuse{ifledgroupnotes#1@}
7616 \vskip\skip\csuse{mp\splitbotmarks\parledgroup@series footins}
7617 \csuse{\splitbotmarks\parledgroup@series footnoterule}
7618 \fi
7619 }
7620 {}
7621 \IfStrEq{\splitbotmarks\parledgroup@type}{footnoteX}{
7622 \csuse{ifledgroupnotes#1@}
7623 \vskip\skip\csuse{mpfootins\splitbotmarks\parledgroup@series}
7624 \csuse{footnoterule\splitbotmarks\parledgroup@series}
7625 \fi
7626 }{}
7627 }
7628 {}
7629 }
7630 % \end{macrocode}
7631 % \end{macro}
7632 %
7633 % \begin{macro}{\@parledgroupnotespacing}
7634 % \protect\cs{@parledgroupnotespacing} can be redefined by the user to change the interline spacing of ledgroup notes.
7635 % \begin{macrocode}
7636 \newcommand{\setparledgroupnotespacing}[1]{\gdef\@parledgroupnotespacing{#1}}
7637 \newcommand{\@parledgroupnotespacing}{}
7638 % \end{macrocode}
7639 % \end{macro}
7640 % \begin{macro}{\parledgroup@notespacing@correction}
7641 % \begin{macro}{\parledgroup@notespacing@set@correction}
7642 % \protect\cs{parledgroup@notespacing@correction} is the difference between a normal line skip and a line skip in a note. It is set by \protect\cs{parledgroup@notespacing@set@correction}, called at the beginning of \protect\cs{Pages}.
7643 % \begin{macrocode}
7644 \dimdef{\parledgroup@notespacing@correction}{0pt}
7645 \newcommand{\parledgroup@notespacing@set@correction}{%
7646 {\@getfirstseries\csuse{Xnotefontsize@\@firstseries}%We suppose all the series has the same footnote size setup
7647 \@parledgroupnotespacing\dimgdef{\temp@spacing}{\baselineskip}}%
7648 \dimgdef{\parledgroup@notespacing@correction}{\baselineskip-\temp@spacing}%
7649 }
7650 % \end{macrocode}
7651 % \end{macro}
7652 % \end{macro}
7653 % \begin{macro}{\parledgroup@correction@notespacing@init}
7654 % \protect\cs{parledgroup@correction@notespacing@init} sets the value of accumulated corrections of note spacing to 0~pt.
7655 % It is called at the beginning of each pages AND at the end of each ledgroup.
7656 % \begin{macrocode}
7657 \newcommand{\parledgroup@correction@notespacing@init}{
7658 \dimdef{\parledgroup@notespacing@correction@accumulated}{0pt}
7659 \dimdef{\parledgroup@notespacing@correction@modulo}{0pt}
7660 }
7661 \parledgroup@correction@notespacing@init
7662 % \end{macrocode}
7663 % \end{macro}
7664 % \begin{macro}{\parledgroup@correction@notespacing@final}
7665 % \protect\cs{parledgroup@correction@notespacing@final} adds the total space deleted because of correction for notes, in a parallel ledgroup.
7666 % It also adds the space needed by the other side spaces between note rules and notes. It is called after the print of each pstart/pend.
7667 % \begin{macrocode}
7668 \newcommand{\parledgroup@correction@notespacing@final}[1]{
7669 \ifparledgroup
7670 \vspace{\parledgroup@notespacing@correction@accumulated}
7671 \parledgroup@correction@notespacing@init%
7672 \ifstrequal{#1}{L}{
7673 \numdef{\@checking}{\the\l@dpscL-1}
7674 }{
7675 \numdef{\@checking}{\the\l@dpscR-1}
7676 }
7677 \dimdef{\@beforenotes@current@diff}{\csuse{@parledgroup@beforenotes@\@checking L}-\csuse{@parledgroup@beforenotes@\@checking R}}%
7678 \ifstrequal{#1}{L}%
7679 {% Left
7680 \ifdimgreater{\@beforenotes@current@diff}{0pt}{}{\vspace{-\@beforenotes@current@diff}}%
7681 }%
7682 {% Right
7683 \ifdimgreater{\@beforenotes@current@diff}{0pt}{\vspace{\@beforenotes@current@diff}}{}
7684 }%
7685 \fi
7686 }
7687 % \end{macrocode}
7688 % \end{macro}
7689 % \begin{macro}{\parledgroup@correction@notespacing}
7690 % \protect\cs{parledgroup@correction@notespacing} is used before each printed line.
7691 % If it is a line of notes in parallel ledgroup, the space \protect\cs{parledgroup@notespacing@correction} is decreased, to make interline space correct.
7692 % The decreased space is added to \protect\cs{parledgroup@notespacing@correction@accumulated} and \protect\cs{parledgroup@notespacing@correction@modulo}.
7693 % If \protect\cs{parledgroup@notespacing@correction@modulo} is equal or greater than \protect\cs{baselineskip}:
7694 % \begin{itemize}
7695 % \item It is decreased by \protect\cs{baselineskip}.
7696 % \item The total of line number in the current page is decreased by one.
7697 % \end{itemize}
7698 % For example, suppose an normal interline of 24~pt and interline for note of 12~pt.
7699 % 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.
7700 % \begin{macrocode}{}
7701 \newcommand{\parledgroup@correction@notespacing}[1]{%
7702 \csuse{ifledgroupnotes#1@}%
7703 \vspace{-\parledgroup@notespacing@correction}%
7704 \dimdef{\parledgroup@notespacing@correction@accumulated}{\parledgroup@notespacing@correction@accumulated+\parledgroup@notespacing@correction}%
7705 \dimdef{\parledgroup@notespacing@correction@modulo}{\parledgroup@notespacing@correction@modulo+\parledgroup@notespacing@correction}%
7706 \ifdimless{\parledgroup@notespacing@correction@modulo}{\baselineskip}{}{\advance\numpagelinesL -\@ne%
7707 \dimdef{\parledgroup@notespacing@correction@modulo}{\parledgroup@notespacing@correction@modulo-\baselineskip}%
7708 }% mean greater than equal
7709 \fi%
7710 }
7711 % \end{macrocode}
7712 % \end{macro}
7713 % \begin{macro}{\parledgroup@beforenotesL}
7714 % \begin{macro}{\parledgroup@beforenotesR}
7715 % \protect\cs{parledgroup@beforenotesL} and \protect\cs{parledgroup@beforenotesR} store the total of space before notes in the current parallel ledgroup.
7716 % \begin{macrocode}
7717 \dimdef\parledgroup@beforenotesL{0pt}
7718 \dimdef\parledgroup@beforenotesR{0pt}
7719 % \end{macrocode}
7720 % \end{macro}
7721 % \end{macro}
7722 % \begin{macro}{\parledgroup@beforenotes@save}
7723 % The macro \protect\cs{parledgroup@beforenotes@save} dumps the space before notes of the current parallel ledgroup in a macro named with the current pstart number.
7724 % \begin{macrocode}
7725 \newcommand{\parledgroup@beforenotes@save}[1]{
7726 \ifparledgroup
7727 \csdimgdef{@parledgroup@beforenotes@\the\csuse{l@dnumpstarts#1}#1}{\csuse{parledgroup@beforenotes#1}}
7728 \csdimgdef{parledgroup@beforenotes#1}{0pt}
7729 \fi
7730 }
7731 % \end{macrocode}
7732 % \end{macro}
7733
7734
7735 % \section{Compatibility with \eledmac}
7736 %
7737 % Here, we define some command for the \verb+eledmac-compat+ option.
7738 %
7739 % \begin{macrocode}
7740 \ifeledmaccompat@%
7741
7742
7743 \unless\ifnocritical@
7744 \let\onlyXside\Xonlyside
7745 \fi
7746 \fi
7747 % \end{macrocode}
7748 % \section{The End}\label{end}
7749 %
7750 %
7751 %</code>
7752 %
7753 % \newpage
7754 % \appendix
7755 % \clearpage
7756 %
7757 % \let\oldthesection\thesection
7758 % \renewcommand{\thesection}{Appendix \oldthesection}
7759 % \renewcommand{\thesubsection}{\oldthesection.\arabic{subsection}}
7760 % \section{Some things to do when changing version}
7761 % \input{doc-include/migrate-par.dtx}
7762 % \bibliographystyle{alpha}
7763 % \begin{thebibliography}{WWW99}
7764 % \addcontentsline{toc}{section}{References}
7765 % \bibitem[LW90]{EDMACTUG}
7766 % John Lavagnino and Dominik Wujastyk.
7767 % \newblock \enquote{An overview of \edmac: a \textsc{Plain} TeX format for
7768 % critical editions}.
7769 % \newblock \emph{TUGboat}, \textbf{11}, 4, pp. 623--643, November 1990.
7770 % \newblock (Code available from CTAN in
7771 % \texttt{macros/plain/contrib/edmac})
7772 %
7773 %
7774 % \bibitem[Wil02]{MEMOIR}
7775 % Peter Wilson.
7776 % \newblock \emph{The \protect\package{memoir} class for configurable typesetting}.
7777 % \newblock November 2002.
7778 % \newblock (Available from CTAN in
7779 % \texttt{macros/latex/contrib/memoir})
7780 %
7781 % \bibitem[Wil04]{ELEDMAC}
7782 % Peter Wilson and Maïeul Rouquette.
7783 % \newblock \emph{\protect\package{eledmac} A presumptuous attempt to port
7784 % \protect\package{EDMAC},\protect\package{TABMAC} and \protect\package{EDSTANZA} to
7785 % LaTeX}.
7786 % \newblock December 2004.
7787 % \newblock (Available from CTAN in
7788 % \texttt{macros/latex/contrib/eledmac})
7789 %
7790 % \end{thebibliography}
7791 %
7792 % \Finale
7793 % \phantomsection
7794 % \addcontentsline{toc}{section}{Index}
7795 % \PrintIndex
7796 %
7797 % \phantomsection
7798 % \addcontentsline{toc}{section}{Change History}
7799 % \PrintChanges
7800 % \endinput
7801 \endinput
7802
7803 %% \CharacterTabl
7804 %% 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
7805 %% 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
7806 %% Digits \0\1\2\3\4\5\6\7\8\9
7807 %% Exclamation \! Double quote \" Hash (number) \#
7808 %% Dollar \$ Percent \% Ampersand \&
7809 %% Acute accent \' Left paren \( Right paren \)
7810 %% Asterisk \* Plus \+ Comma \,
7811 %% Minus \- Point \. Solidus \/
7812 %% Colon \: Semicolon \; Less than \<
7813 %% Equals \= Greater than \> Question mark \?
7814 %% Commercial at \@ Left bracket \[ Backslash \\
7815 %% Right bracket \] Circumflex \^ Underscore \_
7816 %% Grave accent \` Left brace \{ Vertical bar \|
7817 %% Right brace \} Tilde \~}
7818 %%