summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/eledmac/eledpar.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-09 23:38:16 +0000
committerKarl Berry <karl@freefriends.org>2013-11-09 23:38:16 +0000
commit9d1f0b004cd5a2bdf8014aef14a0afb6f54c3c06 (patch)
tree327dd724a3e886e675aec58dcba21b1451078e49 /Master/texmf-dist/source/latex/eledmac/eledpar.dtx
parented47a420cd7d5ffcfc9106fbb61a9e25bc47c577 (diff)
eledmac (9nov13)
git-svn-id: svn://tug.org/texlive/trunk@32113 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/eledmac/eledpar.dtx')
-rw-r--r--Master/texmf-dist/source/latex/eledmac/eledpar.dtx203
1 files changed, 192 insertions, 11 deletions
diff --git a/Master/texmf-dist/source/latex/eledmac/eledpar.dtx b/Master/texmf-dist/source/latex/eledmac/eledpar.dtx
index 49f413a7eb9..e35ff1ebf96 100644
--- a/Master/texmf-dist/source/latex/eledmac/eledpar.dtx
+++ b/Master/texmf-dist/source/latex/eledmac/eledpar.dtx
@@ -51,7 +51,7 @@
%
% \fi
%
-% \CheckSum{4003}
+% \CheckSum{4254}
%
% \makeatletter
% \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
@@ -157,6 +157,7 @@
% \changes{v1.2}{2012/10/15}{Support for \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.}
% \hyphenation{man-u-script man-u-scripts}
%
% \newcommand{\Lpack}[1]{\textsf{#1}}
@@ -435,6 +436,10 @@
% \DescribeMacro{\linenumincrement}
% \DescribeMacro{\firstsublinenum}
% \DescribeMacro{\sublinenumincrement}
+% \DescribeMacro{\firstlinenum*}
+% \DescribeMacro{\linenumincrement*}
+% \DescribeMacro{\firstsublinenum*}
+% \DescribeMacro{\sublinenumincrement*}
% The \Eledmac{} package originally used counters for specifying the
% numbering scheme; now both \Eledmac\footnote{when used with \Lpack{ledpatch}
% v0.2 or greater.} and
@@ -446,6 +451,7 @@
% control over the left and right numbering schemes. The \cs{firstsublinenum}
% and \cs{sublinenumincrement} macros correspondingly set the numbering
% scheme for sublines.
+% The starred versions change both left and right numbering schemes.
%
% \DescribeMacro{\pstart}
% \DescribeMacro{\pend}
@@ -680,6 +686,14 @@
%\begin{verbatim}
%\renewcommand{\hangingsymbol}{[\,}
%\end{verbatim}
+% You can also use it to force hanging verse to be flush right:
+% \begin{verbatim}
+% \renewcommand{\hangingsymbol}{\protect\hfill}
+% \end{verbatim}
+%
+%
+% When you use \cs{lednopb} make sure to use it on both sides in the corresponding
+% verses to keep the pages in sync.
% \StopEventually{}
%
% \clearpage
@@ -720,7 +734,7 @@
% \begin{macrocode}
%<*code>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{eledpar}[2013/10/27 v1.4.3 eledmac extension for parallel texts]
+\ProvidesPackage{eledpar}[2013/11/08 v1.5.0 eledmac extension for parallel texts]
% \end{macrocode}
% With the option `shiftedpstarts' a long pstart one the left side (or in the right side) don't make a blank on the corresponding pstart, but the blank is put on the bottom of the page. Consequently, the pstarts on the parallel pages are shifted, but the shifted stop at every end of pages.
@@ -780,7 +794,7 @@
% All the error and warning messages are collected here as macros.
%
% \begin{macro}{\led@err@TooManyPstarts}
-% \begin{macrocode}
+% \begin{macrocode}
\newcommand*{\led@err@TooManyPstarts}{%
\eledmac@error{Too many \string\pstart\space without printing.
Some text will be lost}{\@ehc}}
@@ -788,7 +802,7 @@
% \end{macro}
%
% \begin{macro}{\led@err@BadLeftRightPstarts}
-% \begin{macrocode}
+% \begin{macrocode}
\newcommand*{\led@err@BadLeftRightPstarts}[2]{%
\eledmac@error{The numbers of left (#1) and right (#2)
\string\pstart s do not match}{\@ehc}}
@@ -797,7 +811,7 @@
%
% \begin{macro}{\led@err@LeftOnRightPage}
% \begin{macro}{\led@err@RightOnLeftPage}
-% \begin{macrocode}
+% \begin{macrocode}
\newcommand*{\led@err@LeftOnRightPage}{%
\eledmac@error{The left page has ended on a right page}{\@ehc}}
\newcommand*{\led@err@RightOnLeftPage}{%
@@ -875,6 +889,9 @@
\global\numberingRtrue
\global\advance\section@numR \@ne
\global\absline@numR \z@
+ \gdef\normal@page@breakR{}
+ \gdef\l@prev@pbR{}
+ \gdef\l@prev@nopbR{}
\global\line@numR \z@
\global\@lockR \z@
\global\sub@lockR \z@
@@ -1001,8 +1018,8 @@
% \label{lineation}\relax
%
% \subsection{Choosing the system of lineation}
-%% \changes{v0.11}{2012/06/11}{Lineation can be by pstart (like in eledmac 0.15).}
-%M \changes{v1.0}{2012/09/14}{Debug in lineation by pstart}
+% \changes{v0.11}{2012/06/11}{Lineation can be by pstart (like in eledmac 0.15).}
+% \changes{v1.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
% of each section and increase regardless of page breaks.
@@ -1139,9 +1156,15 @@
% \begin{macro}{\linenumincrement}
% \begin{macro}{\firstsublinenum}
% \begin{macro}{\sublinenumincrement}
+% \begin{macro}{\firstlinenum*}
+% \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.}
% These are the user's macros for changing (sub) line numbers. They are
% defined in \Lpack{eledmac} v0.7, but just in case
% I have started by \cs{provide}ing them.
+% The starred versions are specifi to \Lpack{eledpar}.
% \begin{macrocode}
\providecommand*{\firstlinenum}{}
\providecommand*{\linenumincrement}{}
@@ -1163,12 +1186,19 @@
\ifledRcol \setcounter{sublinenumincrementR}{#1}%
\else \setcounter{sublinenumincrement}{#1}%
\fi}
-
+\WithSuffix\newcommand\firstlinenum*[1]{\setcounter{firstlinenumR}{#1}\setcounter{firstlinenum}{#1}}
+\WithSuffix\newcommand\linenumincrement*[1]{\setcounter{linenumincrementR}{#1}\setcounter{linenumincrement}{#1}}
+\WithSuffix\newcommand\firstsublinenum*[1]{\setcounter{subfirstlinenumR}{#1}\setcounter{subfirstlinenum}{#1}}
+\WithSuffix\newcommand\sublinenumincrement*[1]{\setcounter{sublinenumincrementR}{#1}\setcounter{sublinenumincrement}{#1}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\Rlineflag}
% This is appended to the line numbers of right text.
@@ -1467,6 +1497,7 @@
\page@num=#1\relax
\last@page@num=#1\relax
\def\next@page@num{#1}%
+ \listcsxadd{normal@page@break}{\the\absline@num}
\fi
\fi}
@@ -1909,6 +1940,14 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\new@lineL}
+% The \cs{new@lineL} macro sends the \cs{@l} command to the left text
+% line-list file, to mark the start of a new text line.
+% \begin{macrocode}
+\newcommand*{\new@lineL}{%
+ \write\linenum@out{\string\@l[\the\c@page][\thepage]}}
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\new@lineR}
% The \cs{new@lineR} macro sends the \cs{@l} command to the right text
% line-list file, to mark the start of a new text line.
@@ -2277,6 +2316,8 @@
\let\thepstart\thepstartR
\let\pstart\pstartR
\let\pend\pendR
+ \let\ledpb\ledpbR
+ \let\lednopb\lednopbR
\let\lineation\lineationR
\Rightsidehook
\let\oldstanza\stanza
@@ -2601,7 +2642,7 @@
\add@inserts
\affixside@note
\l@dlsn@te
- {\ledllfill\hb@xt@ \wd\one@line{\do@insidelineLhook\inserthangingsymbolL\new@line\l@dunhbox@line{\one@line}}\correcthangingL\ledrlfill\l@drd@ta%
+ {\ledllfill\hb@xt@ \wd\one@line{\do@insidelineLhook\inserthangingsymbolL\new@lineL\l@dunhbox@line{\one@line}}\correcthangingL\ledrlfill\l@drd@ta%
\l@drsn@te
}}%
\add@penaltiesL
@@ -3981,6 +4022,9 @@
\unhbox\l@drightbox
}%
\checkraw@text
+ \checkverseL
+ \checkverseR
+ \checkpb@columns
\repeat}
% \end{macrocode}
% Having completed a pair of chunks, write the number of lines
@@ -4020,7 +4064,32 @@
% \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}.
+% \begin{macrocode}
+
+\newcommand{\checkpb@columns}{%
+ \newif\if@pb
+ \newif\if@nopb
+ \IfStrEq{\led@pb@setting}{before}{
+ \numdef{\next@absline}{\the\absline@num+1}%
+ \numdef{\next@abslineR}{\the\absline@numR+1}%
+ \xifinlistcs{\next@absline}{l@prev@pb}{\@pbtrue}{}%
+ \xifinlistcs{\next@abslineR}{l@prev@pbR}{\@pbtrue}{}
+ \xifinlistcs{\next@absline}{l@prev@nopb}{\@nopbtrue}{}%
+ \xifinlistcs{\next@abslineR}{l@prev@nopbR}{\@nopbtrue}{}
+ }{}
+ \IfStrEq{\led@pb@setting}{after}{
+ \xifinlistcs{\the\absline@num}{l@prev@pb}{\@pbtrue}{}%
+ \xifinlistcs{\the\absline@numR}{l@prev@pbR}{\@pbtrue}{}
+ \xifinlistcs{\the\absline@num}{l@prev@nopb}{\@nopbtrue}{}%
+ \xifinlistcs{\the\absline@numR}{l@prev@nopbR}{\@nopbtrue}{}
+ }{}
+\if@nopb\nopagebreak[4]\enlargethispage{\baselineskip}\fi
+\if@pb\pagebreak[4]\fi
+}
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\columnseparator}
% \begin{macro}{\columnrulewidth}
% The separator between line pairs in parallel columns is in the form
@@ -4248,6 +4317,8 @@
\get@nextboxL
\checkpageL
+ \checkverseL
+ \checkpbL
\repeat
% \end{macrocode}
% That (left) page has been filled. Output the number of real lines
@@ -4283,6 +4354,8 @@
\fi
\get@nextboxR
\checkpageR
+ \checkverseR
+ \checkpbR
\repeat
\ifl@dpagefull
\@writelinesonpageR{\the\numpagelinesR}%
@@ -4510,6 +4583,7 @@
\newif\ifl@dsamepage
\l@dsamepagetrue
\newif\ifl@dpagefull
+
\newcommand*{\checkpageL}{%
\l@dpagefulltrue
\l@dsamepagetrue
@@ -4548,7 +4622,66 @@
% \end{macro}
% \end{macro}
% \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}.
+% \begin{macrocode}
+\newcommand{\checkpbL}{
+ \IfStrEq{\led@pb@setting}{after}{
+ \xifinlistcs{\the\absline@num}{l@prev@pb}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\the\absline@num}{l@prev@nopb}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+ \IfStrEq{\led@pb@setting}{before}{
+ \numdef{\next@absline}{\the\absline@num+1}
+ \xifinlistcs{\next@absline}{l@prev@pb}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\next@absline}{l@prev@nopb}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+}
+
+\newcommand{\checkpbR}{
+ \IfStrEq{\led@pb@setting}{after}{
+ \xifinlistcs{\the\absline@numR}{l@prev@pbR}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\the\absline@numR}{l@prev@nopbR}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+ \IfStrEq{\led@pb@setting}{before}{
+ \numdef{\next@abslineR}{\the\absline@numR+1}
+ \xifinlistcs{\next@abslineR}{l@prev@pbR}{\l@dpagefulltrue\l@dsamepagefalse}{}
+ \xifinlistcs{\next@abslineR}{l@prev@nopbR}{\l@dpagefullfalse\l@dsamepagetrue}{}
+ }{}
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\checkverseL}
+% \begin{macro}{\checkverseR}
+% \cs{checkverseL} and \cs{checkverseR} are called after each line is printed.
+% They prevent page break inside verse.
+% \begin{macrocode}
+\newcommand{\checkverseL}{
+\ifinstanzaL
+ \iflednopbinverse
+ \ifinserthangingsymbol
+ \numgdef{\prev@abslineverse}{\the\absline@num-1}
+ \IfStrEq{\led@pb@setting}{after}{\lednopbnum{\prev@abslineverse}}{}
+ \IfStrEq{\led@pb@setting}{before}{\ifnum\numpagelinesL<3\ledpbnum{\prev@abslineverse}\fi}{}
+ \fi
+ \fi
+\fi
+}
+\newcommand{\checkverseR}{
+\ifinstanzaR
+ \iflednopbinverse
+ \ifinserthangingsymbolR
+ \numgdef{\prev@abslineverse}{\the\absline@numR-1}
+ \IfStrEq{\led@pb@setting}{after}{\lednopbnumR{\prev@abslineverse}}{}
+ \IfStrEq{\led@pb@setting}{before}{\ifnum\numpagelinesR<3\ledpbnumR{\prev@abslineverse}\fi}{}
+ \fi
+ \fi
+\fi
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
% \begin{macro}{\ledthegoal}
% \begin{macro}{\goalfraction}
% \begin{macro}{\check@goal}
@@ -4676,6 +4809,54 @@
% \end{macro}
% \end{macro}
%
+% \section{Page break/no page break, depending on the specific line}
+% 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 etoolbox list, which contains the lines in which page breaks occur (before or after).
+% The \cs{l@prev@nopbR} macro is a 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{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\ledpbR}
+% \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.
+% \begin{macrocode}
+\newcommand{\ledpbR}{\write\linenum@outR{\string\led@pbR}}
+\newcommand{\ledpbnumR}[1]{\write\linenum@outR{\string\led@pbnumR{#1}}}
+\newcommand{\lednopbR}{\write\linenum@outR{\string\led@nopbR}}
+\newcommand{\lednopbnumR}[1]{\write\linenum@outR{\string\led@nopbnumR{#1}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\led@pbR}
+% \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.
+% \begin{macrocode}
+\newcommand{\led@pbR}{\listcsxadd{l@prev@pbR}{\the\absline@numR}}
+\newcommand{\led@pbnumR}[1]{\listcsxadd{l@prev@pbR}{#1}}
+\newcommand{\led@nopbR}{\listcsxadd{l@prev@nopbR}{\the\absline@numR}}
+\newcommand{\led@nopbnumR}[1]{\listcsxadd{l@prev@nopbR}{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
% \section{The End}\label{end}
%
%