summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/eledmac/eledpar.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-12-18 22:03:54 +0000
committerKarl Berry <karl@freefriends.org>2013-12-18 22:03:54 +0000
commit00be60da8df9f90d4ad3914ed813951c0639b409 (patch)
treed5bcf7fdfd0e514b240cd782008473fa76b10f8a /Master/texmf-dist/source/latex/eledmac/eledpar.dtx
parent2953c24114166c782e7828ec3aaf9b8d594ef9d1 (diff)
eledmac (18dec13)
git-svn-id: svn://tug.org/texlive/trunk@32441 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.dtx324
1 files changed, 298 insertions, 26 deletions
diff --git a/Master/texmf-dist/source/latex/eledmac/eledpar.dtx b/Master/texmf-dist/source/latex/eledmac/eledpar.dtx
index e35ff1ebf96..f1ab7dd8fbe 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{4254}
+% \CheckSum{4479}
%
% \makeatletter
% \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
@@ -694,6 +694,77 @@
%
% When you use \cs{lednopb} make sure to use it on both sides in the corresponding
% verses to keep the pages in sync.
+% \section{Parallel ledgroups}
+% \changes{v1.6.0}{2013/12/13}{Add tool and documentation for parallel ledgroups}
+% You can also make parallel ledgroups (see the documentation of eledmac about ledgroups).
+% To do it you have:
+% \begin{itemize}
+% \item To load \Lpack{eledpar} package with the \verb+parledgroup+ option, or to add \cs{\parledgrouptrue}.
+% \item To push each ledgroup between \cs{pstart}…\cs{pend} command.
+% \end{itemize}
+% See the following example:
+% \begin{verbatim}
+% \begin{pages}
+% \begin{Leftside}
+% \beginnumbering
+% \pstart
+% \begin{ledgroup}
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \pstart
+% \begin{ledgroup}
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \endnumbering
+% \end{Leftside}
+% \begin{Rightside}
+% \beginnumbering
+% \pstart
+% \begin{ledgroup}
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \pstart
+% \begin{ledgroup}
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \endnumbering
+% \end{Rightside}
+% \Pages
+% \end{pages}
+% \end{verbatim}
+% You can add sectioning a sectioning command, following this scheme:
+% \begin{verbatim}
+% \begin{..side}
+% \beginnumbering
+% \pstart
+% \section{First ledgroup title}
+% \pend
+% \pstart
+% \begin{ledgroup}\skipnumbering
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \pstart
+% \section{Second ledgroup title}
+% \pend
+% \pstart
+% \begin{ledgroup}\skipnumbering
+% ledgroup content
+% \end{ledgroup}
+% \pend
+% \endnumbering
+% \end{..side}
+% \end{verbatim}
+% \subsection{Parallel ledgroups and \Lpack{setspace} package}.
+% If you use the \Lpack{setspace} package and want your notes in parallel ledgroups ledgroups to be single-spaced (not half-spaced or double-spaced), just add to your preamble:
+% \begin{verbatim}
+% \let\parledgroupnotespacing\singlespacing
+% \end{verbatim}
+% \emph{In effect, to have correct spacing, don't change the font size of your notes}.
% \StopEventually{}
%
% \clearpage
@@ -734,7 +805,7 @@
% \begin{macrocode}
%<*code>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{eledpar}[2013/11/08 v1.5.0 eledmac extension for parallel texts]
+\ProvidesPackage{eledpar}[2013/12/13 v1.6.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.
@@ -746,6 +817,7 @@
\let\shiftedversesfalse\shiftedpstartsfalse
\DeclareOption{shiftedverses}{\shiftedpstartstrue}
\DeclareOption{shiftedpstarts}{\shiftedpstartstrue}
+\DeclareOption{parledgroup}{\parledgrouptrue}
\ProcessOptions
% \end{macrocode}
% \end{macro}
@@ -953,10 +1025,10 @@
\newcounter{subsectionR}
\newcounter{subsubsectionR}
\newcommand{\initnumbering@sectcountR}{
- \let\c@chapter\c@chapterR
- \let\c@section\c@sectionR
- \let\c@subsection\c@subsectionR
- \let\c@subsubsection\c@subsubsectionR
+ \let\c@chapter\c@chapterR
+ \let\c@section\c@sectionR
+ \let\c@subsection\c@subsectionR
+ \let\c@subsubsection\c@subsubsectionR
}
% \end{macrocode}
% \end{macro}
@@ -2530,9 +2602,11 @@
\endgroup%
\ignorespaces%
\@oldnobreak%
- \ifnumberpstart%
+ \ifnumberpstart%
\addtocounter{pstartL}{1}%
- \fi}
+ \fi
+ \parledgroup@beforenotes@save{L}%
+ }
% \end{macrocode}
% \end{macro}
@@ -2554,9 +2628,10 @@
\endgroup%
\ignorespaces%
\@oldnobreak%
- \ifnumberpstart%
+ \ifnumberpstart%
\addtocounter{pstartR}{1}%
- \fi%
+ \fi%
+ \parledgroup@beforenotes@save{R}
}
% \end{macrocode}
@@ -2631,6 +2706,7 @@
\l@demptyd@ta
\global\setbox\one@line=\vsplit\namebox{l@dLcolrawbox\the\l@dpscL}
to\baselineskip}%
+ \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startL}{}
\unvbox\one@line \global\setbox\one@line=\lastbox
\getline@numL
\ifnum\@lock>\@ne\inserthangingsymboltrue\else\inserthangingsymbolfalse\fi
@@ -2689,6 +2765,7 @@
\l@demptyd@ta
\global\setbox\one@lineR=\vsplit\namebox{l@dRcolrawbox\the\l@dpscR}
to\baselineskip}%
+ \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startR}{}
\unvbox\one@lineR \global\setbox\one@lineR=\lastbox
\getline@numR
\ifnum\@lockR>\@ne\inserthangingsymbolRtrue\else\inserthangingsymbolRfalse\fi
@@ -2727,7 +2804,7 @@
\global\advance\absline@numR \@ne
\do@actionsR
\do@ballastR
-\ifnumberline
+\ifledgroupnotesR@\else\ifnumberline
\ifsublines@
\ifnum\sub@lockR<\tw@
\global\advance\subline@numR \@ne
@@ -2739,12 +2816,13 @@
\fi
\fi
\fi
+\fi
}
\newcommand*{\getline@numL}{%
\global\advance\absline@num \@ne
\do@actions
\do@ballast
-\ifnumberline
+\ifledgroupnotesL@\else\ifnumberline
\ifsublines@
\ifnum\sub@lock<\tw@
\global\advance\subline@num \@ne
@@ -2756,6 +2834,7 @@
\fi
\fi
\fi
+\fi
}
@@ -2935,7 +3014,7 @@
\newcommand*{\affixline@numR}{%
-\ifnumberline
+\ifledgroupnotesR@\else\ifnumberline
\ifl@dskipnumber
\global\l@dskipnumberfalse
\else
@@ -2978,6 +3057,7 @@
\fi
\f@x@l@cksR
\fi
+\fi
\fi}
% \end{macrocode}
% \end{macro}
@@ -3500,8 +3580,8 @@
\footnotelang@lua[R]%
\fi
\@ifundefined{xpg@main@language}%if polyglossia
- {}%
- {\footnotelang@poly[R]}%
+ {}%
+ {\footnotelang@poly[R]}%
\protected@csxdef{thisfootnote}{\csuse{thefootnote#1}}%
\xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\csexpandonce{thisfootnote}}}%
\to\inserts@listR
@@ -3511,8 +3591,8 @@
\footnotelang@lua%
\fi
\@ifundefined{xpg@main@language}%if polyglossia
- {}%
- {\footnotelang@poly}%
+ {}%
+ {\footnotelang@poly}%
\protected@csxdef{thisfootnote}{\csuse{thefootnote#1}}%
\xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\csexpandonce{thisfootnote}}}%
\to\inserts@list
@@ -4208,6 +4288,7 @@
\newcommand*{\Pages}{%
\setcounter{pstartL}{\value{pstartLold}}
\setcounter{pstartR}{\value{pstartRold}}
+ \parledgroup@notespacing@set@correction
\typeout{}
\typeout{*************************** PAGES ***************************}
\ifnum\l@dnumpstartsL=\l@dnumpstartsR\else
@@ -4297,8 +4378,7 @@
\checkpageL
\l@duselanguage{\theledlanguageL}%
%%% \begingroup
-{ \loop\ifl@dsamepage
-
+{ \loop\ifl@dsamepage
% \end{macrocode}
% Process the next (left) text line, adding it to the page.
% \changes{v0.3}{2005/02/10}{Added \cs{ledstrutL} to \cs{Pages}}
@@ -4308,13 +4388,13 @@
\ifshiftedpstarts
\ifdim\ht\l@dleftbox>0pt\hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}\fi%
\else%
+ \parledgroup@correction@notespacing{L}
\hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}%
\fi
% \end{macrocode}
% Perhaps we have to move to the next (left) box. Check if we have got all
% we can onto the page. If not, repeat for the next line.
-% \begin{macrocode}
-
+% \begin{macrocode}
\get@nextboxL
\checkpageL
\checkverseL
@@ -4333,10 +4413,11 @@
\@writelinesonpageL{1000}%
\fi
% \end{macrocode}
-% Zero the left page lines count and clear the page to get onto the facing
-% (odd, right) page.
+% Reset to zero the left-page line count, clear the page to get onto the facing
+% (odd, right) page, and reinitialize the accumulated dimension of interline correction for notes in parallel ledgroup.
% \begin{macrocode}
\numpagelinesL \z@
+ \parledgroup@correction@notespacing@init
\clearl@dleftpage }%
% \end{macrocode}
% Now do the same for the right text.
@@ -4350,6 +4431,7 @@
\ifshiftedpstarts
\ifdim\ht\l@drightbox>0pt\hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}\fi%
\else%
+ \parledgroup@correction@notespacing{R}
\hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}%
\fi
\get@nextboxR
@@ -4363,6 +4445,7 @@
\@writelinesonpageR{1000}%
\fi
\numpagelinesR=\z@
+ \parledgroup@correction@notespacing@init
% \end{macrocode}
% The page is full, so move onto the next (left, odd) page and repeat left
% text processing.
@@ -4735,10 +4818,14 @@
% output.
% \begin{macrocode}
\ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>\@donetotallinesL
+ \parledgroup@notes@endL
\else
% \end{macrocode}
% Sufficient lines have been output.
% \begin{macrocode}
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}=\@donetotallinesL
+ \parledgroup@notes@endL
+ \fi
\ifwrittenlinesL
\else
% \end{macrocode}
@@ -4769,6 +4856,8 @@
{\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
\global\@donetotallinesL \z@
\global\advance\l@dpscL \@ne
+ \parledgroup@notes@endL
+ \parledgroup@correction@notespacing@final{L}
\fi
\fi
\fi}
@@ -4779,7 +4868,11 @@
\ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% box is not empty
\else% box is empty
\ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>\@donetotallinesR
+ \parledgroup@notes@endR
\else
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}=\@donetotallinesR
+ \parledgroup@notes@endR
+ \fi
\ifwrittenlinesR
\else
\@writelinesinparR
@@ -4801,6 +4894,8 @@
{\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%
\global\@donetotallinesR \z@
\global\advance\l@dpscR \@ne
+ \parledgroup@notes@endR
+ \parledgroup@correction@notespacing@final{R}
\fi
\fi
\fi}
@@ -4857,6 +4952,182 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \section{Parallel ledgroup}
+% \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{parledgroupseries} contains the footnote series.
+% \cs{parledgroupseries} contains the type of the footnote: critical (Xfootnote) or familiar (footnoteX).
+% \begin{macrocode}
+\newmarks\parledgroup@
+\newmarks\parledgroup@series
+\newmarks\parledgroup@type
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \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 begining of a note series in a parallel ledgroup.
+% \begin{macrocode}
+\newcommand{\parledgroup@notes@startL}{%
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>0%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{footnoteX}{\csuse{bhooknoteX@\splitfirstmarks\parledgroup@series}}{}%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{Xfootnote}{\csuse{bhookXnote@\splitfirstmarks\parledgroup@series}}{}%
+ \fi%
+ \global\ledgroupnotesL@true%
+ \insert@noterule@ledgroup{L}%
+}
+\newcommand{\parledgroup@notes@startR}{%
+ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>0%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{footnoteX}{\csuse{bhooknoteX@\splitfirstmarks\parledgroup@series}}{}%
+ \IfStrEq{\splitfirstmarks\parledgroup@type}{Xfootnote}{\csuse{bhookXnote@\splitfirstmarks\parledgroup@series}}{}%
+ \fi%
+ \global\ledgroupnotesR@true%
+ \insert@noterule@ledgroup{R}%
+}
+% \end{macrocode}
+% \end{macro}
+% \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.
+% \begin{macrocode}
+\newcommand{\parledgroup@notes@endL}{%
+ \global\ledgroupnotesL@false%
+}
+\newcommand{\parledgroup@notes@endR}{%
+ \global\ledgroupnotesR@false%
+}
+% \end{macrocode}
+% \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 paralling lines are constructed.
+% This is the goal of \cs{insert@noterule@ledgroup}
+% \begin{macrocode}
+\newcommand{\insert@noterule@ledgroup}[1]{
+ \IfStrEq{\splitbotmarks\parledgroup@}{begin}{%
+ \IfStrEq{\splitbotmarks\parledgroup@type}{Xfootnote}{
+ \csuse{ifledgroupnotes#1@}
+ \vskip\skip\csuse{mp\splitbotmarks\parledgroup@series footins}
+ \csuse{\splitbotmarks\parledgroup@series footnoterule}
+ \fi
+ }
+ {}
+ \IfStrEq{\splitbotmarks\parledgroup@type}{footnoteX}{
+ \csuse{ifledgroupnotes#1@}
+ \vskip\skip\csuse{mpfootins\splitbotmarks\parledgroup@series}
+ \csuse{footnoterule\splitbotmarks\parledgroup@series}
+ \fi
+ }{}
+ }
+ {}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\parledgroupnotespacing}
+% \cs{parledgroupnotespacing} can be redefined by the user to change the interline spacing of ledgroup notes.
+% \begin{macrocode}
+\newcommand{\parledgroupnotespacing}{}
+% \end{macrocode}
+% \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's set by \cs{parledgroup@notespacing@set@correction}, called at the begining of \cs{Pages}.
+% \begin{macrocode}
+\dimdef{\parledgroup@notespacing@correction}{0pt}
+\newcommand{\parledgroup@notespacing@set@correction}{%
+ {\notefontsetup\parledgroupnotespacing\dimgdef{\temp@spacing}{\baselineskip}}%
+ \dimgdef{\parledgroup@notespacing@correction}{\baselineskip-\temp@spacing}%
+}
+% \end{macrocode}
+% \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.
+% It's called at the begining of each pages AND at the end of each ledgroup.
+% \begin{macrocode}
+\newcommand{\parledgroup@correction@notespacing@init}{
+ \dimdef{\parledgroup@notespacing@correction@accumulated}{0pt}
+ \dimdef{\parledgroup@notespacing@correction@modulo}{0pt}
+}
+\parledgroup@correction@notespacing@init
+% \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.
+% It also adds the space needed by the other side spaces between note rules and notes. It's called after the print of each pstart/pend.
+% \begin{macrocode}
+\newcommand{\parledgroup@correction@notespacing@final}[1]{
+ \ifparledgroup
+ \vspace{\parledgroup@notespacing@correction@accumulated}
+ \parledgroup@correction@notespacing@init%
+ \ifstrequal{#1}{L}{
+ \numdef{\@checking}{\the\l@dpscL-1}
+ }{
+ \numdef{\@checking}{\the\l@dpscR-1}
+ }
+ \dimdef{\@beforenotes@current@diff}{\csuse{@parledgroup@beforenotes@\@checking L}-\csuse{@parledgroup@beforenotes@\@checking R}}%
+ \ifstrequal{#1}{L}%
+ {% Left
+ \ifdimgreater{\@beforenotes@current@diff}{0pt}{}{\vspace{-\@beforenotes@current@diff}}%
+ }%
+ {% Right
+ \ifdimgreater{\@beforenotes@current@diff}{0pt}{\vspace{\@beforenotes@current@diff}}{}
+ }%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\parledgroup@correction@notespacing}
+% \cs{parledgroup@correction@notespacing} is used before each printed line.
+% If it's 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}:
+% \begin{itemize}
+% \item It is decreased by \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.
+% That means that the two lines of notes take the place of one normal line. For every two lines of notes, the line total for the current place is decreased by one.
+% \begin{macrocode}{}
+\newcommand{\parledgroup@correction@notespacing}[1]{%
+ \csuse{ifledgroupnotes#1@}%
+ \vspace{-\parledgroup@notespacing@correction}%
+ \dimdef{\parledgroup@notespacing@correction@accumulated}{\parledgroup@notespacing@correction@accumulated+\parledgroup@notespacing@correction}%
+ \dimdef{\parledgroup@notespacing@correction@modulo}{\parledgroup@notespacing@correction@modulo+\parledgroup@notespacing@correction}%
+ \ifdimless{\parledgroup@notespacing@correction@modulo}{\baselineskip}{}{\advance\numpagelinesL -\@ne%
+ \dimdef{\parledgroup@notespacing@correction@modulo}{\parledgroup@notespacing@correction@modulo-\baselineskip}%
+ }% mean greater than equal
+ \fi%
+}
+% \end{macrocode}
+% \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.
+% \begin{macrocode}
+\dimdef\parledgroup@beforenotesL{0pt}
+\dimdef\parledgroup@beforenotesR{0pt}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\parledgroup@beforenotes@save}
+% The macro \cs{parledgroup@beforenotes@save} dumps the space befores notes of the current parallel ledgroup in a macro named with the current pstart number.
+% \begin{macrocode}
+\newcommand{\parledgroup@beforenotes@save}[1]{
+ \ifparledgroup
+ \csdimgdef{@parledgroup@beforenotes@\the\csuse{l@dnumpstarts#1}#1}{\csuse{parledgroup@beforenotes#1}}
+ \csdimgdef{parledgroup@beforenotes#1}{0pt}
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+
+
% \section{The End}\label{end}
%
%
@@ -4881,15 +5152,16 @@
% With standard \cs{hangingsymbol}:
% \setstanzaindents{4,0}
% \beginnumbering
-% \stanza
-% A very long verse should be sometime hanged. The position of the hang verse is fixed.\&
+% \stanza
+% A very long verse should be sometime hanged.
+% The position of the hanging verse is fixed.\&
% \endnumbering
%
% With the modification of \cs{hangingsymbol}:
% \renewcommand{\hangingsymbol}{\protect\hfill}
% \setstanzaindents{4,0}
% \beginnumbering
-% \stanza
+% \stanza
% A very long verse should sometimes be hanging. And we can see that an hanging verse is flush right.\&
% \endnumbering
% \bibliographystyle{alpha}