summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/reledmac/reledpar.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/reledmac/reledpar.dtx')
-rw-r--r--Master/texmf-dist/source/latex/reledmac/reledpar.dtx1322
1 files changed, 711 insertions, 611 deletions
diff --git a/Master/texmf-dist/source/latex/reledmac/reledpar.dtx b/Master/texmf-dist/source/latex/reledmac/reledpar.dtx
index 722f038f9a3..c5562ce8550 100644
--- a/Master/texmf-dist/source/latex/reledmac/reledpar.dtx
+++ b/Master/texmf-dist/source/latex/reledmac/reledpar.dtx
@@ -30,6 +30,8 @@
% hyperindex=true
hyperindex=false
]{hyperref}
+\addtolength\marginparwidth{30pt}
+\usepackage{doctools}
\usepackage{libertineotf}
\usepackage[series={A,B},noend,noeledsec,nofamiliar]{reledmac}
\usepackage{reledpar}
@@ -53,36 +55,33 @@
\CodelineIndex
\RecordChanges
\renewcommand{\MakeUppercase}[1]{#1}
- \newcommand{\Lpack}[1]{\textsf{#1}}
- \newcommand{\Lclass}[1]{\textsf{#1}}
- \newcommand{\file}[1]{\texttt{#1}}
- \newcommand{\edmac}{\Lpack{edmac}\xspace}
- \newcommand{\tabmac}{\Lpack{tabmac}\xspace}
- \newcommand{\edstanza}{\Lpack{edstanza}\xspace}
+ \newcommand{\edmac}{\protect\package{edmac}\xspace}
+ \newcommand{\tabmac}{\protect\package{tabmac}\xspace}
+ \newcommand{\edstanza}{\protect\package{edstanza}\xspace}
- \newcommand{\ledmac}{\Lpack{ledmac}\xspace}
- \newcommand{\Ledmac}{\Lpack{Ledmac}\xspace}
- \newcommand{\ledpar}{\Lpack{ledpar}\xspace}
- \newcommand{\Ledpar}{\Lpack{Ledpar}\xspace}
+ \newcommand{\ledmac}{\protect\package{ledmac}\xspace}
+ \newcommand{\Ledmac}{\protect\package{Ledmac}\xspace}
+ \newcommand{\ledpar}{\protect\package{ledpar}\xspace}
+ \newcommand{\Ledpar}{\protect\package{Ledpar}\xspace}
- \newcommand{\eledmac}{\Lpack{eledmac}\xspace}
- \newcommand{\Eledmac}{\Lpack{Eledmac}\xspace}
- \newcommand{\eledpar}{\Lpack{eledpar}\xspace}
- \newcommand{\Eledpar}{\Lpack{Eledpar}\xspace}
+ \newcommand{\eledmac}{\protect\package{eledmac}\xspace}
+ \newcommand{\Eledmac}{\protect\package{Eledmac}\xspace}
+ \newcommand{\eledpar}{\protect\package{eledpar}\xspace}
+ \newcommand{\Eledpar}{\protect\package{Eledpar}\xspace}
- \newcommand{\reledmac}{\Lpack{reledmac}\xspace}
- \newcommand{\Reledmac}{\Lpack{Reledmac}\xspace}
- \newcommand{\reledpar}{\Lpack{reledpar}\xspace}
- \newcommand{\Reledpar}{\Lpack{Reledpar}\xspace}
+ \newcommand{\reledmac}{\protect\package{reledmac}\xspace}
+ \newcommand{\Reledmac}{\protect\package{Reledmac}\xspace}
+ \newcommand{\reledpar}{\protect\package{reledpar}\xspace}
+ \newcommand{\Reledpar}{\protect\package{Reledpar}\xspace}
\let\macpackage\reledmac
\let\parpackage\reledpar
\let\Macpackage\reledmac
\let\Parpackage\reledpar
- \newcommand{\texbook}{\textit{TeXbook}}
- \newcommand{\thetexbook}{\textit{The TeXbook}}
+ \newcommand{\texbook}{\textit{TeXbook}\xspace}
+ \newcommand{\thetexbook}{\textit{The TeXbook}\xspace}
\pagestyle{headings}
\setcounter{StandardModuleDepth}{1}
% Some commands are defined here, and not in the commented part, because \externaldocument require them.
@@ -95,7 +94,6 @@
%
% \fi
% \newcommand{\reff}[1]{\ref{#1} p.~\pageref{#1}}
-% \CheckSum{4545}
%
% \makeatletter
% \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
@@ -181,60 +179,65 @@
% \changes{v0.1.0}{2004/12/10}{First public release}
% \changes{v0.2.0}{2005/01/01}{Fix babel problems}
% \changes{v0.3.0}{2005/03/24}{Reorganize for ledarab}
-% \changes{v0.3.a}{2005/03/30}{Minor \cs{linenummargin} fix}
+% \changes{v0.3.a}{2005/03/30}{Minor \protect\cs{linenummargin} fix}
% \changes{v0.3.b}{2005/04/08}{Improved parallel page balancing}
% \changes{v0.3.c}{2011/06/16}{Compatibilty with Polyglossia}
% \changes{v0.4.0}{2011/08/03}{No more ledparpatch. All patches are now in the main file.}
-% \changes{v0.5.0}{2011/08/21}{Corrections about \cs{section} and other titles in numbered sections}
-% \changes{v0.6.0}{2011/08/22}{Be able to us \cs{chapter} in parallel pages.}
+% \changes{v0.5.0}{2011/08/21}{Corrections about \protect\cs{section} and other titles in numbered sections}
+% \changes{v0.6.0}{2011/08/22}{Be able to us \protect\cs{chapter} in parallel pages.}
% \changes{v0.7.0}{2011/08/31}{Option `shiftedverses' which make there is no blank between two parallel verses with inequal length.}
-% \changes{v0.8.0}{2011/09/16}{Possibility to have a symbol on each hanging of verses, like in the french typography. Redefine the commande \cs{hangingsymbol} to define the character.}
-% \changes{v0.9.0}{2011/10/01}{Possibilty to number the pstart with the commands \cs{numberpstarttrue}.}
-% \changes{v0.9.1}{2011/10/02}{The numbering of the pstarts restarts on each \cs{beginnumbering}.}
-% \changes{v0.9.2}{2011/11/08}{Debug : with \cs{Columns}, the hanging indentation now runs on the left columns and the hanging symbol is shown only when \cs{stanza} is used.}
-% \changes{v0.9.3}{2011/11/18}{\cs{thepstartL} and \cs{thepstartR} use now \cs{bfseries} and not \cs{bf}, which is deprecated and makes conflicts with memoir class.}
-% \changes{v0.10.0}{2012/04/04}{\cs{edlabel} commands which start a paragraph are now put in the right place.}
-% \changes{v0.10.0}{2012/04/04}{\cs{edlabel} commands on the right side are now correctly indicated.}
+% \changes{v0.8.0}{2011/09/16}{Possibility to have a symbol on each hanging of verses, like in the french typography. Redefine the commande \protect\cs{hangingsymbol} to define the character.}
+% \changes{v0.9.0}{2011/10/01}{Possibilty to number the pstart with the commands \protect\cs{numberpstarttrue}.}
+% \changes{v0.9.1}{2011/10/02}{The numbering of the pstarts restarts on each \protect\cs{beginnumbering}.}
+% \changes{v0.9.2}{2011/11/08}{Debug : with \protect\cs{Columns}, the hanging indentation now runs on the left columns and the hanging symbol is shown only when \protect\cs{stanza} is used.}
+% \changes{v0.9.3}{2011/11/18}{\protect\cs{thepstartL} and \protect\cs{thepstartR} use now \protect\cs{bfseries} and not \protect\cs{bf}, which is deprecated and makes conflicts with memoir class.}
+% \changes{v0.10.0}{2012/04/04}{\protect\cs{edlabel} commands which start a paragraph are now put in the right place.}
+% \changes{v0.10.0}{2012/04/04}{\protect\cs{edlabel} commands on the right side are now correctly indicated.}
% \changes{v1.0.0}{2012/09/14}{Compatibility with eledmac. Change name to eledpar.}
-% \changes{v1.0.1}{2012/09/16}{Correction on \cs{numberonlyfirstinline} with lineation by pstart or by page.}
+% \changes{v1.0.1}{2012/09/16}{Correction on \protect\cs{numberonlyfirstinline} with lineation by pstart or by page.}
% \changes{v1.1.0}{2012/09/25}{Shiftedverses becomes shiftedpstarts.}
-% \changes{v1.2.0}{2012/10/15}{Support for \cs{led}\meta{section} commands in parallel texts.}
+% \changes{v1.2.0}{2012/10/15}{Support for \protect\cs{led}\meta{section} commands in parallel texts.}
% \changes{v1.3.2}{2012/12/11}{Debug with some classes.}
% \changes{v1.4.3}{2013/10/27}{Corrects a false hanging verse when a verse is exactly the length of a line.}
% \changes{v1.5.0}{2013/11/08}{Add, as in eledmac, features to manage page breaks.}
% \changes{v1.7.0}{2014/04/14}{Add, as in eledmac, features to make crossrefs with pstart numbers.}
-% \changes{v1.8.0}{2014/08/05}{Debug eledmac sectioning command after using \cs{resumenumbering}.}
-% \changes{v1.8.0}{2014/08/05}{Compatibility with \Lpack{musixtex}.}
-% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, option to insert something after \cs{pend}s / verses.}
-% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, option to insert something between \cs{pstart}s / verse.}
+% \changes{v1.8.0}{2014/08/05}{Debug eledmac sectioning command after using \protect\cs{resumenumbering}.}
+% \changes{v1.8.0}{2014/08/05}{Compatibility with \protect\package{musixtex}.}
+% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, option to insert something after \protect\cs{pend}s / verses.}
+% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, option to insert something between \protect\cs{pstart}s / verse.}
% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, new system of sectioning commands.}
% \changes{v1.8.2}{2014/08/15}{Debug left and side note (bugs added by 1.8.0)}
-% \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}}
+% \changes{v1.8.2}{2014/08/15}{Debug \protect\cs{eledxxx} with some paper sizes}
+% \changes{v1.8.3}{2014/08/31}{Add \protect\cs{noeledxxx}, as in eledmac}
+% \changes{v1.9.0}{2014/09/16}{Compatibility with \protect\cs{Xnoteswidthliketwocolumns} and \protect\cs{notesXwidthliketwocolumns}}
+% \changes{v1.10.0}{2015/01/12}{Restore critical notes in \protect\cs{eledsection} in parallel columns (this bug was added in 1.8.2).}
+% \changes{v1.10.0}{2015/01/12}{Compatibility with \protect\cs{AtEveryPstart} and \protect\cs{AtEveryPend}}
% \changes{v1.11.0}{2015/01/23}{Compatibility of standard footnotes with some biblatex styles.}
% \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
% \changes{v1.13.0}{2015/03/06}{With parallel pages, long notes can now flow from the Left to the right side and from the Right to the left side.}
% \changes{v1.13.0}{2015/03/06}{Fix bug in shiftedpstarts when size difference between pstarts is very important.}
-% \changes{v1.14.0}{2015/03/22}{The \cs{newif}s are not followed by boolean values set to false, because it is the \TeX\ default setting.}
-% \changes{v1.14.0}{2015/03/22}{Fix bug with line number position when using \cs{eledsection} and similar commands for RTL texts with \LuaLaTeX.}
-% \changes{v1.15.0}{2015/04/13}{Add \cs{AtEveryPstartCall}.}
-% \changes{v1.15.0}{2015/04/13}{Fix vertical spurious space before right \cs{eledchapter} (bug added in v1.13.0).}
-% \changes{v1.15.0}{2015/04/13}{Prevent vertical space when using \cs{AtEveryPstart} or \cs{AtEveryPend} with a command which prints nothing}
+% \changes{v1.14.0}{2015/03/22}{The \protect\cs{newif}s are not followed by boolean values set to false, because it is the \TeX\ default setting.}
+% \changes{v1.14.0}{2015/03/22}{Fix bug with line number position when using \protect\cs{eledsection} and similar commands for RTL texts with \LuaLaTeX.}
+% \changes{v1.15.0}{2015/04/13}{Add \protect\cs{AtEveryPstartCall}.}
+% \changes{v1.15.0}{2015/04/13}{Fix vertical spurious space before right \protect\cs{eledchapter} (bug added in v1.13.0).}
+% \changes{v1.15.0}{2015/04/13}{Prevent vertical space when using \protect\cs{AtEveryPstart} or \protect\cs{AtEveryPend} with a command which prints nothing}
% \changes{v1.16.0}{2015/05/18}{Fix bug with nofamiliar / nocritical option of eledmac.}
-% \changes{v1.16.0}{2015/05/18}{Error message when using \cs{beginnumbering}…\cs{endnumbering} without \cs{pstart}.}
+% \changes{v1.16.0}{2015/05/18}{Error message when using \protect\cs{beginnumbering}…\protect\cs{endnumbering} without \protect\cs{pstart}.}
% \changes{v1.16.0}{2015/05/18}{Error message when starting a Leftside/a Rightside while the previous one has not been yet typeset.}
-% \changes{v1.16.0}{2015/05/18}{Error message when calling \cs{Pages} inside `pages' environment and \cs{Columns} inside `pairs' environment.}
+% \changes{v1.16.0}{2015/05/18}{Error message when calling \protect\cs{Pages} inside `pages' environment and \protect\cs{Columns} inside `pairs' environment.}
% \changes{v1.16.0}{2015/05/18}{New package option sameparallelpagenumber to have the same page number for both left and right side.}
% \changes{v1.16.1}{2015/05/20}{Write information about line-list file version in the correct file.}
-% \changes{v1.16.2}{2015/05/29}{Fix bug when adding empty lines before a \cs{pend} in combination with some specific penalties setting.}
-% \changes{v1.17.0}{2015/06/02}{Add compatibility of optional argument of \cs{pstart}/\cs{pend} and \cs{AtEveryPstart}/\cs{AtEveryPend} with two columns mode.}
+% \changes{v1.16.2}{2015/05/29}{Fix bug when adding empty lines before a \protect\cs{pend} in combination with some specific penalties setting.}
+% \changes{v1.17.0}{2015/06/02}{Add compatibility of optional argument of \protect\cs{pstart}/\protect\cs{pend} and \protect\cs{AtEveryPstart}/\protect\cs{AtEveryPend} with two columns mode.}
% \changes{v2.0.0}{2015/07/19}{Many code refactored and moved to \reledmac.}
% \changes{v2.0.0}{2015/07/19}{Package's name becomes \reledpar.}
% \changes{v2.0.0}{2015/07/19}{Fix some bugs with `sameparallelpagenumber' option.}
% \changes{v2.0.0}{2015/07/19}{Totally new implementation of `sameparallelpagenumber' option.}
+% \changes{v2.1.0}{2015/07/27}{Fix bug with \protect\cs{setparledgroupnotespacing} with the shiftedpstarts option.}
+% \changes{v2.1.0}{2015/07/27}{Fix incompatibility between optional argument of \protect\cs{pstart} and \protect\cs{numberpstarttrue}}
+% \changes{v2.1.0}{2015/07/27}{Options to custom empty right page before \protect\cs{Pages}.}
+% \changes{v2.1.0}{2015/07/27}{Fix bug when using \protect\cs{pagenumbering} with memoir (bug added in v2.0.0).}
+% \changes{v2.1.0}{2015/07/27}{Fix bug when using \protect\cs{eledsection} and related on right pages when page width is short.}
% \hyphenation{man-u-script man-u-scripts}
%
%
@@ -338,7 +341,7 @@
% edited text.
%
% The \parpackage package lets you typeset two \emph{numbered} texts in
-% parallel\footnote{You can use, anyway, \cs{numberlinefalse} to disable printing of line numbers.}.
+% parallel\footnote{You can use, anyway, \protect\cs{numberlinefalse} to disable printing of line numbers.}.
% This can be done either as setting the `Leftside' and `Rightside'
% texts in two columns or on facing pages.
% In the paired pages case footnotes are placed at the bottom of the page
@@ -352,8 +355,8 @@
%
%
% \Macpackage essentially puts each chunk of numbered text
-% (the text within a \cs{pstart} \ldots \cs{pend}) into a box and then
-% following the \cs{pend} extracts the text line by line from the box
+% (the text within a \protect\cs{pstart} \ldots \protect\cs{pend}) into a box and then
+% following the \protect\cs{pend} extracts the text line by line from the box
% to number and print it. More precisely, the text is first put into the
% the box as though it was being typeset as normal onto a page and
% any notes are stored without being typeset. Then each typeset line
@@ -364,7 +367,7 @@
%
%
% \Parpackage similarly puts the left and right chunks into boxes but can't
-% immediately output the text after a \cs{pend} --- it has to wait until
+% immediately output the text after a \protect\cs{pend} --- it has to wait until
% after both the left and right texts have been collected before it can
% start processing. This means that several boxes are required and possibly
% \TeX\ has to store a lot of text in its memory; both the number of potential
@@ -373,23 +376,23 @@
%
% \DescribeMacro{\maxchunks}
% It is possible to have multiple chunks in the left and right texts before
-% printing them. The macro \cs{maxchunks}\marg{num} specifies the maximum
+% printing them. The macro \protect\cs{maxchunks}\marg{num} specifies the maximum
% number of chunks within the left or right texts. This is initially set as: \\
% \verb?\maxchunks{5120}? \\
% meaning that there can be up to 5120 chunks in the left text and up to
% 5120 chunks in
% the right text, requiring a total of 10240 boxes. If you need more chunks
-% then you can increase \cs{maxchunks}. The \cs{maxchunks} must be called in the preamble.
+% then you can increase \protect\cs{maxchunks}. The \protect\cs{maxchunks} must be called in the preamble.
%
-% If you \cs{maxchunks} is too little
+% If you \protect\cs{maxchunks} is too little
%you can get a \parpackage{} error message along the
-% lines: ``Too many \cs{pstart} without printing. Some text will be lost.''
-% then you will have to either increase \cs{maxchunks} or use the
-% parallel printing commands (\cs{Columns} or \cs{Pages}) more frequently.
+% lines: ``Too many \protect\cs{pstart} without printing. Some text will be lost.''
+% then you will have to either increase \protect\cs{maxchunks} or use the
+% parallel printing commands (\protect\cs{Columns} or \protect\cs{Pages}) more frequently.
%
-% When typesetting verse using \cs{stanza}, each line is treated as a chunk,
+% When typesetting verse using \protect\cs{stanza}, each line is treated as a chunk,
% so be warned that if you are setting parallel verses you might have to
-% increase \cs{maxchunks} much more than it appears at first sight.
+% increase \protect\cs{maxchunks} much more than it appears at first sight.
%
% In general, \macpackage is a \TeX\ resource hog, and \parpackage{} only
% makes things worse in this respect.
@@ -404,7 +407,7 @@
% in section~\ref{leftright}.
%
% \DescribeMacro{\Columns}
-% The command \cs{Columns} typesets the texts in the previous pair of
+% The command \protect\cs{Columns} typesets the texts in the previous pair of
% \verb?Leftside? and \verb?Rightside? environments.
% The general scheme for parallel columns looks like this:
% \begin{verbatim}
@@ -421,11 +424,11 @@
% \end{verbatim}
%
%
-% Keep in mind that the \cs{Columns} \textbf{must be} outside of the \verb+pairs+ environment.
+% Keep in mind that the \protect\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 beginning of each \verb+pairs+ environments.
-% That could be useful to add the \cs{sloppy} macro to prevent overfull hboxes in two columns.
+% \changes{v1.9.0}{2014/09/16}{Add \protect\cs{AtBeginPairs} macro.}
+% You can use the macro \protect\cs{AtBeginPairs} to insert a code at the beginning of each \verb+pairs+ environments.
+% That could be useful to add the \protect\cs{sloppy} macro to prevent overfull hboxes in two columns.
% \begin{verbatim}
% \AtBeginPairs{\sloppy}
% \end{verbatim}
@@ -434,7 +437,7 @@
% \subsubsection{Column's width}
% \DescribeMacro{\Lcolwidth}
% \DescribeMacro{\Rcolwidth}
-% The lengths \cs{Lcolwidth} and \cs{Rcolwidth} are the widths of the left
+% The lengths \protect\cs{Lcolwidth} and \protect\cs{Rcolwidth} are the widths of the left
% and right columns, respectively. By default, these are: \\
% \verb?\setlength{\Lcolwidth}{0.45\textwidth}? \\
% \verb?\setlength{\Rcolwidth}{0.45\textwidth}? \\
@@ -442,31 +445,31 @@
% \subsubsection{Column's separator}
% \DescribeMacro{\columnrulewidth}
% \DescribeMacro{\columnseparator}
-% The macro \cs{columnseparator} is called between each left/right pair
+% The macro \protect\cs{columnseparator} is called between each left/right pair
% of lines. By default it inserts a vertical rule of width
-% \cs{columnrulewidth}. As this is initially defined to be 0pt the rule
+% \protect\cs{columnrulewidth}. As this is initially defined to be 0pt the rule
% is invisible. For a visible rule between the columns you could try: \\
% \verb?\setlength{\columnrulewidth}{0.4pt}? \\
-% You can also modify \cs{columnseparator} if you want more control.
+% You can also modify \protect\cs{columnseparator} if you want more control.
% \subsubsection{Column's positions}
% \DescribeMacro{\columnsposition}
-% \changes{v1.8.0}{2014/08/05}{Add \cs{columnsposition}.}
+% \changes{v1.8.0}{2014/08/05}{Add \protect\cs{columnsposition}.}
% By default, columns are positioned to the right of the page.
-% However, you can use \cs{columnsposition}\verb+{L}+ to align them to the left,
-% or \cs{columnsposition}\verb+{C}+ to center them.
+% However, you can use \protect\cs{columnsposition}\verb+{L}+ to align them to the left,
+% or \protect\cs{columnsposition}\verb+{C}+ to center them.
%
-% When you use \cs{stanza}, the visible rule may shift when a verse has a hanging indent. To prevent shifting, use \cs{setstanzaindents} outside the \verb|Leftside| or \verb|Rightside| environment.
+% When you use \protect\cs{stanza}, the visible rule may shift when a verse has a hanging indent. To prevent shifting, use \protect\cs{setstanzaindents} outside the \verb|Leftside| or \verb|Rightside| environment.
%
%
% \DescribeMacro{\beforecolumnseparator}\DescribeMacro{\aftercolumnseparator}
-% \changes{v1.8.0}{2014/08/05}{Add \cs{beforecolumnseparator} and \cs{aftercolumnseparator}.}
+% \changes{v1.8.0}{2014/08/05}{Add \protect\cs{beforecolumnseparator} and \protect\cs{aftercolumnseparator}.}
% By default, the spaces around column separator are the same as the space:
% \begin{itemize}
% \item On the left of columns, if columns are aligned right.
% \item On the right of columns, if columns are aligned left.
% \item On both the left and right columns, if columns are centered.
% \end{itemize}
-% You can redefine \cs{beforecolumnseparator} and \cs{aftercolumnseparator} length to define spaces before or after the column separator, instead of letting \parpackage calculate them automatically.
+% You can redefine \protect\cs{beforecolumnseparator} and \protect\cs{aftercolumnseparator} length to define spaces before or after the column separator, instead of letting \parpackage calculate them automatically.
% \begin{verbatim}
% \setlength{\beforecolumseparator}{length}
% \setlength{\aftercolumseparator}{length}
@@ -474,13 +477,13 @@
% If you want to revert to the previous behavior, just set with a negative value.
% \subsubsection{Mixing two columns and one column texts}
% \DescribeMacro{\widthliketwocolumns}
-% If you want to mix two-column with single-column text, you can align horizontally single-column text to two-column text with \cs{widthliketwocolumnstrue}. To reset this feature, use \cs{widthliketwocolumnsfalse}.
-% You can also call \cs{widthliketwocolumns} as a global option when loading \macpackage or \parpackage.
+% If you want to mix two-column with single-column text, you can align horizontally single-column text to two-column text with \protect\cs{widthliketwocolumnstrue}. To reset this feature, use \protect\cs{widthliketwocolumnsfalse}.
+% You can also call \protect\cs{widthliketwocolumns} as a global option when loading \macpackage or \parpackage.
%
% \DescribeMacro{\Xnoteswidthliketwocolumns}
% \DescribeMacro{\notesXwidthliketwocolumns}
-% In most cases, you should use \cs{widthliketwocolumns} in combination with \cs{Xnoteswidthliketwocolumns} and \cs{notesXwidthliketwocolumns} to align the critical/familiar footnotes with the two colums.
+% In most cases, you should use \protect\cs{widthliketwocolumns} in combination with \protect\cs{Xnoteswidthliketwocolumns} and \protect\cs{notesXwidthliketwocolumns} to align the critical/familiar footnotes with the two colums.
% See \macpackage's handbook for more details.
% \section{Facing pages}\label{pages}
% \subsection{Basic usage}
@@ -491,7 +494,7 @@
% environments, respectively.
%
% \DescribeMacro{\Pages}
-% The command \cs{Pages} typesets the texts in the previous pair of
+% The command \protect\cs{Pages} typesets the texts in the previous pair of
% \verb?Leftside? and \verb?Rightside? environments.
% The general scheme for parallel pages looks like this:
% \begin{verbatim}
@@ -505,34 +508,35 @@
% \end{verbatim}
% The \verb?Leftside? text is set on lefthand (even numbered) pages and
% the \verb?Rightside? text is set on righthand (odd numbered) pages.
-% Each \cs{Pages} command starts a new even numbered page. After parallel
+% Each \protect\cs{Pages} command starts a new even numbered page. After parallel
% typesetting is finished, a new page is started.
-% Note that the \cs{Pages} \textbf{must be} outside of the \verb+pages+ environment.
+% Note that the \protect\cs{Pages} \textbf{must be} outside of the \verb+pages+ environment.
% \subsection{Setting}
% \subsubsection{Text width}
% \DescribeMacro{\Lcolwidth}
% \DescribeMacro{\Rcolwidth}
-% Within the \verb?pages? environment the lengths \cs{Lcolwidth} and
-% \cs{Rcolwidth} are the widths of the left
+% Within the \verb?pages? environment the lengths \protect\cs{Lcolwidth} and
+% \protect\cs{Rcolwidth} are the widths of the left
% and right pages, respectively. By default, these are set to the normal
% textwidth for the document, but can be changed within the environment if
% necessary.
-% \subsubsection{Page number}
+% \subsubsection{Page number}\label{sameparallelpagenumber}
% \changes{v1.15.0}{2015/05/18}{Add sameparallelpagenumber option.}
-% By default, \cs{Pages} use the standard \LaTeX\ page number scheme.
+% By default, \protect\cs{Pages} use the standard \LaTeX\ page number scheme.
% This means that pages are numbered continuously following printed-book conventions: from left-hand to right-hand side, left-hand pages having even numbers, right-hand pages having odd numbers.
%
-% \DescribeMacro{\sameparallelpagenumbertrue}\DescribeMacro{\sameparallelpagenumbertrue}However, you can use the package option \verb+sameparallelpagenumber+ to have the same page number for both left and right side.
-% In this case, this setting will apply only for pages typeset by \cs{Pages}, not for ``normal'' pages.
-%
-% You can also switch the two system using \cs{sameparallelpagenumbertrue} and \cs{sameparallelpagenumberfalse}.
+% However, you can use the package option \verb+sameparallelpagenumber+ to have the same page number for both left and right side.
+% In this case, this setting will apply only for pages typeset by \protect\cs{Pages}, not for ``normal'' pages.
+%
+% Please also read advising in \reff{par@page}.
+%
%
% \subsubsection{Page breaking}
% \DescribeMacro{\setgoalfraction}
% When doing parallel pages \parpackage{} has to guess where \TeX\ is going to
% put pagebreaks and hopefully get there first in order to put the pair of
% texts on their proper pages. When it thinks that the fraction
-% \cs{@goalfraction} of a page has been filled, it finishes that page and
+% \protect\cs{@goalfraction} of a page has been filled, it finishes that page and
% starts on the other side's text. The standard value is 0.9.
%
%
@@ -540,17 +544,31 @@
% if some left text overflows onto an odd numbered page or some right text
% onto an even page, try reducing it.
% You can change it using \cs{setgoalfraction}\marg{newvalue}.
+% \subsubsection{Right page before \cs{Pages}}
+% When \cs{Pages} are called, it starts at a new left page, in order to have parallel pages.
+% Consequently, if it is called on a left page, it clears the current page and then lets
+% a right void page.
+%
+% \Parpackage provides two options to customize this (eventual) right page.
+% \label{prevpgnotnumbered}
+% \begin{description}
+% \item[prevpgstyle=\meta{style}] in order to set the style of this page. A common value of \meta{style} is \verb+empty+.
+% Use \verb+prevpgstyle=empty+ will suppress header and footer in this page.
+% Please also read advising in \reff{par@page}.
+% \item[prevpgnotnumbered] will make this page won't be counted in the page counter.
+%
+% \end{description}
% \subsection{Critical and familiar footnotes}
% Of course, in ``Facing pages'', the \macpackage's both critical and familiar footnotes can be used.
% However, some specific points must be taken into consideration.
% \subsubsection{Notes height setting}
-% Since \Lpack{eledpar} v1.13.0, long notes in facing pages can flow from left to right pages, and \emph{vice-versa}.
+% Since \protect\package{eledpar} v1.13.0, long notes in facing pages can flow from left to right pages, and \emph{vice-versa}.
%
-% However, the \macpackage default setting for the maximum alloted size to notes is greater than \cs{textheight}. That makes impossible for long notes to flow across pages.
+% However, the \macpackage default setting for the maximum alloted size to notes is greater than \protect\cs{textheight}. That makes impossible for long notes to flow across pages.
% \footnote{The same applies to \LaTeX\ normal notes. Read \url{http://tex.stackexchange.com/a/228283/7712} for technical informations.}
% We have not changed this default setting, because we do not want to break compatibility with older version of \macpackage and we want to be as close as possible to default \LaTeX's feature.
%
-% So, you MUST change the default setting via \cs{Xmaxnotes} (for critical notes) and \cs{maxhnotesX} (for familiar notes).
+% So, you MUST change the default setting via \protect\cs{Xmaxnotes} (for critical notes) and \protect\cs{maxhnotesX} (for familiar notes).
% Both commands are explained in \macpackage handbook (\reff{reledmac-xmaxhnotes}).
% As an advisable setting:
% \begin{verbatim}
@@ -561,7 +579,7 @@
% \DescribeMacro{\Xonlyside}
% \DescribeMacro{\onlysideX}
% You may want to typeset notes on one side only (either left or right).
-% Use \cs{Xonlyside}\oarg{s}\marg{p} to set critical notes, and \cs{onlysideX}\oarg{s}\marg{p} to set familiar notes.
+% Use \protect\cs{Xonlyside}\oarg{s}\marg{p} to set critical notes, and \protect\cs{onlysideX}\oarg{s}\marg{p} to set familiar notes.
% \marg{p} must be set to \verb+L+ for notes to be confined only on the left side and to \verb+R+ for notes to be confined only on the right side.
% \subsubsection{Familiar notes called in the right side, but to be printed in the left side}
% \DescribeMacro{\footnoteXnomk}
@@ -569,9 +587,9 @@
% As often happens, the left side has less room for text.
% We may want to call familiar notes in the right side while using at the same time the available space in the left side to print them.
%
-% To achieve this, we call \cs{footnoteXnomk}\marg{notecontent} in the left side. X is to be replaced by the series letter. We do this call in the left side after the word which matches up to the one in the right side after which we want to insert the actual footnote mark.
+% To achieve this, we call \protect\cs{footnoteXnomk}\marg{notecontent} in the left side. X is to be replaced by the series letter. We do this call in the left side after the word which matches up to the one in the right side after which we want to insert the actual footnote mark.
%
-% In the right side, we call \cs{footnoteXmk} at the place we want to have the footnote mark. X is to be replaced by the series letter.
+% In the right side, we call \protect\cs{footnoteXmk} at the place we want to have the footnote mark. X is to be replaced by the series letter.
% For example:
% \begin{verbatim}
% \begin{Leftside}
@@ -605,14 +623,14 @@
% \DescribeMacro{\beginnumbering}
% \DescribeMacro{\endnumbering}
% Each section of numbered text must be preceded by
-% \cs{beginnumbering} and followed by \cs{endnumbering}, like: \\
-% \cs{beginnumbering} \\
+% \protect\cs{beginnumbering} and followed by \protect\cs{endnumbering}, like: \\
+% \protect\cs{beginnumbering} \\
% \meta{text} \\
-% \cs{endnumbering} \\
+% \protect\cs{endnumbering} \\
% These have to be separately specified within \verb?Leftside? and
% \verb?Rightside? environments.
%
-% The \cs{beginnumbering} macro resets the line number to zero,
+% The \protect\cs{beginnumbering} macro resets the line number to zero,
% reads an auxiliary file called \meta{jobname}.\file{nn} (where
% \meta{jobname} is the name of the main input file for this job,
% and \file{nn} is 1 for the first numbered section, 2 for
@@ -623,8 +641,8 @@
% them from the left hand and serial (non-parallel) texts.
%
% \DescribeMacro{\memorydump}
-% The command \cs{memorydump} effectively performs an \cs{endumbering}
-% immediately followed by a \cs{beginnumbering} while not restarting the
+% The command \protect\cs{memorydump} effectively performs an \protect\cs{endumbering}
+% immediately followed by a \protect\cs{beginnumbering} while not restarting the
% numbering sequence. This has the effect of clearing \TeX's memory of previous
% texts and any associated notes, allowing
% longer apparent streams of parallel texts. The command should be applied
@@ -654,15 +672,15 @@
% \end{verbatim}
%
%
-%\changes{v0.9.0}{2011/10/01}{Possibility to number \cs{pstart}.}
-% It is possible to insert a number at every \cs{pstart} command.
-% You must use the \DescribeMacro{\numberpstarttrue}\cs{numberpstarttrue} command to have it.
-% You can stop the numbering with \DescribeMacro{\numberpstartfalse}\cs{numberpstartfalse}.
-% You can redefine the commands \DescribeMacro{\thepstartL}\cs{thepstartL} and \DescribeMacro{\thepstartR}\cs{thepstartR} to change style.
-% The numbering restarts on each \cs{beginnumbering}.
+%\changes{v0.9.0}{2011/10/01}{Possibility to number \protect\cs{pstart}.}
+% It is possible to insert a number at every \protect\cs{pstart} command.
+% You must use the \DescribeMacro{\numberpstarttrue}\protect\cs{numberpstarttrue} command to have it.
+% You can stop the numbering with \DescribeMacro{\numberpstartfalse}\protect\cs{numberpstartfalse}.
+% You can redefine the commands \DescribeMacro{\thepstartL}\protect\cs{thepstartL} and \DescribeMacro{\thepstartR}\protect\cs{thepstartR} to change style.
+% The numbering restarts on each \protect\cs{beginnumbering}.
%
% \DescribeMacro{\skipnumbering}
-% The command \cs{skipnumbering} when inserted in a line of parallel text
+% The command \protect\cs{skipnumbering} when inserted in a line of parallel text
% causes the numbering of that particular line to be skipped. This can
% useful if you are putting some kind of marker (even if it is only a
% blank line) between stanzas. Remember, parallel texts must be numbered
@@ -680,31 +698,31 @@
% \DescribeMacro{\firstsublinenum*}
% \DescribeMacro{\sublinenumincrement*}
% Following
-% \cs{firstlinenum}\marg{num} the first line number will be \meta{num}, and
-% following \cs{linenumincrement}\marg{num} only every \meta{num}th
+% \protect\cs{firstlinenum}\marg{num} the first line number will be \meta{num}, and
+% following \protect\cs{linenumincrement}\marg{num} only every \meta{num}th
% line will have a printed number. Using these macros inside the
% \verb?Leftside? and \verb?Rightside? environments gives you independent
-% control over the left and right numbering schemes. The \cs{firstsublinenum}
-% and \cs{sublinenumincrement} macros correspondingly set the numbering
+% control over the left and right numbering schemes. The \protect\cs{firstsublinenum}
+% and \protect\cs{sublinenumincrement} macros correspondingly set the numbering
% scheme for sublines.
% The starred versions change both left and right numbering schemes.
%
-% Generally speaking, controls like \cs{firstlinenum} or \cs{linenummargin}
+% Generally speaking, controls like \protect\cs{firstlinenum} or \protect\cs{linenummargin}
% apply to sequential and left texts.
% To effect right texts only, they have
% to be within a \verb?Rightside? environment.
% \DescribeMacro{\lineationR}
-% \cs{lineationR} macro is the equivalent of \macpackage \cs{lineation} macro for the right side.
+% \protect\cs{lineationR} macro is the equivalent of \macpackage \protect\cs{lineation} macro for the right side.
% \DescribeMacro{\lineation*}
-% \cs{lineation*} macro is the equivalent of \macpackage \cs{lineation} macro for both sides.
+% \protect\cs{lineation*} macro is the equivalent of \macpackage \protect\cs{lineation} macro for both sides.
%
% \DescribeMacro{\setRlineflag}
% A ``R'' is appended to the line numbers of the
% right texts.
% This may be useful for parallel columns but for parallel pages it might
-% be more appropriate to redefine it using \cs{setRlineflag}\marg{flag}.
+% be more appropriate to redefine it using \protect\cs{setRlineflag}\marg{flag}.
% Use \verb?\setRlineflag{}? to empty it.
%
% \subsection{Chunks}
@@ -712,14 +730,14 @@
% \DescribeMacro{\pend}
% In a serial (non-parallel) mode, each numbered paragraph, or chunk,
% is contained
-% between the \cs{pstart} and \cs{pend} macros, and the paragraph is output
-% when the \cs{pend} macro occurs. The situation is somewhat different
-% with parallel typesetting as the left text (contained within \cs{pstart}
-% and \cs{pend} groups within the \verb?Leftside? environment) has to be
-% set in parallel with the right text (contained within its own \cs{pstart}
-% and \cs{pend} groups within the corresponding \verb?Rightside? environment)
-% the \cs{pend} macros cannot immediately initiate any typesetting ---
-% this has to be controlled by the \cs{Columns} or \cs{Pages} macros.
+% between the \protect\cs{pstart} and \protect\cs{pend} macros, and the paragraph is output
+% when the \protect\cs{pend} macro occurs. The situation is somewhat different
+% with parallel typesetting as the left text (contained within \protect\cs{pstart}
+% and \protect\cs{pend} groups within the \verb?Leftside? environment) has to be
+% set in parallel with the right text (contained within its own \protect\cs{pstart}
+% and \protect\cs{pend} groups within the corresponding \verb?Rightside? environment)
+% the \protect\cs{pend} macros cannot immediately initiate any typesetting ---
+% this has to be controlled by the \protect\cs{Columns} or \protect\cs{Pages} macros.
% Several chunks may be specified within a \verb?Leftside? or
% \verb?Rightside? environment.
% A multi-chunk text then looks like:
@@ -733,31 +751,31 @@
% % \endnumbering
% \end{...side}
% \end{verbatim}
-% Numbering, via \cs{beginnumbering} and \cs{endnumbering}, may extend
+% Numbering, via \protect\cs{beginnumbering} and \protect\cs{endnumbering}, may extend
% across several \verb?Leftside? or \verb?Rightside? environments.
% Remember, though,
% that the left/right sides are effectively independent of each other.
%
% \DescribeMacro{\autopar}
-% The \cs{autopar} macro can be used, instead of manually inserting \cs{pstart}\ldots\cs{pends}. Please read \macpackage's handbook (\reff{reledmac-autopar}).
+% The \protect\cs{autopar} macro can be used, instead of manually inserting \protect\cs{pstart}\ldots\protect\cs{pends}. Please read \macpackage's handbook (\reff{reledmac-autopar}).
-% \subsection{\cs{AtEveryPstart} and \cs{AtEveryPstartCall}}
-% In general, remember that the moment where a \cs{pstart} is called is different
-% from the moment when the \cs{pstart}\ldots\cs{pend} content is printed, which is when \cs{Pages} or \cs{Columns} is processed.
+% \subsection{\protect\cs{AtEveryPstart} and \protect\cs{AtEveryPstartCall}}
+% In general, remember that the moment where a \protect\cs{pstart} is called is different
+% from the moment when the \protect\cs{pstart}\ldots\protect\cs{pend} content is printed, which is when \protect\cs{Pages} or \protect\cs{Columns} is processed.
%
% Consequently:
% \begin{itemize}
-% \item The argument of \cs{AtEveryPstart} (see \reff{reledmac-AtEveryPstart}) is called before every chunk is printed, except if you used an optional argument for the \cs{pstart}.
-% \item The argument of \cs{AtEveryPstartCall} is called before every \cs{pstart}.
+% \item The argument of \protect\cs{AtEveryPstart} (see \reff{reledmac-AtEveryPstart}) is called before every chunk is printed, except if you used an optional argument for the \protect\cs{pstart}.
+% \item The argument of \protect\cs{AtEveryPstartCall} is called before every \protect\cs{pstart}.
% \end{itemize}
% \subsection{Language setting}
% If you are using the
-% \Lpack{babel} package or the \Lpack{polyglossia} package ,with different languages
-% (via, say, \cs{selectlanguage}) for the left and right texts it is
+% \protect\package{babel} package or the \protect\package{polyglossia} package ,with different languages
+% (via, say, \protect\cs{selectlanguage}) for the left and right texts it is
% particularly important to select the appropriate language within the
% \verb?Leftside? and \verb?Rightside? environments. The initial language
-% selected for the right text is the \Lpack{babel} package's default. Also,
+% selected for the right text is the \protect\package{babel} package's default. Also,
% it is the \emph{last} language setting in a side that controls the
% language used in any notes for that side when they get printed. If
% you are using multilingual notes then it is probably safest to explicitly
@@ -782,17 +800,17 @@
% To enable this function, load \parpackage with the option \verb+shiftedpstarts+.
% \section{Verse}
%
-% If you are typesetting verse with \macpackage you can use the \cs{stanza}
+% If you are typesetting verse with \macpackage you can use the \protect\cs{stanza}
% construct, and you can also use this in right or left parallel texts.
% In this case each verse line is a chunk which has two implications.
-% (1) you can unexpectedly exceed the \cs{maxchunks} limit or the overall
+% (1) you can unexpectedly exceed the \protect\cs{maxchunks} limit or the overall
% limit on the number of boxes, and (2) left and right verse lines are
% matched, which may not be desirable if one side requires more print lines
% for verse lines than the other does.
%
% \DescribeEnv{astanza}
% \Parpackage provides an \verb?astanza? environment which you can use instead
-% of \cs{stanza}.
+% of \protect\cs{stanza}.
% To use it, imply replace \verb?\stanza? by \verb?\begin{astanza}? and
% add \verb?\end{astanza}? after the ending \verb?\&?. Within the
% \verb?astanza? environment each verse line is treated as a paragraph,
@@ -800,12 +818,12 @@
% be some extraneous vertical spacing.
%
% If you get an error message along the lines of `Missing number,
-% treated as zero \cs{sza@0@}' it is because you have forgotten to use
-% \cs{setstanzaindents} to set the stanza indents.
+% treated as zero \protect\cs{sza@0@}' it is because you have forgotten to use
+% \protect\cs{setstanzaindents} to set the stanza indents.
%
%
%
-% \DescribeMacro{\sethangingsymbol}Like in \macpackage, you could use the \cs{sethangingsymbol} command to insert a character in each hanging line. If you use it, you must run \LaTeX\ two time. Example for the French typography
+% \DescribeMacro{\sethangingsymbol}Like in \macpackage, you could use the \protect\cs{sethangingsymbol} command to insert a character in each hanging line. If you use it, you must run \LaTeX\ two time. Example for the French typography
%\begin{verbatim}
%\sethangingsymbol{[\,}
%\end{verbatim}
@@ -815,21 +833,21 @@
% \end{verbatim}
%
%
-% When you use \cs{lednopb} make sure to use it on both sides in the corresponding
+% When you use \protect\cs{lednopb} make sure to use it on both sides in the corresponding
% verses to keep the pages in sync.
% \section{Side notes}
-% As in \macpackage, you must use one of the following commands to add side notes: \cs{ledsidenote}, \cs{ledleftnote}, \cs{ledrightnote}, \cs{ledouterote}, \cs{ledinnerrote}.
+% 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 \cs{sidenotemargin} defines the margin of the sidenote for either left or right side, depending on the current environment.
-% You can use \cs{sidenotemargin*} to define it for both sides.
+% The \protect\cs{sidenotemargin} defines the margin of the sidenote for either left or right side, depending on the current environment.
+% You can use \protect\cs{sidenotemargin*} to define it for both sides.
% \section{Parallel ledgroups}
% \subsection{General}
% \changes{v1.6.0}{2013/12/13}{Add tool and documentation for parallel ledgroups}
% You can also make parallel ledgroups (see the documentation of \macpackage about ledgroups, \reff{reledmac-ledgroup}).
% To do it you have:
% \begin{itemize}
-% \item To load \parpackage package with the \verb+parledgroup+ option, or to add \cs{parledgrouptrue}.
-% \item To push each ledgroup between \cs{pstart}\ldots\cs{pend} command.
+% \item To load \parpackage package with the \verb+parledgroup+ option, or to add \protect\cs{parledgrouptrue}.
+% \item To push each ledgroup between \protect\cs{pstart}\ldots\protect\cs{pend} command.
% \end{itemize}
% See the following example:
% \begin{verbatim}
@@ -865,8 +883,8 @@
% \end{pages}
% \Pages
% \end{verbatim}
-% \subsection{Parallel ledgroups and \Lpack{setspace} package}
-% If you use the \Lpack{setspace} package and want your notes in parallel ledgroups to be single-spaced (not half-spaced or double-spaced), just add to your preamble:
+% \subsection{Parallel ledgroups and \protect\package{setspace} package}
+% If you use the \protect\package{setspace} package and want your notes in parallel ledgroups to be single-spaced (not half-spaced or double-spaced), just add to your preamble:
% \begin{verbatim}
% \setparledgroupnotespacing{\singlespacing}
% \end{verbatim}
@@ -878,10 +896,21 @@
%
% \DescribeMacro{\eledsectnotoc}
% By default, the section commands of the right side are not added to the table of contents.
-% But you can change it, using \cs{eledsectnotoc}\marg{arg}, where \meta{arg} could be \verb+L+ (for left side) or \verb+R+ (for right side).
+% But you can change it, using \protect\cs{eledsectnotoc}\marg{arg}, where \meta{arg} could be \verb+L+ (for left side) or \verb+R+ (for right side).
%
% \DescribeMacro{\eledsectmark}
-% By default, the \LaTeX\ marks for header are token from left side. You can change it, using \cs{eledsectmark}\marg{arg}, where \meta{arg} could be \verb+L+ (for left side) or \verb+R+ (for right side).
+% By default, the headers are tokens from the left side. You can change them, using \cs{eledsectmark}\marg{arg}, where \meta{arg} could be \verb+L+ (for left side) or \verb+R+ (for right side).
+% \section{Notes about page number}\label{par@page}
+% If you use \verb+sameparallepagenumber+ option (\reff{sameparallelpagenumber} or \verb+prevpgnotnumbered+ option (\reff{prevpgnotnumbered}), please read the following paragraph if you want to manipulate page numbers manually.
+%
+% In order to implement these two options, \parpackage uses its own page counter, called \verb+par@page+.
+% Consequently, if you use at least one of these options:
+% \begin{enumerate}
+% \item If you modify \cs{thepage} command, use the value of \verb+par@page+ counter inside and not the value of \verb+page+ counter.
+% \item If you want to modify a page number, modify the value of \verb+page+ counter AND the value \verb+par@page+ counter.
+% \end{enumerate}
+% Notes that \parpackage automatically do it when you use \protect\cs{frontmatter} and \protect\cs{mainmatter} commands.
+%
% \StopEventually{}
% \clearpage
% \renewcommand{\thesection}{\Roman{section}}
@@ -922,42 +951,57 @@
% \begin{macrocode}
%<*code>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{reledpar}[2015/07/19 v2.0.0 reledmac extension for parallel texts]%
+\ProvidesPackage{reledpar}[2015/07/27 v2.1.0 reledmac extension for parallel texts]%
% \end{macrocode}
% \subsection{Package's requirement}
-% Few commands use \cs{xspace} command.
+% Few commands use \protect\cs{xspace} command.
% \begin{macrocode}
\RequirePackage{xspace}%
% \end{macrocode}
% \subsection{Package's options}
-% With the option `shiftedpstarts' a long pstart one the left side (or in the right side) does not make a blank on the corresponding pstart, but the blank is put on the bottom of the page. Consequently, the pstarts on the parallel pages are shifted, but the shift stops at every end of pages.
+% We use \package{xkeyval} in order to manage options with arguments.
+%
+% \begin{macrocode}
+\RequirePackage{xkeyval}
+% \end{macrocode}
+% With the option `shiftedpstarts' a long pstart on the left side (or on the right side) does not make a blank on the corresponding pstart, but the blank is put on the bottom of the page. Consequently, the pstarts on the parallel pages are shifted, but the shift stops at every end of pages.
% \begin{macro}{\ifshiftedpstarts}
% \begin{macrocode}
\newif\ifshiftedpstarts
-\DeclareOption{shiftedpstarts}{\shiftedpstartstrue}
+\DeclareOptionX{shiftedpstarts}{\shiftedpstartstrue}
% \end{macrocode}
% \end{macro}
% The \verb+parledgroup+ can be called either on \macpackage or \parpackage.
% \begin{macrocode}
-\DeclareOption{parledgroup}{\parledgrouptrue}
+\DeclareOptionX{parledgroup}{\parledgrouptrue}
% \end{macrocode}
% \begin{macro}{\ifwidthliketwocolumns}
-% The \cs{widthliketwocolumns} option can be called either on \macpackage or \parpackage.
+% The \protect\cs{widthliketwocolumns} option can be called either on \macpackage or \parpackage.
% \changes{v1.9.0}{2014/09/16}{Added widthliketwocolumns option}
% \begin{macrocode}
-\DeclareOption{widthliketwocolumns}{\widthliketwocolumnstrue}%
+\DeclareOptionX{widthliketwocolumns}{\widthliketwocolumnstrue}%
% \end{macrocode}
% \end{macro}
-% The \verb+sameparallelpagenumber+ enable to have the same page number in left and right side.
% \begin{macro}{\ifsameparallelpagenumber}
+% \begin{macro}{\ifprevpgnotnumbered}
+% Options related to page numbering
+% \begin{macrocode}
+\newif\ifsameparallelpagenumber
+\newif\ifprevpgnotnumbered
+\DeclareOptionX{sameparallelpagenumber}{\sameparallelpagenumbertrue}
+\DeclareOptionX{prevpgnotnumbered}{\prevpgnotnumberedtrue}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\prevpgstyle}
+% We store on \protect\cs{prevpgstyle} the argument of the option \verb+prevpgstyle+.
% \begin{macrocode}
-\newif\ifsameparallelpagenumber%
-\DeclareOption{sameparallelpagenumber}{\sameparallelpagenumbertrue}%
+\DeclareOptionX{prevpgstyle}{\gdef\prevpgstyle{#1}}%
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
-\ProcessOptions%
+\ProcessOptionsX%
% \end{macrocode}
% \subsection{Determining side and category of parallel processing}
% As noted above, much of the code is a duplication of the original
@@ -971,13 +1015,13 @@
% \begin{macro}{\ifl@dpairing}
% \begin{macro}{\ifl@dpaging}
% \begin{macro}{\ifledRcol}
-% \cs{ifl@dpairing} is set TRUE if we are processing parallel texts and
-% \cs{ifl@dpaging} is also set TRUE if we are doing parallel pages.
-% \cs{ifledRcol} is set TRUE if we are doing the right hand text.
+% \protect\cs{ifl@dpairing} is set TRUE if we are processing parallel texts and
+% \protect\cs{ifl@dpaging} is also set TRUE if we are doing parallel pages.
+% \protect\cs{ifledRcol} is set TRUE if we are doing the right hand text.
% They are defined in \macpackage.
-% \changes{v0.3.0}{2005/02/24}{Moved \cs{ifl@dpairing} to eledmac}
-% \changes{v0.9.0}{2005/10/01}{Moved \cs{iflledRcol} and \cs{ifnumberingR} to eledmac}
-% \changes{v1.9.1}{2014/09/30}{Moved \cs{ifl@dpaging} to eledmac}
+% \changes{v0.3.0}{2005/02/24}{Moved \protect\cs{ifl@dpairing} to eledmac}
+% \changes{v0.9.0}{2005/10/01}{Moved \protect\cs{iflledRcol} and \protect\cs{ifnumberingR} to eledmac}
+% \changes{v1.9.1}{2014/09/30}{Moved \protect\cs{ifl@dpaging} to eledmac}
% \changes{v1.13.0}{2015/03/06}{Remove false boolean settings which are not needed.}
% \end{macro}
% \end{macro}
@@ -1067,6 +1111,13 @@
}%
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\led@error@fail@patch@@mempnum}
+% \begin{macrocode}
+\newcommand{\led@error@fail@patch@@mempnum}{%
+ \reledpar@error{Fail to patch \string\@mempnum\space command.}{\@ehc}%
+}%
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\led@error@fail@patch@@outputpage}
% \begin{macrocode}
\newcommand{\led@error@fail@patch@@outputpage}{%
@@ -1077,13 +1128,13 @@
% \section{Sectioning commands}
%
% \begin{macro}{\section@numR}
-% This is the right side equivalent of \cs{section@num}.
+% This is the right side equivalent of \protect\cs{section@num}.
%
% Each section will read and write an associated `line-list
% file', containing information used to do the numbering. Normally
% the file will be called \meta{jobname}\file{.nn}, where \file{nn} is the
% section number. However, for right side texts the file is called
-% \meta{jobname}\file{.nnR}. The \cs{extensionchars} applies to the
+% \meta{jobname}\file{.nnR}. The \protect\cs{extensionchars} applies to the
% right side files just as it does to the normal files.
% \begin{macrocode}
\newcount\section@numR
@@ -1094,10 +1145,10 @@
%
% \begin{macro}{\ifpst@rtedL}
% \begin{macro}{\ifpst@rtedR}
-% \cs{ifpst@rtedL} is set FALSE at the start of left side numbering, and
-% similarly for \cs{ifpst@rtedR}.
-% \cs{ifpst@rtedL} is defined in \macpackage.
-% \changes{v0.3.0}{2005/02/24}{Moved \cs{ifpst@rtedL} to eledmac}
+% \protect\cs{ifpst@rtedL} is set FALSE at the start of left side numbering, and
+% similarly for \protect\cs{ifpst@rtedR}.
+% \protect\cs{ifpst@rtedL} is defined in \macpackage.
+% \changes{v0.3.0}{2005/02/24}{Moved \protect\cs{ifpst@rtedL} to eledmac}
% \begin{macrocode}
\pst@rtedLfalse
\newif\ifpst@rtedR
@@ -1106,10 +1157,10 @@
% \end{macro}
% \end{macro}
%
-% \changes{v1.8.0}{2014/07/24}{\cs{beginnumbering} is defined only on \Lpack{eledmac}, not on \Lpack{eledpar}.}
+% \changes{v1.8.0}{2014/07/24}{\protect\cs{beginnumbering} is defined only on \protect\package{eledmac}, not on \protect\package{eledpar}.}
%
% \begin{macro}{\beginnumberingR}
-% This is the right text equivalent of \cs{beginnumbering}, and begins
+% This is the right text equivalent of \protect\cs{beginnumbering}, and begins
% a section of numbered text.
% \begin{macrocode}
\newcommand*{\beginnumberingR}{%
@@ -1147,13 +1198,13 @@
% \end{macro}
%
% \begin{macro}{\endnumbering}
-% This is the left text version of the regular \cs{endnumbering} and must
+% This is the left text version of the regular \protect\cs{endnumbering} and must
% follow the last text for a left text numbered section.
-% It sets \cs{ifpst@rtedL} to FALSE. It is fully defined in \macpackage.
+% It sets \protect\cs{ifpst@rtedL} to FALSE. It is fully defined in \macpackage.
% \end{macro}
%
% \begin{macro}{\endnumberingR}
-% This is the right text equivalent of \cs{endnumbering} and must follow the
+% This is the right text equivalent of \protect\cs{endnumbering} and must follow the
% last text for a right text numbered section.
% \begin{macrocode}
\def\endnumberingR{%
@@ -1190,7 +1241,7 @@
% \begin{macro}{\initnumbering@sectcountR}
% \changes{v1.2.1}{2012/11/01}{For the right section, the counter is defined only once.}
% We do not want the numbering of the right-side section commands to be continuous with the numbering of the left side,
-% we switch the \LaTeX\ counter in \cs{numberingR}.
+% we switch the \LaTeX\ counter in \protect\cs{numberingR}.
% \begin{macrocode}
\newcounter{chapterR}
\newcounter{sectionR}
@@ -1207,9 +1258,9 @@
%
% \begin{macro}{\pausenumberingR}
% \begin{macro}{\resumenumberingR}
-% These are the right text equivalents of \cs{pausenumbering} and
-% \cs{resumenumbering}.
-% \changes{v1.8.3}{2014/08/31}{Debug \cs{resumenumberingR}}
+% These are the right text equivalents of \protect\cs{pausenumbering} and
+% \protect\cs{resumenumbering}.
+% \changes{v1.8.3}{2014/08/31}{Debug \protect\cs{resumenumberingR}}
% \begin{macrocode}
\newcommand*{\pausenumberingR}{%
\endnumberingR\global\numberingRtrue}
@@ -1234,7 +1285,7 @@
%
% \begin{macro}{\memorydumpL}
% \begin{macro}{\memorydumpR}
-% \cs{memorydump} is a shorthand for \cs{pausenumbering}\cs{resumenumbering}.
+% \protect\cs{memorydump} is a shorthand for \protect\cs{pausenumbering}\protect\cs{resumenumbering}.
% This will clear the memorised stuff for the previous chunks while
% keeping the numbering going.
% \begin{macrocode}
@@ -1270,17 +1321,17 @@
% \changes{v0.11.0}{2012/06/11}{Lineation can be by pstart (like in eledmac 0.15).}
% \changes{v1.0.0}{2012/09/14}{Debug in lineation by pstart}
% Sometimes you want line numbers that start at $1$ at the top of each
-% page; sometimes you want line numbers that start at $1$ at each \cs{pstart}; other times you want line numbers that start at $1$ at the start
+% page; sometimes you want line numbers that start at $1$ at each \protect\cs{pstart}; other times you want line numbers that start at $1$ at the start
% of each section and increase regardless of page breaks.
% \Parpackage lets you choose different schemes for the left and right texts.
-% \changes{v2.0.0}{2015/07/19}{\cs{ifbypage@} and \cs{ifbypstart@R} defined in \eledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{ifbypage@} and \protect\cs{ifbypstart@R} defined in \eledmac.}
%
% \begin{macro}{\lineationR}
-% \cs{lineationR}\marg{word} is the macro used to select the
+% \protect\cs{lineationR}\marg{word} is the macro used to select the
% lineation system for right texts.
% Its argument is a string: either \verb+page+, \verb+pstart+ or \verb+section+.
-% \changes{v1.15.0}{2015/04/13}{As \cs{lineation}, \cs{lineationR} automatically set the \cs{pstartinfootnote}.}
+% \changes{v1.15.0}{2015/04/13}{As \protect\cs{lineation}, \protect\cs{lineationR} automatically set the \protect\cs{pstartinfootnote}.}
% \begin{macrocode}
\newcommand*{\lineationR}[1]{{%
\ifnumbering
@@ -1319,8 +1370,8 @@
% \end{macro}
%
% \begin{macro}{\lineation*}
-% \changes{v1.8.2}{2014/08/15}{Add \cs{lineation*}}
-% \cs{lineation*} change the lineation system for both sides.
+% \changes{v1.8.2}{2014/08/15}{Add \protect\cs{lineation*}}
+% \protect\cs{lineation*} change the lineation system for both sides.
% \begin{macrocode}
\WithSuffix\newcommand\lineation*[1]{%
\lineation{#1}%
@@ -1332,7 +1383,7 @@
% \subsection{Setting line number margin}
% \begin{macro}{\linenummargin}
% \begin{macro}{\line@marginR}
-% You call \cs{linenummargin}\marg{word} to specify which margin you want your
+% You call \protect\cs{linenummargin}\marg{word} to specify which margin you want your
% right text's line numbers in; it takes one argument, a string.
% You can put the line numbers in the same margin on every page using
% \verb+left+ or \verb+right+; or you can use \verb+inner+ or
@@ -1341,14 +1392,14 @@
% change may not take effect just when you would like; if it is done between
% paragraphs nothing surprising should happen.
%
-% For right texts the selection is recorded in the count \cs{line@marginR},
-% otherwise in the count \cs{line@margin}:
+% For right texts the selection is recorded in the count \protect\cs{line@marginR},
+% otherwise in the count \protect\cs{line@margin}:
% $0$ for left, $1$ for right, $2$ for outer, and $3$ for inner.
%
% It is defined only once time, in \reledmac.
%
-% \changes{v0.3.a}{2005/03/30}{Do not just set \cs{line@marginR} in \cs{linenummargin}}
-% \changes{v2.0.0}{2015/07/19}{\cs{linenummargin} now defined only once time in \reledmac.}
+% \changes{v0.3.a}{2005/03/30}{Do not just set \protect\cs{line@marginR} in \protect\cs{linenummargin}}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{linenummargin} now defined only once time in \reledmac.}
% \begin{macrocode}
\newcount\line@marginR
% \end{macrocode}
@@ -1403,11 +1454,11 @@
% \begin{macro}{\linenumincrement*}
% \begin{macro}{\firstsublinenum*}
% \begin{macro}{\sublinenumincrement*}
-% \changes{v1.5.0}{2013/11/08}{Add starred version of \cs{firstlinenum}, \cs{linenumincrement}, \cs{firstsublinenum}, \cs{sublinenumincrement} to change both Left and Rightside.}
+% \changes{v1.5.0}{2013/11/08}{Add starred version of \protect\cs{firstlinenum}, \protect\cs{linenumincrement}, \protect\cs{firstsublinenum}, \protect\cs{sublinenumincrement} to change both Left and Rightside.}
% These are the user's macros for changing (sub) line numbers. They are
% defined in \macpackage.
-% The starred versions are specific to \Lpack{eledpar}.
-% \changes{v2.0.0}{2015/07/19}{\cs{firstlinenum}, \cs{linenumincrement}, \cs{firstsublinenum}, \cs{sublinenumincrement} are now defined only in \macpackage.}
+% The starred versions are specific to \protect\package{eledpar}.
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{firstlinenum}, \protect\cs{linenumincrement}, \protect\cs{firstsublinenum}, \protect\cs{sublinenumincrement} are now defined only in \macpackage.}
% \begin{macrocode}
\WithSuffix\newcommand\firstlinenum*[1]{%
\setcounter{firstlinenumR}{#1}%
@@ -1448,9 +1499,9 @@
% \subsection{Setting line number style}
% \begin{macro}{\linenumrepR}
% \begin{macro}{\sublinenumrepR}
-% \cs{linenumrepR}\marg{ctr} typesets the right line number \meta{ctr}, and
-% similarly \cs{sublinenumrepR} for subline numbers.
-% \changes{v0.3.0}{2005/02/10}{Added \cs{linenumrepR} and \cs{sublinenumrepR}}
+% \protect\cs{linenumrepR}\marg{ctr} typesets the right line number \meta{ctr}, and
+% similarly \protect\cs{sublinenumrepR} for subline numbers.
+% \changes{v0.3.0}{2005/02/10}{Added \protect\cs{linenumrepR} and \protect\cs{sublinenumrepR}}
% \begin{macrocode}
\newcommand*{\linenumrepR}[1]{\@arabic{#1}}
\newcommand*{\sublinenumrepR}[1]{\@arabic{#1}}
@@ -1462,12 +1513,12 @@
% \begin{macro}{\leftlinenumR}
% \begin{macro}{\rightlinenumR}
% \begin{macro}{\l@dlinenumR}
-% \cs{leftlinenumR} and \cs{rightlinenumR} are the macros that are
+% \protect\cs{leftlinenumR} and \protect\cs{rightlinenumR} are the macros that are
% called to print the right text's marginal line numbers.
% Much of the
-% code for these is common and is maintained in \cs{l@dlinenumR}.
-% \changes{v0.3.0}{2005/02/10}{Simplified \cs{leftlinenumR} and
-% \cs{rightlinenumR} by introducing \cs{l@dlinenumR}}
+% code for these is common and is maintained in \protect\cs{l@dlinenumR}.
+% \changes{v0.3.0}{2005/02/10}{Simplified \protect\cs{leftlinenumR} and
+% \protect\cs{rightlinenumR} by introducing \protect\cs{l@dlinenumR}}
% \begin{macrocode}
\newcommand*{\leftlinenumR}{%
\l@dlinenumR
@@ -1497,11 +1548,11 @@
% \begin{macro}{\line@numR}
% \begin{macro}{\subline@numR}
% \begin{macro}{\absline@numR}
-% The count \cs{line@numR} stores the line number that is used in
+% The count \protect\cs{line@numR} stores the line number that is used in
% the right text's marginal line numbering and in notes.
-% The count \cs{subline@numR} stores
-% a sub-line number that qualifies \cs{line@numR}.
-% The count \cs{absline@numR} stores the
+% The count \protect\cs{subline@numR} stores
+% a sub-line number that qualifies \protect\cs{line@numR}.
+% The count \protect\cs{absline@numR} stores the
% absolute number of lines since the start
% of the right text section: that is, the number we have actually printed,
% no matter what numbers we attached to them.
@@ -1569,7 +1620,7 @@
%
%
% \begin{macro}{\list@clearing@regR}
-% \cs{Clear the right lines for \cs{read@linelist}}
+% \protect\cs{Clear the right lines for \protect\cs{read@linelist}}
% \begin{macrocode}
\newcommand{\list@clearing@regR}{%
\list@clear{\line@listR}%
@@ -1582,28 +1633,28 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{\read@linelist}
-% \cs{read@linelist}\marg{file} is the control sequence
-% that is called by \cs{beginnumbering}
-% (via \cs{line@list@stuff}) to open and process a
+% \protect\cs{read@linelist}\marg{file} is the control sequence
+% that is called by \protect\cs{beginnumbering}
+% (via \protect\cs{line@list@stuff}) to open and process a
% line-list file; its argument is the name of the file.
% \label{readlinelist}.
% It is defined only once time in \reledmac.
-% \changes{v2.0.0}{2015/07/19}{\cs{read@linelist} is defined only once time in \cs{reledmac}.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{read@linelist} is defined only once time in \protect\cs{reledmac}.}
%
% \end{macro}
% \subsection{Commands within the line-list file}
%
% This section defines the commands that can appear within a
-% line-list file, except for \cs{@lab} which is in a
+% line-list file, except for \protect\cs{@lab} which is in a
% later section among the cross-referencing commands it is
% associated with.
%
% The macros with \verb"action" in their names contain all the code
% that modifies the action-code list.
-% \changes{v2.0.0}{2015/07/19}{\cs{@nl} is now defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{@nl} is now defined only in \reledmac.}
% \begin{macro}{\@nl@regR}
% \begin{macro}{\@nl}
-% \cs{@nl@regR} is called by \cs{@nl} if we are on a right side.
+% \protect\cs{@nl@regR} is called by \protect\cs{@nl} if we are on a right side.
% It does everything related to the start of a
% new line of numbered text on a right side.
%
@@ -1658,9 +1709,9 @@
% \end{macro}
% \begin{macro}{\last@page@numR}
% \begin{macro}{\fix@page}
-% \cs{last@page@numR} store the page number of the last right page.
-% It is modified by \cs{fix@page}, defined by \reledmac.
-% \changes{v2.0.0}{2105/06/28}{\cs{fix@page} is defined only once in \reledmac}
+% \protect\cs{last@page@numR} store the page number of the last right page.
+% It is modified by \protect\cs{fix@page}, defined by \reledmac.
+% \changes{v2.0.0}{2105/06/28}{\protect\cs{fix@page} is defined only once in \reledmac}
%
% \begin{macrocode}
\newcount\last@page@numR
@@ -1672,64 +1723,64 @@
%
%
% \begin{macro}{\@adv}
-% The \cs{@adv}\marg{num} macro advances
+% The \protect\cs{@adv}\marg{num} macro advances
% the current visible line number by the amount specified as
-% its argument. This is used to implement \cs{advanceline}.
+% its argument. This is used to implement \protect\cs{advanceline}.
% It is defined in \macpackage.
-% \changes{v2.0.0}{2015/07/19}{\cs{@adv} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{@adv} defined only in \reledmac.}
% \end{macro}
%
% \begin{macro}{\@set}
-% The \cs{@set}\marg{num} macro sets
+% The \protect\cs{@set}\marg{num} macro sets
% the current visible line number to the value specified as
-% its argument. This is used to implement \cs{setline}.
+% its argument. This is used to implement \protect\cs{setline}.
% It is defined in \macpackage.
%
-% \changes{v2.0.0}{2015/07/19}{\cs{@set} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{@set} defined only in \reledmac.}
% \end{macro}
%
% \begin{macro}{\l@d@set}
-% The \cs{l@d@set}\marg{num} macro sets
+% The \protect\cs{l@d@set}\marg{num} macro sets
% the line number for the next \verb?\pstart...? to the value specified as
-% its argument. This is used to implement \cs{setlinenum}.
+% its argument. This is used to implement \protect\cs{setlinenum}.
% It is defined in \macpackage.
-% \changes{v2.0.0}{2015/07/19}{\cs{l@d@set} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{l@d@set} defined only in \reledmac.}
% \end{macro}
%
% \begin{macro}{\page@action}
-% \cs{page@action}
+% \protect\cs{page@action}
% adds an entry to the action-code list to change the page number.
% It is defined in \macpackage.
-% \changes{v2.0.0}{2015/07/19}{\cs{page@action} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{page@action} defined only in \reledmac.}
% \end{macro}
%
% \begin{macro}{\set@line@action}
-% \cs{set@line@action} adds an entry to the action-code
+% \protect\cs{set@line@action} adds an entry to the action-code
% list to change the visible line number.
% It is defined in \macpackage.
-% \changes{v2.0.0}{2015/07/19}{\cs{set@line@action} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{set@line@action} defined only in \reledmac.}
% \end{macro}
%
% \begin{macro}{\sub@action}
-% \cs{sub@action}
+% \protect\cs{sub@action}
% adds an entry to the action-code list to turn sub-lineation on or
-% off, according to the current value of the \cs{ifsublines@} flag.
+% off, according to the current value of the \protect\cs{ifsublines@} flag.
% It is defined in \macpackage.
%
-% \changes{v2.0.0}{2015/07/19}{\cs{sub@action} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{sub@action} defined only in \reledmac.}
% \end{macro}
%
% \begin{macro}{\do@lockon}
% \begin{macro}{\do@lockonR}
-% \cs{lock@on}
+% \protect\cs{lock@on}
% adds an entry to the action-code list to turn line number
% locking on. The current setting of the sub-lineation flag tells us
% whether this applies to line numbers or sub-line numbers.
-% It is defined in \macpackage, however the code specific to right side is defined here, in \cs{do@lockonR}.
+% It is defined in \macpackage, however the code specific to right side is defined here, in \protect\cs{do@lockonR}.
-% \changes{v2.0.0}{2015/07/19}{\cs{do@lockon} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{do@lockon} defined only in \reledmac.}
% \begin{macrocode}
\newcount\@lockR
\newcount\sub@lockR
@@ -1764,10 +1815,10 @@
% \begin{macro}{\do@lockoff}
% \begin{macro}{\do@lockoffR}
% \begin{macro}{\skip@lockoff}
-% \cs{lock@off} adds an entry to the action-code list
+% \protect\cs{lock@off} adds an entry to the action-code list
% to turn line number locking off.
-% It is defined in \macpackage, however the code specific to right side is defined here, in \cs{do@lockoffR}.
-% \changes{v2.0.0}{2015/07/19}{\cs{do@lockoff} defined only in \reledmac.}
+% It is defined in \macpackage, however the code specific to right side is defined here, in \protect\cs{do@lockoffR}.
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{do@lockoff} defined only in \reledmac.}
% \begin{macrocode}
@@ -1797,38 +1848,38 @@
% \end{macro}
%
% \begin{macro}{\n@num}
-% \changes{v1.15.0}{2015/04/13}{\cs{n@num} defined only one time for both \Eledmac{} and \Eledpar{}.}
+% \changes{v1.15.0}{2015/04/13}{\protect\cs{n@num} defined only one time for both \Eledmac{} and \Eledpar{}.}
% \end{macro}
%
% \begin{macro}{\@ref}
% \begin{macro}{\@ref@regR}
-% \changes{v2.0.0}{2015/07/19}{\cs{@ref} defined only in \reledmac, code specific to right side moved in \cs{ref@regR}.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{@ref} defined only in \reledmac, code specific to right side moved in \protect\cs{ref@regR}.}
% \begin{macro}{\insert@countR}
-% \cs{@ref}
+% \protect\cs{@ref}
% marks the start of a passage, for creation of a footnote reference.
% It takes two arguments:
% \begin{itemize}
-% \item \verb"#1", the number of entries to add to \cs{insertlines@list}
+% \item \verb"#1", the number of entries to add to \protect\cs{insertlines@list}
% for this reference.
-% This value for right text, here and within \cs{edtext},
+% This value for right text, here and within \protect\cs{edtext},
% which computes it and writes it to the line-list file,
-% will be stored in the count \cs{insert@countR}.
+% will be stored in the count \protect\cs{insert@countR}.
% \begin{macrocode}
\newcount\insert@countR
% \end{macrocode}
%
% \item \verb"#2", a sequence of other line-list-file commands, executed to
% determine the ending line-number. This may also include other
-% \cs{@ref} commands, corresponding to uses of \cs{edtext}
-% within the first argument of another instance of \cs{edtext}.
+% \protect\cs{@ref} commands, corresponding to uses of \protect\cs{edtext}
+% within the first argument of another instance of \protect\cs{edtext}.
% \end{itemize}
%
-% \cs{@ref} itself is defined in \macpackage.
-% It calls \cs{ref@reg} or \cs{ref@regR}, depending weither we are in left or right side.
-% Here, we define only \cs{ref@regR}, \cs{ref@reg} is already defined in \macpackage.
+% \protect\cs{@ref} itself is defined in \macpackage.
+% It calls \protect\cs{ref@reg} or \protect\cs{ref@regR}, depending weither we are in left or right side.
+% Here, we define only \protect\cs{ref@regR}, \protect\cs{ref@reg} is already defined in \macpackage.
%
-% The first thing \cs{@ref@regR} itself does is to add the specified number
-% of items to the \cs{insertlines@listR} list.
+% The first thing \protect\cs{@ref@regR} itself does is to add the specified number
+% of items to the \protect\cs{insertlines@listR} list.
% \begin{macrocode}
\newcommand*{\@ref@regR}[2]{%
\global\advance\@edtext@level by 1%
@@ -1841,8 +1892,8 @@
%
% Next, process the second argument to determine the page
% and line numbers for the end of this lemma.
-% We temporarily equate \cs{@ref} to a different macro that just executes
-% its argument, so that nested \cs{@ref} commands are just skipped
+% We temporarily equate \protect\cs{@ref} to a different macro that just executes
+% its argument, so that nested \protect\cs{@ref} commands are just skipped
% this time. Some other macros need to be temporarily redefined to
% suppress their action.
% \begin{macrocode}
@@ -1863,7 +1914,7 @@
% \end{macrocode}
%
% Now store all the information about the location of the lemma's
-% start and end in \cs{line@list@R}.
+% start and end in \protect\cs{line@list@R}.
% \begin{macrocode}
\xright@appenditem%
{\the\page@numR|\the\line@numR|%
@@ -1871,7 +1922,7 @@
\the\endpage@num|\the\endline@num|%
\ifsublines@ \the\endsubline@num \else 0\fi}\to\line@listR
% \end{macrocode}
-% Create a list which will store all the second argument of each \cs{@sw}
+% Create a list which will store all the second argument of each \protect\cs{@sw}
% in this lemma, at this level.
% \begin{macrocode}
\expandafter\list@create\expandafter{\csname sw@list@edtext@tmp@\the\@edtext@level\endcsname}%
@@ -1881,12 +1932,12 @@
\providebool{lemmacommand@\the\@edtext@level}%
\boolfalse{lemmacommand@\the\@edtext@level}%
% \end{macrocode}
-% Execute the second argument of \cs{@ref} again,
+% Execute the second argument of \protect\cs{@ref} again,
% to perform for real all the commands within it.
% \begin{macrocode}
#2
-% Now, we store the list of \cs{@sw} of this current \cs{edtext} as an element of
-% the global list of list of \cs{@sw} for a \cs{edtext} depth.
+% Now, we store the list of \protect\cs{@sw} of this current \protect\cs{edtext} as an element of
+% the global list of list of \protect\cs{@sw} for a \protect\cs{edtext} depth.
% \begin{macrocode}
\ifnum\@edtext@level>0%
\def\create@this@edtext@level{\expandafter\list@create\expandafter{\csname sw@list@edtextR@\the\@edtext@level\endcsname}}%
@@ -1907,8 +1958,8 @@
% \end{macro}
% \begin{macro}{\@pend}
% \begin{macro}{\@pendR}
-% \cs{@pend}\marg{num} adds its argument to the \cs{linesinpar@listL}
-% list, and analagously for \cs{@pendR}. If needed, it resets line number.
+% \protect\cs{@pend}\marg{num} adds its argument to the \protect\cs{linesinpar@listL}
+% list, and analagously for \protect\cs{@pendR}. If needed, it resets line number.
% Both are defined in \macpackage, but they are empty.
% They are really defined only in \parpackage.
%
@@ -1927,8 +1978,8 @@
%
% \begin{macro}{\@lopL}
% \begin{macro}{\@lopR}
-% \cs{@lopL}\marg{num} adds its argument to the \cs{linesonpage@listL}
-% list, and analagously for \cs{@lopR}.
+% \protect\cs{@lopL}\marg{num} adds its argument to the \protect\cs{linesonpage@listL}
+% list, and analagously for \protect\cs{@lopR}.
% Both are defined in \macpackage, but they are empty.
% They are really defined only in \parpackage.
% \begin{macrocode}
@@ -1949,7 +2000,7 @@
% section to write commands out to the line-list.
%
% \begin{macro}{\linenum@outR}
-% The file for right texts will be opened on output stream \cs{linenum@outR}.
+% The file for right texts will be opened on output stream \protect\cs{linenum@outR}.
% \begin{macrocode}
\newwrite\linenum@outR
% \end{macrocode}
@@ -1969,8 +2020,8 @@
% \end{macro}
%
% \begin{macro}{\line@list@stuffR}
-% This is the right text version of the \cs{line@list@stuff}\marg{file}
-% macro. It is called by \cs{beginnumberingR} and performs
+% This is the right text version of the \protect\cs{line@list@stuff}\marg{file}
+% macro. It is called by \protect\cs{beginnumberingR} and performs
% all the line-list operations needed at the start of a section.
% Its argument is the name of the line-list file.
% \changes{v1.10.1}{2015/01/16}{Revert modification of 1.4.2, which makes bugs with numbering. Leave vertical mode to solve spurious space before minipage.}
@@ -1994,7 +2045,7 @@
% \end{macro}
%
% \begin{macro}{\new@lineL}
-% The \cs{new@lineL} macro sends the \cs{@nl} command to the left text
+% The \protect\cs{new@lineL} macro sends the \protect\cs{@nl} command to the left text
% line-list file, to mark the start of a new text line.
% \begin{macrocode}
\newcommand*{\new@lineL}{%
@@ -2002,7 +2053,7 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{\new@lineR}
-% The \cs{new@lineR} macro sends the \cs{@nl} command to the right text
+% The \protect\cs{new@lineR} macro sends the \protect\cs{@nl} command to the right text
% line-list file, to mark the start of a new text line.
% \begin{macrocode}
\newcommand*{\new@lineR}{%
@@ -2012,11 +2063,11 @@
%
% \begin{macro}{\flag@start}
% \begin{macro}{\flag@end}
-% We enclose a lemma marked by \cs{edtext} in
-% \cs{flag@start} and \cs{flag@end}: these send the \cs{@ref}
+% We enclose a lemma marked by \protect\cs{edtext} in
+% \protect\cs{flag@start} and \protect\cs{flag@end}: these send the \protect\cs{@ref}
% command to the line-list file.
-% \changes{v0.3.0}{2005/02/04}{Removed extraneous spaces from\cs{flag@end}}
-% \changes{v1.8.2}{2014/08/15}{\cs{flag@start} and \cs{flag@end} are now defined only one time for eledmac and eledpar}
+% \changes{v0.3.0}{2005/02/04}{Removed extraneous spaces from\protect\cs{flag@end}}
+% \changes{v1.8.2}{2014/08/15}{\protect\cs{flag@start} and \protect\cs{flag@end} are now defined only one time for eledmac and eledpar}
% They are both defined in \macpackage.
%
% \end{macro}
@@ -2024,62 +2075,62 @@
%
% \begin{macro}{\startsub}
% \begin{macro}{\endsub}
-% \cs{startsub} and \cs{endsub}
+% \protect\cs{startsub} and \protect\cs{endsub}
% turn sub-lineation on and off, by writing
% appropriate instructions to the line-list file.
% There are both defined in \macpackage.
-% \changes{v2.0.0}{2015/07/19}{\cs{startsub} and \cs{endsub} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{startsub} and \protect\cs{endsub} defined only in \reledmac.}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\advanceline}
-% You can use \cs{advanceline}\marg{num}
+% You can use \protect\cs{advanceline}\marg{num}
% in running text to advance the current visible
% line-number by a specified value, positive or negative.
% It is defined in \macpackage.
-% \changes{v2.0.0}{2015/07/19}{\cs{advanceline} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{advanceline} defined only in \reledmac.}
% \end{macro}
%
% \begin{macro}{\setline}
-% You can use \cs{setline}\marg{num}
+% You can use \protect\cs{setline}\marg{num}
% in running text (i.e., within \verb?\pstart...\pend?) to set the
% current visible
% line-number to a specified positive value.
% It is defined in \macpackage.
-% \changes{v2.0.0}{2015/07/19}{\cs{setline} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{setline} defined only in \reledmac.}
%
% \end{macro}
%
% \begin{macro}{\setlinenum}
-% You can use \cs{setlinenum}\marg{num}
-% before a \cs{pstart} to set the visible line-number to a specified
-% positive value. It writes a \cs{\l@d@set} command to the line-list file.
+% You can use \protect\cs{setlinenum}\marg{num}
+% before a \protect\cs{pstart} to set the visible line-number to a specified
+% positive value. It writes a \protect\cs{l@d@set} command to the line-list file.
% It is defined in \macpackage.
%
-% \changes{v2.0.0}{2015/07/19}{\cs{setlinenum} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{setlinenum} defined only in \reledmac.}
% \end{macro}
%
% \begin{macro}{\startlock}
% \begin{macro}{\endlock}
-% You can use \cs{startlock} or \cs{endlock}
+% You can use \protect\cs{startlock} or \protect\cs{endlock}
% in running text to start or end line number locking at
% the current line. They decide whether line numbers or sub-line numbers
% are affected, depending on the current state of the sub-lineation flags.
% They are defined in \macpackage.
-% \changes{v2.0.0}{2015/07/19}{\cs{startlock} and \cs{endlock} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{startlock} and \protect\cs{endlock} defined only in \reledmac.}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\skipnumbering}
-% \changes{v1.15.0}{2015/04/13}{\cs{skipnumbering} defined only one time for both \Eledmac{} and \Eledpar{}}
+% \changes{v1.15.0}{2015/04/13}{\protect\cs{skipnumbering} defined only one time for both \Eledmac{} and \Eledpar{}}
% \end{macro}
%
%
% \section{Marking text for notes}
% \label{text}
%
-% The \cs{edtext} macro is used to create all
+% The \protect\cs{edtext} macro is used to create all
% footnotes and endnotes,
% as well as to print the portion of the main text to which a given note
% or notes is keyed. The idea is to have that lemma appear only once in
@@ -2089,22 +2140,22 @@
% \begin{macro}{\critext}
% \begin{macro}{\edtext}
% \changes{v1.3.0}{2012/11/16}{Manage RTL language.}
-% \changes{v1.11.0}{2014/01/22}{\cs{critext} and \cs{edtext} are now defined only in eledmac.}
+% \changes{v1.11.0}{2014/01/22}{\protect\cs{critext} and \protect\cs{edtext} are now defined only in eledmac.}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\set@line}
-% The \cs{set@line} macro
-% is called by \cs{edtext} to put the line-reference field and
-% font specifier for the current block of text into \cs{l@d@nums}.
+% The \protect\cs{set@line} macro
+% is called by \protect\cs{edtext} to put the line-reference field and
+% font specifier for the current block of text into \protect\cs{l@d@nums}.
% It is defined in \macpackage.
%
-% \changes{v2.0.0}{2015/07/19}{\cs{set@line} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{set@line} defined only in \reledmac.}
% \end{macro}
% \subsection{Specific hooks and commands for notes}
-% The \macpackage \cs{newseries@} initializes commands which are linked to notes series.
+% The \macpackage \protect\cs{newseries@} initializes commands which are linked to notes series.
% However, to keep \macpackage as light as possible, it does not define commands which are specific to \parpackage.
-% This is what does \cs{newseries@par}. The specific hooks are also defined here.
+% This is what does \protect\cs{newseries@par}. The specific hooks are also defined here.
% \begin{macro}{\newseries@par}
% \begin{macrocode}
\newcommand{\newseries@par}[1]{%
@@ -2114,7 +2165,7 @@
% We need to declare these options.
% We also need boolean flags, and to set them to true when a note series is not printed on one side.
% We check the \verb+nofamiliar+ and \verb+nocritical+ \Eledmac{} options.
-% \changes{v1.16.0}{2015/05/18}{Fix bug with \cs{onlysideX}.}
+% \changes{v1.16.0}{2015/05/18}{Fix bug with \protect\cs{onlysideX}.}
% \begin{macrocode}
\unless\ifnofamiliar@%
\csgdef{onlysideX@#1}{}%
@@ -2126,8 +2177,8 @@
\fi%
% \end{macrocode}
% \subsubsection{Familiar footnotes without marks}
-% The \cs{footnoteXnomk} commands are for notes which are printed on the left side, while they are called in the right side.
-% Basically, they set first toggle \cs{nomark@} to true, then call the \cs{footnoteX}.
+% The \protect\cs{footnoteXnomk} commands are for notes which are printed on the left side, while they are called in the right side.
+% Basically, they set first toggle \protect\cs{nomark@} to true, then call the \protect\cs{footnoteX}.
% and finally add the footnote counter in the footnote counter list.
%
% First, check the \verb+nofamiliar+ option of \macpackage.
@@ -2138,18 +2189,18 @@
% \begin{macrocode}
\expandafter\list@create\csname footnote#1@mk\endcsname%
% \end{macrocode}
-% Then, declare the \cs{footnoteXnomk} command.
+% Then, declare the \protect\cs{footnoteXnomk} command.
% \begin{macrocode}
\expandafter\newcommand\csname footnote#1nomk\endcsname[1]{%
% \end{macrocode}
-% First step: just call the normal \cs{footnoteX}, saying that we do not want to print the mark.
+% First step: just call the normal \protect\cs{footnoteX}, saying that we do not want to print the mark.
% \begin{macrocode}
\toggletrue{nomk@}%
\csuse{footnote#1}{##1}%
\togglefalse{nomk@}%
% \end{macrocode}
% Second, and last, step: store the footnote counter in the footnote counters list.
-% We use some \cs{let}, because \cs{xright@appenditem} is difficult to use with \cs{expandafter}.
+% We use some \protect\cs{let}, because \protect\cs{xright@appenditem} is difficult to use with \protect\cs{expandafter}.
% \begin{macrocode}
\letcs{\@tmp}{footnote#1@mk}%
\numdef\@tmpa{\csuse{c@footnote#1}}%
@@ -2162,7 +2213,7 @@
\expandafter\newcommand\csname footnote#1mk\endcsname{%
% \end{macrocode}
% Get the first element of the footnote mark list.
-% As \cs{gl@p} is difficult to use with dynamic name macro, we use \cs{let} commands.
+% As \protect\cs{gl@p} is difficult to use with dynamic name macro, we use \protect\cs{let} commands.
% \begin{macrocode}
\letcs{\@tmp}{footnote#1@mk}%
\gl@p\@tmp\to\@tmpa%
@@ -2189,13 +2240,13 @@
% \begin{macrocode}
\fi
% \end{macrocode}
-% End of \cs{newseries@par}.
+% End of \protect\cs{newseries@par}.
% \begin{macrocode}
}%
% \end{macrocode}
% \end{macro}
% \subsubsection{Create hooks}
-% Read the \macpackage code handbook about \cs{newhookcommand@series}.
+% Read the \macpackage code handbook about \protect\cs{newhookcommand@series}.
% Here, we create hooks which are specific to \parpackage.
% \begin{macrocode}
\unless\ifnocritical@%
@@ -2209,7 +2260,7 @@
% \end{macrocode}
% \subsubsection{Init standards series (A,B,C,D,E,Z)}
% \begin{macro}{\init@series@par}
-% \cs{newseries@par} is called by \cs{newseries}.
+% \protect\cs{newseries@par} is called by \protect\cs{newseries}.
% However, this last command is called before \parpackage is loaded.
% Thus, we need to initiate a specific series hook for \parpackage.
% \begin{macrocode}
@@ -2221,10 +2272,10 @@
% \end{macrocode}
% \end{macro}
% \section{Pstart numbers dumping and restoration}
-% While in \macpackage the footnotes are inserted in the same time as the \cs{pstart}\ldots\cs{pend} are read, in \parpackage they are inserted when the \cs{Columns} or \cs{Pages} commands are called.
+% While in \macpackage the footnotes are inserted in the same time as the \protect\cs{pstart}\ldots\protect\cs{pend} are read, in \parpackage they are inserted when the \protect\cs{Columns} or \protect\cs{Pages} commands are called.
% Consequently, if we do nothing, the value of the \verb+PstartL+ and \verb+PstartR+ counters are not the same in the main text and in the notes.
-% To solve this problem, we dump the values in two list (one by side) when processing \cs{pstart} and restore these at each \cs{pstart} when calling \cs{Columns} or \cs{Pages}.
-% We also dump and restore the value of the boolean \cs{ifnumberpstart}.
+% To solve this problem, we dump the values in two list (one by side) when processing \protect\cs{pstart} and restore these at each \protect\cs{pstart} when calling \protect\cs{Columns} or \protect\cs{Pages}.
+% We also dump and restore the value of the boolean \protect\cs{ifnumberpstart}.
% So, first step, creating the lists.
% Here, ``pc'' means ``public counters''.
@@ -2238,7 +2289,7 @@
% \end{macro}
% Two commands to dump current pstarts.
% We prefer two commands to one with argument indicating the side,
-% because the commands are short, and so we save one test (or a \cs{csname} construction).
+% because the commands are short, and so we save one test (or a \protect\cs{csname} construction).
% \begin{macro}{\dump@pstartL@pc}
% \begin{macro}{\dump@pstartR@pc}
% \begin{macrocode}
@@ -2296,16 +2347,16 @@
% \end{macrocode}
% \begin{macro}{\AtBeginPairs}
-% The \cs{AtBeginPairs} macro just define a \cs{at@begin@pairs} macro, called at the beginning of each \verb+pairs+ environments.
+% The \protect\cs{AtBeginPairs} macro just define a \protect\cs{at@begin@pairs} macro, called at the beginning of each \verb+pairs+ environments.
% \begin{macrocode}
\newcommand{\AtBeginPairs}[1]{\xdef\at@begin@pairs{#1}}%
\def\at@begin@pairs{}%
% \end{macrocode}
% \end{macro}
-% \changes{v2.0.0}{2015/07/19}{Deleting the old system of managing parallel chapter, keep only the new one with \cs{patchcmd}.}
+% \changes{v2.0.0}{2015/07/19}{Deleting the old system of managing parallel chapter, keep only the new one with \protect\cs{patchcmd}.}
% The \verb?pages? environment additionally sets the `column' widths to the
-% \cs{textwidth} (as known at the time the package is called). In this environment, there are two text in parallel on 2 pages.
+% \protect\cs{textwidth} (as known at the time the package is called). In this environment, there are two text in parallel on 2 pages.
% \begin{macrocode}
\newenvironment{pages}{%
\l@dpairingtrue
@@ -2326,7 +2377,7 @@
%
% \begin{macro}{ifinstanzaL}
% \begin{macro}{ifinstanzaR}
-% These boolean tests are switched by the \cs{stanza} command, using either the left or right side.
+% These boolean tests are switched by the \protect\cs{stanza} command, using either the left or right side.
% \begin{macrocode}
\newif\ifinstanzaL
\newif\ifinstanzaR
@@ -2365,8 +2416,8 @@
% \begin{macro}{\Rightsidehookend}
% Hooks into the start and end of the {Leftside} and {Rightside}
% environments. These are initially empty.
-% \changes{v0.3.0}{2005/02/10}{Added \cs{Leftsidehook}, \cs{Leftsidehookend},
-% \cs{Rightsidehook} and \cs{Rightsidehookend}}
+% \changes{v0.3.0}{2005/02/10}{Added \protect\cs{Leftsidehook}, \protect\cs{Leftsidehookend},
+% \protect\cs{Rightsidehook} and \protect\cs{Rightsidehookend}}
% \begin{macrocode}
\newcommand*{\Leftsidehook}{}
\newcommand*{\Leftsidehookend}{}
@@ -2427,8 +2478,8 @@
% line-list, and then at last send the line to the vertical list.
% This section contains all the code for this processing.
%
-% \subsection{Boxes, counters, \cs{pstart}
-% and \cs{pend}}
+% \subsection{Boxes, counters, \protect\cs{pstart}
+% and \protect\cs{pend}}
%
% \begin{macro}{\num@linesR}
% \begin{macro}{\one@lineR}
@@ -2437,14 +2488,14 @@
% of the paragraph decomposition.
%
% When we first form the paragraph, it goes into a box register,
-% \cs{l@dLcolrawbox} or \cs{l@dRcolrawbox} for right text, instead of onto the
+% \protect\cs{l@dLcolrawbox} or \protect\cs{l@dRcolrawbox} for right text, instead of onto the
% current vertical list.
-% The \cs{ifnumberedpar@} flag will be \verb"true" while a paragraph is
+% The \protect\cs{ifnumberedpar@} flag will be \verb"true" while a paragraph is
% being processed in that way.
-% \cs{num@lines(R)} will store the number of lines in the paragraph
+% \protect\cs{num@lines(R)} will store the number of lines in the paragraph
% when it is complete. When we chop it up into lines, each line
% in turn goes into the
-% \cs{one@line} or \cs{one@lineR} register, and \cs{par@line(R)}
+% \protect\cs{one@line} or \protect\cs{one@lineR} register, and \protect\cs{par@line(R)}
% will be the number
% of that line within the paragraph.
% \begin{macrocode}
@@ -2458,22 +2509,22 @@
%
% \begin{macro}{\pstartL}
% \begin{macro}{\pstartR}
-% \changes{v1.1.0}{2012/09/25}{Add \cs{labelpstarttrue} (from eledmac).}
-% \changes{v1.1.1}{2012/10/01}{Correct \cs{pstartR} bug introduced by 1.1.}
-% \changes{v1.4.3}{2013/10/27}{Spurious spaces in \cs{pstartL} and \cs{pstartR}.}
-% \changes{v1.8.0}{2014/08/05}{As in \Lpack{eledmac}, \cs{pendL} and \cs{pendR} can have an optional argument.}
-% \cs{pstart} starts the paragraph by
-% clearing the \cs{inserts@list} list and other
+% \changes{v1.1.0}{2012/09/25}{Add \protect\cs{labelpstarttrue} (from eledmac).}
+% \changes{v1.1.1}{2012/10/01}{Correct \protect\cs{pstartR} bug introduced by 1.1.}
+% \changes{v1.4.3}{2013/10/27}{Spurious spaces in \protect\cs{pstartL} and \protect\cs{pstartR}.}
+% \changes{v1.8.0}{2014/08/05}{As in \protect\package{eledmac}, \protect\cs{pendL} and \protect\cs{pendR} can have an optional argument.}
+% \protect\cs{pstart} starts the paragraph by
+% clearing the \protect\cs{inserts@list} list and other
% relevant variables, and then arranges for the
% subsequent text to go into the appropriate box.
-% \cs{pstart} needs to appear at the start of
+% \protect\cs{pstart} needs to appear at the start of
% every paragraph that is to be numbered.
%
-% Beware: everything that occurs between \cs{pstart} and \cs{pend}
+% Beware: everything that occurs between \protect\cs{pstart} and \protect\cs{pend}
% is happening within a group; definitions must be global if you want
% them to survive past the end of the paragraph.
%
-% We have to have specific left and right \cs{pstart} when parallel processing;
+% We have to have specific left and right \protect\cs{pstart} when parallel processing;
% among other things because of potential changes in the linewidth.
%
% \begin{macrocode}
@@ -2504,8 +2555,8 @@
\pend%
\fi%
% \end{macrocode}
-% If this is the first \cs{pstart} in a numbered section, clear any inserts
-% and set \cs{ifpst@rtedL} to FALSE.
+% If this is the first \protect\cs{pstart} in a numbered section, clear any inserts
+% and set \protect\cs{ifpst@rtedL} to FALSE.
% \begin{macrocode}
\ifpst@rtedL\else%
\list@clear{\inserts@list}%
@@ -2528,7 +2579,7 @@
% We set all the usual interline penalties to zero; this ensures that there will
% be no large interline penalties to prevent us from slicing the
% paragraph into pieces. These penalties revert to the values
-% that you set when the group for the \cs{vbox} ends.
+% that you set when the group for the \protect\cs{vbox} ends.
% \begin{macrocode}
\l@dzeropenalties%
\ifautopar\else%
@@ -2550,6 +2601,12 @@
{\csgdef{before@pstartL@\the\l@dnumpstartsL}{\at@every@pstart}}%
{\csgdef{before@pstartL@\the\l@dnumpstartsL}{\noindent#1}}%
\at@every@pstart@call%
+% \end{macrocode}
+% Gobble following space (automatically done if there is no optional argument)
+% \begin{macrocode}
+ \ignorespaces%
+% \end{macrocode}
+% \begin{macrocode}
}
% \end{macrocode}
% The same for right side.
@@ -2603,6 +2660,7 @@
{\csgdef{before@pstartR@\the\l@dnumpstartsR}{\at@every@pstart}}%
{\csgdef{before@pstartR@\the\l@dnumpstartsR}{\noindent#1}}%
\at@every@pstart@call%
+ \ignorespaces%
}
% \end{macrocode}
% \end{macro}
@@ -2610,9 +2668,9 @@
%
%
% \begin{macro}{\pendL}
-% \changes{v1.4.3}{2013/10/27}{Spurious spaces in \cs{pendL}.}
-% \changes{v1.8.0}{2014/08/05}{As in \Lpack{eledmac}, \cs{pendL} can have an optional argument.}
-% \cs{pend} must be used to end a numbered paragraph. Again we need
+% \changes{v1.4.3}{2013/10/27}{Spurious spaces in \protect\cs{pendL}.}
+% \changes{v1.8.0}{2014/08/05}{As in \protect\package{eledmac}, \protect\cs{pendL} can have an optional argument.}
+% \protect\cs{pend} must be used to end a numbered paragraph. Again we need
% a version
% that knows about left parallel texts.
%
@@ -2626,14 +2684,14 @@
\fi%
% \end{macrocode}
% We immediately
-% call \cs{endgraf} to end the paragraph; this ensures that there will
+% call \protect\cs{endgraf} to end the paragraph; this ensures that there will
% be no large interline penalties to prevent us from slicing the
% paragraph into pieces.
% \begin{macrocode}
\endgraf\global\num@lines=\prevgraf\egroup%
\global\par@line=0%
% \end{macrocode}
-% End the group that was begun in the \cs{pstart}.
+% End the group that was begun in the \protect\cs{pstart}.
% \begin{macrocode}
\endgroup%
\ignorespaces%
@@ -2654,9 +2712,9 @@
% \end{macro}
%
% \begin{macro}{\pendR}
-% \changes{v1.4.3}{2013/10/27}{Spurious spaces in \cs{pstartR}.}
-% \changes{v1.8.0}{2014/08/05}{As in \Lpack{eledmac}, \cs{pendR} can have an optional argument.}
-% The version of \cs{pend} needed for right texts.
+% \changes{v1.4.3}{2013/10/27}{Spurious spaces in \protect\cs{pstartR}.}
+% \changes{v1.8.0}{2014/08/05}{As in \protect\package{eledmac}, \protect\cs{pendR} can have an optional argument.}
+% The version of \protect\cs{pend} needed for right texts.
%
% \begin{macrocode}
\newcommandx*{\pendR}[1][1]{%
@@ -2686,8 +2744,8 @@
%
%
% \begin{macro}{\AtEveryPstartCall}
-% The \cs{AtEveryPstartCall} argument is called when the \cs{pstartL} or \cs{pstartR} is called.
-% That is different of \cs{AtEveryPstart} the argument of which is called when the \cs{pstart}s are printed.
+% The \protect\cs{AtEveryPstartCall} argument is called when the \protect\cs{pstartL} or \protect\cs{pstartR} is called.
+% That is different of \protect\cs{AtEveryPstart} the argument of which is called when the \protect\cs{pstart}s are printed.
% \begin{macrocode}
\newcommand{\AtEveryPstartCall}[1]{\gdef\at@every@pstart@call{#1}}%
\gdef\at@every@pstart@call{}%
@@ -2695,7 +2753,7 @@
% \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}.
+% Two booleans set to true, when the time is to print the last optional argument of a \protect\cs{pend}.
% \begin{macrocode}
\newif\ifprint@last@after@pendL%
\newif\ifprint@last@after@pendR%
@@ -2706,11 +2764,11 @@
%
% For parallel texts we have to be able to process left and right lines
% independently. For sequential text we happily use the
-% original \cs{do@line}. Otherwise \ldots
+% original \protect\cs{do@line}. Otherwise \ldots
%
% \begin{macro}{\l@dleftbox}
% \begin{macro}{\l@drightbox}
-% A line of left text will be put in the box \cs{l@dleftbox}, and analogously
+% A line of left text will be put in the box \protect\cs{l@dleftbox}, and analogously
% for a line of right text.
% \begin{macrocode}
\newbox\l@dleftbox
@@ -2753,14 +2811,14 @@
% \end{macro}
%
%
-% \changes{v0.11.0}{2012/06/11}{Change \cs{do@lineL} and \cs{do@lineR} to allow line numbering by pstart (like in eledmac 0.15).}
-% \changes{v1.8.0}{2014/08/05}{Change \cs{do@lineR} and \cs{do@lineR} to allow new sectioning commands.}
+% \changes{v0.11.0}{2012/06/11}{Change \protect\cs{do@lineL} and \protect\cs{do@lineR} to allow line numbering by pstart (like in eledmac 0.15).}
+% \changes{v1.8.0}{2014/08/05}{Change \protect\cs{do@lineR} and \protect\cs{do@lineR} to allow new sectioning commands.}
% \begin{macro}{\do@lineL}
% \changes{v1.8.1}{2014/08/07}{Fix a bug with critical notes a the begining of a page, (maybe added by v1.8.0) (?).}
-% The \cs{do@lineL} macro is called to
+% The \protect\cs{do@lineL} macro is called to
% do all the processing for a single line of left text.
-% \changes{v0.3.0}{2005/02/10}{Added \cs{do@lineLhook} to \cs{do@lineL}}
-% \changes{v0.3.0}{2005/02/10}{Simplified \cs{do@lineL} by using macros for
+% \changes{v0.3.0}{2005/02/10}{Added \protect\cs{do@lineLhook} to \protect\cs{do@lineL}}
+% \changes{v0.3.0}{2005/02/10}{Simplified \protect\cs{do@lineL} by using macros for
% some common code}
% \begin{macrocode}
\newcommand*{\do@lineL}{%
@@ -2805,7 +2863,7 @@
% \end{macro}
%
% \begin{macro}{\print@lineL}
-% \cs{print@lineL} is for lines without a sectioning command. See \macpackage definition of \cs{print@line} for handbook.
+% \protect\cs{print@lineL} is for lines without a sectioning command. See \macpackage definition of \protect\cs{print@line} for handbook.
% \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
% \begin{macrocode}
\def\print@lineL{%
@@ -2827,8 +2885,8 @@
% \end{macro}
% \begin{macro}{\print@eledsectionL}
% \changes{v1.12.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
-% \changes{v1.12.1}{2015/02/27}{Fixes bug with \LuaLaTeX\ RTL \cs{eledsection}.}
-% \cs{print@eledsectionL} is for line with macro code.
+% \changes{v1.12.1}{2015/02/27}{Fixes bug with \LuaLaTeX\ RTL \protect\cs{eledsection}.}
+% \protect\cs{print@eledsectionL} is for line with macro code.
% \begin{macrocode}
\def\print@eledsectionL{%%
\addtocounter{pstartL}{-1}%
@@ -2864,9 +2922,9 @@
% \begin{macro}{\dolineRhook}
% \begin{macro}{\doinsidelineLhook}
% \begin{macro}{\doinsidelineRhook}
-% \changes{v1.8.3}{2014/08/31}{Added \cs{dolineLhook}, \cs{dolineRhook}, \cs{doinsidelineLhook} and \cs{doinsidelineRhook}}
+% \changes{v1.8.3}{2014/08/31}{Added \protect\cs{dolineLhook}, \protect\cs{dolineRhook}, \protect\cs{doinsidelineLhook} and \protect\cs{doinsidelineRhook}}
% These high-level commands just redefine the low-level commands.
-% They have to be used be user, without \cs{makeatletter}.
+% They have to be used be user, without \protect\cs{makeatletter}.
% \begin{macrocode}
\newcommand*{\dolineLhook}[1]{\gdef\do@lineLhook{#1}}%
\newcommand*{\dolineRhook}[1]{\gdef\do@lineRhook{#1}}%
@@ -2878,13 +2936,13 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \changes{v0.3.0}{2005/02/10}{Added \cs{do@lineLhook} and \cs{do@lineRhook}}
-% \changes{v1.4.0}{2013/07/11}{Added \cs{do@insidelineLhook} and \cs{do@insidelineRhook}}
+% \changes{v0.3.0}{2005/02/10}{Added \protect\cs{do@lineLhook} and \protect\cs{do@lineRhook}}
+% \changes{v1.4.0}{2013/07/11}{Added \protect\cs{do@insidelineLhook} and \protect\cs{do@insidelineRhook}}
% \begin{macro}{\do@lineLhook}
% \begin{macro}{\do@lineRhook}
% \begin{macro}{\do@insidelineLhook}
% \begin{macro}{\do@insidelineRhook}
-% Hooks, initially empty, into the respective \cs{do@line(L/R)} macros.
+% Hooks, initially empty, into the respective \protect\cs{do@line(L/R)} macros.
% \begin{macrocode}
\newcommand*{\do@lineLhook}{}
\newcommand*{\do@lineRhook}{}
@@ -2897,9 +2955,9 @@
% \end{macro}
% \end{macro}
% \begin{macro}{\do@lineR}
-% The \cs{do@lineR} macro is called to
+% The \protect\cs{do@lineR} macro is called to
% do all the processing for a single line of right text.
-% \changes{v0.3.0}{2005/02/10}{Changed \cs{do@lineR} similarly to \cs{do@lineL}}
+% \changes{v0.3.0}{2005/02/10}{Changed \protect\cs{do@lineR} similarly to \protect\cs{do@lineL}}
% \changes{v1.8.1}{2014/08/07}{Fix a bug with critical notes a the begining of a page, added by v1.8.0 (?).}
% \begin{macrocode}
\newcommand*{\do@lineR}{%
@@ -2986,10 +3044,10 @@
\@eled@sectioningfalse%
\global\csundef{eled@sectioning@\the\l@dpscR R}%
\if@RTL%
- \hspace{-\paperwidth}%
+ \hspace{-3\paperwidth}%
{\hbox{\l@dunhbox@line{\one@lineR}} \new@lineR}%
\else%
- \hspace{\paperwidth}%
+ \hspace{3\paperwidth}%
{\new@lineR \hbox{\l@dunhbox@line{\one@lineR}}}%
\fi%
\vskip\eledsection@correcting@skip
@@ -3000,9 +3058,9 @@
% \subsection{Line and page number computation}
%
% \begin{macro}{\getline@numR}
-% The \cs{getline@numR} macro
+% The \protect\cs{getline@numR} macro
% determines the page and line numbers for the right text line we are about to
-% send to the vertical list. The \cs{getline@numL} is the same for left text.
+% send to the vertical list. The \protect\cs{getline@numL} is the same for left text.
%
% \begin{macrocode}
\newcommand*{\getline@numR}{%
@@ -3050,8 +3108,8 @@
%
% \begin{macro}{\do@ballastR}
% \relax
-% The real work in the line macros above is done in \cs{do@actions}, but
-% before we plunge into that, let is get \cs{do@ballastR} out of the
+% The real work in the line macros above is done in \protect\cs{do@actions}, but
+% before we plunge into that, let is get \protect\cs{do@ballastR} out of the
% way.
% \begin{macrocode}
\newcommand*{\do@ballastR}{\global\ballast@count=\z@
@@ -3072,13 +3130,13 @@
% \begin{macro}{\do@actions@fixedcodeR}
% \begin{macro}{\do@actions@nextR}
%
-% The \cs{do@actionsR} macro
+% The \protect\cs{do@actionsR} macro
% looks at the list of actions to take at particular right text absolute line
% numbers, and does everything that is specified for the current line.
%
% It may call itself recursively and we use tail recursion, via
-% \cs{do@actions@nextR} for this.
-% \changes{v0.3.0}{2005/02/24}{Used \cs{do@actions@fixedcode} in \cs{do@actionsR}}
+% \protect\cs{do@actions@nextR} for this.
+% \changes{v0.3.0}{2005/02/24}{Used \protect\cs{do@actions@fixedcode} in \protect\cs{do@actionsR}}
% \changes{v1.15.0}{2015/04/13}{Add action 1008 and 1009}
% \begin{macrocode}
@@ -3164,10 +3222,10 @@
% \begin{macro}{\ch@ck@l@ckR}
% \begin{macro}{\f@x@l@cksR}
% \begin{macro}{\affixline@numR}
-% \cs{affixline@numR} is the right text version of the
-% \cs{affixline@num} macro.
-% \changes{v0.3.0}{2005/02/24}{Changed \cs{affixline@numR} to match new eledmac}
-% \changes{v0.11.0}{2012/06/11}{Changed \cs{affixline@numR} to allow to disable line numbering (like in eledmac 0.15).}
+% \protect\cs{affixline@numR} is the right text version of the
+% \protect\cs{affixline@num} macro.
+% \changes{v0.3.0}{2005/02/24}{Changed \protect\cs{affixline@numR} to match new eledmac}
+% \changes{v0.11.0}{2012/06/11}{Changed \protect\cs{affixline@numR} to allow to disable line numbering (like in eledmac 0.15).}
% \begin{macrocode}
\newcommand*{\l@dcalcnum}[3]{%
@@ -3288,7 +3346,7 @@
% The printing of the pstart number is like in \macpackage, with two differences :
%\begin{itemize}
%\item Some commands have versions suffixed by R or L.
-%\item The \cs{affixpstart@num} and \cs{affixpstart@numR} commands are called in the \cs{Pages} command. Consequently, the \verb|pstartL| and \verb|pstartR| counters must be reset at the beginning of this command.
+%\item The \protect\cs{affixpstart@num} and \protect\cs{affixpstart@numR} commands are called in the \protect\cs{Pages} command. Consequently, the \verb|pstartL| and \verb|pstartR| counters must be reset at the beginning of this command.
%\end{itemize}
% \begin{macro}{\affixpstart@numL}
% \begin{macro}{\affixpstart@numR}
@@ -3375,7 +3433,7 @@
% \subsection{Add insertions to the vertical list}
%
% \begin{macro}{\inserts@listR}
-% \cs{inserts@listR} is the list macro that contains the inserts that
+% \protect\cs{inserts@listR} is the list macro that contains the inserts that
% we save up for one right text paragraph.
%
% \begin{macrocode}
@@ -3417,22 +3475,22 @@
%
% \begin{macro}{\add@penaltiesL}
% \begin{macro}{\add@penaltiesR}
-% \cs{add@penaltiesL} is
-% the last macro used by \cs{do@lineL}. It adds up the club,
+% \protect\cs{add@penaltiesL} is
+% the last macro used by \protect\cs{do@lineL}. It adds up the club,
% widow, and interline penalties, and puts a single penalty
% of the appropriate size
% back into the paragraph; these penalties get
-% removed by the \cs{vsplit} operation. \cs{displaywidowpenalty} and
-% \cs{brokenpenalty} are not restored, since we have no easy way to
+% removed by the \protect\cs{vsplit} operation. \protect\cs{displaywidowpenalty} and
+% \protect\cs{brokenpenalty} are not restored, since we have no easy way to
% find out where we should insert them.
%
% \label{add@penalties}
% In the code below, which is a virtual copy of the original
-% \cs{add@penalties}, \cs{num@lines} is the number of lines in the whole
-% paragraph, and \cs{par@line} is the line we are working on at the
-% moment. The count \cs{@l@dtempcnta} is used to calculate and
+% \protect\cs{add@penalties}, \protect\cs{num@lines} is the number of lines in the whole
+% paragraph, and \protect\cs{par@line} is the line we are working on at the
+% moment. The count \protect\cs{@l@dtempcnta} is used to calculate and
% accumulate the penalty; it is initially set to the value of
-% \cs{ballast@count}, which has been worked out in \cs{do@ballast}.
+% \protect\cs{ballast@count}, which has been worked out in \protect\cs{do@ballast}.
% Finally, the penalty is
% checked to see that it does not go below $-10000$.
% \begin{verbatim}
@@ -3477,7 +3535,7 @@
% \subsection{Printing leftover notes}
%
% \begin{macro}{\flush@notesR}
-% The \cs{flush@notesR}
+% The \protect\cs{flush@notesR}
% macro is called after the entire right text has been sliced up
% and sent on to the vertical list.
% \begin{macrocode}
@@ -3498,11 +3556,11 @@
%
% \subsection{Line number printing} \label{sec:nfootformat}
%
-% The \cs{printlinesR} macro prints the line
+% The \protect\cs{printlinesR} macro prints the line
% numbers for a note---which, in the
% general case, is a rather complicated task.
% The seven parameters of the
-% argument are the line numbers as stored in \cs{l@d@nums}, in the
+% argument are the line numbers as stored in \protect\cs{l@d@nums}, in the
% form described on \reff{reledmac-linenumbers} of \Eledmac{}' handbook: the starting
% page, line, and sub-line numbers, followed by the ending page,
% line, and sub-line numbers, and then the font specifier for
@@ -3510,13 +3568,13 @@
%
%
% \begin{macro}{\printlinesR}
-% This is the right text version of \cs{printlines} and takes account
-% of \cs{@Rlineflag}.
+% This is the right text version of \protect\cs{printlines} and takes account
+% of \protect\cs{@Rlineflag}.
% Just a reminder of the arguments: \\
% \verb?\printlinesR #1 | #2 | #3 | #4 | #5 | #6 | #7? \\
% \verb?\printlinesR start-page | line | subline | end-page | line | subline | font ?
-% \changes{v0.3.0}{2005/02/10}{Simplified \cs{printlinesR} by using
-% \cs{setprintlines}}
+% \changes{v0.3.0}{2005/02/10}{Simplified \protect\cs{printlinesR} by using
+% \protect\cs{setprintlines}}
% \begin{macrocode}
\def\printlinesR#1|#2|#3|#4|#5|#6|#7|{\begingroup
\setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
@@ -3533,17 +3591,17 @@
% \end{macrocode}
% \end{macro}
%
-% \subsection{Footnotes output specific to \cs{Pages}}
+% \subsection{Footnotes output specific to \protect\cs{Pages}}
% \begin{macro}{\print@Xnotes@forpages}
% \begin{macro}{\correct@Xfootins@box}
% \begin{macro}{\print@notesX@forpages}
% \begin{macro}{\correct@footinsX@box}
-% \changes{v1.13.1}{2015/03/12}{Correct \cs{correct@footinsX@box} and \cs{correct@Xfootins@box}}
-% \changes{v1.13.1}{2015/03/12}{Call \cs{correct@footinsX@box} and \cs{correct@Xfootins@box} directly in \cs{print@notesX@forpages} and \cs{print@Xnotes@forpages}.}
-% The \cs{Xonlyside} and \cs{onlysideX} hooks for \cs{Pages}
+% \changes{v1.13.1}{2015/03/12}{Correct \protect\cs{correct@footinsX@box} and \protect\cs{correct@Xfootins@box}}
+% \changes{v1.13.1}{2015/03/12}{Call \protect\cs{correct@footinsX@box} and \protect\cs{correct@Xfootins@box} directly in \protect\cs{print@notesX@forpages} and \protect\cs{print@Xnotes@forpages}.}
+% The \protect\cs{Xonlyside} and \protect\cs{onlysideX} hooks for \protect\cs{Pages}
% allow notes to be printed either in left or right pages only.
-% The implementation of such features is delegated to \cs{print@Xnotes@forpages},
-% which replaces \cs{print@Xnotes} inside \cs{Pages}.
+% The implementation of such features is delegated to \protect\cs{print@Xnotes@forpages},
+% which replaces \protect\cs{print@Xnotes} inside \protect\cs{Pages}.
% Here is how we proceed\footnote{See \url{http://tex.stackexchange.com/a/230332/7712}.}:
% \begin{itemize}
% \item If notes are to be printed in both sides, we just proceed the usual way: print the foot starts for the series, then the foot group.
@@ -3564,10 +3622,10 @@
% \item For the pages where notes must be NOT printed, we allow to every note box one line less than it ought to be.
% In our example, that means that we allow \TeX\ to add only $10-1=9$ line in the note box on p.~3.
% Before shifting to the pages where notes must be printed, we allow to every notes the expected number of lines. In our example, that means that we allow \TeX to add 10~lines in the note box on p.~4. As on p.~3 only 9 lines were allowed, that means note box of p.~4 will contain $9+1=10$ lines. So the ``one line too many'' problem is solved.
-% \item Still remains the ``glue'' problem. We solve it by recreating a clean note box. We split the one which is created by \TeX\ to get the next line printed. Then, we create the new box, by bringing together the first part and the last part of the split box, adding some skip between them. That is achieved by \cs{correct@Xfootins@box} (or \cs{correct@footinsX@box} for familiar notes).
+% \item Still remains the ``glue'' problem. We solve it by recreating a clean note box. We split the one which is created by \TeX\ to get the next line printed. Then, we create the new box, by bringing together the first part and the last part of the split box, adding some skip between them. That is achieved by \protect\cs{correct@Xfootins@box} (or \protect\cs{correct@footinsX@box} for familiar notes).
% \end{itemize}
% \end{itemize}
-% The code to print critical notes, when processing \cs{Pages}.
+% The code to print critical notes, when processing \protect\cs{Pages}.
% \begin{macrocode}
\newcommand\print@Xnotes@forpages[1]{%
% \end{macrocode}
@@ -3629,12 +3687,12 @@
\egroup%
% \end{macrocode}
% \begin{macrocode}
-% End of \cs{print@Xnotes@forpages}.
+% End of \protect\cs{print@Xnotes@forpages}.
}%
}%
}%
% \end{macrocode}
-% Now, \cs{correct@Xfootins@box}, to fix problem of last line being glued to the previous one.
+% Now, \protect\cs{correct@Xfootins@box}, to fix problem of last line being glued to the previous one.
% \begin{macrocode}
\newcommand{\correct@Xfootins@box}[1]{%
% \end{macrocode}
@@ -3716,7 +3774,7 @@
%
%
% \begin{macro}{\labelref@listR}
-% Set up a new list, \cs{labelref@listR}, to hold the page, line and
+% Set up a new list, \protect\cs{labelref@listR}, to hold the page, line and
% sub-line numbers for each label in right text.
% \begin{macrocode}
\list@create{\labelref@listR}
@@ -3727,13 +3785,13 @@
%
% \begin{macro}{\edlabel}
% This command is defined only one time in \macpackage, including features for \parpackage.
-% \changes{v1.12.0}{2015/02/23}{\cs{edlabel} is now defined only one time for both eledmac and eledpar}
-% \changes{v1.12.0}{2015/02/23}{\cs{edlabel} and \cs{edindex} works now with hyperref when using \Lpack{eledpar}.}
+% \changes{v1.12.0}{2015/02/23}{\protect\cs{edlabel} is now defined only one time for both eledmac and eledpar}
+% \changes{v1.12.0}{2015/02/23}{\protect\cs{edlabel} and \protect\cs{edindex} works now with hyperref when using \protect\package{eledpar}.}
% \end{macro}
%
% \begin{macro}{\l@dmake@labelsR}
-% This is the right text version of \cs{l@dmake@labels}, taking account
-% of \cs{@Rlineflag}.
+% This is the right text version of \protect\cs{l@dmake@labels}, taking account
+% of \protect\cs{@Rlineflag}.
%
% \begin{macrocode}
\def\l@dmake@labelsR#1|#2|#3|#4|#5{%
@@ -3751,14 +3809,14 @@
%
%
% \begin{macro}{\@lab}
-% The \cs{@lab} command, which appears in the \cs{linenum@out} file,
+% The \protect\cs{@lab} command, which appears in the \protect\cs{linenum@out} file,
% appends the current values of page, line and sub-line to the
-% \cs{labelref@list}. These values are defined by the earlier
-% \cs{@page}, \cs{@nl}, and the \cs{sub@on} and \cs{sub@off} commands
-% appearing in the \cs{linenum@out} file.
+% \protect\cs{labelref@list}. These values are defined by the earlier
+% \protect\cs{@page}, \protect\cs{@nl}, and the \protect\cs{sub@on} and \protect\cs{sub@off} commands
+% appearing in the \protect\cs{linenum@out} file.
%
% It is defined on \macpackage.
-% \changes{v2.0.0}{2015/28/06}{\cs{@lab} defined only in \eledmac.}
+% \changes{v2.0.0}{2015/28/06}{\protect\cs{@lab} defined only in \eledmac.}
% \end{macro}
%
%
@@ -3769,8 +3827,8 @@
% the text.
% \begin{macro}{\sidenote@marginR}
% \begin{macro}{\sidenotemargin*}
-% \changes{v1.8.0}{2014/08/05}{\cs{sidenotemargin} is now directly defined in \Lpack{eledmac} to be able to manage \Lpack{eledpar}.}
-% \changes{v1.8.0}{2014/08/05}{Add \cs{sidenotemargin*}}
+% \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.
% \begin{macrocode}
\WithSuffix\newcommand\sidenotemargin*[1]{%
@@ -3788,9 +3846,9 @@
% \changes{v1.3.3}{2012/12/19}{Debugging the left notes of the right column.}
% \changes{v1.3.4}{2013/07/03}{Allow use of commands in sidenotes, as introduced by eledmac 1.0.}
-% \changes{v1.8.0}{2014/08/05}{\cs{l@dlsnote},\cs{l@drsnote} and \cs{l@dcsnote} defined only one time, in \Lpack{eledmac}. }
+% \changes{v1.8.0}{2014/08/05}{\protect\cs{l@dlsnote},\protect\cs{l@drsnote} and \protect\cs{l@dcsnote} defined only one time, in \protect\package{eledmac}. }
% \begin{macro}{\affixside@noteR}
-% The right text version of \cs{affixside@note}.
+% The right text version of \protect\cs{affixside@note}.
% \changes{v1.1.2}{2012/10/06}{Remove spurious space between line number and line content}
% \begin{macrocode}
\newcommand*{\affixside@noteR}{%
@@ -3847,20 +3905,20 @@
%
%
% \begin{macro}{\l@dbfnote}
-% \cs{l@dbfnote} adds the footnote to the insert list, and
-% \cs{vl@dbfnote} calls the original \cs{@footnotetext}.
+% \protect\cs{l@dbfnote} adds the footnote to the insert list, and
+% \protect\cs{vl@dbfnote} calls the original \protect\cs{@footnotetext}.
% \changes{v1.3.1}{2012/11/16}{Compatibility of standard footnotes with eledmac when theses footnotes contain any commands.}
% \changes{v1.3.3}{2012/11/19}{Spurious space with footnote in right column.}
% There are both defined in \macpackage.
-% \changes{v2.0.0}{2015/07/19}{\cs{l@dbfnote} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{l@dbfnote} defined only in \reledmac.}
% \end{macro}
%
%
% \begin{macro}{\normalbfnoteX}
-% \changes{v0.3.0}{2005/02/04}{Removed extraneous spaces from \cs{normalbfnoteX}}
-% \changes{v1.3.5}{2013/07/10}{Allows one to redefine \cs{thefootnoteX} with \c{alph} when some packages are loaded.}
+% \changes{v0.3.0}{2005/02/04}{Removed extraneous spaces from \protect\cs{normalbfnoteX}}
+% \changes{v1.3.5}{2013/07/10}{Allows one to redefine \protect\cs{thefootnoteX} with \c{alph} when some packages are loaded.}
% \changes{v1.4.1}{2013/08/16}{Fix bug with normal familiar footnotes when mixing RTL and LTR text.}
-% \changes{v2.0.0}{2015/07/19}{\cs{normalbfnoteX} defined only in \reledmac.}
+% \changes{v2.0.0}{2015/07/19}{\protect\cs{normalbfnoteX} defined only in \reledmac.}
% \end{macro}
%
%
@@ -3868,8 +3926,8 @@
% \section{Verse}
%\changes{v0.11.0}{2012/06/11}{New management of hangingsymbol insertion, preventing undesirable insertions.}
%\changes{v0.12.0}{2012/08/03}{New management of hangingsymbol insertion, preventing undesirable insertions.}
-% Like in \macpackage, the insertion of hangingsymbol is base on \cs{ifinserthangingsymbol}, and, for the right side, on \cs{ifinserthangingsymbolR}.
-% Both commands also include the hanging space, to be sure the \cs{one@line} of hanging lines has the same width that the \cs{one@line} of normal lines and to prevent the column separator from shifting.
+% Like in \macpackage, the insertion of hangingsymbol is base on \protect\cs{ifinserthangingsymbol}, and, for the right side, on \protect\cs{ifinserthangingsymbolR}.
+% Both commands also include the hanging space, to be sure the \protect\cs{one@line} of hanging lines has the same width that the \protect\cs{one@line} of normal lines and to prevent the column separator from shifting.
% \begin{macro}{\inserthangingsymbolL}
% \begin{macro}{\inserthangingsymbolR}
% \changes{v0.11.0}{2012/06/11}{Prevent the column separator for hanging verse from shifting}
@@ -3914,7 +3972,7 @@
% \begin{environment}{astanza}
% \changes{v1.4.1}{2013/08/16}{Enable the use of stanzaindentsrepetition within astanza environment.}
% \changes{v1.13.0}{2015/03/06}{Enable the use of optional argument of \& in astanza environment.}
-% This is roughly an environmental form of \cs{stanza}, which treats
+% This is roughly an environmental form of \protect\cs{stanza}, which treats
% its stanza-like contents as a single chunk.
%
% \begin{macrocode}
@@ -3981,7 +4039,7 @@
%
% \section{Naming macros}
%
-% The \LaTeX\ kernel provides \cs{@namedef} and \cs{@namuse} for defining
+% The \LaTeX\ kernel provides \protect\cs{@namedef} and \protect\cs{@namuse} for defining
% and using macros that may have non-letters in their names. We need
% something similar here as we are going to need and use some numbered
% boxes and counters.
@@ -4028,8 +4086,8 @@
% \section{Fixing babel and polyglossia}
%
% With parallel texts there is the possibility that the two sides
-% might use different languages via \Lpack{babel}. On the other hand,
-% nor \Lpack{babel} nor \Lpack{polyglossia} might not be called at all (even though it might be already
+% might use different languages via \protect\package{babel}. On the other hand,
+% nor \protect\package{babel} nor \protect\package{polyglossia} might not be called at all (even though it might be already
% built into the format).
% \changes{v0.2.0}{2004/12/20}{Added section of babel related code}
%
@@ -4053,19 +4111,19 @@
% \end{macro}
% \end{macro}
%
-% \changes{v1.8.0}{2014/08/05}{Suppress \cs{ifl@dsamelang} which did not work and was not logical, because both columns could have the same language but not the main language of the document.}
+% \changes{v1.8.0}{2014/08/05}{Suppress \protect\cs{ifl@dsamelang} which did not work and was not logical, because both columns could have the same language but not the main language of the document.}
%
% \begin{macro}{\l@dchecklang}
-% \changes{v1.8.0}{2014/08/05}{Suppress \cs{l@dchecklang} which did not work and was not logical, because both columns could have the same language but not the main language of the document.}
+% \changes{v1.8.0}{2014/08/05}{Suppress \protect\cs{l@dchecklang} which did not work and was not logical, because both columns could have the same language but not the main language of the document.}
% \end{macro}
% \begin{macro}{\bbl@set@language}
-% In \Lpack{babel} the macro \cs{bbl@set@language}\marg{lang} does the work when
-% the language \meta{lang} is changed via \cs{selectlanguage}.
+% In \protect\package{babel} the macro \protect\cs{bbl@set@language}\marg{lang} does the work when
+% the language \meta{lang} is changed via \protect\cs{selectlanguage}.
% Unfortunately for us, if it is given
% an argument in the form of a control sequence it strips off the \verb?\?
% character rather than expanding the command. We need a version that accepts
-% an argument in the form \cs{lang} without it stripping the \verb?\?.
-% \changes{v2.0.0}{2015/07/19}{Patch \cs{bbl@set@language} instead of redefining it}
+% an argument in the form \protect\cs{lang} without it stripping the \verb?\?.
+% \changes{v2.0.0}{2015/07/19}{Patch \protect\cs{bbl@set@language} instead of redefining it}
% \begin{macrocode}
\patchcmd{\bbl@set@language}%
{\select@language{\languagename}}%
@@ -4077,16 +4135,16 @@
% \end{macro}
%
% The rest of the setup has to be postponed until the end of the preamble
-% when we know if \Lpack{babel} or \Lpack{polyglossia} have been used or not. However, for now assume
+% when we know if \protect\package{babel} or \protect\package{polyglossia} have been used or not. However, for now assume
% that it has not been used.
%
% \begin{macro}{\selectlanguage}
% \begin{macro}{\l@duselanguage}
% \begin{macro}{\theledlanguageL}
% \begin{macro}{\theledlanguageR}
-% \cs{selectlanguage} is a \verb?babel? command. \cs{theledlanguageL} and
-% \cs{theledlanguageR} are the names of the languages of the left and right
-% texts. \cs{l@duselanguage} is similar to \cs{selectlanguage}.
+% \protect\cs{selectlanguage} is a \verb?babel? command. \protect\cs{theledlanguageL} and
+% \protect\cs{theledlanguageR} are the names of the languages of the left and right
+% texts. \protect\cs{l@duselanguage} is similar to \protect\cs{selectlanguage}.
% \begin{macrocode}
\newcommand*{\l@duselanguage}[1]{}
\gdef\theledlanguageL{}
@@ -4094,20 +4152,20 @@
% \end{macrocode}
%
-% Now do the \Lpack{babel} or \Lpack{polyglossia} fix or, if necessary.
+% Now do the \protect\package{babel} or \protect\package{polyglossia} fix or, if necessary.
% \begin{macrocode}
\AtBeginDocument{%
\@ifundefined{xpg@main@language}{%
\@ifundefined{bbl@main@language}{%
% \end{macrocode}
-% Either \Lpack{babel} has not been used or it has been used with no
+% Either \protect\package{babel} has not been used or it has been used with no
% specified language.
% \begin{macrocode}
\l@dusedbabelfalse
}{%
% \end{macrocode}
-% Here we deal with the case where babel has been used. \cs{selectlanguage}
-% has to be redefined to use our version of \cs{bbl@set@language} and to
+% Here we deal with the case where babel has been used. \protect\cs{selectlanguage}
+% has to be redefined to use our version of \protect\cs{bbl@set@language} and to
% store the left or right language.
% \begin{macrocode}
\l@dusedbabeltrue
@@ -4119,13 +4177,13 @@
\else \gdef\theledlanguageL{#1}%
\fi}
% \end{macrocode}
-% \cs{l@duselanguage} simply calls the original \cs{selectlanguage} so
-% that \cs{theledlanguageL} and \cs{theledlanguageR} are unaltered.
+% \protect\cs{l@duselanguage} simply calls the original \protect\cs{selectlanguage} so
+% that \protect\cs{theledlanguageL} and \protect\cs{theledlanguageR} are unaltered.
% \begin{macrocode}
\renewcommand*{\l@duselanguage}[1]{%
\l@doldselectlanguage{#1}}
% \end{macrocode}
-% Lastly, initialise the left and right languages to the current \Lpack{babel}
+% Lastly, initialise the left and right languages to the current \protect\package{babel}
% one.
% \begin{macrocode}
\gdef\theledlanguageL{\bbl@main@language}%
@@ -4133,10 +4191,10 @@
}%
}
% \end{macrocode}
-% If use \Lpack{polyglossia}
+% If use \protect\package{polyglossia}
% \changes{v1.8.0}{2014/08/05}{Correct left/right language setting with polyglossia.}
% \changes{v1.9.0}{2014/09/16}{Debug left/right language switching with polyglossia. Do not write in .aux file when setting left/right lines.}
-% \changes{v2.0.0}{2015/07/19}{Patch \cs{otherlanguage} instead of redefining it.}
+% \changes{v2.0.0}{2015/07/19}{Patch \protect\cs{otherlanguage} instead of redefining it.}
% \begin{macrocode}
{ \let\old@otherlanguage\otherlanguage%
\renewcommand{\otherlanguage}[2][]{%
@@ -4160,8 +4218,8 @@
%
% \section{Counts and boxes for parallel texts}
%
-% In sequential text, each chunk (that enclosed by \cs{pstart} \ldots
-% \cs{pend}) is put into a box called \cs{raw@text} and then immediately
+% In sequential text, each chunk (that enclosed by \protect\cs{pstart} \ldots
+% \protect\cs{pend}) is put into a box called \protect\cs{raw@text} and then immediately
% printed, resulting in the box being emptied and ready for the next chunk.
% For parallel processing multiple boxes are needed as printing is delayed.
% We also need extra counters for various things.
@@ -4181,9 +4239,9 @@
%
% \begin{macro}{\l@dnumpstartsL}
% \begin{macro}{\l@dnumpstartsR}
-% The numbers of left and right chunks. \cs{l@dnumpstartsL} is defined
-% in \Lpack{eledmac}.
-% \changes{v0.3.0}{2005/02/24}{Moved \cs{l@dnumpstartsL} to eledmac}
+% The numbers of left and right chunks. \protect\cs{l@dnumpstartsL} is defined
+% in \protect\package{eledmac}.
+% \changes{v0.3.0}{2005/02/24}{Moved \protect\cs{l@dnumpstartsL} to eledmac}
% \begin{macrocode}
\newcount\l@dnumpstartsR
@@ -4203,8 +4261,8 @@
% \end{macro}
%
% \begin{macro}{\l@dsetuprawboxes}
-% This macro creates \cs{maxchunks} pairs of boxes for left and right
-% chunks. The boxes are called \cs{l@dLcolrawbox1}, \cs{l@dLcolrawbox2}, etc.
+% This macro creates \protect\cs{maxchunks} pairs of boxes for left and right
+% chunks. The boxes are called \protect\cs{l@dLcolrawbox1}, \protect\cs{l@dLcolrawbox2}, etc.
% \begin{macrocode}
\newcommand*{\l@dsetuprawboxes}{%
\@l@dtempcntb=\l@dc@maxchunks
@@ -4221,9 +4279,9 @@
% \begin{macro}{\l@dzeromaxlinecounts}
% To be able to synchronise left and right texts we need
% to know the maximum number of text lines there are in each pair of chunks.
-% \cs{l@dsetupmaxlinecounts} creates \cs{maxchunks} new counts
-% called \cs{l@dmaxlinesinpar1}, etc., and
-% \cs{l@dzeromaxlinecounts} zeroes all of them.
+% \protect\cs{l@dsetupmaxlinecounts} creates \protect\cs{maxchunks} new counts
+% called \protect\cs{l@dmaxlinesinpar1}, etc., and
+% \protect\cs{l@dzeromaxlinecounts} zeroes all of them.
% \begin{macrocode}
\newcommand*{\l@dsetupmaxlinecounts}{%
\@l@dtempcntb=\l@dc@maxchunks
@@ -4245,7 +4303,7 @@
% \end{macro}
%
% Make sure that all these are set up. This has to be done after the
-% user has had an opportunity to change \cs{maxchunks}.
+% user has had an opportunity to change \protect\cs{maxchunks}.
% \begin{macrocode}
\AtBeginDocument{%
\l@dsetuprawboxes
@@ -4262,7 +4320,7 @@
% \begin{macro}{\@pstartstrue}
% \begin{macro}{\@pstartsfalse}
% \begin{macro}{\check@pstarts}
-% \cs{check@pstarts} returns \cs{@pstartstrue} if there are any unprocessed
+% \protect\cs{check@pstarts} returns \protect\cs{@pstartstrue} if there are any unprocessed
% chunks.
% \begin{macrocode}
\newif\if@pstarts
@@ -4287,9 +4345,9 @@
% \begin{macro}{\araw@texttrue}
% \begin{macro}{\araw@textfalse}
% \begin{macro}{\checkraw@text}
-% \cs{checkraw@text} checks whether the current Left or Right box is
-% void or not. If one or other is not void it sets \cs{araw@texttrue},
-% otherwise both are void and it sets \cs{araw@textfalse}.
+% \protect\cs{checkraw@text} checks whether the current Left or Right box is
+% void or not. If one or other is not void it sets \protect\cs{araw@texttrue},
+% otherwise both are void and it sets \protect\cs{araw@textfalse}.
% \begin{macrocode}
\newif\ifaraw@text
\newcommand*{\checkraw@text}{%
@@ -4335,7 +4393,7 @@
%
% \begin{macro}{\@eledsectionL}
% \begin{macro}{\@eledsectionR}
-% The parbox \cs{@eledsectionL} and \cs{@eledsectionR} will keep the sections' title.
+% The parbox \protect\cs{@eledsectionL} and \protect\cs{@eledsectionR} will keep the sections' title.
% \begin{macrocode}
\newsavebox{\@eledsectionL}%
\newsavebox{\@eledsectionR}%
@@ -4343,12 +4401,12 @@
% \end{macro}
% \end{macro}
% \begin{macro}{\Columns}
-% \changes{v1.8.0}{2014/07/28}{Modify \cs{Columns} to enable to add section's title.}
-% The \cs{Columns} command results in the previous Left and
+% \changes{v1.8.0}{2014/07/28}{Modify \protect\cs{Columns} to enable to add section's title.}
+% The \protect\cs{Columns} command results in the previous Left and
% Right texts being typeset in matching columns. There should
% be equal numbers of chunks in the left and right texts.
%
-% \changes{v1.12.0}{2015/02/23}{Add \cs{l@dprintingcolumnstrue}}
+% \changes{v1.12.0}{2015/02/23}{Add \protect\cs{l@dprintingcolumnstrue}}
% \begin{macrocode}
\newcommand*{\Columns}{%
\ifl@dpairing%
@@ -4379,7 +4437,7 @@
\global\pstartnumtrue
\global\pstartnumRtrue
% \end{macrocode}
-% Increment \cs{l@dpscL} and \cs{l@dpscR} which here count
+% Increment \protect\cs{l@dpscL} and \protect\cs{l@dpscR} which here count
% the numbers of left and right chunks.
% Also restore the value of the public pstart counters.
% \begin{macrocode}
@@ -4388,16 +4446,16 @@
\restore@pstartL@pc%
\restore@pstartR@pc%
% \end{macrocode}
-% We print the optional argument of \cs{pstart} or the argument of \cs{AtEveryPstart}.
+% We print the optional argument of \protect\cs{pstart} or the argument of \protect\cs{AtEveryPstart}.
% \begin{macrocode}
\Columns@print@before@pstart%
% \end{macrocode}
% Check if there is text yet to be processed in at least one of
% the two current chunks, and also whether the left and right languages
% are the same
-% \changes{v0.2.0}{2004/12/20}{Added \cs{l@dchecklang} and \cs{l@duselanguage}
-% to \cs{Columns}}
-% \changes{v1.8.0}{2014/08/05}{Suppress \cs{l@dchecklang} from \cs{Columns}.}
+% \changes{v0.2.0}{2004/12/20}{Added \protect\cs{l@dchecklang} and \protect\cs{l@duselanguage}
+% to \protect\cs{Columns}}
+% \changes{v1.8.0}{2014/08/05}{Suppress \protect\cs{l@dchecklang} from \protect\cs{Columns}.}
% \begin{macrocode}
\checkraw@text
{ \loop\ifaraw@text
@@ -4484,10 +4542,10 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{\print@columnseparator}
-% \changes{v1.8.0}{2014/08/05}{Move some code of \cs{Columns} to \cs{print@columnseparator}.}
-% \cs{print@columnseparator} prints the column separator, with surrounding spaces (as the user has set them).
-% We use the \TeX\ \cs{ifdim} instead of \Lpack{etoolbox}
-% to avoid having \cs{hfill} in a \verb+{}+, which deletes some space (but not much).
+% \changes{v1.8.0}{2014/08/05}{Move some code of \protect\cs{Columns} to \protect\cs{print@columnseparator}.}
+% \protect\cs{print@columnseparator} prints the column separator, with surrounding spaces (as the user has set them).
+% We use the \TeX\ \protect\cs{ifdim} instead of \protect\package{etoolbox}
+% to avoid having \protect\cs{hfill} in a \verb+{}+, which deletes some space (but not much).
% \begin{macrocode}
\def\print@columnseparator{%
\ifdim\beforecolumnseparator<0pt%
@@ -4505,7 +4563,7 @@
%\end{macrocode}
% \end{macro}
% \begin{macro}{\checkpb@columns}
-% \cs{checkpb@columns} prevent or make pagebreaking in columns, depending of the use of \cs{ledpb} or \cs{lednopb}.
+% \protect\cs{checkpb@columns} prevent or make pagebreaking in columns, depending of the use of \protect\cs{ledpb} or \protect\cs{lednopb}.
% \begin{macrocode}
\newcommand{\checkpb@columns}{%
@@ -4534,8 +4592,8 @@
% \begin{macro}{\columnrulewidth}
% The separator between line pairs in parallel columns is in the form
% of a vertical rule extending a little below the baseline and with a height
-% slightly greater than the \cs{baselineskip}. The width of the rule
-% is \cs{columnrulewidth} (initially 0pt so the rule is invisible).
+% slightly greater than the \protect\cs{baselineskip}. The width of the rule
+% is \protect\cs{columnrulewidth} (initially 0pt so the rule is invisible).
% \begin{macrocode}
\newcommand*{\columnseparator}{%
\smash{\rule[-0.2\baselineskip]{\columnrulewidth}{1.05\baselineskip}}}
@@ -4547,8 +4605,8 @@
% \end{macro}
% \begin{macro}{\columnsposition}
% \begin{macro}{\columns@position}
-% The position of the \cs{Columns} in a page. Default value is R.
-% Stored in \cs{columns@position}.
+% The position of the \protect\cs{Columns} in a page. Default value is R.
+% Stored in \protect\cs{columns@position}.
% \begin{macrocode}
\newcommand*{\columnsposition}[1]{%
\xdef\columns@position{#1}%
@@ -4559,7 +4617,7 @@
% \end{macro}
% \begin{macro}{\beforecolumnseparator}
% \begin{macro}{\aftercolumnseparator}
-% \cs{beforecolumnseparator} and \cs{aftercolumnseparator} lengths are defined to \verb+-1pt+. If user changes them to a positive length, the lengths are used to define blank spaces before / after the column separator, instead of \cs{hfill}.
+% \protect\cs{beforecolumnseparator} and \protect\cs{aftercolumnseparator} lengths are defined to \verb+-1pt+. If user changes them to a positive length, the lengths are used to define blank spaces before / after the column separator, instead of \protect\cs{hfill}.
% \begin{macrocode}
\newlength{\beforecolumnseparator}%
\setlength{\beforecolumnseparator}{-2pt}%
@@ -4580,10 +4638,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{non-parallel}
+% The \protect\cs{setwidth…} macros are called in \protect\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.
+% The \protect\cs{setposition…} macros are called in \protect\cs{beginnumbering} in a \textbf{non- parallel} typesetting context to fix the position of the lines.
+% The \protect\cs{setnoteposition…} macros are called in \protect\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
@@ -4708,7 +4766,7 @@
%
% \begin{macro}{\Columns@print@before@pstart}
% \begin{macro}{\Columns@print@after@pend}
-% The \cs{Columns@print@before@pstart} and \cs{Columns@print@after@pend} print the content of the optional argument of \cs{pstart} / \cs{pend}. If this content is not empty, it also print the separator.
+% The \protect\cs{Columns@print@before@pstart} and \protect\cs{Columns@print@after@pend} print the content of the optional argument of \protect\cs{pstart} / \protect\cs{pend}. If this content is not empty, it also print the separator.
% \begin{macrocode}
\newcommand{\Columns@print@before@pstart}{%
\ifboolexpr{%
@@ -4778,17 +4836,17 @@
% \end{macro}
% \subsection{Main macro}
% \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 across two pages.}
-% \changes{v1.13.0}{2015/03/06}{When using shiftedpstarts option, a \cs{l@dleftbox} with a null height will advance the \cs{pagetotal} in any case.}
-% \changes{v1.13.1}{2015/03/12}{Prevent false empty page after \cs{Pages} (bug added in 1.13.0)}
-% The \cs{Pages} command results in the previous Left and
+% \changes{v1.8.0}{2014/07/28}{Modify \protect\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 \protect\cs{pend}.}
+% \changes{v1.10.0}{2015/01/12}{Debug wrong pages splitting when no optional argument is used in last \protect\cs{pend} (bug was added in v.1.8.3).}
+% \changes{v1.10.0}{2015/01/12}{Debug wrong parallel pages synchronization when an \protect\cs{edtext} falls across two pages.}
+% \changes{v1.13.0}{2015/03/06}{When using shiftedpstarts option, a \protect\cs{l@dleftbox} with a null height will advance the \protect\cs{pagetotal} in any case.}
+% \changes{v1.13.1}{2015/03/12}{Prevent false empty page after \protect\cs{Pages} (bug added in 1.13.0)}
+% The \protect\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.
%
-% \changes{v1.12.0}{2015/02/23}{Add \cs{l@dprintingpagestrue}}
+% \changes{v1.12.0}{2015/02/23}{Add \protect\cs{l@dprintingpagestrue}}
% \begin{macrocode}
\newcommand*{\Pages}{%
\ifl@dpairing%
@@ -4802,8 +4860,8 @@
\led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}%
\fi%
% \end{macrocode}
-% \changes{v1.13.0}{2015/03/06xx}{Prevent false overfull hboxes when using \cs{Pages} outside of pages environment.}
-% As \cs{Pages} must be called outside of the pages environment, we have to redefine the \cs{Lcolwidth} and \cs{Rcolwidth} lengths, to prevent false overfull hboxes.
+% \changes{v1.13.0}{2015/03/06xx}{Prevent false overfull hboxes when using \protect\cs{Pages} outside of pages environment.}
+% As \protect\cs{Pages} must be called outside of the pages environment, we have to redefine the \protect\cs{Lcolwidth} and \protect\cs{Rcolwidth} lengths, to prevent false overfull hboxes.
% \begin{macrocode}
\setlength{\Lcolwidth}{\textwidth}%
\setlength{\Rcolwidth}{\textwidth}%
@@ -4834,14 +4892,14 @@
\loop\if@pstarts%
% \end{macrocode}
% Loop over the number of chunks, incrementing the chunk counts
-% (\cs{l@dpscL}
-% and \cs{l@dpscR} are chunk (box) counts.)
+% (\protect\cs{l@dpscL}
+% and \protect\cs{l@dpscR} are chunk (box) counts.)
% \begin{macrocode}
\global\advance\l@dpscL \@ne%
\global\advance\l@dpscR \@ne%
% \end{macrocode}
% Calculate the maximum number of real text lines in the chunk pair,
-% storing the result in the relevant \cs{l@dmaxlinesinpar}.
+% storing the result in the relevant \protect\cs{l@dmaxlinesinpar}.
% \begin{macrocode}
\getlinesfromparlistL%
\getlinesfromparlistR%
@@ -4856,15 +4914,15 @@
\global\l@dpscR=\z@%
% \end{macrocode}
% Get the number of lines on the first pair of pages and store
-% the minimum in \cs{l@dminpagelines}.
+% the minimum in \protect\cs{l@dminpagelines}.
% \begin{macrocode}
\getlinesfrompagelistL%
\getlinesfrompagelistR%
\l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}%
{\l@dminpagelines}%
% \end{macrocode}
-% Now we start processing the left and right chunks (\cs{l@dpscL} and
-% \cs{l@dpscR} count the left and right chunks), starting with the first pair.
+% Now we start processing the left and right chunks (\protect\cs{l@dpscL} and
+% \protect\cs{l@dpscR} count the left and right chunks), starting with the first pair.
% \begin{macrocode}
\check@pstarts%
\if@pstarts%
@@ -4895,7 +4953,7 @@
% \end{macrocode}
% See if there is more that can be done for the left page and set up the
% left language.
-% \changes{v0.2.0}{2004/12/20}{Added \cs{l@duselanguage} to \cs{Pages}}
+% \changes{v0.2.0}{2004/12/20}{Added \protect\cs{l@duselanguage} to \protect\cs{Pages}}
% \begin{macrocode}
\checkpageL%
\l@duselanguage{\theledlanguageL}%
@@ -4903,7 +4961,7 @@
% \end{macrocode}
% Process the next (left) text line, adding it to the page.
% Eventually, adds the optional argument of pstart.
-% \changes{v0.3.0}{2005/02/10}{Added \cs{ledstrutL} to \cs{Pages}}
+% \changes{v0.3.0}{2005/02/10}{Added \protect\cs{ledstrutL} to \protect\cs{Pages}}
% \begin{macrocode}
\ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{}%
\csuse{before@pstartL@\the\l@dpscL}%
@@ -4914,24 +4972,25 @@
{}%
\advance\numpagelinesL \@ne%
% \end{macrocode}
-% When using shiftedpstarts option, a \cs{l@dleftbox} with a null height is not printed.
+% When using shiftedpstarts option, a \protect\cs{l@dleftbox} with a null height is not printed.
% That means we do not insert blank lines at the end of a left chunk lower than the corresponding right chunk.
-% However, a \cs{l@dleftbox} with a null height will advance the \cs{pagetotal} in any case.
-% Because if we do not do this, the \cs{checkpageL} could let \cs{ifl@pagefull} to false,
-% and consequently a \cs{@lopL} equal to 1000 could be written in the numbered file,
+% However, a \protect\cs{l@dleftbox} with a null height will advance the \protect\cs{pagetotal} in any case.
+% Because if we do not do this, the \protect\cs{checkpageL} could let \protect\cs{ifl@pagefull} to false,
+% and consequently a \protect\cs{@lopL} equal to 1000 could be written in the numbered file,
% even if all the lines actually needed for the current page have been printed.
% \l@dleftbox
% \begin{macrocode}
\ifshiftedpstarts%
- \ifdim\ht\l@dleftbox>0pt\hb@xt@%
- \hsize{\ledstrutL\unhbox\l@dleftbox}%
+ \ifdim\ht\l@dleftbox>0pt%
+ \parledgroup@correction@notespacing{L}%
+ \hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}%
\else%
\dimen0=\pagetotal%
\advance\dimen0 by \baselineskip%
\global\pagetotal=\dimen0%
\fi%
\else%
- \parledgroup@correction@notespacing{L}
+ \parledgroup@correction@notespacing{L}%
\hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}%
\fi%
% \end{macrocode}
@@ -4974,7 +5033,7 @@
\clearl@dleftpage }%
% \end{macrocode}
% Now do the same for the right text.
-% \changes{v0.3.0}{2005/02/10}{Added \cs{ledstrutR} to \cs{Pages}}
+% \changes{v0.3.0}{2005/02/10}{Added \protect\cs{ledstrutR} to \protect\cs{Pages}}
% \begin{macrocode}
\checkpageR%
\l@duselanguage{\theledlanguageR}%
@@ -4989,8 +5048,9 @@
{}%
\advance\numpagelinesR \@ne%
\ifshiftedpstarts%
- \ifdim\ht\l@drightbox>0pt\hb@xt@%
- \hsize{\ledstrutR\unhbox\l@drightbox}%
+ \ifdim\ht\l@drightbox>0pt%
+ \parledgroup@correction@notespacing{R}%
+ \hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}%
\else%
\dimen0=\pagetotal%
\advance\dimen0 by \baselineskip%
@@ -5025,7 +5085,7 @@
% \end{macrocode}
% More to do? If there is we have to get the number of lines for the next
% pair of pages before starting to output them.
-% \changes{v0.3.b}{2005/04/08}{Added \cs{l@dminpagelines} calculation
+% \changes{v0.3.b}{2005/04/08}{Added \protect\cs{l@dminpagelines} calculation
% for succeeding page pairs}
% \begin{macrocode}
\checkraw@text%
@@ -5065,7 +5125,7 @@
%
% \subsection{Ensure all notes be printed at the end of parallel pages}
% \begin{macro}{\finish@Pages@notes}
-% This macro ensures that all long notes are printed at the end of \cs{Pages} typesetting, and that there is no more long notes left for the next pages.
+% This macro ensures that all long notes are printed at the end of \protect\cs{Pages} typesetting, and that there is no more long notes left for the next pages.
% \begin{macrocode}
\newcommand{\finish@Pages@notes}{%
\def\do##1{%
@@ -5080,7 +5140,7 @@
\global\newnamebox{footins##1}
\fi
% \end{macrocode}
-% And now, add a \cs{newpage} if there is no more footnote to print.
+% And now, add a \protect\cs{newpage} if there is no more footnote to print.
% \begin{macrocode}
\ifvoid\csuse{##1footins}%
\ifvoid\csuse{footins##1}\else%
@@ -5100,7 +5160,7 @@
% \begin{macro}{\ledstrutL}
% \begin{macro}{\ledstrutR}
% Struts inserted into leftand right text lines.
-% \changes{v0.3.0}{2005/02/10}{Added \cs{ledtrutL} and \cs{ledstrutR}}
+% \changes{v0.3.0}{2005/02/10}{Added \protect\cs{ledtrutL} and \protect\cs{ledstrutR}}
% \begin{macrocode}
\newcommand*{\ledstrutL}{\strut}
\newcommand*{\ledstrutR}{\strut}
@@ -5113,35 +5173,42 @@
% \subsection{Page clearing}
% \begin{macro}{\cleartoevenpage}
% \begin{macro}{\cleartol@devenpage}
-% \cs{cleartoevenpage}, which is defined in the memoir class,
-% is like \cs{clear(double)page} except that we
+% \protect\cs{cleartoevenpage}, which is defined in the memoir class,
+% is like \protect\cs{clear(double)page} except that we
% end up on an even page.
-% \cs{cleartol@devenpage} is similar except that it first checks to see
+% \protect\cs{cleartol@devenpage} is similar except that it first checks to see
% if it is already on an empty page.
% \begin{macrocode}
\providecommand{\cleartoevenpage}[1][\@empty]{%
\clearpage
\ifodd\c@page\hbox{}#1\clearpage\fi}
+
\newcommand*{\cleartol@devenpage}{%
\ifdim\pagetotal<\topskip% on an empty page
\else
\clearpage
\fi
- \ifodd\c@page\hbox{}\clearpage\fi%
+ \ifodd\c@page%
+ \ifprevpgnotnumbered%
+ \addtocounter{par@page}{-1}%
+ \ifdef{\prevpgstyle}{\thispagestyle{\prevpgstyle}}{}%
+ \fi%
+ \hbox{}\clearpage%
+ \fi%
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\clearl@dleftpage}
% \begin{macro}{\clearl@drightpage}
-% \cs{clearl@dleftpage} and \cs{clearl@drightpage} get us onto
+% \protect\cs{clearl@dleftpage} and \protect\cs{clearl@drightpage} get us onto
% an odd and even page, respectively, checking that we end up on
% the subsquent page.
-% Both commands use \cs{newpage} and not \cs{clearpage}.
-% Because \cs{clearpage} prints all footnotes before the next page, even if it has to add new empty pages, while \cs{newpage} does not.
-% And as we want notes started in the left page continue in the right page and \emph{vice-versa}, we must use \cs{newpage} and not \cs{clearpage}
+% Both commands use \protect\cs{newpage} and not \protect\cs{clearpage}.
+% Because \protect\cs{clearpage} prints all footnotes before the next page, even if it has to add new empty pages, while \protect\cs{newpage} does not.
+% And as we want notes started in the left page continue in the right page and \emph{vice-versa}, we must use \protect\cs{newpage} and not \protect\cs{clearpage}
%
-% \changes{v1.13.0}{2015/03/06x}{Use \cs{newpage} instead of \cs{clearpage}.}
+% \changes{v1.13.0}{2015/03/06x}{Use \protect\cs{newpage} instead of \protect\cs{clearpage}.}
% \begin{macrocode}
\newcommand*{\clearl@dleftpage}{%
\ifdim\pagetotal=0pt\hbox{}\fi%
@@ -5170,10 +5237,10 @@
% \begin{macro}{\@cs@linesinparL}
% \begin{macro}{\getlinesfromparlistR}
% \begin{macro}{\@cs@linesinparR}
-% \cs{getlinesfromparlistL} gets the next entry from the
-% \cs{linesinpar@listL} and puts it into \cs{@cs@linesinparL}; if the
-% list is empty, it sets \cs{@cs@linesinparL} to 0. Similarly
-% for \cs{getlinesfromparlistR}.
+% \protect\cs{getlinesfromparlistL} gets the next entry from the
+% \protect\cs{linesinpar@listL} and puts it into \protect\cs{@cs@linesinparL}; if the
+% list is empty, it sets \protect\cs{@cs@linesinparL} to 0. Similarly
+% for \protect\cs{getlinesfromparlistR}.
% \begin{macrocode}
\newcommand*{\getlinesfromparlistL}{%
\ifx\linesinpar@listL\empty
@@ -5198,10 +5265,10 @@
% \begin{macro}{\@cs@linesonpageL}
% \begin{macro}{\getlinesfrompagelistR}
% \begin{macro}{\@cs@linesonpageR}
-% \cs{getlinesfrompagelistL} gets the next entry from the
-% \cs{linesonpage@listL} and puts it into \cs{@cs@linesonpageL}; if the
-% list is empty, it sets \cs{@cs@linesonpageL} to 1000. Similarly
-% for \cs{getlinesfrompagelistR}.
+% \protect\cs{getlinesfrompagelistL} gets the next entry from the
+% \protect\cs{linesonpage@listL} and puts it into \protect\cs{@cs@linesonpageL}; if the
+% list is empty, it sets \protect\cs{@cs@linesonpageL} to 1000. Similarly
+% for \protect\cs{getlinesfrompagelistR}.
% \begin{macrocode}
\newcommand*{\getlinesfrompagelistL}{%
\ifx\linesonpage@listL\empty
@@ -5225,7 +5292,7 @@
% \begin{macro}{\@writelinesonpageL}
% \begin{macro}{\@writelinesonpageR}
% These macros output the number of lines on a page to the section file
-% in the form of \cs{@lopL} or \cs{@lopR} macros.
+% in the form of \protect\cs{@lopL} or \protect\cs{@lopR} macros.
% \begin{macrocode}
\newcommand*{\@writelinesonpageL}[1]{%
\edef\next{\write\linenum@out{\string\@lopL{#1}}}%
@@ -5241,11 +5308,11 @@
%
% \begin{macro}{\l@dcalc@maxoftwo}
% \begin{macro}{\l@dcalc@minoftwo}
-% \cs{l@dcalc@maxoftwo}\marg{num}\marg{num}\marg{count} sets \meta{count}
+% \protect\cs{l@dcalc@maxoftwo}\marg{num}\marg{num}\marg{count} sets \meta{count}
% to the maximum of the two \meta{num}.
%
% Similarly
-% \cs{l@dcalc@minoftwo}\marg{num}\marg{num}\marg{count} sets \meta{count}
+% \protect\cs{l@dcalc@minoftwo}\marg{num}\marg{num}\marg{count} sets \meta{count}
% to the minimum of the two \meta{num}.
%
% \begin{macrocode}
@@ -5275,13 +5342,13 @@
% \begin{macro}{\l@dpagefullfalse}
% \begin{macro}{\checkpageL}
% \begin{macro}{\checkpageR}
-% \cs{checkpageL} tests if the space and lines already taken on the page by
+% \protect\cs{checkpageL} tests if the space and lines already taken on the page by
% text and footnotes is less than the constraints. If so, then
-% \cs{ifl@dpagefull} is set FALSE and \cs{ifl@dsamepage} is set TRUE.
+% \protect\cs{ifl@dpagefull} is set FALSE and \protect\cs{ifl@dsamepage} is set TRUE.
% If the page is spatially full
-% then \cs{ifl@dpagefull} is set TRUE and \cs{ifl@dsamepage} is set FALSE.
+% then \protect\cs{ifl@dpagefull} is set TRUE and \protect\cs{ifl@dsamepage} is set FALSE.
% If it is not spatially full but the maximum number of lines have been
-% output then both \cs{ifl@dpagefull} and \cs{ifl@dsamepage}
+% output then both \protect\cs{ifl@dpagefull} and \protect\cs{ifl@dsamepage}
% are set FALSE.
%
% \begin{macrocode}
@@ -5342,7 +5409,7 @@
% \end{macro}
% \begin{macro}{\checkpbL}
% \begin{macro}{\checkpbR}
-% \cs{checkpbL} and \cs{checkpbR} are called after each line is printed, and after the page is checked. These commands correct page breaks depending on \cs{ledpb} and \cs{lednopb}.
+% \protect\cs{checkpbL} and \protect\cs{checkpbR} are called after each line is printed, and after the page is checked. These commands correct page breaks depending on \protect\cs{ledpb} and \protect\cs{lednopb}.
% \begin{macrocode}
\newcommand{\checkpbL}{
\IfStrEq{\led@pb@setting}{after}{
@@ -5372,7 +5439,7 @@
% \end{macro}
% \begin{macro}{\checkverseL}
% \begin{macro}{\checkverseR}
-% \cs{checkverseL} and \cs{checkverseR} are called after each line is printed.
+% \protect\cs{checkverseL} and \protect\cs{checkverseR} are called after each line is printed.
% They prevent page break inside line of verse.
% \begin{macrocode}
\newcommand{\checkverseL}{
@@ -5404,9 +5471,9 @@
% \begin{macro}{\ledthegoal}
% \begin{macro}{\goalfraction}
% \begin{macro}{\check@goal}
-% \cs{ledthegoal} is the amount of space allowed to taken by text and
+% \protect\cs{ledthegoal} is the amount of space allowed to taken by text and
% footnotes on a page before a forced pagebreak. This can be controlled via
-% \cs{@goalfraction}. \cs{ledthegoal} is calculated via \cs{check@goal}.
+% \protect\cs{@goalfraction}. \protect\cs{ledthegoal} is calculated via \protect\cs{check@goal}.
% \begin{macrocode}
\newdimen\ledthegoal
\ifshiftedpstarts
@@ -5441,7 +5508,7 @@
% \subsection{Getting boxes content}
% \begin{macro}{\get@nextboxL}
% \begin{macro}{\get@nextboxR}
-% \changes{v0.11.0}{2012/06/11}{Change \cs{get@nextboxL} and \cs{get@nextboxR} to allow to disable line numbering (like in eledmac 0.15).}
+% \changes{v0.11.0}{2012/06/11}{Change \protect\cs{get@nextboxL} and \protect\cs{get@nextboxR} to allow to disable line numbering (like in eledmac 0.15).}
% If the current box is not empty (i.e., still contains some lines)
% nothing is done. Otherwise if and only if a synchronisation point is
% reached the next box is started.
@@ -5479,14 +5546,14 @@
% \end{macrocode}
% \changes{v0.11.0}{2012/06/11}{Pstart number can be printed in side}
% There are still unprocessed boxes. Recalculate the maximum number of
-% lines needed, and move onto the next box (by incrementing \cs{l@dpscL}). If needed, restart the line numbering.
+% lines needed, and move onto the next box (by incrementing \protect\cs{l@dpscL}). If needed, restart the line numbering.
% \begin{macrocode}
\writtenlinesLfalse
\ifbypstart@
\global\line@num=0%
\resetprevline@%
\fi
-% Add the content of the optional argument of the previous \cs{pend}.
+% Add the content of the optional argument of the previous \protect\cs{pend}.
% \begin{macrocode}
\csuse{after@pendL@\the\l@dpscL}%
\global\csundef{after@pendL@\the\l@dpscL}%
@@ -5557,54 +5624,87 @@
% \end{macro}
% \end{macro}
%
-% \subsection{Same page number in both side}
-% The \verb+sameparallelpagenumber+ allow to have the same page number for the left and the right side
-% We can not do it by changing the value of the \verb|page| counter, since its value is used by many \LaTeX's features to determine whether a page is left or right: left page are even, right page are odd.
-% Consequently, we have to do it by patching \cs{thepage}, in order to use the value of the \verb+sameparallelpage@number+ counter instead of value of \verb+page+ counter.
+% \section{Page numbering}
+% The \verb+sameparallelpagenumber+ option allows the same page number on both left and right side
+% The \verb+prevpgnotnumbered+ option allows an empty (not numbered) right-side page before \cs{Pages}.
+%
+%
+% We cannot implement these two options by changing the value of the \verb|page| counter, since its value is used by many \LaTeX features to determine whether a page is left (even-numbered) or right (odd-numbered).
+% Consequently, we have to do it by patching \cs{thepage}, in order to use the value of the \verb+par@page+ counter instead of value of \verb+page+ counter.
%
-% This counter will be increased in a patched version of the \LaTeX's \cs{@outputpage} macro, as is the \verb+page+ counter in this macro. However, \cs{sameparallelpage@number} will be increased only one page on two when processing \cs{Pages}.
+% This counter will be increased in a patched version of the \LaTeX's \protect\cs{@outputpage} macro, as is the \verb+page+ counter in this macro. However, this increase will take account of the options.
%
%
% \begin{macro}{\par@patch@thepage}
-
-% \cs{par@patch@thepage} patches \cs{thepage} in order to use the value of \verb+sameparallelpage@number+ counter and not the value of \verb+sameparallelpage@number+. It must be called after any redefinition of \cs{thepage}. That why we insert it at the end of the \LaTeX macro \cs{pagenumbering}, which is called by some \cs{xxxmatter} commands. We also call it at the begin of the document.
+% \begin{macro}{\par@patch@pagenumbering}
+% \cs{par@patch@thepage} patches \cs{thepage} in order to use the value of \verb+par@page+ counter and not the value of \verb+par@page+.
+% It must be called after any redefinition of \cs{thepage}.
+% That why we insert it at the end of the \LaTeX macro \cs{pagenumbering}, which is called by some \cs{xxxmatter} commands.
+% In the case of \ltxclass{memoir} class using, we insert it at the end of \cs{@mempnum}.
+% When using \cs{pagenumbering}, we also need to restart \verb+par@page+ counter. Consequently, we have wrapped \cs{par@patch@thepage} and counter restart in \cs{par@patch@pagenumbering}
+% We also call \cs{par@patch@thepage} it at the beginning of the document.
% \begin{macrocode}
+
\newcommand{\par@patch@thepage}{%
- \ifsameparallelpagenumber%
+ \ifboolexpr{%
+ bool{sameparallelpagenumber}%
+ or bool{prevpgnotnumbered}%
+ }%
+ {%
\patchcmd{\thepage}%
- {page}{sameparallelpage@number}%
+ {page}{par@page}%
{}%
{\led@error@fail@patch@thepage}%
- \fi%
+ }{}%
}%
-\apptocmd{\pagenumbering}{%
+
+\newcommand{\par@patch@pagenumbering}{%
+ \ifboolexpr{%
+ bool{sameparallelpagenumber}%
+ or bool{prevpgnotnumbered}%
+ }%
+ {%
+ \setcounter{par@page}{1}%
+ }%
+ {}%
\par@patch@thepage%
- }%
- {}%
- {\led@error@fail@patch@pagenumbering}%
+}%
-\AtBeginDocument{\par@patch@thepage}%
+\ifl@dmemoir%
+ \apptocmd{\@mempnum}%
+ {\par@patch@pagenumbering}%
+ {}%%
+ {\led@error@fail@patch@@mempnum}%
+\else%
+ \apptocmd{\pagenumbering}%
+ {\par@patch@pagenumbering}%
+ {}%
+ {\led@error@fail@patch@pagenumbering}%
+\fi%
+
+\AtBeginDocument{\par@patch@thepage}%
% \end{macrocode}
% \end{macro}
+% \end{macro}
% \begin{macro}{\@outputpage}
-% As its names said, \cs{@outputpage} is a \LaTeX's macro called in the output routine. That is this macro which increase the \verb+page+ counter.
-% We patch it in order to increase, conditionally, the \verb+sameparallelpage@number+ counter.
+% As its name says, \cs{@outputpage} is a \LaTeX's macro called in the output routine. It is this macro which increases the \verb+page+ counter..
+% We patch it in order to increase, conditionally, the \verb+par@page+ counter.
% \begin{macrocode}
\AtBeginDocument{%
\apptocmd{\@outputpage}{%
\ifsameparallelpagenumber%
\ifl@dprintingpages%
\ifodd\c@page\else%
- \stepcounter{sameparallelpage@number}%
+ \stepcounter{par@page}%
\fi%
\else%
- \stepcounter{sameparallelpage@number}%
+ \stepcounter{par@page}%
\fi%
\else%
- \stepcounter{sameparallelpage@number}%
+ \stepcounter{par@page}%
\fi%
}%
{}%
@@ -5613,18 +5713,18 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\thesameparallelpage@number}
-% And now, initialize \verb+sameparallelpage@number+ counter.
+% \begin{macro}{\thepar@page}
+% And now, initialize \verb+par@page+ counter.
% \begin{macrocode}
-\newcounter{sameparallelpage@number}%
-\setcounter{sameparallelpage@number}{1}%
+\newcounter{par@page}%
+\setcounter{par@page}{1}%
% \end{macrocode}
% \end{macro}
% \section{Sections' titles' commands}
% As switching from left to right pages does not clear the page since v1.13.0,
% but only creates new pages, no \verb+\vbox{}+ is inserted, and consequently parallel chapters are mis-aligned.
%
-% So we patch the \cs{chapter} command in order to prevent this problem.
+% So we patch the \protect\cs{chapter} command in order to prevent this problem.
% \begin{macro}{\chapter}
% \begin{macrocode}
\pretocmd{\chapter}{%
@@ -5637,27 +5737,27 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{\eledsectnotoc}
-% \cs{eledsectnotoc} just saves its content \cs{@eledsectnotoc}, which will be tested where sectioning commands will be printed.
+% \protect\cs{eledsectnotoc} just saves its content \protect\cs{@eledsectnotoc}, which will be tested where sectioning commands will be printed.
% \begin{macrocode}
\newcommand{\eledsectnotoc}[1]{\xdef\@eledsectnotoc{#1}}
\eledsectnotoc{R}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\eledsectmark}
-% \cs{eledsectmark} just saves its content \cs{@eledsectmark}, which will be tested where sectioning commands will be printed.
+% \protect\cs{eledsectmark} just saves its content \protect\cs{@eledsectmark}, which will be tested where sectioning commands will be printed.
% \begin{macrocode}
\newcommand{\eledsectmark}[1]{\xdef\@eledsectmark{#1}}
\eledsectmark{L}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\eledsection@correcting@skip}
-% Because the vertical correction needed after inserting a title in parallel depends whether we are in parallel columns or parallel pages, we stock its length in \cs{eledsection@correcting@skip}.
+% Because the vertical correction needed after inserting a title in parallel depends whether we are in parallel columns or parallel pages, we stock its length in \protect\cs{eledsection@correcting@skip}.
% \begin{macrocode}
\newskip\eledsection@correcting@skip
% \end{macrocode}
% \end{macro}
% \begin{macro}{\eled@sectioningR@out}
-% We save the sectioning commands of the right side in the \cs{eled@sectioningR@out} file.
+% We save the sectioning commands of the right side in the \protect\cs{eled@sectioningR@out} file.
% \begin{macrocode}
\newwrite\eled@sectioningR@out
% \end{macrocode}
@@ -5666,8 +5766,8 @@
% We need to adapt the macro of the homonym section of eledmac to eledpar.
% \begin{macro}{\prev@pbR}
% \begin{macro}{\prev@nopbR}
-% The \cs{l@prev@pbR} macro is a \Lpack{etoolbox}'s list, which contains the lines in which page breaks occur (before or after).
-% The \cs{l@prev@nopbR} macro is a \Lpack{etoolbox} list, which contains the lines in which NO page breaks occur (before or after).
+% The \protect\cs{l@prev@pbR} macro is a \protect\package{etoolbox}'s list, which contains the lines in which page breaks occur (before or after).
+% The \protect\cs{l@prev@nopbR} macro is a \protect\package{etoolbox} list, which contains the lines in which NO page breaks occur (before or after).
% \begin{macrocode}
\def\l@prev@pbR{}
\def\l@prev@nopbR{}
@@ -5678,10 +5778,10 @@
% \begin{macro}{\ledpbnumR}
% \begin{macro}{\lednopbnum}
% \begin{macro}{\lednopbnumR}
-% The \cs{ledpbR} macro writes the call to \cs{led@pbR} in line-list file.
-% The \cs{ledpbnumR} macro writes the call to \cs{led@pbnumR} in line-list file.
-% The \cs{lednopbR} macro writes the call to \cs{led@nopbR} in line-list file.
-% The \cs{lednopbnumR} macro writes the call to \cs{led@nopbnumR} in line-list file.
+% The \protect\cs{ledpbR} macro writes the call to \protect\cs{led@pbR} in line-list file.
+% The \protect\cs{ledpbnumR} macro writes the call to \protect\cs{led@pbnumR} in line-list file.
+% The \protect\cs{lednopbR} macro writes the call to \protect\cs{led@nopbR} in line-list file.
+% The \protect\cs{lednopbnumR} macro writes the call to \protect\cs{led@nopbnumR} in line-list file.
% \begin{macrocode}
\newcommand{\ledpbR}{\write\linenum@outR{\string\led@pbR}}
\newcommand{\ledpbnumR}[1]{\write\linenum@outR{\string\led@pbnumR{#1}}}
@@ -5696,10 +5796,10 @@
% \begin{macro}{\led@pbnumR}
% \begin{macro}{\led@nopbR}
% \begin{macro}{\led@nopbnumR}
-% The \cs{led@pbR} add the absolute line number in the \cs{prev@pbR} list.
-% The \cs{led@pbnumR} add the argument in the \cs{prev@pbR} list.
-% 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.
+% The \protect\cs{led@pbR} add the absolute line number in the \protect\cs{prev@pbR} list.
+% The \protect\cs{led@pbnumR} add the argument in the \protect\cs{prev@pbR} list.
+% The \protect\cs{led@nopbR} add the absolute line number in the \protect\cs{prev@nopbR} list.
+% The \protect\cs{led@nopbnumR} add the argument in the \protect\cs{prev@nopbR} list.
% \begin{macrocode}
\newcommand{\led@pbR}{\listxadd{\l@prev@pbR}{\the\absline@numR}}
\newcommand{\led@pbnumR}[1]{\listxadd{\l@prev@pbR}{#1}}
@@ -5714,9 +5814,9 @@
% \begin{macro}{\parledgroup@}
% \begin{macro}{\parledgroupseries@}
% \begin{macro}{\parledgrouptype@}
-% The marks \cs{parledgroup@} contains information about the beginnings and endings of notes in a parallel ledgroup.
-% \cs{parledgroup@series} contains the footnote series.
-% \cs{parledgroup@type} contains the type of the footnote: critical (Xfootnote) or familiar (footnoteX).
+% The marks \protect\cs{parledgroup@} contains information about the beginnings and endings of notes in a parallel ledgroup.
+% \protect\cs{parledgroup@series} contains the footnote series.
+% \protect\cs{parledgroup@type} contains the type of the footnote: critical (Xfootnote) or familiar (footnoteX).
% \begin{macrocode}
\newmarks\parledgroup@
\newmarks\parledgroup@series
@@ -5727,7 +5827,7 @@
% \end{macro}
% \begin{macro}{\parledgroup@notes@startL}
% \begin{macro}{\parledgroup@notes@startR}
-% \cs{parledgroup@notes@startL} and \cs{parledgroup@notes@startR} are used to mark the beginning of a note series in a parallel ledgroup.
+% \protect\cs{parledgroup@notes@startL} and \protect\cs{parledgroup@notes@startR} are used to mark the beginning of a note series in a parallel ledgroup.
% \begin{macrocode}
\newcommand{\parledgroup@notes@startL}{%
\ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>0%
@@ -5750,7 +5850,7 @@
% \end{macro}
% \begin{macro}{\parledgroup@notes@startL}
% \begin{macro}{\parledgroup@notes@startR}
-% \cs{parledgroup@notes@endL} and \cs{parledgroup@notes@endR} are used to mark the end of a note series in a parallel ledgroup.
+% \protect\cs{parledgroup@notes@endL} and \protect\cs{parledgroup@notes@endR} are used to mark the end of a note series in a parallel ledgroup.
% \begin{macrocode}
\newcommand{\parledgroup@notes@endL}{%
\global\ledgroupnotesL@false%
@@ -5762,8 +5862,8 @@
% \end{macro}
% \end{macro}
% \begin{macro}{\insert@noterule@ledgroup}
-% A \cs{vskip} is not used when the boxes are constructed. So we insert it before ledgroup note series when parallel lines are constructed.
-% This is the goal of \cs{insert@noterule@ledgroup}
+% A \protect\cs{vskip} is not used when the boxes are constructed. So we insert it before ledgroup note series when parallel lines are constructed.
+% This is the goal of \protect\cs{insert@noterule@ledgroup}
% \begin{macrocode}
\newcommand{\insert@noterule@ledgroup}[1]{
\IfStrEq{\splitbotmarks\parledgroup@}{begin}{%
@@ -5787,7 +5887,7 @@
% \end{macro}
%
% \begin{macro}{\@parledgroupnotespacing}
-% \cs{@parledgroupnotespacing} can be redefined by the user to change the interline spacing of ledgroup notes.
+% \protect\cs{@parledgroupnotespacing} can be redefined by the user to change the interline spacing of ledgroup notes.
% \begin{macrocode}
\newcommand{\setparledgroupnotespacing}[1]{\gdef\@parledgroupnotespacing{#1}}
\newcommand{\@parledgroupnotespacing}{}
@@ -5795,7 +5895,7 @@
% \end{macro}
% \begin{macro}{\parledgroup@notespacing@correction}
% \begin{macro}{\parledgroup@notespacing@set@correction}
-% \cs{parledgroup@notespacing@correction} is the difference between a normal line skip and a line skip in a note. It is set by \cs{parledgroup@notespacing@set@correction}, called at the beginning of \cs{Pages}.
+% \protect\cs{parledgroup@notespacing@correction} is the difference between a normal line skip and a line skip in a note. It is set by \protect\cs{parledgroup@notespacing@set@correction}, called at the beginning of \protect\cs{Pages}.
% \begin{macrocode}
\dimdef{\parledgroup@notespacing@correction}{0pt}
\newcommand{\parledgroup@notespacing@set@correction}{%
@@ -5807,7 +5907,7 @@
% \end{macro}
% \end{macro}
% \begin{macro}{\parledgroup@correction@notespacing@init}
-% \cs{parledgroup@correction@notespacing@init} sets the value of accumulated corrections of note spacing to 0~pt.
+% \protect\cs{parledgroup@correction@notespacing@init} sets the value of accumulated corrections of note spacing to 0~pt.
% It is called at the beginning of each pages AND at the end of each ledgroup.
% \begin{macrocode}
\newcommand{\parledgroup@correction@notespacing@init}{
@@ -5818,7 +5918,7 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{\parledgroup@correction@notespacing@final}
-% \cs{parledgroup@correction@notespacing@final} adds the total space deleted because of correction for notes, in a parallel ledgroup.
+% \protect\cs{parledgroup@correction@notespacing@final} adds the total space deleted because of correction for notes, in a parallel ledgroup.
% It also adds the space needed by the other side spaces between note rules and notes. It is called after the print of each pstart/pend.
% \begin{macrocode}
\newcommand{\parledgroup@correction@notespacing@final}[1]{
@@ -5843,12 +5943,12 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{\parledgroup@correction@notespacing}
-% \cs{parledgroup@correction@notespacing} is used before each printed line.
-% If it is a line of notes in parallel ledgroup, the space \cs{parledgroup@notespacing@correction} is decreased, to make interline space correct.
-% The decreased space is added to \cs{parledgroup@notespacing@correction@accumulated} and \cs{parledgroup@notespacing@correction@modulo}.
-% If \cs{parledgroup@notespacing@correction@modulo} is equal or greater than \cs{baselineskip}:
+% \protect\cs{parledgroup@correction@notespacing} is used before each printed line.
+% If it is a line of notes in parallel ledgroup, the space \protect\cs{parledgroup@notespacing@correction} is decreased, to make interline space correct.
+% The decreased space is added to \protect\cs{parledgroup@notespacing@correction@accumulated} and \protect\cs{parledgroup@notespacing@correction@modulo}.
+% If \protect\cs{parledgroup@notespacing@correction@modulo} is equal or greater than \protect\cs{baselineskip}:
% \begin{itemize}
-% \item It is decreased by \cs{baselineskip}.
+% \item It is decreased by \protect\cs{baselineskip}.
% \item The total of line number in the current page is decreased by one.
% \end{itemize}
% For example, suppose an normal interline of 24~pt and interline for note of 12~pt.
@@ -5868,7 +5968,7 @@
% \end{macro}
% \begin{macro}{\parledgroup@beforenotesL}
% \begin{macro}{\parledgroup@beforenotesR}
-% \cs{parledgroup@beforenotesL} and \cs{parledgroup@beforenotesR} store the total of space before notes in the current parallel ledgroup.
+% \protect\cs{parledgroup@beforenotesL} and \protect\cs{parledgroup@beforenotesR} store the total of space before notes in the current parallel ledgroup.
% \begin{macrocode}
\dimdef\parledgroup@beforenotesL{0pt}
\dimdef\parledgroup@beforenotesR{0pt}
@@ -5876,7 +5976,7 @@
% \end{macro}
% \end{macro}
% \begin{macro}{\parledgroup@beforenotes@save}
-% The macro \cs{parledgroup@beforenotes@save} dumps the space before notes of the current parallel ledgroup in a macro named with the current pstart number.
+% The macro \protect\cs{parledgroup@beforenotes@save} dumps the space before notes of the current parallel ledgroup in a macro named with the current pstart number.
% \begin{macrocode}
\newcommand{\parledgroup@beforenotes@save}[1]{
\ifparledgroup
@@ -5928,15 +6028,15 @@
%
% \bibitem[Wil02]{MEMOIR}
% Peter Wilson.
-% \newblock \emph{The \Lpack{memoir} class for configurable typesetting}.
+% \newblock \emph{The \protect\package{memoir} class for configurable typesetting}.
% \newblock November 2002.
% \newblock (Available from CTAN in
% \texttt{macros/latex/contrib/memoir})
%
% \bibitem[Wil04]{ELEDMAC}
% Peter Wilson and Maïeul Rouquette.
-% \newblock \emph{\Lpack{eledmac} A presumptuous attempt to port
-% \Lpack{EDMAC},\Lpack{TABMAC} and \Lpack{EDSTANZA} to
+% \newblock \emph{\protect\package{eledmac} A presumptuous attempt to port
+% \protect\package{EDMAC},\protect\package{TABMAC} and \protect\package{EDSTANZA} to
% LaTeX}.
% \newblock December 2004.
% \newblock (Available from CTAN in