From 61ef516740ec5cbb3e2cbc5b5c37821a46ac0e11 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 12 Nov 2017 22:22:03 +0000 Subject: reledmac (12nov17) git-svn-id: svn://tug.org/texlive/trunk@45760 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/reledmac/reledmac.sty | 394 ++++++++++++++++++---- Master/texmf-dist/tex/latex/reledmac/reledpar.sty | 39 ++- 2 files changed, 359 insertions(+), 74 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/reledmac/reledmac.sty b/Master/texmf-dist/tex/latex/reledmac/reledmac.sty index 87a5dd36cfc..d2bd92812f3 100644 --- a/Master/texmf-dist/tex/latex/reledmac/reledmac.sty +++ b/Master/texmf-dist/tex/latex/reledmac/reledmac.sty @@ -25,7 +25,6 @@ -%% \changes{v2.25.0}{2017/11/05}{Add \protect\cs{Xendtxtbeforenotes} hook} @@ -36,7 +35,7 @@ %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{reledmac}[2017/11/05 v2.25.0 typesetting critical editions]% +\ProvidesPackage{reledmac}[2017/11/11 v2.26.0 typesetting critical editions]% \RequirePackage{xkeyval} \newif\ifparledgroup \DeclareOptionX{series}[A,B,C,D,E]{\xdef\default@series{#1}} @@ -325,6 +324,15 @@ \providecommand*{\@gobblethree}[3]{} \providecommand*{\@gobblefour}[4]{} \providecommand*{\@gobbleseven}[7]{} +\newcommand{\l@wrap@ifnotemptybox}[2]{% + \setbox0=\hbox{#2}% + \ifdim\wd0=\z@\else% + #1{#2}% + \fi% +}% +\newcommand{\l@wrapcs@ifnotemptybox}[2]{% + \l@wrap@ifnotemptybox{\csname #1\endcsname}{#2}% +}% \ifledfinal \newcommand*{\showlemma}[1]{#1} \else @@ -702,7 +710,13 @@ \ifluatex% \textdir TLT% \fi% - \numlabfont\linenumrep{\line@num}% + \numlabfont% + \ifdefstring{\Xlinenumannotationposition@side}{before}{% + \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{% + \csuse{annot@\the\absline@num @\the\section@num}% + }% + }{}% + \linenumrep{\line@num}% \ifsublines@ \ifnum\subline@num>0\relax \unskip% @@ -710,6 +724,11 @@ \sublinenumrep{\subline@num}% \fi \fi% + \ifdefstring{\Xlinenumannotationposition@side}{after}{% + \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{% + \csuse{annot@\the\absline@num @\the\section@num}% + }% + }{}% \egroup% }% @@ -730,7 +749,7 @@ \list@create{\insertlines@list} \list@create{\actionlines@list} \list@create{\actions@list} - +\list@create{\annot@list}% \newcount\page@num \newcount\endpage@num \newcount\endline@num @@ -832,6 +851,7 @@ } \newcommand*{\@nl@reg}{% \ifx\l@dchset@num\relax \else + \reset@current@annot% \advance\absline@num \@ne \csgdef{l@dchset@num@\the\absline@num}{}%To remember this line have been marked by a \setlinenum \set@line@action @@ -1214,16 +1234,20 @@ \let\@lab=\relax \let\@lemma=\relax% \let\@sw\@gobblethree% + \let\store@annot@to@absline\@gobble% #2 \global\endpage@num=\page@num \global\endline@num=\line@num \global\endsubline@num=\subline@num + \global\let\endcurrent@annot=\current@annot% \endgroup \xright@appenditem% {\the\page@num|\the\line@num|% \ifsublines@ \the\subline@num \else 0\fi|% \the\endpage@num|\the\endline@num|% \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@list + \xright@appenditem% + {\current@annot|\endcurrent@annot}\to\annot@list% \@ref@reg@parse{#2}% \global\advance\@edtext@level by -1% } @@ -1404,12 +1428,15 @@ \newcommand*{\setline}[1]{% \leavevmode% \ifnum#1<\z@ - \led@warn@BadSetline - \else - \ifledRcol \write\linenum@outR{\string\@set[#1]}% - \else \write\linenum@out{\string\@set[#1]}% - \fi - \fi} + \led@warn@BadSetline% + \else% + \ifledRcol% + \write\linenum@outR{\string\@set[#1]}% + \else% + \write\linenum@out{\string\@set[#1]}% + \fi% + \fi% +}% \newcommand*{\setlinenum}[1]{% @@ -1463,6 +1490,7 @@ \let\edtext=\dummy@edtext \let\edindex\dummy@edindex% \l@dtabnoexpands + \let\linenumannotation=\@gobble% \morenoexpands} \let\morenoexpands=\relax @@ -1551,6 +1579,13 @@ \xdef\l@d@nums{\@tempb|\edfont@info}% \global\let\@tempb=\undefined \fi + \ifx\annot@listR\empty% + \xdef\l@current@annotR{|}% + \else% + \gl@p\annot@listR\to\@tempb% + \xdef\l@current@annotR{\@tempb}% + \global\let\@tempb=\undefined% + \fi% \else \ifx\line@list\empty \global\noteschanged@true @@ -1560,6 +1595,13 @@ \xdef\l@d@nums{\@tempb|\edfont@info}% \global\let\@tempb=\undefined \fi + \ifx\annot@list\empty% + \xdef\l@current@annot{|}% + \else% + \gl@p\annot@list\to\@tempb% + \xdef\l@current@annot{\@tempb}% + \global\let\@tempb=\undefined% + \fi% \fi} \newcommand*{\edfont@info}{\f@encoding/\f@family/\f@series/\f@shape} @@ -1592,6 +1634,19 @@ \fi} \newcommand{\l@d@add}[1]{\xdef\l@d@nums{\l@d@nums#1}} +\newcommand*{\lineannot}[1]{% + \lineannot@set#1|% +}% +\def\lineannot@set#1|#2|{% + \expandafter\parse@annot#1|#2|% + \IfStrEq{#1}{}% + {\let\@tempa\annot@start}% + {\def\@tempa{#1}}% + \IfStrEq{#2}{}% + {\let\@tempb\annot@start}% + {\def\@tempb{#2}}% + \xdef\l@current@annot{\@tempa|\@tempb}% +}% \newcommand{\get@sw@txt}[1]{% \begingroup% \swnoexpands% @@ -2169,6 +2224,36 @@ \led@warn@BadAction \fi} +\newcommand{\linenumannotation}[1]{% + \leavevmode%In case it begins with a \pstart, ensure the \@annot is written after \@nl + \ifledRcol% + \write\linenum@outR{\string\@annot[#1]}% + \else% + \write\linenum@out{\string\@annot[#1]}% + \fi% +}% +\def\Xlinenumannotationposition@side{after}% +\def\Xwraplinenumannotation@ref{\textsuperscript}% +\def\Xwraplinenumannotation@side{\textsuperscript}% +\newcommand{\@annot}[1]{% + \store@annot@to@absline{#1}% + \def\current@annot{#1}% +}% +\newcommand{\store@annot@to@absline}[1]{% + \ifledRcol% + \csgappto{annotR@\the\absline@numR @\the\section@numR}{#1}% + \else% + \csgappto{annot@\the\absline@num @\the\section@num}{#1}% + \fi% +}% +\let\current@annot=\empty% +\newcommand{\reset@current@annot}{% + \let\current@annot\empty% +}% +\def\parse@annot#1|#2|{% + \gdef\annot@start{#1}% + \gdef\annot@end{#2}% +}% \newcommand*{\affixline@num}{% \ifledgroupnotesL@\else \ifnumberline @@ -2508,7 +2593,7 @@ \newcommand*{\footnoteoptions@}[3]{% \def\do##1{% - \ifstrequal{#1}{L}{% In Leftside + \ifstrequal{#1}{L}{% On the left side \xright@appenditem{\noexpand\setkeys[mac]{#3footnoteoption}{\unexpanded{##1}}}\to\inserts@list% \global\advance\insert@count \@ne% Increment the left insert counter. }% @@ -3285,6 +3370,8 @@ \newif\ifl@d@dash \newif\ifl@d@Xtwolines% \newif\ifl@d@Xmorethantwolines% +\let\@annot@start@print\relax% +\let\@annot@end@print\relax% \newcommand*{\l@dparsefootspec}[3]{\l@dp@rsefootspec#1|} \def\l@dp@rsefootspec#1|#2|#3|#4|#5|#6|#7|{% \gdef\l@dparsedstartpage{#1}% @@ -3302,18 +3389,61 @@ \def\l@dparsedendsub{0}% \newcommand*{\setprintlines}[6]{% - \l@d@pnumfalse \l@d@dashfalse + \let\@annot@start@print\relax% + \let\@annot@end@print\relax% + \l@d@pnumfalse% + \l@d@dashfalse% + \l@d@elinfalse% \ifbypage@ \ifnum#4=#1 \else \l@d@pnumtrue \l@d@dashtrue \fi \fi - \ifl@d@pnum \l@d@elintrue \else \l@d@elinfalse \fi - \ifnum#2=#5 \else - \l@d@elintrue - \l@d@dashtrue - \fi + \ifboolexpr{% + bool{l@d@pnum}% + or not test{\ifnumequal{#2}{#5}}% + }{% + \l@d@elintrue% + \l@d@dashtrue% + \unless\ifx\relax\annot@end% + \def\@annot@end@print{% + \l@wrapcs@ifnotemptybox{Xwraplinenumannotation@\@currentseries}{\annot@end}% + }% + \fi% + }{}% + \ifl@d@elin% + \def\@annot@start@print{% + \l@wrapcs@ifnotemptybox{Xwraplinenumannotation@\@currentseries}{\annot@start}% + }% + \else% + \ifx\annot@start\annot@end% + \unless\ifx\@annot@start\relax% + \def\@annot@start@print{% + \l@wrapcs@ifnotemptybox{Xwraplinenumannotation@\@currentseries}{\annot@start}% + }% + \fi% + \else% + \ifx\@annot@end@print\relax% + \def\@annot@start@print{% + \l@wrapcs@ifnotemptybox{Xwraplinenumannotation@\@currentseries}{% + \ifx\annot@start\empty\else% + \annot@start% + \ifdefined\linerangesep@% + \linerangesep@% + \else% + \csuse{Xlinerangeseparator@\@currentseries}% + \fi% + \fi% + \annot@end% + }% + }% + \else% + \let\@annot@start@print\@annot@end@print% + \let\@annot@end@print\relax% + \fi% + \fi% + \fi% \l@d@ssubfalse \ifnum#3=0 \else \l@d@ssubtrue @@ -3391,6 +3521,9 @@ \ifdimequal{\csuse{Xboxstartlinenum@\@currentseries}}{0pt}% {\bgroup}% {\leavevmode\hbox to \csuse{Xboxstartlinenum@\@currentseries}\bgroup\hfill}% + \ifcsstring{Xlinenumannotationposition@\@currentseries}{before}% + {\@annot@start@print}% + {}% \ifl@d@pnum% \wrap@edcrossref{\@this@crossref@start}{#1}% \csuse{Xpagelinesep@\@currentseries}% @@ -3403,6 +3536,9 @@ \csuse{Xsublinesep@\@currentseries}% \wrap@edcrossref{\@this@crossref@start}{\sublinenumrep{#3}}% \fi + \ifcsstring{Xlinenumannotationposition@\@currentseries}{after}% + {\@annot@start@print}% + {}% \egroup% \ifdimequal{\csuse{Xboxendlinenum@\@currentseries}}{0pt}% {\bgroup}% @@ -3421,6 +3557,9 @@ \csuse{Xlinerangeseparator@\@currentseries}% \fi% \fi% + \ifcsstring{Xlinenumannotationposition@\@currentseries}{before}% + {\@annot@end@print}% + {}% \ifl@d@pnum% \wrap@edcrossref{\@this@crossref@end}{#4}% \csuse{Xpagelinesep@\@currentseries}% @@ -3436,7 +3575,10 @@ \csuse{Xsublinesep@\@currentseries}% \fi% \wrap@edcrossref{\@this@crossref@end}{\sublinenumrep{#6}}% - \fi% + \fi% + \ifcsstring{Xlinenumannotationposition@\@currentseries}{after}% + {\@annot@end@print}% + {}% \fi% \ifdimequal{\csuse{Xboxendlinenum@\@currentseries}}{0pt}% {}% @@ -4521,16 +4663,62 @@ }% }% \newcommand*{\setprintendlines}[6]{% - \l@d@pnumfalse \l@d@dashfalse + \let\@annot@start@print\relax% + \let\@annot@end@print\relax% + \l@d@pnumfalse% + \l@d@dashfalse% + \l@d@elinfalse% \ifnum#4=#1 \else \l@d@pnumtrue \l@d@dashtrue \fi - \ifl@d@pnum \l@d@elintrue \else \l@d@elinfalse \fi - \ifnum#2=#5 \else + \ifboolexpr{% + bool{l@d@pnum}% + or not test{\ifnumequal{#2}{#5}}% + }{% + \l@d@elintrue% + \l@d@dashtrue% \l@d@elintrue \l@d@dashtrue - \fi + \unless\ifx\relax\annot@end% + \def\@annot@end@print{% + \l@wrapcs@ifnotemptybox{Xendwraplinenumannotation@\@currentseries}{\annot@end}% + }% + \fi% + }% + {}% + \ifl@d@elin% + \def\@annot@start@print{% + \l@wrapcs@ifnotemptybox{Xendwraplinenumannotation@\@currentseries}{\annot@start}% + }% + \else% + \ifx\annot@start\annot@end% + \unless\ifx\@annot@start\relax% + \def\@annot@start@print{% + \l@wrapcs@ifnotemptybox{Xendwraplinenumannotation@\@currentseries}{\annot@start}% + }% + \fi% + \else% + \ifx\@annot@end@print\relax% + \def\@annot@start@print{% + \l@wrapcs@ifnotemptybox{Xendwraplinenumannotation@\@currentseries}{% + \ifx\annot@start\empty\else% + \annot@start% + \ifdefined\linerangesep@% + \linerangesep@% + \else% + \csuse{Xendlinerangeseparator@\@currentseries}% + \fi% + \fi% + \annot@end% + }% + }% + \else% + \let\@annot@start@print\@annot@end@print% + \let\@annot@end@print\relax% + \fi% + \fi% + \fi% \l@d@ssubfalse \ifnum#3=0 \else \l@d@ssubtrue @@ -4615,6 +4803,9 @@ \else% \csuse{Xendlineprefixsingle@\@currentseries}% \fi% + \ifcsstring{Xendlinenumannotationposition@\@currentseries}{before}% + {\@annot@start@print}% + {}% \wrap@edcrossref{\@this@crossref@start}{% \ifledRcol@% \linenumrepR{#2}% @@ -4633,6 +4824,9 @@ \fi% }% \fi% + \ifcsstring{Xendlinenumannotationposition@\@currentseries}{after}% + {\@annot@start@print}% + {}% \egroup% \ifdimequal{\csuse{Xendboxendlinenum@\@currentseries}}{0pt}% {\bgroup}% @@ -4662,6 +4856,9 @@ \wrap@edcrossref{\@this@crossref@end}\printnpnum{#4}% }% \fi% + \ifcsstring{Xendlinenumannotationposition@\@currentseries}{before}% + {\@annot@end@print}% + {}% \ifl@d@elin% \ifl@d@pnum\csuse{Xendlineprefixsingle@\@currentseries}\fi% \wrap@edcrossref{\@this@crossref@end}{% @@ -4685,6 +4882,9 @@ \fi% }% \fi% + \ifcsstring{Xendlinenumannotationposition@\@currentseries}{after}% + {\@annot@end@print}% + {}% \fi% \ifdimequal{\csuse{Xendboxendlinenum@\@currentseries}}{0pt}% {}% @@ -4779,6 +4979,7 @@ \csgdef{Xlemmafont@#1}{}% \csgdef{Xwraplemma@#1}{} \csgdef{Xwidth@#1}{\hsize}% + \csgdef{Xwraplinenumannotation@#1}{\textsuperscript}% \expandafter\newinsert\csname #1footins\endcsname% \unless\ifnoledgroup@% \expandafter\newinsert\csname mp#1footins\endcsname% @@ -4816,6 +5017,7 @@ \unexpanded{\def\@this@crossref@start}{\theedtext:start}% \unexpanded{\def\@this@crossref@end}{\theedtext:end}% \expandonce{\@beforeinsertofthisedtext}% Internal for now, no reason to make it public + \noexpand\parse@annot\l@current@annot|% \noexpand\csuse{v#1footnote}{#1}% {{\l@d@nums}{\expandonce\@tag}{\expandonce\content}}% \noexpand\Xnote@false% @@ -4856,6 +5058,7 @@ \unexpanded{\def\@this@crossref@start}{\theedtext:start}% \unexpanded{\def\@this@crossref@end}{\theedtext:end}% \expandonce{\@beforeinsertofthisedtext}%Internal for now, no reason to make it public + \noexpand\parse@annot\l@current@annot|% \noexpand\csuse{v#1footnote}% {#1}% {{\l@d@nums}{\expandonce\@tag}{\expandonce\content}}% @@ -4910,6 +5113,7 @@ \csgdef{txtbeforenotesX@#1}{}% \newtoggle{txtbeforesnotesX@#1@typeset}%Not directly used by user, but internal \newtoggle{txtbeforenotesonlyonceX@#1}% + \csgdef{Xlinenumannotationposition@#1}{after}% \expandafter\newinsert\csname footins#1\endcsname% \unless\ifnoledgroup@% \expandafter\newinsert\csname mpfootins#1\endcsname% @@ -4988,7 +5192,10 @@ \newcommand{\content}{##2}% \stepcounter{labidx}% \expandafter\immediate\expandafter\write\csname l@d@#1end\endcsname{% - \unexpanded{\def\sw@list@inedtext}{\expandafter\unexpanded\expandafter{\sw@inthisedtext}}\@percentchar\space%Explicit space, to add a linebreak in the output file + \unexpanded{\def\sw@list@inedtext}% + {\expandafter\unexpanded\expandafter{\sw@inthisedtext}}% + \@percentchar\space%Explicit space, to add a linebreak in the output file + \noexpand\parse@annot\l@current@annot|\@percentchar\space% \expandafter\string\csname #1end\endcsname% {\ifnumberedpar@\l@d@nums\fi}% {\ifnumberedpar@\expandonce\@tag\fi}% @@ -5073,6 +5280,9 @@ \csgdef{Xendlemmafont@#1}{}% + \csgdef{Xendlinenumannotationposition@#1}{after}% + \csgdef{Xendwraplinenumannotation@#1}{\textsuperscript}% + \newtoggle{Xendpagenumberonlyfirst@#1}% \newtoggle{Xendpagenumberonlyfirstifsingle@#1}% \newtoggle{Xendpagenumberonlyfirstintwo@#1}% @@ -5243,7 +5453,6 @@ \newhookcommand@series{Xafternote}% \newhookcommand@series{Xparafootsep} - \newhookcommand@series@reload{Xwidth}{critical}% \ifundef{\Xhsize}% @@ -5263,6 +5472,8 @@ \newhooktoggle@series{Xtwolinesbutnotmore}[appref,SEref] \newhooktoggle@series{Xtwolinesonlyinsamepage}[appref,SEref] \newhookcommand@series{Xlinerangeseparator}[appref,SEref] +\newhookcommand@series{Xlinenumannotationposition}[side,appref,SEref]% +\newhookcommand@series{Xwraplinenumannotation}[side,ref,appref,SEref]% \unless\ifnofamiliar@ \newhookcommand@series{wrapcontentX}% \newhookcommand@series{beforeinsertingX}% @@ -5360,14 +5571,16 @@ \newhookcommand@series{Xendlineprefixmore}[apprefwithpage,SErefwithpage] \newhookcommand@series{Xendsublinesep}[apprefwithpage,SErefwithpage] +\newhookcommand@series{Xendlinenumannotationposition}[apprefwithpage,SErefwithpage]% +\newhookcommand@series{Xendwraplinenumannotation}[apprefwithpage,SErefwithpage]% \newcommand{\newhooktoggle@specific}[1]{% \newtoggle{#1@}% \define@key[mac]{truefootnoteoption}{#1}[]{\global\settoggle{#1@}{true}}%When enabling footnote option \define@key[mac]{falsefootnoteoption}{#1}[]{\global\settoggle{#1@}{false}} } \newcommand{\newhookarg@specific}[1]{% - \define@key[mac]{truefootnoteoption}{#1}{\global\def\linerangesep@{##1}}%When enabling footnote option - \define@key[mac]{falsefootnoteoption}{#1}{\global\undef\linerangesep@}%When + \define@key[mac]{truefootnoteoption}{#1}{\csgdef{#1@}{##1}}%When enabling footnote option + \define@key[mac]{falsefootnoteoption}{#1}{\global\csundef{#1@}}%When disabling footnote option } \newhooktoggle@specific{fulllines}% \newhooktoggle@specific{nonum} @@ -5570,6 +5783,7 @@ \list@create{\labelref@list} \newcommand*{\zz@@@}{000|000|000}% Set three counters to zero in one go +\newcommand*{\zz@@@@}{000|000|000|000}% Set four counters to zero in one go \newcommand*{\edlabel}[1]{% \leavevmode% @@ -5577,14 +5791,14 @@ \ifboolexpr{bool{ledRcol} or bool{ledRcol@}}{% \ifXnote@% \protected@write\@auxout{}% - {\string\l@dmake@labelsR\space\thepage|\l@dparsedstartline|\l@dparsedstartsub||\the\c@pstartR|{#1}}% + {\string\l@dmake@labelsR\space\thepage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstartR|{#1}}% \ifdef{\hypertarget}% {\Hy@raisedlink{\hypertarget{#1}{}}}% {}% \else% \write\linenum@outR{\string\@lab}% \ifx\labelref@listR\empty% - \xdef\label@refs{\zz@@@}% + \xdef\label@refs{\zz@@@@}% \else% \gl@p\labelref@listR\to\label@refs% \fi% @@ -5601,13 +5815,13 @@ \ifXnote@% \ifl@dpairing%pstart or pstartL? \protected@write\@auxout{}% - {\string\l@dmake@labels\space\thepage|\l@dparsedstartline|\l@dparsedstartsub||\the\c@pstartL|{#1}}% + {\string\l@dmake@labels\space\thepage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstartL|{#1}}% \ifdef{\hypertarget}% {\Hy@raisedlink{\hypertarget{#1}{}}}% {}% \else% \protected@write\@auxout{}% - {\string\l@dmake@labels\space\thepage|\l@dparsedstartline|\l@dparsedstartsub||\the\c@pstart|{#1}}% + {\string\l@dmake@labels\space\thepage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstart|{#1}}% \ifdef{\hypertarget}% {\Hy@raisedlink{\hypertarget{#1}{}}}% {}% @@ -5615,7 +5829,7 @@ \else% \write\linenum@out{\string\@lab}% \ifx\labelref@list\empty% - \xdef\label@refs{\zz@@@}% + \xdef\label@refs{\zz@@@@}% \else% \gl@p\labelref@list\to\label@refs% \fi% @@ -5659,29 +5873,36 @@ \def\labelrefsparsesubline#1|#2|#3{#2}% \def\labelrefsparseabsline#1|#2|#3{#3}% \newcommand*{\l@dmake@labels}{} -\def\l@dmake@labels#1|#2|#3|#4|#5|#6{% - \expandafter\ifx\csname the@label\csuse{XR@prefix}#6\endcsname% +\def\l@dmake@labels#1|#2|#3|#4|#5|#6|#7{% + \expandafter\ifx\csname the@label\csuse{XR@prefix}#7\endcsname% \relax% \else% - \led@warn@DuplicateLabel{\csuse{XR@prefix}#6}% + \led@warn@DuplicateLabel{\csuse{XR@prefix}#7}% \fi - \global\providetoggle{label@#6@ledRcol}%False is the default value of this toggle, which tell us if a label is linked to a right or a left side - \expandafter\gdef\csname the@label\csuse{XR@prefix}#6\endcsname{#1|#2|#3|#4|#5|\relax}% + \global\providetoggle{label@#7@ledRcol}%False is the default value of this toggle, which tells us whether a label is linked to the right or left side + \csgdef{the@label\csuse{XR@prefix}#7}{#1|#2|#3|#4|#5|#6|\relax}% \ignorespaces} \AtBeginDocument{% - \def\l@dmake@labels#1|#2|#3|#4|#5|#6{}% + \def\l@dmake@labels#1|#2|#3|#4|#5|#6|#7{}% } \newcommand*{\@lab}{% \ifledRcol \xright@appenditem{\linenumr@p{\line@numR}|% - \ifsublines@ \sublinenumr@p{\subline@numR}\else 0\fi|\the\absline@numR}% + \ifsublines@ \sublinenumr@p{\subline@numR}\else 0\fi|% + \the\absline@numR|% + \current@annot% + }% \to\labelref@listR \else - \xright@appenditem{\linenumr@p{\line@num}|% - \ifsublines@ \sublinenumr@p{\subline@num}\else 0\fi|\the\absline@num}% + \xright@appenditem{% + \linenumr@p{\line@num}|% + \ifsublines@ \sublinenumr@p{\subline@num}\else 0\fi|% + \the\absline@num|% + \current@annot% + }% \to\labelref@list \fi} \newcommand*{\applabel}[1]{% @@ -5693,32 +5914,33 @@ \led@warn@DuplicateLabel{#1 (applabel)}% }% \expandafter\l@dp@rsefootspec\l@d@nums|% + \expandafter\parse@annot\l@current@annot|% \@bsphack% \ifledRcol% \protected@write\@auxout{}% - {\string\l@dmake@labelsR\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub||\the\c@pstartR|{#1:start}}% + {\string\l@dmake@labelsR\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstartR|{#1:start}}% \ifdef{\hypertarget}% {\Hy@raisedlink{\hypertarget{#1:start}{}}}% {}% \protected@write\@auxout{}% - {\string\l@dmake@labelsR\space\l@dparsedendpage|\l@dparsedendline||\l@dparsedendsub|\the\c@pstartR|{#1:end}}% + {\string\l@dmake@labelsR\space\l@dparsedendpage|\l@dparsedendline||\l@dparsedendsub||\annot@end|\the\c@pstartR|{#1:end}}% \else% \ifl@dpairing%pstart or pstartL? \protected@write\@auxout{}% - {\string\l@dmake@labels\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub||\the\c@pstartL|{#1:start}}% + {\string\l@dmake@labels\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstartL|{#1:start}}% \ifdef{\hypertarget}% {\Hy@raisedlink{\hypertarget{#1:start}{}}}% {}% \protected@write\@auxout{}% - {\string\l@dmake@labels\space\l@dparsedendpage|\l@dparsedendline|\l@dparsedendsub||\the\c@pstartL|{#1:end}}% + {\string\l@dmake@labels\space\l@dparsedendpage|\l@dparsedendline|\l@dparsedendsub||\annot@end|\the\c@pstartL|{#1:end}}% \else% \protected@write\@auxout{}% - {\string\l@dmake@labels\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub||\the\c@pstart|{#1:start}}% + {\string\l@dmake@labels\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstart|{#1:start}}% \ifdef{\hypertarget}% {\Hy@raisedlink{\hypertarget{#1:start}{}}}% {}% \protected@write\@auxout{}% - {\string\l@dmake@labels\space\l@dparsedendpage|\l@dparsedendline|\l@dparsedendsub||\the\c@pstart|{#1:end}}% + {\string\l@dmake@labels\space\l@dparsedendpage|\l@dparsedendline|\l@dparsedendsub||\annot@end|\the\c@pstart|{#1:end}}% \fi% \fi% \@esphack% @@ -5768,10 +5990,21 @@ \newcommand*{\xsublineref}[1]{\l@dgetref@num{3}{#1}} \newcommand*{\xabslineref}[1]{\l@dgetref@num{4}{#1}}% -\newcommand*{\pstartref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{5}{#1}}}% -\newcommand*{\xpstartref}[1]{\l@dgetref@num{5}{#1}}% +\newcommand*{\annotationref}[1]{% + \l@dref@undefined{#1}% + \wrap@edcrossref{#1}{% + \l@wrap@ifnotemptybox{\Xwraplinenumannotation@ref}{% + \l@dgetref@num{5}{#1}% + }% + }% +}% +\newcommand*{\xannotationref}[1]{% + \l@dgetref@num{5}{#1}% +}% +\newcommand*{\pstartref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{6}{#1}}}% +\newcommand*{\xpstartref}[1]{\l@dgetref@num{6}{#1}}% -\newcommand*{\xflagref}[1]{\l@dgetref@num{6}{#1}}% +\newcommand*{\xflagref}[1]{\l@dgetref@num{7}{#1}}% \newcommand*{\l@dref@undefined}[1]{% \expandafter\ifx\csname the@label#1\endcsname\relax \led@warn@RefUndefined{#1}% @@ -5787,33 +6020,55 @@ \fi} \newcommand*{\l@dlabel@parse}{} -\def\l@dlabel@parse#1|#2|#3|#4|#5|#6|#7{% - \ifcase #7% +\def\l@dlabel@parse#1|#2|#3|#4|#5|#6|#7|#8{% + \ifcase #8% \or #1% \or #2% \or #3% \or #4% \or #5% \or #6% + \or #7% \fi} \newcommand*{\xxref}[2]{% {% - \expandafter\ifx\csname the@label#1\endcsname \relax% - \expandafter\let\csname the@@label#1\endcsname\zz@@@% + \expandafter\ifx\csname the@label#1\endcsname\relax% + \let\@tempa\zz@@@% + \def\@tempc{}% \else% - \expandafter\def\csname the@@label#1\endcsname{\l@dgetref@num{1}{#1}|\l@dgetref@num{2}{#1}|\l@dgetref@num{3}{#1}}% + \def\@tempa{% + \l@dgetref@num{1}{#1}|% + \l@dgetref@num{2}{#1}|% + \l@dgetref@num{3}{#1}% + }% + \edef\@tempc{% + \l@dgetref@num{5}{#1}% + }% \fi% - \expandafter\ifx\csname the@label#2\endcsname \relax% - \expandafter\let\csname the@@label#2\endcsname\zz@@@% + \expandafter\ifx\csname the@label#2\endcsname\relax% + \let\@tempb\zz@@@% + \def\@tempd{}% \else% - \expandafter\def\csname the@@label#2\endcsname{\l@dgetref@num{1}{#2}|\l@dgetref@num{2}{#2}|\l@dgetref@num{3}{#2}}% + \def\@tempb{% + \l@dgetref@num{1}{#2}|% + \l@dgetref@num{2}{#2}|% + \l@dgetref@num{3}{#2}% + }% + \edef\@tempd{% + \l@dgetref@num{5}{#2}% + }% \fi% - \letcs{\@tempa}{the@@label#1}% - \letcs{\@tempb}{the@@label#2}% - \global\appto\@beforeinsertofthisedtext{\def\@this@crossref@start{#1}}% - \global\appto\@beforeinsertofthisedtext{\def\@this@crossref@end{#2}}% - \linenum{\@tempa|% - \@tempb}}}% + \global\appto\@beforeinsertofthisedtext{% + \def\@this@crossref@start{#1}% + }% + \global\appto\@beforeinsertofthisedtext{% + \def\@this@crossref@end{#2}% + }% + \linenum{\@tempa|\@tempb}% + \edef\@tempe{\@tempc|\@tempd}% + \expandafter\lineannot\expandafter{\@tempe}% + }% +}% \def\Xtwolines@appref{}% \def\Xtwolines@SEref{}% @@ -5842,6 +6097,12 @@ \newtoggle{Xlineflag@SEref}% \toggletrue{Xlineflag@SEref}%%Here exception +\def\Xlinenumannotationposition@appref{after}% +\def\Xlinenumannotationposition@SEref{after}% + +\def\Xwraplinenumannotation@appref{\textsuperscript}% +\def\Xwraplinenumannotation@SEref{\textsuperscript}% + \def\Xendtwolines@apprefwithpage{}% \def\Xendtwolines@SErefwithpage{}% @@ -5879,6 +6140,11 @@ \newtoggle{Xendlineflag@SErefwithpage} \toggletrue{Xendlineflag@SErefwithpage}%Here, exception +\def\Xendlinenumannotationposition@apprefwithpage{after}% +\def\Xendlinenumannotationposition@apprefwithpage@SErefwithpage{after}% + +\def\Xendwraplinenumannotation@apprefwithpage{\textsuperscript}% +\def\Xendwraplinenumannotation@SErefwithpage{\textsuperscript}% \gdef\Xboxstartlinenum@appref{0pt} \gdef\Xboxstartlinenum@SEref{0pt} @@ -5962,6 +6228,8 @@ {% \def\@this@crossref@start{#2:start}% \def\@this@crossref@end{#2:end}% + \xdef\annot@start{\xannotationref{#2:start}}% + \xdef\annot@end{\xannotationref{#2:end}}% \printlines\xpageref{#2:start}|\xlineref{#2:start}|\xsublineref{#2:start}|\xpageref{#2:end}|\xlineref{#2:end}|\xsublineref{#2:end}|\relax|\xflagref{#2:start}|% \undef\@this@crossref@end% \undef\@this@crossref@start% diff --git a/Master/texmf-dist/tex/latex/reledmac/reledpar.sty b/Master/texmf-dist/tex/latex/reledmac/reledpar.sty index 0e7a22478e9..95e68061d36 100644 --- a/Master/texmf-dist/tex/latex/reledmac/reledpar.sty +++ b/Master/texmf-dist/tex/latex/reledmac/reledpar.sty @@ -28,7 +28,7 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{reledpar}[2017/08/31 v2.20.2 reledmac extension for parallel texts]% +\ProvidesPackage{reledpar}[2017/11/11 v2.21.0 reledmac extension for parallel texts]% \RequirePackage{xspace}% \RequirePackage{xkeyval} @@ -503,12 +503,24 @@ \kern\linenumsep \l@dlinenumR} \newcommand*{\l@dlinenumR}{% - \numlabfont\linenumrepR{\line@numR}\@Rlineflag% + \numlabfont% + \ifdefstring{\Xlinenumannotationposition@side}{before}{% + \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{% + \csuse{annotR@\the\absline@numR @\the\section@numR}% + }% + }{}% + \linenumrepR{\line@numR}\@Rlineflag% \ifsublines@R \ifnum\subline@numR>\z@ \unskip\fullstop\sublinenumrepR{\subline@numR}% \fi - \fi} + \fi% + \ifdefstring{\Xlinenumannotationposition@side}{after}{% + \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{% + \csuse{annotR@\the\absline@numR @\the\section@numR}% + }% + }{}% +}% \newcount\line@numR \newcount\subline@numR @@ -519,7 +531,7 @@ \list@create{\insertlines@listR} \list@create{\actionlines@listR} \list@create{\actions@listR} - +\list@create{\annot@listR}% \newcount\page@numR \list@create{\linesinpar@listL} @@ -547,6 +559,7 @@ }% \newcommand{\@nl@regR}{% \ifx\l@dchset@num\relax \else + \reset@current@annot% \advance\absline@numR \@ne \csgdef{l@dchset@num@R\the\absline@numR}{}%To remember this line have been marked by a \setlinenum \set@line@action @@ -657,16 +670,20 @@ \let\@lab=\relax \let\@lemma=\relax \let\@sw\@gobblethree% + \let\store@annot@to@absline\@gobble% #2 \global\endpage@num=\page@numR \global\endline@num=\line@numR \global\endsubline@num=\subline@numR + \global\let\endcurrent@annot=\current@annot% \endgroup \xright@appenditem% {\the\page@numR|\the\line@numR|% \ifsublines@R \the\subline@numR \else 0\fi|% \the\endpage@num|\the\endline@num|% \ifsublines@R \the\endsubline@num \else 0\fi}\to\line@listR + \xright@appenditem% + {\current@annot|\endcurrent@annot}\to\annot@list% \expandafter\list@create\expandafter{\csname sw@list@edtext@tmp@\the\@edtext@level\endcsname}% \@ref@reg@parseR{#2}% \global\advance\@edtext@level by -1% @@ -1941,18 +1958,18 @@ }% \list@create{\labelref@listR} -\def\l@dmake@labelsR#1|#2|#3|#4|#5|#6{% - \expandafter\ifx\csname the@label\csuse{XR@prefix}#6\endcsname% +\def\l@dmake@labelsR#1|#2|#3|#4|#5|#6|#7{% + \expandafter\ifx\csname the@label\csuse{XR@prefix}#7\endcsname% \relax% \else% - \led@warn@DuplicateLabel{\csuse{XR@prefix}#6}% + \led@warn@DuplicateLabel{\csuse{XR@prefix}#7}% \fi% - \expandafter\gdef\csname the@label\csuse{XR@prefix}#6\endcsname{#1|#2|#3|#4|#5|\@Rlineflag}% - \global\providetoggle{label@#6@ledRcol}%False is the default value of this toggle, which tell us if a label is linked to a right or a left side - \global\toggletrue{label@#6@ledRcol}% + \csgdef{the@label\csuse{XR@prefix}#7}{#1|#2|#3|#4|#5|#6|\@Rlineflag}% + \global\providetoggle{label@#7@ledRcol}%False is the default value of this toggle, which tells us whether a label is linked to the right or left side + \global\toggletrue{label@#7@ledRcol}% \ignorespaces} \AtBeginDocument{% - \def\l@dmake@labelsR#1|#2|#3|#4|#5|#6{}% + \def\l@dmake@labelsR#1|#2|#3|#4|#5|#6|#7{}% } \WithSuffix\newcommand\sidenotemargin*[1]{% -- cgit v1.2.3