From 00db3b3ef04868e84ab4abccf4ece66d3fc77e60 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 12 Dec 2016 22:54:22 +0000
Subject: reledmac (12dec16)

git-svn-id: svn://tug.org/texlive/trunk@42689 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/source/latex/reledmac/reledpar.dtx  | 140 +++++++++++++++++----
 1 file changed, 118 insertions(+), 22 deletions(-)

(limited to 'Master/texmf-dist/source/latex/reledmac/reledpar.dtx')

diff --git a/Master/texmf-dist/source/latex/reledmac/reledpar.dtx b/Master/texmf-dist/source/latex/reledmac/reledpar.dtx
index bf7b1e101d9..004444aaa54 100644
--- a/Master/texmf-dist/source/latex/reledmac/reledpar.dtx
+++ b/Master/texmf-dist/source/latex/reledmac/reledpar.dtx
@@ -280,16 +280,21 @@
 % \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 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}{New commands to have specific line margins for text running 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.}
+% \changes{v2.14.0}{2016/10/02}{More explicit error message when the stanza indentation is not defined.}
+% \changes{v2.14.0}{2016/10/02}{Error message when left / right side are not defined.}
 % \changes{v2.14.1}{2016/10/16}{Fix bug with vertical space before sectioning command in optional argument of \protect\cs{pstart} (bug added in v2.13.1).}
 % \changes{v2.14.1}{2016/10/16}{Fix bug when using \protect\cs{markboth} on \protect\cs{doinsidelineLhook} and \protect\cs{doinsidelineRhook}.}
 % \changes{v2.14.2}{2016/10/31}{Fix spurious space with \protect\cs{edtextlater}.}
 % \changes{v2.14.3}{2016/11/04}{Fix bug in \protect\cs{edtextnow}.}
-% \changes{v2.14.4}{2016/11/14}{Take account of \protect\cs{linenumberstyle} when using \protect\cs{edlineref}.}
+% \changes{v2.14.4}{2016/11/14}{Take into account \protect\cs{linenumberstyle} when using \protect\cs{edlineref}.}
+% \changes{v2.15.0}{2016/12/12}{Add \protect\option{movecolumnspositiononrightpage} option.}
+% \changes{v2.15.0}{2016/12/12}{New macro \protect\cs{sidenotemarginR}, fix default value to right.}
+% \changes{v.2.15.0}{2016/12/12}{Fix bug with \protect\cs{msdata} when using multiple \protect\cs{beginnumbering}…\protect\cs{endnumbering}}
+% \changes{v2.15.0}{2016/12/12}{Fix bug about space before sectioning commands after a pairs environment (bug added in v.~2.14.4).}
+% \changes{v2.15.0}{2016/12/12}{Fix bug with page break when using \protect\cs{columns} (bug added in v.~2.14.1).}
 % ^^A PW added following as the definitions are at some unknown elsewhere
 %
 % \newcommand{\egstart}{%
@@ -406,6 +411,8 @@
 %    \item [prevpgnotnumbered] enables that the page before facing pages (the one
 %       automatically inserted to start parallel pages on a left page) is not
 %       counted. This applies only if the page is empty.
+%    \item[movecolumnspositiononrightpage] make the left column on the right page become the right column, and the left column become the right column.
+% It allows to have a text running on the inner column, and an other one on the outer column.
 % \end{description}
 % 
 %
@@ -569,7 +576,13 @@
 % If you want to have continuous line numbers between multiple columns and single columns, use the \option{continuousnumberingwithcolumns} option when loading \macpackage or \parpackage.
 % You will need to use \cs{pausenumbering}\ldots\cs{resumenumbering} instead of \cs{endnumbering}\ldots{endnumbering} (see \reff{reledmac-pause}).
 %
+% \section{Keeping translation in the outside/inside column}
+% By default, \parpackage works with left and right columns.
+% However, it is possible to work with inner and outer column.
+% In this case, use the \option{movecolumnspositiononrightpage} at loading time of the package.
 %
+% The \env{Leftside} environment will correspond to the inner column, and the \env{Rightside} environment will correspond to the outer column.
+% 
 % \section{Facing pages}\label{pages}
 % \subsection{Basic usage}
 % \DescribeEnv{pages}
@@ -1060,7 +1073,7 @@
 %
 % \DescribeMacro{\doinsidelineLhook}
 % \DescribeMacro{\doinsidelineRhook}
-% \cs{doinsidelineLhook} and \cs{doinsidelineRhook} are the equivalent to the \macpackage \cs{doinsidelinehook}, respectively for left and right side.
+% \cs{doinsidelineLhook} and \cs{doinsidelineRhook} are the equivalent to the \macpackage \cs{doinsidelinehook}, for the left and the right sides respectively.
 % 
 % About these two hooks, read \macpackage's handbook (\reff{reledmac-linehook}).
 %
@@ -1121,6 +1134,9 @@
 % As in \macpackage, you must use one of the following commands to add side notes: \protect\cs{ledsidenote}, \protect\cs{ledleftnote}, \protect\cs{ledrightnote}, \protect\cs{ledouterote}, \protect\cs{ledinnerrote}.
 % 
 % The \protect\cs{sidenotemargin} defines the margin of the sidenote for either left or right side, depending on the current environment.
+% 
+% The \cs{sidenotemarginR} defines the margin of the sidenote for the right side.
+%
 % You can use \protect\cs{sidenotemargin*} to define it for both sides.
 % \section{Parallel ledgroups}
 % \subsection{General}
@@ -1234,7 +1250,7 @@
 %    \begin{macrocode}
 %<*code>
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{reledpar}[2016/11/14 v2.14.4 reledmac extension for parallel texts]%
+\ProvidesPackage{reledpar}[2016/12/12 v2.15.0 reledmac extension for parallel texts]%
 
 %    \end{macrocode}
 % \subsection{Package's requirement}
@@ -1301,6 +1317,16 @@
 }%
 %    \end{macrocode}
 % \end{macro}
+% \subsubsection{Position option}
+% \begin{macro}{\ifmovecolumnspositiononrightpage}
+% The \cs{ifmovecolumnspositiononrightpage} boolean is set to true if, for a right page, we want the left column become a right column and the right column become a left column. 
+%    \begin{macrocode}
+\newif\ifmovecolumnspositiononrightpage%
+\DeclareOptionX{movecolumnspositiononrightpage}{%
+ \movecolumnspositiononrightpagetrue%
+}%
+%    \end{macrocode}
+% \end{macro}
 % \subsubsection{Other options}
 % The \verb+parledgroup+ can be called either on \macpackage or \parpackage.
 %    \begin{macrocode}
@@ -1455,13 +1481,13 @@
 % \begin{macro}{\led@err@Columns@WithoutLeftside}
 %    \begin{macrocode}
 \newcommand*{\led@err@Pages@WithoutRightside}{%
-  \reledpar@error{\string\Pages\space called without previous `Rightside` environment (or environment without content)}{\@ehc}}%
+  \reledpar@error{\string\Pages\space called without any preceding `Rightside` environment (or environment without content)}{\@ehc}}%
 \newcommand*{\led@err@Pages@WithoutLeftside}{%
-  \reledpar@error{\string\Pages\space called without previous `Leftside` environment (or environment without content)}{\@ehc}}%
+  \reledpar@error{\string\Pages\space called without any preceding `Leftside` environment (or environment without content)}{\@ehc}}%
   \newcommand*{\led@err@Columns@WithoutRightside}{%
-  \reledpar@error{\string\Columns\space called without previous `Rightside` environment (or environment without content)}{\@ehc}}%
+  \reledpar@error{\string\Columns\space called without any preceding `Rightside` environment (or environment without content)}{\@ehc}}%
 \newcommand*{\led@err@Columns@WithoutLeftside}{%
-  \reledpar@error{\string\Columns\space called without previous `Leftside` environment (or environment without content)}{\@ehc}}%
+  \reledpar@error{\string\Columns\space called without any preceding `Leftside` environment (or environment without content)}{\@ehc}}%
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -1571,9 +1597,9 @@
 % \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.
+% The \cs{ifcsboxvoid} command comes on top of the \package{etoolbox} package. 
+% The first argument is a box name, the second is the \meta{true} value, the third the \meta{false} value.
+% If the first argument refers to a non-existing box, or if it refers to a box that is void, the \meta{true} value is returned. otherwise, \meta{false} is returned.
 %    \begin{macrocode}
 \newcommand*{\ifcsboxvoid}[1]{%
   \ifcsname#1\endcsname%
@@ -1662,6 +1688,8 @@
   \global\let\next@page@numR\relax
   \global\let\sub@change\relax
   \global\stopmsdata@inserted@true%
+  \global\let\@msdata@list\relax%
+  \global\csundef{@msdata@\add@msd@cR @dataR}%
   \set@continuousnumberingforR%
   \message{Section \the\section@numR R }%
   \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
@@ -1952,6 +1980,10 @@
     \global\line@margin=\@l@dtempcntb%
   \fi%
 }
+\ifmovecolumnspositiononrightpage%
+  \linenummargin{inner}%
+  \linenummarginR{outer}%
+\fi%
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -3466,6 +3498,7 @@
 %    \begin{macrocode}
   \endgroup%
   \ignorespaces%
+  \@oldnobreak%
   \dump@pstartL@pc%
   \ifnumberpstart%
     \addtocounter{pstartL}{1}%
@@ -3498,6 +3531,7 @@
   \global\par@lineR=0%
   \endgroup%
   \ignorespaces%
+  \@oldnobreak%
   \dump@pstartR@pc%  
   \ifnumberpstart%
     \addtocounter{pstartR}{1}%
@@ -4706,6 +4740,7 @@
 % the text.
 % \begin{macro}{\sidenote@marginR}
 % \begin{macro}{\sidenotemargin*}
+% \begin{macro}{\sidenotemarginR}
 % \changes{v1.8.0}{2014/08/05}{\protect\cs{sidenotemargin} is now directly defined in \protect\package{eledmac} to be able to manage \protect\package{eledpar}.}
 % \changes{v1.8.0}{2014/08/05}{Add \protect\cs{sidenotemargin*}}
 % Specifies which margin sidenotes can be in.
@@ -4715,12 +4750,22 @@
   \global\sidenote@marginR=\@l@dtempcntb
   \global\sidenote@margin=\@l@dtempcntb
 }
+\newcommand{\sidenotemarginR}[1]{%
+  \l@dgetsidenote@margin{#1}%
+  \global\sidenote@marginR=\@l@dtempcntb%
+}%
 \newcount\sidenote@marginR
-\global\sidenote@margin=\@ne
+\global\sidenote@marginR=\@ne%
+
+\ifmovecolumnspositiononrightpage%
+  \sidenotemargin{inner}%
+  \sidenotemarginR{outer}%
+\fi%
 
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 
 % \changes{v1.3.3}{2012/12/19}{Debugging the left notes of the right column.}
@@ -5362,15 +5407,9 @@
                 {}%
           \hb@xt@ \hsize{%
            \ifdefstring{\columns@position}{L}{}{\hfill }%
-            \unhbox\l@dleftbox%
-            \ifhbox\@eledsectionL%
-               \usebox{\@eledsectionL}%
-            \fi%
+            \print@leftcolumn%
             \print@columnseparator%
-            \unhbox\l@drightbox%
-            \ifhbox\@eledsectionR%
-              \usebox{\@eledsectionR}%
-            \fi%
+            \print@rightcolumn%
             \ifdefstring{\columns@position}{R}{}{\hfill}%
           }%
           \checkraw@text
@@ -5440,6 +5479,63 @@
 }%
 %\end{macrocode}
 % \end{macro}
+% \begin{macro}{\print@leftcolumn}
+% \begin{macro}{\print@rightcolumn}
+% \cs{print@leftcolumn} and \cs{print@rightcolumn} print the line number of the left or right column respectively. 
+% Normally, it is defined by the content of the \env{Leftside} or \env{Rightside} environments. 
+% But if \cs{movecolumnspositiononrightpage} is set to TRUE, it also depends on the page number.
+%    \begin{macrocode}
+\newcommand{\print@leftcolumn}{%
+  \if\page@num>\page@numR%
+    \@l@dtempcntb=\page@num%
+  \else%
+    \@l@dtempcntb=\page@numR%
+  \fi%
+  \ifboolexpr{%
+     not bool {movecolumnspositiononrightpage}%
+     or test {\ifnumodd{\@l@dtempcntb}}%
+    }%
+    {%
+      \unhbox\l@dleftbox%
+      \ifhbox\@eledsectionL%
+         \usebox{\@eledsectionL}%
+      \fi%
+    }%
+    {%
+       \unhbox\l@drightbox%
+       \ifhbox\@eledsectionR%
+         \usebox{\@eledsectionR}%
+       \fi%
+    }%
+}%
+
+
+\newcommand{\print@rightcolumn}{%
+  \if\page@num>\page@numR%
+    \@l@dtempcntb=\page@num%
+  \else%
+    \@l@dtempcntb=\page@numR%
+  \fi%
+  \ifboolexpr{%
+     not bool {movecolumnspositiononrightpage}%
+     or test {\ifnumodd{\@l@dtempcntb}}%
+    }%
+    {%
+      \unhbox\l@drightbox%
+      \ifhbox\@eledsectionR%
+        \usebox{\@eledsectionR}%
+      \fi%
+    }%
+    {%
+      \unhbox\l@dleftbox%
+      \ifhbox\@eledsectionL%
+         \usebox{\@eledsectionL}%
+      \fi%
+    }%
+}%
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
 % \begin{macro}{\checkpb@columns}
 % \protect\cs{checkpb@columns} prevent or make pagebreaking in columns, depending of the use of \protect\cs{ledpb} or \protect\cs{lednopb}.
 %    \begin{macrocode}
-- 
cgit v1.2.3

