diff options
author | Karl Berry <karl@freefriends.org> | 2014-08-06 22:49:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-08-06 22:49:21 +0000 |
commit | 6dbec9cf98c5cc99c45848bbb37a207c2ae21160 (patch) | |
tree | 9a852286da25707be4379a9c2170ffe30783b8be /Master/texmf-dist/tex/latex/eledmac | |
parent | ff1845c8557690d905ecb126d40c90e611602de5 (diff) |
eledmac (6aug14)
git-svn-id: svn://tug.org/texlive/trunk@34854 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/eledmac')
-rw-r--r-- | Master/texmf-dist/tex/latex/eledmac/eledmac.sty | 1040 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/eledmac/eledpar.sty | 389 |
2 files changed, 1077 insertions, 352 deletions
diff --git a/Master/texmf-dist/tex/latex/eledmac/eledmac.sty b/Master/texmf-dist/tex/latex/eledmac/eledmac.sty index 60bf7019004..6c10b8364a8 100644 --- a/Master/texmf-dist/tex/latex/eledmac/eledmac.sty +++ b/Master/texmf-dist/tex/latex/eledmac/eledmac.sty @@ -23,8 +23,9 @@ %% This work consists of the files listed in the README file. + \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{eledmac}[2014/05/29 v1.11.1 LaTeX port of EDMAC] +\ProvidesPackage{eledmac}[2014/08/05 v1.12.0 LaTeX port of EDMAC]% \newif\ifledfinal \newif\ifparapparatus@ \newif\ifnoquotation@ @@ -47,6 +48,7 @@ \RequirePackage{suffix} \RequirePackage{xstring} \RequirePackage{ifluatex} +\RequirePackage{ragged2e} \ifcsdef{if@RTL}{}{\newif\if@RTL} \ifledfinal \newcommand*{\showlemma}[1]{#1} @@ -151,6 +153,7 @@ \pst@rtedLfalse \newcount\l@dnumpstartsL \newif\ifledRcol +\newif\ifledRcol@ \newif\ifnumberingR \newcommand*{\beginnumbering}{% \ifnumbering @@ -164,8 +167,16 @@ \line@list@stuff{\jobname.\extensionchars\the\section@num}% \l@dend@stuff \setcounter{pstart}{1} - \ifl@dpairing\else\begingroup\fi - \initnumbering@sectcmd + \ifl@dpairing + \global\l@dnumpstartsL \z@ + \global\pst@rtedLfalse + \else + \begingroup + \initnumbering@sectcmd + \fi + \gdef\eled@sections@@{} + \makeatletter\InputIfFileExists{\jobname.eledsec\the\section@num}{}{}\makeatother + \immediate\openout\eled@sectioning@out=\jobname.eledsec\the\section@num\relax } \newcommand*{\initnumbering@reg}{% \global\pst@rtedLfalse @@ -185,112 +196,6 @@ \resetprevpage@num } -\newcommand{\initnumbering@sectcmd}{ - \newcommand{\ledsection}[2][]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi%% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\section[##1]{##2}\leavevmode\vspace{2.3ex \@plus.2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \WithSuffix\newcommand\ledsection*[1]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\section*{##1}\leavevmode\vspace{2.3ex \@plus.2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \newcommand{\ledsubsection}[2][]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsection[##1]{##2}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \WithSuffix\newcommand\ledsubsection*[1]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsection*{##1}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \newcommand{\ledsubsubsection}[2][]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsubsection[##1]{##2}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \WithSuffix\newcommand\ledsubsubsection*[1]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsubsection*{##1}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \newcommand\ledchapter[2][]{\ifl@dmemoir\gdef\ch@pt@c{##1}\fi~\pend\skipnumbering\pstart\chapter[##1]{##2}\pend\pstart} - \WithSuffix\newcommand\ledchapter*[1]{~\pend\skipnumbering\pstart\chapter*{##1}\pend\pstart} - \patchcmd{\@makeschapterhead}{1\par}{1}{}{} - \pretocmd{\@makeschapterhead}{\par}{}{} - \apptocmd{\@makeschapterhead}{\par}{}{} - \patchcmd{\@makeschapterhead}{\vskip 40\p@}{}{}{} - \patchcmd{\@makechapterhead}{1\par}{1}{}{} - \pretocmd{\@makechapterhead}{\par}{}{} - \apptocmd{\@makechapterhead}{\par}{}{} - \patchcmd{\@makechapterhead}{\vskip 40\p@}{}{}{} - \apptocmd{\@chapter}{\par\leavevmode\vspace{40 \p@}\skipnumbering}{}{} - \apptocmd{\@schapter}{\par\leavevmode\vspace{40 \p@}\skipnumbering}{}{} - \newcommand\beforeledchapter{\pend\cleardoublepage\pstart} - \patchcmd{\chapter}{\cleardoublepage}{\relax}{}{} - \patchcmd{\chapter}{\clearpage}{\relax}{}{} - \ifnoquotation@\else - \renewcommand{\quotation}{\par\leavevmode% - \parindent=1.5em% - \skipnumbering% - \ifautopar% - \vskip-\parskip% - \else% - \vskip\topsep% - \fi% - \global\leftskip=\leftmargin% - \global\rightskip=\leftmargin% - } - \renewcommand{\endquotation}{\par% - \global\leftskip=0pt% - \global\rightskip=0pt% - \leavevmode% - \skipnumbering% - \ifautopar% - \vskip-\parskip% - \else% - \vskip\topsep% - \fi% - } - \renewcommand{\quote}{\par\leavevmode% - \parindent=0pt% - \skipnumbering% - \ifautopar% - \vskip-\parskip% - \else% - \vskip\topsep% - \fi% - \global\leftskip=\leftmargin% - \global\rightskip=\leftmargin% - } - \renewcommand{\endquote}{\par% - \global\leftskip=0pt% - \global\rightskip=0pt% - \leavevmode% - \skipnumbering% - \ifautopar% - \vskip-\parskip% - \else% - \vskip\topsep% - \fi% - } - \fi -} -\newcommand{\ledsectnotoc}{\let\addcontentsline\@gobblethree} \def\endnumbering{% \ifnumbering \global\numberingfalse @@ -311,7 +216,12 @@ \else \led@err@NumberingNotStarted \fi - \autoparfalse\ifl@dpairing\else\endgroup\fi} + \autoparfalse + \immediate\closeout\eled@sectioning@out + \ifl@dpairing\else + \endgroup + \fi +} \newcommand{\pausenumbering}{% \ifautopar\global\autopar@pausetrue\fi% \endnumbering\global\numberingtrue} @@ -324,6 +234,7 @@ \line@list@stuff{\jobname.\extensionchars\the\section@num}% \l@dend@stuff \begingroup + \initnumbering@sectcmd \else \led@err@NumberingShouldHaveStarted \endnumbering @@ -532,10 +443,10 @@ \begingroup}% } -\newcommand{\@l}[2]{% +\newcommand{\@nl}[2]{% \fix@page{#1}% - \@l@reg} -\newcommand*{\@l@reg}{% + \@nl@reg} +\newcommand*{\@nl@reg}{% \ifx\l@dchset@num\relax \else \advance\absline@num \@ne \set@line@action @@ -769,27 +680,25 @@ {\xifinlistcs{\the\absline@num}{l@prev@nopb}% {\xifinlistcs{\the\absline@num}{normal@page@break}% {\numgdef{\@next@page}{\thepage+1}% - \write\linenum@out{\string\@l[\@next@page][\@next@page]}% + \write\linenum@out{\string\@nl[\@next@page][\@next@page]}% }% - {\write\linenum@out{\string\@l[\the\c@page][\thepage]}}% + {\write\linenum@out{\string\@nl[\the\c@page][\thepage]}}% }% - {\write\linenum@out{\string\@l[\the\c@page][\thepage]}}}% + {\write\linenum@out{\string\@nl[\the\c@page][\thepage]}}}% {}% \IfStrEq{\led@pb@setting}{before}% - {% -\numdef{\next@absline}{\the\absline@num+1}% -\xifinlistcs{\next@absline}{l@prev@nopb}% - {\xifinlistcs{\the\absline@num}{normal@page@break}% - {% - \numgdef{\nc@page}{\c@page+1}% - \write\linenum@out{\string\@l[\nc@page][\nc@page]}% + {\numdef{\next@absline}{\the\absline@num+1}% + \xifinlistcs{\next@absline}{l@prev@nopb}% + {\xifinlistcs{\the\absline@num}{normal@page@break}% + {\numgdef{\nc@page}{\c@page+1}% + \write\linenum@out{\string\@nl[\nc@page][\nc@page]}% + }% + {\write\linenum@out{\string\n@l[\the\c@page][\thepage]}}% + }% + {\write\linenum@out{\string\@nl[\the\c@page][\thepage]}}% }% - {\write\linenum@out{\string\@l[\the\c@page][\thepage]}}% - }% - {\write\linenum@out{\string\@l[\the\c@page][\thepage]}}% -}% - {}% - \IfStrEqCase{\led@pb@setting}{{before}{\relax}{after}{\relax}}[\write\linenum@out{\string\@l[\the\c@page][\thepage]}]% + {}% + \IfStrEqCase{\led@pb@setting}{{before}{\relax}{after}{\relax}}[\write\linenum@out{\string\@nl[\the\c@page][\thepage]}]% } \newcommand*{\flag@start}{% @@ -938,14 +847,15 @@ \numberpstartfalse \newif\iflabelpstart \labelpstartfalse -\newcommand*{\pstart}{% -\if@nobreak% - \let\@oldnobreak\@nobreaktrue% -\else% - \let\@oldnobreak\@nobreakfalse% -\fi% -\@nobreaktrue% -\ifnumbering \else% +\newcommandx*{\pstart}[1][1]{% + \ifstrempty{#1}{}{\noindent#1}% + \if@nobreak% + \let\@oldnobreak\@nobreaktrue% + \else% + \let\@oldnobreak\@nobreakfalse% + \fi% + \@nobreaktrue% + \ifnumbering \else% \led@err@PstartNotNumbered% \beginnumbering% \fi% @@ -956,6 +866,7 @@ \list@clear{\inserts@list}% \global\let\next@insert=\empty% \begingroup\normal@pars% + \global\advance \l@dnumpstartsL\@ne \global\setbox\raw@text=\vbox\bgroup% \ifautopar\else% \ifnumberpstart% @@ -968,9 +879,10 @@ \fi% \numberedpar@true% \iflabelpstart\protected@edef\@currentlabel% - {\p@pstart\thepstart}\fi% + {\p@pstart\thepstart} + \fi% } -\newcommand*{\pend}{\ifnumbering \else% +\newcommandx*{\pend}[1][1]{\ifnumbering \else% \led@err@PendNotNumbered% \fi% \ifnumberedpar@ \else% @@ -994,7 +906,9 @@ \pstartnumtrue% \fi% \@oldnobreak% - \addtocounter{pstart}{1}} + \addtocounter{pstart}{1}% + \ifstrempty{#1}{}{\noindent#1}% +} \newcommand*{\l@dzeropenalties}{% \brokenpenalty \z@ \clubpenalty \z@ @@ -1041,19 +955,43 @@ \fi \check@pb@in@verse \affixline@num - \affixpstart@num - \hb@xt@ \linewidth{\do@insidelinehook\l@dld@ta\add@inserts\affixside@note - \l@dlsn@te - {\ledllfill\hb@xt@ \wd\one@line{\new@line\inserthangingsymbol\l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta% - \l@drsn@te - }} + \add@inserts\affixside@note + \xifinlist{\the\l@dnumpstartsL}{\eled@sections@@}% + {\print@eledsection}% + {\print@line}% \IfStrEq{\led@pb@setting}{after}{\led@check@pb\led@check@nopb}{} }% +\def\print@line{ + \affixpstart@num% + \hb@xt@ \linewidth{\do@insidelinehook\l@dld@ta + \l@dlsn@te + {\ledllfill\hb@xt@ \wd\one@line{\new@line\inserthangingsymbol \l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta% + \l@drsn@te + }}% +} +\def\print@eledsection{% + \numdef{\temp@}{\l@dnumpstartsL-1}% + \xifinlist{\temp@}{\eled@sections@@}{\@nobreaktrue}{\@nobreakfalse}% + \@eled@sectioningtrue% + \csuse{eled@sectioning@\the\l@dnumpstartsL}% + \@eled@sectioningfalse% + \global\csundef{eled@sectioning@\the\l@dnumpstartsL}% + \if@RTL% + \hspace{-\paperwidth}% + {\hbox{\l@dunhbox@line{\one@line}}\new@line}% + \else% + \hspace{\paperwidth}% + {\new@line \hbox{\l@dunhbox@line{\one@line}}}% + \fi% + \vskip-\baselineskip% +} \newcommand*{\do@linehook}{} \newcommand*{\do@insidelinehook}{} \newcommand*{\l@demptyd@ta}{% \gdef\l@dld@ta{}% \gdef\l@drd@ta{}% + \gdef\l@dcsnotetext@l{}% + \gdef\l@dcsnotetext@r{}% \gdef\l@dcsnotetext{}} \newcommand{\l@dlsn@te}{% @@ -1556,7 +1494,9 @@ }% \vskip\skip\csname #1footins\endcsname% \leftskip0pt \rightskip0pt - \csname #1footnoterule\endcsname\noindent\leavevmode} + \csname #1footnoterule\endcsname% + \vskip\csuse{afterXrule@#1}% + \noindent\leavevmode} \let\normalfootnoterule=\footnoterule \newcommand*{\normalfootgroup}[1]{{\csuse{Xnotefontsize@#1}\noindent\csuse{txtbeforeXnotes@#1}}\unvbox\csname #1footins\endcsname} @@ -1571,9 +1511,11 @@ \ifl@dpairing% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \setlength{\parindent}{0pt} {\csuse{Xnotefontsize@#1}\csuse{txtbeforeXnotes@#1}} @@ -1615,10 +1557,14 @@ \expandafter\let\csname #1footfmt\endcsname=\parafootfmt \expandafter\let\csname #1footgroup\endcsname=\para@footgroup \count\csname #1footins\endcsname=1000 + \dimen\csname #1footins\endcsname=\csuse{maxhXnotes@#1} + \skip\csname #1footins\endcsname=\csuse{beforeXnotes@#1} \para@footsetup{#1} \expandafter\let\csname mpv#1footnote\endcsname=\mppara@vfootnote \expandafter\let\csname mp#1footgroup\endcsname=\mppara@footgroup \count\csname mp#1footins\endcsname=1000 + \dimen\csname mp#1footins\endcsname=\csuse{maxhXnotes@#1} + \skip\csname mp#1footins\endcsname=\csuse{beforeXnotes@#1} } \providecommand{\footfudgefiddle}{64} \newcommand*{\para@footsetup}[1]{{\csuse{Xnotefontsize@#1} @@ -1638,7 +1584,9 @@ {}% }% \vskip\skip\csname #1footins\endcsname% - \csname #1footnoterule\endcsname\noindent\leavevmode} + \csname #1footnoterule\endcsname% + \vskip\csuse{afterXrule@#1}% + \noindent\leavevmode} \newcommand*{\para@vfootnote}[2]{% \insert\csname #1footins\endcsname \bgroup @@ -1690,6 +1638,8 @@ #3\penalty-10 } \newcommand*{\para@footgroup}[1]{% \unvbox\csname #1footins\endcsname + \ifcsstring{Xragged@#1}{L}{\RaggedLeft}{}% + \ifcsstring{Xragged@#1}{R}{\RaggedRight}{}% \makehboxofhboxes \setbox0=\hbox{{\csuse{Xnotefontsize@#1}\csuse{txtbeforeXnotes@#1}}\unhbox0 \removehboxes}% \csuse{Xnotefontsize@#1} @@ -1706,11 +1656,15 @@ \ifl@dpairing% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \unvbox\csname mp#1footins\endcsname + \ifcsstring{Xragged@#1}{L}{\RaggedLeft}{}% + \ifcsstring{Xragged@#1}{R}{\RaggedRight}{}% \makehboxofhboxes \setbox0=\hbox{{\csuse{Xnotefontsize@#1}\csuse{txtbeforeXnotes@#1}}\unhbox0 \removehboxes}% \csuse{Xnotefontsize@#1} @@ -1806,9 +1760,11 @@ \ifl@dpairing% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% {\csuse{Xnotefontsize@#1}\noindent\csuse{txtbeforeXnotes@#1}}\par \splittopskip=\ht\strutbox @@ -1868,9 +1824,11 @@ \ifl@dpairing% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% {\csuse{Xnotefontsize@#1}\noindent\csuse{txtbeforeXnotes@#1}}\par \splittopskip=\ht\strutbox @@ -1984,7 +1942,8 @@ \vskip\skip\csname footins#1\endcsname% \leftskip=\z@ \rightskip=\z@ - \@nameuse{footnoterule#1}} + \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}} \let\normalfootnoteruleX=\footnoterule @@ -2002,9 +1961,11 @@ \ifl@dpairing% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \unvbox\@nameuse{mpfootins#1}} @@ -2102,9 +2063,11 @@ \ifl@dpairing% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \splittopskip=\ht\strutbox \expandafter @@ -2163,9 +2126,11 @@ \ifl@dpairing% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \splittopskip=\ht\strutbox \expandafter @@ -2180,9 +2145,13 @@ \expandafter\let\csname footgroup#1\endcsname=\para@footgroupX \expandafter\let\csname footnoterule#1\endcsname=\normalfootnoteruleX \count\csname footins#1\endcsname=1000 + \dimen\csname footins#1\endcsname=\csuse{maxhnotesX@#1} + \skip\csname footins#1\endcsname=\csuse{beforenotesX@#1} \expandafter\let\csname mpvfootnote#1\endcsname=\mppara@vfootnoteX \expandafter\let\csname mpfootgroup#1\endcsname=\mppara@footgroupX \count\csname mpfootins#1\endcsname=1000 + \dimen\csname mpfootins#1\endcsname=\csuse{maxhnotesX@#1} + \skip\csname mpfootins#1\endcsname=\csuse{beforenotesX@#1} \para@footsetupX{#1}} \newcommand*{\para@footsetupX}[1]{{\csuse{notefontsizeX@#1} @@ -2205,7 +2174,9 @@ \rightskip=\z@ \parindent=\z@ \vskip\skip\@nameuse{footins#1}% - \@nameuse{footnoterule#1}} + \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% + } \newcommand*{\para@vfootnoteX}[2]{% \insert\csname footins#1\endcsname @@ -2246,6 +2217,8 @@ \newcommand*{\para@footgroupX}[1]{% \unvbox\csname footins#1\endcsname + \ifcsstring{raggedX@#1}{L}{\RaggedLeft}{}% + \ifcsstring{raggedX@#1}{R}{\RaggedRight}{}% \makehboxofhboxes \setbox0=\hbox{\unhbox0 \removehboxes}% \csuse{notefontsizeX@#1} @@ -2262,11 +2235,15 @@ \ifl@dpairing% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \unvbox\csname mpfootins#1\endcsname + \ifcsstring{raggedX@#1}{L}{\RaggedLeft}{}% + \ifcsstring{raggedX@#1}{R}{\RaggedRight}{}% \makehboxofhboxes \setbox0=\hbox{\unhbox0 \removehboxes}% \csuse{notefontsizeX@#1} @@ -2375,10 +2352,12 @@ \newcommand{\newseries@}[1]{ \xifinlist{#1}{\@series}{\eledmac@warning{Series #1 is still existing !}} {% -\newtoggle{Xlemmadisablefontselection@#1} -\newtoggle{Xendlemmadisablefontselection@#1} + \newtoggle{Xlemmadisablefontselection@#1} + \newtoggle{Xendlemmadisablefontselection@#1} \csgdef{Xhangindent@#1}{0pt}% - \csgdef{hangindentX@#1}{0pt} + \csgdef{hangindentX@#1}{0pt}% + \csgdef{Xragged@#1}{}% + \csgdef{raggedX@#1}{}% \csgdef{hsizetwocol@#1}{0.45 \hsize}% \csgdef{hsizetwocolX@#1}{0.45 \hsize}% \csgdef{hsizethreecol@#1}{.3 \hsize}% @@ -2414,6 +2393,8 @@ \csgdef{parafootsep@#1}{\parafootftmsep}% \csgdef{beforeXnotes@#1}{1.2em \@plus .6em \@minus .6em} \csgdef{beforenotesX@#1}{1.2em \@plus .6em \@minus .6em} + \csgdef{afterXrule@#1}{0pt} + \csgdef{afterruleX@#1}{0pt} \csgdef{txtbeforeXnotes@#1}{} \csgdef{maxhnotesX@#1}{\ledfootinsdim}% \csgdef{maxhXnotes@#1}{\ledfootinsdim} @@ -2538,6 +2519,10 @@ \newhookcommand@series{hangindentX} +\newhookcommand@series{Xragged} + +\newhookcommand@series{raggedX} + \newhookcommand@series{hsizetwocol} \newhookcommand@series{hsizethreecol} @@ -2594,6 +2579,10 @@ \newhookcommand@series{txtbeforeXnotes} +\newhookcommand@series{afterruleX} + +\newhookcommand@series{afterXrule} + \newcommand{\newhookcommand@series@reload}[1]{% \global\expandafter\newcommand\expandafter*\csname #1\endcsname[2][]{% \csuse{setcommand@series}{##1}{#1}{##2}[reload] @@ -2890,6 +2879,7 @@ \fi \protected@write\@auxout{}% {\string\l@dmake@labels\space\thepage|\label@refs|\the\c@pstart|{#1}}% + \ifcsdef{hypertarget}{\hypertarget{#1}{}}{}% \@esphack} \newcounter{line}% @@ -2923,17 +2913,23 @@ {\linenumrep{\line@num}|% \ifsublines@ \sublinenumrep{\subline@num}\else 0\fi}\to\labelref@list} -\newcommand*{\edpageref}[1]{\l@dref@undefined{#1}\l@dgetref@num{1}{#1}} +\newcommand{\wrap@edcrossref}[2]{% + \ifdef{\hyperlink}% + {\hyperlink{#1}{#2}}% + {#2} +} +\newcommand*{\edpageref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{1}{#1}}} \newcommand*{\xpageref}[1]{\l@dgetref@num{1}{#1}} -\newcommand*{\lineref}[1]{\l@dref@undefined{#1}\l@dgetref@num{2}{#1}} +\newcommand*{\lineref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{2}{#1}}} \newcommand*{\xlineref}[1]{\l@dgetref@num{2}{#1}} -\newcommand*{\sublineref}[1]{\l@dref@undefined{#1}\l@dgetref@num{3}{#1}} +\newcommand*{\sublineref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{3}{#1}}} \newcommand*{\xsublineref}[1]{\l@dgetref@num{3}{#1}} -\newcommand*{\pstartref}[1]{\l@dref@undefined{#1}\l@dgetref@num{4}{#1}} +\newcommand*{\pstartref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{4}{#1}}} \newcommand*{\xpstartref}[1]{\l@dgetref@num{4}{#1}} + \newcommand*{\l@dref@undefined}[1]{% \expandafter\ifx\csname the@label#1\endcsname\relax \led@warn@RefUndefined{#1}% @@ -2986,7 +2982,11 @@ \newcommand*{\sidenotemargin}[1]{{% \l@dgetsidenote@margin{#1}% \ifnum\@l@dtempcntb>\m@ne - \global\sidenote@margin=\@l@dtempcntb + \ifledRcol + \global\sidenote@marginR=\@l@dtempcntb + \else + \global\sidenote@margin=\@l@dtempcntb + \fi \fi}} \newcommand*{\l@dgetsidenote@margin}[1]{% \def\@tempa{#1}\def\@tempb{left}% @@ -3025,36 +3025,108 @@ \newcommand*{\ledleftnote}[1]{\edtext{}{\l@dlsnote{#1}}} \newcommand*{\ledrightnote}[1]{\edtext{}{\l@drsnote{#1}}} -\newcommand*{\ledsidenote}[1]{\edtext{}{\l@dcsnote{#1}}} +\newcommand*{\ledinnernote}[1]{% + \ifodd\page@num% + \ledleftnote{#1}% + \else% + \ledrightnote{#1}% + \fi% +} + +\newcommand*{\ledouternote}[1]{% + \ifodd\page@num% + \ledrightnote{#1}% + \else% + \ledleftnote{#1}% + \fi% +} + +\newcommand*{\ledsidenote}[1]{\edtext{}{\l@dcsnote{#1}}} \newif\ifrightnoteup \rightnoteuptrue + \newcommand*{\l@dlsnote}[1]{% \begingroup% \newcommand{\content}{#1}% \ifnumberedpar@ - \xright@appenditem{\noexpand\vl@dlsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne + \ifledRcol% + \xright@appenditem{\noexpand\vl@dlsnote{\csexpandonce{content}}}% + \to\inserts@listR + \global\advance\insert@countR \@ne% + \else% + \xright@appenditem{\noexpand\vl@dlsnote{\csexpandonce{content}}}% + \to\inserts@list + \global\advance\insert@count \@ne% + \fi \fi\ignorespaces\endgroup} + \newcommand*{\l@drsnote}[1]{% \begingroup% \newcommand{\content}{#1}% \ifnumberedpar@ - \xright@appenditem{\noexpand\vl@drsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne + \ifledRcol% + \xright@appenditem{\noexpand\vl@drsnote{\csexpandonce{content}}}% + \to\inserts@listR + \global\advance\insert@countR \@ne% + \else% + \xright@appenditem{\noexpand\vl@drsnote{\csexpandonce{content}}}% + \to\inserts@list + \global\advance\insert@count \@ne% + \fi \fi\ignorespaces\endgroup} -\newcommand*{\l@dcsnote}[1]{\begingroup% + +\newcommand*{\l@dcsnote}[1]{% + \begingroup% \newcommand{\content}{#1}% \ifnumberedpar@ - \xright@appenditem{\noexpand\vl@dcsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne + \ifledRcol% + \xright@appenditem{\noexpand\vl@dcsnote{\csexpandonce{content}}}% + \to\inserts@listR + \global\advance\insert@countR \@ne% + \else% + \xright@appenditem{\noexpand\vl@dcsnote{\csexpandonce{content}}}% + \to\inserts@list + \global\advance\insert@count \@ne% + \fi \fi\ignorespaces\endgroup} -\newcommand*{\vl@dlsnote}[1]{\setl@dlp@rbox{#1}} -\newcommand*{\vl@drsnote}[1]{\setl@drp@rbox{#1}} +\newcommand*{\vl@dlsnote}[1]{% + \ifledRcol@% + \@l@dtempcntb=\sidenote@marginR% + \ifnum\@l@dtempcntb>\@ne% + \advance\@l@dtempcntb by\page@numR% + \fi% + \else% + \@l@dtempcntb=\sidenote@margin% + \ifnum\@l@dtempcntb>\@ne% + \advance\@l@dtempcntb by\page@num% + \fi% + \fi% + \ifodd\@l@dtempcntb% + \listgadd{\l@dcsnotetext@l}{#1}% + \else% + \listgadd{\l@dcsnotetext}{#1}% + \fi +} +\newcommand*{\vl@drsnote}[1]{% + \ifledRcol@% + \@l@dtempcntb=\sidenote@marginR% + \ifnum\@l@dtempcntb>\@ne% + \advance\@l@dtempcntb by\page@numR% + \fi% + \else% + \@l@dtempcntb=\sidenote@margin% + \ifnum\@l@dtempcntb>\@ne% + \advance\@l@dtempcntb by\page@num% + \fi% + \fi% + \ifodd\@l@dtempcntb% + \listgadd{\l@dcsnotetext}{#1}% + \else% + \listgadd{\l@dcsnotetext@r}{#1}% + \fi% +} \newcommand*{\vl@dcsnote}[1]{\listgadd{\l@dcsnotetext}{#1}} \newcommand*{\setl@dlp@rbox}[1]{% @@ -3104,21 +3176,32 @@ \fi% \ifodd\@l@dtempcntb% \setl@drp@rbox{\sidenotecontent@}% + \gdef\sidenotecontent@{}% + \numdef{\itemcount@}{0}% + \dolistloop{\l@dcsnotetext@l}% + \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space leftnotes on line \the\line@num\space p. \the\page@num,}}{}% + \setl@dlp@rbox{\sidenotecontent@}% \else% \setl@dlp@rbox{\sidenotecontent@}% + \gdef\sidenotecontent@{}% + \numdef{\itemcount@}{0}% + \dolistloop{\l@dcsnotetext@r}% + \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space rightnotes on line \the\line@num\space p. \the\page@num,}}{}% + \setl@drp@rbox{\sidenotecontent@}% \fi% \fi% -\fi} + \fi% +} \newcommand*{\l@dfeetbeginmini}{\l@dedbeginmini\l@dfambeginmini} \newcommand*{\l@dfeetendmini}{% -\IfStrEq{critical-familiar}{\@mpfnpos}% -{\l@dedendmini\l@dfamendmini}% -{% -\IfStrEq{familiar-critical}{\@mpfnpos}% -{\l@dfamendmini\l@dedendmini}% -{\l@dedendmini\l@dfamendmini}% -}% -}% + \IfStrEq{critical-familiar}{\@mpfnpos}% + {\l@dedendmini\l@dfamendmini}% + {% + \IfStrEq{familiar-critical}{\@mpfnpos}% + {\l@dfamendmini\l@dedendmini}% + {\l@dedendmini\l@dfamendmini}% + }% + }% \newcommand*{\l@dedbeginmini}{% \def\do##1{\csletcs{v##1footnote}{mpv##1footnote}}% \dolistloop{\@series}% @@ -3241,6 +3324,13 @@ \newif\ifledgroupnotesL@ \newif\ifledgroupnotesR@ +\newif\ifeledmac@after@imakeidx@ +\@ifpackageloaded{imakeidx}{\eledmac@after@imakeidx@true}{} +\AtBeginDocument{% + \ifeledmac@after@imakeidx@\else% + \@ifpackageloaded{imakeidx}{\eledmac@error{Imakeidx must be loaded before eledmac.}}{}% + \fi +} \newcommand{\pagelinesep}{-} \newcommand{\edindexlab}{$&} \newcounter{labidx} @@ -3250,7 +3340,7 @@ \edlabel{\edindexlab\thelabidx}} \newcommand{\thepageline}{% - \thepage\pagelinesep\lineref{\edindexlab\thelabidx}} + \thepage\pagelinesep\xlineref{\edindexlab\thelabidx}} \newcommand{\thestartpageline}{\l@dparsedstartpage\pagelinesep\l@dparsedstartline} \newcommand{\theendpageline}{\l@dparsedendpage\pagelinesep\l@dparsedendline} \newif\if@edindex@fornote@ @@ -3258,7 +3348,21 @@ \l@dp@rsefootspec#1|% \@edindex@fornote@true } -\def\get@index@command#1|#2{\gdef\@index@command{#2}\gdef\@index@txt{#1}} +\def\get@index@command#1|#2+{% + \gdef\@index@txt{#1}% + \gdef\@index@command{#2}% + \xdef\@index@parenthesis{}% + \IfBeginWith{\@index@command}{(}{% + \StrGobbleLeft{\@index@command}{1}[\@index@command@]% + \global\let\@index@command\@index@command@% + \xdef\@index@parenthesis{(}% + }{}% + \IfBeginWith{\@index@command}{)}{% + \StrGobbleLeft{\@index@command}{1}[\@index@command@]% + \global\let\@index@command\@index@command@% + \xdef\@index@parenthesis{)}% + }{}% +} \newcommand{\ledinnote}[2]{\csuse{#1}{#2\emph{n}}} \newcommand{\ledinnotehyperpage}[2]{\csuse{#1}{\hyperpage{#2}\emph{n}}} \@ifclassloaded{memoir}{% @@ -3326,18 +3430,19 @@ \@sanitize \@wredindex}}{}{} \newcommand{\edindex}[1]{\@bsphack\@esphack} - \newcommandx{\@wredindex}[2][1=\jobname,usedefault]{%#1 = the index name, #2 = the text + \newcommandx{\@wredindex}[2][1=\expandonce\jobname,usedefault]{%#1 = the index name, #2 = the text \ifl@imakeidx% \if@edindex@fornote@% - \IfSubStr[1]{#2}{|}{\get@index@command#2}{\get@index@command#2|}% + \IfSubStr[1]{#2}{|}{\get@index@command#2+}{\get@index@command#2|+}% \expandafter\imki@wrindexentry{#1}{\@index@txt|(ledinnote{\@index@command}}{\thestartpageline}% \expandafter\imki@wrindexentry{#1}{\@index@txt|)ledinnote{\@index@command}}{\theendpageline}% \else% - \imki@wrindexentry{#1}{#2}{\thepageline}% + \get@edindex@hyperref{#2}% + \imki@wrindexentry{#1}{\@index@txt\@edindex@hyperref}{\thepageline}% \fi% \else% \if@edindex@fornote@% - \IfSubStr[1]{#2}{|}{\get@index@command#2}{\get@index@command#2|}% + \IfSubStr[1]{#2}{|}{\get@index@command#2+}{\get@index@command#2|+}% \expandafter\protected@write\@indexfile{}% {\string\indexentry{\@index@txt|(ledinnote{\@index@command}}{\thestartpageline} }% @@ -3354,10 +3459,27 @@ \@esphack} } +\newcommand{\hyperlinkformat}[3]{% + \ifstrempty{#1}% + {\hyperlink{#2}{#3}}% + {\csuse{#1}{\hyperlink{#2}{#3}}% + }} +\newcommand{\get@edindex@hyperref}[1]{% + \ifcsdef{hyperlink}% + {\IfSubStr{#1}{|}% + {\get@index@command#1+% + \gdef\@edindex@hyperref{|\@index@parenthesis % + hyperlinkformat{\@index@command} + {\edindexlab\thelabidx}}}% + {\get@index@command#1|+ + \gdef\@edindex@hyperref{|hyperlink{\edindexlab\thelabidx}}}% + }% + {\gdef\@edindex@hyperref{}}% +} \AtBeginDocument{\@ifpackageloaded{hyperref}{}{% \def\l@d@@wrindexhyp#1||\\{% \ifshowindexmark\@showidx{#1}\fi - \IfSubStr[1]{#1}{|}{\get@index@command#1}{\get@index@command#1|}% + \IfSubStr[1]{#1}{|}{\get@index@command#1+}{\get@index@command#1|+}% \if@edindex@fornote@% \protected@write\@auxout{}% {\string\@@wrindexm@m{\@idxfile}{\@index@txt|(ledinnote{\@index@command}}{\thestartpageline}}% @@ -3446,7 +3568,7 @@ \stanza@modulo\@ne \fi } -\def\stanza@line{ +\newcommandx{\stanza@line}[1][1]{ \ifnum\value{stanzaindentsrepetition}=0 \parindent=\csname sza@\number\stanza@count @\endcsname\stanzaindentbase @@ -3455,7 +3577,7 @@ @\endcsname\stanzaindentbase \managestanza@modulo \fi - \pstart\stanza@hang\ignorespaces} + \pstart[#1]\stanza@hang\ignorespaces} \xdef\stanza@hang{\noexpand\leavevmode\noexpand\startlock \hangindent\expandafter \noexpand\csname sza@0@\endcsname\stanzaindentbase @@ -3465,26 +3587,41 @@ \penalty\fi\count@} \let\startstanzahook\relax \let\endstanzaextra\relax -\xdef\stanza{\noexpand\instanzatrue\expandafter - \begingroup\startstanzahook% - \catcode`\noexpand\&\active% - \global\stanza@count\@ne\stanza@modulo\@ne - \noexpand\ifnum\expandafter\noexpand - \csname sza@0@\endcsname=\z@\let\noexpand\stanza@hang\relax - \let\noexpand\endlock\relax\noexpand\else\interlinepenalty - \@M\rightskip\z@ plus 1fil\relax\noexpand\fi\noexpand\ifnum - \expandafter\noexpand\csname szp@0@\endcsname=\z@ - \let\noexpand\sza@penalty\relax\noexpand\fi% +\xdef\@startstanza[#1]{% + \noexpand\instanzatrue\expandafter + \begingroup\startstanzahook% + \catcode`\noexpand\&\active% + \global\stanza@count\@ne\stanza@modulo\@ne + \noexpand\ifnum\expandafter\noexpand + \csname sza@0@\endcsname=\z@\let\noexpand\stanza@hang\relax + \let\noexpand\endlock\relax\noexpand\else\interlinepenalty + \@M\rightskip\z@ plus 1fil\relax\noexpand\fi\noexpand\ifnum + \expandafter\noexpand\csname szp@0@\endcsname=\z@ + \let\noexpand\sza@penalty\relax\noexpand\fi% \def\noexpand\falseverse{% + \noexpand\eledmac@warning{\string\falseverse\space deprecated. Look at \string\newverse\space instead.} \global\advance\stanza@modulo-\@ne% \global\advance\stanza@count-\@ne% \relax\noexpand&\leavevmode\skipnumbering} - \def\noexpand&{% - \noexpand\endlock\noexpand\pend\noexpand\sza@penalty\global% - \advance\stanza@count\@ne\noexpand\stanza@line}% - \def\noexpand% - \&{\noexpand\endlock\noexpand\pend\endgroup\noexpand\instanzafalse\expandafter\endstanzaextra}% - \noexpand\stanza@line} + \def\noexpand&{% + \noexpand\newverse[][]}% + \def\noexpand\&{\noexpand\@stopstanza}% + \noexpand\stanza@line[#1]} + +\newcommandx{\stanza}[1][1,usedefault]{\@startstanza[#1]} + +\newcommandx{\@stopstanza}[1][1,usedefault]{% + \endlock% + \pend[#1]% + \endgroup% + \instanzafalse% + \endstanzaextra% +} + +\newcommandx*{\newverse}[2][1,2,usedefault]{% + \endlock\pend[#1]\sza@penalty\global% + \advance\stanza@count\@ne\stanza@line[#2]% + } \newcommand*{\flagstanza}[2][\stanzaindentbase]{% \hskip -#1\llap{#2}\hskip #1\ignorespaces} @@ -4107,6 +4244,499 @@ \usingedtext +\newcommand{\initnumbering@sectcmd}{ + \newcommand{\ledsection}[2][]{\eledmac@warning{\string\ledsection\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi%% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\section[##1]{##2}\leavevmode\vspace{2.3ex \@plus.2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \WithSuffix\newcommand\ledsection*[1]{\eledmac@warning{\string\ledsection*\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\section*{##1}\leavevmode\vspace{2.3ex \@plus.2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \newcommand{\ledsubsection}[2][]{\eledmac@warning{\string\ledsubsection*\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsection[##1]{##2}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \WithSuffix\newcommand\ledsubsection*[1]{\eledmac@warning{\string\ledsubsection*\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsection*{##1}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \newcommand{\ledsubsubsection}[2][]{\eledmac@warning{\string\ledsubsubsection*\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsubsection[##1]{##2}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \WithSuffix\newcommand\ledsubsubsection*[1]{\eledmac@warning{\string\ledsubsubsection*\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsubsection*{##1}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \newcommand\ledchapter[2][]{% + \eledmac@warning{\string\ledchapter\space deprecated}% + \ifl@dmemoir% + \gdef\ch@pt@c{##1}% + \fi% + ~\pend\skipnumbering% + \pstart% + \@patchforledchapter\chapter[##1]{##2}% + \pend\pstart} + \WithSuffix\newcommand\ledchapter*[1]{% + \eledmac@warning{\string\ledchapter*\space deprecated}% + ~\pend\skipnumbering% + \pstart% + \@patchforledchapter\chapter*{##1}\pend% + \pstart} + \def\@patchforledchapter{ + \patchcmd{\@makeschapterhead}{1\par}{1}{}{} + \pretocmd{\@makeschapterhead}{\par}{}{} + \apptocmd{\@makeschapterhead}{\par}{}{} + \patchcmd{\@makeschapterhead}{\vskip 40\p@}{}{}{} + \patchcmd{\@makechapterhead}{1\par}{1}{}{} + \pretocmd{\@makechapterhead}{\par}{}{} + \apptocmd{\@makechapterhead}{\par}{}{} + \patchcmd{\@makechapterhead}{\vskip 40\p@}{}{}{} + \apptocmd{\@chapter}{\par\leavevmode\vspace{40 \p@}\skipnumbering}{}{} + \apptocmd{\@schapter}{\par\leavevmode\vspace{40 \p@}\skipnumbering}{}{} + \newcommand\beforeledchapter{\pend\cleardoublepage\pstart} + \patchcmd{\chapter}{\cleardoublepage}{\relax}{}{} + \patchcmd{\chapter}{\clearpage}{\relax}{}{} + } + \ifnoquotation@\else + \renewcommand{\quotation}{\par\leavevmode% + \parindent=1.5em% + \skipnumbering% + \ifautopar% + \vskip-\parskip% + \else% + \vskip\topsep% + \fi% + \global\leftskip=\leftmargin% + \global\rightskip=\leftmargin% + } + \renewcommand{\endquotation}{\par% + \global\leftskip=0pt% + \global\rightskip=0pt% + \leavevmode% + \skipnumbering% + \ifautopar% + \vskip-\parskip% + \else% + \vskip\topsep% + \fi% + } + \renewcommand{\quote}{\par\leavevmode% + \parindent=0pt% + \skipnumbering% + \ifautopar% + \vskip-\parskip% + \else% + \vskip\topsep% + \fi% + \global\leftskip=\leftmargin% + \global\rightskip=\leftmargin% + } + \renewcommand{\endquote}{\par% + \global\leftskip=0pt% + \global\rightskip=0pt% + \leavevmode% + \skipnumbering% + \ifautopar% + \vskip-\parskip% + \else% + \vskip\topsep% + \fi% + } + \fi +} +\newcommand{\ledsectnotoc}{\let\addcontentsline\@gobblethree} +\newcommand{\ledsectnomark}{% + \let\chaptermark\@gobble% + \let\sectionmark\@gobble% + \let\subsectionmark\@gobble% +} +\ifl@dmemoir + \newcommand\beforeeledchapter{\clearforchapter} +\else + \newcommand\beforeeledchapter{\if@openright\cleardoublepage\else\clearpage\fi} +\fi +\newif\if@eled@sectioning +\def\print@rightmargin@eledsection{% + \if@eled@sectioning% + \begingroup% + \if@RTL% + \let\llap\rlap% + \let\leftlinenum\rightlinenum% + \let\leftlinenumR\rightlinenumR% + \let\l@drd@ta\l@dld@ta% + \let\l@drsn@te\l@dlsn@te% + \fi% + \hfill\l@drd@ta \csuse{LR}{\l@drsn@te}% + \endgroup% + \fi% +}% + +\def\print@leftmargin@eledsection{% + \if@eled@sectioning% + \leavevmode% + \begingroup% + \if@RTL% + \let\rlap\llap% + \let\rightlinenum\leftlinenum% + \let\rightlinenumR\leftlinenumR% + \let\l@dld@ta\l@drd@ta% + \let\l@dlsn@te\l@drsn@te% + \fi% + \l@dld@ta\csuse{LR}{\l@dlsn@te}% + \endgroup% + \fi% +}% + +\catcode`\#=12 % Space NEEDS by \catcode +\AtBeginDocument{% +\patchcmd{\chapter}{\clearforchapter}{% + \ifnumbering\else% + \clearforchapter + \fi% + } + {} + {} + +\pretocmd{\M@sect} + {\let\old@edtext=\edtext% + \let\edtext=\dummy@edtext% + } + {} + {} + +\apptocmd{\M@sect} + {\let\edtext=\old@edtext} + {} + {} + +\patchcmd{\M@sect} + { #9} + { #9% + \print@rightmargin@eledsection% + } + {} + {} + +\patchcmd{\M@sect} + {\hskip #3\relax} + {\hskip #3\relax% + \print@leftmargin@eledsection% + } + {} + {} + +\pretocmd{\@mem@old@ssect} + {\let\old@edtext=\edtext% + \let\edtext=\dummy@edtext% + } + {} + {} + +\apptocmd{\@mem@old@ssect} + {\let\edtext=\old@edtext} + {} + {} + +\patchcmd{\@mem@old@ssect} + {#5} + {#5% + \print@leftmargin@eledsection% + } + {} + {} + +\patchcmd{\@mem@old@ssect} + {\hskip #1} + {\hskip #1% + \print@rightmargin@eledsection% + } + {} + {} + +\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{% + \if@eled@sectioning\else% + \leavevmode\if@openright\cleardoublepage\else\clearpage\fi%No clearpage inside a \eledsection : will make the critical notes not in the same page than title. + \fi% + }% + {}% + {}% + +\patchcmd{\@makechapterhead} + {#1} + {\print@leftmargin@eledsection% + #1% + \print@rightmargin@eledsection% + } + {} + {} + +\patchcmd{\@makechapterhead}% For BIDI + {\if@RTL\raggedleft\else\raggedright\fi}% + {\if@eled@sectioning\else% + \if@RTL\raggedleft\else\raggedright\fi% + \fi% + }% + {}% + {}% + +\patchcmd{\@makeschapterhead} + {#1} + {\print@leftmargin@eledsection% + #1% + \print@rightmargin@eledsection% + } + {} + {} + +\pretocmd{\@sect} + {\let\old@edtext=\edtext + \let\edtext=\dummy@edtext% + } + {} + {} + +\apptocmd{\@sect} + {\let\edtext=\old@edtext} + {} + {} + +\patchcmd{\@sect} + {#8} + {#8% + \print@rightmargin@eledsection% + } + {} + {} + +\patchcmd{\@sect} + {\hskip #3\relax} + {\hskip #3\relax% + \print@leftmargin@eledsection% + } + {} + {} + +\pretocmd{\@ssect} + {\let\old@edtext=\edtext% + \let\edtext=\dummy@edtext% + } + {} + {} + +\apptocmd{\@ssect} + {\let\edtext=\old@edtext} + {} + {} + +\patchcmd{\@ssect} + {#5} + {#5% + \print@rightmargin@eledsection% + } + {} + {} + +\patchcmd{\@ssect} + {\hskip #1} + {\hskip #1% + \print@leftmargin@eledsection% + } + {} + {} +}% +\catcode`\#=6 %Space NEEDS by \catcode +\newwrite\eled@sectioning@out +\newcommand{\eledchapter}[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{} + }% + \fi% +} + +\newcommand{\eledsection}[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{} + }% + \fi% +} + +\newcommand{\eledsubsection}[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{} + }% + \fi% +} +\newcommand{\eledsubsubsection}[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{} + }% + \fi% +} + +\WithSuffix\newcommand\eledchapter*[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{} + }% + \fi% +} + +\WithSuffix\newcommand\eledsection*[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{} + }% + \fi% +} + +\WithSuffix\newcommand\eledsubsection*[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{} + }% + \fi% +} + +\WithSuffix\newcommand\eledsubsubsection*[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{} + }% + \fi% +} +\def\eled@chapter#1#2#3#4#5{% + \ifstrempty{#4}% + {% + \ifstrempty{#1}% + {% + \global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext\chapter{#2}}% + \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\chaptermark{#2}}% + }%Need for \pairs, because of using parbox. + {% + \global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext\chapter[#1]{#2}}% + \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\chaptermark{#2}}%Need for \pairs, because of using parbox. + }% + }% + {% + \ifstrempty{#1}% + {\global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext\chapter*{#2}}} + {\global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext\chapter*[#1]{#2}}}%Bug in LaTeX! + }% + \listcsgadd{eled@sections#5@@}{#3}% + } +\def\eled@section#1#2#3#4#5{% + \ifstrempty{#4}% + {\ifstrempty{#1}% + {% + \global\csdef{eled@sectioning@#3#5}{\section{#2}}% + \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\sectionmark{#2}}%Need for \pairs, because of using parbox. + }% + {% + \global\csdef{eled@sectioning@#3#5}{\section[#1]{#2}}% + \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\sectionmark{#1}}%Need for \pairs, because of using parbox. + }% + }% + {\ifstrempty{#1}% + {\global\csdef{eled@sectioning@#3#5}{\section*{#2}}}% + {\global\csdef{eled@sectioning@#3#5}{\section*[#1]{#2}}}%Bug in LaTeX! + } + \listcsgadd{eled@sections#5@@}{#3}% + } +\def\eled@subsection#1#2#3#4#5{% + \ifstrempty{#4}% + {\ifstrempty{#1}% + {% + \global\csdef{eled@sectioning@#3#5}{\subsection{#2}}% + \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\csuse{subsectionmark}{#2}}%Need for \pairs, because of using parbox. \csuse in case of \subsectionmark is not defined (book) + }% + {% + \global\csdef{eled@sectioning@#3#5}{\subsection[#1]{#2}}% + \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\csuse{subsectionmark}{#1}}%Need for \pairs, because of using parbox. \csuse in case of \subsectionmark is not defined (book) + }% + }% + {\ifstrempty{#1}% + {\global\csdef{eled@sectioning@#3#5}{\subsection*{#2}}}% + {\global\csdef{eled@sectioning@#3#5}{\subsection*[#1]{#2}}}%Bug in LaTeX! + } + \listcsgadd{eled@sections#5@@}{#3}% + } +\def\eled@subsubsection#1#2#3#4#5{% + \ifstrempty{#4}% + {\ifstrempty{#1}% + {\global\csdef{eled@sectioning@#3#5}{\subsubsection{#2}}}% + {\global\csdef{eled@sectioning@#3#5}{\subsubsection[#1]{#2}}}% + }% + {\ifstrempty{#1}% + {\global\csdef{eled@sectioning@#3#5}{\subsubsection*{#2}}}% + {\global\csdef{eled@sectioning@#3#5}{\subsubsection*[#1]{#2}}}%Bug in LaTeX! + } + \listcsgadd{eled@sections#5@@}{#3}% + } + \def\normal@page@break{} \def\l@prev@pb{} \def\l@prev@nopb{} diff --git a/Master/texmf-dist/tex/latex/eledmac/eledpar.sty b/Master/texmf-dist/tex/latex/eledmac/eledpar.sty index 60b80af8ceb..6b0a96c5264 100644 --- a/Master/texmf-dist/tex/latex/eledmac/eledpar.sty +++ b/Master/texmf-dist/tex/latex/eledmac/eledpar.sty @@ -24,7 +24,7 @@ %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{eledpar}[2014/04/14 v1.7.0 eledmac extension for parallel texts] +\ProvidesPackage{eledpar}[2014/08/05 v1.8.0 eledmac extension for parallel texts]% \newif\ifshiftedpstarts \let\shiftedversestrue\shiftedpstartstrue @@ -58,19 +58,6 @@ \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 @@ -95,10 +82,11 @@ \l@dend@stuff \setcounter{pstartR}{1} \begingroup - \initnumbering@sectcmd \initnumbering@sectcountR + \gdef\eled@sectionsR@@{} + \makeatletter\InputIfFileExists{\jobname.eledsec\the\section@numR R}{}{}\makeatother + \immediate\openout\eled@sectioningR@out=\jobname.eledsec\the\section@numR R\relax } - \def\endnumberingR{% \ifnumberingR \global\numberingRfalse @@ -118,7 +106,10 @@ \fi \else \led@err@NumberingNotStarted - \fi\endgroup} + \fi + \endgroup + \immediate\closeout\eled@sectioningR@out + } \newcounter{chapterR} \newcounter{sectionR} @@ -139,6 +130,7 @@ \led@mess@SectionContinued{\the\section@numR R}% \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}% \l@dend@stuff + \initnumbering@sectcmd \else \led@err@numberingShouldHaveStarted \endnumberingR @@ -303,7 +295,7 @@ \fi \fi} -\newcommand{\@l@regR}{% +\newcommand{\@nl@regR}{% \ifx\l@dchset@num\relax \else \advance\absline@numR \@ne \set@line@action @@ -347,12 +339,12 @@ \fi \fi} -\renewcommand*{\@l}[2]{% +\renewcommand*{\@nl}[2]{% \fix@page{#1}% \ifledRcol - \@l@regR + \@nl@regR \else - \@l@reg + \@nl@reg \fi} \newcount\last@page@numR @@ -628,9 +620,9 @@ \fi} \newcommand*{\new@lineL}{% - \write\linenum@out{\string\@l[\the\c@page][\thepage]}} + \write\linenum@out{\string\@nl[\the\c@page][\thepage]}} \newcommand*{\new@lineR}{% - \write\linenum@outR{\string\@l[\the\c@page][\thepage]}} + \write\linenum@outR{\string\@nl[\the\c@page][\thepage]}} \renewcommand*{\flag@start}{% \ifledRcol \edef\next{\write\linenum@outR{% @@ -767,6 +759,7 @@ \newenvironment{pairs}{%} \l@dpairingtrue \l@dpagingfalse + \initnumbering@sectcmd }{% \l@dpairingfalse } @@ -775,6 +768,7 @@ \let\chapter\chapterinpages \l@dpairingtrue \l@dpagingtrue + \initnumbering@sectcmd \setlength{\Lcolwidth}{\textwidth}% \setlength{\Rcolwidth}{\textwidth}% }{% @@ -791,16 +785,15 @@ \newif\ifinstanzaR \newenvironment{Leftside}{% \ledRcolfalse - \let\beginnumbering\beginnumbering\setcounter{pstartL}{1} + \setcounter{pstartL}{1} \let\pstart\pstartL \let\thepstart\thepstartL \let\pend\pendL \let\memorydump\memorydumpL \Leftsidehook - \let\oldstanza\stanza - \renewcommand{\stanza}{\oldstanza\global\instanzaLtrue} + \let\old@startstanza\@startstanza + \def\@startstanza[##1]{\global\instanzaLtrue\old@startstanza[##1]} }{ - \let\stanza\oldstanza \Leftsidehookend} \newcommand*{\Leftsidehook}{} \newcommand*{\Leftsidehookend}{} @@ -821,11 +814,10 @@ \let\lednopb\lednopbR \let\lineation\lineationR \Rightsidehook - \let\oldstanza\stanza - \renewcommand{\stanza}{\oldstanza\global\instanzaRtrue} + \let\old@startstanza\@startstanza + \def\@startstanza[##1]{\global\instanzaRtrue\old@startstanza[##1]} }{% \ledRcolfalse - \let\stanza\oldstanza \Rightsidehookend } @@ -840,12 +832,12 @@ \newcounter{pstartRold} \renewcommand{\thepstartR}{{\bfseries\@arabic\c@pstartR}. } -\newcommand*{\pstartL}{% -\if@nobreak% +\newcommandx*{\pstartL}[1][1]{% + \if@nobreak% \let\@oldnobreak\@nobreaktrue% -\else% + \else% \let\@oldnobreak\@nobreakfalse% -\fi% + \fi% \@nobreaktrue% \ifnumbering \else% \led@err@PstartNotNumbered% @@ -880,13 +872,16 @@ \numberedpar@true% \iflabelpstart\protected@edef\@currentlabel% {\p@pstartL\thepstartL}\fi% + \ifstrempty{#1}% + {}% + {\csgdef{before@pstartL@\the\l@dnumpstartsL}{\noindent#1}}% } -\newcommand*{\pstartR}{% -\if@nobreak% +\newcommandx*{\pstartR}[1][1]{% + \if@nobreak% \let\@oldnobreak\@nobreaktrue% -\else% + \else% \let\@oldnobreak\@nobreakfalse% -\fi% + \fi% \@nobreaktrue% \ifnumberingR \else% \led@err@PstartNotNumbered% @@ -920,8 +915,12 @@ \numberedpar@true% \iflabelpstart\protected@edef\@currentlabel% {\p@pstartR\thepstartR}\fi% + \ifstrempty{#1}% + {} + {\csgdef{before@pstartR@\the\l@dnumpstartsR}{\noindent#1}}% } -\newcommand*{\pendL}{\ifnumbering \else% +\newcommandx*{\pendL}[1][1]{% + \ifnumbering \else% \led@err@PendNotNumbered% \fi% \ifnumberedpar@ \else% @@ -937,9 +936,12 @@ \addtocounter{pstartL}{1}% \fi \parledgroup@beforenotes@save{L}% + \ifstrempty{#1}% + {}% + {\csgdef{after@pendL@\the\l@dnumpstartsL}{\noindent#1}}% } - -\newcommand*{\pendR}{\ifnumberingR \else% +\newcommandx*{\pendR}[1][1]{% + \ifnumberingR \else% \led@err@PendNotNumbered% \fi% \ifnumberedpar@ \else% @@ -954,7 +956,10 @@ \ifnumberpstart% \addtocounter{pstartR}{1}% \fi% - \parledgroup@beforenotes@save{R} + \parledgroup@beforenotes@save{R}% + \ifstrempty{#1}% + {}% + {\csgdef{after@pendR@\the\l@dnumpstartsR}{\noindent#1}}% } \newbox\l@dleftbox @@ -982,18 +987,19 @@ \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startL}{} \unvbox\one@line \global\setbox\one@line=\lastbox \getline@numL -\ifnum\@lock>\@ne\inserthangingsymboltrue\else\inserthangingsymbolfalse\fi + \ifnum\@lock>\@ne% + \inserthangingsymboltrue% + \else% + \inserthangingsymbolfalse% + \fi \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{\do@insidelineLhook\inserthangingsymbolL\new@lineL\l@dunhbox@line{\one@line}}\correcthangingL\ledrlfill\l@drd@ta% - \l@drsn@te - }}% + \xifinlist{\the\l@dpscL}{\eled@sections@@}% + {}% + {\print@lineL}}% \add@penaltiesL \global\advance\@donereallinesL\@ne \global\advance\@donetotallinesL\@ne @@ -1002,12 +1008,38 @@ \global\advance\@donetotallinesL\@ne \fi} +\def\print@lineL{% + \affixpstart@numL% + \l@dld@ta %space kept for backwar compatibility + \l@dlsn@te %space kept for backwar compatibility + {\ledllfill\hb@xt@ \wd\one@line{\do@insidelineLhook\inserthangingsymbolL\new@lineL\l@dunhbox@line{\one@line}}\correcthangingL\ledrlfill\l@drd@ta% + \l@drsn@te}} +\def\print@eledsectionL{% + \addtocounter{pstartL}{-1}% + \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{} + \ifdefstring{\@eledsectmark}{L}{}{\ledsectnomark} + \numdef{\temp@}{\l@dpscL-1}% + \xifinlist{\temp@}{\eled@sections@@}{\@nobreaktrue}{\@nobreakfalse}% + \@eled@sectioningtrue% + \csuse{eled@sectioning@\the\l@dpscL}% + \@eled@sectioningfalse% + \global\csundef{eled@sectioning@\the\l@dpscL}% + \if@RTL% + \hspace{-\paperwidth}% + {\hbox{\l@dunhbox@line{\one@line}} \new@line}% + \else% + \hspace{\paperwidth}% + {\new@line \hbox{\l@dunhbox@line{\one@line}}}% + \fi% + \vskip\eledsection@correcting@skip% +} \newcommand*{\do@lineLhook}{} \newcommand*{\do@lineRhook}{} \newcommand*{\do@insidelineLhook}{} \newcommand*{\do@insidelineRhook}{} \newcommand*{\do@lineR}{% + \ledRcol@true% \advance\countRline \@ne \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% {\vbadness=10000 @@ -1016,29 +1048,61 @@ \l@demptyd@ta \global\setbox\one@lineR=\vsplit\namebox{l@dRcolrawbox\the\l@dpscR} to\baselineskip}% - \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startR}{} + \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startR}{} \unvbox\one@lineR \global\setbox\one@lineR=\lastbox \getline@numR -\ifnum\@lockR>\@ne\inserthangingsymbolRtrue\else\inserthangingsymbolRfalse\fi + \ifnum\@lockR>\@ne% + \inserthangingsymbolRtrue + \else% + \inserthangingsymbolRfalse% + \fi% \setbox\l@drightbox \hb@xt@ \Rcolwidth{% - \affixpstart@numR - \affixline@numR - \l@dld@ta + \affixline@numR% \add@insertsR \affixside@noteR - \l@dlsn@te - {\correcthangingR\ledllfill\hb@xt@ \wd\one@lineR{\do@insidelineRhook\inserthangingsymbolR\new@lineR\l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta% - \l@drsn@te - }}% + \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}% + {}% + {\print@lineR}% + }% \add@penaltiesR \global\advance\@donereallinesR\@ne \global\advance\@donetotallinesR\@ne \else \setbox\l@drightbox \hb@xt@ \Rcolwidth{\hspace*{\Rcolwidth}} \global\advance\@donetotallinesR\@ne -\fi} +\fi +\ledRcol@false% +} +\def\print@lineR{% + \affixpstart@numR% + \l@dld@ta + \l@dlsn@te +\correcthangingR\ledllfill\hb@xt@ \wd\one@lineR{\do@insidelineRhook\inserthangingsymbolR\new@lineR\l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta% + \l@drsn@te + } + +\def\print@eledsectionR{% + \addtocounter{pstartR}{-1}% + \initnumbering@sectcountR% + \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{}% + \ifdefstring{\@eledsectmark}{R}{}{\ledsectnomark}% + \numdef{\temp@}{\l@dpscR-1}% + \xifinlist{\temp@}{\eled@sectionsR@@}{\@nobreaktrue}{\@nobreakfalse}% + \@eled@sectioningtrue% + \csuse{eled@sectioning@\the\l@dpscR R}% + \@eled@sectioningfalse% + \global\csundef{eled@sectioning@\the\l@dpscR R}% + \if@RTL% + \hspace{-\paperwidth}% + {\hbox{\l@dunhbox@line{\one@lineR}} \new@lineR}% + \else% + \hspace{\paperwidth}% + {\new@lineR \hbox{\l@dunhbox@line{\one@lineR}}}% + \fi% + \vskip\eledsection@correcting@skip +} \newcommand*{\getline@numR}{% \global\advance\absline@numR \@ne \do@actionsR @@ -1416,61 +1480,14 @@ \to\labelref@list \fi} +\WithSuffix\newcommand\sidenotemargin*[1]{% + \l@dgetsidenote@margin{#1} + \global\sidenote@marginR=\@l@dtempcntb + \global\sidenote@margin=\@l@dtempcntb +} \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]{% - \begingroup% - \newcommand{\content}{#1}% - \ifnumberedpar@ - \ifledRcol% - \xright@appenditem{\noexpand\vl@dlsnote{\csexpandonce{content}}}% - \to\inserts@listR - \global\advance\insert@countR \@ne% - \else% - \xright@appenditem{\noexpand\vl@dlsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne% - \fi - \fi\ignorespaces\endgroup} -\renewcommand*{\l@drsnote}[1]{% - \begingroup% - \newcommand{\content}{#1}% - \ifnumberedpar@ - \ifledRcol% - \xright@appenditem{\noexpand\vl@drsnote{\csexpandonce{content}}}% - \to\inserts@listR - \global\advance\insert@countR \@ne% - \else% - \xright@appenditem{\noexpand\vl@drsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne% - \fi - \fi\ignorespaces\endgroup} -\renewcommand*{\l@dcsnote}[1]{% - \begingroup% - \newcommand{\content}{#1}% - \ifnumberedpar@ - \ifledRcol% - \xright@appenditem{\noexpand\vl@dcsnote{\csexpandonce{content}}}% - \to\inserts@listR - \global\advance\insert@countR \@ne% - \else% - \xright@appenditem{\noexpand\vl@dcsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne% - \fi - \fi\ignorespaces\endgroup} \newcommand*{\affixside@noteR}{% \def\sidenotecontent@{}% @@ -1484,27 +1501,38 @@ \numdef{\itemcount@}{\itemcount@+1}% }% \dolistloop{\l@dcsnotetext}% - \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space sidenotes on line \the\line@numR R p. \the\page@numR,}}{}% + \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space sidenotes on line \the\line@numR\space p. \the\page@numR,}}{}% \gdef\@templ@d{}% \ifx\@templ@d\l@dcsnotetext \else% \if@twocolumn% \if@firstcolumn% - \setl@dlp@rbox{\sidenotecontent@}% + \setl@dlp@rbox{##1}{\sidenotecontent@}% \else% \setl@drp@rbox{\sidenotecontent@}% \fi% \else% \@l@dtempcntb=\sidenote@marginR% \ifnum\@l@dtempcntb>\@ne% - \advance\@l@dtempcntb by\page@num% + \advance\@l@dtempcntb by\page@numR% \fi% \ifodd\@l@dtempcntb% - \setl@drp@rbox{\sidenotecontent@t}% + \setl@drp@rbox{\sidenotecontent@}% + \gdef\sidenotecontent@{}% + \numdef{\itemcount@}{0}% + \dolistloop{\l@dcsnotetext@l}% + \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space leftnotes on line \the\line@numR\space p. \the\page@numR,}}{}% + \setl@dlp@rbox{\sidenotecontent@}% \else% \setl@dlp@rbox{\sidenotecontent@}% + \gdef\sidenotecontent@{}% + \numdef{\itemcount@}{0}% + \dolistloop{\l@dcsnotetext@r}% + \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space rightnotes on line \the\line@numR\space p. \the\page@numR,}}{}% + \setl@drp@rbox{\sidenotecontent@}% \fi% \fi% - \fi} + \fi% +} \renewcommand{\l@dbfnote}[1]{% \ifnumberedpar@ @@ -1684,15 +1712,6 @@ \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}% @@ -1728,15 +1747,20 @@ \gdef\theledlanguageR{\bbl@main@language}% }% } - { \apptocmd{\xpg@set@language}{% - \ifledRcol \gdef\theledlanguageR{#1}% - \else \gdef\theledlanguageL{#1}% + { \let\old@otherlanguage\otherlanguage% + \renewcommand{\otherlanguage}[2][]{% + \selectlanguage[#1]{#2}% + \ifledRcol \gdef\theledlanguageR{#2}% + \else \gdef\theledlanguageL{#2}% \fi}% - \let\l@duselanguage\xpg@set@language + \let\l@duselanguage\xpg@set@language% \gdef\theledlanguageL{\xpg@main@language}% \gdef\theledlanguageR{\xpg@main@language}% }} +\newsavebox{\@eledsectionL}% +\newsavebox{\@eledsectionR}% \newcommand*{\Columns}{% + \eledsection@correcting@skip=-\baselineskip% Correction for sections' titles \setcounter{pstartL}{\value{pstartLold}} \setcounter{pstartR}{\value{pstartRold}} \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else @@ -1757,21 +1781,40 @@ \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 + \xifinlist{\the\l@dpscL}{\eled@sections@@} + {% + \ifdefstring{\@eledsectmark}{L}% + {\csuse{eled@sectmark@\the\l@dpscL}% + }{}% + \global\csundef{eled@sectmark@\the\l@dpscL}% + \savebox{\@eledsectionL}{\parbox[t][][t]{\Lcolwidth}{\vbox{}\print@eledsectionL}}%\vbox{}-> prevent alignment troubles with RTL language + }% + {}% \l@duselanguage{\theledlanguageR}% \do@lineR - \fi + \xifinlist{\the\l@dpscR}{\eled@sectionsR@@} + {% + \ifdefstring{\@eledsectmark}{R}% + {\csuse{eled@sectmark@\the\l@dpscR R}% + }{}% + \global\csundef{eled@sectmark@\the\l@dpscR R}% + \savebox{\@eledsectionR}{\parbox[t][][t]{\Rcolwidth}{\vbox{}\print@eledsectionR}}}%\vbox{}-> prevent alignment troubles with RTL language + {}% \hb@xt@ \hsize{% - \hfill \unhbox\l@dleftbox - \hfill \columnseparator \hfill - \unhbox\l@drightbox + \ifdefstring{\columns@position}{L}{}{\hfill }% + \unhbox\l@dleftbox% + \ifhbox\@eledsectionL% + \usebox{\@eledsectionL}% + \fi% + \print@columnseparator% + \unhbox\l@drightbox% + \ifhbox\@eledsectionR% + \usebox{\@eledsectionR}% + \fi% + \ifdefstring{\columns@position}{R}{}{\hfill}% }% \checkraw@text \checkverseL @@ -1803,6 +1846,19 @@ \global\instanzaLfalse \global\instanzaRfalse} +\def\print@columnseparator{% + \ifdim\beforecolumnseparator<0pt% + \hfill% + \else% + \hspace{\beforecolumnseparator}% + \fi% + \columnseparator% + \ifdim\aftercolumnseparator<0pt% + \hfill% + \else% + \hspace{\beforecolumnseparator}% + \fi% +}% \newcommand{\checkpb@columns}{% \newif\if@pb @@ -1829,6 +1885,15 @@ \newdimen\columnrulewidth \columnrulewidth=\z@ +\newcommand*{\columnsposition}[1]{% + \xdef\columns@position{#1}% + }% +\xdef\columns@position{R}% +\newlength{\beforecolumnseparator}% +\setlength{\beforecolumnseparator}{-2pt}% + +\newlength{\aftercolumnseparator}% +\setlength{\aftercolumnseparator}{-2pt}% \newif\if@pstarts \newcommand*{\check@pstarts}{% \@pstartsfalse @@ -1870,6 +1935,7 @@ \newcount\l@dminpagelines \newcommand*{\Pages}{% + \eledsection@correcting@skip=-2\baselineskip% line correcting for section titles. \setcounter{pstartL}{\value{pstartLold}} \setcounter{pstartR}{\value{pstartRold}} \parledgroup@notespacing@set@correction @@ -1918,8 +1984,14 @@ \checkpageL \l@duselanguage{\theledlanguageL}% %%% \begingroup -{ \loop\ifl@dsamepage +{ \loop\ifl@dsamepage% + \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{} + \csuse{before@pstartL@\the\l@dpscL} + \global\csundef{before@pstartL@\the\l@dpscL} \do@lineL + \xifinlist{\the\l@dpscL}{\eled@sections@@} + {\print@eledsectionL}% + {}% \advance\numpagelinesL \@ne \ifshiftedpstarts \ifdim\ht\l@dleftbox>0pt\hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}\fi% @@ -1942,8 +2014,15 @@ \clearl@dleftpage }% \checkpageR \l@duselanguage{\theledlanguageR}% -{ \loop\ifl@dsamepage +{ \loop\ifl@dsamepage% + \initnumbering@sectcountR + \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{} + \csuse{before@pstartR@\the\l@dpscR} + \global\csundef{before@pstartR@\the\l@dpscR} \do@lineR + \xifinlist{\the\l@dpscR}{\eled@sectionsR@@} + {\print@eledsectionR}% + {}% \advance\numpagelinesR \@ne \ifshiftedpstarts \ifdim\ht\l@drightbox>0pt\hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}\fi% @@ -2152,13 +2231,12 @@ \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}% box is not empty \else% box is empty \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>\@donetotallinesL - \parledgroup@notes@endL + \parledgroup@notes@endL \else \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}=\@donetotallinesL \parledgroup@notes@endL \fi - \ifwrittenlinesL - \else + \ifwrittenlinesL\else \@writelinesinparL \writtenlinesLtrue \fi @@ -2171,6 +2249,8 @@ \resetprevline@ \fi \fi + \csuse{after@pendL@\the\l@dpscL}% + \global\csundef{after@pendL@\the\l@dpscL}% \addtocounter{pstartL}{1} \global\pstartnumtrue \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}% @@ -2180,6 +2260,10 @@ \global\advance\l@dpscL \@ne \parledgroup@notes@endL \parledgroup@correction@notespacing@final{L} + \else + \l@dpagefulltrue + \csuse{after@pendL@\the\l@dpscL}% + \global\csundef{after@pendL@\the\l@dpscL}% \fi \fi \fi} @@ -2187,13 +2271,12 @@ \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 + \parledgroup@notes@endR \else \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}=\@donetotallinesR \parledgroup@notes@endR \fi - \ifwrittenlinesR - \else + \ifwrittenlinesR\else \@writelinesinparR \writtenlinesRtrue \fi @@ -2206,6 +2289,8 @@ \resetprevline@ \fi \fi + \csuse{after@pendR@\the\l@dpscR}% + \global\csundef{after@pendR@\the\l@dpscR}% \addtocounter{pstartR}{1} \global\pstartnumRtrue \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}% @@ -2215,10 +2300,20 @@ \global\advance\l@dpscR \@ne \parledgroup@notes@endR \parledgroup@correction@notespacing@final{R} + \else + \csuse{after@pendR@\the\l@dpscR}% + \global\csundef{after@pendR@\the\l@dpscR}% + \l@dpagefulltrue \fi \fi \fi} +\newcommand{\eledsectnotoc}[1]{\xdef\@eledsectnotoc{#1}} +\eledsectnotoc{R} +\newcommand{\eledsectmark}[1]{\xdef\@eledsectmark{#1}} +\eledsectmark{L} +\newskip\eledsection@correcting@skip +\newwrite\eled@sectioningR@out \def\l@prev@pbR{} \def\l@prev@nopbR{} \newcommand{\ledpbR}{\write\linenum@outR{\string\led@pbR}} @@ -2288,7 +2383,7 @@ \vspace{\parledgroup@notespacing@correction@accumulated} \parledgroup@correction@notespacing@init% \ifstrequal{#1}{L}{ - \numdef{\@checking}{\the\l@dpscL-1} + \numdef{\@checking}{\the\l@dpscL-1} }{ \numdef{\@checking}{\the\l@dpscR-1} } |