diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/ledmac/ledpar.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/ledmac/ledpar.sty | 1842 |
1 files changed, 1842 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/ledmac/ledpar.sty b/Master/texmf-dist/tex/latex/ledmac/ledpar.sty new file mode 100644 index 00000000000..0050d5fa099 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ledmac/ledpar.sty @@ -0,0 +1,1842 @@ +%% +%% This is file `ledpar.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ledpar.dtx (with options: `code') +%% +%% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net +%% Copyright 2004, 2005 Peter R. Wilson +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any +%% later version. +%% The latest version of the license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2003/06/01 or later. +%% +%% This work has the LPPL maintenance status "author-maintained". +%% +%% This work consists of the files listed in the README file. +%% + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{ledpar}[2005/04/08 v0.3b ledmac extension for parallel texts] + + \l@dpairingfalse +\newif\ifl@dpaging + \l@dpagingfalse +\newif\ifledRcol + \ledRcolfalse +\newdimen\Lcolwidth + \Lcolwidth=0.45\textwidth +\newdimen\Rcolwidth + \Rcolwidth=0.45\textwidth + +\newcommand*{\led@err@TooManyPstarts}{% + \ledmac@error{Too many \string\pstart\space without printing. + Some text will be lost}{\@ehc}} +\newcommand*{\led@err@BadLeftRightPstarts}[2]{% + \ledmac@error{The numbers of left (#1) and right (#2) + \string\pstart s do not match}{\@ehc}} +\newcommand*{\led@err@LeftOnRightPage}{% + \ledmac@error{The left page has ended on a right page}{\@ehc}} +\newcommand*{\led@err@RightOnLeftPage}{% + \ledmac@error{The right page has ended on a left page}{\@ehc}} +\newcount\section@numR + \section@numR=\z@ +\newif\ifnumberingR + \pst@rtedLfalse +\newif\ifpst@rtedR + \pst@rtedRfalse + +\providecommand*{\beginnumbering}{% + \ifnumbering + \led@err@NumberingStarted + \endnumbering + \fi + \global\l@dnumpstartsL \z@ + \global\pst@rtedLfalse + \global\numberingtrue + \global\advance\section@num \@ne + \initnumbering@reg + \message{Section \the\section@num}% + \line@list@stuff{\jobname.\extensionchars\the\section@num}% + \l@dend@stuff} +\newcommand*{\beginnumberingR}{% + \ifnumberingR + \led@err@NumberingStarted + \endnumberingR + \fi + \global\l@dnumpstartsR \z@ + \global\pst@rtedRfalse + \global\numberingRtrue + \global\advance\section@numR \@ne + \global\absline@numR \z@ + \global\line@numR \z@ + \global\subline@numR \z@ + \global\@lock \z@ + \global\sub@lock \z@ + \global\sublines@false + \global\let\next@page@numR=\relax + \global\let\sub@change=\relax + \message{Section \the\section@numR R }% + \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}% + \l@dend@stuff} + +\def\endnumberingR{% + \ifnumberingR + \global\numberingRfalse + \normal@pars + \ifl@dpairing + \global\pst@rtedRfalse + \else + \ifx\insertlines@listR\empty\else + \global\noteschanged@true + \fi + \ifx\line@listR\empty\else + \global\noteschanged@true + \fi + \fi + \ifnoteschanged@ + \led@mess@NotesChanged + \fi + \else + \led@err@NumberingNotStarted + \fi} + +\newcommand*{\pausenumberingR}{% + \endnumberingR\global\numberingRtrue} +\newcommand*{\resumenumberingR}{% + \ifnumberingR + \global\pst@rtedRtrue + \global\advance\section@numR \@ne + \led@mess@SectionContinued{\the\section@numR R}% + \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}% + \l@dend@stuff + \else + \led@err@numberingShouldHaveStarted + \endnumberingR + \beginnumberingR + \fi} + +\newcommand*{\memorydumpL}{% + \endnumbering + \numberingtrue + \global\pst@rtedLtrue + \global\advance\section@num \@ne + \led@mess@SectionContinued{\the\section@num}% + \line@list@stuff{\jobname.\extensionchars\the\section@num}% + \l@dend@stuff} +\newcommand*{\memorydumpR}{% + \endnumberingR + \numberingRtrue + \global\pst@rtedRtrue + \global\advance\section@numR \@ne + \led@mess@SectionContinued{\the\section@numR R}% + \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}% + \l@dend@stuff} + +\newif\ifbypage@R + \bypage@Rfalse +\newcommand*{\lineationR}[1]{{% + \ifnumberingR + \led@err@LineationInNumbered + \else + \def\@tempa{#1}\def\@tempb{page}% + \ifx\@tempa\@tempb + \global\bypage@Rtrue + \else + \def\@tempb{section}% + \ifx\@tempa\@tempb + \global\bypage@Rfalse + \else + \led@warn@BadLineation + \fi + \fi + \fi}} + +\newcount\line@marginR +\renewcommand*{\linenummargin}[1]{{% + \l@dgetline@margin{#1}% + \ifnum\@l@dtempcntb>\m@ne + \ifledRcol + \global\line@marginR=\@l@dtempcntb + \else + \global\line@margin=\@l@dtempcntb + \fi + \fi}} +\line@marginR=\@ne + +\newcounter{firstlinenumR} + \setcounter{firstlinenumR}{5} +\newcounter{linenumincrementR} + \setcounter{linenumincrementR}{5} +\newcounter{firstsublinenumR} + \setcounter{firstsublinenumR}{5} +\newcounter{sublinenumincrementR} + \setcounter{sublinenumincrementR}{5} + +\providecommand*{\firstlinenum}{} +\providecommand*{\linenumincrement}{} +\providecommand*{\firstsublinenum}{} +\providecommand*{\sublinenumincrement}{} +\renewcommand*{\firstlinenum}[1]{% + \ifledRcol \setcounter{firstlinenumR}{#1}% + \else \setcounter{firstlinenum}{#1}% + \fi} +\renewcommand*{\linenumincrement}[1]{% + \ifledRcol \setcounter{linenumincrementR}{#1}% + \else \setcounter{linenumincrement}{#1}% + \fi} +\renewcommand*{\firstsublinenum}[1]{% + \ifledRcol \setcounter{firstsublinenumR}{#1}% + \else \setcounter{firstsublinenum}{#1}% + \fi} +\renewcommand*{\sublinenumincrement}[1]{% + \ifledRcol \setcounter{sublinenumincrementR}{#1}% + \else \setcounter{sublinenumincrement}{#1}% + \fi} + +\newcommand*{\Rlineflag}{R} + +\newcommand*{\linenumrepR}[1]{\@arabic{#1}} +\newcommand*{\sublinenumrepR}[1]{\@arabic{#1}} + +\newcommand*{\leftlinenumR}{% + \l@dlinenumR + \kern\linenumsep} +\newcommand*{\rightlinenumR}{% + \kern\linenumsep + \l@dlinenumR} +\newcommand*{\l@dlinenumR}{% + \numlabfont\linenumrepR{\line@numR}\Rlineflag% + \ifsublines@ + \ifnum\subline@num>\z@ + \unskip\fullstop\sublinenumrepR{\subline@numR}% + \fi + \fi} + +\newcount\line@numR +\newcount\subline@numR +\newcount\absline@numR + +\list@create{\line@listR} +\list@create{\insertlines@listR} +\list@create{\actionlines@listR} +\list@create{\actions@listR} + +\list@create{\linesinpar@listL} +\list@create{\linesinpar@listR} +\list@create{\maxlinesinpar@list} + +\newcount\page@numR + +\renewcommand*{\read@linelist}[1]{% + \ifledRcol + \list@clear{\line@listR}% + \list@clear{\insertlines@listR}% + \list@clear{\actionlines@listR}% + \list@clear{\actions@listR}% + \list@clear{\linesinpar@listR}% + \list@clear{\linesonpage@listR} + \else + \list@clearing@reg + \list@clear{\linesinpar@listL}% + \list@clear{\linesonpage@listL}% + \fi + \list@clear{\maxlinesinpar@list} + \get@linelistfile{#1}% + \endgroup + \ifledRcol + \global\page@numR=\m@ne + \ifx\actionlines@listR\empty + \gdef\next@actionlineR{1000000}% + \else + \gl@p\actionlines@listR\to\next@actionlineR + \gl@p\actions@listR\to\next@actionR + \fi + \else + \global\page@num=\m@ne + \ifx\actionlines@list\empty + \gdef\next@actionline{1000000}% + \else + \gl@p\actionlines@list\to\next@actionline + \gl@p\actions@list\to\next@action + \fi + \fi} + +\renewcommand{\@l}[2]{% + \fix@page{#1}% + \ifledRcol + \ifx\l@dchset@num\relax \else + \advance\absline@numR \@ne + \set@line@action + \let\l@dchset@num=\relax + \advance\absline@numR \m@ne + \advance\line@numR \m@ne% % do we need this?? + \fi + \advance\absline@numR \@ne + \ifx\next@page@numR\relax \else + \page@action + \let\next@page@numR=\relax + \fi + \ifx\sub@change\relax \else + \ifnum\sub@change>\z@ + \sublines@true + \else + \sublines@false + \fi + \sub@action + \let\sub@change=\relax + \fi + \ifcase\@lock + \or + \@lock \tw@ + \or \or + \@lock \z@ + \fi + \ifcase\sub@lock + \or + \sub@lock \tw@ + \or \or + \sub@lock \z@ + \fi + \ifsublines@ + \ifnum\sub@lock<\tw@ + \advance\subline@numR \@ne + \fi + \else + \ifnum\@lock<\tw@ + \advance\line@numR \@ne \subline@numR \z@ + \fi + \fi + \else + \@l@reg + \fi} + +\newcount\last@page@numR + \last@page@numR=-10000 +\renewcommand*{\fix@page}[1]{% + \ifledRcol + \ifnum #1=\last@page@numR + \else + \ifbypage@R + \line@numR \z@ \subline@numR \z@ + \fi + \page@numR=#1\relax + \last@page@numR=#1\relax + \def\next@page@numR{#1}% + \fi + \else + \ifnum #1=\last@page@num + \else + \ifbypage@ + \line@num \z@ \subline@num \z@ + \fi + \page@num=#1\relax + \last@page@num=#1\relax + \def\next@page@num{#1}% + \fi + \fi} + +\renewcommand*{\@adv}[1]{% + \ifsublines@ + \ifledRcol + \advance\subline@numR by #1\relax + \ifnum\subline@numR<\z@ + \led@warn@BadAdvancelineSubline + \subline@numR \z@ + \fi + \else + \advance\subline@num by #1\relax + \ifnum\subline@num<\z@ + \led@warn@BadAdvancelineSubline + \subline@num \z@ + \fi + \fi + \else + \ifledRcol + \advance\line@numR by #1\relax + \ifnum\line@numR<\z@ + \led@warn@BadAdvancelineLine + \line@numR \z@ + \fi + \else + \advance\line@num by #1\relax + \ifnum\line@num<\z@ + \led@warn@BadAdvancelineLine + \line@num \z@ + \fi + \fi + \fi + \set@line@action} + +\renewcommand*{\@set}[1]{% + \ifledRcol + \ifsublines@ + \subline@numR=#1\relax + \else + \line@numR=#1\relax + \fi + \set@line@action + \else + \ifsublines@ + \subline@num=#1\relax + \else + \line@num=#1\relax + \fi + \set@line@action + \fi} + +\renewcommand*{\l@d@set}[1]{% + \ifledRcol + \line@numR=#1\relax + \advance\line@numR \@ne + \def\l@dchset@num{#1} + \else + \line@num=#1\relax + \advance\line@num \@ne + \def\l@dchset@num{#1} + \fi} +\let\l@dchset@num\relax + +\renewcommand*{\page@action}{% + \ifledRcol + \xright@appenditem{\the\absline@numR}\to\actionlines@listR + \xright@appenditem{\next@page@numR}\to\actions@listR + \else + \xright@appenditem{\the\absline@num}\to\actionlines@list + \xright@appenditem{\next@page@num}\to\actions@list + \fi} +\renewcommand*{\set@line@action}{% + \ifledRcol + \xright@appenditem{\the\absline@numR}\to\actionlines@listR + \ifsublines@ + \@l@dtempcnta=-\subline@numR + \else + \@l@dtempcnta=-\line@numR + \fi + \advance\@l@dtempcnta by -5000\relax + \xright@appenditem{\the\@l@dtempcnta}\to\actions@listR + \else + \xright@appenditem{\the\absline@num}\to\actionlines@list + \ifsublines@ + \@l@dtempcnta=-\subline@num + \else + \@l@dtempcnta=-\line@num + \fi + \advance\@l@dtempcnta by -5000\relax + \xright@appenditem{\the\@l@dtempcnta}\to\actions@list + \fi} + +\renewcommand*{\sub@action}{% + \ifledRcol + \xright@appenditem{\the\absline@numR}\to\actionlines@listR + \ifsublines@ + \xright@appenditem{-1001}\to\actions@listR + \else + \xright@appenditem{-1002}\to\actions@listR + \fi + \else + \xright@appenditem{\the\absline@num}\to\actionlines@list + \ifsublines@ + \xright@appenditem{-1001}\to\actions@list + \else + \xright@appenditem{-1002}\to\actions@list + \fi + \fi} + +\renewcommand*{\do@lockon}{% + \ifx\next\lock@off + \global\let\lock@off=\skip@lockoff + \else + \ifledRcol + \xright@appenditem{\the\absline@numR}\to\actionlines@listR + \ifsublines@ + \xright@appenditem{-1005}\to\actions@listR + \ifcase\sub@lock + \sub@lock \@ne + \else + \sub@lock \z@ + \fi + \else + \xright@appenditem{-1003}\to\actions@listR + \ifcase\@lock + \@lock \@ne + \else + \@lock \z@ + \fi + \fi + \else + \xright@appenditem{\the\absline@num}\to\actionlines@list + \ifsublines@ + \xright@appenditem{-1005}\to\actions@list + \ifcase\sub@lock + \sub@lock \@ne + \else + \sub@lock \z@ + \fi + \else + \xright@appenditem{-1003}\to\actions@list + \ifcase\@lock + \@lock \@ne + \else + \@lock \z@ + \fi + \fi + \fi + \fi} +\renewcommand*{\do@lockoff}{% + \ifledRcol + \xright@appenditem{\the\absline@numR}\to\actionlines@listR + \ifsublines@ + \xright@appenditem{-1006}\to\actions@listR + \ifnum\sub@lock=\tw@ + \sub@lock \thr@@ + \else + \sub@lock \z@ + \fi + \else + \xright@appenditem{-1004}\to\actions@listR + \ifnum\@lock=\tw@ + \@lock \thr@@ + \else + \@lock \z@ + \fi + \fi + \else + \xright@appenditem{\the\absline@num}\to\actionlines@list + \ifsublines@ + \xright@appenditem{-1006}\to\actions@list + \ifnum\sub@lock=\tw@ + \sub@lock \thr@@ + \else + \sub@lock \z@ + \fi + \else + \xright@appenditem{-1004}\to\actions@list + \ifnum\@lock=\tw@ + \@lock \thr@@ + \else + \@lock \z@ + \fi + \fi + \fi} +\global\let\lock@off=\do@lockoff + +\providecommand*{\n@num}{} +\renewcommand*{\n@num}{% + \ifledRcol + \xright@appenditem{\the\absline@numR}\to\actionlines@listR + \xright@appenditem{-1007}\to\actions@listR + \else + \n@num@reg + \fi} + +\newcount\insert@countR +\renewcommand*{\@ref}[2]{% + \ifledRcol + \global\insert@countR=#1\relax + \loop\ifnum\insert@countR>\z@ + \xright@appenditem{\the\absline@numR}\to\insertlines@listR + \global\advance\insert@countR \m@ne + \repeat + \begingroup + \let\@ref=\dummy@ref + \let\page@action=\relax + \let\sub@action=\relax + \let\set@line@action=\relax + \let\@lab=\relax + #2 + \global\endpage@num=\page@numR + \global\endline@num=\line@numR + \global\endsubline@num=\subline@numR + \endgroup + \xright@appenditem% + {\the\page@numR|\the\line@numR|% + \ifsublines@ \the\subline@numR \else 0\fi|% + \the\endpage@num|\the\endline@num|% + \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@listR + #2 + \else + \@ref@reg{#1}{#2}% + \fi} +\providecommand*{\@pend}[1]{} +\renewcommand*{\@pend}[1]{% + \xright@appenditem{#1}\to\linesinpar@listL} +\providecommand*{\@pendR}[1]{} +\renewcommand*{\@pendR}[1]{% + \xright@appenditem{#1}\to\linesinpar@listR} + +\providecommand*{\@lopL}[1]{} +\renewcommand*{\@lopL}[1]{% + \xright@appenditem{#1}\to\linesonpage@listL} +\providecommand*{\@lopR}[1]{} +\renewcommand*{\@lopR}[1]{% + \xright@appenditem{#1}\to\linesonpage@listR} + +\newwrite\linenum@outR +\newif\iffirst@linenum@out@R + \first@linenum@out@Rtrue +\newcommand*{\line@list@stuffR}[1]{% + \read@linelist{#1}% + \iffirst@linenum@out@R + \immediate\closeout\linenum@outR + \global\first@linenum@out@Rfalse + \immediate\openout\linenum@outR=#1 + \else + \closeout\linenum@outR + \openout\linenum@outR=#1 + \fi} + +\newcommand*{\new@lineR}{% + \write\linenum@outR{\string\@l[\the\c@page][\thepage]}} +\renewcommand*{\flag@start}{% + \ifledRcol + \edef\next{\write\linenum@outR{% + \string\@ref[\the\insert@countR][}}% + \next + \else + \edef\next{\write\linenum@out{% + \string\@ref[\the\insert@count][}}% + \next + \fi} +\renewcommand*{\flag@end}{% + \ifledRcol + \write\linenum@outR{]}% + \else + \write\linenum@out{]}% + \fi} +\renewcommand*{\startsub}{\dimen0\lastskip + \ifdim\dimen0>0pt \unskip \fi + \ifledRcol \write\linenum@outR{\string\sub@on}% + \else \write\linenum@out{\string\sub@on}% + \fi + \ifdim\dimen0>0pt \hskip\dimen0 \fi} +\def\endsub{\dimen0\lastskip + \ifdim\dimen0>0pt \unskip \fi + \ifledRcol \write\linenum@outR{\string\sub@off}% + \else \write\linenum@out{\string\sub@off}% + \fi + \ifdim\dimen0>0pt \hskip\dimen0 \fi} + +\renewcommand*{\advanceline}[1]{% + \ifledRcol \write\linenum@outR{\string\@adv[#1]}% + \else \write\linenum@out{\string\@adv[#1]}% + \fi} +\renewcommand*{\setline}[1]{% + \ifnum#1<\z@ + \led@warn@BadSetline + \else + \ifledRcol \write\linenum@outR{\string\@set[#1]}% + \else \write\linenum@out{\string\@set[#1]}% + \fi + \fi} +\renewcommand*{\setlinenum}[1]{% + \ifnum#1<\z@ + \led@warn@BadSetlinenum + \else + \ifledRcol \write\linenum@outR{\string\l@d@set[#1]} + \else \write\linenum@out{\string\l@d@set[#1]} \fi + \fi} + +\renewcommand*{\startlock}{% + \ifledRcol \write\linenum@outR{\string\lock@on}% + \else \write\linenum@out{\string\lock@on}% + \fi} +\def\endlock{% + \ifledRcol \write\linenum@outR{\string\lock@off}% + \else \write\linenum@out{\string\lock@off}% + \fi} + +\renewcommand*{\skipnumbering}{% + \ifledRcol \write\linenum@outR{\string\n@num}% + \advanceline{-1}% + \else + \skipnumbering@reg + \fi} + +\long\def\critext#1#2/{\leavevmode + \begingroup + \no@expands + \xdef\@tag{#1}% + \set@line + \ifledRcol \global\insert@countR \z@ + \else \global\insert@count \z@ \fi + \ignorespaces #2\relax + \flag@start + \endgroup + \showlemma{#1}% + \ifx\end@lemmas\empty \else + \gl@p\end@lemmas\to\x@lemma + \x@lemma + \global\let\x@lemma=\relax + \fi + \flag@end} +\renewcommand{\edtext}[2]{\leavevmode + \begingroup + \no@expands + \xdef\@tag{#1}% + \set@line + \ifledRcol \global\insert@countR \z@ + \else \global\insert@count \z@ \fi + \ignorespaces #2\relax + \flag@start + \endgroup + \showlemma{#1}% + \ifx\end@lemmas\empty \else + \gl@p\end@lemmas\to\x@lemma + \x@lemma + \global\let\x@lemma=\relax + \fi + \flag@end} + +\renewcommand*{\set@line}{% + \ifledRcol + \ifx\line@listR\empty + \global\noteschanged@true + \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}% + \else + \gl@p\line@listR\to\@tempb + \xdef\l@d@nums{\@tempb|\edfont@info}% + \global\let\@tempb=\undefined + \fi + \else + \ifx\line@list\empty + \global\noteschanged@true + \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}% + \else + \gl@p\line@list\to\@tempb + \xdef\l@d@nums{\@tempb|\edfont@info}% + \global\let\@tempb=\undefined + \fi + \fi} + +\newenvironment{pairs}{% + \l@dpairingtrue + \l@dpagingfalse +}{% + \l@dpairingfalse +} +\newenvironment{pages}{% + \l@dpairingtrue + \l@dpagingtrue + \setlength{\Lcolwidth}{\textwidth}% + \setlength{\Rcolwidth}{\textwidth}% +}{% + \l@dpairingfalse + \l@dpagingfalse +} + +\newenvironment{Leftside}{% + \ledRcolfalse + \let\pstart\pstartL + \let\pend\pendL + \let\memorydump\memorydumpL + \Leftsidehook +}{\Leftsidehookend} +\newcommand*{\Leftsidehook}{} +\newcommand*{\Leftsidehookend}{} +\newcommand*{\Rightsidehook}{} +\newcommand*{\Rightsidehookend}{} + +\newenvironment{Rightside}{% + \ledRcoltrue + \let\beginnumbering\beginnumberingR + \let\endnumbering\endnumberingR + \let\pausenumbering\pausenumberingR + \let\resumenumbering\resumenumberingR + \let\memorydump\memorydumpR + \let\pstart\pstartR + \let\pend\pendR + \let\lineation\lineationR + \Rightsidehook +}{% + \ledRcolfalse + \Rightsidehookend +} + +\newcount\num@linesR +\newbox\one@lineR +\newcount\par@lineR +\newcommand*{\pstartL}{\ifnumbering \else + \led@err@PstartNotNumbered + \beginnumbering + \fi + \ifnumberedpar@ + \led@err@PstartInPstart + \pend + \fi + \ifpst@rtedL\else + \list@clear{\inserts@list}% + \global\let\next@insert=\empty + \global\pst@rtedLtrue + \fi + \begingroup\normal@pars + \global\advance\l@dnumpstartsL \@ne + \ifnum\l@dnumpstartsL>\l@dc@maxchunks + \led@err@TooManyPstarts + \global\l@dnumpstartsL=\l@dc@maxchunks + \fi + \global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup% + \hsize=\Lcolwidth + \numberedpar@true} +\newcommand*{\pstartR}{\ifnumberingR \else + \led@err@PstartNotNumbered + \beginnumberingR + \fi + \ifnumberedpar@ + \led@err@PstartInPstart + \pendR + \fi + \ifpst@rtedR\else + \list@clear{\inserts@listR}% + \global\let\next@insertR=\empty + \global\pst@rtedRtrue + \fi + \begingroup\normal@pars + \global\advance\l@dnumpstartsR \@ne + \ifnum\l@dnumpstartsR>\l@dc@maxchunks + \led@err@TooManyPstarts + \global\l@dnumpstartsR=\l@dc@maxchunks + \fi + \global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup% + \hsize=\Rcolwidth + \numberedpar@true} +\newcommand*{\pendL}{\ifnumbering \else + \led@err@PendNotNumbered + \fi + \ifnumberedpar@ \else + \led@err@PendNoPstart + \fi + \l@dzeropenalties + \endgraf\global\num@lines=\prevgraf\egroup + \global\par@line=0 + \endgroup + \ignorespaces} + +\newcommand*{\pendR}{\ifnumberingR \else + \led@err@PendNotNumbered + \fi + \ifnumberedpar@ \else + \led@err@PendNoPstart + \fi + \l@dzeropenalties + \endgraf\global\num@linesR=\prevgraf\egroup + \global\par@lineR=0 + \endgroup + \ignorespaces} + +\newbox\l@dleftbox +\newbox\l@drightbox + +\newcount\countLline + \countLline \z@ +\newcount\countRline + \countRline \z@ + +\newcount\@donereallinesL +\newcount\@donetotallinesL +\newcount\@donereallinesR +\newcount\@donetotallinesR + +\newcommand*{\do@lineL}{% + \advance\countLline \@ne + \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}% + {\vbadness=10000 \splittopskip=0pt + \do@lineLhook + \l@demptyd@ta + \global\setbox\one@line=\vsplit\namebox{l@dLcolrawbox\the\l@dpscL} + to\baselineskip}% + \unvbox\one@line \global\setbox\one@line=\lastbox + \getline@num + \setbox\l@dleftbox + \hb@xt@ \Lcolwidth{% + \affixline@num + \l@dld@ta + \add@inserts + \affixside@note + \l@dlsn@te% left side note + {\ledllfill\hb@xt@ \wd\one@line{\new@line\unhbox\one@line}\ledrlfill\l@drd@ta + \l@drsn@te% right side note + }}% + \add@penaltiesL + \global\advance\@donereallinesL\@ne + \global\advance\@donetotallinesL\@ne + \else + \setbox\l@dleftbox \hb@xt@ \Lcolwidth{\hspace*{\Lcolwidth}}% + \global\advance\@donetotallinesL\@ne + \fi} + +\newcommand*{\do@lineLhook}{} +\newcommand*{\do@lineRhook}{} + +\newcommand*{\do@lineR}{% + \advance\countRline \@ne + \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% + {\vbadness=10000 \splittopskip=0pt + \do@lineRhook + \l@demptyd@ta + \global\setbox\one@lineR=\vsplit\namebox{l@dRcolrawbox\the\l@dpscR} + to\baselineskip}% + \unvbox\one@lineR \global\setbox\one@lineR=\lastbox + \getline@numR + \setbox\l@drightbox + \hb@xt@ \Rcolwidth{% + \affixline@numR + \l@dld@ta + \add@insertsR + \affixside@noteR + \l@dlsn@te% left side note + {\ledllfill\hb@xt@ \wd\one@lineR{\new@lineR\unhbox\one@lineR}\ledrlfill\l@drd@ta + \l@drsn@te% right side note + }}% + \add@penaltiesR + \global\advance\@donereallinesR \@ne + \global\advance\@donetotallinesR \@ne + \else + \setbox\l@drightbox \hb@xt@ \Rcolwidth{\hspace*{\Rcolwidth}} + \global\advance\@donetotallinesR \@ne + \fi} + +\newcommand*{\getline@numR}{% + \global\advance\absline@numR \@ne + \do@actionsR + \do@ballastR + \ifsublines@ + \ifnum\sub@lock<\tw@ + \global\advance\subline@numR \@ne + \fi + \else + \ifnum\@lock<\tw@ + \global\advance\line@numR \@ne + \global\subline@numR=\z@ + \fi + \fi} + +\newcommand*{\do@ballastR}{\global\ballast@count=\z@ + \begingroup + \advance\absline@numR \@ne + \ifnum\next@actionlineR=\absline@numR + \ifnum\next@actionR>-1001 + \global\advance\ballast@count by -\c@ballast + \fi + \fi + \endgroup} +\newcommand*{\do@actionsR}{% + \global\let\do@actions@nextR=\relax + \@l@dtempcntb=\absline@numR + \ifnum\@l@dtempcntb<\next@actionlineR\else + \ifnum\next@actionR>-1001 + \global\page@numR=\next@actionR + \ifbypage@R + \global\line@numR=\z@ \global\subline@numR=\z@ + \fi + \else + \ifnum\next@actionR<-4999 + \@l@dtempcnta=-\next@actionR + \advance\@l@dtempcnta by -5001 + \ifsublines@ + \global\subline@numR=\@l@dtempcnta + \else + \global\line@numR=\@l@dtempcnta + \fi + \else + \@l@dtempcnta=-\next@actionR + \advance\@l@dtempcnta by -1000 + \do@actions@fixedcode + \fi + \fi + \ifx\actionlines@listR\empty + \gdef\next@actionlineR{1000000}% + \else + \gl@p\actionlines@listR\to\next@actionlineR + \gl@p\actions@listR\to\next@actionR + \global\let\do@actions@nextR=\do@actionsR + \fi + \fi + \do@actions@nextR} + +\newcommand*{\affixline@numR}{% +\ifl@dskipnumber + \global\l@dskipnumberfalse +\else + \ifsublines@ + \@l@dtempcntb=\subline@numR + \ifnum\subline@numR>\c@firstsublinenumR + \@l@dtempcnta=\subline@numR + \advance\@l@dtempcnta by-\c@firstsublinenumR + \divide\@l@dtempcnta by\c@sublinenumincrementR + \multiply\@l@dtempcnta by\c@sublinenumincrementR + \advance\@l@dtempcnta by\c@firstsublinenumR + \else + \@l@dtempcnta=\c@firstsublinenumR + \fi + \ch@cksub@l@ck + \else + \@l@dtempcntb=\line@numR + \ifx\linenumberlist\empty + \ifnum\line@numR>\c@firstlinenumR + \@l@dtempcnta=\line@numR + \advance\@l@dtempcnta by-\c@firstlinenumR + \divide\@l@dtempcnta by\c@linenumincrementR + \multiply\@l@dtempcnta by\c@linenumincrementR + \advance\@l@dtempcnta by\c@firstlinenumR + \else + \@l@dtempcnta=\c@firstlinenumR + \fi + \else + \@l@dtempcnta=\line@numR + \edef\rem@inder{,\linenumberlist,\number\line@numR,}% + \edef\sc@n@list{\def\noexpand\sc@n@list + ####1,\number\@l@dtempcnta,####2|{\def\noexpand\rem@inder{####2}}}% + \sc@n@list\expandafter\sc@n@list\rem@inder|% + \ifx\rem@inder\empty\advance\@l@dtempcnta\@ne\fi + \fi + \ch@ck@l@ck + \fi + \ifnum\@l@dtempcnta=\@l@dtempcntb + \if@twocolumn + \if@firstcolumn + \gdef\l@dld@ta{\llap{{\leftlinenumR}}}% + \else + \gdef\l@drd@ta{\rlap{{\rightlinenumR}}}% + \fi + \else + \@l@dtempcntb=\line@marginR + \ifnum\@l@dtempcntb>\@ne + \advance\@l@dtempcntb by\page@numR + \fi + \ifodd\@l@dtempcntb + \gdef\l@drd@ta{\rlap{{\rightlinenumR}}}% + \else + \gdef\l@dld@ta{\llap{{\leftlinenumR}}}% + \fi + \fi + \else +%% #1% + \fi + \f@x@l@cks +\fi} + +\list@create{\inserts@listR} +\newcommand*{\add@insertsR}{% + \global\let\add@inserts@nextR=\relax + \ifx\inserts@listR\empty \else + \ifx\next@insertR\empty + \ifx\insertlines@listR\empty + \global\noteschanged@true + \gdef\next@insertR{100000}% + \else + \gl@p\insertlines@listR\to\next@insertR + \fi + \fi + \ifnum\next@insertR=\absline@numR + \gl@p\inserts@listR\to\@insertR + \@insertR + \global\let\@insertR=\undefined + \global\let\next@insertR=\empty + \global\let\add@inserts@nextR=\add@insertsR + \fi + \fi + \add@inserts@nextR} + +\newcommand*{\add@penaltiesL}{} +\newcommand*{\add@penaltiesR}{} + +\newcommand*{\flush@notesR}{% + \@xloop + \ifx\inserts@listR\empty \else + \gl@p\inserts@listR\to\@insertR + \@insertR + \global\let\@insertR=\undefined + \repeat} + +\renewcommand*{\Afootnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\vAfootnote{A}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\vAfootnote{A}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list + \global\advance\insert@count \@ne + \fi + \else + \vAfootnote{A}{{0|0|0|0|0|0|0}{}{#1}}% + \fi\ignorespaces} +\renewcommand*{\Bfootnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\vBfootnote{B}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\vBfootnote{B}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list + \global\advance\insert@count \@ne + \fi + \else + \vBfootnote{B}{{0|0|0|0|0|0|0}{}{#1}}% + \fi\ignorespaces} +\renewcommand*{\Cfootnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\vCfootnote{C}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\vCfootnote{C}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list + \global\advance\insert@count \@ne + \fi + \else + \vCfootnote{C}{{0|0|0|0|0|0|0}{}{#1}}% + \fi\ignorespaces} +\renewcommand*{\Dfootnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\vDfootnote{D}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\vDfootnote{D}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list + \global\advance\insert@count \@ne + \fi + \else + \vDfootnote{D}{{0|0|0|0|0|0|0}{}{#1}}% + \fi\ignorespaces} +\renewcommand*{\Efootnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\vEfootnote{E}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\vEfootnote{E}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list + \global\advance\insert@count \@ne + \fi + \else + \vEfootnote{E}{{0|0|0|0|0|0|0}{}{#1}}% + \fi\ignorespaces} + +\renewcommand*{\mpAfootnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\mpvAfootnote{A}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\mpvAfootnote{A}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list + \global\advance\insert@count \@ne + \fi + \else + \mpvAfootnote{A}{{0|0|0|0|0|0|0}{}{#1}}% + \fi\ignorespaces} +\renewcommand*{\mpBfootnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\mpvBfootnote{B}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\mpvBfootnote{B}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list + \global\advance\insert@count \@ne + \fi + \else + \mpvBfootnote{B}{{0|0|0|0|0|0|0}{}{#1}}% + \fi\ignorespaces} +\renewcommand*{\mpCfootnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\mpvCfootnote{C}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\mpvCfootnote{C}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list + \global\advance\insert@count \@ne + \fi + \else + \mpvCfootnote{C}{{0|0|0|0|0|0|0}{}{#1}}% + \fi\ignorespaces} +\renewcommand*{\mpDfootnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\mpvDfootnote{D}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\mpvDfootnote{D}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list + \global\advance\insert@count \@ne + \fi + \else + \mpvDfootnote{D}{{0|0|0|0|0|0|0}{}{#1}}% + \fi\ignorespaces} +\renewcommand*{\mpEfootnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\mpvEfootnote{E}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\mpvEfootnote{E}% + {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list + \global\advance\insert@count \@ne + \fi + \else + \mpvEfootnote{E}{{0|0|0|0|0|0|0}{}{#1}}% + \fi\ignorespaces} +\def\printlinesR#1|#2|#3|#4|#5|#6|#7|{\begingroup + \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}% + \ifl@d@pnum #1\fullstop\fi + \ifledplinenum \linenumr@p{#2}\Rlineflag\else \symplinenum\fi + \ifl@d@ssub \fullstop \sublinenumr@p{#3}\fi + \ifl@d@dash \endashchar\fi + \ifl@d@pnum #4\fullstop\fi + \ifl@d@elin \linenumr@p{#5}\Rlineflag\fi + \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumr@p{#6}\fi +\endgroup} + +\let\ledsavedprintlines\printlines + +\list@create{\labelref@listR} + +\renewcommand*{\edlabel}[1]{\@bsphack + \ifledRcol + \write\linenum@outR{\string\@lab}% + \ifx\labelref@listR\empty + \xdef\label@refs{\zz@@@}% + \else + \gl@p\labelref@listR\to\label@refs + \fi + \protected@write\@auxout{}% + {\string\l@dmake@labelsR\space\thepage|\label@refs|{#1}}% + \else + \write\linenum@out{\string\@lab}% + \ifx\labelref@list\empty + \xdef\label@refs{\zz@@@}% + \else + \gl@p\labelref@list\to\label@refs + \fi + \fi + \protected@write\@auxout{}% + {\string\l@dmake@labels\space\thepage|\label@refs|{#1}}% + \@esphack} + +\def\l@dmake@labelsR#1|#2|#3|#4{% + \expandafter\ifx\csname the@label#4\endcsname \relax\else + \led@warn@DuplicateLabel{#4}% + \fi + \expandafter\gdef\csname the@label#4\endcsname{#1|#2\Rlineflag|#3}% + \ignorespaces} +\AtBeginDocument{% + \def\l@dmake@labelsR#1|#2|#3|#4{}% +} + +\renewcommand*{\@lab}{% + \ifledRcol + \xright@appenditem{\linenumr@p{\line@numR}|% + \ifsublines@ \sublinenumr@p{\subline@numR}\else 0\fi}% + \to\labelref@listR + \else + \xright@appenditem{\linenumr@p{\line@num}|% + \ifsublines@ \sublinenumr@p{\subline@num}\else 0\fi}% + \to\labelref@list + \fi} + +\newcount\sidenote@marginR +\renewcommand*{\sidenotemargin}[1]{{% + \l@dgetsidenote@margin{#1}% + \ifnum\@l@dtempcntb>\m@ne + \ifledRcol + \global\sidenote@marginR=\@l@dtempcntb + \else + \global\sidenote@margin=\@l@dtempcntb + \fi + \fi}} +\sidenotemargin{right} +\global\sidenote@margin=\@ne + +\renewcommand*{\l@dlsnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\vl@dlsnote{{\l@d@nums}{\@tag}{#1}}}% + \to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\vl@dlsnote{{\l@d@nums}{\@tag}{#1}}}% + \to\inserts@list + \global\advance\insert@count \@ne + \fi + \fi\ignorespaces} +\renewcommand*{\l@drsnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\vl@drsnote{{\l@d@nums}{\@tag}{#1}}}% + \to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\vl@drsnote{{\l@d@nums}{\@tag}{#1}}}% + \to\inserts@list + \global\advance\insert@count \@ne + \fi + \fi\ignorespaces} +\renewcommand*{\l@dcsnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\vl@dcsnote{{\l@d@nums}{\@tag}{#1}}}% + \to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\vl@dcsnote{{\l@d@nums}{\@tag}{#1}}}% + \to\inserts@list + \global\advance\insert@count \@ne + \fi + \fi\ignorespaces} + +\newcommand*{\affixside@noteR}{% + \gdef\@templ@d{}% + \ifx\@templ@d\l@dcsnotetext \else + \if@twocolumn + \if@firstcolumn + \setl@dlp@rbox{}{}{\l@dcsnotetext}% + \else + \setl@drp@rbox{}{}{\l@dcsnotetext}% + \fi + \else + \@l@dtempcntb=\sidenote@marginR + \ifnum\@l@dtempcntb>\@ne + \ifl@dpaging + \advance\@l@dtempcntb by\@ne + \else + \advance\@l@dtempcntb by\page@num + \fi + \fi + \ifodd\@l@dtempcntb + \setl@drp@rbox{}{}{\l@dcsnotetext}% + \else + \setl@dlp@rbox{}{}{\l@dcsnotetext}% + \fi + \fi + \fi} + +\renewcommand{\l@dbfnote}[1]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\vl@dbfnote{{#1}}{\@thefnmark}}% + \to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\vl@dbfnote{{#1}}{\@thefnmark}}% + \to\inserts@list + \global\advance\insert@count \@ne + \fi + \fi\ignorespaces} + +\renewcommand{\normalbfnoteX}[2]{% + \ifnumberedpar@ + \ifledRcol + \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\@nameuse{thefootnote#1}}}% + \to\inserts@listR + \global\advance\insert@countR \@ne + \else + \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\@nameuse{thefootnote#1}}}% + \to\inserts@list + \global\advance\insert@count \@ne + \fi + \fi\ignorespaces} + + \chardef\next=\catcode`\& + \catcode`\&=\active + +\newenvironment{astanza}{% + \startstanzahook + \catcode`\&\active + \global\stanza@count\@ne + \ifnum\usenamecount{sza@0@}=\z@ + \let\stanza@hang\relax + \let\endlock\relax + \else +%%% \interlinepenalty\@M % this screws things up, but I don't know why + \rightskip\z@ plus 1fil\relax + \fi + \ifnum\usenamecount{szp@0@}=\z@ + \let\sza@penalty\relax + \fi + \def&{% + \endlock\mbox{}% + \sza@penalty + \global\advance\stanza@count\@ne + \@astanza@line}% + \def\&{% + \endlock\mbox{} + \pend + \endstanzaextra}% + \pstart + \@astanza@line +}{} + +\newcommand*{\@astanza@line}{% + \parindent=\csname sza@\number\stanza@count @\endcsname\stanzaindentbase + \par + \stanza@hang%\mbox{}% + \ignorespaces} + + \catcode`\&=\next + +\providecommand*{\newnamebox}[1]{% + \expandafter\newbox\csname #1\endcsname} +\providecommand*{\setnamebox}[1]{% + \expandafter\setbox\csname #1\endcsname} +\providecommand*{\unhnamebox}[1]{% + \expandafter\unhbox\csname #1\endcsname} +\providecommand*{\unvnamebox}[1]{% + \expandafter\unvbox\csname #1\endcsname} +\providecommand*{\namebox}[1]{% + \csname #1\endcsname} + +\providecommand*{\newnamecount}[1]{% + \expandafter\newcount\csname #1\endcsname} +\providecommand*{\usenamecount}[1]{% + \csname #1\endcsname} + +\newcount\l@dc@maxchunks +\newcommand{\maxchunks}[1]{\l@dc@maxchunks=#1} + \maxchunks{10} + +\newcount\l@dnumpstartsR + +\newcount\l@dpscL +\newcount\l@dpscR + +\newcommand*{\l@dsetuprawboxes}{% + \@l@dtempcntb=\l@dc@maxchunks + \loop\ifnum\@l@dtempcntb>\z@ + \newnamebox{l@dLcolrawbox\the\@l@dtempcntb} + \newnamebox{l@dRcolrawbox\the\@l@dtempcntb} + \advance\@l@dtempcntb \m@ne + \repeat} + +\newcommand*{\l@dsetupmaxlinecounts}{% + \@l@dtempcntb=\l@dc@maxchunks + \loop\ifnum\@l@dtempcntb>\z@ + \newnamecount{l@dmaxlinesinpar\the\@l@dtempcntb} + \advance\@l@dtempcntb \m@ne + \repeat} +\newcommand*{\l@dzeromaxlinecounts}{% + \begingroup + \@l@dtempcntb=\l@dc@maxchunks + \loop\ifnum\@l@dtempcntb>\z@ + \global\usenamecount{l@dmaxlinesinpar\the\@l@dtempcntb}=\z@ + \advance\@l@dtempcntb \m@ne + \repeat + \endgroup} + +\AtBeginDocument{% + \l@dsetuprawboxes + \l@dsetupmaxlinecounts + \l@dzeromaxlinecounts + \l@dnumpstartsL=\z@ + \l@dnumpstartsR=\z@ + \l@dpscL=\z@ + \l@dpscR=\z@} + +\newif\ifl@dusedbabel + \l@dusedbabelfalse +\newif\ifl@dsamelang + \l@dsamelangtrue +\newcommand*{\l@dchecklang}{% + \l@dsamelangfalse + \edef\@tempa{\theledlanguageL}\edef\@temp{\theledlanguageR}% + \ifx\@tempa\@tempb + \l@dsamelangtrue + \fi} + +\newcommand*{\l@dbbl@set@language}[1]{% + \edef\languagename{#1}% + \select@language{\languagename}% + \if@filesw + \protected@write\@auxout{}{\string\select@language{\languagename}}% + \addtocontents{toc}{\string\select@language{\languagename}}% + \addtocontents{lof}{\string\select@language{\languagename}}% + \addtocontents{lot}{\string\select@language{\languagename}}% + \fi} + +\providecommand{\selectlanguage}[1]{} +\newcommand*{\l@duselanguage}[1]{} +\gdef\theledlanguageL{} +\gdef\theledlanguageR{} + +\AtBeginDocument{% + \@ifundefined{bbl@main@language}{% + \l@dusedbabelfalse + \renewcommand*{\selectlanguage}[1]{}}{% + \l@dusedbabeltrue + \let\l@doldselectlanguage\selectlanguage + \let\l@doldbbl@set@language\bbl@set@language + \let\bbl@set@language\l@dbbl@set@language + \renewcommand{\selectlanguage}[1]{% + \l@doldselectlanguage{#1}% + \ifledRcol \gdef\theledlanguageR{#1}% + \else \gdef\theledlanguageL{#1}% + \fi} + \renewcommand*{\l@duselanguage}[1]{% + \l@doldselectlanguage{#1}} + \gdef\theledlanguageL{\bbl@main@language}% + \gdef\theledlanguageR{\bbl@main@language}% +}} +\newcommand*{\Columns}{% + \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else + \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}% + \fi + \begingroup + \l@dzeropenalties + \endgraf\global\num@lines=\prevgraf + \global\num@linesR=\prevgraf + \global\par@line=\z@ + \global\par@lineR=\z@ + \global\l@dpscL=\z@ + \global\l@dpscR=\z@ + \check@pstarts + \loop\if@pstarts + \global\advance\l@dpscL \@ne + \global\advance\l@dpscR \@ne + \checkraw@text + \l@dchecklang +{ \loop\ifaraw@text + \ifl@dsamelang + \do@lineL + \do@lineR + \else + \l@duselanguage{\theledlanguageL}% + \do@lineL + \l@duselanguage{\theledlanguageR}% + \do@lineR + \fi + \hb@xt@ \hsize{% + \unhbox\l@dleftbox + \hfill \columnseparator \hfill + \unhbox\l@drightbox + }% + \checkraw@text + \repeat} + \@writelinesinparL + \@writelinesinparR + \check@pstarts + \repeat + \flush@notes + \flush@notesR + \endgroup + \global\l@dpscL=\z@ + \global\l@dpscR=\z@ + \global\l@dnumpstartsL=\z@ + \global\l@dnumpstartsR=\z@ + \ignorespaces} + +\newcommand*{\columnseparator}{% + \smash{\rule[-0.2\baselineskip]{\columnrulewidth}{1.05\baselineskip}}} +\newdimen\columnrulewidth + \columnrulewidth=\z@ + +\newif\if@pstarts +\newcommand*{\check@pstarts}{% + \@pstartsfalse + \ifnum\l@dnumpstartsL>\l@dpscL + \@pstartstrue + \else + \ifnum\l@dnumpstartsR>\l@dpscR + \@pstartstrue + \fi + \fi} + +\newif\ifaraw@text + \araw@textfalse +\newcommand*{\checkraw@text}{% + \araw@textfalse + \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL} + \araw@texttrue + \else + \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR} + \araw@texttrue + \fi + \fi} + +\newcommand*{\@writelinesinparL}{% + \edef\next{% + \write\linenum@out{\string\@pend[\the\@donereallinesL]}}% + \next + \global\@donereallinesL \z@} +\newcommand*{\@writelinesinparR}{% + \edef\next{% + \write\linenum@outR{\string\@pendR[\the\@donereallinesR]}}% + \next + \global\@donereallinesR \z@} + +\newcount\numpagelinesL +\newcount\numpagelinesR +\newcount\l@dminpagelines + +\newcommand*{\Pages}{% + \typeout{} + \typeout{*************************** PAGES ***************************} + \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else + \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}% + \fi + \cleartol@devenpage + \begingroup + \l@dzeropenalties + \endgraf\global\num@lines=\prevgraf + \global\num@linesR=\prevgraf + \global\par@line=\z@ + \global\par@lineR=\z@ + \global\l@dpscL=\z@ + \global\l@dpscR=\z@ + \writtenlinesLfalse + \writtenlinesRfalse + \check@pstarts + \loop\if@pstarts + \global\advance\l@dpscL \@ne + \global\advance\l@dpscR \@ne + \getlinesfromparlistL + \getlinesfromparlistR + \l@dcalc@maxoftwo{\@cs@linesinparL}{\@cs@linesinparR}% + {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}% + \check@pstarts + \repeat + \global\l@dpscL=\z@ + \global\l@dpscR=\z@ + \getlinesfrompagelistL + \getlinesfrompagelistR + \l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}% + {\l@dminpagelines}% + \check@pstarts + \if@pstarts + \global\advance\l@dpscL \@ne + \global\advance\l@dpscR \@ne + \global\@donereallinesL=\z@ + \global\@donetotallinesL=\z@ + \global\@donereallinesR=\z@ + \global\@donetotallinesR=\z@ + \checkraw@text +{ \loop\ifaraw@text + \checkpageL + \l@duselanguage{\theledlanguageL}% +%%% \begingroup +{ \loop\ifl@dsamepage + \do@lineL + \advance\numpagelinesL \@ne + \hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}% + \get@nextboxL + \checkpageL + \repeat + \ifl@dpagefull + \@writelinesonpageL{\the\numpagelinesL}% + \else + \@writelinesonpageL{1000}% + \fi + \numpagelinesL \z@ + \clearl@dleftpage }% + \checkpageR + \l@duselanguage{\theledlanguageR}% +{ \loop\ifl@dsamepage + \do@lineR + \advance\numpagelinesR \@ne + \hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}% + \get@nextboxR + \checkpageR + \repeat + \ifl@dpagefull + \@writelinesonpageR{\the\numpagelinesR}% + \else + \@writelinesonpageR{1000}% + \fi + \numpagelinesR=\z@ + \clearl@drightpage} + \checkraw@text + \ifaraw@text + \getlinesfrompagelistL + \getlinesfrompagelistR + \l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}% + {\l@dminpagelines}% + \fi + \repeat} + \fi + \flush@notes + \flush@notesR + \endgroup + \global\l@dpscL=\z@ + \global\l@dpscR=\z@ + \global\l@dnumpstartsL=\z@ + \global\l@dnumpstartsR=\z@ + \ignorespaces} + +\newcommand*{\ledstrutL}{\strut} +\newcommand*{\ledstrutR}{\strut} + +\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} +\newcommand*{\clearl@dleftpage}{% + \clearpage + \ifodd\c@page\else + \led@err@LeftOnRightPage + \hbox{}% + \cleardoublepage + \fi} +\newcommand*{\clearl@drightpage}{% + \clearpage + \ifodd\c@page + \led@err@RightOnLeftPage + \hbox{}% + \cleartoevenpage + \fi} + +\newcommand*{\getlinesfromparlistL}{% + \ifx\linesinpar@listL\empty + \gdef\@cs@linesinparL{0}% + \else + \gl@p\linesinpar@listL\to\@cs@linesinparL + \fi} +\newcommand*{\getlinesfromparlistR}{% + \ifx\linesinpar@listR\empty + \gdef\@cs@linesinparR{0}% + \else + \gl@p\linesinpar@listR\to\@cs@linesinparR + \fi} + +\newcommand*{\getlinesfrompagelistL}{% + \ifx\linesonpage@listL\empty + \gdef\@cs@linesonpageL{1000}% + \else + \gl@p\linesonpage@listL\to\@cs@linesonpageL + \fi} +\newcommand*{\getlinesfrompagelistR}{% + \ifx\linesonpage@listR\empty + \gdef\@cs@linesonpageR{1000}% + \else + \gl@p\linesonpage@listR\to\@cs@linesonpageR + \fi} + +\newcommand*{\@writelinesonpageL}[1]{% + \edef\next{\write\linenum@out{\string\@lopL{#1}}}% + \next} +\newcommand*{\@writelinesonpageR}[1]{% + \edef\next{\write\linenum@outR{\string\@lopR{#1}}}% + \next} + +\newcommand*{\l@dcalc@maxoftwo}[3]{% + \ifnum #2>#1\relax + #3=#2\relax + \else + #3=#1\relax + \fi} +\newcommand*{\l@dcalc@minoftwo}[3]{% + \ifnum #2<#1\relax + #3=#2\relax + \else + #3=#1\relax + \fi} + +\newif\ifl@dsamepage + \l@dsamepagetrue +\newif\ifl@dpagefull +\newcommand*{\checkpageL}{% + \l@dpagefulltrue + \l@dsamepagetrue + \check@goal + \ifdim\pagetotal<\ledthegoal + \ifnum\numpagelinesL<\l@dminpagelines + \else + \l@dsamepagefalse + \l@dpagefullfalse + \fi + \else + \l@dsamepagefalse + \l@dpagefulltrue + \fi} +\newcommand*{\checkpageR}{% + \l@dpagefulltrue + \l@dsamepagetrue + \check@goal + \ifdim\pagetotal<\ledthegoal + \ifnum\numpagelinesR<\l@dminpagelines + \else + \l@dsamepagefalse + \l@dpagefullfalse + \fi + \else + \l@dsamepagefalse + \l@dpagefulltrue + \fi} + +\newdimen\ledthegoal +\newcommand*{\goalfraction}{0.9} +\newcommand*{\check@goal}{% + \ledthegoal=\goalfraction\pagegoal} + +\newif\ifwrittenlinesL +\newif\ifwrittenlinesR + +\newcommand*{\get@nextboxL}{% + \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}% box is not empty + \else% box is empty + \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>\@donetotallinesL + \else + \ifwrittenlinesL + \else + \@writelinesinparL + \writtenlinesLtrue + \fi + \ifnum\l@dnumpstartsL>\l@dpscL + \writtenlinesLfalse + \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}% + {\the\@donetotallinesL}% + {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}% + \global\@donetotallinesL \z@ + \global\advance\l@dpscL \@ne + \fi + \fi + \fi} +\newcommand*{\get@nextboxR}{% + \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% box is not empty + \else% box is empty + \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>\@donetotallinesR + \else + \ifwrittenlinesR + \else + \@writelinesinparR + \writtenlinesRtrue + \fi + \ifnum\l@dnumpstartsR>\l@dpscR + \writtenlinesRfalse + \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}% + {\the\@donetotallinesR}% + {\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}% + \global\@donetotallinesR \z@ + \global\advance\l@dpscR \@ne + \fi + \fi + \fi} + +\InputIfFileExists{ledparpatch.sty} + +\endinput +%% +%% End of file `ledpar.sty'. |