summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/reledmac/reledmac.sty6269
-rw-r--r--Master/texmf-dist/tex/latex/reledmac/reledpar.sty2491
2 files changed, 8760 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/reledmac/reledmac.sty b/Master/texmf-dist/tex/latex/reledmac/reledmac.sty
new file mode 100644
index 00000000000..8e879a1b9cf
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/reledmac/reledmac.sty
@@ -0,0 +1,6269 @@
+%%
+%% This is file `reledmac.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% reledmac.dtx (with options: `code')
+%%
+%% Author: Author: Peter Wilson ; Herries Press herries dot press at earthlink dot net ; Maïeul Rouquette maieul at maieul dot net
+%% Copyright 2004, 2005 Peter R. Wilson
+%% 2011- Maïeul Rouquette
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 of this license or (at your option) any
+%% later version.
+%% The latest version of the license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2003/06/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This work consists of the files listed in the README file.
+
+
+
+
+
+
+
+
+
+
+
+
+ \newcommand{\numberit}{%
+ \refstepcounter{stanzanum}%
+ \flagstanza{\thestanzanum}%
+ }
+%%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{reledmac}[2015/07/19 v2.0.0 typesset critical edition]%
+\RequirePackage{xkeyval}
+\newif\ifparledgroup
+\DeclareOptionX{series}[A,B,C,D,E]{\xdef\default@series{#1}}
+\ExecuteOptionsX{series}%
+
+\newif\if@noeled@sec%
+\DeclareOptionX{noeledsec}{\@noeled@sectrue}
+
+\newif\ifnocritical@%
+\DeclareOptionX{nocritical}{\nocritical@true}%
+
+\newif\ifnofamiliar@%
+\DeclareOptionX{nofamiliar}{\nofamiliar@true}%
+
+\newif\ifnoledgroup@%
+\DeclareOptionX{noledgroup}{\noledgroup@true}%
+
+\newif\ifnoend@%
+\DeclareOptionX{noend}{%
+ \let\l@dend@open\@gobble%
+ \let\l@dend@close\relax%
+ \global\let\l@dend@stuff=\relax%
+ \noend@true%
+}%
+
+\newif\ifnoquotation@
+\DeclareOptionX{noquotation}{\noquotation@true}
+
+\newif\ifledfinal
+\DeclareOptionX{final}{\ledfinaltrue}
+\DeclareOptionX{draft}{\ledfinalfalse}
+\ExecuteOptionsX{final}
+
+\newif\ifparapparatus@
+\DeclareOptionX{parapparatus}{\parapparatus@true}
+
+\newif\iflednopbinverse
+\DeclareOptionX{nopbinverse}{\lednopbinversetrue}
+
+\newif\ifwidthliketwocolumns%
+\DeclareOptionX{widthliketwocolumns}{\widthliketwocolumnstrue}%
+
+\newif\ifxindy@
+\DeclareOptionX{xindy}[eledmac-markup-attr.xdy]{%
+ \AtBeginDocument{\immediate\openout\eledmac@xindy@out=#1}%
+ \newwrite\eledmac@xindy@out%
+ \xindy@true%
+ \gdef\eledmacmarkuplocrefdepth{:depth 1}%
+ \AtEndDocument{\immediate\closeout\eledmac@xindy@out}%
+}%
+
+\newif\ifxindyhyperref@
+\DeclareOptionX{xindy+hyperref}{%
+ \xindyhyperref@true%
+}%
+
+\newif\ifeledmaccompat@%
+\DeclareOptionX{eledmac-compat}{%
+ \eledmaccompat@true%
+}%
+\ProcessOptionsX*\relax
+
+\RequirePackage{xargs}
+\RequirePackage{etoolbox}
+\RequirePackage{etex}
+\reserveinserts{32}
+\RequirePackage{suffix}
+\RequirePackage{xstring}
+\RequirePackage{ifluatex}
+\RequirePackage{ragged2e}
+\RequirePackage{ragged2e}
+\RequirePackage{ifxetex}%
+\newif\ifl@dmemoir
+\@ifclassloaded{memoir}{\l@dmemoirtrue}{\l@dmemoirfalse}
+
+\newif\ifl@imakeidx
+\@ifpackageloaded{imakeidx}{\l@imakeidxtrue}{}%False is the default value
+\newif\ifl@indextools%
+\@ifpackageloaded{indextools}{%
+ \l@indextoolstrue%
+ \l@imakeidxtrue%
+ \let\imki@wrindexentry\indtl@wrindexentry%
+ }{}%
+\ifdef{\if@RTL}{}{\newif\if@RTL}
+\newcommand{\reledmac@warning}[1]{\PackageWarning{reledmac}{#1}}
+\newcommand{\reledmac@error}[2]{\PackageError{reledmac}{#1}{#2}}
+\newcommand*{\led@err@NumberingStarted}{%
+ \reledmac@error{Numbering has already been started}{\@ehc}}
+\newcommand*{\led@err@NumberingNotStarted}{%
+ \reledmac@error{Numbering was not started}{\@ehc}}
+\newcommand*{\led@err@NumberingShouldHaveStarted}{%
+ \reledmac@error{Numbering should already have been started}{\@ehc}}
+\newcommand*{\led@err@edtextoutsidepstart}{%
+ \reledmac@error{\string\edtext\space outside numbered paragraph (\pstart\ldots\pend)}{\@ehc}}%
+\newcommand*{\led@mess@NotesChanged}{%
+ \typeout{reledmac reminder: }%
+ \typeout{ The number of the footnotes in this section
+ has changed since the last run.}%
+ \typeout{ You will need to run LaTeX two more times
+ before the footnote placement}%
+ \typeout{ and line numbering in this section are
+ correct.}}
+\newcommand*{\led@mess@SectionContinued}[1]{%
+ \message{Section #1 (continuing the previous section)}}
+\newcommand*{\led@err@LineationInNumbered}{%
+ \reledmac@error{You can't use \string\lineation\space within
+ a numbered section}{\@ehc}}
+\newcommand*{\led@warn@BadLineation}{%
+ \reledmac@warning{Bad \string\lineation\space argument}}
+\newcommand*{\led@warn@BadLinenummargin}{%
+ \reledmac@warning{Bad \string\linenummargin\space argument}}
+\newcommand*{\led@warn@BadLockdisp}{%
+ \reledmac@warning{Bad \string\lockdisp\space argument}}
+\newcommand*{\led@warn@BadSublockdisp}{%
+ \reledmac@warning{Bad \string\sublockdisp\space argument}}
+\newcommand*{\led@warn@NoLineFile}[1]{%
+ \reledmac@warning{Can't find line-list file #1}}
+\newcommand*{\led@warn@Obsolete}[1]{%
+ \reledmac@warning{Line-list file #1 was obsolete. We have not read it. Please run LaTeX again.}}
+\newcommand*{\led@warn@BadAdvancelineSubline}{%
+ \reledmac@warning{\string\advanceline\space produced a sub-line
+ number less than zero.}}
+\newcommand*{\led@warn@BadAdvancelineLine}{%
+ \reledmac@warning{\string\advanceline\space produced a line
+ number less than zero.}}
+\newcommand*{\led@warn@BadSetline}{%
+ \reledmac@warning{Bad \string\setline\space argument}}
+\newcommand*{\led@warn@BadSetlinenum}{%
+ \reledmac@warning{Bad \string\setlinenum\space argument}}
+\newcommand*{\led@err@PstartNotNumbered}{%
+ \reledmac@error{\string\pstart\space must be used within a
+ numbered section}{\@ehc}}
+\newcommand*{\led@err@PstartInPstart}{%
+ \reledmac@error{\string\pstart\space encountered while another
+ \string\pstart\space was in effect}{\@ehc}}
+\newcommand*{\led@err@PendNotNumbered}{%
+ \reledmac@error{\string\pend\space must be used within a
+ numbered section}{\@ehc}}
+\newcommand*{\led@err@PendNoPstart}{%
+ \reledmac@error{\string\pend\space must follow a \string\pstart}{\@ehc}}
+\newcommand*{\led@err@AutoparNotNumbered}{%
+ \reledmac@error{\string\autopar\space must be used within a
+ numbered section}{\@ehc}}
+\newcommand*{\led@err@NumberingWithoutPstart}{%
+ \reledmac@error{\string\beginnumbering...\string\endnumbering\space without \string\pstart}{\@ehc}}%
+\newcommand*{\led@warn@BadAction}{%
+ \reledmac@warning{Bad action code, value \next@action.}}
+\newcommand*{\led@warn@DuplicateLabel}[1]{%
+ \reledmac@warning{Duplicate definition of label `#1' on page \the\pageno.}}
+\newcommand*{\led@warn@AppLabelOutEdtext}[1]{%
+ \reledmac@warning{\string\applabel\space outside of \string\edtext\space `#1' on page \the\pageno.}}%
+\newcommand*{\led@warn@RefUndefined}[1]{%
+ \reledmac@warning{Reference `#1' on page \the\pageno\space undefined.
+ Using `000'.}}
+\newcommand*{\led@warn@NoMarginpars}{%
+ \reledmac@warning{You can't use \string\marginpar\space in numbered text}}
+\newcommand*{\led@warn@BadSidenotemargin}{%
+ \reledmac@warning{Bad \string\sidenotemmargin\space argument}}
+\newcommand*{\led@warn@NoIndexFile}[1]{%
+ \reledmac@warning{Undefined index file #1}}
+\newcommand{\led@warn@SeriesStillExist}[1]{%
+ \reledmac@warning{Series #1 is still existing !}%
+}%
+\newcommand{\led@err@ManySidenotes}{%
+ \ifledRcol@%
+ \reledmac@warning{\itemcount@\space sidenotes on line \the\line@numR\space p. \the\page@numR}%
+ \else%
+ \reledmac@warning{\itemcount@\space sidenotes on line \the\line@num\space p. \the\page@num}%
+ \fi%
+}%
+\newcommand{\led@err@ManyLeftnotes}{%
+ \ifledRcol@%
+ \reledmac@warning{\itemcount@\space leftnotes on line \the\line@numR\space p. \the\page@numR}%
+ \else%
+ \reledmac@warning{\itemcount@\space leftnotes on line \the\line@num\space p. \the\page@num}%
+ \fi%
+}%
+\newcommand{\led@err@ManyRightnotes}{%
+ \ifledRcol@%
+ \reledmac@warning{\itemcount@\space rightnotes on line \the\line@numR\space p. \the\page@numR}%
+ \else%
+ \reledmac@warning{\itemcount@\space rightnotes on line \the\line@num\space p. \the\page@num}%
+ \fi%
+}%
+\newcommand*{\led@err@TooManyColumns}{%
+ \reledmac@error{Too many columns}{\@ehc}}
+\newcommand*{\led@err@UnequalColumns}{%
+ \reledmac@error{Number of columns is not equal to the number
+ in the previous row (or \protect\\ \space forgotten?)}{\@ehc}}
+\newcommand*{\led@err@LowStartColumn}{%
+ \reledmac@error{Start column is too low}{\@ehc}}
+\newcommand*{\led@err@HighEndColumn}{%
+ \reledmac@error{End column is too high}{\@ehc}}
+\newcommand*{\led@err@ReverseColumns}{%
+ \reledmac@error{Start column is greater than end column}{\@ehc}}
+\newcommand{\led@err@EdtextWithoutFootnote}{%
+ \reledmac@error{edtext without Xfootnote. Check syntaxis.}{\@ehc}%
+}%
+\newcommand{\led@err@FootnoteWithoutEdtext}{%
+ \reledmac@error{Xfootnote without edtext. Check syntax.}{\@ehc}%
+}%
+\newcommand{\led@error@ImakeidxAfterEledmac}{%
+ \reledmac@error{Imakeidx must be loaded before eledmac.}{\@ehc}%
+}%
+\newcommand{\led@error@IndextoolsAfterEledmac}{%
+ \reledmac@error{Indextools must be loaded before eledmac.}{\@ehc}%
+}%
+\newcommand{\led@error@fail@patch@@makecol}{%
+ \reledmac@error{Fail to patch \string\@makecol\space command.}{\@ehc}%
+}%
+\newcommand{\led@error@fail@patch@@reinserts}{%
+ \reledmac@error{Fail to patch \string\@reinserts\space command.}{\@ehc}%
+}%
+\newcommand{\led@error@fail@patch@@doclearpage}{%
+ \reledmac@error{Fail to patch \string\@doclearpage\space command.}{\@ehc}%
+}%
+\newcommand{\led@error@fail@patch@@iiiminipage}{%
+ \reledmac@error{Fail to patch \string\@iiiminipage\space command.}{\@ehc}%
+}%
+\newcommand{\led@error@fail@patch@endminipage}{%
+ \reledmac@error{Fail to patch \string\endminipage\space command.}{\@ehc}%
+}%
+\providecommand*{\@gobblethree}[3]{}
+\providecommand*{\@gobblefour}[4]{}
+\providecommand*{\@gobblefive}[5]{}
+\ifledfinal
+ \newcommand*{\showlemma}[1]{#1}
+\else
+ \newcommand*{\showlemma}[1]{\underline{#1}}
+\fi
+
+\let\linenumberlist=\empty
+
+\newcount\@l@dtempcnta \newcount\@l@dtempcntb
+\newif\ifl@dpairing
+\newif\ifl@dpaging%
+\newif\ifl@dprintingpages%
+\newif\ifl@dprintingcolumns%
+\newif\ifpst@rtedL
+\newcount\l@dnumpstartsL
+\newif\ifledRcol
+\newif\ifledRcol@
+\newif\ifnumberingR
+\newcount\section@num
+\section@num=0
+\let\extensionchars=\empty
+\newif\ifnumbering
+\newcommand*{\beginnumbering}{%
+ \ifnumbering
+ \led@err@NumberingStarted
+ \endnumbering
+ \fi
+ \global\numberingtrue
+ \global\advance\section@num \@ne
+ \initnumbering@reg
+ \message{Section \the\section@num }%
+ \line@list@stuff{\jobname.\extensionchars\the\section@num}%
+ \l@dend@stuff
+ \setcounter{pstart}{1}
+ \ifl@dpairing
+ \global\l@dnumpstartsL \z@
+ \global\pst@rtedLfalse
+ \else
+ \begingroup
+ \global\@afterindenttrue%In order to retablish normal feature if the \begingroup was not here
+ \initnumbering@quote
+ \ifwidthliketwocolumns%
+ \csuse{setwidthliketwocolumns@\columns@position}%
+ \csuse{setpositionliketwocolumns@\columns@position}%
+ \fi%
+ \fi
+ \gdef\eled@sections@@{}%
+ \if@noeled@sec\else%
+ \makeatletter\InputIfFileExists{\jobname.eledsec\the\section@num}{}{}\makeatother%
+ \immediate\openout\eled@sectioning@out=\jobname.eledsec\the\section@num\relax%
+ \fi%
+}
+\newcommand*{\initnumbering@reg}{%
+ \global\pst@rtedLfalse
+ \global\l@dnumpstartsL \z@
+ \global\absline@num \z@
+ \gdef\normal@page@break{}
+ \gdef\l@prev@pb{}
+ \gdef\l@prev@nopb{}
+ \global\line@num \z@
+ \global\subline@num \z@
+ \global\@lock \z@
+ \global\sub@lock \z@
+ \global\sublines@false
+ \global\let\next@page@num=\relax
+ \global\let\sub@change=\relax
+ \resetprevline@
+ \resetprevpage@num
+ }
+
+\def\endnumbering{%
+ \ifnumbering
+ \global\numberingfalse
+ \normal@pars
+ \ifnum\l@dnumpstartsL=0%
+ \led@err@NumberingWithoutPstart%
+ \fi%
+ \ifl@dpairing
+ \global\pst@rtedLfalse
+ \else
+ \ifx\insertlines@list\empty\else
+ \global\noteschanged@true
+ \fi
+ \ifx\line@list\empty\else
+ \global\noteschanged@true
+ \fi
+ \fi
+ \ifnoteschanged@
+ \led@mess@NotesChanged
+ \fi
+ \else
+ \led@err@NumberingNotStarted
+ \fi
+ \autoparfalse
+ \if@noeled@sec\else%
+ \immediate\closeout\eled@sectioning@out%
+ \fi%
+ \ifl@dpairing\else
+ \global\l@dnumpstartsL=\z@%
+ \endgroup
+ \fi
+}
+\newcommand{\pausenumbering}{%
+ \ifautopar\global\autopar@pausetrue\fi%
+ \endnumbering\global\numberingtrue}
+\newcommand*{\resumenumbering}{%
+ \ifnumbering
+ \ifautopar@pause\autopar\fi
+ \global\pst@rtedLtrue
+ \global\advance\section@num \@ne
+ \led@mess@SectionContinued{\the\section@num}%
+ \line@list@stuff{\jobname.\extensionchars\the\section@num}%
+ \l@dend@stuff
+ \ifl@dpairing\else%
+ \begingroup%
+ \initnumbering@quote%
+ \ifwidthliketwocolumns%
+ \csuse{setwidthliketwocolumns@\columns@position}%
+ \csuse{setpositionliketwocolumns@\columns@position}%
+ \fi%
+ \fi%
+ \else
+ \led@err@NumberingShouldHaveStarted
+ \endnumbering
+ \beginnumbering
+ \fi}
+
+\newcommand*{\list@create}[1]{%
+ \global\let#1=\empty%
+}%
+\newcommand*{\list@clear}[1]{%
+ \global\let#1=\empty%
+}
+\newtoks\led@toksa \newtoks\led@toksb
+\global\led@toksa={\\}
+\long\def\xright@appenditem#1\to#2{%
+ \global\led@toksb=\expandafter{#2}%
+ \xdef#2{\the\led@toksb\the\led@toksa\expandafter{#1}}%
+ \global\led@toksb={}}
+\long\def\xleft@appenditem#1\to#2{%
+ \global\led@toksb=\expandafter{#2}%
+ \xdef#2{\the\led@toksa\expandafter{#1}\the\led@toksb}%
+ \global\led@toksb={}}
+\def\gl@p#1\to#2{\expandafter\gl@poff#1\gl@poff#1#2}
+\long\def\gl@poff\\#1#2\gl@poff#3#4{\gdef#4{#1}\gdef#3{#2}}
+
+\newif\ifbypage@
+\newif\ifbypstart@
+\newif\ifbypage@R
+\newif\ifbypstart@R
+\newcommand*{\lineation}[1]{{
+ \ifnumbering
+ \led@err@LineationInNumbered
+ \else
+ \def\@tempa{#1}\def\@tempb{page}%
+ \ifx\@tempa\@tempb
+ \global\bypage@true
+ \global\bypstart@false
+ \unless\ifnocritical@%
+ \Xpstart[][false]%
+ \fi%
+ \else
+ \def\@tempb{pstart}%
+ \ifx\@tempa\@tempb
+ \global\bypage@false
+ \global\bypstart@true
+ \unless\ifnocritical@%
+ \Xpstart%
+ \fi%
+ \else
+ \def\@tempb{section}
+ \ifx\@tempa\@tempb
+ \global\bypage@false
+ \global\bypstart@false
+ \unless\ifnocritical@%
+ \Xpstart[][false]%
+ \fi%
+ \else
+ \led@warn@BadLineation
+ \fi
+ \fi
+ \fi
+ \fi}}
+\newcount\line@margin
+
+\newcommand*{\linenummargin}[1]{{%
+ \l@dgetline@margin{#1}%
+ \ifnum\@l@dtempcntb>\m@ne
+ \ifledRcol
+ \global\line@marginR=\@l@dtempcntb
+ \else
+ \global\line@margin=\@l@dtempcntb
+ \fi
+ \fi}}
+
+\newcommand*{\l@dgetline@margin}[1]{%
+ \def\@tempa{#1}\def\@tempb{left}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \z@
+ \else
+ \def\@tempb{right}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \@ne
+ \else
+ \def\@tempb{outer}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \tw@
+ \else
+ \def\@tempb{inner}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \thr@@
+ \else
+ \led@warn@BadLinenummargin
+ \@l@dtempcntb \m@ne
+ \fi
+ \fi
+ \fi
+ \fi}
+
+\newcounter{firstlinenum}
+ \setcounter{firstlinenum}{5}
+\newcounter{linenumincrement}
+ \setcounter{linenumincrement}{5}
+\newcounter{firstsublinenum}
+ \setcounter{firstsublinenum}{5}
+\newcounter{sublinenumincrement}
+ \setcounter{sublinenumincrement}{5}
+
+
+\newcommand*{\firstlinenum}[1]{%
+ \ifledRcol%
+ \setcounter{firstlinenumR}{#1}%
+ \else%
+ \setcounter{firstlinenum}{#1}%
+ \fi%
+}
+\newcommand*{\linenumincrement}[1]{%
+ \ifledRcol%
+ \setcounter{linenumincrementR}{#1}%
+ \else%
+ \setcounter{linenumincrement}{#1}%
+ \fi%
+}
+\newcommand*{\firstsublinenum}[1]{%
+ \ifledRcol%
+ \setcounter{firstsublinenumR}{#1}%
+ \else%
+ \setcounter{firstsublinenum}{#1}%
+ \fi%
+}
+\newcommand*{\sublinenumincrement}[1]{%
+ \ifledRcol%
+ \setcounter{sublinenumincrementR}{#1}%
+ \else%
+ \setcounter{sublinenumincrement}{#1}%
+ \fi%
+}
+
+\newcount\lock@disp
+\newcommand{\lockdisp}[1]{{%
+ \l@dgetlock@disp{#1}%
+ \ifnum\@l@dtempcntb>\m@ne
+ \global\lock@disp=\@l@dtempcntb
+ \else
+ \led@warn@BadLockdisp
+ \fi}}
+\newcommand*{\l@dgetlock@disp}[1]{
+ \def\@tempa{#1}\def\@tempb{first}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \z@
+ \else
+ \def\@tempb{last}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \@ne
+ \else
+ \def\@tempb{all}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \tw@
+ \else
+ \@l@dtempcntb \m@ne
+ \fi
+ \fi
+ \fi}
+
+\newcount\sublock@disp
+\newcommand{\sublockdisp}[1]{{%
+ \l@dgetlock@disp{#1}%
+ \ifnum\@l@dtempcntb>\m@ne
+ \global\sublock@disp=\@l@dtempcntb
+ \else
+ \led@warn@BadSublockdisp
+ \fi}}
+
+\newcommand*{\linenumberstyle}[1]{%
+ \def\linenumrep##1{\@nameuse{@#1}{##1}}}
+\newcommand*{\sublinenumberstyle}[1]{%
+ \def\sublinenumrep##1{\@nameuse{@#1}{##1}}}
+\linenumberstyle{arabic}
+ \let\linenumr@p\linenumrep
+\sublinenumberstyle{arabic}
+ \let\sublinenumr@p\sublinenumrep
+
+\newlength{\linenumsep}
+ \setlength{\linenumsep}{1pc}
+\newcommand*{\numlabfont}{\normalfont\scriptsize}
+\newcommand*{\ledlinenum}{%
+ \bgroup%
+ \ifluatex%
+ \luatextextdir TLT%
+ \fi%
+ \numlabfont\linenumrep{\line@num}%
+ \ifsublines@
+ \ifnum\subline@num>0\relax
+ \unskip\fullstop\sublinenumrep{\subline@num}%
+ \fi
+ \fi%
+ \egroup%
+}%
+
+\newcommand*{\leftlinenum}{%
+ \ledlinenum
+ \kern\linenumsep}
+\newcommand*{\rightlinenum}{%
+ \kern\linenumsep
+ \ledlinenum}
+
+\newcount\line@num
+\newcount\subline@num
+\newif\ifsublines@
+\newcount\absline@num
+\newcount\@lock
+\newcount\sub@lock
+\list@create{\line@list}
+\list@create{\insertlines@list}
+\list@create{\actionlines@list}
+\list@create{\actions@list}
+
+\newcount\page@num
+\newcount\endpage@num
+\newcount\endline@num
+\newcount\endsubline@num
+\newif\ifnoteschanged@
+\newcommand*{\resetprevline@}{%
+ \def\do##1{\global\csundef{prevline##1}}%
+ \dolistloop{\@series}%
+}
+\newcommand*{\resetprevpage@num}{%
+ \def\do##1{\ifcsdef{prevpage##1@num}{\global\csname prevpage##1@num\endcsname=0}{}}%
+ \dolistloop{\@series}%
+}
+\newread\@inputcheck
+\newcommand*{\read@linelist}[1]{%
+ \ifledRcol%
+ \list@clearing@regR%
+ \else%
+ \list@clearing@reg%
+ \fi%
+ \list@clear{\maxlinesinpar@list}
+ \get@linelistfile{#1}%
+ \endgroup
+ \ifledRcol
+ \global\page@numR=\m@ne
+ \ifx\actionlines@listR\empty
+ \gdef\next@actionlineR{1000000}%
+ \else
+ \gl@p\actionlines@listR\to\next@actionlineR
+ \gl@p\actions@listR\to\next@actionR
+ \fi
+ \else
+ \global\page@num=\m@ne
+ \ifx\actionlines@list\empty
+ \gdef\next@actionline{1000000}%
+ \else
+ \gl@p\actionlines@list\to\next@actionline
+ \gl@p\actions@list\to\next@action
+ \fi
+ \fi
+}
+\newcommand*{\list@clearing@reg}{%
+ \list@clear{\line@list}%
+ \list@clear{\insertlines@list}%
+ \list@clear{\actionlines@list}%
+ \list@clear{\actions@list}%
+ \list@clear{\linesinpar@listL}%
+ \list@clear{\linesonpage@listL}%
+ }%
+\newcommand*{\get@linelistfile}[1]{%
+ \InputIfFileExists{#1}{%
+ \global\noteschanged@false
+ \begingroup
+ \catcode`\[=1 \catcode`\]=2
+ \makeatletter \catcode`\^^M=9}{%
+ \led@warn@NoLineFile{#1}%
+ \global\noteschanged@true
+ \begingroup}%
+}
+
+\newcommand{\line@list@version}[1]{%
+ \IfStrEq{#1}{\this@line@list@version}%
+ {}%
+ {\ifledRcol%
+ \led@warn@Obsolete{\jobname.\extensionchars\the\section@num}%
+ \else%
+ \led@warn@Obsolete{\jobname.\extensionchars\the\section@num}%
+ \fi%
+ \endinput%
+ }%
+}%
+
+\newcommand*{\@nl}[2]{%
+ \fix@page{#1}%
+ \ifledRcol%
+ \@nl@regR%
+ \else%
+ \@nl@reg%
+ \fi%
+}
+\newcommand*{\@nl@reg}{%
+ \ifx\l@dchset@num\relax \else
+ \advance\absline@num \@ne
+ \set@line@action
+ \let\l@dchset@num=\relax
+ \advance\absline@num \m@ne
+ \advance\line@num \m@ne
+ \fi
+ \advance\absline@num \@ne
+ \ifx\next@page@num\relax \else
+ \page@action
+ \let\next@page@num=\relax
+ \fi
+ \ifx\sub@change\relax \else
+ \ifnum\sub@change>\z@
+ \sublines@true
+ \else
+ \sublines@false
+ \fi
+ \sub@action
+ \let\sub@change=\relax
+ \fi
+ \ifcase\@lock
+ \or
+ \@lock \tw@
+ \or \or
+ \@lock \z@
+ \fi
+ \ifcase\sub@lock
+ \or
+ \sub@lock \tw@
+ \or \or
+ \sub@lock \z@
+ \fi
+ \ifsublines@
+ \ifnum\sub@lock<\tw@
+ \advance\subline@num \@ne
+ \fi
+ \else
+ \ifnum\@lock<\tw@
+ \advance\line@num \@ne \subline@num \z@
+ \fi
+ \fi}
+
+\newcount\last@page@num
+ \last@page@num=-10000
+
+\newcommand*{\fix@page}[1]{%
+ \ifledRcol
+ \ifnum #1=\last@page@numR
+ \else
+ \ifbypage@R
+ \line@numR \z@ \subline@numR \z@
+ \fi
+ \page@numR=#1\relax
+ \last@page@numR=#1\relax
+ \def\next@page@numR{#1}%
+ \fi
+ \else
+ \ifnum #1=\last@page@num
+ \else
+ \ifbypage@
+ \line@num \z@ \subline@num \z@
+ \fi
+ \page@num=#1\relax
+ \last@page@num=#1\relax
+ \def\next@page@num{#1}%
+ \listxadd{\normal@page@break}{\the\absline@num}
+ \fi
+ \fi}
+\newcommand*{\@pend}[1]{}
+\newcommand*{\@pendR}[1]{}
+\newcommand*{\@lopL}[1]{}
+\newcommand*{\@lopR}[1]{}
+
+\newcommand*{\sub@on}{\ifsublines@
+ \let\sub@change=\relax
+ \else
+ \def\sub@change{1}%
+ \fi}
+\newcommand*{\sub@off}{\ifsublines@
+ \def\sub@change{-1}%
+ \else
+ \let\sub@change=\relax
+ \fi}
+
+
+\newcommand*{\@adv}[1]{%
+ \ifsublines@
+ \ifledRcol
+ \advance\subline@numR by #1\relax
+ \ifnum\subline@numR<\z@
+ \led@warn@BadAdvancelineSubline
+ \subline@numR \z@
+ \fi
+ \else
+ \advance\subline@num by #1\relax
+ \ifnum\subline@num<\z@
+ \led@warn@BadAdvancelineSubline
+ \subline@num \z@
+ \fi
+ \fi
+ \else
+ \ifledRcol
+ \advance\line@numR by #1\relax
+ \ifnum\line@numR<\z@
+ \led@warn@BadAdvancelineLine
+ \line@numR \z@
+ \fi
+ \else
+ \advance\line@num by #1\relax
+ \ifnum\line@num<\z@
+ \led@warn@BadAdvancelineLine
+ \line@num \z@
+ \fi
+ \fi
+ \fi
+ \set@line@action}
+
+
+\newcommand*{\@set}[1]{%
+ \ifledRcol
+ \ifsublines@
+ \subline@numR=#1\relax
+ \else
+ \line@numR=#1\relax
+ \fi
+ \set@line@action
+ \else
+ \ifsublines@
+ \subline@num=#1\relax
+ \else
+ \line@num=#1\relax
+ \fi
+ \set@line@action
+ \fi}
+
+
+\newcommand*{\l@d@set}[1]{%
+ \ifledRcol
+ \line@numR=#1\relax
+ \advance\line@numR \@ne
+ \def\l@dchset@num{#1}
+ \else
+ \line@num=#1\relax
+ \advance\line@num \@ne
+ \def\l@dchset@num{#1}
+ \fi}
+\let\l@dchset@num\relax
+
+
+
+\newcommand*{\page@action}{%
+ \ifledRcol
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \xright@appenditem{\next@page@numR}\to\actions@listR
+ \else
+ \xright@appenditem{\the\absline@num}\to\actionlines@list
+ \xright@appenditem{\next@page@num}\to\actions@list
+ \fi}
+
+\newcommand*{\set@line@action}{%
+ \ifledRcol
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \ifsublines@
+ \@l@dtempcnta=-\subline@numR
+ \else
+ \@l@dtempcnta=-\line@numR
+ \fi
+ \advance\@l@dtempcnta by -5000\relax
+ \xright@appenditem{\the\@l@dtempcnta}\to\actions@listR
+ \else
+ \xright@appenditem{\the\absline@num}\to\actionlines@list
+ \ifsublines@
+ \@l@dtempcnta=-\subline@num
+ \else
+ \@l@dtempcnta=-\line@num
+ \fi
+ \advance\@l@dtempcnta by -5000\relax
+ \xright@appenditem{\the\@l@dtempcnta}\to\actions@list
+ \fi}
+
+\newcommand*{\sub@action}{%
+ \ifledRcol
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \ifsublines@
+ \xright@appenditem{-1001}\to\actions@listR
+ \else
+ \xright@appenditem{-1002}\to\actions@listR
+ \fi
+ \else
+ \xright@appenditem{\the\absline@num}\to\actionlines@list
+ \ifsublines@
+ \xright@appenditem{-1001}\to\actions@list
+ \else
+ \xright@appenditem{-1002}\to\actions@list
+ \fi
+ \fi}
+\newcommand*{\lock@on}{\futurelet\next\do@lockon}
+
+\newcommand*{\do@lockon}{%
+ \ifx\next\lock@off
+ \global\let\lock@off=\skip@lockoff
+ \else
+ \ifledRcol
+ \do@lockonR
+ \else
+ \do@lockonL
+ \fi
+ \fi}
+
+\newcommand*{\do@lockonL}{%
+ \xright@appenditem{\the\absline@num}\to\actionlines@list
+ \ifsublines@
+ \xright@appenditem{-1005}\to\actions@list
+ \ifnum\sub@lock=\z@
+ \sub@lock \@ne
+ \else
+ \ifnum\sub@lock=\thr@@
+ \sub@lock \@ne
+ \fi
+ \fi
+ \else
+ \xright@appenditem{-1003}\to\actions@list
+ \ifnum\@lock=\z@
+ \@lock \@ne
+ \else
+ \ifnum\@lock=\thr@@
+ \@lock \@ne
+ \fi
+ \fi
+ \fi}
+
+\newcommand*{\do@lockoffL}{%
+ \xright@appenditem{\the\absline@num}\to\actionlines@list
+ \ifsublines@
+ \xright@appenditem{-1006}\to\actions@list
+ \ifnum\sub@lock=\tw@
+ \sub@lock \thr@@
+ \else
+ \sub@lock \z@
+ \fi
+ \else
+ \xright@appenditem{-1004}\to\actions@list
+ \ifnum\@lock=\tw@
+ \@lock \thr@@
+ \else
+ \@lock \z@
+ \fi
+ \fi}
+
+\newcommand*{\do@lockoff}{%
+ \ifledRcol
+ \do@lockoffR
+ \else
+ \do@lockoffL
+ \fi}
+\newcommand*{\skip@lockoff}{\global\let\lock@off=\do@lockoff}
+\global\let\lock@off=\do@lockoff
+
+\newcommand*{\n@num}{%
+ \ifledRcol%
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \xright@appenditem{-1007}\to\actions@listR
+ \else%
+ \xright@appenditem{\the\absline@num}\to\actionlines@list%
+ \xright@appenditem{-1007}\to\actions@list%
+ \fi%
+}%
+
+\newcommand*{\n@num@stanza}{%
+ \ifledRcol%
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR%
+ \xright@appenditem{-1008}\to\actions@listR%
+ \else%
+ \xright@appenditem{\the\absline@num}\to\actionlines@list%%
+ \xright@appenditem{-1008}\to\actions@list%
+ \fi%
+}
+\newif\ifl@dhidenumber
+\newcommand*{\hidenumbering}{
+ \ifledRcol%
+ \write\linenum@outR{\string\hide@num}%
+ \else%
+ \write\linenum@out{\string\hide@num}%
+ \fi%
+}%
+\newcommand*{\hide@num}{%
+ \ifledRcol%
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR%
+ \xright@appenditem{-1009}\to\actions@listR%
+ \else%
+ \xright@appenditem{\the\absline@num}\to\actionlines@list%%
+ \xright@appenditem{-1009}\to\actions@list%
+ \fi%
+}
+\newcount\insert@count
+\newcommand*{\dummy@ref}[2]{#2}
+\newcommand*{\@ref}[2]{%
+ \ifledRcol%
+ \@ref@regR{#1}{#2}%
+ \else%
+ \@ref@reg{#1}{#2}%
+ \fi%
+}%
+\newcommand*{\@ref@reg}[2]{%
+ \global\insert@count=#1\relax
+ \global\advance\@edtext@level by 1%
+ \loop\ifnum\insert@count>\z@
+ \xright@appenditem{\the\absline@num}\to\insertlines@list
+ \global\advance\insert@count \m@ne
+ \repeat
+ \begingroup
+ \let\@ref=\dummy@ref
+ \let\@lopL\@gobble
+ \let\page@action=\relax
+ \let\sub@action=\relax
+ \let\set@line@action=\relax
+ \let\@lab=\relax
+ \let\@lemma=\relax%
+ \let\@sw\@gobblethree%
+ #2
+ \global\endpage@num=\page@num
+ \global\endline@num=\line@num
+ \global\endsubline@num=\subline@num
+ \endgroup
+ \xright@appenditem%
+ {\the\page@num|\the\line@num|%
+ \ifsublines@ \the\subline@num \else 0\fi|%
+ \the\endpage@num|\the\endline@num|%
+ \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@list
+ \expandafter\list@create\expandafter{\csname sw@list@edtext@tmp@\the\@edtext@level\endcsname}%
+ \providebool{lemmacommand@\the\@edtext@level}%
+ \boolfalse{lemmacommand@\the\@edtext@level}%
+ #2%
+ \ifnum\@edtext@level>0%
+ \def\create@this@edtext@level{\expandafter\list@create\expandafter{\csname sw@list@edtext@\the\@edtext@level\endcsname}}%
+ \ifcsundef{sw@list@edtext@\the\@edtext@level}{\create@this@edtext@level}{}%
+ \letcs{\@tmp}{sw@list@edtext@\the\@edtext@level}%
+ \letcs{\@tmpp}{sw@list@edtext@tmp@\the\@edtext@level}
+ \xright@appenditem{\expandonce\@tmpp}\to\@tmp%
+ \global\cslet{sw@list@edtext@\the\@edtext@level}{\@tmp}%
+ \fi%
+ \global\advance\@edtext@level by -1%
+}
+
+\newwrite\linenum@out
+\newif\iffirst@linenum@out@
+ \first@linenum@out@true
+\newcommand{\this@line@list@version}{2}%
+\newcommand*{\line@list@stuff}[1]{%
+ \read@linelist{#1}%
+ \iffirst@linenum@out@
+ \immediate\closeout\linenum@out%
+ \global\first@linenum@out@false%
+ \immediate\openout\linenum@out=#1\relax%
+ \immediate\write\linenum@out{\string\line@list@version{\this@line@list@version}}%
+ \else
+ \if@minipage%
+ \leavevmode%
+ \fi%
+ \closeout\linenum@out%
+ \openout\linenum@out=#1\relax%
+ \fi}
+
+\newcommand*{\new@line}{%
+ \IfStrEq{\led@pb@setting}{after}%
+ {\xifinlist{\the\absline@num}{\l@prev@nopb}%
+ {\xifinlist{\the\absline@num}{\normal@page@break}%
+ {\numgdef{\@next@page}{\c@page+1}%
+ \write\linenum@out{\string\@nl[\@next@page][\@next@page]}%
+ }%
+ {\write\linenum@out{\string\@nl[\the\c@page][\thepage]}}%
+ }%
+ {\write\linenum@out{\string\@nl[\the\c@page][\thepage]}}}%
+ {}%
+ \IfStrEq{\led@pb@setting}{before}%
+ {\numdef{\next@absline}{\the\absline@num+1}%
+ \xifinlist{\next@absline}{\l@prev@nopb}%
+ {\xifinlist{\the\absline@num}{\normal@page@break}%
+ {\numgdef{\nc@page}{\c@page+1}%
+ \write\linenum@out{\string\@nl[\nc@page][\nc@page]}%
+ }%
+ {\write\linenum@out{\string\n@l[\the\c@page][\thepage]}}%
+ }%
+ {\write\linenum@out{\string\@nl[\the\c@page][\thepage]}}%
+ }%
+ {}%
+ \IfStrEqCase{\led@pb@setting}{{before}{\relax}{after}{\relax}}[\write\linenum@out{\string\@nl[\the\c@page][\thepage]}]%
+}
+
+\newif\if@noneed@Footnote%
+
+\newcommand*{\flag@start}{%
+ \ifledRcol%
+ \edef\next{\write\linenum@outR{%
+ \string\@ref[\the\insert@countR][}}%
+ \next%
+ \ifnum\insert@countR<1%
+ \if@noneed@Footnote\else%
+ \led@err@EdtextWithoutFootnote%
+ \fi%
+ \fi%
+ \else%
+ \edef\next{\write\linenum@out{%
+ \string\@ref[\the\insert@count][}}%
+ \next%
+ \ifnum\insert@count<1%
+ \if@noneed@Footnote\else%
+ \led@err@EdtextWithoutFootnote%
+ \fi%
+ \fi%
+ \fi}%
+
+
+\newcommand*{\startsub}{\dimen0\lastskip
+ \ifdim\dimen0>0pt \unskip \fi
+ \ifledRcol \write\linenum@outR{\string\sub@on}%
+ \else \write\linenum@out{\string\sub@on}%
+ \fi
+ \ifdim\dimen0>0pt \hskip\dimen0 \fi}
+\def\endsub{\dimen0\lastskip
+ \ifdim\dimen0>0pt \unskip \fi
+ \ifledRcol \write\linenum@outR{\string\sub@off}%
+ \else \write\linenum@out{\string\sub@off}%
+ \fi
+ \ifdim\dimen0>0pt \hskip\dimen0 \fi}
+
+\newcommand*{\advanceline}[1]{%
+ \ifledRcol \write\linenum@outR{\string\@adv[#1]}%
+ \else \write\linenum@out{\string\@adv[#1]}%
+ \fi%
+}
+
+\newcommand*{\setline}[1]{%
+ \ifnum#1<\z@
+ \led@warn@BadSetline
+ \else
+ \ifledRcol \write\linenum@outR{\string\@set[#1]}%
+ \else \write\linenum@out{\string\@set[#1]}%
+ \fi
+ \fi}
+
+
+\newcommand*{\setlinenum}[1]{%
+ \ifnum#1<\z@
+ \led@warn@BadSetlinenum
+ \else
+ \ifledRcol \write\linenum@outR{\string\l@d@set[#1]}
+ \else \write\linenum@out{\string\l@d@set[#1]} \fi
+ \fi}
+
+
+\newcommand*{\startlock}{%
+ \ifledRcol \write\linenum@outR{\string\lock@on}%
+ \else \write\linenum@out{\string\lock@on}%
+ \fi}
+\def\endlock{%
+ \ifledRcol \write\linenum@outR{\string\lock@off}%
+ \else \write\linenum@out{\string\lock@off}%
+ \fi}
+\newif\ifl@dskipnumber
+\newif\ifl@dskipversenumber%
+\newcommand*{\skipnumbering}{%
+ \leavevmode%
+ \ifledRcol%
+ \ifinstanza%
+ \write\linenum@outR{\string\n@num@stanza}%
+ \else%
+ \write\linenum@outR{\string\n@num}%
+ \fi%
+ \advanceline{-1}%
+ \else%
+ \ifinstanza%
+ \write\linenum@out{\string\n@num@stanza}%
+ \else%
+ \write\linenum@out{\string\n@num}%
+ \fi%
+ \advanceline{-1}%
+ \fi%
+}%
+
+\list@create{\end@lemmas}
+\newcommand{\dummy@edtext}[2]{#1}
+\newcommand{\dummy@edtext@showlemma}[2]{\showlemma{#1}}%
+\newcommand*{\no@expands}{%
+ \let\select@@lemmafont=0%
+ \let\startsub=\relax \let\endsub=\relax
+ \let\startlock=\relax \let\endlock=\relax
+ \let\edlabel=\@gobble
+ \let\setline=\@gobble \let\advanceline=\@gobble
+ \let\sameword\sameword@inedtext%
+ \let\edtext=\dummy@edtext
+ \l@dtabnoexpands
+ \morenoexpands}
+\let\morenoexpands=\relax
+
+\newcommand{\@tag}{}
+\newcount\@edtext@level%
+\@edtext@level=0%
+\newcommand{\edtext}[2]{\leavevmode%
+ \ifnumberedpar@%
+ \global\advance\@edtext@level by 1%
+ \global\@lemmacommand@false%
+ \begingroup%
+ \ifledRcol%
+ \ifcsundef{sw@list@edtextR@\the\@edtext@level}%
+ {\global\let\sw@inthisedtext\empty}%
+ {\ifcsempty{sw@list@edtextR@\the\@edtext@level}%
+{\global\let\sw@inthisedtext\empty}%
+{\expandafter\gl@p\csname sw@list@edtextR@\the\@edtext@level\endcsname\to\sw@inthisedtext}%
+ }%
+ \else%
+ \ifcsundef{sw@list@edtext@\the\@edtext@level}%
+ {\global\let\sw@inthisedtext\empty}%
+ {\ifcsempty{sw@list@edtext@\the\@edtext@level}%
+{\global\let\sw@inthisedtext\empty}%
+{\expandafter\gl@p\csname sw@list@edtext@\the\@edtext@level\endcsname\to\sw@inthisedtext}%
+ }%
+ \fi%
+ \global\renewcommand{\@tag}{%
+ \no@expands #1%
+ }%
+ \set@line%
+ \ifledRcol \global\insert@countR \z@%
+ \else \global\insert@count \z@ \fi%
+ \ignorespaces #2\relax%
+ \@ifundefined{xpg@main@language}{%if not polyglossia
+ \flag@start}%
+ {\if@RTL\flag@end\else\flag@start\fi%
+ }%
+ \if@lemmacommand@%
+ \ifledRcol%
+ \write\linenum@outR{\string\@lemma}%
+ \else%
+ \write\linenum@out{\string\@lemma}%
+ \fi%
+ \fi%
+ \endgroup%
+ \showlemma{#1}%
+ \ifx\end@lemmas\empty \else%
+ \gl@p\end@lemmas\to\x@lemma%
+ \x@lemma%
+ \global\let\x@lemma=\relax%
+ \fi%
+ \@ifundefined{xpg@main@language}{%if not polyglossia
+ \flag@end}%
+ {\if@RTL\flag@start\else\flag@end\fi% With polyglossia, you must track whether the language reads left to right (English) or right to left (Arabic).
+ }%
+ \global\@noneed@Footnotefalse%
+ \global\advance\@edtext@level by -1%
+ \global\@lemmacommand@false%
+ \else%
+ \showlemma{#1} (\textbf{\textsc{Edtext outside numbered paragraph}})\led@err@edtextoutsidepstart%
+ \fi%
+}%
+
+\newcommand*{\flag@end}{%
+ \ifledRcol%
+ \write\linenum@outR{]}%
+ \else%
+ \write\linenum@out{]}%
+ \fi}%
+
+\newif\ifnumberline
+\numberlinetrue
+\newcommand*{\set@line}{%
+ \ifledRcol
+ \ifx\line@listR\empty
+ \global\noteschanged@true
+ \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}%
+ \else
+ \gl@p\line@listR\to\@tempb
+ \xdef\l@d@nums{\@tempb|\edfont@info}%
+ \global\let\@tempb=\undefined
+ \fi
+ \else
+ \ifx\line@list\empty
+ \global\noteschanged@true
+ \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}%
+ \else
+ \gl@p\line@list\to\@tempb
+ \xdef\l@d@nums{\@tempb|\edfont@info}%
+ \global\let\@tempb=\undefined
+ \fi
+ \fi}
+
+\newcommand*{\edfont@info}{\f@encoding/\f@family/\f@series/\f@shape}
+
+\unless\ifnocritical@
+\newcommand*{\lemma}[1]{%
+ \global\@lemmacommand@true%
+ \global\renewcommand{\@tag}{%
+ \no@expands #1%
+ }%
+ \ignorespaces%
+}%
+\newcommand{\@lemma}{%
+ \booltrue{lemmacommand@\the\@edtext@level}%
+}%
+\fi
+\newif\if@lemmacommand@%
+\newcommand*{\linenum}[1]{%
+ \xdef\@tempa{#1|||||||\noexpand\\\l@d@nums}%
+ \global\let\l@d@nums=\empty
+ \expandafter\line@set\@tempa|\\\ignorespaces}
+\def\line@set#1|#2\\#3|#4\\{%
+ \gdef\@tempb{#1}%
+ \ifx\@tempb\empty
+ \l@d@add{#3}%
+ \else
+ \l@d@add{#1}%
+ \fi
+ \gdef\@tempb{#4}%
+ \ifx\@tempb\empty\else
+ \l@d@add{|}\line@set#2\\#4\\%
+ \fi}
+\newcommand{\l@d@add}[1]{\xdef\l@d@nums{\l@d@nums#1}}
+
+\newcommand{\get@sw@txt}[1]{%
+ \ifxetex%
+ \xdef\sw@txt{#1}%
+ \else%
+ \expandafter\xdef\expandafter\sw@txt\expandafter{\detokenize{#1}}%
+ \fi%
+}%
+\newcommandx{\sameword}[2][1,usedefault]{%
+ \leavevmode%
+ \get@sw@txt{#2}%
+ \unless\ifledRcol%
+ \csnumgdef{sw@\sw@txt}{\csuse{sw@\sw@txt}+1}%
+ \protected@write\linenum@out{}{\string\@sw{\sw@txt}{\csuse{sw@\sw@txt}}{#1}}%
+ \else%
+ \csnumgdef{sw@\sw@txt@R}{\csuse{sw@\sw@txt@R}+1}%
+ \protected@write\linenum@outR{}{\string\@sw{\sw@txt}{\csuse{sw@\sw@txt@R}}{#1}}%
+ \fi%
+ #2%
+}%
+\newif\if@addsw%
+\newcommand{\@sw}[3]{%
+ \get@sw@txt{#1}%
+ \unless\ifledRcol%
+ \csxdef{sw@\sw@txt @\the\absline@num @\the\section@num}{#2}%
+ \numdef{\prev@line}{\the\absline@num-1}%
+ \ifcsundef{sw@\sw@txt @\prev@line @\the\section@num}{%
+ \csnumgdef{sw@\sw@txt @\prev@line @\the\section@num}{#2-1}%
+ }{}%
+ \numdef{\the@sw}{#2-\csuse{sw@\sw@txt @\prev@line @\the\section@num}}%
+ \else%
+ \csxdef{sw@\sw@txt @\the\absline@numR @\the\section@numR @R}{#2}%
+ \numdef{\prev@line}{\the\absline@numR-1}%
+ \ifcsundef{sw@\sw@txt @\prev@line @\the\section@numR @R}{%
+ \csnumgdef{sw@\sw@txt @\prev@line @\the\section@numR @R}{#2-1}%
+ }{}%
+ \numdef{\the@sw}{#2-\csuse{sw@\sw@txt @\prev@line @\the\section@numR @R}}%
+ \fi%
+ \@tempcnta=\@edtext@level
+ \@whilenum{\@tempcnta>0}\do{%
+ \ifcsdef{sw@list@edtext@tmp@\the\@tempcnta}%
+ {%
+ \@addswfalse%
+ \notbool{lemmacommand@\the\@tempcnta}%
+ {\@addswtrue}%
+ {\IfStrEq{#3}{inlemma}%
+ {\@addswtrue}%
+ {%
+ \def\do##1{%
+ \ifnumequal{##1}{\the\@tempcnta}%
+ {\@addswtrue\listbreak}%
+ {}%
+ }%
+ \docsvlist{#3}%
+ }%
+ }%
+ \if@addsw%
+ \letcs{\@tmp}{sw@list@edtext@tmp@\the\@tempcnta}%
+ \ifledRcol%
+ \xright@appenditem{{\the@sw}{\the\absline@numR}}\to\@tmp%
+ \else%
+ \xright@appenditem{{\the@sw}{\the\absline@num}}\to\@tmp%
+ \fi%
+ \cslet{sw@list@edtext@tmp@\the\@tempcnta}{\@tmp}%
+ \fi%
+ }%
+ {}%
+ \advance\@tempcnta by -1%
+ }%
+}%
+\newcommandx{\sameword@inedtext}[2][1,usedefault]{%
+ \get@sw@txt{#2}%
+ \unless\ifledRcol@%
+ \ifx\sw@list@inedtext\empty%
+ \def\the@sw{999}%
+ \def\this@absline{-99}%
+ \else%
+ \gl@p\sw@list@inedtext\to\@tmp%
+ \edef\the@sw{\expandafter\@firstoftwo\@tmp}%
+ \edef\this@absline{\expandafter\@secondoftwo\@tmp}%
+ \fi%
+ \ifcsdef{sw@\sw@txt @\this@absline @\the\section@num}{%
+ \numdef{\prev@line}{\this@absline-1}%
+ \numdef{\sw@atthisline}{\csuse{sw@\sw@txt @\this@absline @\the\section@num}-\csuse{sw@\sw@txt @\prev@line @\the\section@num}}%
+ }%
+ {\numdef{\sw@atthisline}{0}}%
+ \ifnumgreater{\sw@atthisline}{1}%
+ {\showwordrank{#2}{\the@sw}}%
+ {#2}%
+ \else%
+ \ifx\sw@list@inedtext\empty%
+ \def\the@sw{999}%
+ \def\this@absline{-99}%
+ \else%
+ \gl@p\sw@list@inedtext\to\@tmp%
+ \edef\the@sw{\expandafter\@firstoftwo\@tmp}%
+ \edef\this@absline{\expandafter\@secondoftwo\@tmp}%
+ \fi%
+ \ifcsdef{sw@\sw@txt @\this@absline @\the\section@numR @R}{%
+ \numdef{\prev@line}{\this@absline-1}%
+ \numdef{\sw@atthisline}{\csuse{sw@\sw@txt @\this@absline @\the\section@numR @R}-\csuse{sw@\sw@txt @\prev@line @\the\section@numR @R}}%
+ }%
+ {\numdef{\sw@atthisline}{0}}%
+ \ifnumgreater{\sw@atthisline}{1}%
+ {\showwordrank{#2}{\the@sw}}%
+ {#2}%
+ \fi%
+}%
+\newcommand{\showwordrank}[2]{%
+ #1\textsuperscript{#2}%
+}%
+
+\newbox\raw@text
+\newif\ifnumberedpar@
+\newcount\num@lines
+\newbox\one@line
+\newcount\par@line
+
+\newcommand{\AtEveryPstart}[1]{%
+ \ifstrempty{#1}%
+ {\xdef\at@every@pstart{}}%
+ {\gdef\at@every@pstart{\noindent#1}}%
+}%
+\xdef\at@every@pstart{}%
+
+\newcounter{pstart}
+\renewcommand{\thepstart}{{\bfseries\@arabic\c@pstart}. }
+\newif\ifnumberpstart
+\numberpstartfalse
+\newif\iflabelpstart
+\labelpstartfalse
+\newcommandx*{\pstart}[1][1]{%
+ \normal@pars%
+ \ifstrempty{#1}{\at@every@pstart}{\noindent#1}%
+ \ifautopar%
+ \autopar%
+ \fi%
+ \ifluatex%
+ \edef\l@luatextextdir@L{\the\luatextextdir}%
+ \fi%
+ \if@nobreak%
+ \let\@oldnobreak\@nobreaktrue%
+ \else%
+ \let\@oldnobreak\@nobreakfalse%
+ \fi%
+ \@nobreaktrue%
+ \ifnumbering \else%
+ \led@err@PstartNotNumbered%
+ \beginnumbering%
+ \fi%
+ \ifnumberedpar@%
+ \led@err@PstartInPstart%
+ \pend%
+ \fi%
+ \list@clear{\inserts@list}%
+ \global\let\next@insert=\empty%
+ \begingroup\normal@pars%
+ \global\advance \l@dnumpstartsL\@ne
+ \global\setbox\raw@text=\vbox\bgroup%
+ \ifautopar\else%
+ \ifnumberpstart%
+ \ifinstanza\else%
+ \ifsidepstartnum\else%
+ \thepstart%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \numberedpar@true%
+ \iflabelpstart\protected@edef\@currentlabel%
+ {\p@pstart\thepstart}
+ \fi%
+ \l@dzeropenalties%
+ }
+\newcommandx*{\pend}[1][1]{\ifnumbering \else%
+ \led@err@PendNotNumbered%
+ \fi%
+ \global\l@dskipversenumberfalse%
+ \ifnumberedpar@ \else%
+ \led@err@PendNoPstart%
+ \fi%
+ \l@dzeropenalties%
+ \endgraf\global\num@lines=\prevgraf\egroup%
+ \global\par@line=0%
+ \csnumdef{pstartline}{0}%
+ \loop\ifvbox\raw@text%
+ \csnumdef{pstartline}{\pstartline+1}%
+ \do@line%
+ \ifbypstart@%
+ \ifnumequal{\pstartline}{1}{\setline{1}\resetprevline@}{}%
+ \fi%
+ \repeat%
+ \flush@notes%
+ \endgroup%
+ \ignorespaces%
+ \ifnumberpstart%
+ \pstartnumtrue%
+ \fi%
+ \addtocounter{pstart}{1}%
+ \normal@pars%
+ \@oldnobreak%
+ \ifautopar%
+ \autopar%
+ \fi%
+ \ifstrempty{#1}{\at@every@pend}{\noindent#1}%
+}
+
+
+\newcommand{\AtEveryPend}[1]{%
+ \ifstrempty{#1}%
+ {\xdef\at@every@pend{}}%
+ {\gdef\at@every@pend{\noindent#1}}%
+}%
+\xdef\at@every@pend{}%
+
+\newcommand*{\l@dzeropenalties}{%
+ \brokenpenalty \z@ \clubpenalty \z@
+ \displaywidowpenalty \z@ \interlinepenalty \z@ \predisplaypenalty \z@
+ \postdisplaypenalty \z@ \widowpenalty \z@}
+
+\newif\ifautopar
+\autoparfalse
+\newcommand*{\autopar}{
+ \ifledRcol
+ \ifnumberingR \else
+ \led@err@AutoparNotNumbered
+ \beginnumberingR
+ \fi
+ \else
+ \ifnumbering \else
+ \led@err@AutoparNotNumbered
+ \beginnumbering
+ \fi
+ \fi
+ \autopartrue
+ \everypar{\setbox0=\lastbox
+ \endgraf \vskip-\parskip
+ \pstart \noindent \kern\wd0 \ifnumberpstart\ifinstanza\else\thepstart\fi\fi
+ \let\par=\pend}%
+ \ignorespaces}
+\newcommand*{\normal@pars}{\everypar{}\let\par\endgraf}
+
+\newif\ifautopar@pause
+ \newcommand*{\l@dunhbox@line}[1]{\unhbox #1}
+ \newcommand*{\do@line}{%
+ {\vbadness=10000
+ \splittopskip=\z@
+ \do@linehook
+\l@demptyd@ta
+ \global\setbox\one@line=\vsplit\raw@text to\baselineskip}%
+ \unvbox\one@line \global\setbox\one@line=\lastbox
+ \getline@num
+ \IfStrEq{\led@pb@setting}{before}{\led@check@pb\led@check@nopb}{}
+ \ifnum\@lock>\@ne
+ \inserthangingsymboltrue
+ \else
+ \inserthangingsymbolfalse
+ \fi
+ \check@pb@in@verse
+ \ifl@dhidenumber%
+ \global\l@dhidenumberfalse%
+ \f@x@l@cks%
+ \else%
+ \affixline@num%
+ \fi%
+ \xifinlist{\the\l@dnumpstartsL}{\eled@sections@@}%
+ {\print@eledsection}%
+ {\print@line}%
+ \IfStrEq{\led@pb@setting}{after}{\led@check@pb\led@check@nopb}{}
+ }%
+\def\print@line{
+ \affixpstart@num%
+ \hb@xt@ \linewidth{%
+ \do@insidelinehook%
+ \l@dld@ta%
+ \add@inserts\affixside@note%
+ \l@dlsn@te
+ {\ledllfill\hb@xt@ \wd\one@line{\new@line%
+ \ifluatex%
+ \luatextextdir\l@luatextextdir@L%
+ \fi%
+ \inserthangingsymbol %Space keept for backward compatibility
+ \l@dunhbox@line{\one@line}}%
+ \ledrlfill\l@drd@ta%
+ \l@drsn@te
+ }}%
+ \add@penalties%
+}
+\def\print@eledsection{%
+ \add@inserts\affixside@note%
+ \numdef{\temp@}{\l@dnumpstartsL-1}%
+ \xifinlist{\temp@}{\eled@sections@@}{\@nobreaktrue}{\@nobreakfalse}%
+ \@eled@sectioningtrue%
+ \csuse{eled@sectioning@\the\l@dnumpstartsL}%
+ \@eled@sectioningfalse%
+ \global\csundef{eled@sectioning@\the\l@dnumpstartsL}%
+ \if@RTL%
+ \hspace{-3\paperwidth}%
+ {\hbox{\l@dunhbox@line{\one@line}} \new@line}%
+ \else%
+ \hspace{3\paperwidth}%
+ {\new@line \hbox{\l@dunhbox@line{\one@line}}}%
+ \fi%
+ \vskip-\baselineskip%
+}
+\newcommand*{\do@linehook}{}
+\newcommand*{\do@insidelinehook}{}
+\newcommand*{\dolinehook}[1]{\gdef\do@linehook{#1}}%
+\newcommand*{\doinsidelinehook}[1]{\gdef\do@insidelinehook{#1}}%
+
+\newcommand*{\l@demptyd@ta}{%
+ \gdef\l@dld@ta{}%
+ \gdef\l@drd@ta{}%
+ \gdef\l@dcsnotetext@l{}%
+ \gdef\l@dcsnotetext@r{}%
+ \gdef\l@dcsnotetext{}}
+
+\newcommand{\l@dlsn@te}{%
+ \hb@xt@ \z@{\hss\box\l@dlp@rbox\kern\ledlsnotesep}}
+\newcommand{\l@drsn@te}{%
+ \hb@xt@ \z@{\kern\ledrsnotesep\box\l@drp@rbox\hss}}
+
+\newcommand*{\ledllfill}{\hfil}
+\newcommand*{\ledrlfill}{}
+
+\newcommand*{\getline@num}{%
+ \global\advance\absline@num \@ne%
+ \do@actions
+ \do@ballast
+ \ifnumberline
+ \ifsublines@
+ \ifnum\sub@lock<\tw@
+ \global\advance\subline@num \@ne
+ \fi
+ \else
+ \ifnum\@lock<\tw@
+ \global\advance\line@num \@ne
+ \global\subline@num \z@
+ \fi
+ \fi
+ \fi
+}
+\newcount\ballast@count
+\newcounter{ballast}
+ \setcounter{ballast}{0}
+\newcommand*{\do@ballast}{\global\ballast@count \z@
+ \begingroup
+ \advance\absline@num \@ne
+ \ifnum\next@actionline=\absline@num
+ \ifnum\next@action>-1001\relax
+ \global\advance\ballast@count by -\c@ballast
+ \fi
+ \fi
+ \endgroup}
+\newcommand*{\do@actions}{%
+ \global\let\do@actions@next=\relax
+ \ifnum\absline@num<\next@actionline\else
+ \ifnum\next@action>-1001
+ \global\page@num=\next@action
+ \ifbypage@
+ \global\line@num=\z@ \global\subline@num=\z@
+ \resetprevline@
+ \fi
+ \else
+ \ifnum\next@action<-4999
+ \@l@dtempcnta=-\next@action
+ \advance\@l@dtempcnta by -5001
+ \ifsublines@
+ \global\subline@num=\@l@dtempcnta
+ \else
+ \global\line@num=\@l@dtempcnta
+ \fi
+ \else
+ \@l@dtempcnta=-\next@action
+ \advance\@l@dtempcnta by -1000
+ \do@actions@fixedcode
+ \fi
+ \fi
+ \ifx\actionlines@list\empty
+ \gdef\next@actionline{1000000}%
+ \else
+ \gl@p\actionlines@list\to\next@actionline
+ \gl@p\actions@list\to\next@action
+ \global\let\do@actions@next=\do@actions
+ \fi
+ \fi
+\do@actions@next}
+
+\newcommand*{\do@actions@fixedcode}{%
+ \ifcase\@l@dtempcnta
+ \or% % 1001
+ \global\sublines@true
+ \or% % 1002
+ \global\sublines@false
+ \or% % 1003
+ \global\@lock=\@ne
+ \or% % 1004
+ \ifnum\@lock=\tw@
+ \global\@lock=\thr@@
+ \else
+ \global\@lock=\z@
+ \fi
+ \or% % 1005
+ \global\sub@lock=\@ne
+ \or% % 1006
+ \ifnum\sub@lock=\tw@
+ \global\sub@lock=\thr@@
+ \else
+ \global\sub@lock=\z@
+ \fi
+ \or% % 1007
+ \l@dskipnumbertrue
+ \or% % 1008
+ \l@dskipversenumbertrue%
+ \or% % 1009
+ \l@dhidenumbertrue
+ \else
+ \led@warn@BadAction
+ \fi}
+
+\newcommand*{\affixline@num}{%
+ \ifledgroupnotesL@\else
+ \ifnumberline
+ \ifl@dskipnumber
+ \global\l@dskipnumberfalse
+ \else
+ \ifsublines@
+ \@l@dtempcntb=\subline@num
+ \ifnum\subline@num>\c@firstsublinenum
+ \@l@dtempcnta=\subline@num
+ \advance\@l@dtempcnta by-\c@firstsublinenum
+ \divide\@l@dtempcnta by\c@sublinenumincrement
+ \multiply\@l@dtempcnta by\c@sublinenumincrement
+ \advance\@l@dtempcnta by\c@firstsublinenum
+ \else
+ \@l@dtempcnta=\c@firstsublinenum
+ \fi
+ \ch@cksub@l@ck
+ \else
+ \@l@dtempcntb=\line@num
+ \ifx\linenumberlist\empty
+ \ifnum\line@num>\c@firstlinenum
+ \@l@dtempcnta=\line@num
+ \advance\@l@dtempcnta by-\c@firstlinenum
+ \divide\@l@dtempcnta by\c@linenumincrement
+ \multiply\@l@dtempcnta by\c@linenumincrement
+ \advance\@l@dtempcnta by\c@firstlinenum
+ \else
+ \@l@dtempcnta=\c@firstlinenum
+ \fi
+ \else
+ \@l@dtempcnta=\line@num
+ \edef\rem@inder{,\linenumberlist,\number\line@num,}%
+ \edef\sc@n@list{\def\noexpand\sc@n@list
+ ####1,\number\@l@dtempcnta,####2|{\def\noexpand\rem@inder{####2}}}%
+ \sc@n@list\expandafter\sc@n@list\rem@inder|%
+ \ifx\rem@inder\empty%
+ \advance\@l@dtempcnta\@ne
+ \fi
+ \fi
+ \ch@ck@l@ck
+ \fi
+ \ifnum\@l@dtempcnta=\@l@dtempcntb
+ \ifl@dskipversenumber\else
+ \if@twocolumn
+ \if@firstcolumn
+ \gdef\l@dld@ta{\llap{{\leftlinenum}}}%
+ \else
+ \gdef\l@drd@ta{\rlap{{\rightlinenum}}}%
+ \fi
+ \else
+ \@l@dtempcntb=\line@margin
+ \ifnum\@l@dtempcntb>\@ne
+ \advance\@l@dtempcntb \page@num
+ \fi
+ \ifodd\@l@dtempcntb
+ \gdef\l@drd@ta{\rlap{{\rightlinenum}}}%
+ \else
+ \gdef\l@dld@ta{\llap{{\leftlinenum}}}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \f@x@l@cks
+ \fi
+ \fi
+ \fi
+}
+
+\newcommand*{\ch@cksub@l@ck}{%
+ \ifcase\sub@lock
+ \or
+ \ifnum\sublock@disp=\@ne
+ \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
+ \fi
+ \or
+ \ifnum\sublock@disp=\tw@ \else
+ \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
+ \fi
+ \or
+ \ifnum\sublock@disp=\z@
+ \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
+ \fi
+ \fi}
+\newcommand*{\ch@ck@l@ck}{%
+ \ifcase\@lock
+ \or
+ \ifnum\lock@disp=\@ne
+ \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
+ \fi
+ \or
+ \ifnum\lock@disp=\tw@ \else
+ \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
+ \fi
+ \or
+ \ifnum\lock@disp=\z@
+ \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
+ \fi
+ \fi}
+\newcommand*{\f@x@l@cks}{%
+ \ifcase\@lock
+ \or
+ \global\@lock=\tw@
+ \or \or
+ \global\@lock=\z@
+ \fi
+ \ifcase\sub@lock
+ \or
+ \global\sub@lock=\tw@
+ \or \or
+ \global\sub@lock=\z@
+ \fi}
+
+
+\newif\ifsidepstartnum
+\newcommand*{\affixpstart@num}{%
+ \ifsidepstartnum
+ \if@twocolumn
+ \if@firstcolumn
+ \gdef\l@dld@ta{\llap{{\leftpstartnum}}}%
+ \else
+ \gdef\l@drd@ta{\rlap{{\rightpstartnum}}}%
+ \fi
+ \else
+ \@l@dtempcntb=\line@margin
+ \ifnum\@l@dtempcntb>\@ne
+ \advance\@l@dtempcntb \page@num
+ \fi
+ \ifodd\@l@dtempcntb
+ \gdef\l@drd@ta{\rlap{{\rightpstartnum}}}%
+ \else
+ \gdef\l@dld@ta{\llap{{\leftpstartnum}}}%
+ \fi
+ \fi
+ \fi
+
+}
+
+\newif\ifpstartnum
+\pstartnumtrue
+\newcommand*{\leftpstartnum}{
+ \ifpstartnum\thepstart
+ \kern\linenumsep\fi
+ \global\pstartnumfalse
+}
+\newcommand*{\rightpstartnum}{
+ \ifpstartnum
+ \kern\linenumsep
+ \thepstart
+ \fi
+ \global\pstartnumfalse
+}
+\list@create{\inserts@list}
+\newcommand*{\add@inserts}{%
+ \global\let\add@inserts@next=\relax
+ \ifx\inserts@list\empty \else
+ \ifx\next@insert\empty
+ \ifx\insertlines@list\empty
+ \global\noteschanged@true
+ \gdef\next@insert{100000}%
+ \else
+ \gl@p\insertlines@list\to\next@insert
+ \fi
+ \fi
+ \ifnum\next@insert=\absline@num
+ \gl@p\inserts@list\to\@insert
+ \@insert
+ \global\let\@insert=\undefined
+ \global\let\next@insert=\empty
+ \global\let\add@inserts@next=\add@inserts
+ \fi
+\fi
+\add@inserts@next}
+
+\newcommand*{\add@penalties}{\@l@dtempcnta=\ballast@count
+ \ifnum\num@lines>\@ne
+ \global\advance\par@line \@ne
+ \ifnum\par@line=\@ne
+ \advance\@l@dtempcnta \clubpenalty
+ \fi
+ \@l@dtempcntb=\par@line \advance\@l@dtempcntb \@ne
+ \ifnum\@l@dtempcntb=\num@lines
+ \advance\@l@dtempcnta \widowpenalty
+ \fi
+ \ifnum\par@line<\num@lines
+ \advance\@l@dtempcnta \interlinepenalty
+ \fi
+ \fi
+ \ifnum\@l@dtempcnta=\z@
+ \relax
+ \else
+ \ifnum\@l@dtempcnta>-10000
+ \penalty\@l@dtempcnta
+ \else
+ \penalty -10000
+ \fi
+ \fi}
+
+\newcommand*{\flush@notes}{%
+ \@xloop
+ \ifx\inserts@list\empty \else
+ \gl@p\inserts@list\to\@insert
+ \@insert
+ \global\let\@insert=\undefined
+ \repeat}
+
+\def\@xloop#1\repeat{%
+ \def\body{#1\expandafter\body\fi}%
+ \body}
+
+ \def\select@lemmafont#1|#2|#3|#4|#5|#6|#7|{\select@@lemmafont#7|}
+ \def\select@@lemmafont#1/#2/#3/#4|%
+ {\fontencoding{#1}\fontfamily{#2}\fontseries{#3}\fontshape{#4}%
+ \selectfont}
+
+\newcommandx*{\footnoteoptions@}[3][1=L,usedefault]{%
+ \def\do##1{%
+ \ifstrequal{#1}{L}{% In Leftside
+ \xright@appenditem{\global\noexpand\settoggle{##1@}{#3}}\to\inserts@list% Switch toogle, in all case
+ \global\advance\insert@count \@ne% Increment the left insert counter.
+ }%
+ {%
+ \xright@appenditem{\global\noexpand\settoggle{##1@}{#3}}\to\inserts@listR% Switch toogle, in all case
+ \global\advance\insert@countR \@ne% Increment the right insert counter insert.
+ }%
+ }%
+ \notblank{#2}{\docsvlist{#2}}{}% Parsing all options
+}
+\newcommandx*{\footnotelang@lua}[1][1=L,usedefault]{%
+ \ifstrequal{#1}{L}{%
+ \xright@appenditem{{\csxdef{footnote@luatextextdir}{\the\luatextextdir}}}\to\inserts@list%Know the dir of lemma
+ \global\advance\insert@count \@ne%
+ \xright@appenditem{{\csxdef{footnote@luatexpardir}{\the\luatexpardir}}}\to\inserts@list%Know the dir of lemma
+ \global\advance\insert@count \@ne%
+ }%
+ {%
+ \xright@appenditem{{\csxdef{footnote@luatextextdir}{\the\luatextextdir}}}\to\inserts@listR%Know the dir of lemma
+ \global\advance\insert@countR \@ne%
+ \xright@appenditem{{\csxdef{footnote@luatexpardir}{\the\luatexpardir}}}\to\inserts@listR%Know the dir of lemma
+ \global\advance\insert@countR \@ne%
+ }%
+}
+\newcommandx*{\footnotelang@poly}[1][1=L,usedefault]{%
+ \ifstrequal{#1}{L}{%
+ \if@RTL%
+ \xright@appenditem{{\csxdef{footnote@dir}{@RTLtrue}}}\to\inserts@list%Know the language used in the lemma
+ \global\advance\insert@count \@ne%
+ \else
+ \xright@appenditem{{\csxdef{footnote@dir}{@RTLfalse}}}\to\inserts@list%Know the language of lemma
+ \global\advance\insert@count \@ne%
+ \fi%
+ \xright@appenditem{{\csxdef{footnote@lang}{\expandonce\languagename}}}\to\inserts@list%Know the language of lemma
+ \global\advance\insert@count \@ne%
+ }%
+ {%
+ \if@RTL
+ \xright@appenditem{{\csxdef{footnote@dir}{@RTLtrue}}}\to\inserts@listR%Know the language of lemma
+ \global\advance\insert@countR \@ne%
+ \else
+ \xright@appenditem{{\csxdef{footnote@dir}{@RTLfalse}}}\to\inserts@listR%Know the language of lemma
+ \global\advance\insert@countR \@ne%
+ \fi
+ \xright@appenditem{{\csxdef{footnote@lang}{\expandonce\languagename}}}\to\inserts@listR%Know the language of lemma
+ \global\advance\insert@countR \@ne%
+ }%
+}
+\newcommand*{\footsplitskips}{%
+ \interlinepenalty=\interfootnotelinepenalty
+ \unless\ifl@dprintingpages%
+ \floatingpenalty=\@MM%
+ \fi%
+ \splittopskip=\ht\strutbox \splitmaxdepth=\dp\strutbox
+ \leftskip=\z@skip \rightskip=\z@skip}
+
+\let\normalfootnoterule=\footnoterule
+\newcommandx{\Xarrangement}[2][1,usedefault]{%
+ \def\do##1{%
+ \csname Xarrangement@#2\endcsname{##1}%
+ }%
+ \ifstrempty{#1}%
+ {%
+ \dolistloop{\@series}%
+ }%
+ {
+ \docsvlist{#1}%
+ }%
+}%
+
+\newcommand*{\Xarrangement@normal}[1]{%
+ \csgdef{series@display#1}{normal}
+ \expandafter\let\csname #1footstart\endcsname=\normalfootstart
+ \expandafter\let\csname v#1footnote\endcsname=\normalvfootnote
+ \expandafter\let\csname #1footfmt\endcsname=\normalfootfmt
+ \expandafter\let\csname #1footgroup\endcsname=\normalfootgroup
+ \expandafter\let\csname #1footnoterule\endcsname=%
+ \normalfootnoterule
+ \count\csname #1footins\endcsname=1000
+ \dimen\csname #1footins\endcsname=\csuse{Xmaxhnotes@#1}
+ \skip\csname #1footins\endcsname=\csuse{Xbeforenotes@#1}%
+ \advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
+
+ \csxdef{default@#1footins}{1000}%Use this to confine the notes to one side only
+ \ifnoledgroup@\else%
+ \expandafter\let\csname mpv#1footnote\endcsname=\mpnormalvfootnote
+ \expandafter\let\csname mp#1footgroup\endcsname=\mpnormalfootgroup
+ \count\csname mp#1footins\endcsname=1000
+ \dimen\csname mp#1footins\endcsname=\csuse{Xmaxhnotes@#1}
+ \skip\csname mp#1footins\endcsname=\csuse{Xbeforenotes@#1}%
+ \advance\skip\csname mp#1footins\endcsname by\csuse{Xafterrule@#1}%
+ \fi
+}
+
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\normalvfootnote}[2]{%
+ \insert\csname #1footins\endcsname\bgroup
+ \csuse{Xbhooknote@#1}
+ \csuse{Xnotefontsize@#1}
+ \footsplitskips
+ \ifl@dpairing\ifl@dpaging\else%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \fi\fi%
+ \setXnotespositionliketwocolumns@{#1}%
+ \spaceskip=\z@skip \xspaceskip=\z@skip
+ \csname #1footfmt\endcsname #2{#1}\egroup}
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\mpnormalvfootnote}[2]{%
+ \global\setbox\@nameuse{mp#1footins}\vbox{%
+ \unvbox\@nameuse{mp#1footins}
+ \csuse{Xbhooknote@#1}
+ \csuse{Xnotefontsize@#1}
+ \hsize\columnwidth
+ \@parboxrestore
+ \color@begingroup
+ \csname #1footfmt\endcsname #2{#1}\color@endgroup}}
+
+
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\normalfootfmt}[4]{%
+ \Xledsetnormalparstuff{#4}%
+ \hangindent=\csuse{Xhangindent@#4}
+ \strut{\printlinefootnote{#1}{#4}}%
+ {\nottoggle{Xlemmadisablefontselection@#4}{\select@lemmafont#1|#2}{#2}}%
+ \iftoggle{nosep@}{\hskip\csuse{Xinplaceoflemmaseparator@#4}}{\ifcsempty{Xlemmaseparator@#4}%
+ {\hskip\csuse{Xinplaceoflemmaseparator@#4}}%
+ {\nobreak\hskip\csuse{Xbeforelemmaseparator@#4}\csuse{Xlemmaseparator@#4}\hskip\csuse{Xafterlemmaseparator@#4}\relax%
+ }}%
+ #3\strut\par}
+\newcommand*{\normalfootstart}[1]{%
+ \ifdimequal{0pt}{\preXnotes@}{}%
+ {%
+ \iftoggle{preXnotes@}{%
+ \togglefalse{preXnotes@}%
+ \skip\csname #1footins\endcsname=%
+ \dimexpr\csuse{preXnotes@}+\csuse{Xafterrule@#1}\relax%
+ }%
+ {}%
+ }%
+ \vskip\skip\csname #1footins\endcsname%
+ \leftskip0pt \rightskip0pt
+ \ifl@dpairing\else%
+ \hsize=\old@hsize%
+ \fi%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \setXnotespositionliketwocolumns@{#1}%
+ \print@Xfootnoterule{#1}%
+ \noindent\leavevmode}
+\newcommand*{\normalfootgroup}[1]{%
+ {\csuse{Xnotefontsize@#1}\noindent\csuse{Xtxtbeforenotes@#1}}%
+ \unvbox\csname #1footins\endcsname%
+ \hsize=\old@hsize%
+ }%
+
+\unless\ifnoledgroup@
+\newcommand*{\mpnormalfootgroup}[1]{{
+ \vskip\skip\@nameuse{mp#1footins}
+ \ifl@dpairing\ifparledgroup%
+ \leavevmode\marks\parledgroup@{begin}%
+ \marks\parledgroup@series{#1}%
+ \marks\parledgroup@type{Xfootnote}%
+ \fi\fi\normalcolor%
+ \ifparledgroup%
+ \ifl@dpairing%
+ \else%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \setXnotespositionliketwocolumns@{#1}%
+ \print@Xfootnoterule{#1}%%
+ \fi%
+ \else%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \setXnotespositionliketwocolumns@{#1}%
+ \print@Xfootnoterule{#1}%%
+ \fi%
+ \setlength{\parindent}{0pt}
+ {\csuse{Xnotefontsize@#1}\csuse{Xtxtbeforenotes@#1}}
+ \unvbox\csname mp#1footins\endcsname}}
+\fi
+\newcommand*{\Xarrangement@paragraph}[1]{%
+ \csgdef{series@display#1}{paragraph}
+ \expandafter\newcount\csname #1prevpage@num\endcsname
+ \expandafter\let\csname #1footstart\endcsname=\parafootstart
+ \expandafter\let\csname v#1footnote\endcsname=\paravfootnote
+ \expandafter\let\csname #1footfmt\endcsname=\parafootfmt
+ \expandafter\let\csname #1footgroup\endcsname=\parafootgroup
+ \count\csname #1footins\endcsname=1000
+ \csxdef{default@#1footins}{1000}%Use this to confine the notes to one side only
+ \dimen\csname #1footins\endcsname=\csuse{Xmaxhnotes@#1}
+ \skip\csname #1footins\endcsname=\csuse{Xbeforenotes@#1}%
+ \advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
+ \para@footsetup{#1}
+ \ifnoledgroup@\else
+ \expandafter\let\csname mpv#1footnote\endcsname=\mpparavfootnote
+ \expandafter\let\csname mp#1footgroup\endcsname=\mpparafootgroup
+ \count\csname mp#1footins\endcsname=1000
+ \dimen\csname mp#1footins\endcsname=\csuse{Xmaxhnotes@#1}
+ \skip\csname mp#1footins\endcsname=\csuse{Xbeforenotes@#1}%
+ \advance\skip\csname mp#1footins\endcsname by\csuse{Xafterrule@#1}%
+ \fi
+}
+\providecommand{\footfudgefiddle}{64}
+\newcommand*{\para@footsetup}[1]{{\csuse{Xnotefontsize@#1}
+ \setXnoteswidthliketwocolumns@{#1}%
+ \dimen0=\baselineskip
+ \multiply\dimen0 by 1024
+ \divide \dimen0 by \columnwidth \multiply\dimen0 by \footfudgefiddle\relax
+ \csxdef{#1footfudgefactor}{%
+ \expandafter\strip@pt\dimen0 }}}
+
+\newcommand*{\parafootstart}[1]{%
+ \rightskip=0pt \leftskip=0pt \parindent=0pt
+ \ifdimequal{0pt}{\preXnotes@}{}%
+ {%
+ \iftoggle{preXnotes@}{%
+ \togglefalse{preXnotes@}%
+ \skip\csname #1footins\endcsname=%
+ \dimexpr\csuse{preXnotes@}+\csuse{Xafterrule@#1}\relax%
+ }%
+ {}%
+ }%
+ \vskip\skip\csname #1footins\endcsname%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \setXnotespositionliketwocolumns@{#1}%
+ \print@Xfootnoterule{#1}%%
+ \noindent\leavevmode}
+\newcommand*{\paravfootnote}[2]{%
+ \insert\csname #1footins\endcsname
+ \bgroup
+ \csuse{Xbhooknote@#1}
+ \csuse{Xnotefontsize@#1}
+ \footsplitskips
+ \setbox0=\vbox{\hsize=\maxdimen
+ \noindent\csname #1footfmt\endcsname #2{#1}}%
+ \setbox0=\hbox{\Xunvxh{0}{#1}}%
+ \dp0=0pt
+ \ht0=\csname #1footfudgefactor\endcsname\wd0
+ \if@RTL\noindent \leavevmode\fi\box0%
+ \penalty0
+ \egroup}
+
+\newcommand*{\mpparavfootnote}[2]{%
+ \global\setbox\@nameuse{mp#1footins}\vbox{%
+ \unvbox\@nameuse{mp#1footins}%
+ \csuse{Xbhooknote@#1}
+ \csuse{Xnotefontsize@#1}
+ \footsplitskips
+ \setbox0=\vbox{\hsize=\maxdimen
+ \noindent\color@begingroup\csname #1footfmt\endcsname #2{#1}\color@endgroup}%
+ \setbox0=\hbox{\Xunvxh{0}{#1}}%
+ \dp0=\z@
+ \ht0=\csname #1footfudgefactor\endcsname\wd0
+ \box0
+ \penalty0
+}}
+
+\newcommand*{\Xunvxh}[2]{%
+ \setbox0=\vbox{\unvbox#1%
+ \global\setbox1=\lastbox}%
+ \unhbox1
+ \unskip % remove \rightskip,
+ \unskip % remove \parfillskip,
+ \unpenalty % remove \penalty of 10000,
+ \hskip\csuse{Xafternote@#2}} % but add the glue to go between the notes
+
+\newcommand*{\parafootfmt}[4]{%
+ \Xinsertparafootsep{#4}%
+ \Xledsetnormalparstuff{#4}%
+ \printlinefootnote{#1}{#4}%
+ {\nottoggle{Xlemmadisablefontselection@#4}{\select@lemmafont#1|#2}{#2}}%
+ \iftoggle{nosep@}{\hskip\csuse{Xinplaceoflemmaseparator@#4}}{\ifcsempty{Xlemmaseparator@#4}%
+ {\hskip\csuse{Xinplaceoflemmaseparator@#4}}%
+ {\nobreak\hskip\csuse{Xbeforelemmaseparator@#4}\csuse{Xlemmaseparator@#4}\hskip\csuse{Xafterlemmaseparator@#4}%
+ }}%
+ #3\penalty-10 }
+\newcommand*{\parafootgroup}[1]{%
+ \unvbox\csname #1footins\endcsname
+ \ifcsstring{Xragged@#1}{L}{\RaggedLeft}{}%
+ \ifcsstring{Xragged@#1}{R}{\RaggedRight}{}%
+ \makehboxofhboxes
+ \setbox0=\hbox{{\csuse{Xnotefontsize@#1}\csuse{Xtxtbeforenotes@#1}}\unhbox0 \removehboxes}%
+ \csuse{Xnotefontsize@#1}
+ \noindent\unhbox0\par%
+ \global\hsize=\old@hsize%
+ }%
+
+\newcommand*{\mpparafootgroup}[1]{{%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \vskip\skip\@nameuse{mp#1footins}
+ \ifl@dpairing\ifparledgroup%
+ \leavevmode\marks\parledgroup@{begin}%
+ \marks\parledgroup@series{#1}%
+ \marks\parledgroup@type{Xfootnote}%
+ \fi\fi\normalcolor
+ \ifparledgroup%
+ \ifl@dpairing%
+ \else%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \setXnotespositionliketwocolumns@{#1}%
+ \print@Xfootnoterule{#1}%%
+ \fi%
+ \else%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \setXnotespositionliketwocolumns@{#1}%
+ \print@Xfootnoterule{#1}%
+ \fi%
+ \unvbox\csname mp#1footins\endcsname
+ \ifcsstring{Xragged@#1}{L}{\RaggedLeft}{}%
+ \ifcsstring{Xragged@#1}{R}{\RaggedRight}{}%
+ \makehboxofhboxes
+ \setbox0=\hbox{{\csuse{Xnotefontsize@#1}\csuse{Xtxtbeforenotes@#1}}\unhbox0 \removehboxes}%
+ \csuse{Xnotefontsize@#1}
+ \noindent\unhbox0\par}}
+
+\newcommand*{\makehboxofhboxes}{\setbox0=\hbox{}%
+ \loop
+ \unpenalty
+ \setbox2=\lastbox
+ \ifhbox2
+ \setbox0=\hbox{\box2\unhbox0}%
+ \repeat}
+
+\newcommand*{\removehboxes}{\setbox0=\lastbox
+ \ifhbox0{\removehboxes}\unhbox0 \fi}
+
+\newcommand{\Xinsertparafootsep}[1]{%
+ \ifnumequal{\csuse{#1prevpage@num}}{\page@num}%
+ {\ifcsdef{prevline#1}% Be sur \prevline#1 exists.
+ {\ifnumequal{\csuse{prevline#1}}{\line@num}%
+ {\ifcsempty{Xsymlinenum@#1}{\csuse{Xparafootsep@#1}}{}}%
+ {\csuse{Xparafootsep@#1}}%
+ }%
+ {\csuse{Xparafootsep@#1}}%
+ }%
+ {}%
+ \global\csname #1prevpage@num\endcsname=\page@num%
+}
+\newcount\@k \newdimen\@h
+\newcommand*{\rigidbalance}[3]{\setbox0=\box#1 \@k=#2 \@h=#3
+ \@@line{\splittopskip=\@h \vbadness=\@M \hfilneg
+ \valign{##\vfil\cr\dosplits}}}
+
+\newcommand*{\dosplits}{\ifnum\@k>0 \noalign{\hfil}\splitoff
+ \global\advance\@k-1\cr\dosplits\fi}
+
+\newcommand*{\splitoff}{\dimen0=\ht0
+ \divide\dimen0 by\@k \advance\dimen0 by\@h
+ \setbox2 \vsplit0 to \dimen0
+ \unvbox2 }
+
+\newcommand*{\Xarrangement@threecol}[1]{%
+ \csgdef{series@display#1}{threecol}
+ \expandafter\let\csname v#1footnote\endcsname=\threecolvfootnote
+ \expandafter\let\csname #1footfmt\endcsname=\threecolfootfmt
+ \expandafter\let\csname #1footgroup\endcsname=\threecolfootgroup
+ \dimen\csname #1footins\endcsname=\csuse{Xmaxhnotes@#1}%
+ \skip\csname #1footins\endcsname=\csuse{Xbeforenotes@#1}%
+ \advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
+ \threecolfootsetup{#1}
+ \ifnoledgroup@\else
+ \expandafter\let\csname mpv#1footnote\endcsname=\mpnormalvfootnote
+ \expandafter\let\csname mp#1footgroup\endcsname=\mpthreecolfootgroup
+ \skip\csname mp#1footins\endcsname=\csuse{Xbeforenotes@#1}%
+ \advance\skip\csname mp#1footins\endcsname by\csuse{Xafterrule@#1}%
+ \mpthreecolfootsetup{#1}
+ \fi
+}
+
+\newcommand*{\threecolfootsetup}[1]{%
+ \count\csname #1footins\endcsname 333
+ \csxdef{default@#1footins}{333}%Use this to confine the notes to one side only
+ \multiply\dimen\csname #1footins\endcsname \thr@@}
+\newcommand*{\mpthreecolfootsetup}[1]{%
+ \count\csname mp#1footins\endcsname 333
+ \multiply\dimen\csname mp#1footins\endcsname \thr@@}
+
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolvfootnote}[2]{%
+ \insert\csname #1footins\endcsname\bgroup
+ \csuse{Xnotefontsize@#1}
+ \footsplitskips
+ \csname #1footfmt\endcsname #2{#1}\egroup}
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolfootfmt}[4]{%
+ \normal@pars
+ \hsize \csuse{Xhsizethreecol@#4}
+ \nottoggle{Xparindent@#4}{\parindent=\z@}{}
+ \tolerance=5000
+ \hangindent=\csuse{Xhangindent@#4}
+ \leavevmode
+ \csuse{Xcolalign@#4}%
+ \strut{\printlinefootnote{#1}{#4}}%
+ {\nottoggle{Xlemmadisablefontselection@#4}{\select@lemmafont#1|#2}{#2}}%
+ \iftoggle{nosep@}{\hskip\csuse{Xinplaceoflemmaseparator@#4}}{\ifcsempty{Xlemmaseparator@#4}%
+ {\hskip\csuse{Xinplaceoflemmaseparator@#4}}%
+ {\nobreak\hskip\csuse{Xbeforelemmaseparator@#4}\csuse{Xlemmaseparator@#4}\hskip\csuse{Xafterlemmaseparator@#4}%
+ }}%
+ #3\strut\par\allowbreak}
+\newcommand*{\threecolfootgroup}[1]{{\csuse{Xnotefontsize@#1}%
+ \noindent\csuse{Xtxtbeforenotes@#1}\par%
+ \splittopskip=\ht\strutbox
+ \expandafter
+ \rigidbalance\csname #1footins\endcsname \thr@@ \splittopskip}}
+\newcommand*{\mpthreecolfootgroup}[1]{{%
+ \vskip\skip\@nameuse{mp#1footins}
+ \ifl@dpairing\ifparledgroup%
+ \leavevmode\marks\parledgroup@{begin}%
+ \marks\parledgroup@series{#1}%
+ \marks\parledgroup@type{Xfootnote}%
+ \fi\fi\normalcolor
+ \ifparledgroup%
+ \ifl@dpairing%
+ \else%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \setXnotespositionliketwocolumns@{#1}%
+ \print@Xfootnoterule{#1}%
+ \fi%
+ \else%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \setXnotespositionliketwocolumns@{#1}%
+ \print@Xfootnoterule{#1}%
+ \fi%
+ {\csuse{Xnotefontsize@#1}\noindent\csuse{Xtxtbeforenotes@#1}}\par
+ \splittopskip=\ht\strutbox
+ \expandafter
+ \rigidbalance\csname mp#1footins\endcsname \thr@@ \splittopskip}}
+
+\newcommand*{\Xarrangement@twocol}[1]{%
+ \csgdef{series@display#1}{twocol}
+ \expandafter\let\csname v#1footnote\endcsname=\twocolvfootnote
+ \expandafter\let\csname #1footfmt\endcsname=\twocolfootfmt
+ \expandafter\let\csname #1footgroup\endcsname=\twocolfootgroup
+ \dimen\csname #1footins\endcsname=\csuse{Xmaxhnotes@#1}%
+ \skip\csname #1footins\endcsname=\csuse{Xbeforenotes@#1}%
+ \advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
+ \twocolfootsetup{#1}
+ \ifnoledgroup@\else
+ \expandafter\let\csname mpv#1footnote\endcsname=\mpnormalvfootnote
+ \expandafter\let\csname mp#1footgroup\endcsname=\mptwocolfootgroup
+ \skip\csname mp#1footins\endcsname=\csuse{Xbeforenotes@#1}%
+ \advance\skip\csname mp#1footins\endcsname by\csuse{Xafterrule@#1}%
+ \mptwocolfootsetup{#1}
+ \fi
+}
+
+\newcommand*{\twocolfootsetup}[1]{%
+ \count\csname #1footins\endcsname 500
+ \csxdef{default@#1footins}{500}%Use this to confine the notes to one side only
+ \multiply\dimen\csname #1footins\endcsname \tw@}
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolvfootnote}[2]{\insert\csname #1footins\endcsname\bgroup
+ \csuse{Xnotefontsize@#1}
+ \footsplitskips
+ \csname #1footfmt\endcsname #2{#1}\egroup}
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolfootfmt}[4]{% 4th arg is optional, for backward compatibility
+ \normal@pars
+ \hsize \csuse{Xhsizetwocol@#4}
+ \nottoggle{Xparindent@#4}{\parindent=\z@}{}
+ \tolerance=5000
+ \hangindent=\csuse{Xhangindent@#4}
+ \leavevmode
+ \csuse{Xcolalign@#4}%
+ \strut{\printlinefootnote{#1}{#4}}%
+ {\nottoggle{Xlemmadisablefontselection@#4}{\select@lemmafont#1|#2}{#2}}%
+ \iftoggle{nosep@}{\hskip\csuse{Xinplaceoflemmaseparator@#4}}{\ifcsempty{Xlemmaseparator@#4}%
+ {\hskip\csuse{Xinplaceoflemmaseparator@#4}}%
+ {\nobreak\hskip\csuse{Xbeforelemmaseparator@#4}\csuse{Xlemmaseparator@#4}\hskip\csuse{Xafterlemmaseparator@#4}%
+ }}%
+ #3\strut\par\allowbreak}
+\newcommand*{\twocolfootgroup}[1]{{\csuse{Xnotefontsize@#1}
+ \noindent\csuse{Xtxtbeforenotes@#1}\par%
+ \splittopskip=\ht\strutbox
+ \expandafter
+ \rigidbalance\csname #1footins\endcsname \tw@ \splittopskip}}
+
+\newcommand*{\mptwocolfootsetup}[1]{%
+ \count\csname mp#1footins\endcsname 500
+ \multiply\dimen\csname mp#1footins\endcsname \tw@}
+\newcommand*{\mptwocolfootgroup}[1]{{%
+ \vskip\skip\@nameuse{mp#1footins}
+ \ifl@dpairing\ifparledgroup%
+ \leavevmode\marks\parledgroup@{begin}%
+ \marks\parledgroup@series{#1}%
+ \marks\parledgroup@type{Xfootnote}%
+ \fi\fi\normalcolor
+ \ifparledgroup%
+ \ifl@dpairing%
+ \else%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \setXnotespositionliketwocolumns@{#1}%
+ \print@Xfootnoterule{#1}%
+ \fi%
+ \else%
+ \setXnoteswidthliketwocolumns@{#1}%
+ \setXnotespositionliketwocolumns@{#1}%
+ \print@Xfootnoterule{#1}%
+ \fi%
+ {\csuse{Xnotefontsize@#1}\noindent\csuse{Xtxtbeforenotes@#1}}\par
+ \splittopskip=\ht\strutbox
+ \expandafter
+ \rigidbalance\csname mp#1footins\endcsname \tw@ \splittopskip}}
+
+
+\def\endashchar{\textnormal{--}}
+\newcommand*{\fullstop}{\textnormal{.}}
+\newcommand*{\rbracket}{\textnormal{%
+ \csuse{text\csuse{footnote@lang}}{%
+ \ifluatex%
+ \ifdefstring{\footnote@luatextextdir}{TRT}{\thinspace[}{\thinspace]}%
+ \else%
+ \thinspace]%
+ \fi}%
+ }%
+}
+
+\newcommand{\printpstart}[0]{%
+ \ifboolexpr{bool{l@dpairing} or bool{l@dprintingpages} or bool{l@dprintingcolumns}}{%
+ \ifledRcol%
+ \thepstartR%
+ \else%
+ \thepstartL%
+ \fi%
+ }{%
+ \thepstart%
+ }%
+}
+\newcommand{\printlinefootnote}[2]{%
+ \def\extractline@##1|##2|##3|##4|##5|##6|##7|{##2}%
+ \def\extractsubline@##1|##2|##3|##4|##5|##6|##7|{##3}%
+ \def\extractendline@##1|##2|##3|##4|##5|##6|##7|{##5}%
+ \def\extractendsubline@##1|##2|##3|##4|##5|##6|##7|{##6}%
+ \iftoggle{Xnumberonlyfirstintwolines@#2}{%
+ \edef\lineinfo@{\extractline@ #1| - \extractsubline@ #1| - \extractendline@ #1| - \extractendsubline@ #1|}%
+ }%
+ {%
+ \edef\lineinfo@{\extractline@ #1| - \extractsubline@ #1|}%
+ }%
+ \iftoggle{nonum@}{%Try if the line number must printed for this specific not (by default, yes)
+ \hspace{\csuse{Xinplaceofnumber@#2}}%
+ }%
+ {%
+ {%
+ \iftoggle{Xnonumber@#2}%Try if the line number must printed (by default, yes)
+ {%
+ \hspace{\csuse{Xinplaceofnumber@#2}}%
+ }%
+ {%
+ {\iftoggle{Xnumberonlyfirstinline@#2}% If for this series the line number must be printed only in the first time.
+ {%
+ \ifcsdef{prevline#2}%
+ {%Be sure the \prevline exists.
+ \ifcsequal{prevline#2}{lineinfo@}%Try it
+ {%
+ \ifcsempty{Xsymlinenum@#2}%
+ {%
+ \hspace{\csuse{Xinplaceofnumber@#2}}%
+ }%
+ {\hspace{\csuse{Xbeforesymlinenum@#2}}\csuse{Xnotenumfont@#2}%
+ \ifdimequal{\csuse{Xboxsymlinenum@#2}}{0pt}%
+ {\csuse{Xsymlinenum@#2}}%
+ {\hbox to \csuse{Xboxsymlinenum@#2}{\csuse{Xsymlinenum@#2}\hfill}}%
+ \hspace{\csuse{Xaftersymlinenum@#2}}}%
+ }%
+ {%
+ \printlinefootnotearea{#1}{#2}%
+ }%
+ }%
+ {%
+ \printlinefootnotearea{#1}{#2}%
+ }%
+ }%
+ {%
+ \printlinefootnotearea{#1}{#2}%
+ }%
+ \csxdef{prevline#2}{\lineinfo@}%
+ }%
+ }%
+ }%
+ }%
+}
+\newcommand{\printlinefootnotearea}[2]{%
+ \printXbeforenumber{#2}%
+ \csuse{Xnotenumfont@#2}%
+ \boxfootnotenumbers{#1}{#2}%
+ \printXafternumber{#2}%
+}%
+\newcommand{\boxfootnotenumbers}[2]{%
+ \ifdimequal{\csuse{Xboxlinenum@#2}}{0pt}{%
+ \printlinefootnotenumbers{#1}{#2}%
+ }%
+ {%
+ \hbox to \csuse{Xboxlinenum@#2}%
+ {%
+ \IfSubStr{RC}{\csuse{Xboxlinenumalign@#2}}{\hfill}{}%
+ \printlinefootnotenumbers{#1}{#2}%
+ \IfSubStr{LC}{\csuse{Xboxlinenumalign@#2}}{\hfill}{}%
+ }%
+ }%
+}%
+\newcommand{\printlinefootnotenumbers}[2]{%
+ \xdef\@currentseries{#2}%
+ \ifboolexpr{%
+ (togl{Xpstart@#2} and bool{numberpstart})%
+ or togl{Xpstarteverytime@#2}}%
+ {\printpstart}{}%
+ \iftoggle{Xonlypstart@#2}{}{\printlines#1|}%
+}%
+\newcommand{\printXbeforenumber}[1]{%
+ \hspace{\csuse{Xbeforenumber@#1}}%
+}%
+\newcommand{\printXafternumber}[1]{%
+ \iftoggle{Xnonbreakableafternumber@#1}{\nobreak}{}%
+ \hspace{\csuse{Xafternumber@#1}}%
+}%
+\newif\ifl@d@pnum
+\newif\ifl@d@ssub
+\newif\ifl@d@elin
+\newif\ifl@d@esl
+\newif\ifl@d@dash
+\newif\ifl@d@Xtwolines%
+\newif\ifl@d@Xmorethantwolines%
+\newcommand*{\l@dparsefootspec}[3]{\l@dp@rsefootspec#1|}
+\def\l@dp@rsefootspec#1|#2|#3|#4|#5|#6|#7|{%
+ \gdef\l@dparsedstartpage{#1}%
+ \gdef\l@dparsedstartline{#2}%
+ \gdef\l@dparsedstartsub{#3}%
+ \gdef\l@dparsedendpage{#4}%
+ \gdef\l@dparsedendline{#5}%
+ \gdef\l@dparsedendsub{#6}%
+}
+\def\l@dparsedstartpage{0}%
+\def\l@dparsedstartline{0}%
+\def\l@dparsedstartsub{0}%
+\def\l@dparsedendpage{0}%
+\def\l@dparsedendline{0}%
+\def\l@dparsedendsub{0}%
+
+\newcommand*{\setprintlines}[6]{%
+ \l@d@pnumfalse \l@d@dashfalse
+ \ifbypage@
+ \ifnum#4=#1 \else
+ \l@d@pnumtrue
+ \l@d@dashtrue
+ \fi
+ \fi
+ \ifl@d@pnum \l@d@elintrue \else \l@d@elinfalse \fi
+ \ifnum#2=#5 \else
+ \l@d@elintrue
+ \l@d@dashtrue
+ \fi
+ \l@d@ssubfalse
+ \ifnum#3=0 \else
+ \l@d@ssubtrue
+ \fi
+ \l@d@eslfalse
+ \ifnum#6=0 \else
+ \ifnum#6=#3
+ \ifl@d@elin \l@d@esltrue \else \l@d@eslfalse \fi
+ \else
+ \l@d@esltrue
+ \l@d@dashtrue
+ \fi
+ \fi%
+ \ifl@d@dash%
+ \ifboolexpr{togl{fulllines@} or test{\ifcsempty{Xtwolines@\@currentseries}}}%
+ {}%
+ {%
+ \setistwofollowinglines{#1}{#2}{#4}{#5}%
+ \ifboolexpr{%
+ (%
+ togl {Xtwolinesbutnotmore@\@currentseries}%
+ and not%
+ (%
+ bool {istwofollowinglines@}%
+ )%
+ )%
+ or%
+ (%
+ (not test{\ifnumequal{#1}{#4}})%
+ and togl{Xtwolinesonlyinsamepage@\@currentseries}%
+ )%
+ }%
+ {}%
+ {%
+ \l@d@dashfalse%
+ \l@d@Xtwolinestrue%
+ \l@d@elinfalse%
+ \l@d@eslfalse%
+ \ifcsempty{Xmorethantwolines@\@currentseries}%
+ {}%
+ {\ifistwofollowinglines@\else%
+ \l@d@Xmorethantwolinestrue%
+ \fi%
+ }%
+ }%
+ }%
+ \fi%
+}%
+\newif\ifistwofollowinglines@%
+\newcommand{\setistwofollowinglines}[4]{%
+ \ifcsdef{lastlinenumberon@#1}%
+ {\numdef{\tmp}{\csuse{lastlinenumberon@#1}}}%
+ {\numdef{\tmp}{0}}%
+ \istwofollowinglines@false%
+ \ifnumequal{#4-#2}{1}%
+ {\istwofollowinglines@true}%
+ {\ifbypage@%
+ \ifnumequal{#3-#1}{1}%
+ {%
+ \ifnumequal{#2}{\tmp}%
+ {\ifnumequal{#4}{1}{\istwofollowinglines@true}{}}%
+ {}%
+ }%
+ {}%
+ \fi%
+ }%
+}%
+\def\printlines#1|#2|#3|#4|#5|#6|#7|{%
+ \begingroup%
+ \ifluatex%
+ \luatextextdir TLT%
+ \fi%
+ \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
+ \ifdimequal{\csuse{Xboxstartlinenum@\@currentseries}}{0pt}%
+ {\bgroup}%
+ {\leavevmode\hbox to \csuse{Xboxstartlinenum@\@currentseries}\bgroup\hfill}%
+ \ifl@d@pnum #1\fullstop\fi
+ \linenumrep{#2}
+ \ifl@d@ssub \fullstop \sublinenumrep{#3}\fi
+ \egroup%
+ \ifdimequal{\csuse{Xboxendlinenum@\@currentseries}}{0pt}%
+ {\bgroup}%
+ {\hbox to \csuse{Xboxendlinenum@\@currentseries}\bgroup}%
+ \ifl@d@Xtwolines%
+ \ifl@d@Xmorethantwolines%
+ \csuse{Xmorethantwolines@\@currentseries}%
+ \else%
+ \csuse{Xtwolines@\@currentseries}%
+ \fi%
+ \else%
+ \ifl@d@dash \endashchar\fi%
+ \ifl@d@pnum #4\fullstop\fi%
+ \ifl@d@elin \linenumrep{#5}\fi%
+ \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumrep{#6}\fi%
+ \fi%
+ \ifdimequal{\csuse{Xboxendlinenum@\@currentseries}}{0pt}%
+ {}%
+ {\hfill}%Prevent underfull hbox
+ \egroup%
+ \endgroup%
+}%
+\providecommand*{\multiplefootnotemarker}{3sp}
+\providecommand*{\multfootsep}{\textsuperscript{\normalfont,}}
+
+\providecommand*{\m@mmf@prepare}{%
+ \kern-\multiplefootnotemarker
+ \kern\multiplefootnotemarker\relax}
+\providecommand*{\m@mmf@check}{%
+ \ifdim\lastkern=\multiplefootnotemarker\relax
+ \edef\@x@sf{\the\spacefactor}%
+ \unkern
+ \multfootsep
+ \spacefactor\@x@sf\relax
+ \fi}
+
+\@ifclassloaded{memoir}{}{%
+\apptocmd{\@footnotetext}{\m@mmf@prepare}{}{}
+
+\patchcmd{\@footnotemark}
+ {\nobreak}
+ {\m@mmf@check
+ \nobreak
+ }
+ {}{}
+\patchcmd{\@footnotemark}
+ {\@makefnmark}
+ {\@makefnmark
+ \m@mmf@prepare
+ }
+ {}{}
+}
+
+\pretocmd{\@footnotetext}{%
+ \ifnumberedpar@
+ \edtext{}{\l@dbfnote{#1}}%
+ \else
+ }{}{}
+\apptocmd{\@footnotetext}{\fi}{}{}%
+
+\newcommand{\l@dbfnote}[1]{%
+ \ifnumberedpar@
+ \gdef\@tag{#1\relax}%
+ \ifledRcol%
+ \xright@appenditem{\noexpand\vl@dbfnote{{\expandonce\@tag}}{\@thefnmark}}%
+ \to\inserts@listR
+ \global\advance\insert@countR \@ne%
+ \else%
+ \xright@appenditem{\noexpand\vl@dbfnote{{\expandonce\@tag}}{\@thefnmark}}%
+ \to\inserts@list
+ \global\advance\insert@count \@ne%
+ \fi
+ \fi\ignorespaces}
+
+\newcommand{\vl@dbfnote}[2]{%
+ \def\@thefnmark{#2}%
+ \@footnotetext{#1}%
+ }%
+\newcommand*{\prebodyfootmark}{%
+ \leavevmode
+ \ifhmode
+ \edef\@x@sf{\the\spacefactor}%
+ \m@mmf@check
+ \nobreak
+ \fi}
+\newcommand{\postbodyfootmark}{%
+ \m@mmf@prepare
+ \ifhmode\spacefactor\@x@sf\fi\relax}
+
+\newcommandx{\arrangementX}[2][1,usedefault]{%
+ \def\do##1{%
+ \csname arrangementX@#2\endcsname{##1}%
+ }%
+ \ifstrempty{#1}%
+ {%
+ \dolistloop{\@series}%
+ }%
+ {
+ \docsvlist{#1}%
+ }%
+}%
+\newcommand*{\normal@footnotemarkX}[1]{%
+ \prebodyfootmark
+ \@nameuse{bodyfootmark#1}%
+ \postbodyfootmark}
+
+\newcommand*{\normalbodyfootmarkX}[1]{%
+ \hbox{\textsuperscript{\normalfont\@nameuse{@thefnmark#1}}}}
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\normalvfootnoteX}[2]{%
+ \insert\@nameuse{footins#1}\bgroup
+ \csuse{bhooknoteX@#1}
+ \csuse{notefontsizeX@#1}
+ \footsplitskips
+ \ifl@dpairing\ifl@dpaging\else%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \fi\fi%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \spaceskip=\z@skip \xspaceskip=\z@skip
+ \csuse{\csuse{footnote@dir}}\@nameuse{footfmt#1}{#1}{#2}\egroup}
+
+\newcommand*{\mpnormalvfootnoteX}[2]{%
+ \global\setbox\@nameuse{mpfootins#1}\vbox{%
+ \unvbox\@nameuse{mpfootins#1}
+ \csuse{bhooknoteX@#1}
+ \csuse{notefontsizeX@#1}
+ \hsize\columnwidth
+ \@parboxrestore
+ \color@begingroup
+ \@nameuse{footfmt#1}{#1}{#2}\color@endgroup}}
+
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\normalfootfmtX}[2]{%
+ \ifluatex%
+ \luatextextdir\footnote@luatextextdir%
+ \luatexpardir\footnote@luatexpardir%
+ \par%
+ \fi%
+ \protected@edef\@currentlabel{%
+ \@nameuse{@thefnmark#1}%
+ }%
+ \ledsetnormalparstuffX{#1}%
+ \hangindent=\csuse{hangindentX@#1}%
+ {{\csuse{notenumfontX@#1}\@nameuse{footfootmark#1}}\strut%
+ #2\strut\par}}
+
+\newcommand*{\normalfootfootmarkX}[1]{%
+ \textsuperscript{\@nameuse{@thefnmark#1}}}
+
+\newcommand*{\normalfootstartX}[1]{%
+ \ifdimequal{0pt}{\prenotesX@}{}%
+ {%
+ \iftoggle{prenotesX@}{%
+ \togglefalse{prenotesX@}%
+ \skip\csname footins#1\endcsname=%
+ \dimexpr\csuse{prenotesX@}+\csuse{afterruleX@#1}\relax%
+ }%
+ {}%
+ }%
+ \vskip\skip\csname footins#1\endcsname%
+ \leftskip=\z@
+ \rightskip=\z@
+ \ifl@dpairing\else%
+ \hsize=\old@hsize%
+ \fi%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \print@footnoteXrule{#1}%
+}%
+
+\let\normalfootnoteruleX=\footnoterule
+
+\newcommand*{\normalfootgroupX}[1]{%
+ \unvbox\@nameuse{footins#1}%
+ \hsize=\old@hsize%
+ }%
+
+\newcommand*{\mpnormalfootgroupX}[1]{%
+ \vskip\skip\@nameuse{mpfootins#1}
+ \ifl@dpairing\ifparledgroup%
+ \leavevmode\marks\parledgroup@{begin}%
+ \marks\parledgroup@series{#1}%
+ \marks\parledgroup@type{footnoteX}%
+ \fi\fi\normalcolor
+ \ifparledgroup%
+ \ifl@dpairing%
+ \else%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \print@footnoteXrule{#1}%
+ \fi%
+ \else%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \print@footnoteXrule{#1}%
+ \fi%
+ \unvbox\@nameuse{mpfootins#1}}
+
+
+\newcommand{\normalbfnoteX}[2]{%
+ \ifnumberedpar@
+ \ifledRcol%
+ \ifluatex
+ \footnotelang@lua[R]%
+ \fi
+ \@ifundefined{xpg@main@language}%if polyglossia
+ {}%
+ {\footnotelang@poly[R]}%
+ \protected@xdef\thisfootnote{\csuse{thefootnote#1}}%
+ \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\expandonce\thisfootnote}}%
+ \to\inserts@listR
+ \global\advance\insert@countR \@ne%
+ \else%
+ \ifluatex
+ \footnotelang@lua%
+ \fi
+ \@ifundefined{xpg@main@language}%if polyglossia
+ {}%
+ {\footnotelang@poly}%
+ \protected@xdef\thisfootnote{\csuse{thefootnote#1}}%
+ \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\expandonce\thisfootnote}}%
+ \to\inserts@list
+ \global\advance\insert@count \@ne%
+ \fi
+ \fi\ignorespaces}
+
+\newcommand{\vbfnoteX}[3]{%
+ \@namedef{@thefnmark#1}{#3}%
+ \@nameuse{regvfootnote#1}{#1}{#2}}
+
+\newcommand{\vnumfootnoteX}[2]{%
+ \ifnumberedpar@
+ \edtext{}{\normalbfnoteX{#1}{#2}}%
+ \else
+ \@nameuse{regvfootnote#1}{#1}{#2}%
+ \fi}
+
+\newcommand*{\arrangementX@normal}[1]{%
+ \csgdef{series@displayX#1}{normal}
+ \expandafter\let\csname footstart#1\endcsname=\normalfootstartX
+ \expandafter\newcount\csname prevpage#1@num\endcsname
+ \@namedef{@footnotemark#1}{\normal@footnotemarkX{#1}}
+ \@namedef{bodyfootmark#1}{\normalbodyfootmarkX{#1}}
+ \expandafter\let\csname regvfootnote#1\endcsname=\normalvfootnoteX
+ \expandafter\let\csname vfootnote#1\endcsname=\vnumfootnoteX
+ \expandafter\let\csname footfmt#1\endcsname=\normalfootfmtX
+ \@namedef{footfootmark#1}{\normalfootfootmarkX{#1}}
+ \expandafter\let\csname footgroup#1\endcsname=\normalfootgroupX
+ \expandafter\let\csname footnoterule#1\endcsname=\normalfootnoteruleX
+ \count\csname footins#1\endcsname=1000
+ \csxdef{default@footins#1}{1000}%Use to have note only for one side
+ \dimen\csname footins#1\endcsname=\csuse{maxhnotesX@#1}
+ \skip\csname footins#1\endcsname=\csuse{beforenotesX@#1}%
+ \advance\skip\csname footins#1\endcsname by\csuse{afterruleX@#1}%
+ \ifnoledgroup@\else%
+ \expandafter\let\csname mpvfootnote#1\endcsname=\mpnormalvfootnoteX
+ \expandafter\let\csname mpfootgroup#1\endcsname=\mpnormalfootgroupX
+ \count\csname mpfootins#1\endcsname=1000
+ \dimen\csname mpfootins#1\endcsname=\csuse{maxhnotesX@#1}
+ \skip\csname mpfootins#1\endcsname=\csuse{beforenotesX@#1}%
+ \advance\skip\csname mpfootins#1\endcsname by\csuse{afterruleX@#1}%
+ \fi
+}
+
+\newcommand*{\arrangementX@twocol}[1]{%
+ \csgdef{series@displayX#1}{twocol}
+ \expandafter\let\csname regvfootnote#1\endcsname=\twocolvfootnoteX
+ \expandafter\let\csname footfmt#1\endcsname=\twocolfootfmtX
+ \expandafter\let\csname footgroup#1\endcsname=\twocolfootgroupX
+ \dimen\csname footins#1\endcsname=\csuse{maxhnotesX@#1}%
+ \skip\csname footins#1\endcsname=\csuse{beforenotesX@#1}%
+ \advance\skip\csname footins#1\endcsname by \csuse{afterruleX@#1}\relax%
+ \twocolfootsetupX{#1}
+ \ifnoledgroup@\else%
+ \expandafter\let\csname mpvfootnote#1\endcsname=\mpnormalvfootnoteX
+ \expandafter\let\csname mpfootgroup#1\endcsname=\mptwocolfootgroupX
+ \skip\csname mpfootins#1\endcsname=\csuse{beforenotesX@#1}%
+ \advance\skip\csname mpfootins#1\endcsname by\csuse{afterruleX@#1}
+ \mptwocolfootsetupX{#1}
+ \fi%
+}
+
+\newcommand*{\twocolfootsetupX}[1]{%
+ \count\csname footins#1\endcsname 500
+ \csxdef{default@footins#1}{500}%Use this to confine the notes to one side only
+ \multiply\dimen\csname footins#1\endcsname by \tw@}
+\newcommand*{\mptwocolfootsetupX}[1]{%
+ \count\csname mpfootins#1\endcsname 500
+ \multiply\dimen\csname mpfootins#1\endcsname by \tw@}
+
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolvfootnoteX}[2]{%
+ \insert\csname footins#1\endcsname\bgroup
+ \csuse{notefontsizeX@#1}
+ \footsplitskips
+ \spaceskip=\z@skip \xspaceskip=\z@skip
+ \@nameuse{footfmt#1}{#1}{#2}\egroup}
+
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolfootfmtX}[2]{%
+ \protected@edef\@currentlabel{%
+ \@nameuse{@thefnmark#1}%
+ }%
+ \normal@pars
+ \hangindent=\csuse{hangindentX@#1}%
+ \hsize \csuse{hsizetwocolX@#1}
+ \nottoggle{parindentX@#1}{\parindent=\z@}{}
+ \tolerance=5000\relax
+ \leavevmode
+ \csuse{colalignX@#1}%
+ {\csuse{notenumfontX@#1}\@nameuse{footfootmark#1}\strut%
+ #2\strut\par}\allowbreak}
+
+\newcommand*{\twocolfootgroupX}[1]{{\csuse{notefontsizeX@#1}
+ \splittopskip=\ht\strutbox
+ \expandafter
+ \rigidbalance\csname footins#1\endcsname \tw@ \splittopskip}}
+\newcommand*{\mptwocolfootgroupX}[1]{{%
+ \vskip\skip\@nameuse{mpfootins#1}
+ \ifl@dpairing\ifparledgroup%
+ \leavevmode\marks\parledgroup@{begin}%
+ \marks\parledgroup@series{#1}%
+ \marks\parledgroup@type{footnoteX}%
+ \fi\fi\normalcolor
+ \ifparledgroup%
+ \ifl@dpairing%
+ \else%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \print@footnoteXrule{#1}%
+ \fi%
+ \else%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \print@footnoteXrule{#1}%
+ \fi%
+ \splittopskip=\ht\strutbox
+ \expandafter
+ \rigidbalance\csname mpfootins#1\endcsname \tw@ \splittopskip}}
+
+\newcommand*{\arrangementX@threecol}[1]{%
+ \csgdef{series@displayX#1}{threecol}
+ \expandafter\let\csname regvfootnote#1\endcsname=\threecolvfootnoteX
+ \expandafter\let\csname footfmt#1\endcsname=\threecolfootfmtX
+ \expandafter\let\csname footgroup#1\endcsname=\threecolfootgroupX
+ \dimen\csname footins#1\endcsname=\csuse{maxhnotesX@#1}%
+ \skip\csname footins#1\endcsname=\csuse{beforenotesX@#1}%
+ \advance\skip\csname footins#1\endcsname by \csuse{afterruleX@#1}\relax%
+ \threecolfootsetupX{#1}
+ \ifnoledgroup@\else%
+ \expandafter\let\csname mpvfootnote#1\endcsname=\mpnormalvfootnoteX
+ \expandafter\let\csname mpfootgroup#1\endcsname=\mpthreecolfootgroupX
+ \skip\csname mpfootins#1\endcsname=\csuse{beforenotesX@#1}%
+ \advance\skip\csname mpfootins#1\endcsname by\csuse{afterruleX@#1}
+ \mpthreecolfootsetupX{#1}
+ \fi%
+}
+
+\newcommand*{\threecolfootsetupX}[1]{%
+ \count\csname footins#1\endcsname 333
+ \csxdef{default@footins#1}{333}%Use this to confine the notes to one side only
+ \multiply\dimen\csname footins#1\endcsname by \thr@@}
+\newcommand*{\mpthreecolfootsetupX}[1]{%
+ \count\csname mpfootins#1\endcsname 333
+ \multiply\dimen\csname mpfootins#1\endcsname by \thr@@}
+
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolvfootnoteX}[2]{%
+ \insert\csname footins#1\endcsname\bgroup
+ \csuse{notefontsizeX@#1}
+ \footsplitskips
+ \@nameuse{footfmt#1}{#1}{#2}\egroup}
+
+\notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolfootfmtX}[2]{%
+ \protected@edef\@currentlabel{%
+ \@nameuse{@thefnmark#1}%
+ }%
+ \hangindent=\csuse{hangindentX@#1}%
+ \normal@pars
+ \hsize \csuse{hsizethreecolX@#1}
+ \nottoggle{parindentX@#1}{\parindent=\z@}{} %
+ \tolerance=5000\relax
+ \leavevmode
+ \csuse{colalignX@#1}%
+ {\csuse{notenumfontX@#1}\@nameuse{footfootmark#1}\strut%
+ #2\strut\par}\allowbreak}
+
+\newcommand*{\threecolfootgroupX}[1]{{\csuse{notefontsizeX@#1}
+ \splittopskip=\ht\strutbox
+ \expandafter
+ \rigidbalance\csname footins#1\endcsname \thr@@ \splittopskip}}
+\newcommand*{\mpthreecolfootgroupX}[1]{{%
+ \vskip\skip\@nameuse{mpfootins#1}
+ \ifl@dpairing\ifparledgroup
+ \leavevmode\marks\parledgroup@{begin}%
+ \marks\parledgroup@series{#1}%
+ \marks\parledgroup@type{footnoteX}%
+ \fi\fi\normalcolor
+ \ifparledgroup%
+ \ifl@dpairing%
+ \else%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \print@footnoteXrule{#1}%
+ \fi%
+ \else%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \print@footnoteXrule{#1}%
+ \fi%
+ \splittopskip=\ht\strutbox
+ \expandafter
+ \rigidbalance\csname mpfootins#1\endcsname \thr@@ \splittopskip}}
+
+\newcommand*{\arrangementX@paragraph}[1]{%
+ \csgdef{series@displayX#1}{paragraph}%
+ \expandafter\newcount\csname #1prevpage@num\endcsname
+ \expandafter\let\csname footstart#1\endcsname=\parafootstartX
+ \expandafter\let\csname regvfootnote#1\endcsname=\para@vfootnoteX
+ \expandafter\let\csname footfmt#1\endcsname=\parafootfmtX
+ \expandafter\let\csname footgroup#1\endcsname=\para@footgroupX
+ \expandafter\let\csname footnoterule#1\endcsname=\normalfootnoteruleX
+ \count\csname footins#1\endcsname=1000
+ \csxdef{default@footins#1}{1000}%Use this to confine the notes to one side only
+ \dimen\csname footins#1\endcsname=\csuse{maxhnotesX@#1}
+ \skip\csname footins#1\endcsname=\csuse{beforenotesX@#1}%
+ \advance\skip\csname footins#1\endcsname by\csuse{afterruleX@#1}%
+ \para@footsetupX{#1}
+ \ifnoledgroup@\else
+ \expandafter\let\csname mpvfootnote#1\endcsname=\mppara@vfootnoteX
+ \expandafter\let\csname mpfootgroup#1\endcsname=\mppara@footgroupX
+ \count\csname mpfootins#1\endcsname=1000
+ \dimen\csname mpfootins#1\endcsname=\csuse{maxhnotesX@#1}
+ \skip\csname mpfootins#1\endcsname=\csuse{beforenotesX@#1}%
+ \advance\skip\csname mpfootins#1\endcsname by\csuse{afterruleX@#1}%
+ \fi
+ }
+
+\newcommand*{\para@footsetupX}[1]{{\csuse{notefontsizeX@#1}
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \dimen0=\baselineskip
+ \multiply\dimen0 by 1024
+ \divide\dimen0 by \columnwidth \multiply\dimen0 by \footfudgefiddle\relax%
+ \expandafter
+ \xdef\csname footfudgefactor#1\endcsname{%
+ \expandafter\strip@pt\dimen0 }}}
+
+\newcommand*{\parafootstartX}[1]{%
+ \ifdimequal{0pt}{\prenotesX@}{}%
+ {%
+ \iftoggle{prenotesX@}{%
+ \togglefalse{prenotesX@}%
+ \skip\csname footins#1\endcsname=%
+ \dimexpr\csuse{prenotesX@}+\csuse{afterruleX@#1}\relax%
+ }%
+ {}%
+ }%
+ \vskip\skip\csname footins#1\endcsname%
+ \leftskip=\z@
+ \rightskip=\z@
+ \parindent=\z@
+ \vskip\skip\@nameuse{footins#1}%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \print@footnoteXrule{#1}%
+ }
+
+\newcommand*{\para@vfootnoteX}[2]{%
+ \insert\csname footins#1\endcsname
+ \bgroup
+ \csuse{bhooknoteX@#1}
+ \csuse{notefontsizeX@#1}
+ \footsplitskips
+ \setbox0=\vbox{\hsize=\maxdimen
+ \noindent\@nameuse{footfmt#1}{#1}{#2}}%
+ \setbox0=\hbox{\unvxhX{0}{#1}}%
+ \dp0=\z@
+ \ht0=\csname footfudgefactor#1\endcsname\wd0
+ \box0
+ \penalty0
+ \egroup}
+\newcommand*{\mppara@vfootnoteX}[2]{%
+ \global\setbox\@nameuse{mpfootins#1}\vbox{%
+ \unvbox\@nameuse{mpfootins#1}
+ \csuse{bhooknoteX@#1}
+ \csuse{notefontsizeX@#1}
+ \footsplitskips
+ \setbox0=\vbox{\hsize=\maxdimen
+ \noindent\color@begingroup\@nameuse{footfmt#1}{#1}{#2}\color@endgroup}%
+ \setbox0=\hbox{\unvxhX{0}{#1}}%
+ \dp0=\z@
+ \ht0=\csname footfudgefactor#1\endcsname\wd0
+ \box0
+ \penalty0}}
+
+\newcommand*{\unvxhX}[2]{% 2th is optional for retro-compatibility
+ \setbox0=\vbox{\unvbox#1%
+ \global\setbox1=\lastbox}%
+ \unhbox1
+ \unskip % remove \rightskip,
+ \unskip % remove \parfillskip,
+ \unpenalty % remove \penalty of 10000,
+ \hskip\csuse{afternoteX@#2}} % but add the glue to go between the notes
+
+\newcommand*{\parafootfmtX}[2]{%
+ \protected@edef\@currentlabel{%
+ \@nameuse{@thefnmark#1}%
+ }%
+ \insertparafootsepX{#1}%
+ \ledsetnormalparstuffX{#1}%
+ {\csuse{notenumfontX@#1}%
+ \csuse{notenumfontX@#1}%
+ \@nameuse{footfootmark#1}%
+ \strut%
+ #2\penalty-10}}
+
+\newcommand*{\para@footgroupX}[1]{%
+ \unvbox\csname footins#1\endcsname
+ \ifcsstring{raggedX@#1}{L}{\RaggedLeft}{}%
+ \ifcsstring{raggedX@#1}{R}{\RaggedRight}{}%
+ \makehboxofhboxes
+ \setbox0=\hbox{\unhbox0 \removehboxes}%
+ \csuse{notefontsizeX@#1}
+ \noindent\unhbox0\par}
+\newcommand*{\mppara@footgroupX}[1]{{%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \vskip\skip\@nameuse{mpfootins#1}
+ \ifl@dpairing\ifparledgroup
+ \leavevmode%
+ \leavevmode\marks\parledgroup@{begin}%
+ \marks\parledgroup@series{#1}%
+ \marks\parledgroup@type{footnoteX}%
+ \fi\fi\normalcolor
+ \ifparledgroup%
+ \ifl@dpairing%
+ \else%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \print@footnoteXrule{#1}%
+ \fi%
+ \else%
+ \setnoteswidthliketwocolumnsX@{#1}%
+ \setnotesXpositionliketwocolumns@{#1}%
+ \print@footnoteXrule{#1}%
+ \fi%
+ \unvbox\csname mpfootins#1\endcsname
+ \ifcsstring{raggedX@#1}{L}{\RaggedLeft}{}%
+ \ifcsstring{raggedX@#1}{R}{\RaggedRight}{}%
+ \makehboxofhboxes
+ \setbox0=\hbox{\unhbox0 \removehboxes}%
+ \csuse{notefontsizeX@#1}
+ \noindent\unhbox0\par}}
+
+\newcommand{\insertparafootsepX}[1]{%
+ \ifnumequal{\csuse{prevpage#1@num}}{\page@num}%
+ {\csuse{parafootsepX@#1}}%
+ {}%
+}
+\newcommand*{\ledsetnormalparstuff@common}{%
+ \ifluatex%
+ \luatextextdir\footnote@luatextextdir%
+ \luatexpardir\footnote@luatexpardir%
+ \fi%
+ \csuse{\csuse{footnote@dir}}%
+ \normal@pars%
+ \parfillskip \z@ \@plus 1fil}%
+
+\newcommand*{\Xledsetnormalparstuff}[1]{%
+ \ledsetnormalparstuff@common%
+ \nottoggle{Xparindent@#1}{\noindent}{}%\noindent and and not \parindent=0pt to avoid to break the (bad) change made when moving from ledmac to eledmac
+}%
+
+\newcommand*{\ledsetnormalparstuffX}[1]{%
+ \ledsetnormalparstuff@common%
+ \nottoggle{parindentX@#1}{\noindent}{}%\noindent and and not \parindent=0pt to avoid to break the (bad) change made when moving from ledmac to eledmac
+}%
+
+\newdimen\old@hsize%
+\AtBeginDocument{\old@hsize=\hsize}%
+
+\newcommand{\setXnoteswidthliketwocolumns@}[1]{%
+ \global\let\hsize@fornote=\hsize%
+ \global\old@hsize=\hsize%
+ \iftoggle{Xnoteswidthliketwocolumns@#1}%
+ {%
+ \csuse{setwidthliketwocolumns@\columns@position}%
+ \global\let\hsize@fornote=\hsize%
+ }%
+ {}%
+ \let\hsize=\hsize@fornote%
+ \let\columnwidth=\hsize@fornote%
+}%
+
+\newcommand{\setnoteswidthliketwocolumnsX@}[1]{%
+ \global\let\hsize@fornote=\hsize%
+ \global\old@hsize=\hsize%
+ \iftoggle{noteswidthliketwocolumnsX@#1}%
+ {%
+ \csuse{setwidthliketwocolumns@\columns@position}%
+ \global\let\hsize@fornote=\hsize%
+ }%
+ {}%
+ \let\hsize=\hsize@fornote%
+ \let\columnwidth=\hsize@fornote%
+}%
+
+\newcommand{\setXnotespositionliketwocolumns@}[1]{%
+ \iftoggle{Xnoteswidthliketwocolumns@#1}{%
+ \csuse{setnotespositionliketwocolumns@\columns@position}%
+ }{}%
+}%
+
+\newcommand{\setnotesXpositionliketwocolumns@}[1]{%
+ \iftoggle{noteswidthliketwocolumnsX@#1}{%
+ \csuse{setnotespositionliketwocolumns@\columns@position}%
+ }{}%
+}%
+
+\def\@fnpos{familiar-critical}
+\def\@mpfnpos{critical-familiar}
+\newcommand{\fnpos}[1]{\xdef\@fnpos{#1}}
+\newcommand{\mpfnpos}[1]{\xdef\@mpfnpos{#1}}
+\newcommand{\print@Xfootnoterule}[1]{%
+ \vskip-\csuse{Xafterrule@#1}%Because count in \dimen\csuse{#1footins}
+ \nointerlineskip%
+ \moveleft-\leftskip\vbox{\csuse{#1footnoterule}}%
+ \nointerlineskip%
+ \vskip\csuse{Xafterrule@#1}%
+}%
+
+\newcommand{\print@footnoteXrule}[1]{%
+ \vskip-\csuse{afterruleX@#1}%Because count in \dimen\csuse{footins#1}
+ \nointerlineskip%
+ \moveleft-\leftskip\vbox{\csuse{footnoterule#1}}%
+ \nointerlineskip%
+ \vskip\csuse{afterruleX@#1}%
+}%
+
+\newtoggle{preXnotes@}
+\toggletrue{preXnotes@}
+\newcommand{\preXnotes@}{0pt}
+\newcommand*{\preXnotes}[1]{\renewcommand{\preXnotes@}{#1}}
+\newtoggle{prenotesX@}
+\toggletrue{prenotesX@}
+\newcommand{\prenotesX@}{0pt}
+\newcommand*{\prenotesX}[1]{\renewcommand{\prenotesX@}{#1}}
+\gdef\firstXseries@{}
+\newcommand{\prepare@preXnotes}[1]{%
+ \ifdimequal{0pt}{\preXnotes@}%
+ {}%
+ {%
+ \IfStrEq{\firstXseries@}{}{%
+ \global\skip\csuse{#1footins}=\preXnotes@%
+ \global\advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
+ \gdef\firstXseries@{#1}%
+ }%
+ {%
+ \ifseriesbefore{#1}{\firstXseries@}%
+ {%
+ \global\skip\csuse{#1footins}=\csuse{Xbeforenotes@\firstXseries@}%
+ \global\advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
+ \gdef\firstXseries@{#1}%
+ }%
+ {}%
+ }%
+ }%
+}
+\gdef\firstseriesX@{}
+\newcommand{\prepare@prenotesX}[1]{%
+ \ifdimequal{0pt}{\prenotesX@}%
+ {}%
+ {%
+ \IfStrEq{\firstseriesX@}{}{%
+ \global\skip\csuse{footins#1}=\prenotesX@%
+ \global\advance\skip\csname footins#1\endcsname by\csuse{afterruleX@#1}%
+ \gdef\firstseriesX@{#1}%
+ }%
+ {%
+ \ifseriesbefore{#1}{\firstseriesX@}%
+ {%
+ \global\skip\csuse{footins#1}=\csuse{beforenotesX@\firstseriesX@}%
+ \global\advance\skip\csname footins#1\endcsname by\csuse{afterruleX@#1}%
+ \gdef\firstXseries@{#1}%
+ }%
+ {}%
+ }%
+ }%
+}
+\ifbool{noend@}{}{%Used instead of \ifnoend@ to prevent expansion problem
+\newcommand{\l@dend@open}[1]{%
+ \global\booltrue{l@dend@#1}%
+ \expandafter\immediate%
+ \expandafter\openout%
+ \csname l@d@#1end\endcsname%
+ =\jobname.#1end\relax%
+}%
+\newcommand{\l@dend@close}[1]{%
+ \global\boolfalse{l@dend@#1}%
+ \expandafter\immediate%
+ \expandafter\closeout\csname l@d@#1end\endcsname%
+}%
+
+\newcommand{\l@dend@stuff}{%
+ \def\do##1{%
+ \ifbool{l@dend@##1}{}%
+ {\l@dend@open{##1}}%
+ \expandafter\immediate\expandafter\write\csname l@d@##1end\endcsname{\string\l@d@section{\the\section@num}}%
+ }%
+ \dolistloop{\@series}%
+}%
+
+\global\notbool{parapparatus@}{}{\long}\def\endprint#1#2#3#4#5{{%
+ \ifXendinsertsep@%
+ \hskip\csuse{Xendafternote@#4}%
+ \csuse{Xendsep@#4}%
+ \else%
+ \iftoggle{Xendparagraph@#4}%
+ {\global\Xendinsertsep@true}%
+ {}%
+ \fi%
+ \xdef\@currentseries{#4}%
+ \def\do##1{%
+ \toggletrue{##1@}%
+ }%
+ \notblank{#5}{\docsvlist{#5}}{}%
+ \csuse{Xendbhooknote@#4}%
+ \csuse{Xendnotefontsize@#4}%
+ \ifboolexpr{%
+ togl {nonum@}%
+ or togl {Xendnonumber@#4}%
+ }%
+ {\hspace{\csuse{Xendinplaceofnumber@#4}}}%
+ {\printlineendnotearea{#1}{#4}}%
+ \nottoggle{Xendlemmadisablefontselection@#4}%
+ {\select@lemmafont#1|#2}%
+ {#2}%
+ \ifboolexpr{%
+ togl {nosep@}%
+ or test{\ifcsempty{Xendlemmaseparator@#4}}%
+ }%
+ {\hskip\csuse{Xendinplaceoflemmaseparator@#4}}%
+ {\nobreak%
+ \hskip\csuse{Xendbeforelemmaseparator@#4}%
+ \csuse{Xendlemmaseparator@#4}%
+ \hskip\csuse{Xendafterlemmaseparator@#4}%
+ }%
+ #3%
+ \nottoggle{Xendparagraph@#4}{\par}{}%
+ \def\do##1{%
+ \togglefalse{##1@}%
+ }%
+ \notblank{#5}{\docsvlist{#5}}{}%
+}}%
+
+\let\l@d@section=\@gobble
+
+\newcommand{\printlineendnotearea}[2]{%
+ \bgroup%
+ \csuse{Xendnotenumfont@#2}%
+ \ifdimequal{\csuse{Xendboxlinenum@#2}}{0pt}%
+ {\printendlines#1|}%
+ {\leavevmode%
+ \hbox to \csuse{Xendboxlinenum@#2}%
+ {%
+ \IfSubStr{RC}{\csuse{Xendboxlinenumalign@#2}}{\hfill}{}%
+ \printendlines#1|%
+ \IfSubStr{LC}{\csuse{Xendboxlinenumalign@#2}}{\hfill}{}%
+ }}%
+ \egroup%
+ \enspace%
+}%
+\newcommand*{\setprintendlines}[6]{%
+ \l@d@pnumfalse \l@d@dashfalse
+ \ifnum#4=#1 \else
+ \l@d@pnumtrue
+ \l@d@dashtrue
+ \fi
+ \ifl@d@pnum \l@d@elintrue \else \l@d@elinfalse \fi
+ \ifnum#2=#5 \else
+ \l@d@elintrue
+ \l@d@dashtrue
+ \fi
+ \l@d@ssubfalse
+ \ifnum#3=0 \else
+ \l@d@ssubtrue
+ \fi
+ \l@d@eslfalse
+ \ifnum#6=0 \else
+ \ifnum#6=#3
+ \ifl@d@elin \l@d@esltrue \else \l@d@eslfalse \fi
+ \else
+ \l@d@esltrue
+ \l@d@dashtrue
+ \fi
+ \fi%
+ \ifl@d@dash%
+ \ifboolexpr{togl{fulllines@} or test{\ifcsempty{Xendtwolines@\@currentseries}}}%
+ {}%
+ {%
+ \setistwofollowinglines{#1}{#2}{#4}{#5}%
+ \ifboolexpr{%
+ (%
+ togl {Xendtwolinesbutnotmore@\@currentseries}%
+ and not%
+ (%
+ bool {istwofollowinglines@}%
+ )%
+ )%
+ or%
+ (%
+ (not test{\ifnumequal{#1}{#4}})%
+ and togl{Xendtwolinesonlyinsamepage@\@currentseries}%
+ )%
+ }%
+ {}%
+ {%
+ \l@d@dashfalse%
+ \l@d@Xtwolinestrue%
+ \l@d@elinfalse%
+ \l@d@eslfalse%
+ \ifcsempty{Xendmorethantwolines@\@currentseries}%
+ {}%
+ {\ifistwofollowinglines@\else%
+ \l@d@Xmorethantwolinestrue%
+ \fi%
+ }%
+ }%
+ }%
+ \fi%
+}%
+\def\printendlines#1|#2|#3|#4|#5|#6|#7|{\begingroup
+ \setprintendlines{#1}{#2}{#3}{#4}{#5}{#6}%
+ \ifdimequal{\csuse{Xendboxstartlinenum@\@currentseries}}{0pt}%
+ {\bgroup}%
+ {\leavevmode\hbox to \csuse{Xendboxstartlinenum@\@currentseries}\bgroup\hfill}%
+ \printnpnum{#1}%
+ \linenumrep{#2}%
+ \ifl@d@ssub \fullstop \sublinenumrep{#3}\fi
+ \egroup%
+ \ifdimequal{\csuse{Xendboxendlinenum@\@currentseries}}{0pt}%
+ {\bgroup}%
+ {\hbox to \csuse{Xendboxendlinenum@\@currentseries}\bgroup}%
+ \ifl@d@Xtwolines%
+ \ifl@d@Xmorethantwolines%
+ \csuse{Xendmorethantwolines@\@currentseries}%
+ \else%
+ \csuse{Xendtwolines@\@currentseries}%
+ \fi%
+ \else%
+ \ifl@d@dash \endashchar\fi%
+ \ifl@d@pnum \printnpnum{#4}\fi%
+ \ifl@d@elin \linenumrep{#5}\fi%
+ \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumrep{#6}\fi%
+ \fi%
+ \ifdimequal{\csuse{Xendboxendlinenum@\@currentseries}}{0pt}%
+ {}%
+ {\hfill}%Prevent underfull hbox
+ \egroup%
+ \endgroup%
+}%
+
+\newcommand*{\printnpnum}[1]{p.#1) }
+
+\newif\ifXendinsertsep@%
+\newcommand*{\doendnotes}[1]{%
+ \l@dend@close{#1}%
+ \begingroup
+ \makeatletter
+ \expandafter\let\csname #1end\endcsname=\endprint
+ \input\jobname.#1end%
+ \global\Xendinsertsep@false%
+ \endgroup}
+\newcommand*{\doendnotesbysection}[1]{%
+ \l@dend@close{#1}%
+ \global\expandafter\advance\csname #1end@bysection\endcsname by 1%
+ \begingroup%
+ \makeatletter%
+ \def\l@d@section##1{%
+ \ifnumequal{##1}{\csname #1end@bysection\endcsname}%
+ {\cslet{#1end}{\endprint}}%
+ {\cslet{#1end}{\@gobblefive}}%
+ }%
+ \input\jobname.#1end%
+ \global\Xendinsertsep@false%
+ \endgroup%
+}%
+}%
+\newcommand{\newseries}[1]{%
+ \def\do##1{\newseries@{##1}}%
+ \docsvlist{#1}
+}
+\newcommand{\@series}{}
+\newcommand{\newseries@}[1]{
+ \xifinlist{#1}{\@series}{\led@warn@SeriesStillExist{#1}}%
+ {%
+ \ifdefined\newseries@par%
+ \newseries@par{#1}%
+ \fi%
+ \unless\ifnocritical@
+ \newtoggle{Xparindent@#1}
+ \newtoggle{Xlemmadisablefontselection@#1}
+ \csgdef{Xhangindent@#1}{0pt}%
+ \csgdef{Xragged@#1}{}%
+ \csgdef{Xhsizetwocol@#1}{0.45 \hsize}%
+ \csgdef{Xhsizethreecol@#1}{.3 \hsize}%
+ \csgdef{Xcolalign@#1}{\raggedright}%
+ \csgdef{Xnotenumfont@#1}{\normalfont}%
+ \csgdef{Xnotefontsize@#1}{\footnotesize}%
+ \csgdef{Xbhooknote@#1}{}%
+
+ \csgdef{Xboxlinenum@#1}{0pt}%
+ \csgdef{Xboxlinenumalign@#1}{L}%
+
+ \csgdef{Xboxstartlinenum@#1}{0pt}%
+ \csgdef{Xboxendlinenum@#1}{0pt}%
+
+ \csgdef{Xboxsymlinenum@#1}{0pt}%
+ \newtoggle{Xnumberonlyfirstinline@#1}%
+ \newtoggle{Xnumberonlyfirstintwolines@#1}%
+ \csgdef{Xtwolines@#1}{}%
+ \csgdef{Xmorethantwolines@#1}{}%
+ \newtoggle{Xtwolinesbutnotmore@#1}%
+ \newtoggle{Xtwolinesonlyinsamepage@#1}%
+ \newtoggle{Xonlypstart@#1}%
+ \newtoggle{Xpstarteverytime@#1}%
+ \newtoggle{Xpstart@#1}%
+ \csgdef{Xsymlinenum@#1}{}%
+ \newtoggle{Xnonumber@#1}%
+ \csgdef{Xbeforenumber@#1}{0pt}%
+ \csgdef{Xafternumber@#1}{0.5em}%
+ \newtoggle{Xnonbreakableafternumber@#1}%
+ \csgdef{Xbeforesymlinenum@#1}{\csuse{Xbeforenumber@#1}}%
+ \csgdef{Xaftersymlinenum@#1}{\csuse{Xafternumber@#1}}%
+ \csgdef{Xinplaceofnumber@#1}{1em}%
+ \global\cslet{Xlemmaseparator@#1}{\rbracket}%
+ \csgdef{Xbeforelemmaseparator@#1}{0em}%
+ \csgdef{Xafterlemmaseparator@#1}{0.5em}%
+ \csgdef{Xinplaceoflemmaseparator@#1}{1em}%
+ \csgdef{Xbeforenotes@#1}{1.2em \@plus .6em \@minus .6em}
+ \csgdef{Xafterrule@#1}{0pt}
+ \csgdef{Xtxtbeforenotes@#1}{}
+ \csgdef{Xmaxhnotes@#1}{0.8\vsize}
+ \newtoggle{Xnoteswidthliketwocolumns@#1}%
+ \csgdef{Xparafootsep@#1}{}%
+ \csgdef{Xafternote@#1}{1em plus.4em minus.4em}
+ \expandafter\newinsert\csname #1footins\endcsname%
+ \unless\ifnoledgroup@%
+ \expandafter\newinsert\csname mp#1footins\endcsname%
+ \fi%
+ \global\notbool{parapparatus@}{\expandafter\newcommand\expandafter *}{\expandafter\newcommand}\csname #1footnote\endcsname[2][]{%
+ \ifnum\@edtext@level>0%
+ \begingroup%
+ \newcommand{\content}{##2}%
+ \ifnumberedpar@%
+ \ifledRcol%
+ \ifluatex%
+ \footnotelang@lua[R]%
+ \fi%
+ \@ifundefined{xpg@main@language}%if polyglossia
+ {}%
+ {\footnotelang@poly[R]}%
+ \footnoteoptions@[R]{##1}{true}%
+ \xright@appenditem{%
+ \noexpand\prepare@preXnotes{#1}%
+ \noexpand\prepare@edindex@fornote{\l@d@nums}%
+ \unexpanded{\def\sw@list@inedtext}{\expandafter\unexpanded\expandafter{\sw@inthisedtext}}%The value of the \sw@inthisedtext of current \edtext will be pushed to \sw@list@inedtext when the notes are expanded.
+ \noexpand\csuse{v#1footnote}{#1}%
+ {{\l@d@nums}{\expandonce\@tag}{\expandonce\content}}%
+ }\to\inserts@listR
+ \footnoteoptions@[R]{##1}{false}%
+ \global\advance\insert@countR \@ne%
+ \else%
+ \ifluatex%
+ \footnotelang@lua%
+ \fi%
+ \@ifundefined{xpg@main@language}%if polyglossia
+ {}%
+ {\footnotelang@poly}%
+ \footnoteoptions@{##1}{true}%
+ \xright@appenditem{%
+ \noexpand\prepare@preXnotes{#1}%
+ \noexpand\prepare@edindex@fornote{\l@d@nums}%
+ \unexpanded{\def\sw@list@inedtext}{\expandafter\unexpanded\expandafter{\sw@inthisedtext}}%The value of the \sw@inthisedtext of current edtext will be pushed to \sw@list@inedtext when the notes are expanded.
+ \noexpand\csuse{v#1footnote}{#1}%
+ {{\l@d@nums}{\expandonce\@tag}{\expandonce\content}}%
+ }\to\inserts@list
+ \global\advance\insert@count \@ne%
+ \footnoteoptions@{##1}{false}%
+ \fi
+ \else
+ \csuse{v#1footnote}{#1}{{0|0|0|0|0|0|0}{}{##1}}%
+ \fi%
+ \endgroup%
+ \else%
+ \led@err@FootnoteWithoutEdtext%
+ \fi%
+ \ignorespaces%
+ }
+ \global\csletcs{#1@@footnote}{#1footnote}
+ \Xarrangement@normal{#1}%
+ \fi
+ \unless\ifnofamiliar@
+ \newtoggle{parindentX@#1}
+ \csgdef{hangindentX@#1}{0pt}%
+ \csgdef{raggedX@#1}{}%
+ \csgdef{hsizetwocolX@#1}{0.45 \hsize}%
+ \csgdef{hsizethreecolX@#1}{.3 \hsize}%
+ \csgdef{colalignX@#1}{\raggedright}%
+ \csgdef{notenumfontX@#1}{\normalfont}%
+ \csgdef{notefontsizeX@#1}{\footnotesize}%
+ \csgdef{bhooknoteX@#1}{}%
+ \csgdef{afterruleX@#1}{0pt}
+ \csgdef{beforenotesX@#1}{1.2em \@plus .6em \@minus .6em}
+ \csgdef{maxhnotesX@#1}{0.8\vsize}%
+ \newtoggle{noteswidthliketwocolumnsX@#1}%
+ \csgdef{parafootsepX@#1}{}%
+ \csgdef{afternoteX@#1}{1em plus.4em minus.4em}
+ \expandafter\newinsert\csname footins#1\endcsname%
+ \unless\ifnoledgroup@%
+ \expandafter\newinsert\csname mpfootins#1\endcsname%
+ \fi%
+
+ \global\expandafter\newcommand\csname footnote#1\endcsname[1]{%
+ \begingroup%
+ \prepare@prenotesX{#1}%
+ \newcommand{\content}{##1}%
+ \stepcounter{footnote#1}%
+ \protected@csxdef{@thefnmark#1}{\csuse{thefootnote#1}}%
+ \nottoggle{nomk@}%Nomk is set to true when using \footnoteXnomk with \parpackage
+ {\csuse{@footnotemark#1}}%
+ {}%
+ \ifluatex%
+ \xdef\footnote@luatextextdir{\the\luatextextdir}%
+ \xdef\footnote@luatexpardir{\the\luatexpardir}%
+ \fi%
+ \csuse{vfootnote#1}{#1}{\expandonce\content}\m@mmf@prepare%
+ \endgroup%
+ }
+ \newcounter{footnote#1}
+ \global\expandafter\renewcommand\csname thefootnote#1\endcsname{\arabic{footnote#1}}
+\arrangementX@normal{#1}%
+ \fi
+ \unless\ifnoend@
+ \expandafter\newwrite\csname l@d@#1end\endcsname%
+ \expandafter\newif\csname ifl@dend@#1\endcsname%
+
+ \global\expandafter\newcommandx\csname #1endnote\endcsname[2][1,usedefault]{%
+ \bgroup%
+ \newlinechar='40%
+ \global\@noneed@Footnotetrue%
+ \newcommand{\content}{##2}%
+ \expandafter\immediate\expandafter\write\csname l@d@#1end\endcsname{%
+ \expandafter\string\csname #1end\endcsname%
+ {\ifnumberedpar@\l@d@nums\fi}%
+ {\ifnumberedpar@\expandonce\@tag\fi}%
+ {\expandonce\content}%
+ {#1}%
+ {##1}%
+ \@percentchar%
+ }%
+ \egroup%
+ \ignorespaces%
+ }%
+
+ \global\cslet{#1end}{\@gobblefive}
+ \global\expandafter\newcount\csname #1end@bysection\endcsname%
+ \csgdef{Xendtwolines@#1}{}%
+ \csgdef{Xendmorethantwolines@#1}{}%
+ \newtoggle{Xendtwolinesbutnotmore@#1}{}%
+ \newtoggle{Xendtwolinesonlyinsamepage@#1}{}%
+ \newtoggle{Xendlemmadisablefontselection@#1}%
+ \csgdef{Xendnotenumfont@#1}{\normalfont}%
+ \csgdef{Xendnotefontsize@#1}{\footnotesize}%
+ \csgdef{Xendbhooknote@#1}{}%
+
+ \csgdef{Xendboxlinenum@#1}{0pt}%
+ \csgdef{Xendboxlinenumalign@#1}{L}%
+
+ \csgdef{Xendboxstartlinenum@#1}{0pt}%
+ \csgdef{Xendboxendlinenum@#1}{0pt}%
+
+ \csgdef{Xendlemmaseparator@#1}{}%
+ \csgdef{Xendbeforelemmaseparator@#1}{0em}%
+ \csgdef{Xendafterlemmaseparator@#1}{0.5em}%
+ \csgdef{Xendinplaceoflemmaseparator@#1}{0.5em}%
+
+ \newtoggle{Xendparagraph@#1}%
+ \csgdef{Xendafternote@#1}{1em plus.4em minus.4em}%
+ \csgdef{Xendsep@#1}{}%
+
+ \csgdef{Xendinplaceofnumber@#1}{0pt}%
+ \newtoggle{Xendnonumber@#1}%
+ \fi%
+ \listxadd{\@series}{#1}
+ }
+}% End of \newseries
+\expandafter\newseries\expandafter{\default@series}
+\newcommand{\seriesatbegin}[1]{%
+ \StrDel{\@series}{#1}[\@series]%
+ \edef\@new{}%
+ \listeadd{\@new}{#1}%
+ \listeadd{\@new}{\@series}%
+ \xdef\@series{\@new}%
+}
+\newcommand{\seriesatend}[1]{%
+ \StrDel{\@series}{#1}[\@series]%
+ \edef\@new{}%
+ \listeadd{\@new}{\@series}%
+ \listeadd{\@new}{#1}%
+ \xdef\@series{\@new}%
+}
+\newcommand{\ifseriesbefore}[4]{%
+ \StrPosition{\@series}{#1}[\@first]%
+ \StrPosition{\@series}{#2}[\@second]%
+ \ifnumgreater{\@second}{\@first}{#3}{#4}%
+}
+\newcommand{\@getfirstseries}{%
+ \ifdefempty{\@series}%
+ {\xdef\@firstseries{}}%
+ {\StrChar{\@series}{1}[\@firstseries]}%
+}%
+\newcommandx{\settoggle@series}[5][4,5,usedefault]{%
+ \def\do##1{%
+ \global\settoggle{#2@##1}{#3}%
+ \ifstrequal{#4}{reload}%
+ {%
+ \csuse{Xarrangement@\csuse{series@display##1}}{##1}%
+ \csuse{arrangementX@\csuse{series@displayX##1}}{##1}%
+ }%
+ {}%
+ }%
+ \ifstrempty{#1}{%
+ \dolistloop{\@series}%
+ \ifstrempty{#5}{}{%
+ \docsvlist{#5}%
+ }
+ }%
+ {%
+ \docsvlist{#1}%
+ }%
+}
+\newcommandx{\setcommand@series}[5][4,5,usedefault]{%
+ \def\do##1{
+ \csgdef{#2@##1}{#3}
+ \ifstrequal{#4}{reload}{
+ \csuse{Xarrangement@\csuse{series@display##1}}{##1}%
+ \csuse{arrangementX@\csuse{series@displayX##1}}{##1}%
+ }{}}
+ \ifstrempty{#1}{%
+ \dolistloop{\@series}%
+ \ifstrempty{#5}{}{%
+ \docsvlist{#5}
+ }
+ }%
+ {%
+ \docsvlist{#1}%
+ }%
+}%
+\newcommandx{\newhookcommand@series}[2][2,usedefault]{%
+ \global\expandafter\newcommand\expandafter*\csname #1\endcsname[2][]{%
+ \setcommand@series{##1}{#1}{##2}[][#2]%
+ }%
+ \ifstrempty{#2}{}{%
+ \def\do##1{%
+ \global\expandafter\newcommand\expandafter*\csname #1##1\endcsname[1]{%
+ \csuse{#1}[##1]{####1}%
+ }%
+ }%
+ \docsvlist{#2}%
+ }%
+}
+\newcommandx{\newhooktoggle@series}[2][2,usedefault]{%
+ \global\expandafter\newcommandx\expandafter*\csname #1\endcsname[2][1,2={true},usedefault]{%
+ \settoggle@series{##1}{#1}{##2}[][#2]%
+ }%
+ \ifstrempty{#2}{}{%
+ \def\do##1{%
+ \global\expandafter\newcommand\expandafter*\csname #1##1\endcsname{%
+ \csuse{#1}[##1]%
+ }%
+ }%
+ \docsvlist{#2}%
+ }%
+}
+\newcommand{\newhooktoggle@series@reload}[1]{%
+ \global\expandafter\newcommandx\expandafter*\csname #1\endcsname[2][1,2={true},usedefault]{%
+ \settoggle@series{##1}{#1}{##2}[reload]%
+ }%
+}%
+\newcommand{\newhookcommand@series@reload}[1]{%
+ \global\expandafter\newcommand\expandafter*\csname #1\endcsname[2][]{%
+ \setcommand@series{##1}{#1}{##2}[reload]%
+ }%
+}
+\unless\ifnocritical@
+ \newhooktoggle@series{Xparindent}
+ \newhookcommand@series{Xtwolines}[appref]
+ \newhookcommand@series{Xmorethantwolines}[appref]
+ \newhooktoggle@series{Xtwolinesbutnotmore}[appref]
+ \newhooktoggle@series{Xtwolinesonlyinsamepage}[appref]
+ \newhookcommand@series{Xhangindent}
+ \newhookcommand@series{Xragged}
+ \newhookcommand@series{Xhsizetwocol}
+ \newhookcommand@series{Xhsizethreecol}
+ \newhookcommand@series{Xcolalign}%
+ \newhookcommand@series{Xnotenumfont}
+ \newhookcommand@series{Xbhooknote}
+ \newhookcommand@series{Xboxsymlinenum}%
+ \newhookcommand@series{Xsymlinenum}
+ \newhookcommand@series{Xbeforenumber}
+ \newhookcommand@series{Xafternumber}
+ \newhookcommand@series{Xbeforesymlinenum}
+ \newhookcommand@series{Xaftersymlinenum}
+ \newhookcommand@series{Xinplaceofnumber}
+ \newhookcommand@series{Xlemmaseparator}
+ \newhookcommand@series{Xbeforelemmaseparator}
+ \newhookcommand@series{Xafterlemmaseparator}
+ \newhookcommand@series{Xinplaceoflemmaseparator}
+ \newhookcommand@series{Xtxtbeforenotes}
+ \newhookcommand@series@reload{Xafterrule}
+ \newhooktoggle@series{Xnumberonlyfirstinline}
+ \newhooktoggle@series{Xnumberonlyfirstintwolines}
+ \newhooktoggle@series{Xnonumber}
+ \newhooktoggle@series{Xpstart}
+ \newhooktoggle@series{Xpstarteverytime}%
+ \newhooktoggle@series{Xonlypstart}
+ \newhooktoggle@series{Xnonbreakableafternumber}
+ \newhooktoggle@series{Xlemmadisablefontselection}
+ \newhookcommand@series@reload{Xmaxhnotes}
+ \newhookcommand@series@reload{Xbeforenotes}
+ \newhooktoggle@series@reload{Xnoteswidthliketwocolumns}%
+ \newhookcommand@series{Xnotefontsize}
+
+ \newhookcommand@series{Xboxlinenum}%
+ \newhookcommand@series{Xboxlinenumalign}%
+
+ \newhookcommand@series{Xboxstartlinenum}%
+ \newhookcommand@series{Xboxendlinenum}%
+
+ \newhookcommand@series{Xafternote}%
+ \newhookcommand@series{Xparafootsep}
+
+\fi
+\unless\ifnofamiliar@
+ \newhooktoggle@series{parindentX}
+ \newhookcommand@series{hangindentX}
+ \newhookcommand@series{raggedX}
+ \newhookcommand@series{hsizetwocolX}
+ \newhookcommand@series{hsizethreecolX}
+ \newhookcommand@series{colalignX}%
+ \newhookcommand@series{notenumfontX}
+ \newhookcommand@series{bhooknoteX}
+ \newhookcommand@series@reload{beforenotesX}
+ \newhookcommand@series@reload{maxhnotesX}
+ \newhooktoggle@series@reload{noteswidthliketwocolumnsX}%
+ \newhookcommand@series@reload{afterruleX}
+ \newhookcommand@series{notefontsizeX}
+ \newhookcommand@series{afternoteX}
+ \newhookcommand@series{parafootsepX}
+\fi
+\unless\ifnoend@
+ \newhookcommand@series{Xendtwolines}[apprefwithpage]
+ \newhookcommand@series{Xendmorethantwolines}[apprefwithpage]
+ \newhooktoggle@series{Xendtwolinesbutnotmore}[apprefwithpage]
+ \newhooktoggle@series{Xendtwolinesonlyinsamepage}[apprefwithpage]
+ \newhookcommand@series{Xendnotenumfont}
+ \newhookcommand@series{Xendbhooknote}
+
+ \newhookcommand@series{Xendboxlinenum}%
+ \newhookcommand@series{Xendboxlinenumalign}%
+
+ \newhookcommand@series{Xendboxstartlinenum}%
+ \newhookcommand@series{Xendboxendlinenum}%
+
+ \newhookcommand@series{Xendnotefontsize}
+ \newhooktoggle@series{Xendlemmadisablefontselection}
+ \newhookcommand@series{Xendlemmaseparator}
+ \newhookcommand@series{Xendbeforelemmaseparator}
+ \newhookcommand@series{Xendafterlemmaseparator}
+ \newhookcommand@series{Xendinplaceoflemmaseparator}
+
+ \newhooktoggle@series{Xendparagraph}
+ \newhookcommand@series{Xendafternote}
+ \newhookcommand@series{Xendsep}
+
+ \newhookcommand@series{Xendinplaceofnumber}%
+ \newhooktoggle@series{Xendnonumber}%
+\fi
+\newtoggle{fulllines@}%
+\newtoggle{nonum@}
+\newtoggle{nosep@}
+\newtoggle{nomk@}%
+\newcommandx*{\Xnolemmaseparator}[1][1]{\Xlemmaseparator[#1]{}}
+\countdef\pageno=0 \pageno=1
+\newcommand*{\advancepageno}{\ifnum\pageno<\z@ \global\advance\pageno\m@ne
+ \else\global\advance\pageno\@ne\fi}
+
+
+\newcommand*{\l@ddoxtrafeet}{%
+ \IfStrEq{familiar-critical}{\@fnpos}
+ {\do@feetX\Xdo@feet}%
+ {%
+ \IfStrEq{critical-familiar}{\@fnpos}%
+ {\Xdo@feet\do@feetX}%
+ {\do@feetX\Xdo@feet}%
+ }%
+}%
+
+\newcommand*{\Xdo@feet}{%
+ \setbox\@outputbox \vbox{%
+ \unvbox\@outputbox
+ \@opXfeet}}
+\newcommand\print@Xnotes[1]{%
+ \csuse{#1footstart}{#1}%
+ \csuse{#1footgroup}{#1}%%
+}%
+\newcommand*{\@opXfeet}{%
+ \unless\ifnocritical@%
+ \gdef\firstXseries@{}%
+ \def\do##1{%
+ \ifvoid\csuse{##1footins}\else%
+ \global\skip\csuse{##1footins}=\csuse{Xbeforenotes@##1}%
+ \global\advance\skip\csuse{##1footins} by\csuse{Xafterrule@##1}%
+ \print@Xnotes{##1}%
+ \fi%
+ }%
+ \dolistloop{\@series}%
+ \fi%
+}%
+\newcommand*{\l@ddodoreinxtrafeet}{%
+ \IfStrEq{familiar-critical}{\@fnpos}
+ {\@doreinfeetX\X@doreinfeet}%
+ {%
+ \IfStrEq{critical-familiar}{\@fnpos}%
+ {\X@doreinfeet\@doreinfeetX}%
+ {\@doreinfeetX\X@doreinfeet}%
+ }%
+}
+
+\newcommand*{\X@doreinfeet}{%
+ \unless\ifnocritical@%
+ \def\do##1{%
+ \ifvoid\csuse{##1footins}\else%
+ \insert\csuse{##1footins}{\unvbox\csuse{##1footins}}%
+ \fi}%
+ \dolistloop{\@series}
+ \fi%
+}
+
+\newcommand\print@notesX[1]{%
+ \csuse{footstart#1}{#1}%
+ \csuse{footgroup#1}{#1}%
+}%
+\newcommand*{\do@feetX}{%
+ \unless\ifnofamiliar@%
+ \gdef\firstseriesX@{}%
+ \setbox\@outputbox \vbox{%
+ \unvbox\@outputbox%
+ \def\do##1{%
+ \ifvoid\csuse{footins##1}\else%
+ \global\skip\csuse{footins##1}=\csuse{beforenotesX@##1}%
+ \global\advance\skip\csuse{footins##1} by\csuse{afterruleX@##1}%
+ \print@notesX{##1}%
+ \fi%
+ }%
+ \dolistloop{\@series}}%
+ \fi%
+}%
+
+\newcommand{\@doreinfeetX}{%
+ \unless\ifnofamiliar@%
+ \def\do##1{%
+ \ifvoid\csuse{footins##1}\else
+ \insert%
+ \csuse{footins##1}
+ {\unvbox\csuse{footins##1}}%
+ \fi%
+ }%
+ \dolistloop{\@series}%
+ \fi%
+}%
+
+\@ifclassloaded{memoir}{%
+ \g@addto@macro{\m@mdoextrafeet}{\l@ddoxtrafeet}%
+ \g@addto@macro{\m@mdodoreinextrafeet}{\l@ddodoreinxtrafeet}%
+ }{%
+ \@ifpackageloaded{fancyhdr}{%
+ \patchcmd%
+ {\latex@makecol}%
+ {\xdef\@freelist{\@freelist\@midlist}}%
+ {\xdef\@freelist{\@freelist\@midlist}\l@ddoxtrafeet}%
+ {}%
+ {\led@error@fail@patch@@makecol}%
+ }{%
+ \patchcmd%
+ {\@makecol}%
+ {\xdef\@freelist{\@freelist\@midlist}}%
+ {\xdef\@freelist{\@freelist\@midlist}\l@ddoxtrafeet}%
+ {}%
+ {\led@error@fail@patch@@makecol}%
+ }%
+
+ \patchcmd%
+ {\@reinserts}%
+ {\ifvbox}%
+ {\l@ddodoreinxtrafeet\ifvbox}%
+ {}%
+ {\led@error@fail@patch@@reinserts}%
+}
+
+
+\newif\if@led@nofoot
+
+\@ifclassloaded{memoir}{%
+\g@addto@macro{\@mem@extranofeet}{%%
+ \def\do#1{%
+ \unless\ifnocritical@%
+ \ifvoid\csuse{#1footins}\else\@mem@nofootfalse\fi%
+ \fi%
+ \unless\ifnofamiliar@%
+ \ifvoid\csuse{footins#1}\else\@mem@nofootfalse\fi%
+ \fi%
+ }
+ \dolistloop{\@series}%
+ }%
+}{%
+\newcommand*{\@led@testifnofoot}{%
+ \@led@nofoottrue%
+ \ifvoid\footins\else%
+ \@led@nofootfalse%
+ \fi%
+ \def\do##1{%
+ \unless\ifnocritical@%
+ \ifvoid\csuse{##1footins}\else%
+ \@led@nofootfalse%
+ \fi%
+ \fi%
+ \unless\ifnofamiliar@%
+ \ifvoid\csuse{footins##1}\else%
+ \@led@nofootfalse%
+ \fi%
+ \fi%
+ }%
+ \dolistloop{\@series}%
+}%
+
+\pretocmd%
+ {\@doclearpage}%
+ {\@led@testifnofoot}%
+ {}%
+ {\led@error@fail@patch@@doclearpage}%
+
+\patchcmd%
+ {\@doclearpage}%
+ {\ifvoid\footins}%
+ {\if@led@nofoot}%
+ {}%
+ {\led@error@fail@patch@@doclearpage}%
+
+}
+
+\list@create{\labelref@list}
+\newcommand*{\zz@@@}{000|000} % set two counters to zero in one go
+
+
+\newcommand*{\edlabel}[1]{%
+ \ifl@dpairing\ifautopar%
+ \strut%
+ \fi\fi%
+ \@bsphack%
+ \ifledRcol%
+ \write\linenum@outR{\string\@lab}%
+ \ifx\labelref@listR\empty%
+ \xdef\label@refs{\zz@@@}%
+ \else%
+ \gl@p\labelref@listR\to\label@refs%
+ \fi%
+ \ifvmode%
+ \advancelabel@refs%
+ \fi%
+ \protected@write\@auxout{}%
+ {\string\l@dmake@labelsR\space\thepage|\label@refs|\the\c@pstartR|{#1}}%
+ \ifdef{\hypertarget}{\Hy@raisedlink{\hypertarget{#1}{}}}{}%
+ \else%
+ \write\linenum@out{\string\@lab}%
+ \ifx\labelref@list\empty%
+ \xdef\label@refs{\zz@@@}%
+ \else%
+ \gl@p\labelref@list\to\label@refs%
+ \fi%
+ \ifvmode%
+ \advancelabel@refs%
+ \fi%
+ \protected@write\@auxout{}%
+ {\string\l@dmake@labels\space\thepage|\label@refs|\the\c@pstart|{#1}}%
+ \ifdef{\hypertarget}{\Hy@raisedlink{\hypertarget{#1}{}}}{}%
+ \fi%
+\@esphack}%
+
+\newcounter{line}%
+\newcounter{subline}%
+\newcommand{\advancelabel@refs}{%
+ \setcounter{line}{\expandafter\labelrefsparseline\label@refs}%
+ \stepcounter{line}%
+ \ifsublines@%
+ \setcounter{subline}{\expandafter\labelrefsparsesubline\label@refs}%
+ \stepcounter{subline}{1}%
+ \def\label@refs{\theline|\thesubline}%
+ \else%
+ \def\label@refs{\theline|0}%
+ \fi%
+}
+\def\labelrefsparseline#1|#2{#1}
+\def\labelrefsparsesubline#1|#2{#2}
+\newcommand*{\l@dmake@labels}{}
+\def\l@dmake@labels#1|#2|#3|#4|#5{%
+ \expandafter\ifx\csname the@label#5\endcsname \relax\else
+ \led@warn@DuplicateLabel{#5}%
+ \fi
+ \expandafter\gdef\csname the@label#5\endcsname{#1|#2|#3|#4}%
+ \ignorespaces}
+
+\AtBeginDocument{%
+ \def\l@dmake@labels#1|#2|#3|#4|#5{}%
+}
+
+
+\newcommand*{\@lab}{%
+ \ifledRcol
+ \xright@appenditem{\linenumr@p{\line@numR}|%
+ \ifsublines@ \sublinenumr@p{\subline@numR}\else 0\fi}%
+ \to\labelref@listR
+ \else
+ \xright@appenditem{\linenumr@p{\line@num}|%
+ \ifsublines@ \sublinenumr@p{\subline@num}\else 0\fi}%
+ \to\labelref@list
+ \fi}
+\newcommand*{\applabel}[1]{%
+ \ifnum\@edtext@level>0%
+ \ifcsundef{the@label#1}{%
+ \csdef{the@label#1}{applabel}%
+ }%
+ {%
+ \led@warn@DuplicateLabel{#1 (applabel)}%
+ }%
+ \expandafter\l@dp@rsefootspec\l@d@nums|%
+ \@bsphack%
+ \ifledRcol%
+ \protected@write\@auxout{}%
+ {\string\l@dmake@labelsR\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub|\the\c@pstartR|{#1:start}}%
+ \ifdef{\hypertarget}{\Hy@raisedlink{\hypertarget{#1:start}{}}}{}%
+ \protected@write\@auxout{}%
+ {\string\l@dmake@labelsR\space\l@dparsedendpage|\l@dparsedendline|\l@dparsedendsub|\the\c@pstartR|{#1:end}}%
+ \else%
+ \protected@write\@auxout{}%
+ {\string\l@dmake@labels\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub|\the\c@pstart|{#1:start}}%
+ \ifdef{\hypertarget}{\Hy@raisedlink{\hypertarget{#1:start}{}}}{}%
+ \protected@write\@auxout{}%
+ {\string\l@dmake@labels\space\l@dparsedendpage|\l@dparsedendline|\l@dparsedendsub|\the\c@pstart|{#1:end}}%
+ \fi%
+ \@esphack%
+ \else%
+ \led@warn@AppLabelOutEdtext{#1}%
+ \fi%
+}%
+\newrobustcmd{\wrap@edcrossref}[2]{%
+ \ifdef{\hyperlink}%
+ {\hyperlink{#1}{#2}}%
+ {#2}%
+}
+\newcommand*{\edpageref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{1}{#1}}}
+\newcommand*{\xpageref}[1]{\l@dgetref@num{1}{#1}}
+
+\newcommand*{\edlineref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{2}{#1}}}%
+\newcommand*{\xlineref}[1]{\l@dgetref@num{2}{#1}}%
+
+\newcommand*{\sublineref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{3}{#1}}}
+\newcommand*{\xsublineref}[1]{\l@dgetref@num{3}{#1}}
+
+\newcommand*{\pstartref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{4}{#1}}}
+\newcommand*{\xpstartref}[1]{\l@dgetref@num{4}{#1}}
+
+\newcommand*{\l@dref@undefined}[1]{%
+ \expandafter\ifx\csname the@label#1\endcsname\relax
+ \led@warn@RefUndefined{#1}%
+ \fi}
+
+\newcommand*{\l@dgetref@num}[2]{%
+ \expandafter
+ \ifx\csname the@label#2\endcsname \relax
+ 000%
+ \else
+ \expandafter\expandafter\expandafter
+ \l@dlabel@parse\csname the@label#2\endcsname|#1%
+ \fi}
+
+\newcommand*{\l@dlabel@parse}{}
+\def\l@dlabel@parse#1|#2|#3|#4|#5{%
+ \ifcase #5%
+ \or #1%
+ \or #2%
+ \or #3%
+ \or #4%
+ \fi}
+\newcommand*{\xxref}[2]{%
+ {%
+ \expandafter\ifx\csname the@label#1\endcsname \relax%
+ \expandafter\let\csname the@@label#1\endcsname\zz@@@%
+ \else%
+ \expandafter\def\csname the@@label#1\endcsname{\l@dgetref@num{1}{#1}|\l@dgetref@num{2}{#1}|\l@dgetref@num{3}{#1}}%
+ \fi%
+ \expandafter\ifx\csname the@label#2\endcsname \relax%
+ \expandafter\let\csname the@@label#2\endcsname\zz@@@%
+ \else%
+ \expandafter\def\csname the@@label#2\endcsname{\l@dgetref@num{1}{#2}|\l@dgetref@num{2}{#2}|\l@dgetref@num{3}{#2}}%
+ \fi%
+ \ifdefined\@Rlineflag%
+ \StrDel{\csuse{the@@label#1}}{\@Rlineflag}[\@tempa]%
+ \StrDel{\csuse{the@@label#2}}{\@Rlineflag}[\@tempb]%
+ \else%
+ \letcs{\@tempa}{the@@label#1}%
+ \letcs{\@tempb}{the@@label#2}%
+ \fi%
+ \linenum{\@tempa|%
+ \@tempb}}}%
+
+\xdef\Xtwolines@appref{}%
+\xdef\Xmorethantwolines@appref{}%
+\newtoggle{Xtwolinesbutnotmore@appref}%
+\newtoggle{Xtwolinesonlyinsamepage@appref}%
+
+\xdef\Xendtwolines@apprefwithpage{}%
+\xdef\Xendmorethantwolines@apprefwithpage{}%
+\newtoggle{Xendtwolinesbutnotmore@apprefwithpage}%
+\newtoggle{Xendtwolinesonlyinsamepage@apprefwithpage}%
+
+
+\xdef\Xboxstartlinenum@appref{0pt}
+\xdef\Xboxendlinenum@appref{0pt}
+
+\xdef\Xendboxstartlinenum@apprefwithpage{0pt}
+\xdef\Xendboxendlinenum@apprefwithpage{0pt}
+
+\newcommand\@apprefprefixsingle{}%
+\newcommand\@apprefprefixmore{}%
+
+\newcommand{\apprefprefixsingle}[1]{%
+ \gdef\@apprefprefixsingle{#1}%
+}
+
+\newcommand{\setapprefprefixmore}[1]{%
+ \gdef\@apprefprefixmore{#1}%
+}
+
+\newcommandx{\appref}[2][1,usedefault]{%
+ \IfStrEq{#1}{fulllines}%
+ {\toggletrue{fulllines@}}%
+ {}%
+ \xdef\@currentseries{appref}%
+ \ifdefempty{\@apprefprefixmore}%
+ {\@apprefprefixsingle}%
+ {%
+ \IfEq{\xlineref{#2:start}}{\xlineref{#2:end}}%
+ {\@apprefprefixsingle}%
+ {\@apprefprefixmore}%
+ }%
+ \printlines\xpageref{#2:start}|\xlineref{#2:start}|\xsublineref{#2:start}|\xpageref{#2:end}|\xlineref{#2:end}|\xsublineref{#2:end}||%
+ \togglefalse{fulllines@}%
+}%
+
+\newcommandx{\apprefwithpage}[2][1,usedefault]{%
+ \IfStrEq{#1}{fulllines}%
+ {\toggletrue{fulllines@}}%
+ {}%
+ \xdef\@currentseries{apprefwithpage}%
+ \printendlines\xpageref{#2:start}|\xlineref{#2:start}|\xsublineref{#2:start}|\xpageref{#2:end}|\xlineref{#2:end}|\xsublineref{#2:end}||%
+ \togglefalse{fulllines@}%
+}%
+\newcommand*{\edmakelabel}[2]{\expandafter\xdef\csname the@label#1\endcsname{#2}}
+
+\pretocmd{\@xympar}%
+ {\ifnumberedpar@
+ \led@warn@NoMarginpars
+ \@esphack
+ \else}%
+ {}%
+ {}%
+
+\apptocmd{\@xympar}%
+ {\fi}%
+ {}
+ {}
+
+\newcount\sidenote@margin
+\newcommand*{\sidenotemargin}[1]{{%
+ \l@dgetsidenote@margin{#1}%
+ \ifnum\@l@dtempcntb>\m@ne
+ \ifledRcol
+ \global\sidenote@marginR=\@l@dtempcntb
+ \else
+ \global\sidenote@margin=\@l@dtempcntb
+ \fi
+ \fi}}
+\newcommand*{\l@dgetsidenote@margin}[1]{%
+ \def\@tempa{#1}\def\@tempb{left}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \z@
+ \else
+ \def\@tempb{right}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \@ne
+ \else
+ \def\@tempb{outer}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \tw@
+ \else
+ \def\@tempb{inner}%
+ \ifx\@tempa\@tempb
+ \@l@dtempcntb \thr@@
+ \else
+ \led@warn@BadSidenotemargin
+ \@l@dtempcntb \m@ne
+ \fi
+ \fi
+ \fi
+ \fi}
+\sidenotemargin{right}
+
+\newbox\l@dlp@rbox
+\newbox\l@drp@rbox
+
+\newdimen\ledlsnotewidth \ledlsnotewidth=\marginparwidth
+\newdimen\ledrsnotewidth \ledrsnotewidth=\marginparwidth
+\newdimen\ledlsnotesep \ledlsnotesep=\linenumsep
+\newdimen\ledrsnotesep \ledrsnotesep=\linenumsep
+\newcommand*{\ledlsnotefontsetup}{\raggedleft\footnotesize}
+\newcommand*{\ledrsnotefontsetup}{\raggedright\footnotesize}
+
+\newcommand*{\ledleftnote}[1]{\edtext{}{\l@dlsnote{#1}}}
+\newcommand*{\ledrightnote}[1]{\edtext{}{\l@drsnote{#1}}}
+
+\newcommand*{\ledinnernote}[1]{%
+ \ifodd\c@page% Do not use \page@num, because it is not yet calculated when command is called
+ \ledleftnote{#1}%
+ \else%
+ \ledrightnote{#1}%
+ \fi%
+}
+
+\newcommand*{\ledouternote}[1]{%
+ \ifodd\c@page% Do not use \page@num, because it is not yet calculated when command is called
+ \ledrightnote{#1}%
+ \else%
+ \ledleftnote{#1}%
+ \fi%
+}
+
+\newcommand*{\ledsidenote}[1]{\edtext{}{\l@dcsnote{#1}}}
+\newif\ifrightnoteup
+ \rightnoteuptrue
+
+\newcommand*{\l@dlsnote}[1]{%
+ \begingroup%
+ \newcommand{\content}{#1}%
+ \ifnumberedpar@
+ \ifledRcol%
+ \xright@appenditem{\noexpand\vl@dlsnote{\expandonce\content}}%
+ \to\inserts@listR
+ \global\advance\insert@countR \@ne%
+ \else%
+ \xright@appenditem{\noexpand\vl@dlsnote{\expandonce\content}}%
+ \to\inserts@list
+ \global\advance\insert@count \@ne%
+ \fi
+ \fi\ignorespaces\endgroup}
+
+\newcommand*{\l@drsnote}[1]{%
+ \begingroup%
+ \newcommand{\content}{#1}%
+ \ifnumberedpar@
+ \ifledRcol%
+ \xright@appenditem{\noexpand\vl@drsnote{\expandonce\content}}%
+ \to\inserts@listR
+ \global\advance\insert@countR \@ne%
+ \else%
+ \xright@appenditem{\noexpand\vl@drsnote{\expandonce\content}}%
+ \to\inserts@list
+ \global\advance\insert@count \@ne%
+ \fi
+ \fi\ignorespaces\endgroup}
+
+\newcommand*{\l@dcsnote}[1]{%
+ \begingroup%
+ \newcommand{\content}{#1}%
+ \ifnumberedpar@
+ \ifledRcol%
+ \xright@appenditem{\noexpand\vl@dcsnote{\expandonce\content}}%
+ \to\inserts@listR
+ \global\advance\insert@countR \@ne%
+ \else%
+ \xright@appenditem{\noexpand\vl@dcsnote{\expandonce\content}}%
+ \to\inserts@list
+ \global\advance\insert@count \@ne%
+ \fi
+ \fi\ignorespaces\endgroup}
+
+\newcommand*{\vl@dlsnote}[1]{%
+ \ifledRcol@%
+ \@l@dtempcntb=\sidenote@marginR%
+ \ifnum\@l@dtempcntb>\@ne%
+ \advance\@l@dtempcntb by\page@numR%
+ \fi%
+ \else%
+ \@l@dtempcntb=\sidenote@margin%
+ \ifnum\@l@dtempcntb>\@ne%
+ \advance\@l@dtempcntb by\page@num%
+ \fi%
+ \fi%
+ \ifodd\@l@dtempcntb%
+ \listgadd{\l@dcsnotetext@l}{#1}%
+ \else%
+ \listgadd{\l@dcsnotetext}{#1}%
+ \fi
+}
+\newcommand*{\vl@drsnote}[1]{%
+ \ifledRcol@%
+ \@l@dtempcntb=\sidenote@marginR%
+ \ifnum\@l@dtempcntb>\@ne%
+ \advance\@l@dtempcntb by\page@numR%
+ \fi%
+ \else%
+ \@l@dtempcntb=\sidenote@margin%
+ \ifnum\@l@dtempcntb>\@ne%
+ \advance\@l@dtempcntb by\page@num%
+ \fi%
+ \fi%
+ \ifodd\@l@dtempcntb%
+ \listgadd{\l@dcsnotetext}{#1}%
+ \else%
+ \listgadd{\l@dcsnotetext@r}{#1}%
+ \fi%
+}
+\newcommand*{\vl@dcsnote}[1]{\listgadd{\l@dcsnotetext}{#1}}
+
+\newcommand*{\setl@dlp@rbox}[1]{%
+ {\parindent\z@\hsize=\ledlsnotewidth\ledlsnotefontsetup
+ \global\setbox\l@dlp@rbox
+ \ifleftnoteup
+ =\vbox to\z@{\vss #1}%
+ \else
+ =\vbox to 0.70\baselineskip{\strut#1\vss}%
+ \fi}}
+\newcommand*{\setl@drp@rbox}[1]{%
+ {\parindent\z@\hsize=\ledrsnotewidth\ledrsnotefontsetup
+ \global\setbox\l@drp@rbox
+ \ifrightnoteup
+ =\vbox to\z@{\vss#1}%
+ \else
+ =\vbox to0.7\baselineskip{\strut#1\vss}%
+ \fi}}
+\newif\ifleftnoteup
+ \leftnoteuptrue
+\newcommand{\setsidenotesep}[1]{\gdef\@sidenotesep{#1}}
+\newcommand{\@sidenotesep}{, }
+\newcommand*{\affixside@note}{%
+ \def\sidenotecontent@{}%
+ \numgdef{\itemcount@}{0}%
+ \def\do##1{%
+ \ifnumequal{\itemcount@}{0}%
+ {%
+ \appto\sidenotecontent@{##1}}% Not print not separator before the 1st note
+ {\appto\sidenotecontent@{\@sidenotesep ##1}%
+ }%
+ \numgdef{\itemcount@}{\itemcount@+1}%
+ }%
+ \dolistloop{\l@dcsnotetext}%
+ \ifnumgreater{\itemcount@}{1}{\led@err@ManySidenotes}{}%
+ \gdef\@templ@d{}%
+ \gdef\@templ@n{\l@dcsnotetext\l@dcsnotetext@l\l@dcsnotetext@r}%
+ \ifx\@templ@d\@templ@n \else%
+ \if@twocolumn%
+ \if@firstcolumn%
+ \setl@dlp@rbox{##1}{\sidenotecontent@}%
+ \else%
+ \setl@drp@rbox{\sidenotecontent@}%
+ \fi%
+ \else%
+ \@l@dtempcntb=\sidenote@margin%
+ \ifnum\@l@dtempcntb>\@ne%
+ \advance\@l@dtempcntb by\page@num%
+ \fi%
+ \ifodd\@l@dtempcntb%
+ \setl@drp@rbox{\sidenotecontent@}%
+ \gdef\sidenotecontent@{}%
+ \numgdef{\itemcount@}{0}%
+ \dolistloop{\l@dcsnotetext@l}%
+ \ifnumgreater{\itemcount@}{1}{\led@err@ManyLeftnotes}{}%
+ \setl@dlp@rbox{\sidenotecontent@}%
+ \else%
+ \setl@dlp@rbox{\sidenotecontent@}%
+ \gdef\sidenotecontent@{}%
+ \numgdef{\itemcount@}{0}%
+ \dolistloop{\l@dcsnotetext@r}%
+ \ifnumgreater{\itemcount@}{1}{\led@err@ManyRightnotes}{}%
+ \setl@drp@rbox{\sidenotecontent@}%
+ \fi%
+ \fi%
+ \fi%
+}
+\ifnoledgroup@\else%
+\newcommand*{\l@dfeetbeginmini}{\l@dedbeginmini\l@dfambeginmini}
+\newcommand*{\l@dfeetendmini}{%
+ \IfStrEq{critical-familiar}{\@mpfnpos}%
+ {\l@dedendmini\l@dfamendmini}%
+ {%
+ \IfStrEq{familiar-critical}{\@mpfnpos}%
+ {\l@dfamendmini\l@dedendmini}%
+ {\l@dedendmini\l@dfamendmini}%
+ }%
+ }%
+\newcommand*{\l@dedbeginmini}{%
+ \unless\ifnocritical@%
+ \def\do##1{\csletcs{v##1footnote}{mpv##1footnote}}%
+ \dolistloop{\@series}%
+ \fi%
+ }
+\newcommand*{\l@dedendmini}{%
+ \unless\ifnocritical@%
+ \ifl@dpairing%
+ \ifledRcol%
+ \flush@notesR%
+ \else%
+ \flush@notes%
+ \fi%
+ \fi
+ \def\do##1{%
+ \ifvoid\csuse{mp##1footins}\else%
+ \ifl@dpairing\ifparledgroup%
+ \ifledRcol%
+ \dimgdef{\parledgroup@beforenotesR}{\parledgroup@beforenotesR+\skip\@nameuse{mp##1footins}}%
+ \else%
+ \dimgdef{\parledgroup@beforenotesL}{\parledgroup@beforenotesL+\skip\@nameuse{mp##1footins}}%
+ \fi%
+ \fi\fi%
+ \csuse{mp##1footgroup}{##1}%
+ \fi}%
+ \dolistloop{\@series}%
+ \fi%
+}%
+
+\newcommand*{\l@dfambeginmini}{%
+ \unless\ifnofamiliar@%
+ \def\do##1{\csletcs{vfootnote##1}{mpvfootnote##1}}%
+ \dolistloop{\@series}%
+ \fi%
+}%
+
+\newcommand*{\l@dfamendmini}{%
+ \unless\ifnofamiliar@%
+ \def\do##1{%
+ \ifvoid\csuse{mpfootins##1}\else%
+ \csuse{mpfootgroup##1}{##1}%
+ \fi}%
+ \dolistloop{\@series}%
+ \fi%
+}%
+\patchcmd%
+ {\@iiiminipage}%
+ {\let\@footnotetext\@mpfootnotetext}%
+ {\let\@footnotetext\@mpfootnotetext\l@dfeetbeginmini}%
+ {}%
+ {\led@error@fail@patch@@iiiminipage}%
+\patchcmd%
+ {\endminipage}%
+ {\footnoterule}%
+ {\footnoterule\l@advance@parledgroup@beforenormalnotes}%
+ {}%
+ {\led@error@fail@patch@endminipage}
+
+\patchcmd%
+ {\endminipage}%
+ {\@minipagefalse}%
+ {\l@dfeetendmini\@minipagefalse}%
+ {}%
+ {\led@error@fail@patch@endminipage}
+
+\newcommand*{\l@dunboxmpfoot}{%
+ \vskip\skip\@mpfootins
+ \normalcolor
+ \footnoterule
+ \l@advance@parledgroup@beforenormalnotes
+ \unvbox\@mpfootins%
+}
+\newcommand{\l@advance@parledgroup@beforenormalnotes}{%
+ \ifparledgroup
+ \ifl@dpairing
+ \ifledRcol
+ \dimgdef{\parledgroup@beforenotesR}{\parledgroup@beforenotesR+\skip\@mpfootins}
+ \else
+ \dimgdef{\parledgroup@beforenotesL}{\parledgroup@beforenotesL+\skip\@mpfootins}
+ \fi
+ \fi
+ \fi
+}
+\newenvironment{ledgroup}{%
+ \resetprevpage@num%
+ \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@%
+ \let\@footnotetext\@mpfootnotetext
+ \l@dfeetbeginmini%
+}{%
+ \par
+ \unskip
+ \ifvoid\@mpfootins\else
+ \l@dunboxmpfoot
+ \fi
+ \l@dfeetendmini%
+}
+
+\newenvironment{ledgroupsized}[2][l]{%
+ \hsize #2\relax
+%% \textwidth #2\relax
+%% \columnwidth #2\relax
+ \let\ledllfill\hfil
+ \let\ledrlfill\hfil
+ \def\@tempa{#1}\def\@tempb{l}%
+ \ifx\@tempa\@tempb
+ \let\ledllfill\relax
+ \else
+ \def\@tempb{r}%
+ \ifx\@tempa\@tempb
+ \let\ledrlfill\relax
+ \fi
+ \fi
+ \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
+ \let\@footnotetext\@mpfootnotetext
+ \l@dfeetbeginmini%
+}{%
+ \par
+ \unskip
+ \ifvoid\@mpfootins\else
+ \l@dunboxmpfoot
+ \fi
+ \l@dfeetendmini%
+}
+
+\fi%
+\newif\ifledgroupnotesL@
+\newif\ifledgroupnotesR@
+\AtBeginDocument{%
+ \unless\ifl@imakeidx%
+ \@ifpackageloaded{imakeidx}{\led@error@ImakeidxAfterEledmac}{}%
+ \fi%
+ \unless\ifl@indextools%
+ \@ifpackageloaded{indextools}{\led@error@indextoolsAfterEledmac}{}%
+ \fi%
+}
+\newcommand{\pagelinesep}{-}
+\newcommand{\edindexlab}{$&}
+\newcounter{labidx}
+\setcounter{labidx}{0}
+
+\newcommand{\doedindexlabel}{%
+ \stepcounter{labidx}%
+ \edlabel{\edindexlab\thelabidx}%
+}
+
+\newcommand{\thepageline}{%
+ \thepage%
+ \pagelinesep%
+ \xlineref{\edindexlab\thelabidx}%
+}
+\newcommand{\thestartpageline}{%
+ \l@dparsedstartpage%
+ \pagelinesep%
+ \l@dparsedstartline%
+}
+\newcommand{\theendpageline}{%
+ \l@dparsedendpage%
+ \pagelinesep%
+ \l@dparsedendline%
+}
+\newif\if@edindex@fornote@
+\newcommand{\prepare@edindex@fornote}[1]{%
+ \l@dp@rsefootspec#1|%
+ \@edindex@fornote@true%
+}
+\newcommand{\get@edindex@ledinnote@command}{%
+ \ifxindy@%
+ \gdef\@ledinnote@command{%
+ ledinnote\thelabidx%
+ }%
+ \ifxindyhyperref@%
+ \immediate\write\eledmac@xindy@out{%
+ (define-attributes ("ledinnote\thelabidx"))^^J
+ \space\space(markup-locref^^J
+ \eledmacmarkuplocrefdepth^^J
+ :open "\string\ledinnote[\edindexlab\thelabidx]{\@index@command}{"^^J
+ :close "}"^^J
+ :attr "ledinnote\thelabidx"^^J
+ )
+ }%
+ \else%
+ \immediate\write\eledmac@xindy@out{%
+ (define-attributes ("ledinnote\thelabidx"))^^J
+ \space\space(markup-locref^^J
+ \eledmacmarkuplocrefdepth^^J
+ :open "\string\ledinnote{\@index@command}{"^^J
+ :close "}"^^J
+ :attr "ledinnote\thelabidx"^^J
+ )
+ }%
+ \fi%
+ \else%
+ \gdef\@ledinnote@command{%
+ ledinnote[\edindexlab\thelabidx]{\@index@command}%
+ }%
+ \fi%
+}
+\def\get@index@command#1|#2+{%
+ \gdef\@index@txt{#1}%
+ \gdef\@index@command{#2}%
+ \xdef\@index@parenthesis{}%
+ \IfBeginWith{\@index@command}{(}{%
+ \StrGobbleLeft{\@index@command}{1}[\@index@command@]%
+ \global\let\@index@command\@index@command@%
+ \xdef\@index@parenthesis{(}%
+ }{}%
+ \IfBeginWith{\@index@command}{)}{%
+ \StrGobbleLeft{\@index@command}{1}[\@index@command@]%
+ \global\let\@index@command\@index@command@%
+ \xdef\@index@parenthesis{)}%
+ }{}%
+}
+\newcommandx{\ledinnote}[3][1,usedefault]{%
+ \ifboolexpr{%
+ test{\ifdefequal{\iftrue}{\ifHy@hyperindex}}%
+ or%
+ bool {xindyhyperref@}%
+ }%
+ {%
+ \csuse{#2}{\hyperlink{#1}{\ledinnotemark{#3}}}%
+ }%
+ {%
+ \csuse{#2}{\ledinnotemark{#3}}%
+ }%
+}%
+\newcommand{\ledinnotehyperpage}[2]{\csuse{#1}{\ledinnotemark{\hyperpage{#2}}}}%
+\newcommand{\ledinnotemark}[1]{#1\emph{n}}%
+\newcommandx{\@wredindex}[2][1=\expandonce\jobname,usedefault]{%#1 = the index name, #2 = the text
+ \global\let\old@Rlineflag\@Rlineflag%
+ \gdef\@Rlineflag{}%
+ \ifl@imakeidx%
+ \if@edindex@fornote@%
+ \IfSubStr[1]{#2}{|}{\get@index@command#2+}{\get@index@command#2|+}%
+ \get@edindex@ledinnote@command%
+ \expandafter\imki@wrindexentry{#1}{\@index@txt|(\@ledinnote@command}{\thestartpageline}%
+ \expandafter\imki@wrindexentry{#1}{\@index@txt|)\@ledinnote@command}{\theendpageline}%
+ \else%
+ \get@edindex@hyperref{#2}%
+ \imki@wrindexentry{#1}{\@index@txt\@edindex@hyperref}{\thepageline}%
+ \fi%
+ \else%
+ \if@edindex@fornote@%
+ \IfSubStr[1]{#2}{|}{\get@index@command#2+}{\get@index@command#2|+}%
+ \get@edindex@ledinnote@command%
+ \expandafter\protected@write\@indexfile{}%
+{\string\indexentry{\@index@txt|(\@ledinnote@command}{\thestartpageline}
+}%
+ \expandafter\protected@write\@indexfile{}%
+{\string\indexentry{\@index@txt|)\@ledinnote@command}{\theendpageline}
+ }%
+ \else%
+ \protected@write\@indexfile{}%
+{\string\indexentry{#2}{\thepageline}
+}%
+ \fi%
+ \fi%
+ \endgroup
+ \global\let\@Rlineflag\old@Rlineflag%
+ \@esphack%
+}
+\pretocmd{\makeindex}{%
+ \def\edindex{\@bsphack
+ \doedindexlabel
+ \begingroup
+ \@sanitize
+ \@wredindex}}{}{}
+\newcommand{\edindex}[1]{\@bsphack\@esphack}
+\newcommand{\hyperlinkformat}[3]{%
+ \ifstrempty{#1}%
+ {\hyperlink{#2}{#3}}%
+ {\csuse{#1}{\hyperlink{#2}{#3}}%
+ }}
+\newcommand{\hyperlinkR}[2]{%
+ \hyperlink{#1}{#2\@Rlineflag}%
+}%
+
+\newcommand{\hyperlinkformatR}[3]{%
+ \hyperlinkformat{#1}{#2}{#3\@Rlineflag}%
+}%
+
+\newcommand{\get@edindex@hyperref}[1]{%
+ \edef\temp@{%
+ \catcode`\ =9 %space need for catcode
+ #1%
+ \catcode`\ =10 % space need for catcode
+ }%
+ \ifdefequal{\iftrue}{\ifHy@hyperindex}{%
+ \IfSubStr{\temp@}{|}%
+ {\get@index@command#1+%
+ \ifledRcol%
+ \gdef\@edindex@hyperref{|\@index@parenthesis %space kept
+ hyperlinkformatR{\@index@command}%
+ {\edindexlab\thelabidx}}%
+ \else%
+ \gdef\@edindex@hyperref{|\@index@parenthesis %space kept
+ hyperlinkformat{\@index@command}%
+ {\edindexlab\thelabidx}}%
+ \fi%
+ }%
+ {\get@index@command#1|+%
+ \ifledRcol%
+ \gdef\@edindex@hyperref{|hyperlinkR{\edindexlab\thelabidx}}%
+ \else%
+ \gdef\@edindex@hyperref{|hyperlink{\edindexlab\thelabidx}}%
+ \fi%
+ }%
+ }%
+ {\ifxindyhyperref@%
+ \IfSubStr{\temp@}{|}%
+ {\get@index@command#1+}%
+ {\get@index@command#1|+}%
+ \gdef\@edindex@hyperref{|eledmac\thelabidx}%
+ \IfStrEq{\@index@parenthesis}{(}%
+ {%
+ \csxdef{xindyparenthesis@\@index@txt}{\thelabidx}%
+ \gdef\@edindex@hyperref{|(eledmac\thelabidx}%
+ }%
+ {}%
+ \IfStrEq{\@index@parenthesis}{)}%
+ {%
+ \xdef\@edindex@hyperref{|)eledmac\csuse{xindyparenthesis@\@index@txt}}%
+ \global\csundef{xindyparenthesis@\@index@txt}%
+ }%
+ {%
+ \immediate\write\eledmac@xindy@out{%
+ (define-attributes ("eledmac\thelabidx"))^^J
+ \space\space(markup-locref^^J
+ \eledmacmarkuplocrefdepth^^J
+ :open "\string\hyperlink%
+ \ifledRcol R\fi%
+ {\edindexlab\thelabidx}%
+ {\ifdefempty{\@index@command}%
+ {}%
+ {\@backslashchar\@index@command}%
+ {"^^J
+ :close "}}"^^J
+ :attr "eledmac\thelabidx"^^J
+ )
+ }%
+ }%
+ \else%
+ \gdef\@index@txt{#1}%
+ \gdef\@edindex@hyperref{}%
+ \fi%
+ }%
+}
+\def\@hangingsymbol{}
+\newcommand*{\sethangingsymbol}[1]{%
+ \gdef\@hanginsymbol{#1}%
+}%
+\newif\ifinstanza
+\newif\ifinserthangingsymbol
+\newcommand{\inserthangingsymbol}{%
+\ifinserthangingsymbol%
+ \ifinstanza%
+ \@hangingsymbol%
+ \fi%
+\fi%
+}
+\newcommand*{\ampersand}{\char`\&}
+
+ \chardef\body=\catcode`\@
+ \catcode`\@=11
+ \chardef\next=\catcode`\&
+ \catcode`\&=\active
+
+ \newcount\stanza@count
+ \newlength{\stanzaindentbase}
+ \setlength{\stanzaindentbase}{20pt}
+
+\def\strip@szacnt#1,#2|{\def\@tempb{#1}\def\@tempa{#2|}}
+\newcommand*{\setstanzavalues}[2]{\def\@tempa{#2,,|}%
+ \stanza@count\z@
+ \def\next{\expandafter\strip@szacnt\@tempa
+ \ifx\@tempb\empty\let\next\relax\else
+ \expandafter\mathchardef\csname #1@\number\stanza@count
+ @\endcsname\@tempb\relax
+ \advance\stanza@count\@ne\fi\next}%
+ \next}
+
+\newcommand*{\setstanzaindents}[1]{\setstanzavalues{sza}{#1}}
+\newcommand*{\setstanzapenalties}[1]{\setstanzavalues{szp}{#1}}
+\newcounter{stanzaindentsrepetition}
+\newcount\stanza@modulo
+
+\newcommand*{\managestanza@modulo}[0]{
+ \advance\stanza@modulo\@ne
+ \ifnum\stanza@modulo>\value{stanzaindentsrepetition}
+ \stanza@modulo\@ne
+ \fi
+}
+\newcommand{\stanzaindent}[1]{%
+ \hspace{\dimexpr#1\stanzaindentbase-\parindent\relax}%
+ \ignorespaces%
+}%
+\WithSuffix\newcommand\stanzaindent*[1]{%
+ \stanzaindent{#1}%
+ \global\advance\stanza@modulo-\@ne%
+ \ifnum\stanza@modulo=0%
+ \global\stanza@modulo=\value{stanzaindentsrepetition}%
+ \fi%
+ \ignorespaces%
+}%
+
+\newcommandx{\stanza@line}[1][1]{
+ \ifnum\value{stanzaindentsrepetition}=0
+ \parindent=\csname sza@\number\stanza@count
+ @\endcsname\stanzaindentbase
+ \else
+ \parindent=\csname sza@\number\stanza@modulo
+ @\endcsname\stanzaindentbase
+ \managestanza@modulo
+ \fi
+ \pstart[#1]\stanza@hang\ignorespaces}
+\xdef\stanza@hang{\noexpand\leavevmode\noexpand\startlock
+ \hangindent\expandafter
+ \noexpand\csname sza@0@\endcsname\stanzaindentbase
+ \hangafter\@ne}
+\def\sza@penalty{\count@\csname szp@\number\stanza@count @\endcsname
+ \ifnum\count@>\@M\advance\count@-\@M\penalty-\else
+ \penalty\fi\count@}
+\xdef\@startstanza[#1]{%
+ \noexpand\instanzatrue\expandafter
+ \begingroup%
+ \catcode`\noexpand\&\active%
+ \global\stanza@count\@ne\stanza@modulo\@ne
+ \noexpand\ifnum\expandafter\noexpand
+ \csname sza@0@\endcsname=\z@\let\noexpand\stanza@hang\relax
+ \let\noexpand\endlock\relax\noexpand\else\interlinepenalty
+ \@M\rightskip\z@ plus 1fil\relax\noexpand\fi\noexpand\ifnum
+ \expandafter\noexpand\csname szp@0@\endcsname=\z@
+ \let\noexpand\sza@penalty\relax\noexpand\fi%
+ \def\noexpand&{%
+ \noexpand\newverse[][]}%
+ \def\noexpand\&{\noexpand\@stopstanza}%
+ \noexpand\stanza@line[#1]}
+
+\newcommandx{\stanza}[1][1,usedefault]{\@startstanza[#1]}
+
+\newcommandx{\@stopstanza}[1][1,usedefault]{%
+ \unskip%
+ \endlock%
+ \pend[#1]%
+ \endgroup%
+ \instanzafalse%
+}
+
+\newcommandx*{\newverse}[2][1,2,usedefault]{%
+ \unskip%
+ \endlock\pend[#1]\sza@penalty\global%
+ \advance\stanza@count\@ne\stanza@line[#2]%
+ }
+
+\newcommand*{\flagstanza}[2][\stanzaindentbase]{%
+ \hskip -#1\llap{#2}\hskip #1\ignorespaces}
+
+ \catcode`\&=\next
+ \catcode`\@=\body
+ \setstanzavalues{szp}{0}
+
+\newtoks\@emptytoks
+
+\newtoks\l@denvbody
+
+\newcommand{\addtol@denvbody}[1]{%
+ \global\l@denvbody\expandafter{\the\l@denvbody#1}}
+
+\newcommand{\l@dcollect@body}[1]{%
+ \l@denvbody{\expandafter#1\expandafter{\the\l@denvbody}}%
+ \edef\processl@denvbody{\the\l@denvbody\noexpand\end{\@currenvir}}%
+ \l@denvbody\@emptytoks \def\l@dbegin@stack{b}%
+ \begingroup
+ \expandafter\let\csname\@currenvir\endcsname\l@dcollect@@body
+ \edef\processl@denvbody{\expandafter\noexpand\csname\@currenvir\endcsname}%
+ \processl@denvbody%
+ }%
+
+\def\l@dpush@begins#1\begin#2{%
+ \ifx\end#2\else b\expandafter\l@dpush@begins\fi}
+
+\def\l@dcollect@@body#1\end#2{%
+ \edef\l@dbegin@stack{\l@dpush@begins#1\begin\end
+ \expandafter\@gobble\l@dbegin@stack}%
+ \ifx\@empty\l@dbegin@stack
+ \endgroup
+ \@checkend{#2}%
+ \addtol@denvbody{#1}%
+ \else
+ \addtol@denvbody{#1\end{#2}}%
+ \fi
+ \processl@denvbody % A little tricky! Note the grouping
+}
+
+\newcommand*{\l@dtabnoexpands}{%
+ \let\rtab=0%
+ \let\ctab=0%
+ \let\ltab=0%
+ \let\rtabtext=0%
+ \let\ltabtext=0%
+ \let\ctabtext=0%
+ \let\edbeforetab=0%
+ \let\edaftertab=0%
+ \let\edatleft=0%
+ \let\edatright=0%
+ \let\edvertline=0%
+ \let\edvertdots=0%
+ \let\edrowfill=0%
+}
+
+\newcommand{\disable@familiarnotes}{%
+ \unless\ifnofamiliar@%
+ \def\do##1{%
+ \csletcs{footnote@@##1}{footnote##1}%
+ \expandafter\renewcommand \csname footnote##1\endcsname[1]{%
+ \protected@csxdef{@thefnmark##1}{\csuse{thefootnote##1}}%
+ \csuse{@footnotemark##1}%
+ }%
+ }%
+ \dolistloop{\@series}%
+ \fi%
+}%
+\newcommand{\restore@familiarnotes}{%
+ \unless\ifnofamiliar@%
+ \def\do##1{%
+ \csletcs{footnote##1}{footnote@@##1}%
+ }%
+ \dolistloop{\@series}%
+ \fi%
+}%
+
+\newcommand{\disable@sidenotes}{%
+ \let\@@ledrightnote\ledrightnote%
+ \let\@@ledleftnote\ledleftnote%
+ \let\@@ledsidenote\ledsidenote%
+ \let\ledrightnote\@gobble%
+ \let\ledleftnote\@gobble%
+ \let\ledsidenote\@gobble%
+}%
+\newcommand{\restore@sidenotes}{%
+ \let\ledrightnote\@@ledrightnote%
+ \let\ledleftnote\@@ledleftnote%
+ \let\ledsidenote\@@ledsidenote%
+}%
+\newcommand{\disable@notes}{%
+ \disable@sidenotes%
+ \disable@familiarnotes%
+}%
+\newcommand{\restore@notes}{%
+ \restore@sidenotes%
+ \restore@familiarnotes%
+}%
+\let\EDTEXT=\edtext
+\newcommand{\xedtext}[2]{\EDTEXT{#1}{#2}}
+\let\EDLABEL=\edlabel
+\newcommand*{\xedlabel}[1]{\EDLABEL{#1}}
+\let\EDINDEX=\edindex
+\newcommand{\xedindex}{\@bsphack%
+ \@ifnextchar [{\l@d@index}{\l@d@index[\jobname]}}
+\newcommand{\nulledindex}[2][\jobname]{\@bsphack\@esphack}
+
+\let\@line@@num=\linenum
+\newcommand*{\l@dgobbleoptarg}[2][]{\relax}%
+
+\let\Relax=\relax
+\let\NEXT=\next
+
+\newcommand{\l@dmodforedtext}{%
+ \let\edtext\relax
+ \def\do##1{\global\csletcs{##1footnote}{l@dgobbleoptarg}}%
+ \dolistloop{\@series}%
+ \let\edindex\nulledindex
+ \let\linenum\@gobble}
+\newcommand{\l@drestoreforedtext}{%
+ \def\do##1{\global\csletcs{##1footnote}{##1@@footnote}}
+ \dolistloop{\@series}%
+ \let\edindex\xedindex}
+\newcommand{\l@dnullfills}{%
+ \def\edlabel##1{}%
+ \def\edrowfill##1##2##3{}%
+}
+\newcommand{\l@drestorefills}{%
+ \def\edrowfill##1##2##3{\@EDROWFILL@{##1}{##2}{##3}}%
+}
+
+\newcommand{\letsforverteilen}{%
+ \let\edtext\xedtext
+ \let\edindex\xedindex
+ \def\do##1{\global\csletcs{##1footnote}{##1@@footnote}}
+ \dolistloop{\@series}%
+ \let\linenum\@line@@num
+ \hilfsskip=\l@dcolwidth%
+ \advance\hilfsskip by -\wd\hilfsbox
+ \def\edlabel##1{\xedlabel{##1}}}
+
+\newcommand\disablel@dtabfeet{\l@dmodforedtext}%
+\newcommand\enablel@dtabfeet{\l@drestoreforedtext}%
+\newcount\l@dampcount
+ \l@dampcount=1\relax
+\newcount\l@dcolcount
+ \l@dcolcount=0\relax
+
+\newbox\hilfsbox
+\newskip\hilfsskip
+\newbox\Hilfsbox
+\newcount\hilfscount
+
+\newdimen\dcoli
+\newdimen\dcolii
+\newdimen\dcoliii
+\newdimen\dcoliv
+\newdimen\dcolv
+\newdimen\dcolvi
+\newdimen\dcolvii
+\newdimen\dcolviii
+\newdimen\dcolix
+\newdimen\dcolx
+\newdimen\dcolxi
+\newdimen\dcolxii
+\newdimen\dcolxiii
+\newdimen\dcolxiv
+\newdimen\dcolxv
+\newdimen\dcolxvi
+\newdimen\dcolxvii
+\newdimen\dcolxviii
+\newdimen\dcolxix
+\newdimen\dcolxx
+\newdimen\dcolxxi
+\newdimen\dcolxxii
+\newdimen\dcolxxiii
+\newdimen\dcolxxiv
+\newdimen\dcolxxv
+\newdimen\dcolxxvi
+\newdimen\dcolxxvii
+\newdimen\dcolxxviii
+\newdimen\dcolxxix
+\newdimen\dcolxxx
+\newdimen\dcolerr % added for error handling
+
+\newcommand{\l@dcolwidth}{\ifcase \the\l@dcolcount \dcoli %???
+ \or \dcoli \or \dcolii \or \dcoliii
+ \or \dcoliv \or \dcolv \or \dcolvi
+ \or \dcolvii \or \dcolviii \or \dcolix \or \dcolx
+ \or \dcolxi \or \dcolxii \or \dcolxiii
+ \or \dcolxiv \or \dcolxv \or \dcolxvi
+ \or \dcolxvii \or \dcolxviii \or \dcolxix \or \dcolxx
+ \or \dcolxxi \or \dcolxxii \or \dcolxxiii
+ \or \dcolxxiv \or \dcolxxv \or \dcolxxvi
+ \or \dcolxxvii \or \dcolxxviii \or \dcolxxix \or \dcolxxx
+ \else \dcolerr \fi}
+
+\newcommand*{\stepl@dcolcount}{\advance\l@dcolcount\@ne
+ \ifnum\l@dcolcount>30\relax
+ \led@err@TooManyColumns
+ \fi}
+
+\newcommand{\l@dsetmaxcolwidth}{%
+ \ifdim\l@dcolwidth < \wd\hilfsbox
+ \l@dcolwidth = \wd\hilfsbox
+ \else \relax \fi}
+
+\def\measuremcell #1&{%
+ \ifx #1\\ \ifnum\l@dcolcount=0\let\NEXT\relax%
+ \else\l@dcheckcols%
+ \l@dcolcount=0%
+ \let\NEXT\measuremcell%
+ \fi%
+ \else\setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
+ \stepl@dcolcount%
+ \l@dsetmaxcolwidth%
+ \let\NEXT\measuremcell%
+ \fi\NEXT}
+
+\def\measuretcell #1&{%
+ \ifx #1\\ \ifnum\l@dcolcount=0\let\NEXT\relax%
+ \else\l@dcheckcols%
+ \l@dcolcount=0%
+ \let\NEXT\measuretcell%
+ \fi%
+ \else\setbox\hilfsbox=\hbox{#1}%
+ \stepl@dcolcount%
+ \l@dsetmaxcolwidth%
+ \let\NEXT\measuretcell%
+ \fi\NEXT}
+
+\def\measuremrow #1\\{%
+ \ifx #1&\let\NEXT\relax%
+ \else\measuremcell #1&\\&\\&%
+ \let\NEXT\measuremrow%
+ \fi\NEXT}
+\def\measuretrow #1\\{%
+ \ifx #1&\let\NEXT\relax%
+ \else\measuretcell #1&\\&\\&%
+ \let\NEXT\measuretrow%
+ \fi\NEXT}
+
+\newskip\edtabcolsep
+\global\edtabcolsep=10pt
+
+\newcommand{\variab}{\relax}
+
+\newcommand*{\l@dcheckcols}{%
+ \ifnum\l@dcolcount=1\relax
+ \else
+ \ifnum\l@dampcount=1\relax
+ \else
+ \ifnum\l@dcolcount=\l@dampcount\relax
+ \else
+ \l@d@err@UnequalColumns
+ \fi
+ \fi
+ \l@dampcount=\l@dcolcount
+ \fi}
+
+\newdimen\edfilldimen
+\edfilldimen=0pt
+
+\newcounter{addcolcount}
+ \renewcommand{\theaddcolcount}{\roman{addcolcount}}
+\def\setmcellright #1&{\def\edlabel##1{}%
+ \let\edindex\nulledindex
+ \ifx #1\\ \ifnum\l@dcolcount=0%\removelastskip
+ \let\Next\relax%
+ \else\l@dcolcount=0%
+ \let\Next=\setmcellright%
+ \fi%
+ \else%
+ \disablel@dtabfeet%
+ \stepl@dcolcount%
+ \disable@notes%
+ \setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
+ \restore@notes%
+ \letsforverteilen%
+ \hskip\hilfsskip$\displaystyle{#1}$%
+ \hskip\edtabcolsep%
+ \let\Next=\setmcellright%
+ \fi\Next}
+
+\def\settcellright #1&{\def\edlabel##1{}%
+ \let\edindex\nulledindex
+ \ifx #1\\ \ifnum\l@dcolcount=0%\removelastskip
+ \let\Next\relax%
+ \else\l@dcolcount=0%
+ \let\Next=\settcellright%
+ \fi%
+ \else%
+ \disablel@dtabfeet%
+ \stepl@dcolcount%
+ \disable@notes%
+ \setbox\hilfsbox=\hbox{#1}%
+ \restore@notes%
+ \letsforverteilen%
+ \hskip\hilfsskip#1%
+ \hskip\edtabcolsep%
+ \let\Next=\settcellright%
+ \fi\Next}
+\def\setmcellleft #1&{\def\edlabel##1{}%
+ \let\edindex\nulledindex
+ \ifx #1\\ \ifnum\l@dcolcount=0 \let\Next\relax%
+ \else\l@dcolcount=0%
+ \let\Next=\setmcellleft%
+ \fi%
+ \else \disablel@dtabfeet%
+ \stepl@dcolcount%
+ \disable@notes%
+ \setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
+ \restore@notes%
+ \letsforverteilen%
+ $\displaystyle{#1}$\hskip\hilfsskip\hskip\edtabcolsep%
+ \let\Next=\setmcellleft%
+ \fi\Next}
+
+\def\settcellleft #1&{\def\edlabel##1{}%
+ \let\edindex\nulledindex
+ \ifx #1\\ \ifnum\l@dcolcount=0 \let\Next\relax%
+ \else\l@dcolcount=0%
+ \let\Next=\settcellleft%
+ \fi%
+ \else \disablel@dtabfeet%
+ \stepl@dcolcount%
+ \disable@notes%
+ \setbox\hilfsbox=\hbox{#1}%
+ \restore@notes%
+ \letsforverteilen%
+ #1\hskip\hilfsskip\hskip\edtabcolsep%
+ \let\Next=\settcellleft%
+ \fi\Next}
+\def\setmcellcenter #1&{\def\edlabel##1{}%
+ \let\edindex\nulledindex
+ \ifx #1\\ \ifnum\l@dcolcount=0\let\Next\relax%
+ \else\l@dcolcount=0%
+ \let\Next=\setmcellcenter%
+ \fi%
+ \else \disablel@dtabfeet%
+ \stepl@dcolcount%
+ \disable@notes%
+ \setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
+ \restore@notes%
+ \letsforverteilen%
+ \hskip 0.5\hilfsskip$\displaystyle{#1}$\hskip0.5\hilfsskip%
+ \hskip\edtabcolsep%
+ \let\Next=\setmcellcenter%
+ \fi\Next}
+
+\def\settcellcenter #1&{\def\edlabel##1{}%
+ \let\edindex\nulledindex
+ \ifx #1\\ \ifnum\l@dcolcount=0 \let\Next\relax%
+ \else\l@dcolcount=0%
+ \let\Next=\settcellcenter%
+ \fi%
+ \else \disablel@dtabfeet%
+ \stepl@dcolcount%
+ \disable@notes%
+ \setbox\hilfsbox=\hbox{#1}%
+ \restore@notes%
+ \letsforverteilen%
+ \hskip 0.5\hilfsskip #1\hskip 0.5\hilfsskip%
+ \hskip\edtabcolsep%
+ \let\Next=\settcellcenter%
+ \fi\Next}
+
+\let\NEXT=\relax
+
+\def\setmrowright #1\\{%
+ \ifx #1& \let\NEXT\relax
+ \else \centerline{\setmcellright #1&\\&\\&}
+ \let\NEXT=\setmrowright
+ \fi\NEXT}
+\def\settrowright #1\\{%
+ \ifx #1& \let\NEXT\relax
+ \else \centerline{\settcellright #1&\\&\\&}
+ \let\NEXT=\settrowright
+ \fi\NEXT}
+
+\def\setmrowleft #1\\{%
+ \ifx #1&\let\NEXT\relax
+ \else \centerline{\setmcellleft #1&\\&\\&}
+ \let\NEXT=\setmrowleft
+ \fi\NEXT}
+\def\settrowleft #1\\{%
+ \ifx #1& \let\NEXT\relax
+ \else \centerline{\settcellleft #1&\\&\\&}
+ \let\NEXT=\settrowleft
+ \fi\NEXT}
+
+\def\setmrowcenter #1\\{%
+ \ifx #1& \let\NEXT\relax%
+ \else \centerline{\setmcellcenter #1&\\&\\&}
+ \let\NEXT=\setmrowcenter
+ \fi\NEXT}
+\def\settrowcenter #1\\{%
+ \ifx #1& \let\NEXT\relax
+ \else \centerline{\settcellcenter #1&\\&\\&}
+ \let\NEXT=\settrowcenter
+ \fi\NEXT}
+
+\newcommand{\nullsetzen}{%
+ \stepl@dcolcount%
+ \l@dcolwidth=0pt%
+ \ifnum\l@dcolcount=30\let\NEXT\relax%
+ \l@dcolcount=0\relax
+ \else\let\NEXT\nullsetzen%
+ \fi\NEXT}
+
+\newcommand{\edatleft}[3][\@empty]{%
+ \ifx#1\@empty
+ \vbox to 10pt{\vss\hbox{$\left#2\vrule width0pt height #3
+ depth 0pt \right. $\hss}\vfil}
+ \else
+ \vbox to 4pt{\vss\hbox{$#1\left#2\vrule width0pt height #3
+ depth 0pt \right. $}\vfil}
+ \fi}
+\newcommand{\edatright}[3][\@empty]{%
+ \ifx#1\@empty
+ \vbox to 10pt{\vss\hbox{$\left.\vrule width0pt height #3
+ depth 0pt \right#2 $\hss}\vfil}
+ \else
+ \vbox to 4pt{\vss\hbox{$\left.\vrule width0pt height #3
+ depth 0pt \right#2 #1 $}\vfil}
+ \fi}
+
+\newcommand{\edvertline}[1]{\vbox to 8pt{\vss\hbox{\vrule height #1}\vfil}}
+
+\newcommand{\edvertdots}[1]{\vbox to 1pt{\vss\vbox to #1%
+ {\cleaders\hbox{$\m@th\hbox{.}\vbox to 0.5em{ }$}\vfil}}}
+
+\newcommand{\l@dtabaddcols}[2]{%
+ \l@dcheckstartend{#1}{#2}%
+ \ifl@dstartendok
+ \setcounter{addcolcount}{#1}%
+ \@whilenum \value{addcolcount}<#2\relax \do
+ {\advance\edfilldimen by \the \csname dcol\theaddcolcount\endcsname
+ \advance\edfilldimen by \edtabcolsep
+ \stepcounter{addcolcount}}%
+ \advance\edfilldimen by \the \csname dcol\theaddcolcount\endcsname
+ \fi
+}
+
+\newif\ifl@dstartendok
+\newcommand{\l@dcheckstartend}[2]{%
+ \l@dstartendoktrue
+ \ifnum #1<\@ne
+ \l@dstartendokfalse
+ \led@err@LowStartColumn
+ \fi
+ \ifnum #2>30\relax
+ \l@dstartendokfalse
+ \led@err@HighEndColumn
+ \fi
+ \ifnum #1>#2\relax
+ \l@dstartendokfalse
+ \led@err@ReverseColumns
+ \fi
+}
+
+\newcommand*{\edrowfill}[3]{%
+ \l@dtabaddcols{#1}{#2}%
+ \hb@xt@ \the\l@dcolwidth{\hb@xt@ \the\edfilldimen{#3}\hss}}
+\let\@edrowfill@=\edrowfill
+\def\@EDROWFILL@#1#2#3{\@edrowfill@{#1}{#2}{#3}}
+
+\newcommand{\leftltab}[1]{%
+ \hb@xt@\z@{\vbox{\edtabindent%
+ \moveleft\Hilfsskip\hbox{\ #1}}\hss}}
+
+\newcommand{\leftrtab}[2]{%
+ #2\hb@xt@\z@{\vbox{\edtabindent%
+ \advance\Hilfsskip by\dcoli%
+ \moveleft\Hilfsskip\hbox{\ #1}}\hss}}
+
+\newcommand{\leftctab}[2]{%
+ \hb@xt@\z@{\vbox{\edtabindent\l@dcolcount=\l@dampcount%
+ \advance\Hilfsskip by 0.5\dcoli%
+ \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
+ \disablel@dtabfeet$\displaystyle{#2}$}%
+ \advance\Hilfsskip by -0.5\wd\hilfsbox%
+ \moveleft\Hilfsskip\hbox{\ #1}}\hss}%
+ #2}
+
+\newcommand{\rightctab}[2]{%
+ \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
+ \disablel@dtabfeet#2}\l@dampcount=\l@dcolcount%
+ #1\hb@xt@\z@{\vbox{\edtabindent\l@dcolcount=\l@dampcount%
+ \advance\Hilfsskip by 0.5\l@dcolwidth%
+ \advance\Hilfsskip by -\wd\hilfsbox%
+ \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
+ \disablel@dtabfeet$\displaystyle{#1}$}%
+ \advance\Hilfsskip by -0.5\wd\hilfsbox%
+ \advance\Hilfsskip by \edtabcolsep%
+ \moveright\Hilfsskip\hbox{ #2}}\hss}%
+ }
+
+\newcommand{\rightltab}[2]{%
+ \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
+ \disablel@dtabfeet#2}\l@dampcount=\l@dcolcount%
+ #1\hb@xt@\z@{\vbox{\edtabindent\l@dcolcount=\l@dampcount%
+ \advance\Hilfsskip by\l@dcolwidth%
+ \advance\Hilfsskip by-\wd\hilfsbox%
+ \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
+ \disablel@dtabfeet$\displaystyle{#1}$}%
+ \advance\Hilfsskip by-\wd\hilfsbox%
+ \advance\Hilfsskip by\edtabcolsep%
+ \moveright\Hilfsskip\hbox{ #2}}\hss}%
+ }
+
+\newcommand{\rightrtab}[2]{%
+ \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
+ \disablel@dtabfeet#2}%
+ #1\hb@xt@\z@{\vbox{\edtabindent%
+ \advance\Hilfsskip by-\wd\hilfsbox%
+ \advance\Hilfsskip by\edtabcolsep%
+ \moveright\Hilfsskip\hbox{ #2}}\hss}%
+ }
+
+\newcommand{\rtab}[1]{%
+ \l@dnullfills
+ \def\edbeforetab##1##2{\leftrtab{##1}{##2}}%
+ \def\edaftertab##1##2{\rightrtab{##1}{##2}}%
+ \measurembody{#1}%
+ \l@drestorefills
+ \variab
+ \setmrowright #1\\&\\%
+ \enablel@dtabfeet}
+
+\newcommand{\measurembody}[1]{%
+ \disablel@dtabfeet%
+ \l@dcolcount=0%
+ \nullsetzen%
+ \l@dcolcount=0
+ \measuremrow #1\\&\\%
+ \global\l@dampcount=1}
+
+\newcommand{\rtabtext}[1]{%
+ \l@dnullfills
+ \measuretbody{#1}%
+ \l@drestorefills
+ \variab
+ \settrowright #1\\&\\%
+ \enablel@dtabfeet}
+
+\newcommand{\measuretbody}[1]{%
+ \disable@notes%
+ \disablel@dtabfeet%
+ \l@dcolcount=0%
+ \nullsetzen%
+ \l@dcolcount=0
+ \measuretrow #1\\&\\%
+ \restore@notes%
+ \global\l@dampcount=1}
+
+\newcommand{\ltab}[1]{%
+ \l@dnullfills
+ \def\edbeforetab##1##2{\leftltab{##1}{##2}}%
+ \def\edaftertab##1##2{\rightltab{##1}{##2}}%
+ \measurembody{#1}%
+ \l@drestorefills
+ \variab
+ \setmrowleft #1\\&\\%
+ \enablel@dtabfeet}
+
+\newcommand{\ltabtext}[1]{%
+ \l@dnullfills
+ \measuretbody{#1}%
+ \l@drestorefills
+ \variab
+ \settrowleft #1\\&\\%
+ \enablel@dtabfeet}
+
+\newcommand{\ctab}[1]{%
+ \l@dnullfills
+ \def\edbeforetab##1##2{\leftctab{##1}{##2}}%
+ \def\edaftertab##1##2{\rightctab{##1}{##2}}%
+ \measurembody{#1}%
+ \l@drestorefills
+ \variab
+ \setmrowcenter #1\\&\\%
+ \enablel@dtabfeet}
+
+\newcommand{\ctabtext}[1]{%
+ \l@dnullfills
+ \measuretbody{#1}%
+ \l@drestorefills
+ \variab
+ \settrowcenter #1\\&\\%
+ \enablel@dtabfeet}
+
+\newcommand{\spreadtext}[1]{%\l@dcolcount=\l@dampcount%
+ \hb@xt@ \the\l@dcolwidth{\hbox{#1}\hss}}
+\newcommand{\spreadmath}[1]{%
+ \hb@xt@ \the\l@dcolwidth{\hbox{$\displaystyle{#1}$}\hss}}
+
+\newskip\HILFSskip
+\newskip\Hilfsskip
+
+\newcommand{\EDTABINDENT}{%
+ \ifnum\l@dcolcount=30\let\NEXT\relax\l@dcolcount=0%
+ \else\stepl@dcolcount%
+ \advance\Hilfsskip by\l@dcolwidth%
+ \ifdim\l@dcolwidth=0pt\advance\hilfscount\@ne
+ \else\advance\Hilfsskip by \the\hilfscount\edtabcolsep%
+ \hilfscount=1\fi%
+ \let\NEXT=\EDTABINDENT%
+ \fi\NEXT}%
+\newcommand{\edtabindent}{%
+ \l@dcolcount=0\relax
+ \Hilfsskip=0pt%
+ \hilfscount=1\relax
+ \EDTABINDENT%
+ \hilfsskip=\hsize%
+ \advance\hilfsskip -\Hilfsskip%
+ \Hilfsskip=0.5\hilfsskip%
+ }%
+
+\def\EDTAB #1|#2|{%
+ \setbox\tabhilfbox=\hbox{$\displaystyle{#1}$}%
+ \setbox\tabHilfbox=\hbox{$\displaystyle{#2}$}%
+ \advance\tabelskip -\wd\tabhilfbox%
+ \advance\tabelskip -\wd\tabHilfbox%
+ \unhbox\tabhilfbox\hskip\tabelskip%
+ \unhbox\tabHilfbox}%
+
+\def\EDTABtext #1|#2|{%
+ \setbox\tabhilfbox=\hbox{#1}%
+ \setbox\tabHilfbox=\hbox{#2}%
+ \advance\tabelskip -\wd\tabhilfbox%
+ \advance\tabelskip -\wd\tabHilfbox%
+ \unhbox\tabhilfbox\hskip\tabelskip%
+ \unhbox\tabHilfbox}%
+\newbox\tabhilfbox
+\newbox\tabHilfbox
+
+\newenvironment{edarrayl}{\l@dcollect@body\ltab}{}
+\newenvironment{edarrayc}{\l@dcollect@body\ctab}{}
+\newenvironment{edarrayr}{\l@dcollect@body\rtab}{}
+
+\newenvironment{edtabularl}{\l@dcollect@body\ltabtext}{}
+\newenvironment{edtabularc}{\l@dcollect@body\ctabtext}{}
+\newenvironment{edtabularr}{\l@dcollect@body\rtabtext}{}
+
+\newcommand{\initnumbering@quote}{
+ \ifnoquotation@\else
+ \renewcommand{\quotation}{\par\leavevmode%
+ \parindent=1.5em%
+ \skipnumbering%
+ \ifautopar%
+ \vskip-\parskip%
+ \else%
+ \vskip\topsep%
+ \fi%
+ \global\leftskip=\leftmargin%
+ \global\rightskip=\leftmargin%
+ }
+ \renewcommand{\endquotation}{\par%
+ \global\leftskip=0pt%
+ \global\rightskip=0pt%
+ \leavevmode%
+ \skipnumbering%
+ \ifautopar%
+ \vskip-\parskip%
+ \else%
+ \vskip\topsep%
+ \fi%
+ }
+ \renewcommand{\quote}{\par\leavevmode%
+ \parindent=0pt%
+ \skipnumbering%
+ \ifautopar%
+ \vskip-\parskip%
+ \else%
+ \vskip\topsep%
+ \fi%
+ \global\leftskip=\leftmargin%
+ \global\rightskip=\leftmargin%
+ }
+ \renewcommand{\endquote}{\par%
+ \global\leftskip=0pt%
+ \global\rightskip=0pt%
+ \leavevmode%
+ \skipnumbering%
+ \ifautopar%
+ \vskip-\parskip%
+ \else%
+ \vskip\topsep%
+ \fi%
+ }
+ \fi
+}
+\newcommand{\ledsectnotoc}{\let\addcontentsline\@gobblethree}
+\newcommand{\ledsectnomark}{%
+ \let\chaptermark\@gobble%
+ \let\sectionmark\@gobble%
+ \let\subsectionmark\@gobble%
+}
+\catcode`\#=12
+\notbool{@noeled@sec}{%
+\ifl@dmemoir
+ \newcommand\beforeeledchapter{%
+ \clearforchapter%
+}
+\else
+ \newcommand\beforeeledchapter{%
+ \if@openright%
+ \cleardoublepage%
+ \else%
+ \clearpage%
+ \fi%
+}
+\fi
+\newif\if@eled@sectioning
+\def\print@rightmargin@eledsection{%
+ \if@eled@sectioning%
+ \begingroup%
+ \if@RTL%
+ \let\llap\rlap%
+ \let\leftlinenum\rightlinenum%
+ \let\leftlinenumR\rightlinenumR%
+ \let\l@drd@ta\l@dld@ta%
+ \let\l@drsn@te\l@dlsn@te%
+ \fi%
+ \hfill\l@drd@ta \csuse{LR}{\l@drsn@te}%
+ \endgroup%
+ \fi%
+}%
+
+\def\print@leftmargin@eledsection{%
+ \if@eled@sectioning%
+ \leavevmode%
+ \begingroup%
+ \if@RTL%
+ \let\rlap\llap%
+ \let\rightlinenum\leftlinenum%
+ \let\rightlinenumR\leftlinenumR%
+ \let\l@dld@ta\l@drd@ta%
+ \let\l@dlsn@te\l@drsn@te%
+ \fi%
+ \l@dld@ta\csuse{LR}{\l@dlsn@te}%
+ \endgroup%
+ \fi%
+}%
+
+\AtBeginDocument{%
+\patchcmd{\chapter}{\clearforchapter}{%
+ \if@eled@sectioning\else%
+ \ifl@dprintingpages\else%
+ \clearforchapter%
+ \fi%
+ \fi%
+ }
+ {}
+ {}
+
+\pretocmd{\M@sect}
+ {\let\old@edtext=\edtext%
+ \let\edtext=\dummy@edtext@showlemma%
+ }
+ {}
+ {}
+
+\apptocmd{\M@sect}
+ {\let\edtext=\old@edtext}
+ {}
+ {}
+
+\patchcmd{\M@sect}
+ { #9}
+ { #9%
+ \print@rightmargin@eledsection%
+ }
+ {}
+ {}
+
+\patchcmd{\M@sect}
+ {\hskip #3\relax}
+ {\hskip #3\relax%
+ \print@leftmargin@eledsection%
+ }
+ {}
+ {}
+
+\patchcmd{\@mem@old@ssect}
+ {#5}
+ {#5%
+ \print@leftmargin@eledsection%
+ }
+ {}
+ {}
+
+\patchcmd{\@mem@old@ssect}
+ {\hskip #1}
+ {\hskip #1%
+ \print@rightmargin@eledsection%
+ }
+ {}
+ {}
+
+\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{%
+ \if@eled@sectioning\else%
+ \ifl@dprintingpages\else%
+ \if@openright\cleardoublepage\else\clearpage\fi%No clearpage inside a \eledsection: will keep critical notes from printing on the title page.
+ \fi%
+ \fi%
+ }%
+ {}%
+ {}%
+
+\patchcmd{\@makechapterhead}
+ {#1}
+ {\print@leftmargin@eledsection%
+ #1%
+ \print@rightmargin@eledsection%
+ }
+ {}
+ {}
+
+\patchcmd{\@makechapterhead}% For BIDI
+ {\if@RTL\raggedleft\else\raggedright\fi}%
+ {\if@eled@sectioning\else%
+ \if@RTL\raggedleft\else\raggedright\fi%
+ \fi%
+ }%
+ {}%
+ {}%
+
+\patchcmd{\@makeschapterhead}
+ {#1}
+ {\print@leftmargin@eledsection%
+ #1%
+ \print@rightmargin@eledsection%
+ }
+ {}
+ {}
+
+\pretocmd{\@sect}
+ {\let\old@edtext=\edtext
+ \let\edtext=\dummy@edtext@showlemma%
+ }
+ {}
+ {}
+
+\apptocmd{\@sect}
+ {\let\edtext=\old@edtext}
+ {}
+ {}
+
+\pretocmd{\@ssect}
+ {\let\old@edtext=\edtext%
+ \let\edtext=\dummy@edtext@showlemma%
+ }
+ {}
+ {}
+
+\apptocmd{\@ssect}
+ {\let\edtext=\old@edtext}
+ {}
+ {}
+
+\@ifpackageloaded{nameref}{
+
+ \patchcmd{\NR@sect}
+ {#8}
+ {#8%
+ \print@rightmargin@eledsection%
+ }
+ {}
+ {}
+
+ \patchcmd{\NR@sect}
+ {\hskip #3\relax}
+ {\hskip #3\relax%
+ \print@leftmargin@eledsection%
+ }
+ {}
+ {}
+
+ \patchcmd{\NR@ssect}
+ {#5}
+ {#5%
+ \print@rightmargin@eledsection%
+ }
+ {}
+ {}
+
+ \patchcmd{\NR@ssect}
+ {\hskip #1}
+ {\hskip #1%
+ \print@leftmargin@eledsection%
+ }
+ {}
+ {}
+ }%
+ {
+ \patchcmd{\@sect}
+ {#8}
+ {#8%
+ \print@rightmargin@eledsection%
+ }
+ {}
+ {}
+
+ \patchcmd{\@sect}
+ {\hskip #3\relax}
+ {\hskip #3\relax%
+ \print@leftmargin@eledsection%
+ }
+ {}
+ {}
+
+ \patchcmd{\@ssect}
+ {#5}
+ {#5%
+ \print@rightmargin@eledsection%
+ }
+ {}
+ {}
+
+ \patchcmd{\@ssect}
+ {\hskip #1}
+ {\hskip #1%
+ \print@leftmargin@eledsection%
+ }
+ {}
+ {}
+ }%
+}
+{}}%
+\protect\catcode`\#=6 %Space NEEDS by \catcode
+\notbool{@noeled@sec}{%
+\newwrite\eled@sectioning@out
+\newcommand{\eledchapter}[2][]{%
+ #2%
+ \ifledRcol%
+ \immediate\write\eled@sectioningR@out{%
+ \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R}
+ }%
+ \else%
+ \immediate\write\eled@sectioning@out{%
+ \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{}
+ }%
+ \fi%
+}
+
+\newcommand{\eledsection}[2][]{%
+ #2%
+ \ifledRcol%
+ \immediate\write\eled@sectioningR@out{%
+ \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R}
+ }%
+ \else%
+ \immediate\write\eled@sectioning@out{%
+ \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{}
+ }%
+ \fi%
+}
+
+\newcommand{\eledsubsection}[2][]{%
+ #2%
+ \ifledRcol%
+ \immediate\write\eled@sectioningR@out{%
+ \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R}
+ }%
+ \else%
+ \immediate\write\eled@sectioning@out{%
+ \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{}
+ }%
+ \fi%
+}
+\newcommand{\eledsubsubsection}[2][]{%
+ #2%
+ \ifledRcol%
+ \immediate\write\eled@sectioningR@out{%
+ \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R}
+ }%
+ \else%
+ \immediate\write\eled@sectioning@out{%
+ \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{}
+ }%
+ \fi%
+}
+
+\WithSuffix\newcommand\eledchapter*[2][]{%
+ #2%
+ \ifledRcol%
+ \immediate\write\eled@sectioningR@out{%
+ \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R}
+ }%
+ \else%
+ \immediate\write\eled@sectioning@out{%
+ \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{}
+ }%
+ \fi%
+}
+
+\WithSuffix\newcommand\eledsection*[2][]{%
+ #2%
+ \ifledRcol%
+ \immediate\write\eled@sectioningR@out{%
+ \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R}
+ }%
+ \else%
+ \immediate\write\eled@sectioning@out{%
+ \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{}
+ }%
+ \fi%
+}
+
+\WithSuffix\newcommand\eledsubsection*[2][]{%
+ #2%
+ \ifledRcol%
+ \immediate\write\eled@sectioningR@out{%
+ \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R}
+ }%
+ \else%
+ \immediate\write\eled@sectioning@out{%
+ \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{}
+ }%
+ \fi%
+}
+
+\WithSuffix\newcommand\eledsubsubsection*[2][]{%
+ #2%
+ \ifledRcol%
+ \immediate\write\eled@sectioningR@out{%
+ \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R}
+ }%
+ \else%
+ \immediate\write\eled@sectioning@out{%
+ \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{}
+ }%
+ \fi%
+}
+\def\eled@chapter#1#2#3#4#5{%
+ \ifstrempty{#4}%
+ {%
+ \ifstrempty{#1}%
+ {%
+ \global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext@showlemma\chapter{#2}}%
+ \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\chaptermark{#2}}%
+ }%Need for \pairs, because of using parbox.
+ {%
+ \global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext@showlemma\chapter[#1]{#2}}%
+ \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\chaptermark{#2}}%Need for \pairs, because of using parbox.
+ }%
+ }%
+ {%
+ \ifstrempty{#1}%
+ {\global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext@showlemma\chapter*{#2}}}%
+ {\global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext@showlemma\chapter*[#1]{#2}}}%Bug in LaTeX!
+ }%
+ \listcsgadd{eled@sections#5@@}{#3}%
+ }
+\def\eled@section#1#2#3#4#5{%
+ \ifstrempty{#4}%
+ {\ifstrempty{#1}%
+ {%
+ \global\csdef{eled@sectioning@#3#5}{\section{#2}}%
+ \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\sectionmark{#2}}%Need for \pairs, because of using parbox.
+ }%
+ {%
+ \global\csdef{eled@sectioning@#3#5}{\section[#1]{#2}}%
+ \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\sectionmark{#1}}%Need for \pairs, because of using parbox.
+ }%
+ }%
+ {\ifstrempty{#1}%
+ {\global\csdef{eled@sectioning@#3#5}{\section*{#2}}}%
+ {\global\csdef{eled@sectioning@#3#5}{\section*[#1]{#2}}}%Bug in LaTeX!
+ }
+ \listcsgadd{eled@sections#5@@}{#3}%
+ }
+\def\eled@subsection#1#2#3#4#5{%
+ \ifstrempty{#4}%
+ {\ifstrempty{#1}%
+ {%
+ \global\csdef{eled@sectioning@#3#5}{\subsection{#2}}%
+ \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\csuse{subsectionmark}{#2}}%Need for \pairs, because of using parbox. \csuse in case of \subsectionmark is not defined (book)
+ }%
+ {%
+ \global\csdef{eled@sectioning@#3#5}{\subsection[#1]{#2}}%
+ \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\csuse{subsectionmark}{#1}}%Need for \pairs, because of using parbox. \csuse in case of \subsectionmark is not defined (book)
+ }%
+ }%
+ {\ifstrempty{#1}%
+ {\global\csdef{eled@sectioning@#3#5}{\subsection*{#2}}}%
+ {\global\csdef{eled@sectioning@#3#5}{\subsection*[#1]{#2}}}%Bug in LaTeX!
+ }
+ \listcsgadd{eled@sections#5@@}{#3}%
+ }
+\def\eled@subsubsection#1#2#3#4#5{%
+ \ifstrempty{#4}%
+ {\ifstrempty{#1}%
+ {\global\csdef{eled@sectioning@#3#5}{\subsubsection{#2}}}%
+ {\global\csdef{eled@sectioning@#3#5}{\subsubsection[#1]{#2}}}%
+ }%
+ {\ifstrempty{#1}%
+ {\global\csdef{eled@sectioning@#3#5}{\subsubsection*{#2}}}%
+ {\global\csdef{eled@sectioning@#3#5}{\subsubsection*[#1]{#2}}}%Bug in LaTeX!
+ }
+ \listcsgadd{eled@sections#5@@}{#3}%
+ }
+
+}{}
+\def\normal@page@break{}
+\def\l@prev@pb{}
+\def\l@prev@nopb{}
+\newcommand{\ledpb}{\write\linenum@out{\string\led@pb}}
+\newcommand{\ledpbnum}[1]{\write\linenum@out{\string\led@pbnum{#1}}}
+\newcommand{\lednopb}{\write\linenum@out{\string\led@nopb}}
+\newcommand{\lednopbnum}[1]{\write\linenum@out{\string\led@nopbnum{#1}}}
+\newcommand{\led@pb}{\listxadd{\l@prev@pb}{\the\absline@num}}
+\newcommand{\led@pbnum}[1]{\listxadd{\l@prev@pb}{#1}}
+\newcommand{\led@nopb}{\listxadd{\l@prev@nopb}{\the\absline@num}}
+\newcommand{\led@nopbnum}[1]{\listxadd{\l@prev@nopb}{#1}}
+\def\led@pb@setting{before}
+\newcommand{\ledpbsetting}[1]{\gdef\led@pb@setting{#1}}
+\newcommand{\led@check@pb}{\xifinlist{\the\absline@num}{\l@prev@pb}{\pagebreak[4]}{}}
+\newcommand{\led@check@nopb}{%
+ \IfStrEq{\led@pb@setting}{before}{%
+ \xifinlist{\the\absline@num}{\l@prev@nopb}%
+ {\numdef{\abs@prevline}{\the\absline@num-1}%
+ \xifinlist{\abs@prevline}{\normal@page@break}%
+ {\nopagebreak[4]\enlargethispage{\baselineskip}}%
+ {}}%
+ {}}%
+ {}%
+ {}%
+ \IfStrEq{\led@pb@setting}{after}{%
+ \xifinlist{\the\absline@num}{\l@prev@nopb}{%
+ \xifinlist{\the\absline@num}{\normal@page@break}%
+ {\nopagebreak[4]\enlargethispage{\baselineskip}}%
+ {}%
+}%
+ {}}%
+ {}%
+ {}%
+}
+\newcommand{\check@pb@in@verse}{%
+ \ifinstanza\iflednopbinverse\ifinserthangingsymbol% Using stanzas and enabling page breaks in verse control, while on a hanging verse.
+ \ifnum\page@num=\last@page@num\else%If we have change page
+ \IfStrEq{\led@pb@setting}{before}{%
+ \numgdef{\abs@line@verse}{\the\absline@num-1}%
+ \ledpbnum{\abs@line@verse}%
+ }{}%
+ \IfStrEq{\led@pb@setting}{after}{%
+ \numgdef{\abs@line@verse}{\the\absline@num-1}%
+ \lednopbnum{\abs@line@verse}%
+ }{}%
+ \fi%
+ \fi\fi\fi%
+}
+\ifeledmaccompat@%
+
+\newcommand{\footnormalX}[1]{\arrangementX[#1]{normal}}%
+\newcommand{\footparagraphX}[1]{\arrangementX[#1]{paragraph}}%
+\newcommand{\foottwocolX}[1]{\arrangementX[#1]{twocol}}%
+\newcommand{\footthreecolX}[1]{\XarrangementX[#1]{threecol}}%
+
+\unless\ifnocritical@
+ \newcommand{\footnormal}[1]{\Xarrangement[#1]{normal}}%
+ \newcommand{\footparagraph}[1]{\Xarrangement[#1]{paragraph}}%
+ \newcommand{\foottwocol}[1]{\Xarrangement[#1]{twocol}}%
+ \newcommand{\footthreecol}[1]{\Xarrangement[#1]{threecol}}%
+ \let\hsizetwocol\Xhsizetwocol
+ \let\hsizethreecol\Xhsizethreecol
+ \let\bhookXnote\Xbhooknote
+ \let\boxsymlinenum\Xboxsymlinenum
+ \let\symlinenum\Xsymlinenum
+ \let\beforenumberinfootnote\Xbeforenumber
+ \let\afternumberinfootnote\Xafternumber
+ \let\beforeXsymlinenum\Xbeforesymlinenum
+ \let\afterXsymlinenum\Xaftersymlinenum
+ \let\inplaceofnumber\Xinplaceofnumber
+ \let\Xlemmaseparator\lemmaseparator
+ \let\afterlemmaseparator\Xafterlemmaseparator
+ \let\beforelemmaseparator\Xbeforelemmaseparator
+ \let\inplaceoflemmaseparator\Xinplaceoflemmaseparator
+ \let\txtbeforeXnotes\Xtxtbeforenotes
+ \let\afterXrule\Xafterrule
+ \let\numberonlyfirstinline\Xnumberonlyfirstinline
+ \let\numberonlyfirstintwolines\Xnumberonlyfirstintwolines
+ \let\nonumberinfootnote\Xnonumberinfootnote
+ \let\pstartinfootnote\Xpstart
+ \let\pstartinfootnoteeverytime\Xpstarteverytime
+ \let\onlyXpstart\Xonlypstart
+ \let\Xnonumberinfootnote\Xnonumber
+ \let\nonbreakableafternumber\Xnonbreakableafternumber
+ \let\maxhXnotes\Xmaxhnotes
+ \let\beforeXnotes\Xbeforenotes
+ \let\boxlinenum\Xboxlinenum
+ \let\boxlinenumalign\Xboxlinenumaligm
+ \let\boxstartlinenum\Xboxstartlinenum
+ \let\boxendlinenum\Xboxendlinenum
+ \let\twolines\Xtwolines
+ \let\morethantwolines\Xmorethantwolines
+ \let\twolinesbutnotmore\Xtwolinesbutnotmore
+ \let\twolinesonlyinsamepage\Xtwolinesonlyinsamepage
+ \fi
+
+ \unless\ifnofamiliar@
+ \let\notesXwidthliketwocolumns\noteswidthliketwocolumnsX
+ \fi
+ \newcommandx[2][1,usedefault]{\parafootsep}{%
+ \Xparafootsep[#1]{#2}%
+ \parafootsepX[#1]{#2}
+ }%
+
+ \newcommandx[2][1,usedefault]{\afternote}{%
+ \Xafternote[#1]{#2}%
+ \afternoteX[#1]{#2}%
+ }%
+
+ \unless\ifnoend@
+ \let\XendXtwolines\Xendtwolines
+ \let\XendXmorethantwolines\Xendmorethantwolines
+ \let\bhookXendnote\Xendbhooknote
+ \let\boxXendlinenum\Xendboxlinenum%
+ \let\boxXendlinenumalign\Xendboxlinenumalign%
+ \let\boxXendstartlinenum\Xendboxstartlinenum%
+ \let\boxXendendlinenum\Xendboxendlinenum%
+ \let\XendXlemmaseparator\Xendlemmaseparator
+ \let\XendXbeforelemmaseparator\Xendbeforelemmaseparator
+ \let\XendXafterlemmaseparator\Xendafterlemmaseparator
+ \let\XendXinplaceoflemmaseparator\Xendinplaceoflemmaseparator
+ \fi
+
+ \AtBeginDocument{%
+ \ifdef\lineref{}{\let\lineref\edlineref}%
+ }%
+
+ \fi%
+\endinput
+%%
+%% End of file `reledmac.sty'.
diff --git a/Master/texmf-dist/tex/latex/reledmac/reledpar.sty b/Master/texmf-dist/tex/latex/reledmac/reledpar.sty
new file mode 100644
index 00000000000..c117a68534c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/reledmac/reledpar.sty
@@ -0,0 +1,2491 @@
+%%
+%% This is file `reledpar.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% reledpar.dtx (with options: `code')
+%%
+%% Author: Author: Peter Wilson ; Herries Press herries dot press at earthlink dot net ; Maïeul Rouquette maieul at maieul dot net
+%% Copyright 2004, 2005 Peter R. Wilson
+%% 2011- Maïeul Rouquette
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 of this license or (at your option) any
+%% later version.
+%% The latest version of the license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2003/06/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This work consists of the files listed in the README file.
+%%
+
+
+
+
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{reledpar}[2015/07/19 v2.0.0 reledmac extension for parallel texts]%
+
+\RequirePackage{xspace}%
+\newif\ifshiftedpstarts
+\DeclareOption{shiftedpstarts}{\shiftedpstartstrue}
+\DeclareOption{parledgroup}{\parledgrouptrue}
+\DeclareOption{widthliketwocolumns}{\widthliketwocolumnstrue}%
+\newif\ifsameparallelpagenumber%
+\DeclareOption{sameparallelpagenumber}{\sameparallelpagenumbertrue}%
+\ProcessOptions%
+\newdimen\Lcolwidth
+ \Lcolwidth=0.45\textwidth
+\newdimen\Rcolwidth
+ \Rcolwidth=0.45\textwidth
+\newcommand{\reledpar@error}[2]{\PackageError{reledpar}{#1}{#2}}
+\newcommand*{\led@err@TooManyPstarts}{%
+ \reledpar@error{Too many \string\pstart\space without printing.
+ Some text will be lost}{\@ehc}}
+\newcommand*{\led@err@BadLeftRightPstarts}[2]{%
+ \reledpar@error{The numbers of left (#1) and right (#2)
+ \string\pstart s do not match}{\@ehc}}
+\newcommand*{\led@err@LeftOnRightPage}{%
+ \reledpar@error{The left page has ended on a right page}{\@ehc}}
+\newcommand*{\led@err@RightOnLeftPage}{%
+ \reledpar@error{The right page has ended on a left page}{\@ehc}}
+\newcommand*{\led@err@Leftside@PreviousNotPrinted}{%
+ \reledpar@error{You call a new Leftside environment while the previous one has not been typeset by \string\Pages\space or \string\Columns}{\@ehc}}
+\newcommand*{\led@err@Rightside@PreviousNotPrinted}{%
+ \reledpar@error{You call a new Rightside environment while the previous one has not been typeset by \string\Pages\space or \string\Columns}{\@ehc}}
+\newcommand*{\led@err@Pages@InsideEnv}{%
+ \reledpar@error{\string\Pages\space must be called *outside* of the `pages` environment}{\@ehc}}
+\newcommand*{\led@err@Columns@InsideEnv}{%
+ \reledpar@error{\string\Columns\space must be called *outside* of the `pairs` environment}{\@ehc}}
+\newcommand{\led@error@fail@patch@thepage}{%
+ \reledpar@error{Fail to patch \string\@thepage\space command.}{\@ehc}%
+}%
+\newcommand{\led@error@fail@patch@pagenumbering}{%
+ \reledpar@error{Fail to patch \string\pagenumbering\space command.}{\@ehc}%
+}%
+\newcommand{\led@error@fail@patch@@outputpage}{%
+ \reledpar@error{Fail to patch \string\@outputpage\space command.}{\@ehc}%
+}%
+\newcount\section@numR
+ \section@numR=\z@
+ \pst@rtedLfalse
+\newif\ifpst@rtedR
+
+\newcommand*{\beginnumberingR}{%
+ \ifnumberingR
+ \led@err@NumberingStarted
+ \endnumberingR
+ \fi
+ \global\l@dnumpstartsR \z@
+ \global\pst@rtedRfalse
+ \global\numberingRtrue
+ \global\advance\section@numR \@ne
+ \global\absline@numR \z@
+ \gdef\normal@page@breakR{}
+ \gdef\l@prev@pbR{}
+ \gdef\l@prev@nopbR{}
+ \global\line@numR \z@
+ \global\@lockR \z@
+ \global\sub@lockR \z@
+ \global\sublines@false
+ \global\let\next@page@numR\relax
+ \global\let\sub@change\relax
+ \message{Section \the\section@numR R }%
+ \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
+ \l@dend@stuff
+ \setcounter{pstartR}{1}
+ \begingroup
+ \initnumbering@sectcountR
+ \gdef\eled@sectionsR@@{}%
+ \if@noeled@sec\else%
+ \makeatletter\InputIfFileExists{\jobname.eledsec\the\section@numR R}{}{}\makeatother%
+ \immediate\openout\eled@sectioningR@out=\jobname.eledsec\the\section@numR R\relax%
+ \fi%
+}
+\def\endnumberingR{%
+ \ifnumberingR
+ \global\numberingRfalse
+ \normal@pars
+ \ifnum\l@dnumpstartsR=0%
+ \led@err@NumberingWithoutPstart%
+ \fi%
+ \ifl@dpairing
+ \global\pst@rtedRfalse
+ \else
+ \ifx\insertlines@listR\empty\else
+ \global\noteschanged@true
+ \fi
+ \ifx\line@listR\empty\else
+ \global\noteschanged@true
+ \fi
+ \fi
+ \ifnoteschanged@
+ \led@mess@NotesChanged
+ \fi
+ \else
+ \led@err@NumberingNotStarted
+ \fi
+ \endgroup
+ \if@noeled@sec\else%
+ \immediate\closeout\eled@sectioningR@out%
+ \fi%
+ }
+
+\newcounter{chapterR}
+\newcounter{sectionR}
+\newcounter{subsectionR}
+\newcounter{subsubsectionR}
+\newcommand{\initnumbering@sectcountR}{
+ \let\c@chapter\c@chapterR
+ \let\c@section\c@sectionR
+ \let\c@subsection\c@subsectionR
+ \let\c@subsubsection\c@subsubsectionR
+}
+\newcommand*{\pausenumberingR}{%
+ \endnumberingR\global\numberingRtrue}
+\newcommand*{\resumenumberingR}{%
+ \ifnumberingR
+ \global\pst@rtedRtrue
+ \global\advance\section@numR \@ne
+ \led@mess@SectionContinued{\the\section@numR R}%
+ \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
+ \l@dend@stuff
+ \begingroup%
+ \initnumbering@sectcountR%
+ \else
+ \led@err@numberingShouldHaveStarted
+ \endnumberingR
+ \beginnumberingR
+ \fi}
+
+\newcommand*{\memorydumpL}{%
+ \endnumbering
+ \numberingtrue
+ \global\pst@rtedLtrue
+ \global\advance\section@num \@ne
+ \led@mess@SectionContinued{\the\section@num}%
+ \line@list@stuff{\jobname.\extensionchars\the\section@num}%
+ \l@dend@stuff}
+
+\newcommand*{\memorydumpR}{%
+ \endnumberingR
+ \numberingRtrue
+ \global\pst@rtedRtrue
+ \global\advance\section@numR \@ne
+ \led@mess@SectionContinued{\the\section@numR R}%
+ \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
+ \l@dend@stuff}
+
+
+
+\newcommand*{\lineationR}[1]{{%
+ \ifnumbering
+ \led@err@LineationInNumbered
+ \else
+ \def\@tempa{#1}\def\@tempb{page}%
+ \ifx\@tempa\@tempb
+ \global\bypage@Rtrue
+ \global\bypstart@Rfalse
+ \unless\ifnocritical@%
+ \Xpstart[][false]%
+ \fi%
+ \else
+ \def\@tempb{pstart}%
+ \ifx\@tempa\@tempb
+ \global\bypage@Rfalse
+ \global\bypstart@Rtrue
+ \unless\ifnocritical@%
+ \Xpstart%
+ \fi%
+ \else
+ \def@tempb{section}
+ \ifx\@tempa\@tempb
+ \global\bypage@Rfalse%
+ \global\bypstart@Rfalse%
+ \unless\ifnocritical@%
+ \Xpstart[][false]%
+ \fi%
+ \else
+ \led@warn@BadLineation
+ \fi%
+ \fi
+ \fi
+ \fi}}
+\WithSuffix\newcommand\lineation*[1]{%
+ \lineation{#1}%
+ \lineationR{#1}%
+}%
+
+\newcount\line@marginR
+\line@marginR=\@ne
+
+\newcounter{firstlinenumR}
+ \setcounter{firstlinenumR}{5}
+\newcounter{linenumincrementR}
+ \setcounter{linenumincrementR}{5}
+\newcounter{firstsublinenumR}
+ \setcounter{firstsublinenumR}{5}
+\newcounter{sublinenumincrementR}
+ \setcounter{sublinenumincrementR}{5}
+
+\WithSuffix\newcommand\firstlinenum*[1]{%
+ \setcounter{firstlinenumR}{#1}%
+ \setcounter{firstlinenum}{#1}%
+}
+\WithSuffix\newcommand\linenumincrement*[1]{%
+ \setcounter{linenumincrementR}{#1}%
+ \setcounter{linenumincrement}{#1}%
+}
+\WithSuffix\newcommand\firstsublinenum*[1]{%
+ \setcounter{subfirstlinenumR}{#1}%
+ \setcounter{subfirstlinenum}{#1}%
+}
+\WithSuffix\newcommand\sublinenumincrement*[1]{%
+ \setcounter{sublinenumincrementR}{#1}%
+ \setcounter{sublinenumincrement}{#1}%
+}
+\newcommand{\setRlineflag}[1]{%
+ \gdef\@Rlineflag{#1}%
+}
+\setRlineflag{R}
+\newcommand*{\linenumrepR}[1]{\@arabic{#1}}
+\newcommand*{\sublinenumrepR}[1]{\@arabic{#1}}
+
+\newcommand*{\leftlinenumR}{%
+ \l@dlinenumR
+ \kern\linenumsep}
+\newcommand*{\rightlinenumR}{%
+ \kern\linenumsep
+ \l@dlinenumR}
+\newcommand*{\l@dlinenumR}{%
+ \numlabfont\linenumrepR{\line@numR}\@Rlineflag%
+ \ifsublines@
+ \ifnum\subline@num>\z@
+ \unskip\fullstop\sublinenumrepR{\subline@numR}%
+ \fi
+ \fi}
+
+\newcount\line@numR
+\newcount\subline@numR
+\newcount\absline@numR
+
+\list@create{\line@listR}
+\list@create{\insertlines@listR}
+\list@create{\actionlines@listR}
+\list@create{\actions@listR}
+
+\newcount\page@numR
+
+\list@create{\linesinpar@listL}
+\list@create{\linesinpar@listR}
+\list@create{\maxlinesinpar@list}
+
+\newcommand{\list@clearing@regR}{%
+ \list@clear{\line@listR}%
+ \list@clear{\insertlines@listR}%
+ \list@clear{\actionlines@listR}%
+ \list@clear{\actions@listR}%
+ \list@clear{\linesinpar@listR}%
+ \list@clear{\linesonpage@listR}
+}
+\newcommand{\@nl@regR}{%
+ \ifx\l@dchset@num\relax \else
+ \advance\absline@numR \@ne
+ \set@line@action
+ \let\l@dchset@num\relax
+ \advance\absline@numR \m@ne
+ \advance\line@numR \m@ne% % do we need this?
+ \fi
+ \advance\absline@numR \@ne
+ \ifx\next@page@numR\relax \else
+ \page@action
+ \let\next@page@numR\relax
+ \fi
+ \ifx\sub@change\relax \else
+ \ifnum\sub@change>\z@
+ \sublines@true
+ \else
+ \sublines@false
+ \fi
+ \sub@action
+ \let\sub@change\relax
+ \fi
+ \ifcase\@lockR
+ \or
+ \@lockR \tw@
+ \or\or
+ \@lockR \z@
+ \fi
+ \ifcase\sub@lockR
+ \or
+ \sub@lockR \tw@
+ \or\or
+ \sub@lockR \z@
+ \fi
+ \ifsublines@
+ \ifnum\sub@lockR<\tw@
+ \advance\subline@numR \@ne
+ \fi
+ \else
+ \ifnum\@lockR<\tw@
+ \advance\line@numR \@ne \subline@numR \z@
+ \fi
+ \fi}
+
+\newcount\last@page@numR
+ \last@page@numR=-10000
+
+
+
+
+\newcount\@lockR
+\newcount\sub@lockR
+
+\newcommand*{\do@lockonR}{%
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \ifsublines@
+ \xright@appenditem{-1005}\to\actions@listR
+ \ifnum\sub@lockR=\z@
+ \sub@lockR \@ne
+ \else
+ \ifnum\sub@lockR=\thr@@
+ \sub@lockR \@ne
+ \fi
+ \fi
+ \else
+ \xright@appenditem{-1003}\to\actions@listR
+ \ifnum\@lockR=\z@
+ \@lockR \@ne
+ \else
+ \ifnum\@lockR=\thr@@
+ \@lockR \@ne
+ \fi
+ \fi
+ \fi}
+
+
+\newcommand{\do@lockoffR}{%
+ \xright@appenditem{\the\absline@numR}\to\actionlines@listR
+ \ifsublines@
+ \xright@appenditem{-1006}\to\actions@listR
+ \ifnum\sub@lockR=\tw@
+ \sub@lockR \thr@@
+ \else
+ \sub@lockR \z@
+ \fi
+ \else
+ \xright@appenditem{-1004}\to\actions@listR
+ \ifnum\@lockR=\tw@
+ \@lockR \thr@@
+ \else
+ \@lockR \z@
+ \fi
+ \fi}
+
+\newcount\insert@countR
+\newcommand*{\@ref@regR}[2]{%
+ \global\advance\@edtext@level by 1%
+ \global\insert@countR=#1\relax
+ \loop\ifnum\insert@countR>\z@
+ \xright@appenditem{\the\absline@numR}\to\insertlines@listR
+ \global\advance\insert@countR \m@ne
+ \repeat
+ \begingroup
+ \let\@ref=\dummy@ref
+ \let\@lopR\@gobble
+ \let\page@action=\relax
+ \let\sub@action=\relax
+ \let\set@line@action=\relax
+ \let\@lab=\relax
+ \let\@lemma=\relax
+ \let\@sw\@gobblethree%
+ #2
+ \global\endpage@num=\page@numR
+ \global\endline@num=\line@numR
+ \global\endsubline@num=\subline@numR
+ \endgroup
+ \xright@appenditem%
+ {\the\page@numR|\the\line@numR|%
+ \ifsublines@ \the\subline@numR \else 0\fi|%
+ \the\endpage@num|\the\endline@num|%
+ \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@listR
+ \expandafter\list@create\expandafter{\csname sw@list@edtext@tmp@\the\@edtext@level\endcsname}%
+ \providebool{lemmacommand@\the\@edtext@level}%
+ \boolfalse{lemmacommand@\the\@edtext@level}%
+ #2
+ \ifnum\@edtext@level>0%
+ \def\create@this@edtext@level{\expandafter\list@create\expandafter{\csname sw@list@edtextR@\the\@edtext@level\endcsname}}%
+ \ifcsundef{sw@list@edtextR@\the\@edtext@level}{\create@this@edtext@level}{}%
+ \letcs{\@tmp}{sw@list@edtextR@\the\@edtext@level}%
+ \letcs{\@tmpp}{sw@list@edtext@tmp@\the\@edtext@level}%
+ \xright@appenditem{\expandonce\@tmpp}\to\@tmp%
+ \global\cslet{sw@list@edtextR@\the\@edtext@level}{\@tmp}%
+ \fi%
+ \global\advance\@edtext@level by -1%
+}
+\renewcommand*{\@pend}[1]{%
+ \ifbypstart@\global\line@num=0\fi%
+ \xright@appenditem{#1}\to\linesinpar@listL}
+\renewcommand*{\@pendR}[1]{%
+ \ifbypstart@R\global\line@numR=0\fi
+ \xright@appenditem{#1}\to\linesinpar@listR}
+
+\renewcommand*{\@lopL}[1]{%
+ \xright@appenditem{#1}\to\linesonpage@listL}
+\renewcommand*{\@lopR}[1]{%
+ \xright@appenditem{#1}\to\linesonpage@listR}
+
+\newwrite\linenum@outR
+\newif\iffirst@linenum@out@R
+ \first@linenum@out@Rtrue
+\newcommand*{\line@list@stuffR}[1]{%
+ \read@linelist{#1}%
+ \iffirst@linenum@out@R
+ \immediate\closeout\linenum@outR
+ \global\first@linenum@out@Rfalse
+ \immediate\openout\linenum@outR=#1
+ \immediate\write\linenum@outR{\string\line@list@version{\this@line@list@version}}%
+ \else
+ \if@minipage%
+ \leavevmode%
+ \fi%
+ \closeout\linenum@outR%
+ \openout\linenum@outR=#1%
+ \fi}
+
+\newcommand*{\new@lineL}{%
+ \write\linenum@out{\string\@nl[\the\c@page][\thepage]}}
+\newcommand*{\new@lineR}{%
+ \write\linenum@outR{\string\@nl[\the\c@page][\thepage]}}
+
+\newcommand{\newseries@par}[1]{%
+ \unless\ifnofamiliar@%
+ \csgdef{onlysideX@#1}{}%
+ \global\newbool{keepforsideX@#1}%
+ \fi%
+ \unless\ifnocritical@%
+ \global\newbool{keepforXside@#1}%
+ \csgdef{Xonlyside@#1}{}%
+ \fi%
+ \unless\ifnofamiliar@%
+ \expandafter\list@create\csname footnote#1@mk\endcsname%
+ \expandafter\newcommand\csname footnote#1nomk\endcsname[1]{%
+ \toggletrue{nomk@}%
+ \csuse{footnote#1}{##1}%
+ \togglefalse{nomk@}%
+ \letcs{\@tmp}{footnote#1@mk}%
+ \numdef\@tmpa{\csuse{c@footnote#1}}%
+ \global\xright@appenditem{\@tmpa}\to\@tmp%
+ \global\cslet{footnote#1@mk}{\@tmp}%
+ }%
+ \expandafter\newcommand\csname footnote#1mk\endcsname{%
+ \letcs{\@tmp}{footnote#1@mk}%
+ \gl@p\@tmp\to\@tmpa%
+ \global\cslet{footnote#1@mk}{\@tmp}%
+ \letcs{\old@footnote}{c@footnote#1}%
+ \setcounter{footnote#1}{\@tmpa}%
+ \protected@csxdef{@thefnmark#1}{\csuse{thefootnote#1}}%
+ \csuse{@footnotemark#1}%
+ \setcounter{footnote#1}{\old@footnote}%
+ \xspace%
+ }%
+ \fi
+}%
+\unless\ifnocritical@%
+ \newhookcommand@series{Xonlyside}%
+\fi%
+\unless\ifnofamiliar@%
+ \newhookcommand@series{onlysideX}%
+\fi
+
+\newcommand{\init@series@par}{%
+ \def\do##1{\newseries@par{##1}}%
+ \dolistloop{\@series}%
+}%
+\init@series@par%
+
+\list@create{\list@pstartL@pc}%
+\list@create{\list@pstartR@pc}%
+\def\dump@pstartL@pc{%
+ \xright@appenditem{\the\c@pstartL}\to\list@pstartL@pc%
+ \global\cslet{numberpstart@L\the\l@dnumpstartsL}{\ifnumberpstart}%
+}%
+
+\def\dump@pstartR@pc{%
+ \xright@appenditem{\the\c@pstartR}\to\list@pstartR@pc%
+ \global\cslet{numberpstart@R\the\l@dnumpstartsR}{\ifnumberpstart}%
+}%
+
+\def\restore@pstartL@pc{%
+ \ifx\list@pstartL@pc\empty\else%
+ \gl@p\list@pstartL@pc\to\@temp%
+ \global\c@pstartL=\@temp%
+ \fi%
+}%
+\def\restore@pstartR@pc{%
+ \ifx\list@pstartR@pc\empty\else%
+ \gl@p\list@pstartR@pc\to\@temp%
+ \global\c@pstartR=\@temp%
+ \fi%
+}%
+\newenvironment{pairs}{%}
+ \l@dpairingtrue
+ \l@dpagingfalse
+ \initnumbering@quote
+ \at@begin@pairs%
+}{%
+ \l@dpairingfalse
+}
+
+\newcommand{\AtBeginPairs}[1]{\xdef\at@begin@pairs{#1}}%
+\def\at@begin@pairs{}%
+
+\newenvironment{pages}{%
+ \l@dpairingtrue
+ \l@dpagingtrue
+ \initnumbering@quote
+ \setlength{\Lcolwidth}{\textwidth}%
+ \setlength{\Rcolwidth}{\textwidth}%
+}{%
+ \l@dpairingfalse
+ \l@dpagingfalse
+}
+
+ \newif\ifinstanzaL
+ \newif\ifinstanzaR
+\newenvironment{Leftside}{%
+ \expandafter\ifvoid\csname l@dLcolrawbox1\endcsname\else%
+ \led@err@Leftside@PreviousNotPrinted%
+ \fi%
+ \ledRcolfalse
+ \setcounter{pstartL}{1}
+ \let\pstart\pstartL
+ \let\thepstart\thepstartL
+ \let\pend\pendL
+ \let\memorydump\memorydumpL
+ \Leftsidehook
+ \let\old@startstanza\@startstanza
+ \def\@startstanza[##1]{\global\instanzaLtrue\old@startstanza[##1]}
+}{
+ \Leftsidehookend}
+\newcommand*{\Leftsidehook}{}
+\newcommand*{\Leftsidehookend}{}
+\newcommand*{\Rightsidehook}{}
+\newcommand*{\Rightsidehookend}{}
+
+\newenvironment{Rightside}{%
+ \expandafter\ifvoid\csname l@dRcolrawbox1\endcsname\else%
+ \led@err@Rightside@PreviousNotPrinted%
+ \fi%
+ \ledRcoltrue
+ \let\beginnumbering\beginnumberingR
+ \let\endnumbering\endnumberingR
+ \let\pausenumbering\pausenumberingR
+ \let\resumenumbering\resumenumberingR
+ \let\memorydump\memorydumpR
+ \let\thepstart\thepstartR
+ \let\pstart\pstartR
+ \let\pend\pendR
+ \let\ledpb\ledpbR
+ \let\lednopb\lednopbR
+ \let\lineation\lineationR
+ \Rightsidehook
+ \let\old@startstanza\@startstanza
+ \def\@startstanza[##1]{\global\instanzaRtrue\old@startstanza[##1]}
+}{%
+ \ledRcolfalse
+ \Rightsidehookend
+}
+
+\newcount\num@linesR
+\newbox\one@lineR
+\newcount\par@lineR
+
+\newcounter{pstartL}
+\renewcommand{\thepstartL}{{\bfseries\@arabic\c@pstartL}. }
+\newcounter{pstartR}
+\renewcommand{\thepstartR}{{\bfseries\@arabic\c@pstartR}. }
+
+\newcommandx*{\pstartL}[1][1]{%
+ \if@nobreak%
+ \let\@oldnobreak\@nobreaktrue%
+ \else%
+ \let\@oldnobreak\@nobreakfalse%
+ \fi%
+ \@nobreaktrue%
+ \ifluatex%
+ \xdef\l@luatextextdir@L{\the\luatextextdir}%
+ \xdef\l@luatexpardir@L{\the\luatexpardir}%
+ \xdef\l@luatexbodydir@L{\the\luatexbodydir}%
+ \fi%
+ \ifnumbering \else%
+ \led@err@PstartNotNumbered%
+ \beginnumbering%
+ \fi%
+ \ifnumberedpar@%
+ \led@err@PstartInPstart%
+ \pend%
+ \fi%
+ \ifpst@rtedL\else%
+ \list@clear{\inserts@list}%
+ \global\let\next@insert=\empty%
+ \global\pst@rtedLtrue%
+ \fi%
+ \begingroup\normal@pars%
+ \global\advance\l@dnumpstartsL \@ne%
+ \ifnum\l@dnumpstartsL>\l@dc@maxchunks%
+ \led@err@TooManyPstarts%
+ \global\l@dnumpstartsL=\l@dc@maxchunks%
+ \fi%
+ \global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup%
+ \l@dzeropenalties%
+ \ifautopar\else%
+ \ifnumberpstart%
+ \ifsidepstartnum%
+ \else%
+ \thepstartL%
+ \fi%
+ \fi%
+ \fi%
+ \hsize=\Lcolwidth%
+ \numberedpar@true%
+ \iflabelpstart\protected@edef\@currentlabel%
+ {\p@pstartL\thepstartL}\fi%
+ \ifstrempty{#1}%
+ {\csgdef{before@pstartL@\the\l@dnumpstartsL}{\at@every@pstart}}%
+ {\csgdef{before@pstartL@\the\l@dnumpstartsL}{\noindent#1}}%
+ \at@every@pstart@call%
+ }
+\newcommandx*{\pstartR}[1][1]{%
+ \if@nobreak%
+ \let\@oldnobreak\@nobreaktrue%
+ \else%
+ \let\@oldnobreak\@nobreakfalse%
+ \fi%
+ \@nobreaktrue%
+ \ifluatex%
+ \xdef\l@luatextextdir@R{\the\luatextextdir}%
+ \xdef\l@luatexpardir@R{\the\luatexpardir}%
+ \xdef\l@luatexbodydir@R{\the\luatexbodydir}%
+ \fi%
+ \ifnumberingR \else%
+ \led@err@PstartNotNumbered%
+ \beginnumberingR%
+ \fi%
+ \ifnumberedpar@%
+ \led@err@PstartInPstart%
+ \pendR%
+ \fi%
+ \ifpst@rtedR\else%
+ \list@clear{\inserts@listR}%
+ \global\let\next@insertR=\empty%
+ \global\pst@rtedRtrue%
+ \fi%
+ \begingroup\normal@pars%
+ \global\advance\l@dnumpstartsR \@ne%
+ \ifnum\l@dnumpstartsR>\l@dc@maxchunks%
+ \led@err@TooManyPstarts%
+ \global\l@dnumpstartsR=\l@dc@maxchunks%
+ \fi%
+ \global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup%
+ \l@dzeropenalties%
+ \ifautopar\else%
+ \ifnumberpstart%
+ \ifsidepstartnum\else%
+ \thepstartR%
+ \fi%
+ \fi%
+ \fi%
+ \hsize=\Rcolwidth%
+ \numberedpar@true%
+ \iflabelpstart\protected@edef\@currentlabel%
+ {\p@pstartR\thepstartR}\fi%
+ \ifstrempty{#1}%
+ {\csgdef{before@pstartR@\the\l@dnumpstartsR}{\at@every@pstart}}%
+ {\csgdef{before@pstartR@\the\l@dnumpstartsR}{\noindent#1}}%
+ \at@every@pstart@call%
+ }
+\newcommandx*{\pendL}[1][1]{%
+ \ifnumbering \else%
+ \led@err@PendNotNumbered%
+ \fi%
+ \ifnumberedpar@ \else%
+ \led@err@PendNoPstart%
+ \fi%
+ \endgraf\global\num@lines=\prevgraf\egroup%
+ \global\par@line=0%
+ \endgroup%
+ \ignorespaces%
+ \@oldnobreak%
+ \dump@pstartL@pc%
+ \ifnumberpstart%
+ \addtocounter{pstartL}{1}%
+ \fi
+ \parledgroup@beforenotes@save{L}%
+ \ifstrempty{#1}%
+ {\csgdef{after@pendL@\the\l@dnumpstartsL}{\at@every@pend}}%
+ {\csgdef{after@pendL@\the\l@dnumpstartsL}{\noindent#1}}%
+ }
+\newcommandx*{\pendR}[1][1]{%
+ \ifnumberingR \else%
+ \led@err@PendNotNumbered%
+ \fi%
+ \ifnumberedpar@ \else%
+ \led@err@PendNoPstart%
+ \fi%
+ \endgraf\global\num@linesR=\prevgraf\egroup%
+ \global\par@lineR=0%
+ \endgroup%
+ \ignorespaces%
+ \@oldnobreak%
+ \dump@pstartR@pc%
+ \ifnumberpstart%
+ \addtocounter{pstartR}{1}%
+ \fi%
+ \parledgroup@beforenotes@save{R}%
+ \ifstrempty{#1}%
+ {\csgdef{after@pendR@\the\l@dnumpstartsR}{\at@every@pend}}%
+ {\csgdef{after@pendR@\the\l@dnumpstartsR}{\noindent#1}}%
+}
+
+\newcommand{\AtEveryPstartCall}[1]{\gdef\at@every@pstart@call{#1}}%
+\gdef\at@every@pstart@call{}%
+\newif\ifprint@last@after@pendL%
+\newif\ifprint@last@after@pendR%
+\newbox\l@dleftbox
+\newbox\l@drightbox
+
+\newcount\countLline
+ \countLline \z@
+\newcount\countRline
+ \countRline \z@
+
+\newcount\@donereallinesL
+\newcount\@donetotallinesL
+\newcount\@donereallinesR
+\newcount\@donetotallinesR
+
+\newcommand*{\do@lineL}{%
+ \letcs{\ifnumberpstart}{numberpstart@L\the\l@dpscL}%
+ \advance\countLline \@ne%
+ \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}%
+ {\vbadness=10000%
+ \splittopskip=\z@%
+ \do@lineLhook%
+ \l@demptyd@ta%
+ \global\setbox\one@line=\vsplit\namebox{l@dLcolrawbox\the\l@dpscL}%
+ to\baselineskip}%
+ \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startL}{}%
+ \unvbox\one@line \global\setbox\one@line=\lastbox%
+ \getline@numL%
+ \ifnum\@lock>\@ne%
+ \inserthangingsymboltrue%
+ \else%
+ \inserthangingsymbolfalse%
+ \fi%
+ \setbox\l@dleftbox%
+ \hb@xt@ \Lcolwidth{%
+ \ifl@dhidenumber%
+ \global\l@dhidenumberfalse%
+ \f@x@l@cks%
+ \else%
+ \affixline@num%
+ \fi%
+ \xifinlist{\the\l@dpscL}{\eled@sections@@}%
+ {\add@inserts\affixside@note}%
+ {\print@lineL}}%
+ \add@penaltiesL%
+ \global\advance\@donereallinesL\@ne%
+ \global\advance\@donetotallinesL\@ne%
+\else%
+ \setbox\l@dleftbox \hb@xt@ \Lcolwidth{\hspace*{\Lcolwidth}}%
+ \global\advance\@donetotallinesL\@ne%
+\fi}
+
+\def\print@lineL{%
+ \affixpstart@numL%
+ \l@dld@ta %space kept for backward compatibility
+ \add@inserts\affixside@note%
+ \l@dlsn@te %space kept for backward compatibility
+ {\ledllfill\hb@xt@ \Lcolwidth{%
+ \do@insidelineLhook%
+ \ifluatex%
+ \luatextextdir\l@luatextextdir@L%
+ \fi%
+ \new@lineL%
+ \inserthangingsymbolL%
+ \l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta%
+ \l@drsn@te}}
+
+\def\print@eledsectionL{%%
+ \addtocounter{pstartL}{-1}%
+ \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{}
+ \ifdefstring{\@eledsectmark}{L}{}{\ledsectnomark}
+ \numdef{\temp@}{\l@dpscL-1}%
+ \xifinlist{\temp@}{\eled@sections@@}{\@nobreaktrue}{\@nobreakfalse}%
+ \@eled@sectioningtrue%
+ \bgroup%
+ \ifluatex%
+ \luatextextdir\l@luatextextdir@L%
+ \luatexpardir\l@luatexpardir@L%
+ \luatexbodydir\l@luatexbodydir@L%
+ \ifdefstring{\l@luatextextdir@L}{TRT}{\@RTLtrue}{}%
+ \fi%
+ \csuse{eled@sectioning@\the\l@dpscL}%
+ \egroup%
+ \@eled@sectioningfalse%
+ \global\csundef{eled@sectioning@\the\l@dpscL}%
+ \if@RTL%
+ \hspace{-3\paperwidth}%
+ {\hbox{\l@dunhbox@line{\one@line}} \new@line}%
+ \else%
+ \hspace{3\paperwidth}%
+ {\new@line \hbox{\l@dunhbox@line{\one@line}}}%
+ \fi%
+ \vskip\eledsection@correcting@skip%
+}
+
+\newcommand*{\dolineLhook}[1]{\gdef\do@lineLhook{#1}}%
+\newcommand*{\dolineRhook}[1]{\gdef\do@lineRhook{#1}}%
+\newcommand*{\doinsidelineLhook}[1]{\gdef\do@insidelineLhook{#1}}%
+\newcommand*{\doinsidelineRhook}[1]{\gdef\do@insidelineRhook{#1}}%
+
+\newcommand*{\do@lineLhook}{}
+\newcommand*{\do@lineRhook}{}
+\newcommand*{\do@insidelineLhook}{}
+\newcommand*{\do@insidelineRhook}{}
+
+\newcommand*{\do@lineR}{%
+ \letcs{\ifnumberpstart}{numberpstart@R\the\l@dpscR}%
+ \ledRcol@true%
+ \advance\countRline \@ne%
+ \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}%
+ {\vbadness=10000%
+ \splittopskip=\z@%
+ \do@lineRhook%
+ \l@demptyd@ta%
+ \global\setbox\one@lineR=\vsplit\namebox{l@dRcolrawbox\the\l@dpscR}%
+ to\baselineskip}%
+ \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startR}{}%
+ \unvbox\one@lineR \global\setbox\one@lineR=\lastbox%
+ \getline@numR%
+ \ifnum\@lockR>\@ne%
+ \inserthangingsymbolRtrue%
+ \else%
+ \inserthangingsymbolRfalse%
+ \fi%
+ \setbox\l@drightbox%
+ \hb@xt@ \Rcolwidth{%
+ \ifl@dhidenumber%
+ \global\l@dhidenumberfalse%
+ \f@x@l@cksR%
+ \else%
+ \affixline@numR%
+ \fi%
+ \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}%
+ {\add@insertsR\affixside@noteR}%
+ {\print@lineR}%
+ }%
+ \add@penaltiesR%
+ \global\advance\@donereallinesR\@ne%
+ \global\advance\@donetotallinesR\@ne%
+\else%
+ \setbox\l@drightbox \hb@xt@ \Rcolwidth{\hspace*{\Rcolwidth}}%
+ \global\advance\@donetotallinesR\@ne%
+\fi%
+\ledRcol@false%
+}
+
+\def\print@lineR{%
+ \affixpstart@numR%
+ \l@dld@ta %space kept for backward compatibility
+ \add@insertsR\affixside@noteR%
+ \l@dlsn@te %space kept for backward compatibility
+ \ledllfill\hb@xt@ \Rcolwidth{%
+ \do@insidelineRhook%
+ \new@lineR%
+ \inserthangingsymbolR%
+ \ifluatex%
+ \luatextextdir\l@luatextextdir@R%
+ \fi%
+ \l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta%
+ \l@drsn@te%
+ }
+
+\def\print@eledsectionR{%
+ \addtocounter{pstartR}{-1}%
+ \initnumbering@sectcountR%
+ \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{}%
+ \ifdefstring{\@eledsectmark}{R}{}{\ledsectnomark}%
+ \numdef{\temp@}{\l@dpscR-1}%
+ \xifinlist{\temp@}{\eled@sectionsR@@}{\@nobreaktrue}{\@nobreakfalse}%
+ \@eled@sectioningtrue%
+ \bgroup%
+ \ifluatex%
+ \luatextextdir\l@luatextextdir@R%
+ \luatexpardir\l@luatexpardir@R%
+ \luatexbodydir\l@luatexbodydir@R%
+ \ifdefstring{\l@luatextextdir@L}{TRT}{\@RTLtrue}{}%
+ \fi%
+ \csuse{eled@sectioning@\the\l@dpscR R}%
+ \egroup%
+ \@eled@sectioningfalse%
+ \global\csundef{eled@sectioning@\the\l@dpscR R}%
+ \if@RTL%
+ \hspace{-\paperwidth}%
+ {\hbox{\l@dunhbox@line{\one@lineR}} \new@lineR}%
+ \else%
+ \hspace{\paperwidth}%
+ {\new@lineR \hbox{\l@dunhbox@line{\one@lineR}}}%
+ \fi%
+ \vskip\eledsection@correcting@skip
+}
+\newcommand*{\getline@numR}{%
+ \global\advance\absline@numR \@ne
+ \do@actionsR
+ \do@ballastR
+ \ifledgroupnotesR@\else
+ \ifnumberline
+ \ifsublines@
+ \ifnum\sub@lockR<\tw@
+ \global\advance\subline@numR \@ne
+ \fi
+ \else
+ \ifnum\@lockR<\tw@
+ \global\advance\line@numR \@ne
+ \global\subline@numR \z@
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand*{\getline@numL}{%
+ \global\advance\absline@num \@ne
+ \do@actions
+ \do@ballast
+ \ifledgroupnotesL@\else
+ \ifnumberline
+ \ifsublines@
+ \ifnum\sub@lock<\tw@
+ \global\advance\subline@num \@ne
+ \fi
+ \else
+ \ifnum\@lock<\tw@
+ \global\advance\line@num \@ne
+ \global\subline@num \z@
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+\newcommand*{\do@ballastR}{\global\ballast@count=\z@
+ \begingroup
+ \advance\absline@numR \@ne
+ \ifnum\next@actionlineR=\absline@numR
+ \ifnum\next@actionR>-1001
+ \global\advance\ballast@count by -\c@ballast
+ \fi
+ \fi
+ \endgroup}
+
+\newif\ifl@dskipversenumberR
+\newcommand*{\do@actions@fixedcodeR}{%
+ \ifcase\@l@dtempcnta%
+ \or% % 1001
+ \global\sublines@true
+ \or% % 1002
+ \global\sublines@false
+ \or% % 1003
+ \global\@lockR=\@ne
+ \or% % 1004%
+ \ifnum\@lockR=\tw@
+ \global\@lockR=\thr@@
+ \else
+ \global\@lockR=\z@
+ \fi
+ \or% % 1005
+ \global\sub@lockR=\@ne
+ \or% % 1006
+ \ifnum\sub@lockR=\tw@
+ \global\sub@lockR=\thr@@
+ \else
+ \global\sub@lockR=\z@
+ \fi
+ \or% % 1007
+ \l@dskipnumbertrue
+ \or% % 1008
+ \l@dskipversenumberRtrue%
+ \or% % 1009
+ \l@dhidenumbertrue%
+ \else%
+ \led@warn@BadAction
+ \fi%
+}
+
+\newcommand*{\do@actionsR}{%
+ \global\let\do@actions@nextR=\relax
+ \@l@dtempcntb=\absline@numR
+ \ifnum\@l@dtempcntb<\next@actionlineR\else
+ \ifnum\next@actionR>-1001\relax
+ \global\page@numR=\next@actionR
+ \ifbypage@R
+ \global\line@numR \z@ \global\subline@numR \z@
+ \fi
+ \else
+ \ifnum\next@actionR<-4999\relax % 9/05 added relax here
+ \@l@dtempcnta=-\next@actionR
+ \advance\@l@dtempcnta by -5001\relax
+ \ifsublines@
+ \global\subline@numR=\@l@dtempcnta
+ \else
+ \global\line@numR=\@l@dtempcnta
+ \fi
+ \else
+ \@l@dtempcnta=-\next@actionR
+ \advance\@l@dtempcnta by -1000\relax
+ \do@actions@fixedcodeR
+ \fi
+ \fi
+ \ifx\actionlines@listR\empty
+ \gdef\next@actionlineR{1000000}%
+ \else
+ \gl@p\actionlines@listR\to\next@actionlineR
+ \gl@p\actions@listR\to\next@actionR
+ \global\let\do@actions@nextR=\do@actionsR
+ \fi
+ \fi
+ \do@actions@nextR}
+
+
+\newcommand*{\l@dcalcnum}[3]{%
+ \ifnum #1 > #2\relax
+ \@l@dtempcnta = #1\relax
+ \advance\@l@dtempcnta by -#2\relax
+ \divide\@l@dtempcnta by #3\relax
+ \multiply\@l@dtempcnta by #3\relax
+ \advance\@l@dtempcnta by #2\relax
+ \else
+ \@l@dtempcnta=#2\relax
+ \fi}
+
+\newcommand*{\ch@cksub@l@ckR}{%
+ \ifcase\sub@lockR
+ \or
+ \ifnum\sublock@disp=\@ne
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \or
+ \ifnum\sublock@disp=\tw@
+ \else
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \or
+ \ifnum\sublock@disp=\z@
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \fi}
+
+\newcommand*{\ch@ck@l@ckR}{%
+ \ifcase\@lockR
+ \or
+ \ifnum\lock@disp=\@ne
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \or
+ \ifnum\lock@disp=\tw@
+ \else
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \or
+ \ifnum\lock@disp=\z@
+ \@l@dtempcntb \z@ \@l@dtempcnta \@ne
+ \fi
+ \fi}
+
+\newcommand*{\f@x@l@cksR}{%
+ \ifcase\@lockR
+ \or
+ \global\@lockR \tw@
+ \or \or
+ \global\@lockR \z@
+ \fi
+ \ifcase\sub@lockR
+ \or
+ \global\sub@lockR \tw@
+ \or \or
+ \global\sub@lockR \z@
+ \fi}
+
+\newcommand*{\affixline@numR}{%
+\ifledgroupnotesR@\else\ifnumberline
+\ifl@dskipnumber
+ \global\l@dskipnumberfalse
+\else
+ \ifsublines@
+ \@l@dtempcntb=\subline@numR
+ \l@dcalcnum{\subline@numR}{\c@firstsublinenumR}{\c@sublinenumincrementR}%
+ \ch@cksub@lockR
+ \else
+ \@l@dtempcntb=\line@numR
+ \ifx\linenumberlist\empty
+ \l@dcalcnum{\line@numR}{\c@firstlinenumR}{\c@linenumincrementR}%
+ \else
+ \@l@dtempcnta=\line@numR
+ \edef\rem@inder{,\linenumberlist,\number\line@numR,}%
+ \edef\sc@n@list{\def\noexpand\sc@n@list
+ ####1,\number\@l@dtempcnta,####2|{\def\noexpand\rem@inder{####2}}}%
+ \sc@n@list\expandafter\sc@n@list\rem@inder|%
+ \ifx\rem@inder\empty\advance\@l@dtempcnta\@ne\fi
+ \fi
+ \ch@ck@l@ckR
+ \fi
+ \ifnum\@l@dtempcnta=\@l@dtempcntb
+ \ifl@dskipversenumberR\else
+ \if@twocolumn
+ \if@firstcolumn
+ \gdef\l@dld@ta{\llap{{\leftlinenumR}}}%
+ \else
+ \gdef\l@drd@ta{\rlap{{\rightlinenumR}}}%
+ \fi
+ \else
+ \@l@dtempcntb=\line@marginR
+ \ifnum\@l@dtempcntb>\@ne
+ \advance\@l@dtempcntb by\page@numR
+ \fi
+ \ifodd\@l@dtempcntb
+ \gdef\l@drd@ta{\rlap{{\rightlinenumR}}}%
+ \else
+ \gdef\l@dld@ta{\llap{{\leftlinenumR}}}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \f@x@l@cksR
+\fi
+\fi
+\fi}
+
+\newcommand*{\affixpstart@numL}{%
+\ifsidepstartnum
+\if@twocolumn
+ \if@firstcolumn
+ \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}%
+ \else
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}%
+ \fi
+ \else
+ \@l@dtempcntb=\line@margin
+ \ifnum\@l@dtempcntb>\@ne
+ \advance\@l@dtempcntb \page@num
+ \fi
+ \ifodd\@l@dtempcntb
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}%
+ \else
+ \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}%
+ \fi
+ \fi
+\fi
+}
+\newcommand*{\affixpstart@numR}{%
+\ifsidepstartnum
+\if@twocolumn
+ \if@firstcolumn
+ \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}%
+ \else
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}%
+ \fi
+ \else
+ \@l@dtempcntb=\line@marginR
+ \ifnum\@l@dtempcntb>\@ne
+ \advance\@l@dtempcntb \page@numR
+ \fi
+ \ifodd\@l@dtempcntb
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}%
+ \else
+ \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}%
+ \fi
+ \fi
+\fi
+}
+
+\newcommand*{\leftpstartnumL}{
+\ifpstartnum
+\thepstartL
+\kern\linenumsep\global\pstartnumfalse\fi
+}
+\newcommand*{\rightpstartnumL}{
+\ifpstartnum\kern\linenumsep
+\thepstartL
+\global\pstartnumfalse\fi
+}
+\newif\ifpstartnumR
+\pstartnumRtrue
+\newcommand*{\leftpstartnumR}{
+\ifpstartnumR
+\thepstartR
+\kern\linenumsep\global\pstartnumRfalse\fi
+}
+\newcommand*{\rightpstartnumR}{
+\ifpstartnumR\kern\linenumsep
+\thepstartR
+\global\pstartnumRfalse\fi
+}
+\list@create{\inserts@listR}
+\newcommand*{\add@insertsR}{%
+ \global\let\add@inserts@nextR=\relax
+ \ifx\inserts@listR\empty \else
+ \ifx\next@insertR\empty
+ \ifx\insertlines@listR\empty
+ \global\noteschanged@true
+ \gdef\next@insertR{100000}%
+ \else
+ \gl@p\insertlines@listR\to\next@insertR
+ \fi
+ \fi
+ \ifnum\next@insertR=\absline@numR
+ \gl@p\inserts@listR\to\@insertR
+ \@insertR
+ \global\let\@insertR=\undefined
+ \global\let\next@insertR=\empty
+ \global\let\add@inserts@nextR=\add@insertsR
+ \fi
+ \fi
+ \add@inserts@nextR}
+
+\newcommand*{\add@penaltiesL}{}
+\newcommand*{\add@penaltiesR}{}
+
+\newcommand*{\flush@notesR}{%
+ \@xloop
+ \ifx\inserts@listR\empty \else
+ \gl@p\inserts@listR\to\@insertR
+ \@insertR
+ \global\let\@insertR=\undefined
+ \repeat}
+
+\def\printlinesR#1|#2|#3|#4|#5|#6|#7|{\begingroup
+ \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
+ \ifl@d@pnum #1\fullstop\fi
+ \ifledplinenum \linenumr@p{#2}\@Rlineflag\else \symplinenum\fi
+ \ifl@d@ssub \fullstop \sublinenumr@p{#3}\fi
+ \ifl@d@dash \endashchar\fi
+ \ifl@d@pnum #4\fullstop\fi
+ \ifl@d@elin \linenumr@p{#5}\@Rlineflag\fi
+ \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumr@p{#6}\fi
+\endgroup}
+
+\newcommand\print@Xnotes@forpages[1]{%
+ \ifcsempty{Xonlyside@#1}{%
+ \csuse{#1footstart}{#1}%
+ \csuse{#1footgroup}{#1}%
+ }%
+ {%
+ \ifboolexpr{%
+ ((test {\ifcsstring{Xonlyside@#1}{L}} and not test{\ifnumodd{\c@page}})%
+ or%
+ (test {\ifcsstring{Xonlyside@#1}{R}} and test{\ifnumodd{\c@page}}))%
+ }%
+ {%
+ \correct@Xfootins@box{#1}%
+ \csuse{#1footstart}{#1}%
+ \csuse{#1footgroup}{#1}%
+ \global\count\csuse{#1footins}=0%
+ \global\skip\csuse{#1footins}=0pt%
+ \csuse{Xnotefontsize@#1}%
+ \global\advance\dimen\csuse{#1footins} by -\baselineskip%
+ \global\boolfalse{keepforXside@#1}%
+ }%
+ {%
+ \global\booltrue{keepforXside@#1}%
+ \global\count\csuse{#1footins}=\csuse{default@#1footins}%
+ \global\skip\csuse{#1footins}=\csuse{Xbeforenotes@#1}%
+ \bgroup%
+ \csuse{Xnotefontsize@#1}%
+ \global\advance\dimen\csuse{#1footins} by \baselineskip%
+ \egroup%
+ }%
+ }%
+}%
+\newcommand{\correct@Xfootins@box}[1]{%
+ \ifbool{keepforXside@#1}{%
+ \csuse{Xnotefontsize@#1}%
+ \splittopskip=0pt%
+ \global\setbox\csuse{#1footins}=\vbox{%
+ \vsplit\csuse{#1footins} to \dimexpr\ht\csuse{#1footins}-1pt\relax%
+ \vskip \dimexpr-0.5\baselineskip-0.5\lineskip-0.5pt\relax%
+ \unvbox\csuse{#1footins}%
+ }%
+ }{}%
+}%
+\newcommand\print@notesX@forpages[1]{%
+ \ifcsempty{onlysideX@#1}{%
+ \csuse{footstart#1}{#1}%
+ \csuse{footgroup#1}{#1}%
+ }%
+ {%
+ \ifboolexpr{%
+ ((test {\ifcsstring{onlysideX@#1}{L}} and not test{\ifnumodd{\c@page}})%
+ or%
+ (test {\ifcsstring{onlysideX@#1}{R}} and test{\ifnumodd{\c@page}}))%
+ }%
+ {%
+ \correct@footinsX@box{#1}%
+ \csuse{footstart#1}{#1}%
+ \csuse{footgroup#1}{#1}%
+ \global\count\csuse{footins#1}=0%
+ \global\skip\csuse{footins#1}=0pt%
+ \csuse{notefontsizeX@#1}%
+ \global\advance\dimen\csuse{footins#1} by -\baselineskip%
+ \global\boolfalse{keepforsideX@#1}%
+ }%
+ {%
+ \global\booltrue{keepforsideX@#1}%
+ \global\count\csuse{footins#1}=\csuse{default@footins#1}%
+ \global\skip\csuse{footins#1}=\csuse{beforenotesX@#1}%
+ \bgroup%
+ \csuse{notefontsizeX@#1}%
+ \global\advance\dimen\csuse{footins#1} by \baselineskip%
+ \egroup%
+ }%
+ }%
+}%
+\newcommand{\correct@footinsX@box}[1]{%
+ \ifbool{keepforsideX@#1}{%
+ \csuse{notefontsizeX@#1}%
+ \splittopskip=0pt%
+ \global\setbox\csuse{footins#1}=\vbox{%
+ \vsplit\csuse{footins#1} to \dimexpr\ht\csuse{footins#1}-1pt\relax%
+ \vskip \dimexpr-0.5\baselineskip-0.5\lineskip-0.5pt\relax%
+ \unvbox\csuse{footins#1}%
+ }%
+ }{}%
+}%
+\list@create{\labelref@listR}
+
+\def\l@dmake@labelsR#1|#2|#3|#4|#5{%
+ \expandafter\ifx\csname the@label#5\endcsname \relax\else
+ \led@warn@DuplicateLabel{#4}%
+ \fi
+ \expandafter\gdef\csname the@label#5\endcsname{#1|#2\@Rlineflag|#3|#4}%
+ \ignorespaces}
+\AtBeginDocument{%
+ \def\l@dmake@labelsR#1|#2|#3|#4|#5{}%
+}
+
+\WithSuffix\newcommand\sidenotemargin*[1]{%
+ \l@dgetsidenote@margin{#1}
+ \global\sidenote@marginR=\@l@dtempcntb
+ \global\sidenote@margin=\@l@dtempcntb
+}
+\newcount\sidenote@marginR
+\global\sidenote@margin=\@ne
+
+
+\newcommand*{\affixside@noteR}{%
+ \def\sidenotecontent@{}%
+ \numgdef{\itemcount@}{0}%
+ \def\do##1{%
+ \ifnumequal{\itemcount@}{0}%
+ {%
+ \appto\sidenotecontent@{##1}}% Not print not separator before the 1st note
+ {\appto\sidenotecontent@{\sidenotesep ##1}%
+ }%
+ \numgdef{\itemcount@}{\itemcount@+1}%
+ }%
+ \dolistloop{\l@dcsnotetext}%
+ \ifnumgreater{\itemcount@}{1}{\led@err@ManySidenotes}{}%
+ \gdef\@templ@d{}%
+ \gdef\@templ@n{\l@dcsnotetext\l@dcsnotetext@l\l@dcsnotetext@r}%
+ \ifx\@templ@d\@templ@n \else%
+ \if@twocolumn%
+ \if@firstcolumn%
+ \setl@dlp@rbox{##1}{\sidenotecontent@}%
+ \else%
+ \setl@drp@rbox{\sidenotecontent@}%
+ \fi%
+ \else%
+ \@l@dtempcntb=\sidenote@marginR%
+ \ifnum\@l@dtempcntb>\@ne%
+ \advance\@l@dtempcntb by\page@numR%
+ \fi%
+ \ifodd\@l@dtempcntb%
+ \setl@drp@rbox{\sidenotecontent@}%
+ \gdef\sidenotecontent@{}%
+ \numdef{\itemcount@}{0}%
+ \dolistloop{\l@dcsnotetext@l}%
+ \ifnumgreater{\itemcount@}{1}{\led@err@ManyLeftnotes}{}%
+ \setl@dlp@rbox{\sidenotecontent@}%
+ \else%
+ \setl@dlp@rbox{\sidenotecontent@}%
+ \gdef\sidenotecontent@{}%
+ \numdef{\itemcount@}{0}%
+ \dolistloop{\l@dcsnotetext@r}%
+ \ifnumgreater{\itemcount@}{1}{\led@err@ManyRightnotes}{}%
+ \setl@drp@rbox{\sidenotecontent@}%
+ \fi%
+ \fi%
+ \fi%
+}
+
+
+\newif\ifinserthangingsymbolR
+\newcommand{\inserthangingsymbolL}{%
+ \ifinserthangingsymbol%
+ \ifinstanzaL%
+ \hskip \@ifundefined{sza@0@}{0}{\expandafter%
+ \noexpand\csname sza@0@\endcsname}\stanzaindentbase%
+ \@hangingsymbol%
+ \fi%
+ \fi%
+}%
+\newcommand{\inserthangingsymbolR}{%
+ \ifinserthangingsymbolR%
+ \ifinstanzaR%
+ \hskip \@ifundefined{sza@0@}{0}{\expandafter%
+ \noexpand\csname sza@0@\endcsname}\stanzaindentbase%
+ \@hangingsymbol%
+ \fi%
+ \fi%
+}%
+
+ \chardef\next=\catcode`\&
+ \catcode`\&=\active
+
+\newenvironment{astanza}{%
+ \catcode`\&\active
+ \global\stanza@count\@ne\stanza@modulo\@ne
+ \ifnum\usenamecount{sza@0@}=\z@
+ \let\stanza@hang\relax
+ \let\endlock\relax
+ \else
+ \rightskip\z@ plus 1fil\relax
+ \fi
+ \ifnum\usenamecount{szp@0@}=\z@
+ \let\sza@penalty\relax
+ \fi
+ \def&{%
+ \endlock\mbox{}%
+ \sza@penalty
+ \global\advance\stanza@count\@ne
+ \@astanza@line}%
+ \def\&{\@stopastanza}%
+ \pstart
+ \@astanza@line
+}{}
+
+\newcommandx{\@stopastanza}[1][1,usedefault]{%
+ \endlock\mbox{}%
+ \pend[#1]%
+}%
+\newcommand*{\@astanza@line}{%
+ \ifnum\value{stanzaindentsrepetition}=0
+ \parindent=\csname sza@\number\stanza@count
+ @\endcsname\stanzaindentbase
+ \else
+ \parindent=\csname sza@\number\stanza@modulo
+ @\endcsname\stanzaindentbase
+ \managestanza@modulo
+ \fi
+ \par
+ \stanza@hang%\mbox{}%
+ \ignorespaces}
+
+ \catcode`\&=\next
+
+\providecommand*{\newnamebox}[1]{%
+ \expandafter\newbox\csname #1\endcsname}
+\providecommand*{\setnamebox}[1]{%
+ \expandafter\setbox\csname #1\endcsname}
+\providecommand*{\unhnamebox}[1]{%
+ \expandafter\unhbox\csname #1\endcsname}
+\providecommand*{\unvnamebox}[1]{%
+ \expandafter\unvbox\csname #1\endcsname}
+\providecommand*{\namebox}[1]{%
+ \csname #1\endcsname}
+
+\providecommand*{\newnamecount}[1]{%
+ \expandafter\newcount\csname #1\endcsname}
+\providecommand*{\usenamecount}[1]{%
+ \csname #1\endcsname}
+
+\newif\ifl@dusedbabel
+\patchcmd{\bbl@set@language}%
+ {\select@language{\languagename}}%
+ {\edef\languagename{#1}\select@language{\languagename}}%
+ {}%
+ {}%
+
+\newcommand*{\l@duselanguage}[1]{}
+\gdef\theledlanguageL{}
+\gdef\theledlanguageR{}
+
+\AtBeginDocument{%
+ \@ifundefined{xpg@main@language}{%
+ \@ifundefined{bbl@main@language}{%
+ \l@dusedbabelfalse
+ }{%
+ \l@dusedbabeltrue
+ \let\l@doldselectlanguage\selectlanguage
+ \let\l@doldbbl@set@language\bbl@set@language
+ \renewcommand{\selectlanguage}[1]{%
+ \l@doldselectlanguage{#1}%
+ \ifledRcol \gdef\theledlanguageR{#1}%
+ \else \gdef\theledlanguageL{#1}%
+ \fi}
+ \renewcommand*{\l@duselanguage}[1]{%
+ \l@doldselectlanguage{#1}}
+ \gdef\theledlanguageL{\bbl@main@language}%
+ \gdef\theledlanguageR{\bbl@main@language}%
+ }%
+ }
+ { \let\old@otherlanguage\otherlanguage%
+ \renewcommand{\otherlanguage}[2][]{%
+ \selectlanguage[#1]{#2}%
+ \ifledRcol \gdef\theledlanguageR{#2}%
+ \else \gdef\theledlanguageL{#2}%
+ \fi}%
+ \let\l@duselanguage\select@language%
+ \gdef\theledlanguageL{\xpg@main@language}%
+ \gdef\theledlanguageR{\xpg@main@language}%
+}}
+\newcount\l@dc@maxchunks
+\newcommand{\maxchunks}[1]{\l@dc@maxchunks=#1}
+ \maxchunks{5120}
+
+\newcount\l@dnumpstartsR
+
+\newcount\l@dpscL
+\newcount\l@dpscR
+
+\newcommand*{\l@dsetuprawboxes}{%
+ \@l@dtempcntb=\l@dc@maxchunks
+ \loop\ifnum\@l@dtempcntb>\z@
+ \newnamebox{l@dLcolrawbox\the\@l@dtempcntb}
+ \newnamebox{l@dRcolrawbox\the\@l@dtempcntb}
+ \advance\@l@dtempcntb \m@ne
+ \repeat}
+
+\newcommand*{\l@dsetupmaxlinecounts}{%
+ \@l@dtempcntb=\l@dc@maxchunks
+ \loop\ifnum\@l@dtempcntb>\z@
+ \newnamecount{l@dmaxlinesinpar\the\@l@dtempcntb}
+ \advance\@l@dtempcntb \m@ne
+ \repeat}
+\newcommand*{\l@dzeromaxlinecounts}{%
+ \begingroup
+ \@l@dtempcntb=\l@dc@maxchunks
+ \loop\ifnum\@l@dtempcntb>\z@
+ \global\usenamecount{l@dmaxlinesinpar\the\@l@dtempcntb}=\z@
+ \advance\@l@dtempcntb \m@ne
+ \repeat
+ \endgroup}
+
+\AtBeginDocument{%
+ \l@dsetuprawboxes
+ \l@dsetupmaxlinecounts
+ \l@dzeromaxlinecounts
+ \l@dnumpstartsL=\z@
+ \l@dnumpstartsR=\z@
+ \l@dpscL=\z@
+ \l@dpscR=\z@}
+
+\newif\if@pstarts
+\newcommand*{\check@pstarts}{%
+ \@pstartsfalse
+ \ifnum\l@dnumpstartsL>\l@dpscL
+ \@pstartstrue
+ \else
+ \ifnum\l@dnumpstartsR>\l@dpscR
+ \@pstartstrue
+ \fi
+ \fi
+}
+
+\newif\ifaraw@text
+\newcommand*{\checkraw@text}{%
+ \araw@textfalse
+ \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}
+ \araw@texttrue
+ \else
+ \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}
+ \araw@texttrue
+ \fi
+ \fi
+}
+
+\newcommand*{\@writelinesinparL}{%
+ \edef\next{%
+ \write\linenum@out{\string\@pend[\the\@donereallinesL]}}%
+ \next
+ \global\@donereallinesL \z@}
+\newcommand*{\@writelinesinparR}{%
+ \edef\next{%
+ \write\linenum@outR{\string\@pendR[\the\@donereallinesR]}}%
+ \next
+ \global\@donereallinesR \z@}
+
+\newsavebox{\@eledsectionL}%
+\newsavebox{\@eledsectionR}%
+\newcommand*{\Columns}{%
+ \ifl@dpairing%
+ \led@err@Columns@InsideEnv%
+ \fi%
+ \l@dprintingcolumnstrue%
+ \eledsection@correcting@skip=-\baselineskip% Correction for sections' titles
+ \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else
+ \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}%
+ \fi
+ \begingroup
+ \l@dzeropenalties
+ \endgraf\global\num@lines=\prevgraf
+ \global\num@linesR=\prevgraf
+ \global\par@line=\z@
+ \global\par@lineR=\z@
+ \global\l@dpscL=\z@
+ \global\l@dpscR=\z@
+ \check@pstarts
+ \loop\if@pstarts
+ \global\pstartnumtrue
+ \global\pstartnumRtrue
+ \global\advance\l@dpscL \@ne
+ \global\advance\l@dpscR \@ne
+ \restore@pstartL@pc%
+ \restore@pstartR@pc%
+ \Columns@print@before@pstart%
+ \checkraw@text
+{ \loop\ifaraw@text
+ \l@duselanguage{\theledlanguageL}%
+ \do@lineL
+ \xifinlist{\the\l@dpscL}{\eled@sections@@}
+ {%
+ \ifdefstring{\@eledsectmark}{L}%
+ {\csuse{eled@sectmark@\the\l@dpscL}%
+ }{}%
+ \global\csundef{eled@sectmark@\the\l@dpscL}%
+ \savebox{\@eledsectionL}{\parbox[t][][t]{\Lcolwidth}{\vbox{}\print@eledsectionL}}%\vbox{}-> prevent alignment troubles with RTL language
+ }%
+ {}%
+ \l@duselanguage{\theledlanguageR}%
+ \do@lineR
+ \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}
+ {%
+ \ifdefstring{\@eledsectmark}{R}%
+ {\csuse{eled@sectmark@\the\l@dpscR R}%
+ }{}%
+ \global\csundef{eled@sectmark@\the\l@dpscR R}%
+ \savebox{\@eledsectionR}{\parbox[t][][t]{\Rcolwidth}{\vbox{}\print@eledsectionR}}}%\vbox{}-> prevent alignment troubles with RTL language
+ {}%
+ \hb@xt@ \hsize{%
+ \ifdefstring{\columns@position}{L}{}{\hfill }%
+ \unhbox\l@dleftbox%
+ \ifhbox\@eledsectionL%
+ \usebox{\@eledsectionL}%
+ \fi%
+ \print@columnseparator%
+ \unhbox\l@drightbox%
+ \ifhbox\@eledsectionR%
+ \usebox{\@eledsectionR}%
+ \fi%
+ \ifdefstring{\columns@position}{R}{}{\hfill}%
+ }%
+ \checkraw@text
+ \checkverseL
+ \checkverseR
+ \checkpb@columns
+ \repeat}
+ \@writelinesinparL
+ \@writelinesinparR
+ \check@pstarts
+ \ifbypstart@%
+ \write\linenum@out{\string\@set[1]}
+ \resetprevline@
+ \fi
+ \ifbypstart@R
+ \write\linenum@outR{\string\@set[1]}
+ \resetprevline@
+ \fi
+ \Columns@print@after@pend%
+ \repeat
+ \flush@notes
+ \flush@notesR
+ \endgroup
+ \global\l@dpscL=\z@
+ \global\l@dpscR=\z@
+ \global\l@dnumpstartsL=\z@
+ \global\l@dnumpstartsR=\z@
+ \l@dprintingcolumnsfalse%
+ \ignorespaces
+ \global\instanzaLfalse
+ \global\instanzaRfalse}
+
+\def\print@columnseparator{%
+ \ifdim\beforecolumnseparator<0pt%
+ \hfill%
+ \else%
+ \hspace{\beforecolumnseparator}%
+ \fi%
+ \columnseparator%
+ \ifdim\aftercolumnseparator<0pt%
+ \hfill%
+ \else%
+ \hspace{\beforecolumnseparator}%
+ \fi%
+}%
+
+\newcommand{\checkpb@columns}{%
+ \newif\if@pb
+ \newif\if@nopb
+ \IfStrEq{\led@pb@setting}{before}{
+ \numdef{\next@absline}{\the\absline@num+1}%
+ \numdef{\next@abslineR}{\the\absline@numR+1}%
+ \xifinlistcs{\next@absline}{l@prev@pb}{\@pbtrue}{}%
+ \xifinlistcs{\next@abslineR}{l@prev@pbR}{\@pbtrue}{}
+ \xifinlistcs{\next@absline}{l@prev@nopb}{\@nopbtrue}{}%
+ \xifinlistcs{\next@abslineR}{l@prev@nopbR}{\@nopbtrue}{}
+ }{}
+ \IfStrEq{\led@pb@setting}{after}{
+ \xifinlistcs{\the\absline@num}{l@prev@pb}{\@pbtrue}{}%
+ \xifinlistcs{\the\absline@numR}{l@prev@pbR}{\@pbtrue}{}
+ \xifinlistcs{\the\absline@num}{l@prev@nopb}{\@nopbtrue}{}%
+ \xifinlistcs{\the\absline@numR}{l@prev@nopbR}{\@nopbtrue}{}
+ }{}
+\if@nopb\nopagebreak[4]\enlargethispage{\baselineskip}\fi
+\if@pb\pagebreak[4]\fi
+}
+\newcommand*{\columnseparator}{%
+ \smash{\rule[-0.2\baselineskip]{\columnrulewidth}{1.05\baselineskip}}}
+\newdimen\columnrulewidth
+ \columnrulewidth=\z@
+
+\newcommand*{\columnsposition}[1]{%
+ \xdef\columns@position{#1}%
+ }%
+\xdef\columns@position{R}%
+\newlength{\beforecolumnseparator}%
+\setlength{\beforecolumnseparator}{-2pt}%
+
+\newlength{\aftercolumnseparator}%
+\setlength{\aftercolumnseparator}{-2pt}%
+
+\newcommand{\setwidthliketwocolumns@L}{%
+ \newdimen\temp%
+ \temp=\hsize%
+ \hsize=\Lcolwidth%
+ \advance\hsize\Rcolwidth%
+ \advance\temp-\hsize%
+ \multiply\temp by 2%
+ \divide\temp by 3%
+ \advance\hsize\temp%
+}%
+
+\newcommand{\setpositionliketwocolumns@L}{%
+ \renewcommand{\ledrlfill}{\hfill}%
+}%
+
+\newcommand{\setnotespositionliketwocolumns@L}{%
+}%
+
+\newcommand{\setwidthliketwocolumns@C}{%
+ \newdimen\temp%
+ \temp=\hsize%
+ \hsize=\Lcolwidth%
+ \advance\hsize\Rcolwidth%
+ \advance\temp-\hsize%
+ \divide\temp by 2%
+ \advance\hsize\temp%
+}%
+
+\newcommand{\setpositionliketwocolumns@C}{%
+ \doinsidelinehook{\hfill}%
+ \renewcommand{\ledrlfill}{\hfill}%
+}%
+
+\newcommand{\setnotespositionliketwocolumns@C}{%
+ \newdimen\temp%
+ \newdimen\tempa%
+ \temp=\hsize%
+ \tempa=\Lcolwidth%
+ \advance\tempa\Rcolwidth%
+ \advance\temp-\tempa%
+ \divide\temp by 2%
+ \leftskip=\temp%
+ \rightskip=-\temp%
+}%
+
+\newcommand{\setwidthliketwocolumns@R}{%
+ \newdimen\temp%
+ \temp=\hsize%
+ \hsize=\Lcolwidth%
+ \advance\hsize\Rcolwidth%
+ \advance\temp-\hsize%
+ \multiply\temp by 2%
+ \divide\temp by 3%
+ \advance\hsize\temp%
+}%
+
+\newcommand{\setpositionliketwocolumns@R}{%
+ \doinsidelinehook{\hfill}%
+}%
+
+\newcommand{\setnotespositionliketwocolumns@R}{%
+ \newdimen\temp%
+ \newdimen\tempa%
+ \temp=\hsize%
+ \tempa=\Lcolwidth%
+ \advance\tempa\Rcolwidth%
+ \advance\temp-\tempa%
+ \divide\temp by 2%
+ \leftskip=\temp%
+ \rightskip=-\temp%
+}%
+
+\newcommand{\Columns@print@before@pstart}{%
+ \ifboolexpr{%
+ test{\ifcsstring{before@pstartL@\the\l@dpscL}{\at@every@pstart}}%
+ and test {\ifcsstring{before@pstartR@\the\l@dpscR}{\at@every@pstart}}%
+ and test {\ifdefempty{\at@every@pstart}}}%
+ {}%
+ {%
+ \hb@xt@ \hsize{%
+ \ifdefstring{\columns@position}{L}{}{\hfill }%
+ \par\parbox[t][][t]{\Lcolwidth}{%
+ \csuse{before@pstartL@\the\l@dpscL}%
+ }%
+ \print@columnseparator%
+ \parbox[t][][t]{\Rcolwidth}{%
+ \csuse{before@pstartR@\the\l@dpscR}%
+ }%
+ \ifdefstring{\columns@position}{R}{}{\hfill}%
+ }%
+ }%
+ \global\csundef{before@pstartL@\the\l@dpscL}%
+ \global\csundef{before@pstartR@\the\l@dpscR}%
+}%
+\newcommand{\Columns@print@after@pend}{%
+ \ifboolexpr{%
+ test{\ifcsstring{after@pendL@\the\l@dpscL}{\at@every@pend}}%
+ and test {\ifcsstring{after@pendR@\the\l@dpscR}{\at@every@pend}}%
+ and test {\ifdefempty{\at@every@pend}}}%
+ {}%
+ {%
+ \hb@xt@ \hsize{%
+ \ifdefstring{\columns@position}{L}{}{\hfill }%
+ \parbox[t][][t]{\Lcolwidth}{%
+ \csuse{after@pendL@\the\l@dpscL}%
+ }%
+ \print@columnseparator%
+ \parbox[t][][t]{\Rcolwidth}{%
+ \csuse{after@pendR@\the\l@dpscR}%
+ }%
+ \ifdefstring{\columns@position}{R}{}{\hfill}%
+ }%
+ }%
+ \global\csundef{after@pendL@\the\l@dpscL}%
+ \global\csundef{after@pendR@\the\l@dpscR}%
+}%
+\newcount\numpagelinesL
+\newcount\numpagelinesR
+\newcount\l@dminpagelines
+
+\newcommand*{\Pages}{%
+ \ifl@dpairing%
+ \led@err@Pages@InsideEnv%
+ \fi%
+ \eledsection@correcting@skip=-2\baselineskip% line correcting for section titles.
+ \parledgroup@notespacing@set@correction%
+ \typeout{}%
+ \typeout{*************************** PAGES ***************************}%
+ \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else%
+ \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}%
+ \fi%
+ \setlength{\Lcolwidth}{\textwidth}%
+ \setlength{\Rcolwidth}{\textwidth}%
+ \cleartol@devenpage%
+ \l@dprintingpagestrue%
+ \begingroup%
+ \l@dzeropenalties%
+ \endgraf\global\num@lines=\prevgraf%
+ \global\num@linesR=\prevgraf%
+ \global\par@line=\z@%
+ \global\par@lineR=\z@%
+ \global\l@dpscL=\z@%
+ \global\l@dpscR=\z@%
+ \writtenlinesLfalse%
+ \writtenlinesRfalse%
+ \let\print@Xnotes\print@Xnotes@forpages%
+ \let\print@notesX\print@notesX@forpages%
+ \check@pstarts%
+ \loop\if@pstarts%
+ \global\advance\l@dpscL \@ne%
+ \global\advance\l@dpscR \@ne%
+ \getlinesfromparlistL%
+ \getlinesfromparlistR%
+ \l@dcalc@maxoftwo{\@cs@linesinparL}{\@cs@linesinparR}%
+ {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
+ \check@pstarts%
+ \repeat%
+ \global\l@dpscL=\z@%
+ \global\l@dpscR=\z@%
+ \getlinesfrompagelistL%
+ \getlinesfrompagelistR%
+ \l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}%
+ {\l@dminpagelines}%
+ \check@pstarts%
+ \if@pstarts%
+ \global\advance\l@dpscL \@ne%
+ \global\advance\l@dpscR \@ne%
+ \restore@pstartL@pc%
+ \restore@pstartR@pc%
+ \global\@donereallinesL=\z@%
+ \global\@donetotallinesL=\z@%
+ \global\@donereallinesR=\z@%
+ \global\@donetotallinesR=\z@%
+ \checkraw@text%
+{ \loop\ifaraw@text%
+ \checkpageL%
+ \l@duselanguage{\theledlanguageL}%
+{ \loop\ifl@dsamepage%
+ \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{}%
+ \csuse{before@pstartL@\the\l@dpscL}%
+ \global\csundef{before@pstartL@\the\l@dpscL}%
+ \do@lineL%
+ \xifinlist{\the\l@dpscL}{\eled@sections@@}
+ {\print@eledsectionL}%
+ {}%
+ \advance\numpagelinesL \@ne%
+ \ifshiftedpstarts%
+ \ifdim\ht\l@dleftbox>0pt\hb@xt@%
+ \hsize{\ledstrutL\unhbox\l@dleftbox}%
+ \else%
+ \dimen0=\pagetotal%
+ \advance\dimen0 by \baselineskip%
+ \global\pagetotal=\dimen0%
+ \fi%
+ \else%
+ \parledgroup@correction@notespacing{L}
+ \hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}%
+ \fi%
+ \get@nextboxL%
+ \global\l@dskipversenumberfalse%
+ \ifprint@last@after@pendL%
+ \csuse{after@pendL@\the\l@dpscL}%
+ \global\csundef{after@pendL@\the\l@dpscL}%
+ \fi%
+ \checkpageL%
+ \checkverseL%
+ \checkpbL%
+ \repeat%
+ \ifl@dpagefull%
+ \@writelinesonpageL{\the\numpagelinesL}%
+ \else%
+ \@writelinesonpageL{1000}%
+ \fi%
+ \numpagelinesL \z@%
+ \parledgroup@correction@notespacing@init%
+ \clearl@dleftpage }%
+ \checkpageR%
+ \l@duselanguage{\theledlanguageR}%
+{ \loop\ifl@dsamepage%
+ \initnumbering@sectcountR%
+ \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{}%
+ \csuse{before@pstartR@\the\l@dpscR}%
+ \global\csundef{before@pstartR@\the\l@dpscR}%
+ \do@lineR%
+ \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}%
+ {\print@eledsectionR}%
+ {}%
+ \advance\numpagelinesR \@ne%
+ \ifshiftedpstarts%
+ \ifdim\ht\l@drightbox>0pt\hb@xt@%
+ \hsize{\ledstrutR\unhbox\l@drightbox}%
+ \else%
+ \dimen0=\pagetotal%
+ \advance\dimen0 by \baselineskip%
+ \global\pagetotal=\dimen0%
+ \fi%
+ \else%
+ \parledgroup@correction@notespacing{R}%
+ \hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}%
+ \fi%
+ \get@nextboxR%
+ \global\l@dskipversenumberRfalse%
+ \ifprint@last@after@pendR%
+ \csuse{after@pendR@\the\l@dpscR}%
+ \global\csundef{after@pendR@\the\l@dpscR}%
+ \fi%
+ \checkpageR%
+ \checkverseR%
+ \checkpbR%
+ \repeat%
+ \ifl@dpagefull%
+ \@writelinesonpageR{\the\numpagelinesR}%
+ \else%
+ \@writelinesonpageR{1000}%
+ \fi%
+ \numpagelinesR=\z@%
+ \parledgroup@correction@notespacing@init%
+ \clearl@drightpage}%
+ \checkraw@text%
+ \ifaraw@text%
+ \getlinesfrompagelistL%
+ \getlinesfrompagelistR%
+ \l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}%
+ {\l@dminpagelines}%
+ \fi%
+ \repeat}%
+ \fi%
+ \flush@notes%
+ \flush@notesR%
+ \endgroup%
+ \global\l@dpscL=\z@%
+ \global\l@dpscR=\z@%
+ \global\l@dnumpstartsL=\z@%
+ \global\l@dnumpstartsR=\z@%
+ \global\instanzaLfalse%
+ \global\instanzaRfalse%
+ \l@dprintingpagesfalse%
+ \finish@Pages@notes%Needed to prevent final notes overlap line number
+ \ignorespaces}
+
+\newcommand{\finish@Pages@notes}{%
+ \def\do##1{%
+ \ifnocritical@%
+ \global\newnamebox{##1footins}
+ \fi
+ \ifnofamiliar@%
+ \global\newnamebox{footins##1}
+ \fi
+ \ifvoid\csuse{##1footins}%
+ \ifvoid\csuse{footins##1}\else%
+ \newpage\null%
+ \listbreak%
+ \fi%
+ \else%
+ \newpage\null%
+ \listbreak%
+ \fi%
+ }%
+ \dolistloop{\@series}%
+}%
+\newcommand*{\ledstrutL}{\strut}
+\newcommand*{\ledstrutR}{\strut}
+
+\providecommand{\cleartoevenpage}[1][\@empty]{%
+ \clearpage
+ \ifodd\c@page\hbox{}#1\clearpage\fi}
+\newcommand*{\cleartol@devenpage}{%
+ \ifdim\pagetotal<\topskip% on an empty page
+ \else
+ \clearpage
+ \fi
+ \ifodd\c@page\hbox{}\clearpage\fi%
+}%
+\newcommand*{\clearl@dleftpage}{%
+ \ifdim\pagetotal=0pt\hbox{}\fi%
+ \newpage%
+ \ifodd\c@page\else
+ \led@err@LeftOnRightPage
+ \hbox{}%
+ \cleardoublepage
+ \fi}
+
+\newcommand*{\clearl@drightpage}{%
+ \ifdim\pagetotal=0pt\hbox{}\fi%
+ \newpage%
+ \ifodd\c@page
+ \led@err@RightOnLeftPage
+ \hbox{}%
+ \cleartoevenpage
+ \fi}
+
+\newcommand*{\getlinesfromparlistL}{%
+ \ifx\linesinpar@listL\empty
+ \gdef\@cs@linesinparL{0}%
+ \else
+ \gl@p\linesinpar@listL\to\@cs@linesinparL
+ \fi}
+\newcommand*{\getlinesfromparlistR}{%
+ \ifx\linesinpar@listR\empty
+ \gdef\@cs@linesinparR{0}%
+ \else
+ \gl@p\linesinpar@listR\to\@cs@linesinparR
+ \fi}
+
+\newcommand*{\getlinesfrompagelistL}{%
+ \ifx\linesonpage@listL\empty
+ \gdef\@cs@linesonpageL{1000}%
+ \else
+ \gl@p\linesonpage@listL\to\@cs@linesonpageL
+ \fi}
+\newcommand*{\getlinesfrompagelistR}{%
+ \ifx\linesonpage@listR\empty
+ \gdef\@cs@linesonpageR{1000}%
+ \else
+ \gl@p\linesonpage@listR\to\@cs@linesonpageR
+ \fi}
+
+\newcommand*{\@writelinesonpageL}[1]{%
+ \edef\next{\write\linenum@out{\string\@lopL{#1}}}%
+ \next}
+\newcommand*{\@writelinesonpageR}[1]{%
+ \edef\next{\write\linenum@outR{\string\@lopR{#1}}}%
+ \next}
+
+\newcommand*{\l@dcalc@maxoftwo}[3]{%
+ \ifnum #2>#1\relax
+ #3=#2\relax
+ \else
+ #3=#1\relax
+ \fi}
+\newcommand*{\l@dcalc@minoftwo}[3]{%
+ \ifnum #2<#1\relax
+ #3=#2\relax
+ \else
+ #3=#1\relax
+ \fi}
+
+\newif\ifl@dsamepage
+ \l@dsamepagetrue
+\newif\ifl@dpagefull
+
+\newcommand*{\checkpageL}{%
+ \l@dpagefulltrue
+ \l@dsamepagetrue
+ \check@goal
+ \ifdim\pagetotal<\ledthegoal
+ \ifnum\numpagelinesL<\l@dminpagelines
+ \else
+ \l@dsamepagefalse
+ \l@dpagefullfalse
+ \fi
+ \else
+ \l@dsamepagefalse
+ \l@dpagefulltrue
+ \fi%
+ \ifprint@last@after@pendL%
+ \l@dpagefullfalse%
+ \l@dsamepagefalse%
+ \print@last@after@pendLfalse%
+ \fi%
+ }%
+
+\newcommand*{\checkpageR}{%
+ \l@dpagefulltrue
+ \l@dsamepagetrue
+ \check@goal
+ \ifdim\pagetotal<\ledthegoal
+ \ifnum\numpagelinesR<\l@dminpagelines
+ \else
+ \l@dsamepagefalse
+ \l@dpagefullfalse
+ \fi
+ \else
+ \l@dsamepagefalse
+ \l@dpagefulltrue
+ \fi%
+ \ifprint@last@after@pendR%
+ \l@dpagefullfalse%
+ \l@dsamepagefalse%
+ \print@last@after@pendRfalse%
+ \fi%
+ }%
+
+\newcommand{\checkpbL}{
+ \IfStrEq{\led@pb@setting}{after}{
+ \xifinlistcs{\the\absline@num}{l@prev@pb}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\the\absline@num}{l@prev@nopb}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+ \IfStrEq{\led@pb@setting}{before}{
+ \numdef{\next@absline}{\the\absline@num+1}
+ \xifinlistcs{\next@absline}{l@prev@pb}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\next@absline}{l@prev@nopb}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+}
+
+\newcommand{\checkpbR}{
+ \IfStrEq{\led@pb@setting}{after}{
+ \xifinlistcs{\the\absline@numR}{l@prev@pbR}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\the\absline@numR}{l@prev@nopbR}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+ \IfStrEq{\led@pb@setting}{before}{
+ \numdef{\next@abslineR}{\the\absline@numR+1}
+ \xifinlistcs{\next@abslineR}{l@prev@pbR}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\next@abslineR}{l@prev@nopbR}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+}
+\newcommand{\checkverseL}{
+\ifinstanzaL
+ \iflednopbinverse
+ \ifinserthangingsymbol
+ \numgdef{\prev@abslineverse}{\the\absline@num-1}
+ \IfStrEq{\led@pb@setting}{after}{\lednopbnum{\prev@abslineverse}}{}
+ \IfStrEq{\led@pb@setting}{before}{\ifnum\numpagelinesL<3\ledpbnum{\prev@abslineverse}\fi}{}
+ \fi
+ \fi
+\fi
+}
+\newcommand{\checkverseR}{
+\ifinstanzaR
+ \iflednopbinverse
+ \ifinserthangingsymbolR
+ \numgdef{\prev@abslineverse}{\the\absline@numR-1}
+ \IfStrEq{\led@pb@setting}{after}{\lednopbnumR{\prev@abslineverse}}{}
+ \IfStrEq{\led@pb@setting}{before}{\ifnum\numpagelinesR<3\ledpbnumR{\prev@abslineverse}\fi}{}
+ \fi
+ \fi
+\fi
+}
+\newdimen\ledthegoal
+\ifshiftedpstarts
+ \newcommand*{\@goalfraction}{0.95}
+\else
+ \newcommand*{\@goalfraction}{0.9}
+\fi
+
+\newcommand*{\check@goal}{%
+ \ledthegoal=\@goalfraction\pagegoal}
+\newcommand{\setgoalfraction}[1]{%
+ \xdef\@goalfraction{#1}%
+}
+\newif\ifwrittenlinesL
+\newif\ifwrittenlinesR
+
+\newcommand*{\get@nextboxL}{%
+ \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}% box is not empty
+ \else% box is empty
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>\@donetotallinesL
+ \parledgroup@notes@endL
+ \else
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}=\@donetotallinesL
+ \parledgroup@notes@endL
+ \fi
+ \ifwrittenlinesL\else
+ \@writelinesinparL
+ \writtenlinesLtrue
+ \fi
+ \ifnum\l@dnumpstartsL>\l@dpscL
+ \writtenlinesLfalse
+ \ifbypstart@
+ \global\line@num=0%
+ \resetprevline@%
+ \fi
+ \csuse{after@pendL@\the\l@dpscL}%
+ \global\csundef{after@pendL@\the\l@dpscL}%
+ \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
+ {\the\@donetotallinesL}%
+ {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
+ \global\@donetotallinesL \z@
+ \global\advance\l@dpscL \@ne
+ \global\pstartnumtrue%
+ \restore@pstartL@pc%
+ \parledgroup@notes@endL
+ \parledgroup@correction@notespacing@final{L}
+ \else
+ \fi
+ \fi
+ \fi}
+\newcommand*{\get@nextboxR}{%
+ \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% box is not empty
+ \else% box is empty
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>\@donetotallinesR
+ \parledgroup@notes@endR
+ \else
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}=\@donetotallinesR
+ \parledgroup@notes@endR
+ \fi
+ \ifwrittenlinesR\else
+ \@writelinesinparR
+ \writtenlinesRtrue
+ \fi
+ \ifnum\l@dnumpstartsR>\l@dpscR
+ \writtenlinesRfalse
+ \ifbypstart@R
+ \global\line@numR=0%
+ \resetprevline@%
+ \fi
+ \csuse{after@pendR@\the\l@dpscR}%
+ \global\csundef{after@pendR@\the\l@dpscR}%
+ \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%
+ {\the\@donetotallinesR}%
+ {\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%
+ \global\@donetotallinesR \z@
+ \global\advance\l@dpscR \@ne
+ \global\pstartnumRtrue%
+ \restore@pstartR@pc%
+ \parledgroup@notes@endR
+ \parledgroup@correction@notespacing@final{R}
+ \else
+ \print@last@after@pendRtrue%
+ \fi
+ \fi
+ \fi}
+
+
+
+
+\newcommand{\par@patch@thepage}{%
+ \ifsameparallelpagenumber%
+ \patchcmd{\thepage}%
+ {page}{sameparallelpage@number}%
+ {}%
+ {\led@error@fail@patch@thepage}%
+ \fi%
+}%
+\apptocmd{\pagenumbering}{%
+ \par@patch@thepage%
+ }%
+ {}%
+ {\led@error@fail@patch@pagenumbering}%
+
+\AtBeginDocument{\par@patch@thepage}%
+
+\AtBeginDocument{%
+ \apptocmd{\@outputpage}{%
+ \ifsameparallelpagenumber%
+ \ifl@dprintingpages%
+ \ifodd\c@page\else%
+ \stepcounter{sameparallelpage@number}%
+ \fi%
+ \else%
+ \stepcounter{sameparallelpage@number}%
+ \fi%
+ \else%
+ \stepcounter{sameparallelpage@number}%
+ \fi%
+ }%
+ {}%
+ {\led@error@fail@patch@@outputpage}%
+}
+\newcounter{sameparallelpage@number}%
+\setcounter{sameparallelpage@number}{1}%
+\pretocmd{\chapter}{%
+ \ifl@dprintingpages%
+ \vbox{}%
+ \fi%
+ }%
+ {}%
+ {}%
+\newcommand{\eledsectnotoc}[1]{\xdef\@eledsectnotoc{#1}}
+\eledsectnotoc{R}
+\newcommand{\eledsectmark}[1]{\xdef\@eledsectmark{#1}}
+\eledsectmark{L}
+\newskip\eledsection@correcting@skip
+\newwrite\eled@sectioningR@out
+\def\l@prev@pbR{}
+\def\l@prev@nopbR{}
+\newcommand{\ledpbR}{\write\linenum@outR{\string\led@pbR}}
+\newcommand{\ledpbnumR}[1]{\write\linenum@outR{\string\led@pbnumR{#1}}}
+\newcommand{\lednopbR}{\write\linenum@outR{\string\led@nopbR}}
+\newcommand{\lednopbnumR}[1]{\write\linenum@outR{\string\led@nopbnumR{#1}}}
+\newcommand{\led@pbR}{\listxadd{\l@prev@pbR}{\the\absline@numR}}
+\newcommand{\led@pbnumR}[1]{\listxadd{\l@prev@pbR}{#1}}
+\newcommand{\led@nopbR}{\listxadd{\l@prev@nopbR}{\the\absline@numR}}
+\newcommand{\led@nopbnumR}[1]{\listxadd{\l@prev@nopbR}{#1}}
+\newmarks\parledgroup@
+\newmarks\parledgroup@series
+\newmarks\parledgroup@type
+\newcommand{\parledgroup@notes@startL}{%
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>0%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{footnoteX}{\csuse{bhooknoteX@\splitfirstmarks\parledgroup@series}}{}%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{Xfootnote}{\csuse{bhookXnote@\splitfirstmarks\parledgroup@series}}{}%
+ \fi%
+ \global\ledgroupnotesL@true%
+ \insert@noterule@ledgroup{L}%
+}
+\newcommand{\parledgroup@notes@startR}{%
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>0%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{footnoteX}{\csuse{bhooknoteX@\splitfirstmarks\parledgroup@series}}{}%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{Xfootnote}{\csuse{bhookXnote@\splitfirstmarks\parledgroup@series}}{}%
+ \fi%
+ \global\ledgroupnotesR@true%
+ \insert@noterule@ledgroup{R}%
+}
+\newcommand{\parledgroup@notes@endL}{%
+ \global\ledgroupnotesL@false%
+}
+\newcommand{\parledgroup@notes@endR}{%
+ \global\ledgroupnotesR@false%
+}
+\newcommand{\insert@noterule@ledgroup}[1]{
+ \IfStrEq{\splitbotmarks\parledgroup@}{begin}{%
+ \IfStrEq{\splitbotmarks\parledgroup@type}{Xfootnote}{
+ \csuse{ifledgroupnotes#1@}
+ \vskip\skip\csuse{mp\splitbotmarks\parledgroup@series footins}
+ \csuse{\splitbotmarks\parledgroup@series footnoterule}
+ \fi
+ }
+ {}
+ \IfStrEq{\splitbotmarks\parledgroup@type}{footnoteX}{
+ \csuse{ifledgroupnotes#1@}
+ \vskip\skip\csuse{mpfootins\splitbotmarks\parledgroup@series}
+ \csuse{footnoterule\splitbotmarks\parledgroup@series}
+ \fi
+ }{}
+ }
+ {}
+}
+\newcommand{\setparledgroupnotespacing}[1]{\gdef\@parledgroupnotespacing{#1}}
+\newcommand{\@parledgroupnotespacing}{}
+\dimdef{\parledgroup@notespacing@correction}{0pt}
+\newcommand{\parledgroup@notespacing@set@correction}{%
+ {\@getfirstseries\csuse{Xnotefontsize@\@firstseries}%We suppose all the series has the same footnote size setup
+ \@parledgroupnotespacing\dimgdef{\temp@spacing}{\baselineskip}}%
+ \dimgdef{\parledgroup@notespacing@correction}{\baselineskip-\temp@spacing}%
+}
+\newcommand{\parledgroup@correction@notespacing@init}{
+ \dimdef{\parledgroup@notespacing@correction@accumulated}{0pt}
+ \dimdef{\parledgroup@notespacing@correction@modulo}{0pt}
+}
+\parledgroup@correction@notespacing@init
+\newcommand{\parledgroup@correction@notespacing@final}[1]{
+ \ifparledgroup
+ \vspace{\parledgroup@notespacing@correction@accumulated}
+ \parledgroup@correction@notespacing@init%
+ \ifstrequal{#1}{L}{
+ \numdef{\@checking}{\the\l@dpscL-1}
+ }{
+ \numdef{\@checking}{\the\l@dpscR-1}
+ }
+ \dimdef{\@beforenotes@current@diff}{\csuse{@parledgroup@beforenotes@\@checking L}-\csuse{@parledgroup@beforenotes@\@checking R}}%
+ \ifstrequal{#1}{L}%
+ {% Left
+ \ifdimgreater{\@beforenotes@current@diff}{0pt}{}{\vspace{-\@beforenotes@current@diff}}%
+ }%
+ {% Right
+ \ifdimgreater{\@beforenotes@current@diff}{0pt}{\vspace{\@beforenotes@current@diff}}{}
+ }%
+ \fi
+}
+\newcommand{\parledgroup@correction@notespacing}[1]{%
+ \csuse{ifledgroupnotes#1@}%
+ \vspace{-\parledgroup@notespacing@correction}%
+ \dimdef{\parledgroup@notespacing@correction@accumulated}{\parledgroup@notespacing@correction@accumulated+\parledgroup@notespacing@correction}%
+ \dimdef{\parledgroup@notespacing@correction@modulo}{\parledgroup@notespacing@correction@modulo+\parledgroup@notespacing@correction}%
+ \ifdimless{\parledgroup@notespacing@correction@modulo}{\baselineskip}{}{\advance\numpagelinesL -\@ne%
+ \dimdef{\parledgroup@notespacing@correction@modulo}{\parledgroup@notespacing@correction@modulo-\baselineskip}%
+ }% mean greater than equal
+ \fi%
+}
+\dimdef\parledgroup@beforenotesL{0pt}
+\dimdef\parledgroup@beforenotesR{0pt}
+\newcommand{\parledgroup@beforenotes@save}[1]{
+ \ifparledgroup
+ \csdimgdef{@parledgroup@beforenotes@\the\csuse{l@dnumpstarts#1}#1}{\csuse{parledgroup@beforenotes#1}}
+ \csdimgdef{parledgroup@beforenotes#1}{0pt}
+ \fi
+}
+
+\ifeledmaccompat@%
+
+ \unless\ifnocritical@
+ \let\onlyXside\Xonlyside
+ \fi
+\fi
+\endinput
+%%
+%% End of file `reledpar.sty'.