summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/eledmac/eledpar.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/eledmac/eledpar.sty')
-rw-r--r--Master/texmf-dist/tex/latex/eledmac/eledpar.sty134
1 files changed, 115 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/latex/eledmac/eledpar.sty b/Master/texmf-dist/tex/latex/eledmac/eledpar.sty
index f1fd61f5c34..eaf21ab072b 100644
--- a/Master/texmf-dist/tex/latex/eledmac/eledpar.sty
+++ b/Master/texmf-dist/tex/latex/eledmac/eledpar.sty
@@ -23,7 +23,7 @@
%% This work consists of the files listed in the README file.
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{eledpar}[2015/04/13 v1.15.0 eledmac extension for parallel texts]%
+\ProvidesPackage{eledpar}[2015/06/02 v1.17.0 eledmac extension for parallel texts]%
\RequirePackage{xspace}%
\newif\ifshiftedpstarts
@@ -33,6 +33,8 @@
\DeclareOption{shiftedpstarts}{\shiftedpstartstrue}
\DeclareOption{parledgroup}{\parledgrouptrue}
\DeclareOption{widthliketwocolumns}{\widthliketwocolumnstrue}%
+\newif\ifsameparallelpagenumber%
+\DeclareOption{sameparallelpagenumber}{\sameparallelpagenumbertrue}%
\ProcessOptions%
\newdimen\Lcolwidth
\Lcolwidth=0.45\textwidth
@@ -50,6 +52,14 @@
\eledpar@error{The left page has ended on a right page}{\@ehc}}
\newcommand*{\led@err@RightOnLeftPage}{%
\eledpar@error{The right page has ended on a left page}{\@ehc}}
+\newcommand*{\led@err@Leftside@PreviousNotPrinted}{%
+ \eledpar@error{You call a new Leftside environment while the previous one has not been typeset by \string\Pages\space or \string\Columns}{\@ehc}}
+\newcommand*{\led@err@Rightside@PreviousNotPrinted}{%
+ \eledpar@error{You call a new Rightside environment while the previous one has not been typeset by \string\Pages\space or \string\Columns}{\@ehc}}
+\newcommand*{\led@err@Pages@InsideEnv}{%
+ \eledpar@error{\string\Pages\space must be called *outside* of the `pages` environment}{\@ehc}}
+\newcommand*{\led@err@Columns@InsideEnv}{%
+ \eledpar@error{\string\Columns\space must be called *outside* of the `pairs` environment}{\@ehc}}
\newcount\section@numR
\section@numR=\z@
\pst@rtedLfalse
@@ -90,6 +100,9 @@
\ifnumberingR
\global\numberingRfalse
\normal@pars
+ \ifnum\l@dnumpstartsR=0%
+ \led@err@NumberingWithoutPstart%
+ \fi%
\ifl@dpairing
\global\pst@rtedRfalse
\else
@@ -267,15 +280,13 @@
\list@create{\insertlines@listR}
\list@create{\actionlines@listR}
\list@create{\actions@listR}
-\list@create{\sw@listR}%
-\list@create{\sw@list@inedtextR}%
+
+\newcount\page@numR
\list@create{\linesinpar@listL}
\list@create{\linesinpar@listR}
\list@create{\maxlinesinpar@list}
-\newcount\page@numR
-
\renewcommand*{\read@linelist}[1]{%
\ifledRcol
\list@clear{\line@listR}%
@@ -284,8 +295,6 @@
\list@clear{\actions@listR}%
\list@clear{\linesinpar@listR}%
\list@clear{\linesonpage@listR}
- \list@clear{\sw@listR}%
- \list@clear{\sw@list@inedtextR}%
\else
\list@clearing@reg
\list@clear{\linesinpar@listL}%
@@ -562,6 +571,7 @@
\newcount\insert@countR
\renewcommand*{\@ref}[2]{%
\ifledRcol
+ \global\advance\@edtext@level by 1%
\global\insert@countR=#1\relax
\loop\ifnum\insert@countR>\z@
\xright@appenditem{\the\absline@numR}\to\insertlines@listR
@@ -574,7 +584,8 @@
\let\sub@action=\relax
\let\set@line@action=\relax
\let\@lab=\relax
- \let\@sw\@gobbletwo%
+ \let\@lemma=\relax
+ \let\@sw\@gobblethree%
#2
\global\endpage@num=\page@numR
\global\endline@num=\line@numR
@@ -585,7 +596,19 @@
\ifsublines@ \the\subline@numR \else 0\fi|%
\the\endpage@num|\the\endline@num|%
\ifsublines@ \the\endsubline@num \else 0\fi}\to\line@listR
- #2
+ \expandafter\list@create\expandafter{\csname sw@list@edtext@tmp@\the\@edtext@level\endcsname}%
+ \providebool{lemmacommand@\the\@edtext@level}%
+ \boolfalse{lemmacommand@\the\@edtext@level}%
+ #2
+ \ifnum\@edtext@level>0%
+ \def\create@this@edtext@level{\expandafter\list@create\expandafter{\csname sw@list@edtextR@\the\@edtext@level\endcsname}}%
+ \ifcsundef{sw@list@edtextR@\the\@edtext@level}{\create@this@edtext@level}{}%
+ \letcs{\@tmp}{sw@list@edtextR@\the\@edtext@level}%
+ \letcs{\@tmpp}{sw@list@edtext@tmp@\the\@edtext@level}%
+ \xright@appenditem{\expandonce\@tmpp}\to\@tmp%
+ \global\cslet{sw@list@edtextR@\the\@edtext@level}{\@tmp}%
+ \fi%
+ \global\advance\@edtext@level by -1%
\else
\@ref@reg{#1}{#2}%
\fi}
@@ -614,6 +637,7 @@
\immediate\closeout\linenum@outR
\global\first@linenum@out@Rfalse
\immediate\openout\linenum@outR=#1
+ \immediate\write\linenum@outR{\string\line@list@version{\this@line@list@version}}%
\else
\if@minipage%
\leavevmode%
@@ -691,12 +715,12 @@
\fi}
\newcommand{\newseries@eledpar}[1]{%
- \unless\ifnocritical@%
- \csgdef{onlysideX@#1}{}%
- \global\newbool{keepforXside@#1}%
- \fi%
\unless\ifnofamiliar@%
+ \csgdef{onlysideX@#1}{}%
\global\newbool{keepforsideX@#1}%
+ \fi%
+ \unless\ifnocritical@%
+ \global\newbool{keepforXside@#1}%
\csgdef{onlyXside@#1}{}%
\fi%
\unless\ifnofamiliar@%
@@ -793,6 +817,9 @@
\newif\ifinstanzaL
\newif\ifinstanzaR
\newenvironment{Leftside}{%
+ \expandafter\ifvoid\csname l@dLcolrawbox1\endcsname\else%
+ \led@err@Leftside@PreviousNotPrinted%
+ \fi%
\ledRcolfalse
\setcounter{pstartL}{1}
\let\pstart\pstartL
@@ -810,6 +837,9 @@
\newcommand*{\Rightsidehookend}{}
\newenvironment{Rightside}{%
+ \expandafter\ifvoid\csname l@dRcolrawbox1\endcsname\else%
+ \led@err@Rightside@PreviousNotPrinted%
+ \fi%
\ledRcoltrue
\let\beginnumbering\beginnumberingR
\let\endnumbering\endnumberingR
@@ -871,6 +901,7 @@
\global\l@dnumpstartsL=\l@dc@maxchunks%
\fi%
\global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup%
+ \l@dzeropenalties%
\ifautopar\else%
\ifnumberpstart%
\ifsidepstartnum%
@@ -920,6 +951,7 @@
\global\l@dnumpstartsR=\l@dc@maxchunks%
\fi%
\global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup%
+ \l@dzeropenalties%
\ifautopar\else%
\ifnumberpstart%
\ifsidepstartnum\else%
@@ -943,7 +975,6 @@
\ifnumberedpar@ \else%
\led@err@PendNoPstart%
\fi%
- \l@dzeropenalties%
\endgraf\global\num@lines=\prevgraf\egroup%
\global\par@line=0%
\endgroup%
@@ -965,7 +996,6 @@
\ifnumberedpar@ \else%
\led@err@PendNoPstart%
\fi%
- \l@dzeropenalties%
\endgraf\global\num@linesR=\prevgraf\egroup%
\global\par@lineR=0%
\endgroup%
@@ -1923,6 +1953,9 @@
\newsavebox{\@eledsectionL}%
\newsavebox{\@eledsectionR}%
\newcommand*{\Columns}{%
+ \ifl@dpairing%
+ \led@err@Columns@InsideEnv%
+ \fi%
\l@dprintingcolumnstrue%
\eledsection@correcting@skip=-\baselineskip% Correction for sections' titles
\ifnum\l@dnumpstartsL=\l@dnumpstartsR\else
@@ -1944,6 +1977,7 @@
\global\advance\l@dpscR \@ne
\restore@pstartL@pc%
\restore@pstartR@pc%
+ \Columns@print@before@pstart%
\checkraw@text
{ \loop\ifaraw@text
\l@duselanguage{\theledlanguageL}%
@@ -1996,6 +2030,7 @@
\write\linenum@outR{\string\@set[1]}
\resetprevline@
\fi
+ \Columns@print@after@pend%
\repeat
\flush@notes
\flush@notesR
@@ -2130,12 +2165,59 @@
\rightskip=-\temp%
}%
+\newcommand{\Columns@print@before@pstart}{%
+ \ifboolexpr{%
+ test{\ifcsstring{before@pstartL@\the\l@dpscL}{\at@every@pstart}}%
+ and test {\ifcsstring{before@pstartR@\the\l@dpscR}{\at@every@pstart}}%
+ and test {\ifdefempty{\at@every@pstart}}}%
+ {}%
+ {%
+ \hb@xt@ \hsize{%
+ \ifdefstring{\columns@position}{L}{}{\hfill }%
+ \par\parbox[t][][t]{\Lcolwidth}{%
+ \csuse{before@pstartL@\the\l@dpscL}%
+ }%
+ \print@columnseparator%
+ \parbox[t][][t]{\Rcolwidth}{%
+ \csuse{before@pstartR@\the\l@dpscR}%
+ }%
+ \ifdefstring{\columns@position}{R}{}{\hfill}%
+ }%
+ }%
+ \global\csundef{before@pstartL@\the\l@dpscL}%
+ \global\csundef{before@pstartR@\the\l@dpscR}%
+}%
+\newcommand{\Columns@print@after@pend}{%
+ \ifboolexpr{%
+ test{\ifcsstring{after@pendL@\the\l@dpscL}{\at@every@pend}}%
+ and test {\ifcsstring{after@pendR@\the\l@dpscR}{\at@every@pend}}%
+ and test {\ifdefempty{\at@every@pend}}}%
+ {}%
+ {%
+ \hb@xt@ \hsize{%
+ \ifdefstring{\columns@position}{L}{}{\hfill }%
+ \parbox[t][][t]{\Lcolwidth}{%
+ \csuse{after@pendL@\the\l@dpscL}%
+ }%
+ \print@columnseparator%
+ \parbox[t][][t]{\Rcolwidth}{%
+ \csuse{after@pendR@\the\l@dpscR}%
+ }%
+ \ifdefstring{\columns@position}{R}{}{\hfill}%
+ }%
+ }%
+ \global\csundef{after@pendL@\the\l@dpscL}%
+ \global\csundef{after@pendR@\the\l@dpscR}%
+}%
\newcount\numpagelinesL
\newcount\numpagelinesR
\newcount\l@dminpagelines
\newcommand*{\Pages}{%
- \l@dprintingpagestrue%
+ \l@dprintingpagestrue%
+ \ifl@dpairing%
+ \led@err@Pages@InsideEnv%
+ \fi%
\eledsection@correcting@skip=-2\baselineskip% line correcting for section titles.
\parledgroup@notespacing@set@correction%
\typeout{}%
@@ -2156,6 +2238,7 @@
\global\l@dpscR=\z@%
\writtenlinesLfalse%
\writtenlinesRfalse%
+ \init@sameparallelpage@number
\let\print@Xnotes\print@Xnotes@forpages%
\let\print@notesX\print@notesX@forpages%
\check@pstarts%
@@ -2288,16 +2371,17 @@
\global\instanzaLfalse%
\global\instanzaRfalse%
\l@dprintingpagesfalse%
+ \finish@sameparallelpage@number%In order to have continuous page number
\finish@Pages@notes%Needed to prevent final notes overlap line number
\ignorespaces}
\newcommand{\finish@Pages@notes}{%
\def\do##1{%
\ifnocritical@%
- \newbox\csuse{##1footins}
+ \global\newnamebox{##1footins}
\fi
\ifnofamiliar@%
- \newbox\csuse{footins##1}
+ \global\newnamebox{footins##1}
\fi
\ifvoid\csuse{##1footins}%
\ifvoid\csuse{footins##1}\else%
@@ -2335,6 +2419,7 @@
\newcommand*{\clearl@drightpage}{%
\ifdim\pagetotal=0pt\hbox{}\fi%
\newpage%
+ \stepcounter{sameparallelpage@number}%
\ifodd\c@page
\led@err@RightOnLeftPage
\hbox{}%
@@ -2522,7 +2607,6 @@
\parledgroup@notes@endL
\parledgroup@correction@notespacing@final{L}
\else
- \print@last@after@pendLtrue%
\fi
\fi
\fi}
@@ -2562,6 +2646,18 @@
\fi
\fi}
+\newcounter{sameparallelpage@number}
+\newcommand{\init@sameparallelpage@number}{%
+ \setcounter{sameparallelpage@number}{\c@page}%
+ \ifsameparallelpagenumber%
+ \patchcmd{\thepage}{page}{sameparallelpage@number}{}{}%
+ \fi%
+}%
+\newcommand{\finish@sameparallelpage@number}{%
+ \ifsameparallelpagenumber%
+ \setcounter{page}{\c@sameparallelpage@number}%
+ \fi%
+}%
\pretocmd{\chapter}{%
\ifl@dprintingpages%
\vbox{}%