summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/eledmac/eledmac.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-06-15 23:28:58 +0000
committerKarl Berry <karl@freefriends.org>2015-06-15 23:28:58 +0000
commit210f6b4d5e219769ade60e62594dbea850759243 (patch)
tree621b069b0b55efdd833052e1cf4cad7d7003a5b8 /Master/texmf-dist/tex/latex/eledmac/eledmac.sty
parent20e51a25c22700214c05b35772c0f08180182e9b (diff)
eledmac (2jun15)
git-svn-id: svn://tug.org/texlive/trunk@37555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/eledmac/eledmac.sty')
-rw-r--r--Master/texmf-dist/tex/latex/eledmac/eledmac.sty431
1 files changed, 303 insertions, 128 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