summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ledmac/ledpar.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-07-12 21:41:28 +0000
committerKarl Berry <karl@freefriends.org>2012-07-12 21:41:28 +0000
commite3c6e657f396096f4406658bd2917dd46b7aa9f5 (patch)
tree0b1e7fa2fd386946837ebb17bc3a2f1e5eda3940 /Master/texmf-dist/tex/latex/ledmac/ledpar.sty
parent9f5608ba2efae21382aa973dc6095686c97b6c0e (diff)
ledmac (21jun12)
git-svn-id: svn://tug.org/texlive/trunk@27016 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ledmac/ledpar.sty')
-rw-r--r--Master/texmf-dist/tex/latex/ledmac/ledpar.sty171
1 files changed, 146 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/ledmac/ledpar.sty b/Master/texmf-dist/tex/latex/ledmac/ledpar.sty
index 4b93ec2e423..07645da57fe 100644
--- a/Master/texmf-dist/tex/latex/ledmac/ledpar.sty
+++ b/Master/texmf-dist/tex/latex/ledmac/ledpar.sty
@@ -24,7 +24,7 @@
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ledpar}[2012/04/04 v0.10 ledmac extension for parallel texts]
+\ProvidesPackage{ledpar}[2012/06/11 v0.11 ledmac extension for parallel texts]
\newif\ifshiftedverses
\shiftedversesfalse
@@ -143,25 +143,35 @@
\line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
\l@dend@stuff}
+%% \changes{v0.11}{2012/06/11}{Lineation can be by pstart (like in ledmac 0.15).}
\newif\ifbypage@R
+\newif\ifbypstart@R
\bypage@Rfalse
+ \bypstart@Rfalse
\newcommand*{\lineationR}[1]{{%
- \ifnumberingR
+ \ifnumbering
\led@err@LineationInNumbered
\else
\def\@tempa{#1}\def\@tempb{page}%
\ifx\@tempa\@tempb
\global\bypage@Rtrue
+ \global\bypstart@Rfalse
\else
- \def\@tempb{section}%
+ \def\@tempb{pstart}%
\ifx\@tempa\@tempb
\global\bypage@Rfalse
+ \global\bypstart@Rtrue
\else
- \led@warn@BadLineation
+ \def@tempb{section}
+ \ifx\@tempa\@tempb
+ \global\bypage@Rfalse
+ \global\bypstart@Rfalse
+ \else
+ \led@warn@BadLineation
+ \fi
\fi
\fi
\fi}}
-
\newcount\line@marginR
\renewcommand*{\linenummargin}[1]{{%
\l@dgetline@margin{#1}%
@@ -774,8 +784,10 @@
\newcount\par@lineR
\newcounter{pstartL}
+\newcounter{pstartLold}
\renewcommand{\thepstartL}{{\bfseries\@arabic\c@pstartL}. }
\newcounter{pstartR}
+\newcounter{pstartRold}
\renewcommand{\thepstartR}{{\bfseries\@arabic\c@pstartR}. }
\newcommand*{\pstartL}{
@@ -794,6 +806,7 @@
\pend
\fi
\ifpst@rtedL\else
+ \setcounter{pstartLold}{\value{pstartL}}%
\list@clear{\inserts@list}%
\global\let\next@insert=\empty
\global\pst@rtedLtrue
@@ -804,7 +817,7 @@
\led@err@TooManyPstarts
\global\l@dnumpstartsL=\l@dc@maxchunks
\fi
- \global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup\ifautopar\else\ifnumberpstart\thepstartL\fi\fi%
+ \global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup\ifautopar\else\ifnumberpstart\ifsidepstartnum\else\thepstartL\fi\fi\fi%
\hsize=\Lcolwidth
\numberedpar@true}
\newcommand*{\pstartR}{
@@ -823,6 +836,7 @@
\pendR
\fi
\ifpst@rtedR\else
+ \setcounter{pstartRold}{\value{pstartR}}%
\list@clear{\inserts@listR}%
\global\let\next@insertR=\empty
\global\pst@rtedRtrue
@@ -833,7 +847,7 @@
\led@err@TooManyPstarts
\global\l@dnumpstartsR=\l@dc@maxchunks
\fi
- \global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup\ifautopar\else\ifnumberpstart\thepstartR\fi\fi%
+ \global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup\ifautopar\else\ifnumberpstart\ifsidepstartnum\else\thepstartR\fi\fi\fi%
\hsize=\Rcolwidth
\numberedpar@true}
\newcommand*{\pendL}{\ifnumbering \else
@@ -883,7 +897,6 @@
\newcount\@donetotallinesR
\newcommand*{\do@lineL}{%
-\ifinstanzaL\manageparhangingsymbol\fi
\advance\countLline \@ne
\ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}%
{\vbadness=10000
@@ -896,14 +909,16 @@
\getline@numL
\setbox\l@dleftbox
\hb@xt@ \Lcolwidth{%
+ \affixpstart@numL
\affixline@num
\l@dld@ta
\add@inserts
\affixside@note
\l@dlsn@te
- {\ledllfill\hb@xt@ \wd\one@line{\new@line\l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta%
+ {\ledllfill\hb@xt@ \wd\one@line{\inserthangingsymbolL\new@line\l@dunhbox@line{\one@line}}\correcthangingL\ledrlfill\l@drd@ta%
\l@drsn@te
}}%
+ \prevline@num=\line@num%
\add@penaltiesL
\global\advance\@donereallinesL\@ne
\global\advance\@donetotallinesL\@ne
@@ -916,7 +931,6 @@
\newcommand*{\do@lineRhook}{}
\newcommand*{\do@lineR}{%
-\ifinstanzaR\manageparhangingsymbol\fi
\advance\countRline \@ne
\ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}%
{\vbadness=10000
@@ -929,14 +943,16 @@
\getline@numR
\setbox\l@drightbox
\hb@xt@ \Rcolwidth{%
+ \affixpstart@numR
\affixline@numR
\l@dld@ta
\add@insertsR
\affixside@noteR
\l@dlsn@te
- {\ledllfill\hb@xt@ \wd\one@lineR{\new@lineR\l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta%
+ {\correcthangingR\ledllfill\hb@xt@ \wd\one@lineR{\inserthangingsymbolR\new@lineR\l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta%
\l@drsn@te
}}%
+ \prevline@numR=\line@numR%
\add@penaltiesR
\global\advance\@donereallinesR\@ne
\global\advance\@donetotallinesR\@ne
@@ -946,24 +962,31 @@
\fi}
\newcommand*{\getline@numR}{%
+\ifnumberline
\global\advance\absline@numR \@ne
+\fi
\do@actionsR
\do@ballastR
+\ifnumberline
\ifsublines@
\ifnum\sub@lockR<\tw@
\global\advance\subline@numR \@ne
\fi
\else
\ifnum\@lockR<\tw@
-\addtocounter{hbox}{10}%
\global\advance\line@numR \@ne
\global\subline@numR \z@
\fi
- \fi}
+ \fi
+\fi
+}
\newcommand*{\getline@numL}{%
- \global\advance\absline@num \@ne
+\ifnumberline
+\global\advance\absline@num \@ne
+\fi
\do@actions
\do@ballast
+\ifnumberline
\ifsublines@
\ifnum\sub@lock<\tw@
\global\advance\subline@num \@ne
@@ -971,10 +994,11 @@
\else
\ifnum\@lock<\tw@
\global\advance\line@num \@ne
- \addtocounter{hbox}{10}%
\global\subline@num \z@
\fi
- \fi}
+ \fi
+\fi
+}
\newcommand*{\do@ballastR}{\global\ballast@count=\z@
\begingroup
@@ -1108,6 +1132,7 @@
\fi}
\newcommand*{\affixline@numR}{%
+\ifnumberline
\ifl@dskipnumber
\global\l@dskipnumberfalse
\else
@@ -1149,8 +1174,74 @@
\fi
\fi
\f@x@l@cksR
+\fi
\fi}
+\newcommand*{\affixpstart@numL}{%
+\ifsidepstartnum
+\if@twocolumn
+ \if@firstcolumn
+ \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}%
+ \else
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}%
+ \fi
+ \else
+ \@l@dtempcntb=\line@margin
+ \ifnum\@l@dtempcntb>\@ne
+ \advance\@l@dtempcntb \page@num
+ \fi
+ \ifodd\@l@dtempcntb
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}%
+ \else
+ \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}%
+ \fi
+ \fi
+\fi
+}
+\newcommand*{\affixpstart@numR}{%
+\ifsidepstartnum
+\if@twocolumn
+ \if@firstcolumn
+ \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}%
+ \else
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}%
+ \fi
+ \else
+ \@l@dtempcntb=\line@marginR
+ \ifnum\@l@dtempcntb>\@ne
+ \advance\@l@dtempcntb \page@numR
+ \fi
+ \ifodd\@l@dtempcntb
+ \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}%
+ \else
+ \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}%
+ \fi
+ \fi
+\fi
+}
+
+\newcommand*{\leftpstartnumL}{
+\ifpstartnum
+\thepstartL
+\kern\linenumsep\global\pstartnumfalse\fi
+}
+\newcommand*{\rightpstartnumL}{
+\ifpstartnum\kern\linenumsep
+\thepstartL
+\global\pstartnumfalse\fi
+}
+\newif\ifpstartnumR
+\pstartnumRtrue
+\newcommand*{\leftpstartnumR}{
+\ifpstartnumR
+\thepstartR
+\kern\linenumsep\global\pstartnumRfalse\fi
+}
+\newcommand*{\rightpstartnumR}{
+\ifpstartnumR\kern\linenumsep
+\thepstartR
+\global\pstartnumRfalse\fi
+}
\list@create{\inserts@listR}
\newcommand*{\add@insertsR}{%
\global\let\add@inserts@nextR=\relax
@@ -1501,14 +1592,14 @@
\fi\ignorespaces}
+\newcount\prevline@numR
+\newcommand{\inserthangingsymbolL}{\ifinstanzaL\ifnum\line@num=\prevline@num\hfill\hangingsymbol\fi\fi}
+\newcommand{\inserthangingsymbolR}{\ifinstanzaR\ifnum\line@numR=\prevline@numR\hfill\hangingsymbol\fi\fi}
+\newcommand{\correcthangingL}{\ifl@dpaging\else\ifinstanzaL\ifnum\line@num=\prevline@num\hskip \@ifundefined{sza@0@}{0}{\expandafter%
+ \noexpand\csname sza@0@\endcsname}\stanzaindentbase\fi\fi\fi}
-\newcommand{\manageparhangingsymbol}{%
- \setcounter{hbox}{0}%
- \everyhbox{%
- \ifnum \value{hbox}=-2%
- \hangingsymbol%
- \fi%
- \addtocounter{hbox}{-1}}}
+\newcommand{\correcthangingR}{\ifl@dpaging\else\ifinstanzaR\ifnum\line@numR=\prevline@numR\hskip \@ifundefined{sza@0@}{0}{\expandafter%
+ \noexpand\csname sza@0@\endcsname}\stanzaindentbase\fi\fi\fi}
\chardef\next=\catcode`\&
\catcode`\&=\active
@@ -1659,6 +1750,8 @@
\gdef\theledlanguageR{\xpg@main@language}%
}}
\newcommand*{\Columns}{%
+ \setcounter{pstartL}{\value{pstartLold}}
+ \setcounter{pstartR}{\value{pstartRold}}
\ifnum\l@dnumpstartsL=\l@dnumpstartsR\else
\led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}%
\fi
@@ -1672,6 +1765,8 @@
\global\l@dpscR=\z@
\check@pstarts
\loop\if@pstarts
+ \global\pstartnumtrue
+ \global\pstartnumRtrue
\global\advance\l@dpscL \@ne
\global\advance\l@dpscR \@ne
\checkraw@text
@@ -1696,6 +1791,14 @@
\@writelinesinparL
\@writelinesinparR
\check@pstarts
+ \ifbypstart@
+ \write\linenum@out{\string\@set[1]}
+ \fi
+ \ifbypstart@R
+ \write\linenum@outR{\string\@set[1]}
+ \fi
+ \addtocounter{pstartL}{1}
+ \addtocounter{pstartR}{1}
\repeat
\flush@notes
\flush@notesR
@@ -1754,6 +1857,8 @@
\newcount\l@dminpagelines
\newcommand*{\Pages}{%
+ \setcounter{pstartL}{\value{pstartLold}}
+ \setcounter{pstartR}{\value{pstartRold}}
\typeout{}
\typeout{*************************** PAGES ***************************}
\ifnum\l@dnumpstartsL=\l@dnumpstartsR\else
@@ -1800,14 +1905,15 @@
\l@duselanguage{\theledlanguageL}%
%%% \begingroup
{ \loop\ifl@dsamepage
+
\do@lineL
\advance\numpagelinesL \@ne
\ifshiftedverses
-\addtocounter{hbox}{-1}
\ifdim\ht\l@dleftbox>0pt\hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}\fi%
\else
\hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}%
\fi
+
\get@nextboxL
\checkpageL
\repeat
@@ -1824,7 +1930,6 @@
\do@lineR
\advance\numpagelinesR \@ne
\ifshiftedverses
-\addtocounter{hbox}{-1}
\ifdim\ht\l@drightbox>0pt\hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}\fi%
\else
\hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}%
@@ -1989,6 +2094,14 @@
\fi
\ifnum\l@dnumpstartsL>\l@dpscL
\writtenlinesLfalse
+ \ifbypstart@
+ \ifnum\value{pstartL}<\value{pstartLold}
+ \else
+ \setline{0}
+ \fi
+ \fi
+ \addtocounter{pstartL}{1}
+ \global\pstartnumtrue
\l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
{\the\@donetotallinesL}%
{\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
@@ -2009,6 +2122,14 @@
\fi
\ifnum\l@dnumpstartsR>\l@dpscR
\writtenlinesRfalse
+ \ifbypstart@R
+ \ifnum\value{pstartR}<\value{pstartRold}
+ \else
+ \write\linenum@outR{\string\@set[0]}
+ \fi
+ \fi
+ \addtocounter{pstartR}{1}
+ \global\pstartnumRtrue
\l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%
{\the\@donetotallinesR}%
{\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%