diff options
author | Karl Berry <karl@freefriends.org> | 2015-06-15 23:28:58 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-06-15 23:28:58 +0000 |
commit | 210f6b4d5e219769ade60e62594dbea850759243 (patch) | |
tree | 621b069b0b55efdd833052e1cf4cad7d7003a5b8 /Master/texmf-dist/tex | |
parent | 20e51a25c22700214c05b35772c0f08180182e9b (diff) |
eledmac (2jun15)
git-svn-id: svn://tug.org/texlive/trunk@37555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/eledmac/eledmac.sty | 431 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/eledmac/eledpar.sty | 134 |
2 files changed, 418 insertions, 147 deletions
diff --git a/Master/texmf-dist/tex/latex/eledmac/eledmac.sty b/Master/texmf-dist/tex/latex/eledmac/eledmac.sty index e5cd4d0769b..e469e7ea4c1 100644 --- a/Master/texmf-dist/tex/latex/eledmac/eledmac.sty +++ b/Master/texmf-dist/tex/latex/eledmac/eledmac.sty @@ -25,8 +25,9 @@ + \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{eledmac}[2015/04/29 v1.22.1 LaTeX port of EDMAC]% +\ProvidesPackage{eledmac}[2015/06/02 v1.24.0 LaTeX port of EDMAC]% \newif\ifledfinal \newif\ifoldprintnpnumspace@ \newif\ifnocritical@% @@ -81,25 +82,14 @@ \RequirePackage{xargs} \RequirePackage{etoolbox} +\RequirePackage{etex} \reserveinserts{32} \RequirePackage{suffix} \RequirePackage{xstring} \RequirePackage{ifluatex} \RequirePackage{ragged2e} -\ifdef{\if@RTL}{}{\newif\if@RTL} -\ifledfinal - \newcommand*{\showlemma}[1]{#1} -\else - \newcommand*{\showlemma}[1]{\underline{#1}} -\fi - -\RequirePackage{xargs} -\RequirePackage{etoolbox} -\reserveinserts{32} -\RequirePackage{suffix} -\RequirePackage{xstring} -\RequirePackage{ifluatex} \RequirePackage{ragged2e} +\RequirePackage{ifxetex}% \newif\ifl@dmemoir \@ifclassloaded{memoir}{\l@dmemoirtrue}{\l@dmemoirfalse} @@ -112,6 +102,7 @@ \let\imki@wrindexentry\indtl@wrindexentry% }{}%False is the default value. We consider indextools as a variant of imakeidx. That's why we set `l@imakeidx` to true. We also let \imki@wrindexentry to \indtl@wrindexentry \ifdef{\if@RTL}{}{\newif\if@RTL} +\ifdef{\if@RTL}{}{\newif\if@RTL} \newcommand{\eledmac@warning}[1]{\PackageWarning{eledmac}{#1}} \newcommand{\eledmac@error}[2]{\PackageError{eledmac}{#1}{#2}} \newcommand*{\led@err@NumberingStarted}{% @@ -145,6 +136,8 @@ \eledmac@warning{Bad \string\sublockdisp\space argument}} \newcommand*{\led@warn@NoLineFile}[1]{% \eledmac@warning{Can't find line-list file #1}} +\newcommand*{\led@warn@Obsolete}[1]{% + \eledmac@warning{Line-list file #1 was obsolete. We have not read it. Please run LaTeX again.}} \newcommand*{\led@warn@BadAdvancelineSubline}{% \eledmac@warning{\string\advanceline\space produced a sub-line number less than zero.}} @@ -169,6 +162,8 @@ \newcommand*{\led@err@AutoparNotNumbered}{% \eledmac@error{\string\autopar\space must be used within a numbered section}{\@ehc}} +\newcommand*{\led@err@NumberingWithoutPstart}{% + \eledmac@error{\string\beginnumbering...\string\endnumbering\space without \string\pstart}{\@ehc}}% \newcommand*{\led@warn@BadAction}{% \eledmac@warning{Bad action code, value \next@action.}} \newcommand*{\led@warn@DuplicateLabel}[1]{% @@ -249,9 +244,16 @@ \newcommand{\led@error@IndextoolsAfterEledmac}{% \eledmac@error{Indextools must be loaded before eledmac.}{\@ehd}% }% + \providecommand*{\@gobblethree}[3]{} \providecommand*{\@gobblefour}[4]{} \providecommand*{\@gobblefive}[5]{} +\ifledfinal + \newcommand*{\showlemma}[1]{#1} +\else + \newcommand*{\showlemma}[1]{\underline{#1}} +\fi + \let\linenumberlist=\empty \newcount\@l@dtempcnta \newcount\@l@dtempcntb @@ -319,6 +321,9 @@ \ifnumbering \global\numberingfalse \normal@pars + \ifnum\l@dnumpstartsL=0% + \led@err@NumberingWithoutPstart% + \fi% \ifl@dpairing \global\pst@rtedLfalse \else @@ -573,8 +578,6 @@ \list@clear{\insertlines@list}% \list@clear{\actionlines@list}% \list@clear{\actions@list}% - \list@clear{\sw@list}% - \list@clear{\sw@list@inedtext}% }% \newcommand*{\get@linelistfile}[1]{% \InputIfFileExists{#1}{% @@ -587,6 +590,17 @@ \begingroup}% } +\newcommand{\line@list@version}[1]{% + \IfStrEq{#1}{\this@line@list@version}% + {}% + {\ifledRcol% + \led@warn@Obsolete{\jobname.\extensionchars\the\section@num}% + \else% + \led@warn@Obsolete{\jobname.\extensionchars\the\section@num}% + \fi% + \endinput% + }% +}% \newcommand{\@nl}[2]{% \fix@page{#1}% \@nl@reg} @@ -805,6 +819,7 @@ \@ref@reg{#1}{#2}} \newcommand*{\@ref@reg}[2]{% \global\insert@count=#1\relax + \global\advance\@edtext@level by 1% \loop\ifnum\insert@count>\z@ \xright@appenditem{\the\absline@num}\to\insertlines@list \global\advance\insert@count \m@ne @@ -816,7 +831,8 @@ \let\sub@action=\relax \let\set@line@action=\relax \let\@lab=\relax - \let\@sw\@gobbletwo% + \let\@lemma=\relax% + \let\@sw\@gobblethree% #2 \global\endpage@num=\page@num \global\endline@num=\line@num @@ -827,17 +843,32 @@ \ifsublines@ \the\subline@num \else 0\fi|% \the\endpage@num|\the\endline@num|% \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@list - #2} + \expandafter\list@create\expandafter{\csname sw@list@edtext@tmp@\the\@edtext@level\endcsname}% + \providebool{lemmacommand@\the\@edtext@level}% + \boolfalse{lemmacommand@\the\@edtext@level}% + #2% + \ifnum\@edtext@level>0% + \def\create@this@edtext@level{\expandafter\list@create\expandafter{\csname sw@list@edtext@\the\@edtext@level\endcsname}}% + \ifcsundef{sw@list@edtext@\the\@edtext@level}{\create@this@edtext@level}{}% + \letcs{\@tmp}{sw@list@edtext@\the\@edtext@level}% + \letcs{\@tmpp}{sw@list@edtext@tmp@\the\@edtext@level} + \xright@appenditem{\expandonce\@tmpp}\to\@tmp% + \global\cslet{sw@list@edtext@\the\@edtext@level}{\@tmp}% + \fi% + \global\advance\@edtext@level by -1% +} \newwrite\linenum@out \newif\iffirst@linenum@out@ \first@linenum@out@true +\newcommand{\this@line@list@version}{2}% \newcommand*{\line@list@stuff}[1]{% \read@linelist{#1}% \iffirst@linenum@out@ \immediate\closeout\linenum@out% \global\first@linenum@out@false% \immediate\openout\linenum@out=#1\relax% + \immediate\write\linenum@out{\string\line@list@version{\this@line@list@version}}% \else \if@minipage% \leavevmode% @@ -926,7 +957,8 @@ \newif\ifl@dskipnumber \newif\ifl@dskipversenumber% -\newcommand*{\skipnumbering}{ +\newcommand*{\skipnumbering}{% + \leavevmode% \ifledRcol% \ifinstanza% \write\linenum@outR{\string\n@num@stanza}% @@ -962,21 +994,47 @@ \let\morenoexpands=\relax \newcommand{\@tag}{} -\newif\if@edtext@% +\newcount\@edtext@level% +\@edtext@level=0% \long\def\critext#1#2/{\edtext{#1}{#2}}% \newcommand{\edtext}[2]{\leavevmode% \ifnumberedpar@% - \@edtext@true% + \global\advance\@edtext@level by 1% + \global\@lemmacommand@false% \begingroup% - \global\renewcommand{\@tag}{\no@expands #1}% + \ifledRcol% + \ifcsundef{sw@list@edtextR@\the\@edtext@level}% + {\global\let\sw@inthisedtext\empty}% + {\ifcsempty{sw@list@edtextR@\the\@edtext@level}% +{\global\let\sw@inthisedtext\empty}% +{\expandafter\gl@p\csname sw@list@edtextR@\the\@edtext@level\endcsname\to\sw@inthisedtext}% + }% + \else% + \ifcsundef{sw@list@edtext@\the\@edtext@level}% + {\global\let\sw@inthisedtext\empty}% + {\ifcsempty{sw@list@edtext@\the\@edtext@level}% +{\global\let\sw@inthisedtext\empty}% +{\expandafter\gl@p\csname sw@list@edtext@\the\@edtext@level\endcsname\to\sw@inthisedtext}% + }% + \fi% + \global\renewcommand{\@tag}{% + \no@expands #1% + }% \set@line% \ifledRcol \global\insert@countR \z@% \else \global\insert@count \z@ \fi% \ignorespaces #2\relax% \@ifundefined{xpg@main@language}{%if not polyglossia \flag@start}% - {\if@RTL\flag@end\else\flag@start\fi% With polyglossia, you must track whether the language reads left to right (English) or right to left (Arabic). + {\if@RTL\flag@end\else\flag@start\fi% }% + \if@lemmacommand@% + \ifledRcol% + \write\linenum@outR{\string\@lemma}% + \else% + \write\linenum@out{\string\@lemma}% + \fi% + \fi% \endgroup% \showlemma{#1}% \ifx\end@lemmas\empty \else% @@ -989,7 +1047,7 @@ {\if@RTL\flag@start\else\flag@end\fi% With polyglossia, you must track whether the language reads left to right (English) or right to left (Arabic). }% \global\@noneed@Footnotefalse% - \@edtext@false% + \global\advance\@edtext@level by -1% \global\@lemmacommand@false% \else% \showlemma{#1} (\textbf{\textsc{Edtext outside numbered paragraph}})\led@err@edtextoutsidepstart% @@ -1019,8 +1077,15 @@ \newcommand*{\lemma}[1]{% \global\@lemmacommand@true% - \global\renewcommand{\@tag}{\no@expands #1}}% + \global\renewcommand{\@tag}{% + \no@expands #1% + }% + \ignorespaces% +}% \newif\if@lemmacommand@% +\newcommand{\@lemma}{% + \booltrue{lemmacommand@\the\@edtext@level}% +}% \newcommand*{\linenum}[1]{% \xdef\@tempa{#1|||||||\noexpand\\\l@d@nums}% \global\let\l@d@nums=\empty @@ -1038,89 +1103,111 @@ \fi} \newcommand{\l@d@add}[1]{\xdef\l@d@nums{\l@d@nums#1}} - -\list@create{\sw@list}% -\list@create{\sw@list@inedtext}% -\newcommandx{\sameword}[2][1,usedefault]{\leavevmode% - \unless\ifledRcol% - \csnumgdef{sw@#2}{\csuse{sw@#2}+1}% - \protected@write\linenum@out{}{\string\@sw{#2}{\csuse{sw@#2}}}% - \unless\ifx\sw@list\empty% - \gl@p\sw@list\to\@tempb% - \if@edtext@% - \unless\if@lemmacommand@% - \xright@appenditem{\@tempb}\to\sw@list@inedtext% - \else% - \ifstrequal{#1}{inlemma}{\xright@appenditem{\@tempb}\to\sw@list@inedtext}{}% - \fi% - \fi% - \global\let\@tempb=\undefined% - \fi% +\newcommand{\get@sw@txt}[1]{% + \ifxetex% + \xdef\sw@txt{#1}% \else% - \csnumgdef{sw@#2@R}{\csuse{sw@#2@R}+1}% - \protected@write\linenum@outR{}{\string\@sw{#2}{\csuse{sw@#2@R}}}% - \unless\ifx\sw@listR\empty% - \gl@p\sw@listR\to\@tempb% - \if@edtext@% - \unless\if@lemmacommand@% - \xright@appenditem{\@tempb}\to\sw@list@inedtextR% - \else% - \ifstrequal{#1}{inlemma}{\xright@appenditem{\@tempb}\to\sw@list@inedtextR}{}% - \fi% - \fi% - \global\let\@tempb=\undefined% - \fi% + \expandafter\xdef\expandafter\sw@txt\expandafter{\detokenize{#1}}% + \fi% +}% +\newcommandx{\sameword}[2][1,usedefault]{% + \leavevmode% + \get@sw@txt{#2}% + \unless\ifledRcol% + \csnumgdef{sw@\sw@txt}{\csuse{sw@\sw@txt}+1}% + \protected@write\linenum@out{}{\string\@sw{\sw@txt}{\csuse{sw@\sw@txt}}{#1}}% + \else% + \csnumgdef{sw@\sw@txt@R}{\csuse{sw@\sw@txt@R}+1}% + \protected@write\linenum@outR{}{\string\@sw{\sw@txt}{\csuse{sw@\sw@txt@R}}{#1}}% \fi% #2% }% -\newcommand{\@sw}[2]{% +\newif\if@addsw% +\newcommand{\@sw}[3]{% + \get@sw@txt{#1}% \unless\ifledRcol% - \csxdef{sw@#1@\the\absline@num @\the\section@num}{#2}% + \csxdef{sw@\sw@txt @\the\absline@num @\the\section@num}{#2}% \numdef{\prev@line}{\the\absline@num-1}% - \ifcsundef{sw@#1@\prev@line @\the\section@num}{% - \csnumgdef{sw@#1@\prev@line @\the\section@num}{#2-1}% + \ifcsundef{sw@\sw@txt @\prev@line @\the\section@num}{% + \csnumgdef{sw@\sw@txt @\prev@line @\the\section@num}{#2-1}% }{}% - \numdef{\the@sw}{#2-\csuse{sw@#1@\prev@line @\the\section@num}}% - \xright@appenditem{\the@sw}\to\sw@list% + \numdef{\the@sw}{#2-\csuse{sw@\sw@txt @\prev@line @\the\section@num}}% \else% - \csxdef{sw@#1@\the\absline@numR @\the\section@numR @R}{#2}% + \csxdef{sw@\sw@txt @\the\absline@numR @\the\section@numR @R}{#2}% \numdef{\prev@line}{\the\absline@numR-1}% - \ifcsundef{sw@#1@\prev@line @\the\section@numR @R}{% - \csnumgdef{sw@#1@\prev@line @\the\section@numR @R}{#2-1}% + \ifcsundef{sw@\sw@txt @\prev@line @\the\section@numR @R}{% + \csnumgdef{sw@\sw@txt @\prev@line @\the\section@numR @R}{#2-1}% }{}% - \numdef{\the@sw}{#2-\csuse{sw@#1@\prev@line @\the\section@numR @R}}% - \xright@appenditem{\the@sw}\to\sw@listR% + \numdef{\the@sw}{#2-\csuse{sw@\sw@txt @\prev@line @\the\section@numR @R}}% \fi% + \@tempcnta=\@edtext@level + \@whilenum{\@tempcnta>0}\do{% + \ifcsdef{sw@list@edtext@tmp@\the\@tempcnta}% + {% + \@addswfalse% + \notbool{lemmacommand@\the\@tempcnta}% + {\@addswtrue}% + {\IfStrEq{#3}{inlemma}% + {\@addswtrue}% + {% + \def\do##1{% + \ifnumequal{##1}{\the\@tempcnta}% + {\@addswtrue\listbreak}% + {}% + }% + \docsvlist{#3}% + }% + }% + \if@addsw% + \letcs{\@tmp}{sw@list@edtext@tmp@\the\@tempcnta}% + \ifledRcol% + \xright@appenditem{{\the@sw}{\the\absline@numR}}\to\@tmp% + \else% + \xright@appenditem{{\the@sw}{\the\absline@num}}\to\@tmp% + \fi% + \cslet{sw@list@edtext@tmp@\the\@tempcnta}{\@tmp}% + \fi% + }% + {}% + \advance\@tempcnta by -1% + }% }% -\def\sameword@inedtext#1{% +\newcommandx{\sameword@inedtext}[2][1,usedefault]{% + \get@sw@txt{#2}% \unless\ifledRcol@% - \ifcsdef{sw@#1@\the\absline@num @\the\section@num}{% - \numdef{\prev@line}{\the\absline@num-1}% - \numdef{\sw@atthisline}{\csuse{sw@#1@\the\absline@num @\the\section@num}-\csuse{sw@#1@\prev@line @\the\section@num}}% - }% - {\numdef{\sw@atthisline}{0}}% \ifx\sw@list@inedtext\empty% \def\the@sw{999}% + \def\this@absline{-99}% \else% - \gl@p\sw@list@inedtext\to\the@sw% + \gl@p\sw@list@inedtext\to\@tmp% + \edef\the@sw{\expandafter\@firstoftwo\@tmp}% + \edef\this@absline{\expandafter\@secondoftwo\@tmp}% \fi% - \ifnumgreater{\sw@atthisline}{1}% - {\showwordrank{#1}{\the@sw}}% - {#1}% - \else% - \ifcsdef{sw@#1@\the\absline@numR @\the\section@numR @R}{% - \numdef{\prev@line}{\the\absline@numR-1}% - \numdef{\sw@atthisline}{\csuse{sw@#1@\the\absline@numR @\the\section@numR @R}-\csuse{sw@#1@\prev@line @\the\section@numR @R}}% + \ifcsdef{sw@\sw@txt @\this@absline @\the\section@num}{% + \numdef{\prev@line}{\this@absline-1}% + \numdef{\sw@atthisline}{\csuse{sw@\sw@txt @\this@absline @\the\section@num}-\csuse{sw@\sw@txt @\prev@line @\the\section@num}}% }% {\numdef{\sw@atthisline}{0}}% - \ifx\sw@list@inedtextR\empty% + \ifnumgreater{\sw@atthisline}{1}% + {\showwordrank{#2}{\the@sw}}% + {#2}% + \else% + \ifx\sw@list@inedtext\empty% \def\the@sw{999}% + \def\this@absline{-99}% \else% - \gl@p\sw@list@inedtextR\to\the@sw% + \gl@p\sw@list@inedtext\to\@tmp% + \edef\the@sw{\expandafter\@firstoftwo\@tmp}% + \edef\this@absline{\expandafter\@secondoftwo\@tmp}% \fi% + \ifcsdef{sw@\sw@txt @\this@absline @\the\section@numR @R}{% + \numdef{\prev@line}{\this@absline-1}% + \numdef{\sw@atthisline}{\csuse{sw@\sw@txt @\this@absline @\the\section@numR @R}-\csuse{sw@\sw@txt @\prev@line @\the\section@numR @R}}% + }% + {\numdef{\sw@atthisline}{0}}% \ifnumgreater{\sw@atthisline}{1}% - {\showwordrank{#1}{\the@sw}}% - {#1}% + {\showwordrank{#2}{\the@sw}}% + {#2}% \fi% }% \newcommand{\showwordrank}[2]{% @@ -1133,7 +1220,11 @@ \newbox\one@line \newcount\par@line -\newcommand{\AtEveryPstart}[1]{\xdef\at@every@pstart{\noindent\unexpanded{#1}}}% +\newcommand{\AtEveryPstart}[1]{% + \ifstrempty{#1}% + {\xdef\at@every@pstart{}}% + {\xdef\at@every@pstart{\noindent\unexpanded{#1}}}% +}% \xdef\at@every@pstart{}% \newcounter{pstart} @@ -1219,7 +1310,11 @@ } -\newcommand{\AtEveryPend}[1]{\xdef\at@every@pend{\noindent\unexpanded{#1}}}% +\newcommand{\AtEveryPend}[1]{% + \ifstrempty{#1}% + {\xdef\at@every@pend{}}% + {\xdef\at@every@pend{\noindent\unexpanded{#1}}}% +}% \xdef\at@every@pend{}% \newcommand*{\l@dzeropenalties}{% @@ -1825,6 +1920,7 @@ {}% }% {}% + \fi% }% }% \newcommand*{\setprintlines}[6]{% @@ -1888,14 +1984,22 @@ }% \fi% }% -\def\printlines#1|#2|#3|#4|#5|#6|#7|{\begingroup +\def\printlines#1|#2|#3|#4|#5|#6|#7|{% + \begingroup% \ifluatex% \luatextextdir TLT% \fi% \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}% + \ifdimequal{\csuse{boxstartlinenum@\@currentseries}}{0pt}% + {\bgroup}% + {\leavevmode\hbox to \csuse{boxstartlinenum@\@currentseries}\bgroup\hfill}% \ifl@d@pnum #1\fullstop\fi \linenumrep{#2} \ifl@d@ssub \fullstop \sublinenumrep{#3}\fi + \egroup% + \ifdimequal{\csuse{boxendlinenum@\@currentseries}}{0pt}% + {\bgroup}% + {\hbox to \csuse{boxendlinenum@\@currentseries}\bgroup}% \ifl@d@twolines% \ifl@d@morethantwolines% \csuse{morethantwolines@\@currentseries}% @@ -1908,7 +2012,12 @@ \ifl@d@elin \linenumrep{#5}\fi% \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumrep{#6}\fi% \fi% -\endgroup} + \ifdimequal{\csuse{boxendlinenum@\@currentseries}}{0pt}% + {}% + {\hfill}%Prevent underfull hbox + \egroup% + \endgroup% +}% \newcommand*{\normalfootstart}[1]{% \ifdimequal{0pt}{\preXnotes@}{}% {% @@ -2968,7 +3077,13 @@ \csuse{Xendnotenumfont@#4}% \ifdimequal{\csuse{boxXendlinenum@#4}}{0pt}% {\printendlines#1|}% - {\leavevmode\hbox to \csuse{boxXendlinenum@#4}{\printendlines#1|\hfill}}% + {\leavevmode% + \hbox to \csuse{boxXendlinenum@#4}% + {% + \IfSubStr{RC}{\csuse{boxXendlinenumalign@#4}}{\hfill}{}% + \printendlines#1|% + \IfSubStr{LC}{\csuse{boxXendlinenumalign@#4}}{\hfill}{}% + }}% }% \enspace{% \nottoggle{Xendlemmadisablefontselection@#4}% @@ -3055,10 +3170,17 @@ }% \def\printendlines#1|#2|#3|#4|#5|#6|#7|{\begingroup \setprintendlines{#1}{#2}{#3}{#4}{#5}{#6}% + \ifdimequal{\csuse{boxXendstartlinenum@\@currentseries}}{0pt}% + {\bgroup}% + {\leavevmode\hbox to \csuse{boxXendstartlinenum@\@currentseries}\bgroup\hfill}% \printnpnum{#1}% \ifoldprintnpnumspace@\space\fi% \linenumrep{#2}% \ifl@d@ssub \fullstop \sublinenumrep{#3}\fi + \egroup% + \ifdimequal{\csuse{boxXendendlinenum@\@currentseries}}{0pt}% + {\bgroup}% + {\hbox to \csuse{boxXendendlinenum@\@currentseries}\bgroup}% \ifl@d@twolines% \ifl@d@morethantwolines% \csuse{Xendmorethantwolines@\@currentseries}% @@ -3071,7 +3193,12 @@ \ifl@d@elin \linenumrep{#5}\fi% \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumrep{#6}\fi% \fi% -\endgroup} + \ifdimequal{\csuse{boxXendendlinenum@\@currentseries}}{0pt}% + {}% + {\hfill}%Prevent underfull hbox + \egroup% + \endgroup% +}% \newcommand*{\printnpnum}[1]{p.#1) } @@ -3125,7 +3252,13 @@ \csgdef{Xnotenumfont@#1}{\notenumfont}% \csgdef{Xnotefontsize@#1}{\notefontsetup}% \csgdef{bhookXnote@#1}{}% + \csgdef{boxlinenum@#1}{0pt}% + \csgdef{boxlinenumalign@#1}{L}% + + \csgdef{boxstartlinenum@#1}{0pt}% + \csgdef{boxendlinenum@#1}{0pt}% + \csgdef{boxsymlinenum@#1}{0pt}% \newtoggle{numberonlyfirstinline@#1}% \newtoggle{numberonlyfirstintwolines@#1}% @@ -3158,7 +3291,7 @@ \expandafter\newinsert\csname mp#1footins\endcsname% \fi% \global\notbool{parapparatus@}{\expandafter\newcommand\expandafter *}{\expandafter\newcommand}\csname #1footnote\endcsname[2][]{% - \if@edtext@% + \ifnum\@edtext@level>0% \begingroup% \newcommand{\content}{##2}% \ifnumberedpar@% @@ -3173,6 +3306,7 @@ \xright@appenditem{% \noexpand\prepare@preXnotes{#1}% \noexpand\prepare@edindex@fornote{\l@d@nums}% + \unexpanded{\def\sw@list@inedtext}{\expandafter\unexpanded\expandafter{\sw@inthisedtext}}%The value of the \sw@inthisedtext of current edtext will be pushed to \sw@list@inedtext when the notes are expanded. \noexpand\csuse{v#1footnote}{#1}% {{\l@d@nums}{\expandonce\@tag}{\expandonce\content}}% }\to\inserts@listR @@ -3189,6 +3323,7 @@ \xright@appenditem{% \noexpand\prepare@preXnotes{#1}% \noexpand\prepare@edindex@fornote{\l@d@nums}% + \unexpanded{\def\sw@list@inedtext}{\expandafter\unexpanded\expandafter{\sw@inthisedtext}}%The value of the \sw@inthisedtext of current edtext will be pushed to \sw@list@inedtext when the notes are expanded. \noexpand\csuse{v#1footnote}{#1}% {{\l@d@nums}{\expandonce\@tag}{\expandonce\content}}% }\to\inserts@list @@ -3198,11 +3333,11 @@ \else \csuse{v#1footnote}{#1}{{0|0|0|0|0|0|0}{}{##1}}% \fi% - \ignorespaces% \endgroup% \else% \led@err@FootnoteWithoutEdtext% \fi% + \ignorespaces% } \global\csletcs{#1@@footnote}{#1footnote} \footnormal{#1} @@ -3278,7 +3413,13 @@ \csgdef{Xendnotenumfont@#1}{\notenumfont}% \csgdef{Xendnotefontsize@#1}{\notefontsetup}% \csgdef{bhookXendnote@#1}{}% + \csgdef{boxXendlinenum@#1}{0pt}% + \csgdef{boxXendlinenumalign@#1}{L}% + + \csgdef{boxXendstartlinenum@#1}{0pt}% + \csgdef{boxXendendlinenum@#1}{0pt}% + \csgdef{Xendlemmaseparator@#1}{}% \csgdef{Xendbeforelemmaseparator@#1}{0em}% \csgdef{Xendafterlemmaseparator@#1}{0.5em}% @@ -3397,7 +3538,7 @@ \newhookcommand@series{Xcolalign}% \newhookcommand@series{Xnotenumfont} \newhookcommand@series{bhookXnote} - \newhookcommand@series{boxsymlinenum} + \newhookcommand@series{boxsymlinenum}% \newhookcommand@series{symlinenum} \newhookcommand@series{beforenumberinfootnote} \newhookcommand@series{afternumberinfootnote} @@ -3422,7 +3563,13 @@ \newhookcommand@series@reload{beforeXnotes} \newhooktoggle@series@reload{Xnoteswidthliketwocolumns}% \newhookcommand@series{Xnotefontsize} - \newhookcommand@series{boxlinenum} + + \newhookcommand@series{boxlinenum}% + \newhookcommand@series{boxlinenumalign}% + + \newhookcommand@series{boxstartlinenum}% + \newhookcommand@series{boxendlinenum}% + \fi \unless\ifnofamiliar@ \newhooktoggle@series{parindentX} @@ -3448,7 +3595,13 @@ \newhooktoggle@series{Xendtwolinesonlyinsamepage}[apprefwithpage] \newhookcommand@series{Xendnotenumfont} \newhookcommand@series{bhookXendnote} + \newhookcommand@series{boxXendlinenum}% + \newhookcommand@series{boxXendlinenumalign}% + + \newhookcommand@series{boxXendstartlinenum}% + \newhookcommand@series{boxXendendlinenum}% + \newhookcommand@series{Xendnotefontsize} \newhooktoggle@series{Xendlemmadisablefontselection} \newhookcommand@series{Xendlemmaseparator} @@ -3540,9 +3693,12 @@ \printlinefootnotenumbers{#1}{#2}% }% {% - \hbox to \csuse{boxlinenum@#2}{% - \printlinefootnotenumbers{#1}{#2}% - \hfill}% + \hbox to \csuse{boxlinenum@#2}% + {% + \IfSubStr{RC}{\csuse{boxlinenumalign@#2}}{\hfill}{}% + \printlinefootnotenumbers{#1}{#2}% + \IfSubStr{LC}{\csuse{boxlinenumalign@#2}}{\hfill}{}% + }% }% }% \newcommand{\printlinefootnotenumbers}[2]{% @@ -3824,7 +3980,7 @@ \ifsublines@ \sublinenumrep{\subline@num}\else 0\fi}\to\labelref@list} \newcommand*{\applabel}[1]{% - \if@edtext@% + \ifnum\@edtext@level>0% \ifcsundef{the@label#1}{% \csdef{the@label#1}{applabel}% }% @@ -3920,6 +4076,18 @@ \newtoggle{twolinesbutnotmore@appref}% \newtoggle{twolinesonlyinsamepage@appref}% +\xdef\Xendtwolines@apprefwithpage{}% +\xdef\Xendmorethantwolines@apprefwithpage{}% +\newtoggle{Xendtwolinesbutnotmore@apprefwithpage}% +\newtoggle{Xendtwolinesonlyinsamepage@apprefwithpage}% + + +\xdef\boxstartlinenum@appref{0pt} +\xdef\boxendlinenum@appref{0pt} + +\xdef\boxXendstartlinenum@apprefwithpage{0pt} +\xdef\boxXendendlinenum@apprefwithpage{0pt} + \newcommand\apprefprefixsingle{}% \newcommand\apprefprefixmore{}% @@ -3939,15 +4107,11 @@ \togglefalse{fulllines@}% }% -\xdef\Xendtwolines@apprefwithpage{}% -\xdef\Xendmorethantwolines@apprefwithpage{}% -\newtoggle{Xendtwolinesbutnotmore@apprefwithpage}% -\newtoggle{Xendtwolinesonlyinsamepage@apprefwithpage}% - \newcommandx{\apprefwithpage}[2][1,usedefault]{% \IfStrEq{#1}{fulllines}% {\toggletrue{fulllines@}}% {}% + \xdef\@currentseries{apprefwithpage}% \printendlines\xpageref{#2:start}|\xlineref{#2:start}|\xsublineref{#2:start}|\xpageref{#2:end}|\xlineref{#2:end}|\xsublineref{#2:end}||% \togglefalse{fulllines@}% }% @@ -4189,37 +4353,48 @@ }% }% \newcommand*{\l@dedbeginmini}{% - \def\do##1{\csletcs{v##1footnote}{mpv##1footnote}}% - \dolistloop{\@series}% + \unless\ifnocritical@% + \def\do##1{\csletcs{v##1footnote}{mpv##1footnote}}% + \dolistloop{\@series}% + \fi% } \newcommand*{\l@dedendmini}{% - \ifl@dpairing - \ifledRcol - \flush@notesR - \else - \flush@notes + \unless\ifnocritical@% + \ifl@dpairing% + \ifledRcol% + \flush@notesR% + \else% + \flush@notes% + \fi% \fi - \fi - \def\do##1{ - \ifvoid\csuse{mp##1footins}\else% - \ifl@dpairing\ifparledgroup% - \ifledRcol% - \dimgdef{\parledgroup@beforenotesR}{\parledgroup@beforenotesR+\skip\@nameuse{mp##1footins}} - \else% - \dimgdef{\parledgroup@beforenotesL}{\parledgroup@beforenotesL+\skip\@nameuse{mp##1footins}} - \fi% - \fi\fi% - \csuse{mp##1footgroup}{##1}% - \fi}% - \dolistloop{\@series}% - } + \def\do##1{% + \ifvoid\csuse{mp##1footins}\else% + \ifl@dpairing\ifparledgroup% + \ifledRcol% + \dimgdef{\parledgroup@beforenotesR}{\parledgroup@beforenotesR+\skip\@nameuse{mp##1footins}}% + \else% + \dimgdef{\parledgroup@beforenotesL}{\parledgroup@beforenotesL+\skip\@nameuse{mp##1footins}}% + \fi% + \fi\fi% + \csuse{mp##1footgroup}{##1}% + \fi}% + \dolistloop{\@series}% + \fi% +}% \newcommand*{\l@dfambeginmini}{% + \unless\ifnofamiliar@% \def\do##1{\csletcs{vfootnote##1}{mpvfootnote##1}}% - \dolistloop{\@series}} + \dolistloop{\@series}% + \fi% +}% + \newcommand*{\l@dfamendmini}{% - \def\do##1{\ifvoid\csuse{mpfootins##1}\else\csuse{mpfootgroup##1}{##1}\fi}% - \dolistloop{\@series}} + \unless\ifnofamiliar@% + \def\do##1{\ifvoid\csuse{mpfootins##1}\else\csuse{mpfootgroup##1}{##1}\fi}% + \dolistloop{\@series}% + \fi% +}% \def\@iiiminipage#1#2[#3]#4{% \leavevmode \@pboxswfalse diff --git a/Master/texmf-dist/tex/latex/eledmac/eledpar.sty b/Master/texmf-dist/tex/latex/eledmac/eledpar.sty index f1fd61f5c34..eaf21ab072b 100644 --- a/Master/texmf-dist/tex/latex/eledmac/eledpar.sty +++ b/Master/texmf-dist/tex/latex/eledmac/eledpar.sty @@ -23,7 +23,7 @@ %% This work consists of the files listed in the README file. %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{eledpar}[2015/04/13 v1.15.0 eledmac extension for parallel texts]% +\ProvidesPackage{eledpar}[2015/06/02 v1.17.0 eledmac extension for parallel texts]% \RequirePackage{xspace}% \newif\ifshiftedpstarts @@ -33,6 +33,8 @@ \DeclareOption{shiftedpstarts}{\shiftedpstartstrue} \DeclareOption{parledgroup}{\parledgrouptrue} \DeclareOption{widthliketwocolumns}{\widthliketwocolumnstrue}% +\newif\ifsameparallelpagenumber% +\DeclareOption{sameparallelpagenumber}{\sameparallelpagenumbertrue}% \ProcessOptions% \newdimen\Lcolwidth \Lcolwidth=0.45\textwidth @@ -50,6 +52,14 @@ \eledpar@error{The left page has ended on a right page}{\@ehc}} \newcommand*{\led@err@RightOnLeftPage}{% \eledpar@error{The right page has ended on a left page}{\@ehc}} +\newcommand*{\led@err@Leftside@PreviousNotPrinted}{% + \eledpar@error{You call a new Leftside environment while the previous one has not been typeset by \string\Pages\space or \string\Columns}{\@ehc}} +\newcommand*{\led@err@Rightside@PreviousNotPrinted}{% + \eledpar@error{You call a new Rightside environment while the previous one has not been typeset by \string\Pages\space or \string\Columns}{\@ehc}} +\newcommand*{\led@err@Pages@InsideEnv}{% + \eledpar@error{\string\Pages\space must be called *outside* of the `pages` environment}{\@ehc}} +\newcommand*{\led@err@Columns@InsideEnv}{% + \eledpar@error{\string\Columns\space must be called *outside* of the `pairs` environment}{\@ehc}} \newcount\section@numR \section@numR=\z@ \pst@rtedLfalse @@ -90,6 +100,9 @@ \ifnumberingR \global\numberingRfalse \normal@pars + \ifnum\l@dnumpstartsR=0% + \led@err@NumberingWithoutPstart% + \fi% \ifl@dpairing \global\pst@rtedRfalse \else @@ -267,15 +280,13 @@ \list@create{\insertlines@listR} \list@create{\actionlines@listR} \list@create{\actions@listR} -\list@create{\sw@listR}% -\list@create{\sw@list@inedtextR}% + +\newcount\page@numR \list@create{\linesinpar@listL} \list@create{\linesinpar@listR} \list@create{\maxlinesinpar@list} -\newcount\page@numR - \renewcommand*{\read@linelist}[1]{% \ifledRcol \list@clear{\line@listR}% @@ -284,8 +295,6 @@ \list@clear{\actions@listR}% \list@clear{\linesinpar@listR}% \list@clear{\linesonpage@listR} - \list@clear{\sw@listR}% - \list@clear{\sw@list@inedtextR}% \else \list@clearing@reg \list@clear{\linesinpar@listL}% @@ -562,6 +571,7 @@ \newcount\insert@countR \renewcommand*{\@ref}[2]{% \ifledRcol + \global\advance\@edtext@level by 1% \global\insert@countR=#1\relax \loop\ifnum\insert@countR>\z@ \xright@appenditem{\the\absline@numR}\to\insertlines@listR @@ -574,7 +584,8 @@ \let\sub@action=\relax \let\set@line@action=\relax \let\@lab=\relax - \let\@sw\@gobbletwo% + \let\@lemma=\relax + \let\@sw\@gobblethree% #2 \global\endpage@num=\page@numR \global\endline@num=\line@numR @@ -585,7 +596,19 @@ \ifsublines@ \the\subline@numR \else 0\fi|% \the\endpage@num|\the\endline@num|% \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@listR - #2 + \expandafter\list@create\expandafter{\csname sw@list@edtext@tmp@\the\@edtext@level\endcsname}% + \providebool{lemmacommand@\the\@edtext@level}% + \boolfalse{lemmacommand@\the\@edtext@level}% + #2 + \ifnum\@edtext@level>0% + \def\create@this@edtext@level{\expandafter\list@create\expandafter{\csname sw@list@edtextR@\the\@edtext@level\endcsname}}% + \ifcsundef{sw@list@edtextR@\the\@edtext@level}{\create@this@edtext@level}{}% + \letcs{\@tmp}{sw@list@edtextR@\the\@edtext@level}% + \letcs{\@tmpp}{sw@list@edtext@tmp@\the\@edtext@level}% + \xright@appenditem{\expandonce\@tmpp}\to\@tmp% + \global\cslet{sw@list@edtextR@\the\@edtext@level}{\@tmp}% + \fi% + \global\advance\@edtext@level by -1% \else \@ref@reg{#1}{#2}% \fi} @@ -614,6 +637,7 @@ \immediate\closeout\linenum@outR \global\first@linenum@out@Rfalse \immediate\openout\linenum@outR=#1 + \immediate\write\linenum@outR{\string\line@list@version{\this@line@list@version}}% \else \if@minipage% \leavevmode% @@ -691,12 +715,12 @@ \fi} \newcommand{\newseries@eledpar}[1]{% - \unless\ifnocritical@% - \csgdef{onlysideX@#1}{}% - \global\newbool{keepforXside@#1}% - \fi% \unless\ifnofamiliar@% + \csgdef{onlysideX@#1}{}% \global\newbool{keepforsideX@#1}% + \fi% + \unless\ifnocritical@% + \global\newbool{keepforXside@#1}% \csgdef{onlyXside@#1}{}% \fi% \unless\ifnofamiliar@% @@ -793,6 +817,9 @@ \newif\ifinstanzaL \newif\ifinstanzaR \newenvironment{Leftside}{% + \expandafter\ifvoid\csname l@dLcolrawbox1\endcsname\else% + \led@err@Leftside@PreviousNotPrinted% + \fi% \ledRcolfalse \setcounter{pstartL}{1} \let\pstart\pstartL @@ -810,6 +837,9 @@ \newcommand*{\Rightsidehookend}{} \newenvironment{Rightside}{% + \expandafter\ifvoid\csname l@dRcolrawbox1\endcsname\else% + \led@err@Rightside@PreviousNotPrinted% + \fi% \ledRcoltrue \let\beginnumbering\beginnumberingR \let\endnumbering\endnumberingR @@ -871,6 +901,7 @@ \global\l@dnumpstartsL=\l@dc@maxchunks% \fi% \global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup% + \l@dzeropenalties% \ifautopar\else% \ifnumberpstart% \ifsidepstartnum% @@ -920,6 +951,7 @@ \global\l@dnumpstartsR=\l@dc@maxchunks% \fi% \global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup% + \l@dzeropenalties% \ifautopar\else% \ifnumberpstart% \ifsidepstartnum\else% @@ -943,7 +975,6 @@ \ifnumberedpar@ \else% \led@err@PendNoPstart% \fi% - \l@dzeropenalties% \endgraf\global\num@lines=\prevgraf\egroup% \global\par@line=0% \endgroup% @@ -965,7 +996,6 @@ \ifnumberedpar@ \else% \led@err@PendNoPstart% \fi% - \l@dzeropenalties% \endgraf\global\num@linesR=\prevgraf\egroup% \global\par@lineR=0% \endgroup% @@ -1923,6 +1953,9 @@ \newsavebox{\@eledsectionL}% \newsavebox{\@eledsectionR}% \newcommand*{\Columns}{% + \ifl@dpairing% + \led@err@Columns@InsideEnv% + \fi% \l@dprintingcolumnstrue% \eledsection@correcting@skip=-\baselineskip% Correction for sections' titles \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else @@ -1944,6 +1977,7 @@ \global\advance\l@dpscR \@ne \restore@pstartL@pc% \restore@pstartR@pc% + \Columns@print@before@pstart% \checkraw@text { \loop\ifaraw@text \l@duselanguage{\theledlanguageL}% @@ -1996,6 +2030,7 @@ \write\linenum@outR{\string\@set[1]} \resetprevline@ \fi + \Columns@print@after@pend% \repeat \flush@notes \flush@notesR @@ -2130,12 +2165,59 @@ \rightskip=-\temp% }% +\newcommand{\Columns@print@before@pstart}{% + \ifboolexpr{% + test{\ifcsstring{before@pstartL@\the\l@dpscL}{\at@every@pstart}}% + and test {\ifcsstring{before@pstartR@\the\l@dpscR}{\at@every@pstart}}% + and test {\ifdefempty{\at@every@pstart}}}% + {}% + {% + \hb@xt@ \hsize{% + \ifdefstring{\columns@position}{L}{}{\hfill }% + \par\parbox[t][][t]{\Lcolwidth}{% + \csuse{before@pstartL@\the\l@dpscL}% + }% + \print@columnseparator% + \parbox[t][][t]{\Rcolwidth}{% + \csuse{before@pstartR@\the\l@dpscR}% + }% + \ifdefstring{\columns@position}{R}{}{\hfill}% + }% + }% + \global\csundef{before@pstartL@\the\l@dpscL}% + \global\csundef{before@pstartR@\the\l@dpscR}% +}% +\newcommand{\Columns@print@after@pend}{% + \ifboolexpr{% + test{\ifcsstring{after@pendL@\the\l@dpscL}{\at@every@pend}}% + and test {\ifcsstring{after@pendR@\the\l@dpscR}{\at@every@pend}}% + and test {\ifdefempty{\at@every@pend}}}% + {}% + {% + \hb@xt@ \hsize{% + \ifdefstring{\columns@position}{L}{}{\hfill }% + \parbox[t][][t]{\Lcolwidth}{% + \csuse{after@pendL@\the\l@dpscL}% + }% + \print@columnseparator% + \parbox[t][][t]{\Rcolwidth}{% + \csuse{after@pendR@\the\l@dpscR}% + }% + \ifdefstring{\columns@position}{R}{}{\hfill}% + }% + }% + \global\csundef{after@pendL@\the\l@dpscL}% + \global\csundef{after@pendR@\the\l@dpscR}% +}% \newcount\numpagelinesL \newcount\numpagelinesR \newcount\l@dminpagelines \newcommand*{\Pages}{% - \l@dprintingpagestrue% + \l@dprintingpagestrue% + \ifl@dpairing% + \led@err@Pages@InsideEnv% + \fi% \eledsection@correcting@skip=-2\baselineskip% line correcting for section titles. \parledgroup@notespacing@set@correction% \typeout{}% @@ -2156,6 +2238,7 @@ \global\l@dpscR=\z@% \writtenlinesLfalse% \writtenlinesRfalse% + \init@sameparallelpage@number \let\print@Xnotes\print@Xnotes@forpages% \let\print@notesX\print@notesX@forpages% \check@pstarts% @@ -2288,16 +2371,17 @@ \global\instanzaLfalse% \global\instanzaRfalse% \l@dprintingpagesfalse% + \finish@sameparallelpage@number%In order to have continuous page number \finish@Pages@notes%Needed to prevent final notes overlap line number \ignorespaces} \newcommand{\finish@Pages@notes}{% \def\do##1{% \ifnocritical@% - \newbox\csuse{##1footins} + \global\newnamebox{##1footins} \fi \ifnofamiliar@% - \newbox\csuse{footins##1} + \global\newnamebox{footins##1} \fi \ifvoid\csuse{##1footins}% \ifvoid\csuse{footins##1}\else% @@ -2335,6 +2419,7 @@ \newcommand*{\clearl@drightpage}{% \ifdim\pagetotal=0pt\hbox{}\fi% \newpage% + \stepcounter{sameparallelpage@number}% \ifodd\c@page \led@err@RightOnLeftPage \hbox{}% @@ -2522,7 +2607,6 @@ \parledgroup@notes@endL \parledgroup@correction@notespacing@final{L} \else - \print@last@after@pendLtrue% \fi \fi \fi} @@ -2562,6 +2646,18 @@ \fi \fi} +\newcounter{sameparallelpage@number} +\newcommand{\init@sameparallelpage@number}{% + \setcounter{sameparallelpage@number}{\c@page}% + \ifsameparallelpagenumber% + \patchcmd{\thepage}{page}{sameparallelpage@number}{}{}% + \fi% +}% +\newcommand{\finish@sameparallelpage@number}{% + \ifsameparallelpagenumber% + \setcounter{page}{\c@sameparallelpage@number}% + \fi% +}% \pretocmd{\chapter}{% \ifl@dprintingpages% \vbox{}% |