texlive[42197] Master/texmf-dist: reledmac (3oct16)

commits+karl at tug.org commits+karl at tug.org
Tue Oct 4 00:22:31 CEST 2016


Revision: 42197
          http://tug.org/svn/texlive?view=revision&revision=42197
Author:   karl
Date:     2016-10-04 00:22:30 +0200 (Tue, 04 Oct 2016)
Log Message:
-----------
reledmac (3oct16)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/reledmac/README
    trunk/Master/texmf-dist/doc/latex/reledmac/doc-include/migrate-par.dtx
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/1-criticalnotes.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/1-sidenotes.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/1-tabular.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/1-verses.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-cross_referencing.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-footnote_spacing.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-glossaries.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-indexing.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-lemma_disambigution.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-line_numbers_in_header.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-linespacing.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-manuscript-apparatus.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-notes-width.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-one_series_per_pstart.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-performances.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-reledmac-right-to-left.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-titles_in_line_numbering_with_notes.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-titles_not_in_line_numbering.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_columns_different_languages.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_mwe.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_default.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_nomax.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_nosync.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_shifted.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_column_mix_with_not_column.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_columns_alignment.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_one_series_per_pstart.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_pages_long_notes.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_pages_notes_leftpage.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_verse_text_between.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/migration.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/reledmac.pdf
    trunk/Master/texmf-dist/doc/latex/reledmac/reledpar.pdf
    trunk/Master/texmf-dist/source/latex/reledmac/reledmac.dtx
    trunk/Master/texmf-dist/source/latex/reledmac/reledpar.dtx
    trunk/Master/texmf-dist/tex/latex/reledmac/reledmac.sty
    trunk/Master/texmf-dist/tex/latex/reledmac/reledpar.sty

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/reledmac/README	2016-10-03 22:21:57 UTC (rev 42196)
+++ trunk/Master/texmf-dist/doc/latex/reledmac/README	2016-10-03 22:22:30 UTC (rev 42197)
@@ -113,7 +113,9 @@
         the branch there):
         -   Go to [the project page](https://github.com/maieul/ledmac/).
         -   Choose the correct branch in the "branch" menu.
-        -   Click on the cloud, in the right side.
+        -   Choose "Dowload zip" on the "Clone or download" menu, in the
+            right side.
+        -   Unzip the file
     -   Run the `.ins` files with pdflatex, to obtain the `.sty` files.
     -   Put the `.sty` files with your test files (in the same folder).
     -   Look on file issueXXX.tex get a MWE of the new feature.

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/doc-include/migrate-par.dtx
===================================================================
--- trunk/Master/texmf-dist/doc/latex/reledmac/doc-include/migrate-par.dtx	2016-10-03 22:21:57 UTC (rev 42196)
+++ trunk/Master/texmf-dist/doc/latex/reledmac/doc-include/migrate-par.dtx	2016-10-03 22:22:30 UTC (rev 42197)
@@ -74,3 +74,5 @@
 % \cs{printlinenumR} was deleted. Use \cs{Xlineflag} instead.
 % \subsection{Migration to \reledpar~2.6.1}
 % If you use \package{perpage} package to control footnote numbering, please read the handbook on \reff{perpage}.
+% \subsection{Migration to \reledpar~2.14.0}
+% The \cs{linenumberlist} command is reserved for the left side. For the equivalent feature on the right side, define \cs{linenumberlistR}.

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/1-criticalnotes.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/1-sidenotes.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/1-tabular.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/1-verses.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-cross_referencing.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-footnote_spacing.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-glossaries.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-indexing.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-lemma_disambigution.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-line_numbers_in_header.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-linespacing.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-manuscript-apparatus.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-notes-width.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-one_series_per_pstart.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-performances.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-reledmac-right-to-left.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-titles_in_line_numbering_with_notes.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/2-titles_not_in_line_numbering.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_columns_different_languages.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_mwe.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_default.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_nomax.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_nosync.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/3-reledpar_sync_setting_shifted.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_column_mix_with_not_column.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_columns_alignment.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_one_series_per_pstart.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_pages_long_notes.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_pages_notes_leftpage.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/examples/4-reledpar_verse_text_between.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/migration.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/reledmac.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/reledmac/reledpar.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/reledmac/reledmac.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/reledmac/reledmac.dtx	2016-10-03 22:21:57 UTC (rev 42196)
+++ trunk/Master/texmf-dist/source/latex/reledmac/reledmac.dtx	2016-10-03 22:22:30 UTC (rev 42197)
@@ -428,7 +428,20 @@
 % \changes{v2.15.1}{2016/09/07}{Fix \protect\cs{edindex} in tabular environments.}
 % \changes{v2.15.2}{2016/09/12}{Fix bug with \protect\package{fancyhdr} package 3.8 and later.}
 % \changes{v2.15.3}{2016/09/26}{Fix bug with \protect\cs{section} in optional argument of \protect\cs{pstart} and empty line before \protect\cs{pend} (bug added in v2.8.2).}
-% \changes{v2.15.3}{2016/09/26}{Simplification of the code concerning sectioning command.}
+% \changes{v2.15.3}{2016/09/26}{Simplification of the sectioning command code.}
+% \changes{v2.16.0}{2016/10/02}{Display warning message if using a version of \protect\LaTeX that is too old.}
+% \changes{v2.16.0}{2016/10/02}{Deleting dead code.}
+% \changes{v2.16.0}{2016/10/02}{New options of \protect\cs{fnpos} and \protect\cs{mpfnpos} to set a customized order for familiar and critical footnotes.}
+% \changes{v2.16.0}{2016/10/02}{Compatibility with new features of \protect\reledpar}
+% \changes{v2.16.0}{2016/10/02}{Fix bug with \protect\cs{Xtxtbeforenotes} for notes in three or two columns}
+% \changes{v2.16.0}{2016/10/02}{Fix bug with \protect\cs{Xgroupbylines} for notes in two columns}
+% \changes{v2.16.0}{2016/10/02}{Fix bug with `notenumber' option of \protect\package{indextools} package when indexing texts in familiar footnotes.}
+% \changes{v2.16.0}{2016/10/02}{When indexing texts in familiar footnotes with \protect\cs{edtext}, referring to the line number where the footnote is called.}
+% \changes{v2.16.0}{2016/10/02}{When indexing texts in sidenotes with \protect\cs{edtext}, referring to the line number where the sidenote is called.}
+% \changes{v2.16.0}{2016/10/02}{Fix potential bug when using \protect\cs{edindex} in critical footnotes.}
+% \changes{v2.16.0}{2016/10/02}{Add \protect\cs{Xendpagenumberonlyfirst}, \protect\cs{Xendpagenumberonlyfirstifsingle}, \protect\cs{Xendpagenumberonlyfirstintwo}, \protect\cs{Xendinplaceofpagenumber} and \protect\cs{Xendsympagenum} hooks.}
+% \changes{v2.16.0}{2016/10/02}{When \protect\cs{edindex} is called outside of a \protect\cs{beginnumbering}\protect\ldots\protect\cs{endnumbering} structure, it is automatically switched to \protect\cs{index}, with a warning message.}
+
 % \title{\Macpackage \\
 %      Typeset scholarly editions with \LaTeX\thanks{This file (\dtxfilename)
 % has version number \fileversion, last revised \filedate.}}
@@ -965,16 +978,16 @@
 % There are similar commands, \protect\cs{firstsublinenum}\marg{num} and 
 % \protect\cs{sublinenumincrement}\marg{num} for controlling sub-line numbering.
 %
-% \DescribeMacro{\linenumberlist}
+% \DescribeMacro{\linenumberlist}\label{linenumberlist}
 % You can define \protect\cs{linenumberlist} to specify a non-uniform distribution
 % of printed line numbers. For example: \\
-% \verb?\def\linenumberlist{1,2,3,5,7,11,13,17,19,23,29}? \\
+% \verb?\gdef\linenumberlist{1,2,3,5,7,11,13,17,19,23,29}? \\
 % to have numbers printed on prime-numbered lines only. There must be
 % no spaces within the definition which consists of comma-separated integer
 % numbers. The numbers can be in any order but it is easier to read if you
 % put them in numerical order. Either omitting the definition of
 % \protect\cs{linenumberlist} or following the empty definition \\
-% \verb?\def\linenumberlist{}? \\
+% \verb?\gdef\linenumberlist{}? \\
 % the standard numbering sequence is applied. The standard sequence
 % is that specified by the combination of the \verb+firstlinenum+,
 % \verb+linenumincrement+, \verb+firstsublinenum+ and
@@ -1759,6 +1772,33 @@
 % \begin{verbatim}
 % \mpfnpos{familiar-critical}
 % \end{verbatim}
+%
+% You can also decide to alternate familiar and critical footnotes with your own order.
+% In this case, the second argument of \cs{fnpos} or \cs{mpfnpos} is a comma separated list of values.
+% Each value has the following form:\\
+% \meta{series}\meta{type}
+%
+% \meta{series} is a series letter (A,B,C etc.), while \meta{type} must be either \enquote{critical} or \enquote{familiar}.
+%
+% For example, suppose you want to first print the familiar footnotes of the \enquote{A} series, then all the series of critical footnotes, and finally all the series of familiar footnotes, except the \enquote{A} series.
+% In this case, use the following command:
+% \begin{verbatim}
+%\fnpos{%
+%  {A}{familiar},
+%  {A}{critical},%
+%  {B}{critical},%
+%  {C}{critical},%
+%  {D}{critical},%
+%  {E}{critical},%
+%  {B}{familiar},%
+%  {C}{familiar},%
+%  {D}{familiar},%
+%  {E}{familiar}%
+%}
+% \end{verbatim}
+% Note that you must define the position of all the series of footnotes you use.
+% If you don't, you will have infinite runs of \LaTeX.
+%
 % \section{Critical apparatus appearance}
 % \label{displayoptions}
 % \changes{v1.0.0}{2012/09/15}{New generic commands to customize footnote display.}
@@ -1849,6 +1889,33 @@
 % \DescribeMacro{\Xendsymlinenum}
 % For endnotes, \cs{Xendnumberonlyfirstinline}; \cs{Xendnumberonlyfirstintwolines} and \cs{Xendsymlinenum} are the equivalents of
 % \\ \cs{Xnumberonlyfirstinline}; \cs{Xnumberonlyfirstintwolines} and \cs{Xsymlinenum}.
+%
+% \subsubsection{Print page number only at first time}
+% For endnotes, \reledmac provides tools to print the page number only the first time it is seen.
+% However, when a lemma spans over two pages, the line numbers are normally printed following this pattern: start page number - start line number - end page number - end line number.
+% Consequently, what is the `page number' is not obvious. So: 
+% \DescribeMacro{\Xendpagenumberonlyfirst} \cs{Xendpagenumberonlyfirst}\oarg{s} can be called to tell that the start page number of a lemma is not printed if it is equal to the end page number of the previous lemma.
+% You can use \emph{as complement} one (and only one) of the following commands:
+% \begin{itemize}
+% \item    \cs{Xendpagenumberonlyfirstifsingle}\oarg{s}:
+% the first page number of the lemma will not be printed only if the following conditions are true:
+% \begin{enumerate}
+%   \item The start page number of the lemma is equal to the end page number of the previous lemma.
+%   \item The end page number of the lemma is equal to the start page number of the lemma.
+% \end{enumerate}
+% In this case the end page number will always be printed if differing from the start page number.
+% \item  \cs{Xendpagenumberonlyfirstintwo}\oarg{s}: both the start page number and the end page number of a lemma are not printed if they are both equal  to respectively the start page number and the end page number of the previous lemma.
+%
+% \end{itemize}
+
+%  
+% In any case, you can use:
+% \begin{itemize}
+% \item \DescribeMacro{\Xendsympagenum} \cs{Xendsympagenum}\oarg{series}\marg{c} to tell to print \meta{c} when the page number is not printed.
+% \item \DescribeMacro{\Xendinplaceofpagenumber} \cs{Xendinplaceofpagenumber}\oarg{series}\marg{l} to tell to print a horizontal space of \meta{l} if no symbol is printed instead of page number.
+%
+% \end{itemize}
+%
 % \subsubsection{Arbitrary text before line number}
 % \DescribeMacro{\Xbeforenumber}
 % \cs{Xbeforenumber}\oarg{s}\marg{txt} allow to insert \meta{txt} before the line number, only when the line number is printed, so taking into accout \cs{Xnumberonlyfirstinline} and similar.
@@ -1949,6 +2016,13 @@
 % \textbf{However, it does not change anything for the separator in side number. Use \cs{Xsublinesep} without optional argument or \cs{Xsublinesepside}\marg{txt} to do it.}
 %
 % The default value is \verb+\textnormal{.}+.
+% \subsubsection{Separator between page and line numbers}
+% \changes{v2.16.0}{2016/01/10}{Add \protect\cs{Xpagelinesep} hook.}
+% \DescribeMacro{\Xpagelinesep}
+% \cs{Xpagelinesep}\oarg{s}\marg{txt} changes the separator between the page and line number in footnotes.
+%
+% By default, the value defined for \cs{Xsublinesep} is used.
+%
 % \subsubsection{Space around number}
 % \DescribeMacro{\Xbeforenumber}
 % With \protect\cs{Xbeforenumber}\oarg{s}\marg{l}, you can add some space before the line number in a footnote. If the line number is not printed, the space is not either. The default value is 0~pt.
@@ -2971,9 +3045,9 @@
 %    If two note commands for the same side are called in the same line, they will
 % be appended and separated by a comma.
 %
-% \textbf{The notes will appear only at the second \LaTeX\ run. If the note positions change in your \texttt{.tex} file, 
+% \textbf{The notes will appear only after the second \LaTeX\ run. If the note positions change in your \texttt{.tex} file, 
 % you need two runs to get the correction position in the output file.
-% You are strongly encouraged to use tools like \emph{latexmk}, to be sure to get the good number of runs.}
+% You are strongly encouraged to use tools like \emph{latexmk}, to be sure to get the correct number of runs.}
 % \subsection{Setting}
 %
 % \subsubsection{Width}
@@ -3038,6 +3112,8 @@
 %     \item Load \macpackage.
 %   \item Declare the index with the macro \cs{makeindex} of \package{imakeidx} and \package{indextools}.
 % \end{enumerate}
+%
+% Also note that using \cs{edtext} in familiar footnotes refer to the line the footnotes are called
 % \subsection{Referring to critical notes}
 % If you want to refer to a word inside an
 % \protect\cs{edtext}\marg{lemma}\marg{app} command, \protect\cs{edindex} should be defined inside
@@ -3761,7 +3837,7 @@
 %    \begin{macrocode}
 %<*code>
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{reledmac}[2016/09/26 v2.15.3 typeset critical editions]%
+\ProvidesPackage{reledmac}[2016/10/02 v2.16.0 typesetting critical editions]%
 %    \end{macrocode}
 %
 % \subsection{Package options}
@@ -3895,10 +3971,14 @@
 \RequirePackage{xargs}
 \RequirePackage{etoolbox}
 \@ifl at t@r\fmtversion{2015/10/01}
- {}%
+ {\ifboolexpr{not test{\@ifl at t@r\fmtversion{2016/03/31}} or (test{\ifdefstring{\fmtversion}{2016/03/31}} and test {\ifnumless{\patch at level}{3}})}%
+   {\PackageWarning{reledmac}{You are using a LaTeX version older than 2016/03/31 patch 3.%
+   \MessageBreak You are strongly encouraged to use a newer version.}}%
+   {}%
+ }%
  {\RequirePackage{etex}%
  \csname reserveinserts\endcsname{32}%
-}
+ }%
 \RequirePackage{suffix}
 \RequirePackage{xstring}
 \RequirePackage{ifluatex}
@@ -4141,16 +4221,16 @@
   \@latex at warning@no at line{Label `#1' multiply defined}%
 }%
 \newcommand*{\led at warn@AppLabelOutSecondArgEdtext}[1]{%
-  \reledmac at warning{\string\applabel\space outside of the second argument of an \string\edtext\space `#1' on page \the\pageno.}}%
+  \reledmac at warning{\string\applabel\space outside of the second argument of an \string\edtext\space `#1' on page \thepage.}}%
 \newcommand*{\led at warn@RefUndefined}[1]{%
   \G at refundefinedtrue%
-  \reledmac at warning{Reference `#1' on page \the\pageno\space undefined.%
+  \reledmac at warning{Reference `#1' on page \thepage\space undefined.%
                   Using `000'.}%
   \@latex at warning{Reference `#1' undefined\on at line}%
 }%
 \newcommand*{\led at warn@pairRefUndefined}[1]{%
   \G at refundefinedtrue%
-  \reledmac at warning{Reference `#1:start' and/or `#1:end' on page \the\pageno\space undefined.
+  \reledmac at warning{Reference `#1:start' and/or `#1:end' on page \thepage\space undefined.
                   Using `??'.}%
   \@latex at warning{Reference `#1:start' and/or `#1:end' undefined\on at line}%
 }
@@ -4188,6 +4268,12 @@
 }%
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{\led at err@BadAction}
+%    \begin{macrocode}
+\newcommand*{\led at err@StanzaIndentNotDefined}{%
+  \reledmac at error{You have not defined indentation for the line of verse \number\stanza at count}{\@ehc}}%
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{\led at err@ManySidenotes}
 % \begin{macro}{\led at err@ManyLeftnotes}
 % \begin{macro}{\led at err@ManyRightnotes}
@@ -4312,6 +4398,20 @@
 }%
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{\led at error@fail at patch@endminipage}
+%    \begin{macrocode}
+\newcommand{\led at error@fail at patch@makeindex}{%
+  \reledmac at error{Fail to patch \string\makeindex\space command.}{\@ehc}%
+}%
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\led at warn@edinde at outsidenumbering}
+%    \begin{macrocode}
+\newcommand{\led at warn@edinde at outsidenumbering}{%
+  \reledmac at warning{\string\edindex\space called outside of \string\beginnumbering…\string\endnumbering. \MessageBreak Automatically switched to \string\index.}%
+}%
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{\led at warning@hsizeX at deprecated}
 %    \begin{macrocode}
 \newcommand{\led at warning@hsizeX at deprecated}{%    
@@ -4902,7 +5002,9 @@
 % $0$ for left, $1$ for right, $2$ for outer, and $3$ for inner.
 % \changes{v0.7.0}{2005/02/23}{Added \protect\cs{l at dgetline@margin}}
 %    \begin{macrocode}
-\newcount\line at margin
+\newcount\line at margin%
+\newcount\line at margin@columns%Only for parallel typesetting
+\line at margin@columns=\m at ne%
 
 \newcommand*{\linenummargin}[1]{{%
   \l at dgetline@margin{#1}%
@@ -7354,7 +7456,7 @@
 %    \item \textbf{When this auxiliary file is read at the second run}, different operations are achieved:
 %	\begin{enumerate} 
 %       	\item  Get the rank of each \protect\cs{sameword} in a line (relative rank) from the rank of each \protect\cs{sameword} in all the numbered section (absolute rank):
-%		      \begin{itemize}
+%		     \begin{itemize}
 %        		\item For each paired \protect\cs{sameword} argument and absolute line number, a counter is defined. Its value corresponds to the number of times \protect\cs{sameword}\marg{argument} is called from the beginning of  the lineation to the end of the current line. We also store the same data for the preceding absolute line number, if it does not have \protect\cs{sameword}\marg{argument}.    
 %        		\item  For each \protect\cs{sameword} having the same argument,  we subtract from its absolute rank the number stored for the paired \protect\cs{sameword} argument and previous absolute line number. Consequently, we obtain the relative rank.
 %			       \item See the following example which explains how, for same \protect\cs{sameword}, absolute ranks are transformed to relative ranks.
@@ -7373,7 +7475,7 @@
 %  absolute rank 4 becomes relative rank 4-3 = 1  
 %  4 is stored for this \sameword and line 4
 %  \end{verbatim}
-%	       \end{itemize}
+%	      \end{itemize}
 %        \item Create lists of lists of \protect\cs{sameword} by depth of \protect\cs{edtext}.
 % That is: create a list for \protect\cs{edtext}s of level~1, a list for \protect\cs{edtext}s of level~2, a list for \protect\cs{edtext}s of level~3 etc.
 % For each \protect\cs{edtext} in these lists, we store all of the relative ranks of \protect\cs{saweword} which are called as lemma information. That is: 1) either called in the first argument of \protect\cs{sameword}, or, 2) called in the \protect\cs{lemma} macro of the second argument of \protect\cs{sameword} AND marked by the optional argument of \protect\cs{saweword} in first argument of \protect\cs{edtext}.
@@ -7400,7 +7502,7 @@
 %The list for \protect\cs{edtext}s of level~2 is $\{\{1,2,2,3\},\{5\}\}$.
 %
 % As you can see, the mandatory argument of \protect\cs{sameword} does not matter: we store the rank informations for every word potentially ambiguous.
-%       \end{enumerate}
+%      \end{enumerate}
 %  \item At the second run, when a critical notes is called, we associate it to the next item of the list associated to its \protect\cs{edtext} level. So, in the previous example:
 %  \begin{itemize}
 %      \item Critical notes (A) and (B) are associated with $\{1,2,2,3\}$.
@@ -7413,10 +7515,10 @@
 %         \item The \protect\cs{sameword} command is let  \protect\cs{sameword at inedtext}. 
 %	        \item At each call of this \protect\cs{sameword at inedtext}, we step to the next element of the list associated to the note. Let it be $r$.
 %	      \item For the word marked by \protect\cs{sameword}, we calculate how many time it is called in its line. To do it:
-%           \begin{itemize}
+%          \begin{itemize}
 %            \item We get the absolute line number of the current \protect\cs{sameword}. This absolute line number was stored with a list of relative ranks for the current \protect\cs{edtext}. That means, in the previous example, that if the absolute line number of \protect\cs{edtext} was 1, that critical notes (A) and (B) were not associated with  $\{1,2,2,3\}$ but with $\{(1,1),(2,1),(2,1),(3,1)\}$. Such a method of knowing the absolute line number associated to a \protect\cs{sameword} is required because a \protect\cs{edtext} can overlap many lines, but \protect\cs{sameword} can't get it.
 %            \item When reading the auxiliary file, we get the value associated to the pair composed by the current marked word and the current absolute line number. To this value, we subtract the value associated to the pair composed by the current marked word and the previous absolute line number. Let the result be $n$.
-%           \end{itemize}
+%          \end{itemize}
 %        \item If $n >1 $, that means the current word appears more than once in its line. In this case, we call \protect\cs{showwordrank} with the word as the first argument and $r$ as the second argument. If the word is called only once, we just print it.
 %   \end{itemize}
 % \end{itemize} 
@@ -8504,7 +8606,9 @@
                    \gdef\l at drd@ta{\rlap{{\rightlinenum}}}%
                 \fi
              \else
-                \@l at dtempcntb=\line at margin
+                \ifboolexpr{bool {l at dprintingcolumns} and test {\ifnumgreater{\line at margin@columns}{\m at ne}}}%
+                  {\@l at dtempcntb=\line at margin@columns}%
+                  {\@l at dtempcntb=\line at margin}%
                 \ifnum\@l at dtempcntb>\@ne
                    \advance\@l at dtempcntb \page at num
                 \fi
@@ -8916,7 +9020,9 @@
         {\noindent\csuse{Xtxtbeforenotes@#1}}%
         {\expandafter\insert\csname#1footins\endcsname%
           \bgroup%
-            \noindent\strut\csuse{Xnotefontsize@#1}\csuse{Xtxtbeforenotes@#1}%
+            \noindent%
+            \csuse{\csuse{series at display#1}@begin at insert}{#1}%
+            \strut\csuse{Xnotefontsize@#1}\csuse{Xtxtbeforenotes@#1}%
           \egroup%
         }%
     }%
@@ -10024,18 +10130,7 @@
 %
 %    \begin{macrocode}
 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolfootfmt}[4]{% 
-  \normal at pars%
-  \nottoggle{Xgroupbyline@#4}%
-    {\hsize \csuse{Xhsizethreecol@#4}}%
-    {}%
-  \nottoggle{Xparindent@#4}{\parindent=\z@}{}%
-  \tolerance=5000%
-  \hangindent=\csuse{Xhangindent@#4}%
-  \everypar{\hangindent=\csuse{Xhangindent@#4}}%
-  \@tempdima=\parindent%
-  \csuse{Xcolalign@#4}%
-  \parindent=\@tempdima%
-  \strut%
+  \threecol at begin@insert{#4}%
   \hspace{\parindent}%
   \printlinefootnote{#1}{#4}%
   \print at lemma{#1}{#2}{#4}%
@@ -10046,7 +10141,25 @@
 }%
 %    \end{macrocode}
 % \end{macro}
-%
+% \begin{macro}{\threecol at begin@insert}
+% The \cs{threecol at begin@insert} contains code used at the beginning of any \cs{insert} for critical footnotes in three columns. It is used both by \cs{threecolfootfmt} and by \cs{insert at Xtxtbeforenotes}.
+%    \begin{macrocode}
+\newcommand{\threecol at begin@insert}[1]{%
+  \normal at pars%
+  \nottoggle{Xgroupbyline@#1}%
+    {\hsize \csuse{Xhsizethreecol@#1}}%
+    {}%
+  \nottoggle{Xparindent@#1}{\parindent=\z@}{}%
+  \tolerance=5000%
+  \hangindent=\csuse{Xhangindent@#1}%
+  \everypar{\hangindent=\csuse{Xhangindent@#1}}%
+  \@tempdima=\parindent%
+  \csuse{Xcolalign@#1}%
+  \parindent=\@tempdima%
+  \strut%
+}%
+%    \end{macrocode} 
+% \end{macro}
 % \begin{macro}{\threecolfootgroup}
 % And here is the \verb"footgroup" macro that is called within the
 % output routine to regroup the notes into three columns. Once
@@ -10146,9 +10259,13 @@
 %    \end{macrocode}
 %    \begin{macrocode}
 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolvfootnote}[2]{%
-  \csuse{Xbeforeinserting@#1}%
-  \insert\csname #1footins\endcsname{%
-    \twocolvfootnote at inserted{#1}{#2}%
+  \iftoggle{Xgroupbyline@#1}{%
+    \prepare at Xgroupbyline{#1}{#2}{\twocolvfootnote at inserted}%
+  }{%
+    \X at beforeinsertion{#1}%
+    \insert\csname #1footins\endcsname{%
+      \twocolvfootnote at inserted{#1}{#2}%
+    }%
   }%
 }%
 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolvfootnote at inserted}[2]{%
@@ -10161,16 +10278,7 @@
 %    \end{macrocode}
 %    \begin{macrocode}
 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolfootfmt}[4]{% 4th arg is optional, for backward compatibility
-  \normal at pars%
-  \hsize \csuse{Xhsizetwocol@#4}%
-  \nottoggle{Xparindent@#4}{\parindent=\z@}{}%
-  \tolerance=5000%
-  \hangindent=\csuse{Xhangindent@#4}%
-  \everypar{\hangindent=\csuse{Xhangindent@#4}}%
-  \@tempdima=\parindent%
-  \csuse{Xcolalign@#4}%
-  \parindent=\@tempdima%
-  \strut%
+  \twocol at begin@insert{#4}%
   \hspace{\parindent}%
   \printlinefootnote{#1}{#4}%
   \print at lemma{#1}{#2}{#4}%
@@ -10181,6 +10289,19 @@
 }%
 %    \end{macrocode}
 %    \begin{macrocode}
+\newcommand{\twocol at begin@insert}[1]{%
+  \normal at pars%
+  \hsize \csuse{Xhsizetwocol@#1}%
+  \nottoggle{Xparindent@#1}{\parindent=\z@}{}%
+  \tolerance=5000%
+  \hangindent=\csuse{Xhangindent@#1}%
+  \everypar{\hangindent=\csuse{Xhangindent@#1}}%
+  \@tempdima=\parindent%
+  \csuse{Xcolalign@#1}%
+  \parindent=\@tempdima%
+  \strut%
+}%
+
 \newcommand*{\twocolfootgroup}[1]{%
   \csuse{Xbhookgroup@#1}\par%
   \splittopskip=\ht\strutbox
@@ -10753,7 +10874,7 @@
     {\leavevmode\hbox to \csuse{Xboxstartlinenum@\@currentseries}\bgroup\hfill}%
   \ifl at d@pnum%
     \wrap at edcrossref{\@this at crossref@start}{#1}%
-    \csuse{Xsublinesep@\@currentseries}%
+    \csuse{Xpagelinesep@\@currentseries}%
   \fi%
   \wrap at edcrossref{\@this at crossref@start}{%
     \linenumrep{#2}%
@@ -10789,7 +10910,7 @@
     \fi%
     \ifl at d@pnum%
        \wrap at edcrossref{\@this at crossref@end}{#4}%
-       \csuse{Xsublinesep@\@currentseries}%
+       \csuse{Xpagelinesep@\@currentseries}%
     \fi%
     \ifl at d@elin% 
       \wrap at edcrossref{\@this at crossref@end}{%
@@ -11309,9 +11430,11 @@
         {\footnotelang at poly[R]}%
       \xright at appenditem{%
         \noexpand\led at set@index at fornote{#1}%
+        \noexpand\prepare at edindex@fornote{\l at d@nums}%
         \unexpanded{\def\this at footnoteX@reading}{\the\csname footnote#1 at reading\endcsname}%
         \noexpand\vbfnoteX{#1}{#2}{\expandonce\thisfootnote}%
         \noexpand\led at reinit@index at fornote%
+        \unexpanded{\advance\@edindex at fornote@\m at ne}%
       }%
                          \to\inserts at listR
        \global\advance\insert at countR \@ne%
@@ -11324,9 +11447,11 @@
         {\footnotelang at poly}%
       \xright at appenditem{%
         \noexpand\led at set@index at fornote{#1}%
+        \noexpand\prepare at edindex@fornote{\l at d@nums}%
         \unexpanded{\def\this at footnoteX@reading}{\the\csname footnote#1 at reading\endcsname}%
         \noexpand\vbfnoteX{#1}{#2}{\expandonce\thisfootnote}%
         \noexpand\led at reinit@index at fornote%
+        \unexpanded{\advance\@edindex at fornote@\m at ne}%
       }%
                          \to\inserts at list
       \global\advance\insert at count \@ne%
@@ -12463,6 +12588,8 @@
 \newcommand*{\doendnotes}[1]{%
   \l at dend@close{#1}%
    \begingroup
+      \csxdef{prevpagenum@#1}{}%
+      \csxdef{prevpagerange@#1}{}%
       \makeatletter
       \expandafter\let\csname #1end\endcsname=\endprint
       \input\l at auxdir\jobname.#1end%
@@ -12478,6 +12605,8 @@
 %    \begin{macrocode}
 \newcommand*{\doendnotesbysection}[1]{%
  \l at dend@close{#1}%
+ \csxdef{prevpagenum@#1}{}%
+ \csxdef{prevpagerange@#1}{}%
  \global\expandafter\advance\csname #1end at bysection\endcsname by 1%
  \begingroup%
     \makeatletter%
@@ -12600,7 +12729,8 @@
 % \changes{v0.3.0}{2004/02/14}{Added \protect\cs{linenumr at p} and \protect\cs{sublinenumr at p}
 %              to \protect\cs{printendlines}}
 %    \begin{macrocode}
-\def\printendlines#1|#2|#3|#4|#5|#6|#7|#8|{\begingroup
+\def\printendlines#1|#2|#3|#4|#5|#6|#7|#8|{%
+  \begingroup
   \setprintendlines{#1}{#2}{#3}{#4}{#5}{#6}%
 %    \end{macrocode}
 % The only subtlety left here is when to print a period between
@@ -12609,23 +12739,50 @@
 % sub-line number (in which case we want only the dash) or after an
 % ending line number (in which case we need to insert a period).
 %
-% So, first, print the start lines.
+% So, first, start the start line box, if required.
 %    \begin{macrocode}
   \ifdimequal{\csuse{Xendboxstartlinenum@\@currentseries}}{0pt}%
     {\bgroup}%
     {\leavevmode\hbox to \csuse{Xendboxstartlinenum@\@currentseries}\bgroup\hfill}%
-  \wrap at edcrossref{\@this at crossref@start}{\printnpnum{#1}}%
+%    \end{macrocode}
+% Then, print the start page-
+%    \begin{macrocode}
+  \ifboolexpr{%
+    (%  
+      test{\ifcsstring{prevpagenum@\@currentseries}{#1}}%
+        and not%
+      (togl{Xendpagenumberonlyfirstifsingle@\@currentseries} and bool{l at d@pnum})%
+    )%
+    or%
+    (%
+    test {\ifcsstring{prevpagerange@\@currentseries}{#1-#4}}%
+    )%
+  }%
+    {%
+    \ifcsempty{Xendsympagenum@\@currentseries}%
+      {\hspace{\csuse{Xendinplaceofpagenumber@\@currentseries}}}%
+      {\csuse{Xendsympagenum@\@currentseries}}%
+    }%
+    {%
+    \wrap at edcrossref{\@this at crossref@start}{\printnpnum{#1}}%
+    }%
+%    \end{macrocode}
+% Then, determine what must be printed before the start line.
+%    \begin{macrocode}
   \ifl at d@dash%
-   \ifl at d@pnum%
+    \ifl at d@pnum%
+      \csuse{Xendlineprefixsingle@\@currentseries}%
+    \else%
+      \ifcsempty{Xendlineprefixmore@\@currentseries}%
+        {\csuse{Xendlineprefixsingle@\@currentseries}}%
+        {\csuse{Xendlineprefixmore@\@currentseries}}%
+    \fi%
+  \else%
     \csuse{Xendlineprefixsingle@\@currentseries}%
-   \else%
-    \ifcsempty{Xendlineprefixmore@\@currentseries}%
-      {\csuse{Xendlineprefixsingle@\@currentseries}}
-      {\csuse{Xendlineprefixmore@\@currentseries}}%
-   \fi%
-  \else%
-   \csuse{Xendlineprefixsingle@\@currentseries}%
   \fi%
+%    \end{macrocode}
+% The print the start line, following, if required, by the side flag and the start sub line.
+%    \begin{macrocode}
   \wrap at edcrossref{\@this at crossref@start}{\linenumrep{#2}}%
   \iftoggle{Xendlineflag@\@currentseries}{\ifledRcol@\@Rlineflag\fi}{}%
   \ifl at d@ssub%
@@ -12632,13 +12789,19 @@
     \csuse{Xendsublinesep@\@currentseries}% 
     \wrap at edcrossref{\@this at crossref@start}{\sublinenumrep{#3}}%
   \fi%
+%    \end{macrocode}
+% Close the box.
+%    \begin{macrocode}
   \egroup%
 %    \end{macrocode}
-% And now, print the dash + the end line number, or the line number range symbol.
+% Open the box for the end line.
 %    \begin{macrocode}
   \ifdimequal{\csuse{Xendboxendlinenum@\@currentseries}}{0pt}%
     {\bgroup}%
     {\hbox to \csuse{Xendboxendlinenum@\@currentseries}\bgroup}%
+%    \end{macrocode}
+% Print the dash + the end line number, or the line number range symbol.
+%    \begin{macrocode}
   \ifl at d@Xtwolines%
     \ifl at d@Xmorethantwolines%
       \csuse{Xendmorethantwolines@\@currentseries}%
@@ -12653,9 +12816,23 @@
         \csuse{Xendlinerangeseparator@\@currentseries}%
       \fi%
     \fi%
+%    \end{macrocode}
+% Print the end page number.
+%    \begin{macrocode}
     \ifl at d@pnum%
-     \wrap at edcrossref{\@this at crossref@end}\printnpnum{#4}%
+     \ifcsstring{prevpagerange@\@currentseries}{#1-#4}%
+       {%
+       \ifcsempty{Xendsympagenum@\@currentseries}%
+         {\hspace{\csuse{Xendinplaceofpagenumber@\@currentseries}}}%
+         {\csuse{Xendsympagenum@\@currentseries}}%
+       }%
+       {%
+       \wrap at edcrossref{\@this at crossref@end}\printnpnum{#4}%
+       }%
     \fi%
+%    \end{macrocode}
+% Print the end line number, with if required the line prefix, and followed by the side flag and the subline number.
+%    \begin{macrocode}
     \ifl at d@elin%
       \ifl at d@pnum\csuse{Xendlineprefixsingle@\@currentseries}\fi%
       \wrap at edcrossref{\@this at crossref@end}{\linenumrep{#5}}%
@@ -12668,10 +12845,25 @@
       \wrap at edcrossref{\@this at crossref@end}{\sublinenumrep{#6}}%
     \fi%
   \fi%
+%    \end{macrocode}
+% Close the end line box.
+%    \begin{macrocode}
   \ifdimequal{\csuse{Xendboxendlinenum@\@currentseries}}{0pt}%
     {}%
     {\hfill}%Prevent underfull hbox
   \egroup%
+%    \end{macrocode}
+% And, finally, save, if needed, the current page number for the Xendpagenumberonlyfirst hooks.
+%    \begin{macrocode}
+  \iftoggle{Xendpagenumberonlyfirst@\@currentseries}%
+    {\iftoggle{Xendpagenumberonlyfirstintwo@\@currentseries}%
+      {\csxdef{prevpagerange@\@currentseries}{#1-#4}}%
+      {\csxdef{prevpagenum@\@currentseries}{#4}}%
+    }%
+    {}%
+%    \end{macrocode}
+% Now, the end of \cs{printendlines} macro.
+%    \begin{macrocode}
   \endgroup%
 }%
 
@@ -12758,6 +12950,7 @@
       \csgdef{Xtwolines@#1}{}%
       \csgdef{Xmorethantwolines@#1}{}%
       \csgdef{Xsublinesep@#1}{\fullstop}%
+      \csgdef{Xpagelinesep@#1}{\csname Xsublinesep@#1\endcsname}%for backward compatibility, call Xsublinesep@#1
       \newtoggle{Xtwolinesbutnotmore@#1}%
       \newtoggle{Xtwolinesonlyinsamepage@#1}%
       \newtoggle{Xonlypstart@#1}%
@@ -12843,6 +13036,7 @@
                       \noexpand\csuse{v#1footnote}{#1}%
                        {{\l at d@nums}{\expandonce\@tag}{\expandonce\content}}%
                       \noexpand\Xnote at false% 
+                      \unexpanded{\advance\@edindex at fornote@\m at ne}%
                       \unexpanded{\undef\@this at crossref@start}%
                       \unexpanded{\undef\@this at crossref@end}%
                       \ifbool{indtl at innote}%
@@ -12885,6 +13079,7 @@
                       \unexpanded{\undef\@this at crossref@start}%
                       \unexpanded{\undef\@this at crossref@end}%
                       \noexpand\Xnote at false%
+                      \unexpanded{\advance\@edindex at fornote@\m at ne}%
                       \ifbool{indtl at innote}%
                         {\unexpanded{\let\index\orig@@index}}%
                         {}%
@@ -13180,6 +13375,13 @@
       \newtoggle{Xendlineflag@#1}
      
       \csgdef{Xendlemmafont@#1}{}%
+      
+  \newtoggle{Xendpagenumberonlyfirst@#1}%
+  \newtoggle{Xendpagenumberonlyfirstifsingle@#1}%
+  \newtoggle{Xendpagenumberonlyfirstintwo@#1}%
+  \csgdef{Xendsympagenum@#1}{}%
+  \csgdef{Xendinplaceofpagenumber@#1}{0pt}%
+  
 %    \end{macrocode}
 % End of endnotes declaration
 %    \begin{macrocode}
@@ -13482,7 +13684,8 @@
 \newhooktoggle at series{Xlineflag}[appref,SEref]
 \newhookcommand at series{Xtwolines}[appref,SEref]
 \newhookcommand at series{Xmorethantwolines}[appref,SEref]
-\newhookcommand at series{Xsublinesep}[appref,SEref,side]   
+\newhookcommand at series{Xsublinesep}[appref,SEref,side]%
+\newhookcommand at series{Xpagelinesep}[appref,SEref,side]%   
 \newhooktoggle at series{Xtwolinesbutnotmore}[appref,SEref]
 \newhooktoggle at series{Xtwolinesonlyinsamepage}[appref,SEref]
 \newhookcommand at series{Xlinerangeseparator}[appref,SEref]
@@ -13567,8 +13770,13 @@
   \newhookcommand at series{Xendahookinplaceofnumber}%
 
   \newhookcommand at series{Xendhangindent}%
+
+ \newhooktoggle at series{Xendpagenumberonlyfirst}%
+ \newhooktoggle at series{Xendpagenumberonlyfirstifsingle}%
+ \newhooktoggle at series{Xendpagenumberonlyfirstintwo}%
+ \newhookcommand at series{Xendsympagenum}%
+ \newhookcommand at series{Xendinplaceofpagenumber}%
   
-  
 \fi
 \newhooktoggle at series{Xendlineflag}[apprefwithpage,SErefwithpage]
 \newhookcommand at series{Xendtwolines}[apprefwithpage,SErefwithpage]
@@ -13639,19 +13847,6 @@
 % Now we begin the output routine and associated things.
 %
 %
-% \subsection{Page number management}
-% \begin{macro}{\pageno}
-% \begin{macro}{\advancepageno}
-%  \protect\cs{pageno} is a page number, starting at 1, and \protect\cs{advancepageno}
-% increments the number.
-%    \begin{macrocode}
-\countdef\pageno=0 \pageno=1
-\newcommand*{\advancepageno}{\ifnum\pageno<\z@ \global\advance\pageno\m at ne
-  \else\global\advance\pageno\@ne\fi}
-
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
 %
 %
 % \subsection{Extra footnotes output}
@@ -13673,23 +13868,47 @@
 %    \begin{macrocode}
 \newcommand*{\l at ddoxtrafeet}{%
   \IfStrEq{familiar-critical}{\@fnpos}
-    {\do at feetX\Xdo at feet}%
+    {\do at feetX\do at Xfeet}%
     {%
     \IfStrEq{critical-familiar}{\@fnpos}%
-        {\Xdo at feet\do at feetX}%
-        {\do at feetX\Xdo at feet}%
+        {\do at Xfeet\do at feetX}%
+        {%
+          \setbox\@outputbox \vbox{%
+            \unvbox\@outputbox%
+            \do at feet@custom at order{}{\@fnpos}%
+          }%
+        }%
     }%
 }%
 
 %    \end{macrocode}
 % \end{macro}
-%
-% \begin{macro}{\Xdo at feet}
-% \protect\cs{Xdo at feet} is the code extending \protect\cs{@makecol} to cater for
+% \begin{macro}{\do at feet@custom at order}
+% \cs{do at feet@custom at order} is called when \cs{@fnpos} is neither `familiar-critical', nor `critical-familiar', that is, when the order is more complex.
+% In this case, people must define the order for all footnote series.
+% If they don't, \LaTeX\ could perform an infinite run.
+%    \begin{macrocode}
+\newcommand{\do at feet@custom at order}[2]{%
+  \def\do##1{%
+    \edef\@@notesseries{\@firstoftwo##1}%
+    \edef\@@notetype{\@secondoftwo##1}%
+    \ifdefstring{\@@notetype}{critical}%
+      {\csuse{#1append at Xnotes}{\@@notesseries}}%
+      {\ifdefstring{\@@notetype}{familiar}%
+        {\csuse{#1append at notesX}{\@@notesseries}}%
+        {}%
+      }%
+  }%
+  \expandafter\docsvlist\expandafter{#2}%
+}%
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\do at Xfeet}
+% \protect\cs{do at Xfeet} is the code extending \protect\cs{@makecol} to cater to
 % the extra critical feet. 
-% \changes{v0.4.1}{2004/03/06}{Changed \protect\cs{Xdo at feet} code for easier extensions}
+% \changes{v0.4.1}{2004/03/06}{Changed \protect\cs{do at Xfeet} code for easier extensions}
 %    \begin{macrocode}
-\newcommand*{\Xdo at feet}{%
+\newcommand*{\do at Xfeet}{%
   \setbox\@outputbox \vbox{%
     \unvbox\@outputbox
     \@opXfeet}}
@@ -13697,9 +13916,20 @@
 % \end{macro}
 %
 % \begin{macro}{\@opXfeet}
+% \begin{macro}{\append at Xnotes}
 % \begin{macro}{\print at Xnotes}
 % The extra critical feet to be added to the output.
-% \changes{v0.4.1}{2004/03/06}{Added \protect\cs{@opXfeet}}
+% \changes{v0.4.1}{2004/03/06}{Added \protect\cs{@opXfeet}}.
+% A macro which appends critical notes to the output's routine, also adding vertical space before notes
+%    \begin{macrocode}
+\newcommand{\append at Xnotes}[1]{%
+  \ifvoid\csuse{#1footins}\else%
+      \global\skip\csuse{#1footins}=\csuse{Xbeforenotes@#1}%
+      \global\advance\skip\csuse{#1footins} by\csuse{Xafterrule@#1}%
+      \print at Xnotes{#1}%
+   \fi%
+}%
+%    \end{macrocode}
 % The normal way to add one series,
 % \protect\cs{print at Xnotes}, is replaced by \parpackage when using \protect\cs{Pages}.
 %    \begin{macrocode}
@@ -13716,11 +13946,7 @@
   \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 at Xnotes{##1}%
-       \fi%
+      \append at Xnotes{##1}%
       }%
     \dolistloop{\@series}%
   \fi%
@@ -13728,6 +13954,7 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 %
 % \begin{macro}{\l at ddodoreinxtrafeet}
@@ -13768,11 +13995,22 @@
 % \end{macro}
 %
 % \begin{macro}{\print at notesX}
+% \begin{macro}{\append at notesX}
 % \begin{macro}{\do at feetX}
 % \begin{macro}{\@doreinfeetX}
 % We have to add all the new kinds of familiar footnotes to the output
 % routine. 
-% The normal way to add one series.
+% A macro which appends the familiar footnotes of one series onto the output routine, also adding vertical skip before notes.
+%    \begin{macrocode}
+\newcommand{\append at notesX}[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 at notesX{#1}%
+  \fi%
+}%
+%    \end{macrocode}
+% The normal way to print one series of notes.
 % \protect\cs{print at Xnotes} is replaced by \parpackage when using \protect\cs{Pages}.
 %    \begin{macrocode}
 \newcommand\print at notesX[1]{%
@@ -13790,11 +14028,7 @@
     \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 at notesX{##1}%
-      \fi%
+        \append at notesX{##1}%
       }%
       \dolistloop{\@series}}%
   \fi%
@@ -13817,8 +14051,9 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
-% \subsection{Patching standard output of commands}
+% \subsection{Patching standard output's commands}
 % The \protect\ltxclass{memoir} class does not use the `standard' versions of
 % \protect\cs{@makecol} and \protect\cs{@reinserts}, due to its sidebar insert.
 % We had better add that code if \protect\ltxclass{memoir} is used. (It can
@@ -13826,11 +14061,13 @@
 % |\ifl at dmemoir| here.)
 % \changes{v0.2.1}{2003/09/13}{Major changes to insert code when memoir is loaded}
 % \changes{v2.0.0}{2015/07/19}{\protect\cs{@makecol}, \protect\cs{@reinserts} and \protect\cs{@doclearpage} are patched instead of begin redefined}
-% \changes{v2.0.0}{2015/07/19}{\protect\cs{doxtrafeeti} becomes \protect\cs{do at feetX};
-% \protect\cs{doxtrafeetii} becomes \protect\cs{Xdo at feet};
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{doxtrafeeti} becomes \protect\cs{Xdo at feet};
+% \protect\cs{doxtrafeetii} becomes \protect\cs{do at Xfeet};
 % \protect\cs{@opxtrafeeti} becomes \protect\cs{@opfeetX};
 % \protect\cs{doreinxtrafeetii} becomes \protect\cs{X at doreinfeet};
 % \protect\cs{doreinxtrafeeti} becomes \protect\cs{@doreinfeetX}.}
+% \changes{v2.16.0}{2016/10/02}{\protect\cs{Xdo at feet} becomes \protect\cs{do at Xfeet}}
+% \changes{v2.16.0}{2016/10/02}{More explicit error message when missing to define stanza indent.}
 %    \begin{macrocode}
 \@ifclassloaded{memoir}{%
 %    \end{macrocode}
@@ -13842,9 +14079,9 @@
 %    \end{macrocode}
 % \protect\ltxclass{memoir} has not been loaded, so patch \protect\cs{@makecol} and 
 % \protect\cs{@reinserts}.
-% If the \package{fancyhdr} package $<$ 3.8 has been loaded, we patch the \cs{latex at makecol} command, because this package redefines in the preamble the standard \cs{@makecol}, to call  \cs{latex at makecol} which have been \cs{let} to \cs{@makecol}. 
+% If the \package{fancyhdr} package $<$ version 3.8 has been loaded, we patch the \cs{latex at makecol} command, because this package redefines the standard \cs{@makecol} in the preamble, to call \cs{latex at makecol} which have been \cs{let} to \cs{@makecol}. 
 % If this package is not loaded, we directly patch \cs{@makecol}. 
-% If the \package{fancyhdr} package $\geq$ 3.8, we also directly patch \cs{@makecol}, because \package{fancyhdr} does its own patch \cs{AtBeginDocument}.
+% If the \package{fancyhdr} package $\geq$ version 3.8, we also directly patch \cs{@makecol}, because \package{fancyhdr} does its own patch \cs{AtBeginDocument}.
 %    \begin{macrocode}
   \ifboolexpr{%
     test{\@ifpackageloaded{fancyhdr}}%
@@ -14448,6 +14685,10 @@
 \def\Xsublinesep at appref{\fullstop}%
 \def\Xsublinesep at SEref{\fullstop}%
 
+\def\Xpagelinesep at appref{\fullstop}%
+\def\Xpagelinesep at SEref{\fullstop}%
+
+
 \newtoggle{Xtwolinesbutnotmore at appref}%
 \newtoggle{Xtwolinesbutnotmore at SEref}%
 
@@ -14502,18 +14743,33 @@
 % Note that some of these hooks are declared but no user command can change their values. Such hooks are not pertinent for \verb+appref+ and \verb+apprefwithpage+ pseudo-series, but their values are nonetheless tested in some  macros.
 %    \begin{macrocode}
 
-\xdef\Xboxstartlinenum at appref{0pt}
-\xdef\Xboxstartlinenum at SEref{0pt}
+\gdef\Xboxstartlinenum at appref{0pt}
+\gdef\Xboxstartlinenum at SEref{0pt}
 
-\xdef\Xboxendlinenum at appref{0pt}
-\xdef\Xboxendlinenum at SEref{0pt}
+\gdef\Xboxendlinenum at appref{0pt}
+\gdef\Xboxendlinenum at SEref{0pt}
 
-\xdef\Xendboxstartlinenum at apprefwithpage{0pt}
-\xdef\Xendboxstartlinenum at SErefwithpage{0pt}
+\gdef\Xendboxstartlinenum at apprefwithpage{0pt}
+\gdef\Xendboxstartlinenum at SErefwithpage{0pt}
 
-\xdef\Xendboxendlinenum at apprefwithpage{0pt}
-\xdef\Xendboxendlinenum at SErefwithpage{0pt}
+\gdef\Xendboxendlinenum at apprefwithpage{0pt}
+\gdef\Xendboxendlinenum at SErefwithpage{0pt}
 
+\newtoggle{Xendpagenumberonlyfirst at apprefwithpage}
+\newtoggle{Xendpagenumberonlyfirst at SErefwithpage}
+
+\newtoggle{Xendpagenumberonlyfirstifsingle at apprefwithpage}
+\newtoggle{Xendpagenumberonlyfirstifsingle at SErefwithpage}
+
+\newtoggle{Xendpagenumberonlyfirstintwo at apprefwithpage}
+\newtoggle{Xendpagenumberonlyfirstintwo at SErefwithpage}
+
+\gdef\Xendsympagenum at apprefwithpage
+\gdef\Xendsympagenum at SErefwithpage
+
+\gdef\Xendinplaceofpagenumber at apprefwithpage
+\gdef\Xendinplaceofpagenumber at SErefwithpage
+
 %    \end{macrocode}
 % Now, declare the default values of \protect\cs{@apprefprefixsingle} and \protect\cs{@apprefprefixmore}, \cs{@SErefprefix}, \cs{@SErefprefixmore} and the commands which defines them.
 % \changes{v2.5.0}{2015/11/13}{Debug \protect\cs{setapprefprefixsingle}}
@@ -14988,15 +15244,15 @@
 % \begin{itemize}
 %   \item Store the content of \protect\cs{ledsidenote} to \protect\cs{l at dcsnotetext} in any cases.
 %   \item Store the content of \protect\cs{rightsidenote} to:
-%         \begin{itemize}
+%        \begin{itemize}
 %             \item \protect\cs{l at dcsnotetext} if \protect\cs{ledsidenote} is to be put on right.
 %             \item \protect\cs{l at dcsnotetext@r} if \protect\cs{ledsidenote} is to be put on left.
-%         \end{itemize}
+%        \end{itemize}
 %   \item Store the content of \protect\cs{leftsidenote} to:
-%         \begin{itemize}
+%        \begin{itemize}
 %             \item \protect\cs{l at dcsnotetext} if \protect\cs{ledsidenote} is to be put on left.
 %             \item \protect\cs{l at dcsnotetext@l} if \protect\cs{ledsidenote} is to be put on right.
-%         \end{itemize}
+%        \end{itemize}
 % \end{itemize}
 % \cs{vl at disnote} and \cs{vl at dosnote} just call \cs{vl at dlsnote} or \cs{vl at drsnote}, depending of the page.
 %    \begin{macrocode}
@@ -15127,6 +15383,7 @@
 % \changes{v1.4.1}{2012/11/16}{Remove spurious spaces.}
 %    \begin{macrocode}
 \newcommand*{\affixside at note}{%
+    \prepare at edindex@fornote{\the\page at num|\the\line at num|\the\subline at num|\the\page at num|\the\line at num|\the\subline at num|}%
     \def\sidenotecontent@{}%
     \numgdef{\itemcount@}{0}%
     \def\do##1{%
@@ -15173,6 +15430,7 @@
       \fi%
     \fi%
   \fi%
+  \advance\@edindex at fornote@\m at ne%
 }
 %    \end{macrocode}
 % \end{macro}%
@@ -15205,7 +15463,7 @@
         {%
             \IfStrEq{familiar-critical}{\@mpfnpos}%
                 {\l at dfamendmini\l at dedendmini}%
-                {\l at dedendmini\l at dfamendmini}%
+                {\do at feet@custom at order{mp@}{\@mpfnpos}}%
         }%
     }%
 %    \end{macrocode}
@@ -15214,6 +15472,7 @@
 %
 % \begin{macro}{\l at dedbeginmini}
 % \begin{macro}{\l at dedendmini}
+% \begin{macro}{\mp at append@Xnotes}
 % These handle the initiation and closure of critical footnotes in a
 % minipage environment. 
 %    \begin{macrocode}
@@ -15235,37 +15494,44 @@
       \fi%
     \fi
     \def\do##1{%
-      \ifvoid\csuse{mp##1footins}\else%
-        \ifl at dpairing\ifparledgroup%
-          \ifledRcol%
-            \dimgdef{\parledgroup at beforenotesR}{\parledgroup at beforenotesR+\skip\@nameuse{mp##1footins}}%
-          \else%
-             \dimgdef{\parledgroup at beforenotesL}{\parledgroup at beforenotesL+\skip\@nameuse{mp##1footins}}%
-          \fi%
-         \fi\fi%
-     \ifcsstring{series at display##1}{paragraph}{}{%
-        \setbox\@nameuse{mp##1footins}=\vbox{%
-          \csuse{Xnotefontsize@##1}%
-          \ifcsdef{Xhsize\csuse{series at display##1}@##1}{%
-            \hsize\csuse{Xhsize\csuse{series at display##1}@##1}%
-          }{}%
-          \noindent\csuse{Xtxtbeforenotes@##1}%
-          \unvbox\@nameuse{mp##1footins}%
-          \@parboxrestore%
-        }%
-      }%
-         \csuse{mp##1footgroup}{##1}%
-    \fi}%
+      \mp at append@Xnotes{##1}%
+    }%
     \dolistloop{\@series}%
   \fi%
 }%
-
+\newcommand{\mp at append@Xnotes}[1]{%
+\ifvoid\csuse{mp#1footins}\else%
+  \ifl at dpairing%
+    \ifparledgroup%
+      \ifledRcol%
+        \dimgdef{\parledgroup at beforenotesR}{\parledgroup at beforenotesR+\skip\@nameuse{mp#1footins}}%
+      \else%
+         \dimgdef{\parledgroup at beforenotesL}{\parledgroup at beforenotesL+\skip\@nameuse{mp#1footins}}%
+      \fi%
+     \fi%
+   \fi%
+  \ifcsstring{series at display#1}{paragraph}{}{%
+    \setbox\@nameuse{mp#1footins}=\vbox{%
+      \csuse{Xnotefontsize@#1}%
+      \ifcsdef{Xhsize\csuse{series at display#1}@#1}{%
+        \hsize\csuse{Xhsize\csuse{series at display#1}@#1}%
+      }{}%
+      \noindent\csuse{Xtxtbeforenotes@#1}%
+      \unvbox\@nameuse{mp#1footins}%
+      \@parboxrestore%
+    }%
+  }%
+  \csuse{mp#1footgroup}{#1}%
+\fi%
+}%
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\l at dfambeginmini}
 % \begin{macro}{\l at dfamendmini}
+% \begin{macro}{\mp at append@notesX}
 % These handle the initiation and closure of familiar footnotes in a
 % minipage environment. 
 %    \begin{macrocode}
@@ -15279,15 +15545,20 @@
 \newcommand*{\l at dfamendmini}{%
  \unless\ifnofamiliar@%
    \def\do##1{%
-     \ifvoid\csuse{mpfootins##1}\else%
-     \csuse{mpfootgroup##1}{##1}%
-   \fi}%
+     \mp at append@notesX{##1}%
+   }%
    \dolistloop{\@series}%
  \fi%
 }%
+\newcommand{\mp at append@notesX}[1]{%
+  \ifvoid\csuse{mpfootins#1}\else%
+     \csuse{mpfootgroup#1}{#1}%
+  \fi%
+}%
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\@iiiminipage}
 % This is our extended form of the kernel \protect\cs{@iiiminipage} defined in
@@ -15532,11 +15803,11 @@
 % \end{macro}
 %
 % \subsection{Code specific to \cs{edindex} in critical footnotes}
-% \begin{macro}{\if at edindex@fornote at true}
-% This boolean test is switching at the beginning of each critical note,
-% to allow index referring to this note.
+% \begin{macro}{\@edindex at fornote@}
+% This counter is increased at the beginning of every notes (footnote and and sidenotes), and decreased at the end of every notes.
+% If its value is greater than 0, that means we are inside a note.
 %    \begin{macrocode}
-\newif\if at edindex@fornote@
+\newcount\@edindex at fornote@
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\prepare at edindex@fornote}
@@ -15547,7 +15818,7 @@
 %    \begin{macrocode}
 \newcommand{\prepare at edindex@fornote}[1]{%
     \l at dp@rsefootspec#1|%
-    \@edindex at fornote@true%
+    \advance\@edindex at fornote@\@ne%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -15665,7 +15936,7 @@
 %    \begin{macrocode}
 \newcommandx{\@wredindex}[2][1=\expandonce\jobname,usedefault]{%#1 = the index name, #2 = the text
   \ifl at imakeidx%
-    \if at edindex@fornote@%
+    \ifnum\@edindex at fornote@>\z@%
       \IfSubStr[1]{#2}{|}{\get at index@command#2+}{\get at index@command#2|+}%
       \get at edindex@ledinnote at command%
       \expandafter\imki at wrindexentry{#1}{\@index at txt|(\@ledinnote at command}{\thestartpageline}%
@@ -15675,7 +15946,7 @@
       \imki at wrindexentry{#1}{\@index at txt\@edindex at hyperref}{\thepageline}%
     \fi%
   \else%
-    \if at edindex@fornote@%
+    \ifnum\@edindex at fornote@>\z@%
       \IfSubStr[1]{#2}{|}{\get at index@command#2+}{\get at index@command#2|+}%
       \get at edindex@ledinnote at command%
       \expandafter\protected at write\@indexfile{}%
@@ -15698,11 +15969,22 @@
 % \protect\cs{edindex} to do nothing.
 %    \begin{macrocode}
 \pretocmd{\makeindex}{%
-  \def\edindex{\@bsphack
-  \doedindexlabel
-  \begingroup
-  \@sanitize
-  \@wredindex}}{}{}
+  \def\edindex{%
+    \ifboolexpr{bool{numbering} or bool{numberingR}}{%
+      \@bsphack%
+      \doedindexlabel%
+      \begingroup%
+      \@sanitize%
+      \@wredindex%
+    }%
+    {%
+      \led at warn@edinde at outsidenumbering%
+      \index%
+    }%
+  }%
+}%
+{}%
+{\led at error@fail at patch@makeindex}%
 \newcommand{\edindex}[1]{\@bsphack\@esphack}
 %    \end{macrocode}
 % \end{macro}
@@ -15854,7 +16136,7 @@
     {%
     \renewcommand{\index}[2][\indtl at jobname]{%
       \orig@@index[##1]{%
-        ##2|innotenumber{\csuse{thefootnote#1}}%
+        ##2|innotenumber{\this at footnoteX@reading}%
         }%
       }%
     }%
@@ -16215,12 +16497,20 @@
 %    \begin{macrocode}
 \newcommandx{\stanza at line}[1][1]{
     \ifnum\value{stanzaindentsrepetition}=0
-        \parindent=\csname sza@\number\stanza at count
-                 @\endcsname\stanzaindentbase
+        \ifcsdef{sza@\number\stanza at count @}%
+          {%
+          \parindent=\csname sza@\number\stanza at count  @\endcsname\stanzaindentbase%
+          }{%
+          \led at err@StanzaIndentNotDefined%
+          }%
     \else
-        \parindent=\csname sza@\number\stanza at modulo
-                 @\endcsname\stanzaindentbase
-        \managestanza at modulo
+        \ifcsdef{sza@\number\stanza at modulo @}{%
+          \parindent=\csname sza@\number\stanza at modulo @\endcsname\stanzaindentbase%
+          \managestanza at modulo%
+        }%
+        {%
+        \led at err@StanzaIndentNotDefined%
+        }%
     \fi
     \pstart[#1]\stanza at hang\ignorespaces}
 \xdef\stanza at hang{\noexpand\leavevmode\noexpand\startlock
@@ -18163,19 +18453,19 @@
 % The system of \protect\cs{eledxxxx} commands to section text work like this:
 % \begin{enumerate}
 %     \item When one of these commands is called, \macpackage  writes to an auxiliary files:
-%      \begin{itemize}
+%     \begin{itemize}
 %           \item The section level.
 %           \item The section title.
 %           \item The side (when \protect\package{eledpar} is used).
 %           \item The pstart where the command is called.
 %           \item If we have starred version or not.
-%      \end{itemize}
+%     \end{itemize}
 %   \item \macpackage adds the title of the section to pstart, as  normal content. This is to enable critical notes.
 %   \item When \LaTeX\ is run a other time, this file is read. That:
-%     \begin{itemize}
+%    \begin{itemize}
 %         \item Adds the pstart number to a list of pstarts where a sectioning command is used.
 %         \item Defines a command, the name of which contains the pstart number, and which calls the normal \LaTeX\ sectioning command.
-%     \end{itemize}
+%    \end{itemize}
 %   \item This last command is called when the pstart is effectively printed.
 % \end{enumerate}
 % \subsection{\protect\cs{beforeeledchapter} command} 

Modified: trunk/Master/texmf-dist/source/latex/reledmac/reledpar.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/reledmac/reledpar.dtx	2016-10-03 22:21:57 UTC (rev 42196)
+++ trunk/Master/texmf-dist/source/latex/reledmac/reledpar.dtx	2016-10-03 22:22:30 UTC (rev 42197)
@@ -279,7 +279,12 @@
 % \changes{v2.12.0}{2016/07/01}{Fix bug with \protect\cs{lineationR}.}
 % \changes{v2.12.0}{2016/07/01}{Fix bug with \protect\cs{AtBeginPairs}.}
 % \changes{v2.13.0}{2016/07/22}{Compatibility with the new features of \protect\macpackage 2.15.0}
-% \changes{v2.13.1}{2016/09/26}{Simplification of the code concerning sectioning command}
+% \changes{v2.13.1}{2016/09/26}{Simplification of the code concerning the sectioning command}
+% \changes{v2.14.0}{2016/10/02}{New commands to have specific line margins for text in parallel columns}
+% \changes{v2.14.0}{2016/10/02}{Add \protect\cs{linenumberlistR}, equivalent to \protect\cs{linenumberlist} for the right side.}
+% \changes{v2.14.0}{2016/10/02}{When indexing texts in sidenotes with \protect\cs{edtext}, referring to the line number where the sidenote is called.}
+% \changes{v2.14.0}{2016/10/02}{More explicit error message when missing to define stanza indent.}
+% \changes{v2.14.0}{2016/10/02}{Error message when missing to define left / right side.}
 % ^^A PW added following as the definitions are at some unknown elsewhere
 %
 % \newcommand{\egstart}{%
@@ -945,6 +950,10 @@
 
 % \protect\cs{lineation*} macro is the equivalent of \macpackage \protect\cs{lineation} macro for both sides.
 %
+% \Macpackage allows you to define a \cs{linenumberlist} to explicitly define (\reff{reledmac-linenumberlist}) in which line the line number will be printed.
+% In parallel typesetting, this command affects only left side.
+% For right side, you have to define \cs{linenumberlistR}.
+%
 % \DescribeMacro{\linenumberstyleR}
 % \DescribeMacro{\sublinenumberstyleR}
 % \DescribeMacro{\linenumberstyle*}
@@ -958,6 +967,16 @@
 % \cs{linenummarginR}\marg{margin} sets the line margin for right side.
 % \cs{linenummargin*}\marg{margin} sets for both side.
 % \meta{margin} can be, as for \macpackage's \cs{linenummargin} one of these values: \verb+left+, \verb+right+, \verb+inner+, \verb+outer+.
+% 
+% \DescribeMacro{\linenummarginColumns}
+% \DescribeMacro{\linenummarginColumnsR}
+% \DescribeMacro{\linenummarginColumns*}
+% Suppose you typeset parallel texts both in parallel pages and in parallel columns. 
+% In this case, your setting of line margin in parallel pages could be different from your setting of line margin in parallel columns. 
+% For example, you could want to have line numbers on the right when your are in parallel pages, but when you are in parallel columns, to have them on the left for the left column and on the right for the right column.
+% 
+% In this case, you can use \cs{linenummarginColumns}, which overrides the default setting for the left column, \cs{linenummarginColumnsR} which overrides the default setting for the right column, and \cs{linenummarginColumns*}, which overrides the default for both left and right columns.
+%
 % \DescribeMacro{\setRlineflag}\label{Rlineflag}
 % A ``R''  is appended to the line numbers of the
 % right texts. 
@@ -1199,7 +1218,7 @@
 %    \begin{macrocode}
 %<*code>
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{reledpar}[2016/09/26 v2.13.1 reledmac extension for parallel texts]%
+\ProvidesPackage{reledpar}[2016/10/02 v2.14.0 reledmac extension for parallel texts]%
 
 %    \end{macrocode}
 % \subsection{Package's requirement}
@@ -1414,7 +1433,24 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
-
+% \begin{macro}{\led at err@Pages at WithoutRightside}
+% \begin{macro}{\led at err@Pages at WithoutLeftside}
+% \begin{macro}{\led at err@Columns at WithoutRightside}
+% \begin{macro}{\led at err@Columns at WithoutLeftside}
+%    \begin{macrocode}
+\newcommand*{\led at err@Pages at WithoutRightside}{%
+  \reledpar at error{\string\Pages\space called without previous `Rightside` environment (or environment without content)}{\@ehc}}%
+\newcommand*{\led at err@Pages at WithoutLeftside}{%
+  \reledpar at error{\string\Pages\space called without previous `Leftside` environment (or environment without content)}{\@ehc}}%
+  \newcommand*{\led at err@Columns at WithoutRightside}{%
+  \reledpar at error{\string\Columns\space called without previous `Rightside` environment (or environment without content)}{\@ehc}}%
+\newcommand*{\led at err@Columns at WithoutLeftside}{%
+  \reledpar at error{\string\Columns\space called without previous `Leftside` environment (or environment without content)}{\@ehc}}%
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\led at error@fail at patch@thepage}
 %    \begin{macrocode}
@@ -1518,6 +1554,26 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \begin{macro}{\ifcsboxvoid}
+% The \cs{ifcsboxvoid} is a complement to the \package{etoolbox} package. 
+% The first argument is a box name, the second is a the \meta{true} value, the third the \meta{false} value.
+% If the first argument refers to a not existing box, or if it refers to a void box, the \meta{true} value is returned. In other case, the \meta{false} is returned.
+%    \begin{macrocode}
+\newcommand*{\ifcsboxvoid}[1]{%
+  \ifcsname#1\endcsname%
+    \expandafter\ifvoid\csname #1\endcsname%
+      \expandafter\expandafter%
+      \expandafter\@firstoftwo%
+    \else%
+      \expandafter\expandafter%
+      \expandafter\@secondoftwo%
+    \fi%
+  \else%
+    \expandafter\@firstoftwo%
+  \fi%
+}%
+%    \end{macrocode}
+% \end{macro}
 %
 % \begin{macro}{\newnamecount}
 % \begin{macro}{\usenamecount}
@@ -1883,6 +1939,41 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+% \begin{macro}{\linenummarginColumns*}
+% \begin{macro}{\linenummarginColumns}
+% \begin{macro}{\linenummarginColumnsR}
+% The \cs{linenummarginColumns} macro overrides the definition of the line margin when typesetting in parallel columns.
+%    \begin{macrocode}
+
+\newcount\line at margin@columnsR%
+\line at margin@columnsR=\m at ne%
+
+\newcommand{\linenummarginColumns}[1]{%
+  \l at dgetline@margin{#1}%
+  \ifnum\@l at dtempcntb>\m at ne%
+    \global\line at margin@columns=\@l at dtempcntb%
+  \fi%
+}%
+
+\WithSuffix\newcommand\linenummarginColumns*[1]{%
+  \l at dgetline@margin{#1}%
+  \ifnum\@l at dtempcntb>\m at ne%
+    \global\line at margin@columns=\@l at dtempcntb%
+    \global\line at margin@columnsR=\@l at dtempcntb%
+  \fi%
+}%
+
+\newcommand{\linenummarginColumnsR}[1]{%
+  \l at dgetline@margin{#1}%
+  \ifnum\@l at dtempcntb>\m at ne%
+    \global\line at margin@columnsR=\@l at dtempcntb%
+  \fi%
+}%
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 % \subsection{Setting lineation start and step} 
 % \begin{macro}{\c at firstlinenumR}
 % \begin{macro}{\c at linenumincrementR}
@@ -4007,6 +4098,7 @@
   \fi}
 
 
+\let\linenumberlistR\empty%
 \newcommand*{\affixline at numR}{%
 \ifledgroupnotesR@\else\ifnumberline
 \ifl at dskipnumber
@@ -4018,15 +4110,15 @@
     \ch at cksub@lockR
   \else
     \@l at dtempcntb=\line at numR
-    \ifx\linenumberlist\empty
+    \ifx\linenumberlistR\empty%
       \l at dcalcnum{\line at numR}{\c at firstlinenumR}{\c at linenumincrementR}%
     \else
       \@l at dtempcnta=\line at numR
-      \edef\rem at inder{,\linenumberlist,\number\line at numR,}%
+      \edef\rem at inderR{,\linenumberlistR,\number\line at numR,}%
         \edef\sc at n@list{\def\noexpand\sc at n@list
-        ####1,\number\@l at dtempcnta,####2|{\def\noexpand\rem at inder{####2}}}%
-      \sc at n@list\expandafter\sc at n@list\rem at inder|%
-        \ifx\rem at inder\empty\advance\@l at dtempcnta\@ne\fi
+        ####1,\number\@l at dtempcnta,####2|{\def\noexpand\rem at inderR{####2}}}%
+      \sc at n@list\expandafter\sc at n@list\rem at inderR|%
+        \ifx\rem at inderR\empty\advance\@l at dtempcnta\@ne\fi%
      \fi
      \ch at ck@l at ckR
   \fi
@@ -4039,7 +4131,9 @@
           \gdef\l at drd@ta{\rlap{{\rightlinenumR}}}%
         \fi
       \else
-        \@l at dtempcntb=\line at marginR
+        \ifboolexpr{bool {l at dprintingcolumns} and test {\ifnumgreater{\line at margin@columnsR}{\m at ne}}}%
+          {\@l at dtempcntb=\line at margin@columnsR}%
+          {\@l at dtempcntb=\line at marginR}%
         \ifnum\@l at dtempcntb>\@ne
           \advance\@l at dtempcntb by\page at numR
         \fi
@@ -4085,7 +4179,9 @@
        \gdef\l at drd@ta{\rlap{{\rightpstartnumL}}}%
      \fi
     \else
-      \@l at dtempcntb=\line at margin
+     \ifboolexpr{bool {l at dprintingcolumns} and test {\ifnumgreater{\line at margin@columns}{\m at ne}}}%
+          {\@l at dtempcntb=\line at margin@columns}%
+          {\@l at dtempcntb=\line at margin}%
      \ifnum\@l at dtempcntb>\@ne
        \advance\@l at dtempcntb \page at num
      \fi
@@ -4106,7 +4202,9 @@
        \gdef\l at drd@ta{\rlap{{\rightpstartnumR}}}%
      \fi
     \else
-      \@l at dtempcntb=\line at marginR
+     \ifboolexpr{bool {l at dprintingcolumns} and test {\ifnumgreater{\line at margin@columnsR}{\m at ne}}}%
+          {\@l at dtempcntb=\line at margin@columnsR}%
+          {\@l at dtempcntb=\line at marginR}%
      \ifnum\@l at dtempcntb>\@ne
        \advance\@l at dtempcntb \page at numR
      \fi
@@ -4601,6 +4699,7 @@
 % \changes{v1.1.2}{2012/10/06}{Remove spurious space between line number and line content}
 %    \begin{macrocode}
 \newcommand*{\affixside at noteR}{%
+    \prepare at edindex@fornote{\the\page at numR|\the\line at numR|\the\subline at numR|\the\page at numR|\the\line at numR|\the\subline at numR|}%
     \def\sidenotecontent@{}%
     \numgdef{\itemcount@}{0}%
     \def\do##1{%
@@ -4644,6 +4743,7 @@
       \fi%
     \fi%
   \fi%
+  \advance\@edindex at fornote@\m at ne%
 }
 
 %    \end{macrocode}
@@ -4749,12 +4849,20 @@
 %    \begin{macrocode}
 \newcommand*{\@astanza at line}{%
   \ifnum\value{stanzaindentsrepetition}=0
-      \parindent=\csname sza@\number\stanza at count
-               @\endcsname\stanzaindentbase
+        \ifcsdef{sza@\number\stanza at count @}%
+          {%
+          \parindent=\csname sza@\number\stanza at count  @\endcsname\stanzaindentbase%
+          }{%
+          \led at err@StanzaIndentNotDefined%
+          }%
   \else
-      \parindent=\csname sza@\number\stanza at modulo
-               @\endcsname\stanzaindentbase
-      \managestanza at modulo
+        \ifcsdef{sza@\number\stanza at modulo @}{%
+          \parindent=\csname sza@\number\stanza at modulo @\endcsname\stanzaindentbase%
+          \managestanza at modulo%
+        }%
+        {%
+        \led at err@StanzaIndentNotDefined%
+        }%
   \fi
   \endgraf
   \stanza at hang%
@@ -5139,9 +5247,14 @@
   \ifl at dpairing%
     \led at err@Columns at InsideEnv%
   \fi%
-  \expandafter\ifvoid\csname l at dRcolrawbox1\endcsname%
-    \led at err@Columns at WithoutEnv%
-  \else%
+    \ifboolexpr{test{\ifcsboxvoid{l at dRcolrawbox1}} or test{\ifcsboxvoid{l at dLcolrawbox1}}}{%
+    \ifcsboxvoid{l at dRcolrawbox1}{%
+        \ifcsboxvoid{l at dLcolrawbox1}%
+          {\led at err@Columns at WithoutEnv}%
+          {\led at err@Columns at WithoutRightside}%
+      }%
+      {\led at err@Columns at WithoutLeftside}%
+  }{%
   \global\l at dprintingcolumnstrue%
   \eledsection at correcting@skip=-\baselineskip% Correction for sections' titles
   \ifnum\l at dnumpstartsL=\l at dnumpstartsR\else
@@ -5269,7 +5382,8 @@
   \ignorespaces
     \global\instanzaLfalse%
     \global\instanzaRfalse%
-  \fi}
+  }%
+}%
 
 %    \end{macrocode}
 % \end{macro}
@@ -5586,9 +5700,14 @@
   \ifl at dpairing%
     \led at err@Pages at InsideEnv%
   \fi%
-  \expandafter\ifvoid\csname l at dRcolrawbox1\endcsname%
-    \led at err@Pages at WithoutEnv%
-  \else%
+  \ifboolexpr{test{\ifcsboxvoid{l at dRcolrawbox1}} or test{\ifcsboxvoid{l at dLcolrawbox1}}}{%
+    \ifcsboxvoid{l at dRcolrawbox1}{%
+        \ifcsboxvoid{l at dLcolrawbox1}%
+          {\led at err@Pages at WithoutEnv}%
+          {\led at err@Pages at WithoutRightside}%
+      }%
+      {\led at err@Pages at WithoutLeftside}%
+  }{%
   \ifstrequal{#1}{mainmatter}{\Pages at mainmattertrue}{\Pages at mainmatterfalse}%
   \eledsection at correcting@skip=-2\baselineskip% line correcting for section titles.
   \parledgroup at notespacing@set at correction%
@@ -5899,7 +6018,7 @@
 % Prevent final notes from overlapping the line number
 %    \begin{macrocode}
  \finish at Pages@notes%
-  \ignorespaces\fi}
+  \ignorespaces}}%
 
 
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/tex/latex/reledmac/reledmac.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/reledmac/reledmac.sty	2016-10-03 22:21:57 UTC (rev 42196)
+++ trunk/Master/texmf-dist/tex/latex/reledmac/reledmac.sty	2016-10-03 22:22:30 UTC (rev 42197)
@@ -31,10 +31,12 @@
 
 
 
+
+
 %%
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{reledmac}[2016/09/26 v2.15.3 typeset critical editions]%
+\ProvidesPackage{reledmac}[2016/10/02 v2.16.0 typesetting critical editions]%
 \RequirePackage{xkeyval}
 \newif\ifparledgroup
 \DeclareOptionX{series}[A,B,C,D,E]{\xdef\default at series{#1}}
@@ -110,10 +112,14 @@
 \RequirePackage{xargs}
 \RequirePackage{etoolbox}
 \@ifl at t@r\fmtversion{2015/10/01}
- {}%
+ {\ifboolexpr{not test{\@ifl at t@r\fmtversion{2016/03/31}} or (test{\ifdefstring{\fmtversion}{2016/03/31}} and test {\ifnumless{\patch at level}{3}})}%
+   {\PackageWarning{reledmac}{You are using a LaTeX version older than 2016/03/31 patch 3.%
+   \MessageBreak You are strongly encouraged to use a newer version.}}%
+   {}%
+ }%
  {\RequirePackage{etex}%
  \csname reserveinserts\endcsname{32}%
-}
+ }%
 \RequirePackage{suffix}
 \RequirePackage{xstring}
 \RequirePackage{ifluatex}
@@ -206,16 +212,16 @@
   \@latex at warning@no at line{Label `#1' multiply defined}%
 }%
 \newcommand*{\led at warn@AppLabelOutSecondArgEdtext}[1]{%
-  \reledmac at warning{\string\applabel\space outside of the second argument of an \string\edtext\space `#1' on page \the\pageno.}}%
+  \reledmac at warning{\string\applabel\space outside of the second argument of an \string\edtext\space `#1' on page \thepage.}}%
 \newcommand*{\led at warn@RefUndefined}[1]{%
   \G at refundefinedtrue%
-  \reledmac at warning{Reference `#1' on page \the\pageno\space undefined.%
+  \reledmac at warning{Reference `#1' on page \thepage\space undefined.%
                   Using `000'.}%
   \@latex at warning{Reference `#1' undefined\on at line}%
 }%
 \newcommand*{\led at warn@pairRefUndefined}[1]{%
   \G at refundefinedtrue%
-  \reledmac at warning{Reference `#1:start' and/or `#1:end' on page \the\pageno\space undefined.
+  \reledmac at warning{Reference `#1:start' and/or `#1:end' on page \thepage\space undefined.
                   Using `??'.}%
   \@latex at warning{Reference `#1:start' and/or `#1:end' undefined\on at line}%
 }
@@ -228,6 +234,8 @@
 \newcommand{\led at warn@SeriesStillExist}[1]{%
   \reledmac at warning{Series #1 is still existing !}%
 }%
+\newcommand*{\led at err@StanzaIndentNotDefined}{%
+  \reledmac at error{You have not defined indentation for the line of verse \number\stanza at count}{\@ehc}}%
 \newcommand{\led at err@ManySidenotes}{%
   \ifledRcol@%
      \reledmac at warning{\itemcount@\space sidenotes on line \the\line at numR\space p. \the\page at numR}%
@@ -290,6 +298,12 @@
 \newcommand{\led at error@fail at patch@endminipage}{%
   \reledmac at error{Fail to patch \string\endminipage\space command.}{\@ehc}%
 }%
+\newcommand{\led at error@fail at patch@makeindex}{%
+  \reledmac at error{Fail to patch \string\makeindex\space command.}{\@ehc}%
+}%
+\newcommand{\led at warn@edinde at outsidenumbering}{%
+  \reledmac at warning{\string\edindex\space called outside of \string\beginnumbering…\string\endnumbering. \MessageBreak Automatically switched to \string\index.}%
+}%
 \newcommand{\led at warning@hsizeX at deprecated}{%
   \reledmac at warning{\string\hsizeX\space command deprecated, use \string\widthX\space instead.}%
 }%
@@ -504,7 +518,9 @@
        \fi
     \fi
   \fi}}
-\newcount\line at margin
+\newcount\line at margin%
+\newcount\line at margin@columns%Only for parallel typesetting
+\line at margin@columns=\m at ne%
 
 \newcommand*{\linenummargin}[1]{{%
   \l at dgetline@margin{#1}%
@@ -1972,7 +1988,9 @@
                    \gdef\l at drd@ta{\rlap{{\rightlinenum}}}%
                 \fi
              \else
-                \@l at dtempcntb=\line at margin
+                \ifboolexpr{bool {l at dprintingcolumns} and test {\ifnumgreater{\line at margin@columns}{\m at ne}}}%
+                  {\@l at dtempcntb=\line at margin@columns}%
+                  {\@l at dtempcntb=\line at margin}%
                 \ifnum\@l at dtempcntb>\@ne
                    \advance\@l at dtempcntb \page at num
                 \fi
@@ -2188,7 +2206,9 @@
         {\noindent\csuse{Xtxtbeforenotes@#1}}%
         {\expandafter\insert\csname#1footins\endcsname%
           \bgroup%
-            \noindent\strut\csuse{Xnotefontsize@#1}\csuse{Xtxtbeforenotes@#1}%
+            \noindent%
+            \csuse{\csuse{series at display#1}@begin at insert}{#1}%
+            \strut\csuse{Xnotefontsize@#1}\csuse{Xtxtbeforenotes@#1}%
           \egroup%
         }%
     }%
@@ -2660,18 +2680,7 @@
   \csname #1footfmt\endcsname #2{#1}%
 }%
 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolfootfmt}[4]{%
-  \normal at pars%
-  \nottoggle{Xgroupbyline@#4}%
-    {\hsize \csuse{Xhsizethreecol@#4}}%
-    {}%
-  \nottoggle{Xparindent@#4}{\parindent=\z@}{}%
-  \tolerance=5000%
-  \hangindent=\csuse{Xhangindent@#4}%
-  \everypar{\hangindent=\csuse{Xhangindent@#4}}%
-  \@tempdima=\parindent%
-  \csuse{Xcolalign@#4}%
-  \parindent=\@tempdima%
-  \strut%
+  \threecol at begin@insert{#4}%
   \hspace{\parindent}%
   \printlinefootnote{#1}{#4}%
   \print at lemma{#1}{#2}{#4}%
@@ -2680,6 +2689,20 @@
     {\strut\par\allowbreak}%
     {}%
 }%
+\newcommand{\threecol at begin@insert}[1]{%
+  \normal at pars%
+  \nottoggle{Xgroupbyline@#1}%
+    {\hsize \csuse{Xhsizethreecol@#1}}%
+    {}%
+  \nottoggle{Xparindent@#1}{\parindent=\z@}{}%
+  \tolerance=5000%
+  \hangindent=\csuse{Xhangindent@#1}%
+  \everypar{\hangindent=\csuse{Xhangindent@#1}}%
+  \@tempdima=\parindent%
+  \csuse{Xcolalign@#1}%
+  \parindent=\@tempdima%
+  \strut%
+}%
 \newcommand*{\threecolfootgroup}[1]{%
   \csuse{Xbhookgroup@#1}\par%
   \splittopskip=\ht\strutbox
@@ -2732,9 +2755,13 @@
   \csxdef{default@#1footins}{500}%
   \multiply\dimen\csname #1footins\endcsname \tw@}
 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolvfootnote}[2]{%
-  \csuse{Xbeforeinserting@#1}%
-  \insert\csname #1footins\endcsname{%
-    \twocolvfootnote at inserted{#1}{#2}%
+  \iftoggle{Xgroupbyline@#1}{%
+    \prepare at Xgroupbyline{#1}{#2}{\twocolvfootnote at inserted}%
+  }{%
+    \X at beforeinsertion{#1}%
+    \insert\csname #1footins\endcsname{%
+      \twocolvfootnote at inserted{#1}{#2}%
+    }%
   }%
 }%
 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolvfootnote at inserted}[2]{%
@@ -2745,16 +2772,7 @@
   \csname #1footfmt\endcsname #2{#1}%
 }%
 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolfootfmt}[4]{% 4th arg is optional, for backward compatibility
-  \normal at pars%
-  \hsize \csuse{Xhsizetwocol@#4}%
-  \nottoggle{Xparindent@#4}{\parindent=\z@}{}%
-  \tolerance=5000%
-  \hangindent=\csuse{Xhangindent@#4}%
-  \everypar{\hangindent=\csuse{Xhangindent@#4}}%
-  \@tempdima=\parindent%
-  \csuse{Xcolalign@#4}%
-  \parindent=\@tempdima%
-  \strut%
+  \twocol at begin@insert{#4}%
   \hspace{\parindent}%
   \printlinefootnote{#1}{#4}%
   \print at lemma{#1}{#2}{#4}%
@@ -2763,6 +2781,19 @@
     {\strut\par\allowbreak}%
     {}%
 }%
+\newcommand{\twocol at begin@insert}[1]{%
+  \normal at pars%
+  \hsize \csuse{Xhsizetwocol@#1}%
+  \nottoggle{Xparindent@#1}{\parindent=\z@}{}%
+  \tolerance=5000%
+  \hangindent=\csuse{Xhangindent@#1}%
+  \everypar{\hangindent=\csuse{Xhangindent@#1}}%
+  \@tempdima=\parindent%
+  \csuse{Xcolalign@#1}%
+  \parindent=\@tempdima%
+  \strut%
+}%
+
 \newcommand*{\twocolfootgroup}[1]{%
   \csuse{Xbhookgroup@#1}\par%
   \splittopskip=\ht\strutbox
@@ -3065,7 +3096,7 @@
     {\leavevmode\hbox to \csuse{Xboxstartlinenum@\@currentseries}\bgroup\hfill}%
   \ifl at d@pnum%
     \wrap at edcrossref{\@this at crossref@start}{#1}%
-    \csuse{Xsublinesep@\@currentseries}%
+    \csuse{Xpagelinesep@\@currentseries}%
   \fi%
   \wrap at edcrossref{\@this at crossref@start}{%
     \linenumrep{#2}%
@@ -3095,7 +3126,7 @@
     \fi%
     \ifl at d@pnum%
        \wrap at edcrossref{\@this at crossref@end}{#4}%
-       \csuse{Xsublinesep@\@currentseries}%
+       \csuse{Xpagelinesep@\@currentseries}%
     \fi%
     \ifl at d@elin%
       \wrap at edcrossref{\@this at crossref@end}{%
@@ -3411,9 +3442,11 @@
         {\footnotelang at poly[R]}%
       \xright at appenditem{%
         \noexpand\led at set@index at fornote{#1}%
+        \noexpand\prepare at edindex@fornote{\l at d@nums}%
         \unexpanded{\def\this at footnoteX@reading}{\the\csname footnote#1 at reading\endcsname}%
         \noexpand\vbfnoteX{#1}{#2}{\expandonce\thisfootnote}%
         \noexpand\led at reinit@index at fornote%
+        \unexpanded{\advance\@edindex at fornote@\m at ne}%
       }%
                          \to\inserts at listR
        \global\advance\insert at countR \@ne%
@@ -3426,9 +3459,11 @@
         {\footnotelang at poly}%
       \xright at appenditem{%
         \noexpand\led at set@index at fornote{#1}%
+        \noexpand\prepare at edindex@fornote{\l at d@nums}%
         \unexpanded{\def\this at footnoteX@reading}{\the\csname footnote#1 at reading\endcsname}%
         \noexpand\vbfnoteX{#1}{#2}{\expandonce\thisfootnote}%
         \noexpand\led at reinit@index at fornote%
+        \unexpanded{\advance\@edindex at fornote@\m at ne}%
       }%
                          \to\inserts at list
       \global\advance\insert at count \@ne%
@@ -4153,6 +4188,8 @@
 \newcommand*{\doendnotes}[1]{%
   \l at dend@close{#1}%
    \begingroup
+      \csxdef{prevpagenum@#1}{}%
+      \csxdef{prevpagerange@#1}{}%
       \makeatletter
       \expandafter\let\csname #1end\endcsname=\endprint
       \input\l at auxdir\jobname.#1end%
@@ -4160,6 +4197,8 @@
    \endgroup}
 \newcommand*{\doendnotesbysection}[1]{%
  \l at dend@close{#1}%
+ \csxdef{prevpagenum@#1}{}%
+ \csxdef{prevpagerange@#1}{}%
  \global\expandafter\advance\csname #1end at bysection\endcsname by 1%
  \begingroup%
     \makeatletter%
@@ -4232,22 +4271,41 @@
       }%
   \fi%
 }%
-\def\printendlines#1|#2|#3|#4|#5|#6|#7|#8|{\begingroup
+\def\printendlines#1|#2|#3|#4|#5|#6|#7|#8|{%
+  \begingroup
   \setprintendlines{#1}{#2}{#3}{#4}{#5}{#6}%
   \ifdimequal{\csuse{Xendboxstartlinenum@\@currentseries}}{0pt}%
     {\bgroup}%
     {\leavevmode\hbox to \csuse{Xendboxstartlinenum@\@currentseries}\bgroup\hfill}%
-  \wrap at edcrossref{\@this at crossref@start}{\printnpnum{#1}}%
+  \ifboolexpr{%
+    (%
+      test{\ifcsstring{prevpagenum@\@currentseries}{#1}}%
+        and not%
+      (togl{Xendpagenumberonlyfirstifsingle@\@currentseries} and bool{l at d@pnum})%
+    )%
+    or%
+    (%
+    test {\ifcsstring{prevpagerange@\@currentseries}{#1-#4}}%
+    )%
+  }%
+    {%
+    \ifcsempty{Xendsympagenum@\@currentseries}%
+      {\hspace{\csuse{Xendinplaceofpagenumber@\@currentseries}}}%
+      {\csuse{Xendsympagenum@\@currentseries}}%
+    }%
+    {%
+    \wrap at edcrossref{\@this at crossref@start}{\printnpnum{#1}}%
+    }%
   \ifl at d@dash%
-   \ifl at d@pnum%
+    \ifl at d@pnum%
+      \csuse{Xendlineprefixsingle@\@currentseries}%
+    \else%
+      \ifcsempty{Xendlineprefixmore@\@currentseries}%
+        {\csuse{Xendlineprefixsingle@\@currentseries}}%
+        {\csuse{Xendlineprefixmore@\@currentseries}}%
+    \fi%
+  \else%
     \csuse{Xendlineprefixsingle@\@currentseries}%
-   \else%
-    \ifcsempty{Xendlineprefixmore@\@currentseries}%
-      {\csuse{Xendlineprefixsingle@\@currentseries}}
-      {\csuse{Xendlineprefixmore@\@currentseries}}%
-   \fi%
-  \else%
-   \csuse{Xendlineprefixsingle@\@currentseries}%
   \fi%
   \wrap at edcrossref{\@this at crossref@start}{\linenumrep{#2}}%
   \iftoggle{Xendlineflag@\@currentseries}{\ifledRcol@\@Rlineflag\fi}{}%
@@ -4274,7 +4332,15 @@
       \fi%
     \fi%
     \ifl at d@pnum%
-     \wrap at edcrossref{\@this at crossref@end}\printnpnum{#4}%
+     \ifcsstring{prevpagerange@\@currentseries}{#1-#4}%
+       {%
+       \ifcsempty{Xendsympagenum@\@currentseries}%
+         {\hspace{\csuse{Xendinplaceofpagenumber@\@currentseries}}}%
+         {\csuse{Xendsympagenum@\@currentseries}}%
+       }%
+       {%
+       \wrap at edcrossref{\@this at crossref@end}\printnpnum{#4}%
+       }%
     \fi%
     \ifl at d@elin%
       \ifl at d@pnum\csuse{Xendlineprefixsingle@\@currentseries}\fi%
@@ -4292,6 +4358,12 @@
     {}%
     {\hfill}%Prevent underfull hbox
   \egroup%
+  \iftoggle{Xendpagenumberonlyfirst@\@currentseries}%
+    {\iftoggle{Xendpagenumberonlyfirstintwo@\@currentseries}%
+      {\csxdef{prevpagerange@\@currentseries}{#1-#4}}%
+      {\csxdef{prevpagenum@\@currentseries}{#4}}%
+    }%
+    {}%
   \endgroup%
 }%
 
@@ -4338,6 +4410,7 @@
       \csgdef{Xtwolines@#1}{}%
       \csgdef{Xmorethantwolines@#1}{}%
       \csgdef{Xsublinesep@#1}{\fullstop}%
+      \csgdef{Xpagelinesep@#1}{\csname Xsublinesep@#1\endcsname}%for backward compatibility, call Xsublinesep@#1
       \newtoggle{Xtwolinesbutnotmore@#1}%
       \newtoggle{Xtwolinesonlyinsamepage@#1}%
       \newtoggle{Xonlypstart@#1}%
@@ -4413,6 +4486,7 @@
                       \noexpand\csuse{v#1footnote}{#1}%
                        {{\l at d@nums}{\expandonce\@tag}{\expandonce\content}}%
                       \noexpand\Xnote at false%
+                      \unexpanded{\advance\@edindex at fornote@\m at ne}%
                       \unexpanded{\undef\@this at crossref@start}%
                       \unexpanded{\undef\@this at crossref@end}%
                       \ifbool{indtl at innote}%
@@ -4455,6 +4529,7 @@
                       \unexpanded{\undef\@this at crossref@start}%
                       \unexpanded{\undef\@this at crossref@end}%
                       \noexpand\Xnote at false%
+                      \unexpanded{\advance\@edindex at fornote@\m at ne}%
                       \ifbool{indtl at innote}%
                         {\unexpanded{\let\index\orig@@index}}%
                         {}%
@@ -4644,6 +4719,13 @@
       \newtoggle{Xendlineflag@#1}
 
       \csgdef{Xendlemmafont@#1}{}%
+
+  \newtoggle{Xendpagenumberonlyfirst@#1}%
+  \newtoggle{Xendpagenumberonlyfirstifsingle@#1}%
+  \newtoggle{Xendpagenumberonlyfirstintwo@#1}%
+  \csgdef{Xendsympagenum@#1}{}%
+  \csgdef{Xendinplaceofpagenumber@#1}{0pt}%
+
   \fi%
     \listxadd{\@series}{#1}
   }
@@ -4819,7 +4901,8 @@
 \newhooktoggle at series{Xlineflag}[appref,SEref]
 \newhookcommand at series{Xtwolines}[appref,SEref]
 \newhookcommand at series{Xmorethantwolines}[appref,SEref]
-\newhookcommand at series{Xsublinesep}[appref,SEref,side]
+\newhookcommand at series{Xsublinesep}[appref,SEref,side]%
+\newhookcommand at series{Xpagelinesep}[appref,SEref,side]%
 \newhooktoggle at series{Xtwolinesbutnotmore}[appref,SEref]
 \newhooktoggle at series{Xtwolinesonlyinsamepage}[appref,SEref]
 \newhookcommand at series{Xlinerangeseparator}[appref,SEref]
@@ -4897,6 +4980,12 @@
 
   \newhookcommand at series{Xendhangindent}%
 
+ \newhooktoggle at series{Xendpagenumberonlyfirst}%
+ \newhooktoggle at series{Xendpagenumberonlyfirstifsingle}%
+ \newhooktoggle at series{Xendpagenumberonlyfirstintwo}%
+ \newhookcommand at series{Xendsympagenum}%
+ \newhookcommand at series{Xendinplaceofpagenumber}%
+
 \fi
 \newhooktoggle at series{Xendlineflag}[apprefwithpage,SErefwithpage]
 \newhookcommand at series{Xendtwolines}[apprefwithpage,SErefwithpage]
@@ -4925,25 +5014,46 @@
 \newhookarg at specific{linerangesep}
 \newtoggle{nomk@}%
 \newcommandx*{\Xnolemmaseparator}[1][1]{\Xlemmaseparator[#1]{}}
-\countdef\pageno=0 \pageno=1
-\newcommand*{\advancepageno}{\ifnum\pageno<\z@ \global\advance\pageno\m at ne
-  \else\global\advance\pageno\@ne\fi}
 
-
 \newcommand*{\l at ddoxtrafeet}{%
   \IfStrEq{familiar-critical}{\@fnpos}
-    {\do at feetX\Xdo at feet}%
+    {\do at feetX\do at Xfeet}%
     {%
     \IfStrEq{critical-familiar}{\@fnpos}%
-        {\Xdo at feet\do at feetX}%
-        {\do at feetX\Xdo at feet}%
+        {\do at Xfeet\do at feetX}%
+        {%
+          \setbox\@outputbox \vbox{%
+            \unvbox\@outputbox%
+            \do at feet@custom at order{}{\@fnpos}%
+          }%
+        }%
     }%
 }%
 
-\newcommand*{\Xdo at feet}{%
+\newcommand{\do at feet@custom at order}[2]{%
+  \def\do##1{%
+    \edef\@@notesseries{\@firstoftwo##1}%
+    \edef\@@notetype{\@secondoftwo##1}%
+    \ifdefstring{\@@notetype}{critical}%
+      {\csuse{#1append at Xnotes}{\@@notesseries}}%
+      {\ifdefstring{\@@notetype}{familiar}%
+        {\csuse{#1append at notesX}{\@@notesseries}}%
+        {}%
+      }%
+  }%
+  \expandafter\docsvlist\expandafter{#2}%
+}%
+\newcommand*{\do at Xfeet}{%
   \setbox\@outputbox \vbox{%
     \unvbox\@outputbox
     \@opXfeet}}
+\newcommand{\append at Xnotes}[1]{%
+  \ifvoid\csuse{#1footins}\else%
+      \global\skip\csuse{#1footins}=\csuse{Xbeforenotes@#1}%
+      \global\advance\skip\csuse{#1footins} by\csuse{Xafterrule@#1}%
+      \print at Xnotes{#1}%
+   \fi%
+}%
 \newcommand\print at Xnotes[1]{%
   \xdef\@currentseries{#1}%
   \csuse{#1footstart}{#1}%
@@ -4953,11 +5063,7 @@
   \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 at Xnotes{##1}%
-       \fi%
+      \append at Xnotes{##1}%
       }%
     \dolistloop{\@series}%
   \fi%
@@ -4982,6 +5088,13 @@
   \fi%
 }
 
+\newcommand{\append at notesX}[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 at notesX{#1}%
+  \fi%
+}%
 \newcommand\print at notesX[1]{%
   \xdef\@currentseries{#1}%
   \csuse{footstart#1}{#1}%
@@ -4993,11 +5106,7 @@
     \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 at notesX{##1}%
-      \fi%
+        \append at notesX{##1}%
       }%
       \dolistloop{\@series}}%
   \fi%
@@ -5307,6 +5416,9 @@
 \def\Xsublinesep at appref{\fullstop}%
 \def\Xsublinesep at SEref{\fullstop}%
 
+\def\Xpagelinesep at appref{\fullstop}%
+\def\Xpagelinesep at SEref{\fullstop}%
+
 \newtoggle{Xtwolinesbutnotmore at appref}%
 \newtoggle{Xtwolinesbutnotmore at SEref}%
 
@@ -5357,18 +5469,33 @@
 \toggletrue{Xendlineflag at SErefwithpage}%Here, exception
 
 
-\xdef\Xboxstartlinenum at appref{0pt}
-\xdef\Xboxstartlinenum at SEref{0pt}
+\gdef\Xboxstartlinenum at appref{0pt}
+\gdef\Xboxstartlinenum at SEref{0pt}
 
-\xdef\Xboxendlinenum at appref{0pt}
-\xdef\Xboxendlinenum at SEref{0pt}
+\gdef\Xboxendlinenum at appref{0pt}
+\gdef\Xboxendlinenum at SEref{0pt}
 
-\xdef\Xendboxstartlinenum at apprefwithpage{0pt}
-\xdef\Xendboxstartlinenum at SErefwithpage{0pt}
+\gdef\Xendboxstartlinenum at apprefwithpage{0pt}
+\gdef\Xendboxstartlinenum at SErefwithpage{0pt}
 
-\xdef\Xendboxendlinenum at apprefwithpage{0pt}
-\xdef\Xendboxendlinenum at SErefwithpage{0pt}
+\gdef\Xendboxendlinenum at apprefwithpage{0pt}
+\gdef\Xendboxendlinenum at SErefwithpage{0pt}
 
+\newtoggle{Xendpagenumberonlyfirst at apprefwithpage}
+\newtoggle{Xendpagenumberonlyfirst at SErefwithpage}
+
+\newtoggle{Xendpagenumberonlyfirstifsingle at apprefwithpage}
+\newtoggle{Xendpagenumberonlyfirstifsingle at SErefwithpage}
+
+\newtoggle{Xendpagenumberonlyfirstintwo at apprefwithpage}
+\newtoggle{Xendpagenumberonlyfirstintwo at SErefwithpage}
+
+\gdef\Xendsympagenum at apprefwithpage
+\gdef\Xendsympagenum at SErefwithpage
+
+\gdef\Xendinplaceofpagenumber at apprefwithpage
+\gdef\Xendinplaceofpagenumber at SErefwithpage
+
 \newcommand\@apprefprefixsingle{}%
 \newcommand\@SErefprefixsingle{}%
 
@@ -5759,6 +5886,7 @@
 \newcommand{\setsidenotesep}[1]{\gdef\@sidenotesep{#1}}
 \newcommand{\@sidenotesep}{, }
 \newcommand*{\affixside at note}{%
+    \prepare at edindex@fornote{\the\page at num|\the\line at num|\the\subline at num|\the\page at num|\the\line at num|\the\subline at num|}%
     \def\sidenotecontent@{}%
     \numgdef{\itemcount@}{0}%
     \def\do##1{%
@@ -5802,6 +5930,7 @@
       \fi%
     \fi%
   \fi%
+  \advance\@edindex at fornote@\m at ne%
 }
 \ifnoledgroup@\else%
 \newcommand*{\l at dfeetbeginmini}{\@ledgrouptrue\l at dedbeginmini\l at dfambeginmini}
@@ -5811,7 +5940,7 @@
         {%
             \IfStrEq{familiar-critical}{\@mpfnpos}%
                 {\l at dfamendmini\l at dedendmini}%
-                {\l at dedendmini\l at dfamendmini}%
+                {\do at feet@custom at order{mp@}{\@mpfnpos}}%
         }%
     }%
 \newcommand*{\l at dedbeginmini}{%
@@ -5832,31 +5961,36 @@
       \fi%
     \fi
     \def\do##1{%
-      \ifvoid\csuse{mp##1footins}\else%
-        \ifl at dpairing\ifparledgroup%
-          \ifledRcol%
-            \dimgdef{\parledgroup at beforenotesR}{\parledgroup at beforenotesR+\skip\@nameuse{mp##1footins}}%
-          \else%
-             \dimgdef{\parledgroup at beforenotesL}{\parledgroup at beforenotesL+\skip\@nameuse{mp##1footins}}%
-          \fi%
-         \fi\fi%
-     \ifcsstring{series at display##1}{paragraph}{}{%
-        \setbox\@nameuse{mp##1footins}=\vbox{%
-          \csuse{Xnotefontsize@##1}%
-          \ifcsdef{Xhsize\csuse{series at display##1}@##1}{%
-            \hsize\csuse{Xhsize\csuse{series at display##1}@##1}%
-          }{}%
-          \noindent\csuse{Xtxtbeforenotes@##1}%
-          \unvbox\@nameuse{mp##1footins}%
-          \@parboxrestore%
-        }%
-      }%
-         \csuse{mp##1footgroup}{##1}%
-    \fi}%
+      \mp at append@Xnotes{##1}%
+    }%
     \dolistloop{\@series}%
   \fi%
 }%
-
+\newcommand{\mp at append@Xnotes}[1]{%
+\ifvoid\csuse{mp#1footins}\else%
+  \ifl at dpairing%
+    \ifparledgroup%
+      \ifledRcol%
+        \dimgdef{\parledgroup at beforenotesR}{\parledgroup at beforenotesR+\skip\@nameuse{mp#1footins}}%
+      \else%
+         \dimgdef{\parledgroup at beforenotesL}{\parledgroup at beforenotesL+\skip\@nameuse{mp#1footins}}%
+      \fi%
+     \fi%
+   \fi%
+  \ifcsstring{series at display#1}{paragraph}{}{%
+    \setbox\@nameuse{mp#1footins}=\vbox{%
+      \csuse{Xnotefontsize@#1}%
+      \ifcsdef{Xhsize\csuse{series at display#1}@#1}{%
+        \hsize\csuse{Xhsize\csuse{series at display#1}@#1}%
+      }{}%
+      \noindent\csuse{Xtxtbeforenotes@#1}%
+      \unvbox\@nameuse{mp#1footins}%
+      \@parboxrestore%
+    }%
+  }%
+  \csuse{mp#1footgroup}{#1}%
+\fi%
+}%
 \newcommand*{\l at dfambeginmini}{%
  \unless\ifnofamiliar@%
    \def\do##1{\csletcs{vfootnote##1}{mpvfootnote##1}}%
@@ -5867,12 +6001,16 @@
 \newcommand*{\l at dfamendmini}{%
  \unless\ifnofamiliar@%
    \def\do##1{%
-     \ifvoid\csuse{mpfootins##1}\else%
-     \csuse{mpfootgroup##1}{##1}%
-   \fi}%
+     \mp at append@notesX{##1}%
+   }%
    \dolistloop{\@series}%
  \fi%
 }%
+\newcommand{\mp at append@notesX}[1]{%
+  \ifvoid\csuse{mpfootins#1}\else%
+     \csuse{mpfootgroup#1}{#1}%
+  \fi%
+}%
 \patchcmd%
   {\@iiiminipage}%
   {\let\@footnotetext\@mpfootnotetext}%
@@ -5989,10 +6127,10 @@
   \pagelinesep%
   \l at dparsedendline%
 }
-\newif\if at edindex@fornote@
+\newcount\@edindex at fornote@
 \newcommand{\prepare at edindex@fornote}[1]{%
     \l at dp@rsefootspec#1|%
-    \@edindex at fornote@true%
+    \advance\@edindex at fornote@\@ne%
 }
 \newcommand{\get at edindex@ledinnote at command}{%
   \ifxindy@%
@@ -6058,7 +6196,7 @@
 \newcommand{\ledinnotemark}[1]{#1\emph{n}}%
 \newcommandx{\@wredindex}[2][1=\expandonce\jobname,usedefault]{%#1 = the index name, #2 = the text
   \ifl at imakeidx%
-    \if at edindex@fornote@%
+    \ifnum\@edindex at fornote@>\z@%
       \IfSubStr[1]{#2}{|}{\get at index@command#2+}{\get at index@command#2|+}%
       \get at edindex@ledinnote at command%
       \expandafter\imki at wrindexentry{#1}{\@index at txt|(\@ledinnote at command}{\thestartpageline}%
@@ -6068,7 +6206,7 @@
       \imki at wrindexentry{#1}{\@index at txt\@edindex at hyperref}{\thepageline}%
     \fi%
   \else%
-    \if at edindex@fornote@%
+    \ifnum\@edindex at fornote@>\z@%
       \IfSubStr[1]{#2}{|}{\get at index@command#2+}{\get at index@command#2|+}%
       \get at edindex@ledinnote at command%
       \expandafter\protected at write\@indexfile{}%
@@ -6087,11 +6225,22 @@
    \@esphack%
 }
 \pretocmd{\makeindex}{%
-  \def\edindex{\@bsphack
-  \doedindexlabel
-  \begingroup
-  \@sanitize
-  \@wredindex}}{}{}
+  \def\edindex{%
+    \ifboolexpr{bool{numbering} or bool{numberingR}}{%
+      \@bsphack%
+      \doedindexlabel%
+      \begingroup%
+      \@sanitize%
+      \@wredindex%
+    }%
+    {%
+      \led at warn@edinde at outsidenumbering%
+      \index%
+    }%
+  }%
+}%
+{}%
+{\led at error@fail at patch@makeindex}%
 \newcommand{\edindex}[1]{\@bsphack\@esphack}
 \newcommand{\hyperlinkformat}[3]{%
   \ifstrempty{#1}%
@@ -6180,7 +6329,7 @@
     {%
     \renewcommand{\index}[2][\indtl at jobname]{%
       \orig@@index[##1]{%
-        ##2|innotenumber{\csuse{thefootnote#1}}%
+        ##2|innotenumber{\this at footnoteX@reading}%
         }%
       }%
     }%
@@ -6371,12 +6520,20 @@
 
 \newcommandx{\stanza at line}[1][1]{
     \ifnum\value{stanzaindentsrepetition}=0
-        \parindent=\csname sza@\number\stanza at count
-                 @\endcsname\stanzaindentbase
+        \ifcsdef{sza@\number\stanza at count @}%
+          {%
+          \parindent=\csname sza@\number\stanza at count  @\endcsname\stanzaindentbase%
+          }{%
+          \led at err@StanzaIndentNotDefined%
+          }%
     \else
-        \parindent=\csname sza@\number\stanza at modulo
-                 @\endcsname\stanzaindentbase
-        \managestanza at modulo
+        \ifcsdef{sza@\number\stanza at modulo @}{%
+          \parindent=\csname sza@\number\stanza at modulo @\endcsname\stanzaindentbase%
+          \managestanza at modulo%
+        }%
+        {%
+        \led at err@StanzaIndentNotDefined%
+        }%
     \fi
     \pstart[#1]\stanza at hang\ignorespaces}
 \xdef\stanza at hang{\noexpand\leavevmode\noexpand\startlock

Modified: trunk/Master/texmf-dist/tex/latex/reledmac/reledpar.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/reledmac/reledpar.sty	2016-10-03 22:21:57 UTC (rev 42196)
+++ trunk/Master/texmf-dist/tex/latex/reledmac/reledpar.sty	2016-10-03 22:22:30 UTC (rev 42197)
@@ -29,7 +29,7 @@
 
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{reledpar}[2016/09/26 v2.13.1 reledmac extension for parallel texts]%
+\ProvidesPackage{reledpar}[2016/10/02 v2.14.0 reledmac extension for parallel texts]%
 
 \RequirePackage{xspace}%
 \RequirePackage{xkeyval}
@@ -101,7 +101,14 @@
   \reledpar at error{\string\Pages\space called without previous `pages` environment}{\@ehc}}
 \newcommand*{\led at err@Columns at WithoutEnv}{%
   \reledpar at error{\string\Columns\space called without previous `pairs` environment}{\@ehc}}
-
+\newcommand*{\led at err@Pages at WithoutRightside}{%
+  \reledpar at error{\string\Pages\space called without previous `Rightside` environment (or environment without content)}{\@ehc}}%
+\newcommand*{\led at err@Pages at WithoutLeftside}{%
+  \reledpar at error{\string\Pages\space called without previous `Leftside` environment (or environment without content)}{\@ehc}}%
+  \newcommand*{\led at err@Columns at WithoutRightside}{%
+  \reledpar at error{\string\Columns\space called without previous `Rightside` environment (or environment without content)}{\@ehc}}%
+\newcommand*{\led at err@Columns at WithoutLeftside}{%
+  \reledpar at error{\string\Columns\space called without previous `Leftside` environment (or environment without content)}{\@ehc}}%
 \newcommand{\led at error@fail at patch@thepage}{%
   \reledpar at error{Fail to patch \string\@thepage\space command.}{\@ehc}%
 }%
@@ -145,6 +152,19 @@
 \providecommand*{\namebox}[1]{%
                      \csname #1\endcsname}
 
+\newcommand*{\ifcsboxvoid}[1]{%
+  \ifcsname#1\endcsname%
+    \expandafter\ifvoid\csname #1\endcsname%
+      \expandafter\expandafter%
+      \expandafter\@firstoftwo%
+    \else%
+      \expandafter\expandafter%
+      \expandafter\@secondoftwo%
+    \fi%
+  \else%
+    \expandafter\@firstoftwo%
+  \fi%
+}%
 \providecommand*{\newnamecount}[1]{%
   \expandafter\newcount\csname #1\endcsname}
 \providecommand*{\usenamecount}[1]{%
@@ -351,6 +371,32 @@
     \global\line at margin=\@l at dtempcntb%
   \fi%
 }
+
+\newcount\line at margin@columnsR%
+\line at margin@columnsR=\m at ne%
+
+\newcommand{\linenummarginColumns}[1]{%
+  \l at dgetline@margin{#1}%
+  \ifnum\@l at dtempcntb>\m at ne%
+    \global\line at margin@columns=\@l at dtempcntb%
+  \fi%
+}%
+
+\WithSuffix\newcommand\linenummarginColumns*[1]{%
+  \l at dgetline@margin{#1}%
+  \ifnum\@l at dtempcntb>\m at ne%
+    \global\line at margin@columns=\@l at dtempcntb%
+    \global\line at margin@columnsR=\@l at dtempcntb%
+  \fi%
+}%
+
+\newcommand{\linenummarginColumnsR}[1]{%
+  \l at dgetline@margin{#1}%
+  \ifnum\@l at dtempcntb>\m at ne%
+    \global\line at margin@columnsR=\@l at dtempcntb%
+  \fi%
+}%
+
 \newcounter{firstlinenumR}
   \setcounter{firstlinenumR}{5}
 \newcounter{linenumincrementR}
@@ -1403,6 +1449,7 @@
     \global\sub at lockR \z@
   \fi}
 
+\let\linenumberlistR\empty%
 \newcommand*{\affixline at numR}{%
 \ifledgroupnotesR@\else\ifnumberline
 \ifl at dskipnumber
@@ -1414,15 +1461,15 @@
     \ch at cksub@lockR
   \else
     \@l at dtempcntb=\line at numR
-    \ifx\linenumberlist\empty
+    \ifx\linenumberlistR\empty%
       \l at dcalcnum{\line at numR}{\c at firstlinenumR}{\c at linenumincrementR}%
     \else
       \@l at dtempcnta=\line at numR
-      \edef\rem at inder{,\linenumberlist,\number\line at numR,}%
+      \edef\rem at inderR{,\linenumberlistR,\number\line at numR,}%
         \edef\sc at n@list{\def\noexpand\sc at n@list
-        ####1,\number\@l at dtempcnta,####2|{\def\noexpand\rem at inder{####2}}}%
-      \sc at n@list\expandafter\sc at n@list\rem at inder|%
-        \ifx\rem at inder\empty\advance\@l at dtempcnta\@ne\fi
+        ####1,\number\@l at dtempcnta,####2|{\def\noexpand\rem at inderR{####2}}}%
+      \sc at n@list\expandafter\sc at n@list\rem at inderR|%
+        \ifx\rem at inderR\empty\advance\@l at dtempcnta\@ne\fi%
      \fi
      \ch at ck@l at ckR
   \fi
@@ -1435,7 +1482,9 @@
           \gdef\l at drd@ta{\rlap{{\rightlinenumR}}}%
         \fi
       \else
-        \@l at dtempcntb=\line at marginR
+        \ifboolexpr{bool {l at dprintingcolumns} and test {\ifnumgreater{\line at margin@columnsR}{\m at ne}}}%
+          {\@l at dtempcntb=\line at margin@columnsR}%
+          {\@l at dtempcntb=\line at marginR}%
         \ifnum\@l at dtempcntb>\@ne
           \advance\@l at dtempcntb by\page at numR
         \fi
@@ -1461,7 +1510,9 @@
        \gdef\l at drd@ta{\rlap{{\rightpstartnumL}}}%
      \fi
     \else
-      \@l at dtempcntb=\line at margin
+     \ifboolexpr{bool {l at dprintingcolumns} and test {\ifnumgreater{\line at margin@columns}{\m at ne}}}%
+          {\@l at dtempcntb=\line at margin@columns}%
+          {\@l at dtempcntb=\line at margin}%
      \ifnum\@l at dtempcntb>\@ne
        \advance\@l at dtempcntb \page at num
      \fi
@@ -1482,7 +1533,9 @@
        \gdef\l at drd@ta{\rlap{{\rightpstartnumR}}}%
      \fi
     \else
-      \@l at dtempcntb=\line at marginR
+     \ifboolexpr{bool {l at dprintingcolumns} and test {\ifnumgreater{\line at margin@columnsR}{\m at ne}}}%
+          {\@l at dtempcntb=\line at margin@columnsR}%
+          {\@l at dtempcntb=\line at marginR}%
      \ifnum\@l at dtempcntb>\@ne
        \advance\@l at dtempcntb \page at numR
      \fi
@@ -1702,6 +1755,7 @@
 
 
 \newcommand*{\affixside at noteR}{%
+    \prepare at edindex@fornote{\the\page at numR|\the\line at numR|\the\subline at numR|\the\page at numR|\the\line at numR|\the\subline at numR|}%
     \def\sidenotecontent@{}%
     \numgdef{\itemcount@}{0}%
     \def\do##1{%
@@ -1745,6 +1799,7 @@
       \fi%
     \fi%
   \fi%
+  \advance\@edindex at fornote@\m at ne%
 }
 
 \newif\ifinserthangingsymbolR
@@ -1803,12 +1858,20 @@
 }%
 \newcommand*{\@astanza at line}{%
   \ifnum\value{stanzaindentsrepetition}=0
-      \parindent=\csname sza@\number\stanza at count
-               @\endcsname\stanzaindentbase
+        \ifcsdef{sza@\number\stanza at count @}%
+          {%
+          \parindent=\csname sza@\number\stanza at count  @\endcsname\stanzaindentbase%
+          }{%
+          \led at err@StanzaIndentNotDefined%
+          }%
   \else
-      \parindent=\csname sza@\number\stanza at modulo
-               @\endcsname\stanzaindentbase
-      \managestanza at modulo
+        \ifcsdef{sza@\number\stanza at modulo @}{%
+          \parindent=\csname sza@\number\stanza at modulo @\endcsname\stanzaindentbase%
+          \managestanza at modulo%
+        }%
+        {%
+        \led at err@StanzaIndentNotDefined%
+        }%
   \fi
   \endgraf
   \stanza at hang%
@@ -1964,9 +2027,14 @@
   \ifl at dpairing%
     \led at err@Columns at InsideEnv%
   \fi%
-  \expandafter\ifvoid\csname l at dRcolrawbox1\endcsname%
-    \led at err@Columns at WithoutEnv%
-  \else%
+    \ifboolexpr{test{\ifcsboxvoid{l at dRcolrawbox1}} or test{\ifcsboxvoid{l at dLcolrawbox1}}}{%
+    \ifcsboxvoid{l at dRcolrawbox1}{%
+        \ifcsboxvoid{l at dLcolrawbox1}%
+          {\led at err@Columns at WithoutEnv}%
+          {\led at err@Columns at WithoutRightside}%
+      }%
+      {\led at err@Columns at WithoutLeftside}%
+  }{%
   \global\l at dprintingcolumnstrue%
   \eledsection at correcting@skip=-\baselineskip% Correction for sections' titles
   \ifnum\l at dnumpstartsL=\l at dnumpstartsR\else
@@ -2055,7 +2123,8 @@
   \ignorespaces
     \global\instanzaLfalse%
     \global\instanzaRfalse%
-  \fi}
+  }%
+}%
 
 \def\print at columnseparator{%
   \ifdim\beforecolumnseparator<0pt%
@@ -2232,9 +2301,14 @@
   \ifl at dpairing%
     \led at err@Pages at InsideEnv%
   \fi%
-  \expandafter\ifvoid\csname l at dRcolrawbox1\endcsname%
-    \led at err@Pages at WithoutEnv%
-  \else%
+  \ifboolexpr{test{\ifcsboxvoid{l at dRcolrawbox1}} or test{\ifcsboxvoid{l at dLcolrawbox1}}}{%
+    \ifcsboxvoid{l at dRcolrawbox1}{%
+        \ifcsboxvoid{l at dLcolrawbox1}%
+          {\led at err@Pages at WithoutEnv}%
+          {\led at err@Pages at WithoutRightside}%
+      }%
+      {\led at err@Pages at WithoutLeftside}%
+  }{%
   \ifstrequal{#1}{mainmatter}{\Pages at mainmattertrue}{\Pages at mainmatterfalse}%
   \eledsection at correcting@skip=-2\baselineskip% line correcting for section titles.
   \parledgroup at notespacing@set at correction%
@@ -2427,7 +2501,7 @@
    \global\edtext at later=\z@%
    \global\edtext at now=\z@%
  \finish at Pages@notes%
-  \ignorespaces\fi}
+  \ignorespaces}}%
 
 \newcommand{\finish at Pages@notes}{%
   \def\do##1{%



More information about the tex-live-commits mailing list