summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/eledmac
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-25 22:54:05 +0000
committerKarl Berry <karl@freefriends.org>2015-04-25 22:54:05 +0000
commit4689c7acddfa64375a78e6703a6c2671131e3628 (patch)
treeb29d904b031e7f9ecd3f394c4643b8638ad49872 /Master/texmf-dist/tex/latex/eledmac
parentfe5c598c0d6412a89e1e3fdfb67bc23719750363 (diff)
eledmac (25apr15)
git-svn-id: svn://tug.org/texlive/trunk@37049 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/eledmac')
-rw-r--r--Master/texmf-dist/tex/latex/eledmac/eledmac.sty204
1 files changed, 177 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/latex/eledmac/eledmac.sty b/Master/texmf-dist/tex/latex/eledmac/eledmac.sty
index f5214429322..ca5ac4cd695 100644
--- a/Master/texmf-dist/tex/latex/eledmac/eledmac.sty
+++ b/Master/texmf-dist/tex/latex/eledmac/eledmac.sty
@@ -26,7 +26,7 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{eledmac}[2015/04/13 v1.21.0 LaTeX port of EDMAC]%
+\ProvidesPackage{eledmac}[2015/04/25 v1.22.0 LaTeX port of EDMAC]%
\newif\ifledfinal
\newif\ifoldprintnpnumspace@
\newif\ifnocritical@%
@@ -40,6 +40,8 @@
\newif\ifparledgroup
\newif\ifwidthliketwocolumns%
\newif\ifledsecnolinenumber
+\newif\ifxindy@
+\newif\ifxindyhyperref@
\parapparatus@false
\RequirePackage{xkeyval}
\DeclareOptionX{series}[A,B,C,D,E,Z]{\xdef\default@series{#1}}
@@ -63,6 +65,16 @@
\DeclareOptionX{nopbinverse}{\lednopbinversetrue}
\DeclareOptionX{ledsecnolinenumber}{\ledsecnolinenumbertrue}
\DeclareOptionX{widthliketwocolumns}{\widthliketwocolumnstrue}%
+\DeclareOptionX{xindy}[eledmac-markup-attr.xdy]{%
+ \AtBeginDocument{\immediate\openout\eledmac@xindy@out=#1}%
+ \newwrite\eledmac@xindy@out%
+ \xindy@true%
+ \gdef\eledmacmarkuplocrefdepth{:depth 1}%
+ \AtEndDocument{\immediate\closeout\eledmac@xindy@out}%
+}%
+\DeclareOptionX{xindy+hyperref}{%
+ \xindyhyperref@true%
+}%
\ExecuteOptionsX{series}%
\ExecuteOptionsX{final}
\ProcessOptionsX*\relax
@@ -2937,10 +2949,19 @@
\immediate\write\l@d@end{\string\l@d@section{\the\section@num}}}
\global\notbool{parapparatus@}{}{\long}\def\endprint#1#2#3#4#5{{%
+ \ifXendinsertsep@%
+ \hskip\csuse{Xendafternote@#4}%
+ \csuse{Xendsep@#4}%
+ \else%
+ \iftoggle{Xendparagraph@#4}%
+ {\global\Xendinsertsep@true}%
+ {}%
+ \fi%
\xdef\@currentseries{#4}%
- \IfStrEq{#5}{fulllines}%
- {\toggletrue{fulllines@}}%
- {}%
+ \def\do##1{%
+ \toggletrue{##1@}%
+ }%
+ \notblank{#5}{\docsvlist{#5}}{}%
\csuse{bhookXendnote@#4}%
\csuse{Xendnotefontsize@#4}%
{%
@@ -2954,8 +2975,20 @@
{\select@lemmafont#1|#2}%
{#2}%
}%
- \enskip#3\par%
+ \ifboolexpr{%
+ togl {nosep@}%
+ or test{\ifcsempty{Xendlemmaseparator@#4}}%
+ }%
+ {\hskip\csuse{Xendinplaceoflemmaseparator@#4}}%
+ {\nobreak%
+ \hskip\csuse{Xendbeforelemmaseparator@#4}%
+ \csuse{Xendlemmaseparator@#4}%
+ \hskip\csuse{Xendafterlemmaseparator@#4}%
+ }%
+ #3%
+ \nottoggle{Xendparagraph@#4}{\par}{}%
\togglefalse{fulllines@}%
+ \togglefalse{nosep@}%
}}%
\let\l@d@section=\@gobble
@@ -3042,12 +3075,28 @@
\newcommand*{\printnpnum}[1]{p.#1) }
+\newif\ifXendinsertsep@%
\newcommand*{\doendnotes}[1]{\l@dend@close
\begingroup
\makeatletter
\expandafter\let\csname #1end\endcsname=\endprint
\input\jobname.end
+ \global\Xendinsertsep@false%
\endgroup}
+\newcommand*{\doendnotesbysection}[1]{%
+ \l@dend@close%
+ \global\expandafter\advance\csname #1end@bysection\endcsname by 1%
+ \begingroup%
+ \makeatletter%
+ \def\l@d@section##1{%
+ \ifnumequal{##1}{\csname #1end@bysection\endcsname}%
+ {\cslet{#1end}{\endprint}}%
+ {\cslet{#1end}{\@gobblefive}}%
+ }%
+ \input\jobname.end%
+ \global\Xendinsertsep@false%
+ \endgroup%
+}%
\newcommand*{\noendnotes}{%
\led@war@noendnotesDeprecated%
\global\let\l@dend@stuff=\relax%
@@ -3155,6 +3204,7 @@
\led@err@FootnoteWithoutEdtext%
\fi%
}
+ \global\csletcs{#1@@footnote}{#1footnote}
\footnormal{#1}
\fi
\unless\ifnofamiliar@
@@ -3212,13 +3262,14 @@
{\expandonce\content}%
{#1}%
{##1}%
+ \@percentchar%
}%
\egroup%
\ignorespaces%
}%
\global\cslet{#1end}{\@gobblefive}
- \global\csletcs{#1@@footnote}{#1footnote}
+ \global\expandafter\newcount\csname #1end@bysection\endcsname%
\csgdef{Xendtwolines@#1}{}%
\csgdef{Xendmorethantwolines@#1}{}%
\newtoggle{Xendtwolinesbutnotmore@#1}{}%
@@ -3228,6 +3279,14 @@
\csgdef{Xendnotefontsize@#1}{\notefontsetup}%
\csgdef{bhookXendnote@#1}{}%
\csgdef{boxXendlinenum@#1}{0pt}%
+ \csgdef{Xendlemmaseparator@#1}{}%
+ \csgdef{Xendbeforelemmaseparator@#1}{0em}%
+ \csgdef{Xendafterlemmaseparator@#1}{0.5em}%
+ \csgdef{Xendinplaceoflemmaseparator@#1}{0.5em}%
+
+ \newtoggle{Xendparagraph@#1}%
+ \csgdef{Xendafternote@#1}{1em plus.4em minus.4em}%
+ \csgdef{Xendsep@#1}{}%
\fi%
\listxadd{\@series}{#1}
}
@@ -3392,6 +3451,14 @@
\newhookcommand@series{boxXendlinenum}%
\newhookcommand@series{Xendnotefontsize}
\newhooktoggle@series{Xendlemmadisablefontselection}
+ \newhookcommand@series{Xendlemmaseparator}
+ \newhookcommand@series{Xendbeforelemmaseparator}
+ \newhookcommand@series{Xendafterlemmaseparator}
+ \newhookcommand@series{Xendinplaceoflemmaseparator}
+
+ \newhooktoggle@series{Xendparagraph}
+ \newhookcommand@series{Xendafternote}
+ \newhookcommand@series{Xendsep}
\fi
\newcommand*{\notenumfont}{\normalfont}
\newcommand*{\notefontsetup}{\footnotesize}
@@ -3435,7 +3502,10 @@
{%Be sure the \prevline exists.
\ifcsequal{prevline#2}{lineinfo@}%Try it
{%
- \IfStrEq{\csuse{symlinenum@#2}}{}%
+ \expandafter\ifstrempty\expandafter{\csuse{symlinenum@#2}}%This test use a complex construction with two expand after and not simple test. The following tests are not working:
+ %1) single `\ifstrempty{\csuse{symlinenum@#2}}` won't work because it will test `\csuse{symlinenum@#2}` and not the expansion of `\csuse{symlinenum@#2}`. So in never case will be empty.
+ %2) `\IfStrEq{\csuse{symlinenum@#2}}{}` is problematic for full expansion of \csuse{symlinenum@#2} when the first level of expansion is \textbardbl.
+ %3) `\ifcsempty{symlinenum@#2}` won't work if user doesn't use `\symlinenum{}`, because the default definition of `\symlinenum@#2` is `\symplinenum` and we need to keep this definition in order to avoid breaking backward compatibility with ledmac (see http://tex.stackexchange.com/a/232734/7712 for an example of problem with `\ifcsempty{symlinenum@#2}`
{%
\hspace{\csuse{inplaceofnumber@#2}}%
}%
@@ -3708,7 +3778,7 @@
\fi%
\protected@write\@auxout{}%
{\string\l@dmake@labelsR\space\thepage|\label@refs|\the\c@pstartR|{#1}}%
- \ifdef{\hypertarget}{\hypertarget{#1}{}}{}%
+ \ifdef{\hypertarget}{\Hy@raisedlink{\hypertarget{#1}{}}}{}%
\else%
\write\linenum@out{\string\@lab}%
\ifx\labelref@list\empty%
@@ -3721,7 +3791,7 @@
\fi%
\protected@write\@auxout{}%
{\string\l@dmake@labels\space\thepage|\label@refs|\the\c@pstart|{#1}}%
- \ifdef{\hypertarget}{\hypertarget{#1}{}}{}%
+ \ifdef{\hypertarget}{\Hy@raisedlink{\hypertarget{#1}{}}}{}%
\fi%
\@esphack}%
@@ -3769,13 +3839,13 @@
\ifledRcol%
\protected@write\@auxout{}%
{\string\l@dmake@labelsR\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub|\the\c@pstartR|{#1:start}}%
- \ifdef{\hypertarget}{\hypertarget{#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}}%
\else%
\protected@write\@auxout{}%
{\string\l@dmake@labels\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub|\the\c@pstart|{#1:start}}%
- \ifdef{\hypertarget}{\hypertarget{#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}}%
\fi%
@@ -4264,7 +4334,39 @@
\newif\if@edindex@fornote@
\newcommand{\prepare@edindex@fornote}[1]{%
\l@dp@rsefootspec#1|%
- \@edindex@fornote@true
+ \@edindex@fornote@true%
+}
+\newcommand{\get@edindex@ledinnote@command}{%
+ \ifxindy@%
+ \gdef\@ledinnote@command{%
+ ledinnote\thelabidx%
+ }%
+ \ifxindyhyperref@%
+ \immediate\write\eledmac@xindy@out{%
+ (define-attributes ("ledinnote\thelabidx"))^^J
+ \space\space(markup-locref^^J
+ \eledmacmarkuplocrefdepth^^J
+ :open "\string\ledinnote[\edindexlab\thelabidx]{\@index@command}{"^^J
+ :close "}"^^J
+ :attr "ledinnote\thelabidx"^^J
+ )
+ }%
+ \else%
+ \immediate\write\eledmac@xindy@out{%
+ (define-attributes ("ledinnote\thelabidx"))^^J
+ \space\space(markup-locref^^J
+ \eledmacmarkuplocrefdepth^^J
+ :open "\string\ledinnote{\@index@command}{"^^J
+ :close "}"^^J
+ :attr "ledinnote\thelabidx"^^J
+ )
+ }%
+ \fi%
+ \else%
+ \gdef\@ledinnote@command{%
+ ledinnote[\edindexlab\thelabidx]{\@index@command}%
+ }%
+ \fi%
}
\def\get@index@command#1|#2+{%
\gdef\@index@txt{#1}%
@@ -4281,7 +4383,19 @@
\xdef\@index@parenthesis{)}%
}{}%
}
-\newcommand{\ledinnote}[2]{\csuse{#1}{\ledinnotemark{#2}}}%
+\newcommandx{\ledinnote}[3][1,usedefault]{%
+ \ifboolexpr{%
+ test{\ifdefequal{\iftrue}{\ifHy@hyperindex}}%
+ or%
+ bool {xindyhyperref@}%
+ }%
+ {%
+ \csuse{#2}{\hyperlink{#1}{\ledinnotemark{#3}}}%
+ }%
+ {%
+ \csuse{#2}{\ledinnotemark{#3}}%
+ }%
+}%
\newcommand{\ledinnotehyperpage}[2]{\csuse{#1}{\ledinnotemark{\hyperpage{#2}}}}%
\newcommand{\ledinnotemark}[1]{#1\emph{n}}%
\def\create@edindex@for@memoir{
@@ -4349,8 +4463,9 @@
\ifl@imakeidx%
\if@edindex@fornote@%
\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}%
+ \get@edindex@ledinnote@command%
+ \expandafter\imki@wrindexentry{##1}{\@index@txt|(\@ledinnote@command}{\thestartpageline}%
+ \expandafter\imki@wrindexentry{##1}{\@index@txt|)\@ledinnote@command}{\theendpageline}%
\else%
\get@edindex@hyperref{##2}%
\imki@wrindexentry{##1}{\@index@txt\@edindex@hyperref}{\thepageline}%
@@ -4358,11 +4473,12 @@
\else%
\if@edindex@fornote@%
\IfSubStr[1]{##2}{|}{\get@index@command##2+}{\get@index@command##2|+}%
+ \get@edindex@ledinnote@command%
\expandafter\protected@write\@indexfile{}%
- {\string\indexentry{\@index@txt|(ledinnote{\@index@command}}{\thestartpageline}
+ {\string\indexentry{\@index@txt|(\@ledinnote@command}{\thestartpageline}
}%
\expandafter\protected@write\@indexfile{}%
- {\string\indexentry{\@index@txt|)ledinnote{\@index@command}}{\theendpageline}
+ {\string\indexentry{\@index@txt|)\@ledinnote@command}{\theendpageline}
}%
\else%
\protected@write\@indexfile{}%
@@ -4405,13 +4521,12 @@
}%
\newcommand{\get@edindex@hyperref}[1]{%
- \ifdefequal{\iftrue}{\ifHy@hyperindex}%
- {%
- \edef\temp@{%
- \catcode`\ =9 %space need for catcode
- #1%
- \catcode`\ =10 % space need for catcode
- }%
+ \edef\temp@{%
+ \catcode`\ =9 %space need for catcode
+ #1%
+ \catcode`\ =10 % space need for catcode
+ }%
+ \ifdefequal{\iftrue}{\ifHy@hyperindex}{%
\IfSubStr{\temp@}{|}%
{\get@index@command#1+%
\ifledRcol%
@@ -4432,9 +4547,44 @@
\fi%
}%
}%
- {%
- \gdef\@index@txt{#1}%
- \gdef\@edindex@hyperref{}}%
+ {\ifxindyhyperref@%
+ \IfSubStr{\temp@}{|}%
+ {\get@index@command#1+}%
+ {\get@index@command#1|+}%
+ \gdef\@edindex@hyperref{|eledmac\thelabidx}%
+ \IfStrEq{\@index@parenthesis}{(}%
+ {%
+ \csxdef{xindyparenthesis@\@index@txt}{\thelabidx}%
+ \gdef\@edindex@hyperref{|(eledmac\thelabidx}%
+ }%
+ {}%
+ \IfStrEq{\@index@parenthesis}{)}%
+ {%
+ \xdef\@edindex@hyperref{|)eledmac\csuse{xindyparenthesis@\@index@txt}}%
+ \global\csundef{xindyparenthesis@\@index@txt}%
+ }%
+ {
+ \immediate\write\eledmac@xindy@out{%
+ (define-attributes ("eledmac\thelabidx"))^^J
+ \space\space(markup-locref^^J
+ \eledmacmarkuplocrefdepth^^J
+ :open "\string\hyperlink%
+ \ifledRcol R\fi%
+ {\edindexlab\thelabidx}%
+ {\ifdefempty{\@index@command}%
+ {}%
+ {\@backslashchar\@index@command}%
+ {"^^J
+ :close "}}"^^J
+ :attr "eledmac\thelabidx"^^J
+ )
+ }%
+ }%
+ \else%
+ \gdef\@index@txt{#1}%
+ \gdef\@edindex@hyperref{}%
+ \fi%
+ }%
}
\newtoks\@emptytoks