From bd074a3cb017b7513267c1a7de5d665b2aa21da8 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 12 Jan 2015 22:58:51 +0000
Subject: eledmac (12jan15)

git-svn-id: svn://tug.org/texlive/trunk@36040 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/eledmac/eledpar.dtx | 137 ++++++++++++++-------
 1 file changed, 91 insertions(+), 46 deletions(-)

(limited to 'Master/texmf-dist/source/latex/eledmac/eledpar.dtx')

diff --git a/Master/texmf-dist/source/latex/eledmac/eledpar.dtx b/Master/texmf-dist/source/latex/eledmac/eledpar.dtx
index b63d36a2f87..e69406fd3f4 100644
--- a/Master/texmf-dist/source/latex/eledmac/eledpar.dtx
+++ b/Master/texmf-dist/source/latex/eledmac/eledpar.dtx
@@ -51,7 +51,7 @@
 %
 % \fi
 %
-% \CheckSum{4747}
+% \CheckSum{4817}
 %
 % \makeatletter
 % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
@@ -181,6 +181,8 @@
 % \changes{v1.8.2}{2014/08/15}{Debug \cs{eledxxx} with some paper sizes}
 % \changes{v1.8.3}{2014/08/31}{Add \cs{noeledxxx}, as in eledmac}
 % \changes{v1.9.0}{2014/09/16}{Compatibility with \cs{Xnoteswidthliketwocolumns} and \cs{notesXwidthliketwocolumns}}
+% \changes{v1.10.0}{2015/01/12}{Restore critical notes in \cs{eledsection} in parallel columns (this bug was added in 1.8.2).}
+% \changes{v1.10.0}{2015/01/12}{Compatibility with \cs{AtEveryPstart} and \cs{AtEveryPend}}
 % \hyphenation{man-u-script man-u-scripts}
 %
 %
@@ -365,7 +367,7 @@
 % \end{verbatim}
 %
 %
-% Note that the \cs{Columns} \textbf{must be} outside of the \verb+pairs+ environment.
+% Keep in mind that the \cs{Columns} \textbf{must be} outside of the \verb+pairs+ environment.
 % \DescribeMacro{\AtBeginPairs}
 % \changes{v1.9.0}{2014/09/16}{Add \cs{AtBeginPairs} macro.}
 % You can use the macro \cs{AtBeginPairs} to insert a code at the begining of each \verb+pairs+ environments.
@@ -870,7 +872,7 @@
 %    \begin{macrocode}
 %<*code>
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{eledpar}[2014/09/30 v1.9.1 eledmac extension for parallel texts]%
+\ProvidesPackage{eledpar}[2015/01/12 v1.10.0 eledmac extension for parallel texts]%
 
 %    \end{macrocode}
 %  With the option `shiftedpstarts' a long pstart one the left side (or in the right side) don't make a blank on the corresponding pstart, but the blank is put on the bottom of the page. Consequently, the pstarts on the parallel pages are shifted, but the shifted stop at every end of pages.
@@ -1447,6 +1449,8 @@
 \list@create{\insertlines@listR}
 \list@create{\actionlines@listR}
 \list@create{\actions@listR}
+\list@create{\sw@listR}%
+\list@create{\sw@list@inedtextR}%
 
 %    \end{macrocode}
 % \end{macro}
@@ -1501,6 +1505,8 @@
     \list@clear{\actions@listR}%
     \list@clear{\linesinpar@listR}%
     \list@clear{\linesonpage@listR}
+    \list@clear{\sw@listR}%
+    \list@clear{\sw@list@inedtextR}%
   \else
     \list@clearing@reg
     \list@clear{\linesinpar@listL}%
@@ -1651,7 +1657,7 @@
       \page@num=#1\relax
       \last@page@num=#1\relax
       \def\next@page@num{#1}%
-      \listcsxadd{normal@page@break}{\the\absline@num}
+      \listxadd{\normal@page@break}{\the\absline@num}
     \fi
   \fi}
 
@@ -1963,10 +1969,12 @@
 %    \begin{macrocode}
   \begingroup
     \let\@ref=\dummy@ref
+    \let\@lopR\@gobble
     \let\page@action=\relax
     \let\sub@action=\relax
     \let\set@line@action=\relax
     \let\@lab=\relax
+    \let\@sw\@gobbletwo%
     #2
     \global\endpage@num=\page@numR
     \global\endline@num=\line@numR
@@ -2255,6 +2263,7 @@
 %
 %    \begin{macrocode}
 \long\def\critext#1#2/{\leavevmode
+  \@edtext@true%
   \begingroup
     \renewcommand{\@tag}{\no@expands #1}%
     \set@line
@@ -2276,6 +2285,8 @@
        \flag@end}%
        {\if@RTL\flag@start\else\flag@end\fi% be careful on the direction of writing with polyglossia
        }
+  \@edtext@false%
+  \@lemmacommand@false%
   }
 %    \end{macrocode}
 % \end{macro}
@@ -2284,6 +2295,7 @@
 % And similarly for \cs{edtext}.
 %    \begin{macrocode}
 \renewcommand{\edtext}[2]{\leavevmode
+  \@edtext@true%
   \begingroup%
     \renewcommand{\@tag}{\no@expands #1}%
     \set@line%
@@ -2305,6 +2317,8 @@
        \flag@end}%
        {\if@RTL\flag@start\else\flag@end\fi% be careful on the direction of writing with polyglossia
        }%
+   \@edtext@false%
+   \@lemmacommand@false%
 }
 
 %    \end{macrocode}
@@ -2604,7 +2618,7 @@
 % Dump the optional arguments
 %    \begin{macrocode}
   \ifstrempty{#1}%
-    {}%
+    {\csgdef{before@pstartL@\the\l@dnumpstartsL}{\at@every@pstart}}%
     {\csgdef{before@pstartL@\the\l@dnumpstartsL}{\noindent#1}}%
   }
 %    \end{macrocode}
@@ -2650,7 +2664,7 @@
    \iflabelpstart\protected@edef\@currentlabel%
        {\p@pstartR\thepstartR}\fi%
    \ifstrempty{#1}%
-     {}
+     {\csgdef{before@pstartR@\the\l@dnumpstartsR}{\at@every@pstart}}%
      {\csgdef{before@pstartR@\the\l@dnumpstartsR}{\noindent#1}}%
   }
 %    \end{macrocode}
@@ -2697,7 +2711,7 @@
 % Dump content of the optional argument.
 %    \begin{macrocode}
   \ifstrempty{#1}%
-    {}%
+    {\csgdef{after@pendL@\the\l@dnumpstartsL}{\at@every@pend}}%
     {\csgdef{after@pendL@\the\l@dnumpstartsL}{\noindent#1}}%
   }
 %    \end{macrocode}
@@ -2727,7 +2741,7 @@
   \fi%    
   \parledgroup@beforenotes@save{R}%
   \ifstrempty{#1}%
-    {}%
+    {\csgdef{after@pendR@\the\l@dnumpstartsR}{\at@every@pend}}%
     {\csgdef{after@pendR@\the\l@dnumpstartsR}{\noindent#1}}%
 }
 
@@ -2735,6 +2749,15 @@
 % \end{macro}
 %
 %
+% \begin{macro}{\ifprint@last@after@pendL}
+% \begin{macro}{\ifprint@last@after@pendR}
+% Two booleans set to true, when the time is to print the last optional argument of a \cs{pend}.
+%    \begin{macrocode}
+\newif\ifprint@last@after@pendL%
+\newif\ifprint@last@after@pendR%
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
 % \subsection{Processing one line}
 %
 % For parallel texts we have to be able to process left and right lines
@@ -2817,7 +2840,7 @@
   \hb@xt@ \Lcolwidth{%
     \affixline@num
     \xifinlist{\the\l@dpscL}{\eled@sections@@}%
-      {}%
+      {\add@inserts\affixside@note}%
       {\print@lineL}}%
   \add@penaltiesL
   \global\advance\@donereallinesL\@ne
@@ -2847,8 +2870,7 @@
 % \begin{macro}{\print@eledsectionL}
 % \cs{print@eledsectionL} is for line with macro code.
 %    \begin{macrocode}
-\def\print@eledsectionL{%
-    \add@inserts\affixside@note%
+\def\print@eledsectionL{%%
     \addtocounter{pstartL}{-1}%
     \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{}
     \ifdefstring{\@eledsectmark}{L}{}{\ledsectnomark}
@@ -2934,7 +2956,7 @@
   \hb@xt@ \Rcolwidth{%
     \affixline@numR%
     \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}%
-     {}%
+     {\add@insertsR\affixside@noteR}%
      {\print@lineR}%
   }%
   \add@penaltiesR
@@ -2956,16 +2978,13 @@
 \def\print@lineR{%
     \affixpstart@numR%
     \l@dld@ta  %space kept for backward compatibility
-    \add@insertsR%
-    \affixside@noteR%
+    \add@insertsR\affixside@noteR%
     \l@dlsn@te  %space kept for backward compatibility
 \correcthangingR\ledllfill\hb@xt@ \wd\one@lineR{\do@insidelineRhook\inserthangingsymbolR\new@lineR\l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta%
      \l@drsn@te
   }
 
 \def\print@eledsectionR{%
-    \add@insertsR%
-    \affixside@noteR%
     \addtocounter{pstartR}{-1}%
     \initnumbering@sectcountR%
     \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{}%
@@ -3538,8 +3557,13 @@
 % label, storing it in \cs{label@refs}. Finally it defines the
 % label to be \cs{empty} so that any future check will turn up
 % the fact that it has been used.
+% \changes{v1.10.0}{2015/01/12}{Prevent some bugs with cross-referencing when using \cs{autopar} in parallel texts.}
 %    \begin{macrocode}
-\renewcommand*{\edlabel}[1]{\@bsphack
+\renewcommand*{\edlabel}[1]{%
+  \ifl@dpairing\ifautopar%
+    \strut%
+  \fi\fi%
+  \@bsphack%
   \ifledRcol
     \write\linenum@outR{\string\@lab}%
     \ifx\labelref@listR\empty
@@ -3707,11 +3731,11 @@
   \ifnumberedpar@
   \gdef\@tag{#1}%
     \ifledRcol%
-      \xright@appenditem{\noexpand\vl@dbfnote{{\csexpandonce{@tag}}}{\@thefnmark}}%
+      \xright@appenditem{\noexpand\vl@dbfnote{{\expandonce\@tag}}{\@thefnmark}}%
                          \to\inserts@listR
        \global\advance\insert@countR \@ne%
     \else%
-      \xright@appenditem{\noexpand\vl@dbfnote{{\csexpandonce{@tag}}}{\@thefnmark}}%
+      \xright@appenditem{\noexpand\vl@dbfnote{{\expandonce\@tag}}{\@thefnmark}}%
                          \to\inserts@list
       \global\advance\insert@count \@ne%
     \fi
@@ -3735,8 +3759,8 @@
       \@ifundefined{xpg@main@language}%if polyglossia
         {}%
         {\footnotelang@poly[R]}%      
-      \protected@csxdef{thisfootnote}{\csuse{thefootnote#1}}%
-      \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\csexpandonce{thisfootnote}}}%
+      \protected@xdef\thisfootnote{\csuse{thefootnote#1}}%
+      \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\expandonce\thisfootnote}}%
                          \to\inserts@listR
        \global\advance\insert@countR \@ne%
     \else%
@@ -3746,8 +3770,8 @@
       \@ifundefined{xpg@main@language}%if polyglossia
         {}%
         {\footnotelang@poly}%    
-      \protected@csxdef{thisfootnote}{\csuse{thefootnote#1}}%
-      \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\csexpandonce{thisfootnote}}}%
+      \protected@xdef\thisfootnote{\csuse{thefootnote#1}}%
+      \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\expandonce\thisfootnote}}%
                          \to\inserts@list
       \global\advance\insert@count \@ne%
     \fi
@@ -4481,10 +4505,10 @@
 % \begin{macro}{setwidthliketwocolumns@R}
 % \begin{macro}{setpositionliketwocolumns@R}
 % \begin{macro}{setnotepositionliketwocolumns@R}
-% The \cs{setwidth…} macros are called in \cs{beginnumbering} in a \textbf{not parallel} 
-% typesetting, to fix the width  of the lines to be vertically aligned with parallel columns. They are also called at the beginning of a note's group, if some options are enabled.
-% The \cs{setposition…} macros are called in \cs{beginnumbering} in a \textbf{not parallel} to fix the position of the lines.
-% The \cs{setnoteposition…} macros are called \cs{xxxfootstart} in a \textbf{not parallel} to fix the position of notes block.
+% The \cs{setwidth…} macros are called in \cs{beginnumbering} in a \textbf{non-parallel} 
+% typesetting context, to fix the width  of the lines to be vertically aligned with parallel columns. They are also called at the beginning of a note's group, if some options are enabled.
+% The \cs{setposition…} macros are called in \cs{beginnumbering} in a \textbf{non- parallel} typesetting context to fix the position of the lines.
+% The \cs{setnoteposition…} macros are called in \cs{xxxfootstart} in a \textbf{non- parallel} typesetting context to fix the position of notes block.
 % \begin{macrocode}
 \newcommand{\setwidthliketwocolumns@L}{%
 % Temporary dimension, initially equal to the standard hsize, i.e. text width
@@ -4628,6 +4652,8 @@
 % \begin{macro}{\Pages}
 % \changes{v1.8.0}{2014/07/28}{Modify \cs{Pages} to enable to add section's title.}
 % \changes{v1.8.3}{2014/08/31}{Debug blank pages when using optional argument in the last \cs{pend}.}
+% \changes{v1.10.0}{2015/01/12}{Debug wrong pages splitting when no optional argument is used in last \cs{pend} (bug was added in v.1.8.3).}
+% \changes{v1.10.0}{2015/01/12}{Debug wrong parallel pages synchronization when an \cs{edtext} falls accross two pages.}
 % The \cs{Pages} command results in the previous Left and
 % Right texts being typeset on matching facing pages. There should
 % be equal numbers of chunks in the left and right texts.
@@ -4734,7 +4760,7 @@
 % \changes{v0.3}{2005/02/10}{Added \cs{ledstrutL} to \cs{Pages}}
 %    \begin{macrocode}
               \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{}
-              \csuse{before@pstartL@\the\l@dpscL}
+              \csuse{before@pstartL@\the\l@dpscL}%
               \global\csundef{before@pstartL@\the\l@dpscL}
               \do@lineL
               \xifinlist{\the\l@dpscL}{\eled@sections@@}
@@ -4749,10 +4775,18 @@
               \fi
 %    \end{macrocode}
 % Perhaps we have to move to the next (left) box. Check if we have got all
-% we can onto the page. If not, repeat for the next line.
+% we can onto the page. If not, repeat for the next line. 
+% Check if we have to print the optional argument of the last pend.
+% Check if the page is full.
+% Check if the verse is split in two subsequent pages.
+% Check there is any forced page breaks.
 %    \begin{macrocode}        
-              \checkpageL%
               \get@nextboxL%
+                  \ifprint@last@after@pendL%
+                     \csuse{after@pendL@\the\l@dpscL}%
+                     \global\csundef{after@pendL@\the\l@dpscL}%
+                   \fi%
+              \checkpageL%
               \checkverseL
               \checkpbL
             \repeat
@@ -4784,7 +4818,7 @@
 {            \loop\ifl@dsamepage%
               \initnumbering@sectcountR
               \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{}
-              \csuse{before@pstartR@\the\l@dpscR}
+              \csuse{before@pstartR@\the\l@dpscR}%
               \global\csundef{before@pstartR@\the\l@dpscR}
               \do@lineR
               \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}
@@ -4797,8 +4831,12 @@
                       \parledgroup@correction@notespacing{R}
                       \hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}%
               \fi
-              \checkpageR%
               \get@nextboxR%
+                  \ifprint@last@after@pendR%
+                     \csuse{after@pendR@\the\l@dpscR}%
+                     \global\csundef{after@pendR@\the\l@dpscR}%
+                   \fi%
+              \checkpageR%
               \checkverseR
               \checkpbR
             \repeat
@@ -5043,7 +5081,14 @@
   \else
     \l@dsamepagefalse
     \l@dpagefulltrue
-  \fi}
+  \fi%
+  \ifprint@last@after@pendL%
+     \l@dpagefullfalse%
+     \l@dsamepagefalse%
+     \print@last@after@pendLfalse%
+  \fi%
+  }%
+
 \newcommand*{\checkpageR}{%
   \l@dpagefulltrue
   \l@dsamepagetrue
@@ -5057,7 +5102,13 @@
   \else
     \l@dsamepagefalse
     \l@dpagefulltrue
-  \fi}
+  \fi%
+  \ifprint@last@after@pendR%
+     \l@dpagefullfalse%
+     \l@dsamepagefalse%
+     \print@last@after@pendRfalse%
+  \fi%    
+  }%
 
 %    \end{macrocode}
 % \end{macro}
@@ -5233,10 +5284,7 @@
       \else
 % Add the content of the optional argument of the last \cs{pend}.
 %     \begin{macrocode}
-         \l@dpagefulltrue
-         \l@dsamepagefalse%
-         \csuse{after@pendL@\the\l@dpscL}%
-         \global\csundef{after@pendL@\the\l@dpscL}%
+        \print@last@after@pendLtrue%
 %     \end{macrocode}
 %     \begin{macrocode}
       \fi
@@ -5279,10 +5327,7 @@
         \parledgroup@notes@endR
         \parledgroup@correction@notespacing@final{R}
       \else
-        \l@dpagefulltrue%
-        \l@dsamepagefalse%
-        \csuse{after@pendR@\the\l@dpscR}%
-        \global\csundef{after@pendR@\the\l@dpscR}%
+          \print@last@after@pendRtrue%
       \fi
     \fi
   \fi}
@@ -5357,10 +5402,10 @@
 % The \cs{led@nopbR} add the absolute line number in the \cs{prev@nopbR} list.
 % The \cs{led@nopbnumR} add the argument in the \cs{prev@nopbR} list.
 %    \begin{macrocode}
-\newcommand{\led@pbR}{\listcsxadd{l@prev@pbR}{\the\absline@numR}}
-\newcommand{\led@pbnumR}[1]{\listcsxadd{l@prev@pbR}{#1}}
-\newcommand{\led@nopbR}{\listcsxadd{l@prev@nopbR}{\the\absline@numR}}
-\newcommand{\led@nopbnumR}[1]{\listcsxadd{l@prev@nopbR}{#1}}
+\newcommand{\led@pbR}{\listxadd{\l@prev@pbR}{\the\absline@numR}}
+\newcommand{\led@pbnumR}[1]{\listxadd{\l@prev@pbR}{#1}}
+\newcommand{\led@nopbR}{\listxadd{\l@prev@nopbR}{\the\absline@numR}}
+\newcommand{\led@nopbnumR}[1]{\listxadd{\l@prev@nopbR}{#1}}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
-- 
cgit v1.2.3

