diff options
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty | 394 |
1 files changed, 305 insertions, 89 deletions
diff --git a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty index c313fe5d29c..2bacb9f9159 100644 --- a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty +++ b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty @@ -41,13 +41,15 @@ %% Running "make inst" installs the files in the user's TeX tree. \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{ekdosis} - [2021/04/02 v1.2 Typesetting TEI xml-compliant critical editions] + [2021/08/18 v1.3 Typesetting TEI xml-compliant critical editions] \RequirePackage{iftex} \RequireLuaTeX \RequirePackage{expkv-opt} \RequirePackage{expkv-def} \newif\if@pkg@float \newif\if@pkg@footins +\newif\if@pkg@keyfloat +\newif\if@pkg@fitfloat \newif\if@pkg@ekddivs \newif\if@parnotesroman \newif\if@pkg@parnotes @@ -55,7 +57,9 @@ \newif\if@pkg@poetry@verse \ekvdefinekeys{ekdosis}{ choice layout = {float = {\@pkg@floattrue}, - footins = {\@pkg@floatfalse\@pkg@footinstrue}}, + footins = {\@pkg@floatfalse\@pkg@footinstrue}, + keyfloat = {\@pkg@floatfalse\@pkg@keyfloattrue}, + fitfloat = {\@pkg@floatfalse\@pkg@fitfloattrue}}, initial layout = float, unknown-choice layout = \PackageError{ekdosis}{unknown layout=#1}{`layout' must be either `float' or `footins'.}, @@ -95,7 +99,21 @@ \RequirePackage{paracol} \RequirePackage{etoolbox} \RequirePackage{lineno} -\RequirePackage{keyfloat} +\if@pkg@float + \RequirePackage{trivfloat} + \trivfloat{ekdapparatus} +\fi +\if@pkg@keyfloat + \RequirePackage{keyfloat} + \def\ekd@keyparopts#1{% + \def\ekd@insert@keyparapp{% + \keyparbox[!b]{#1}{\ekd@insert@apparatus}}} + \ekd@keyparopts{} +\fi +\if@pkg@fitfloat + \RequirePackage{tcolorbox} + \tcbuselibrary{fitting,skins} +\fi \RequirePackage{refcount} \RequirePackage{zref-user} \RequirePackage{zref-abspage} @@ -112,12 +130,32 @@ \AtEndDocument{ \luadirect{ekdosis.closestream()} } +\ekvdefinekeys{ekd@setup}{ + bool showpagebreaks = \ifekd@showpb, + store spbmk = \ekd@spbmk, + initial spbmk = spb, + store hpbmk = \ekd@hpbmk, + initial hpbmk = hpb, +} +\NewDocumentCommand{\ekdsetup}{m}{\ekvset{ekd@setup}{#1}} +\@onlypreamble\ekdsetup \ekvdefinekeys{ekd@hooks}{ store appfontsize = \ekd@appfontsize, store refnumstyle = \ekd@refnumstyle, store postrefnum = \ekd@postrefnum, store lemmastyle = \ekd@lemmastyle, store readingstyle = \ekd@readingstyle, + code keyparopts = \if@pkg@keyfloat\ekd@keyparopts{#1}\fi, + dimen appheight = \ekd@app@height, + initial appheight = .5\textheight, + choice fitalgorithm = {fontsize = \def\ekd@fit@algorithm{fontsize}, + hybrid = \def\ekd@fit@algorithm{hybrid}, + areasize = \def\ekd@fit@algorithm{areasize}, + squeeze = \def\ekd@fit@algorithm{squeeze}}, + initial fitalgorithm = fontsize, + unknown-choice fitalgorithm = \PackageError{ekdosis}{unknown + fitalgorithm=#1}{`fitalgorithm' must be either `fontsize', + `hybrid', `areasize' or `squeeze'.}, code initialrule = \def\ekd@initial@rule{#1\NLS}, default initialrule = \rule{0.4\columnwidth}{0.4pt}, noval noinitialrule = \undef\ekd@initial@rule, @@ -135,7 +173,8 @@ store collection = \collection@value, store idno = \idno@value, store msName = \msName@value, - store origDate = \origDate@value + store origDate = \origDate@value, + store locus = \locus@value } \NewDocumentCommand{\DeclareWitness}{m m m O{}}{% \bgroup @@ -150,7 +189,8 @@ \luastringO{\collection@value}, \luastringO{\idno@value}, \luastringO{\msName@value}, - \luastringO{\origDate@value})} + \luastringO{\origDate@value}, + \luastringO{\locus@value})} \egroup } \@onlypreamble\DeclareWitness @@ -214,6 +254,7 @@ \luastringN{#2}, \luastringN{#3})} } +\NewDocumentCommand{\teidirect}{O{}mm}{\ignorespaces} \NewDocumentCommand{\EnvtoTEI}{s m m O{}}{% \IfBooleanTF{#1}{% \luadirect{ekdosis.newenvtotag(\luastringN{#2}, @@ -237,6 +278,11 @@ \luadirect{ekdosis.addxmlbibresource(\luastringN{#1})} } \@onlypreamble\AddxmlBibResource +\newif\ifekd@lang@pkg +\NewDocumentCommand{\ekd@test@lang}{}{% + \ltx@ifpackageloaded{babel}{\ekd@lang@pkgtrue}{}% + \ltx@ifpackageloaded{polyglossia}{\ekd@lang@pkgtrue}{}% +} \newif\ifekd@mapps \ekvdefinekeys{ekd@newapp}{ choice direction = {LR = \def\direction@val{LR}, @@ -251,6 +297,7 @@ store ehook = \ehook@val, store maxentries = \limit@val, store lang = \lang@val, + store notelang = \notelang@val, initial direction = LR, initial delim = {}, initial ehook = {\csname ekd@end@apparatus\endcsname} @@ -270,7 +317,8 @@ \luastringO{\bhook@val}, \luastringO{\ehook@val}, \luastringO{\limit@val}, - \luastringO{\lang@val} + \luastringO{\lang@val}, + \luastringO{\notelang@val} )} \egroup } @@ -279,33 +327,47 @@ \luadirect{ekdosis.addto_bagunits(\luastringO{#1}, \luastringN{#2})}% \ignorespaces } -\NewDocumentCommand{\ekdpb}{o m}{% - \def\@tmpoarg{#1}% - \def\@tmpmarg{#2}% - \luadirect{ekdosis.dolnlab(\luastringN{#2})}% - \linelabel{\luadirect{tex.sprint(ekdosis.getlnlab())}}% - \def\tmp@ln{% - \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% - \def\tmp@pg{% - \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% - \IfNoValueTF{#1} - {\ifnum - \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 - \pagebreak - \fi} - {\ifnum - \pdf@strcmp{\@tmpoarg}{\tmp@pg} = 0 - \ifnum - \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 - \pagebreak - \fi - \fi +\newcounter{ekd@pb} +\globalcounter{ekd@pb} +\NewDocumentCommand{\ekdpb}{s o m}{% + \IfBooleanTF{#1} + {\ifekd@showpb\marginpar{\ekd@hpbmk}\fi + \pagebreak} + {% + \def\@tmpoarg{#2}% + \def\@tmpmarg{#3}% + \stepcounter{ekd@pb}% + \linelabel{ekdpb:\theekd@pb}% + \def\tmp@ln{% + \getrefnumber{ekdpb:\theekd@pb}}% + \def\tmp@pg{% + \getpagerefnumber{ekdpb:\theekd@pb}}% + \IfNoValueTF{#2} + {\ifnum + \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 + \ifekd@showpb\marginpar{\ekd@spbmk}\fi + \pagebreak + \else + \ifekd@showpb\marginpar{[\ekd@spbmk]}\fi + \fi} + {\ifnum + \pdf@strcmp{\@tmpoarg}{\tmp@pg} = 0 + \ifnum + \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 + \ifekd@showpb\marginpar{\ekd@spbmk}\fi + \pagebreak + \else + \ifekd@showpb\marginpar{[\ekd@spbmk]}\fi + \fi + \fi + }% }\ignorespaces } \newbool{do@app} \newif\ifekd@state \newif\ifekd@isinapp \newif\ifekd@isinlem +\newif\ifekd@appinapp \providebool{al@rlmode} \@ifpackageloaded{arabluatex}{}{% \def\setRL{\booltrue{al@rlmode}\pardir TRT\textdir TRT} @@ -356,7 +418,11 @@ initial rule = \rule{0.4\columnwidth}{0.4pt}, noval norule = \def\ekd@default@rule{\mbox{}}, store lang = \ekd@singleapp@lang, - initial lang = \ltx@ifpackageloaded{babel}{\languagename}{} + initial lang = \ltx@ifpackageloaded{babel}{\languagename}{% + \ltx@ifpackageloaded{polyglossia}{\languagename}{}}, + store notelang = \ekd@singleapp@note@lang, + initial notelang = \ltx@ifpackageloaded{babel}{\languagename}{% + \ltx@ifpackageloaded{polyglossia}{\languagename}{}} } \NewDocumentCommand{\SetApparatus}{m}{ \ekvset{default@app}{#1} @@ -369,6 +435,8 @@ \NewDocumentCommand{\SetUnitDelimiter}{m}{\def\ekd@unit@delim{#1}} \NewDocumentCommand{\SetApparatusLanguage}{m}{% \def\ekd@singleapp@lang{#1}} +\NewDocumentCommand{\SetApparatusNoteLanguage}{m}{% + \def\ekd@singleapp@note@lang{#1}} \newif\iffootnoterule \footnoteruletrue \let\dflt@footnoterule\footnoterule @@ -401,6 +469,35 @@ \newif\ifsubsq@unit \subsq@unittrue \newif\ifekd@inside@app +\if@pkg@fitfloat + \newtcboxfit{\ekd@fitapp}{% + blankest, + fit basedim = \f@size pt, + fit fontsize macros, + fit height from=0pt to \ekd@app@height, + fit algorithm = \ekd@fit@algorithm, + float=!b} +\fi +\long\def\ekd@insert@apparatus{% + \unless\ifekd@mapps + \ifrtl@app\pardir TRT\leavevmode\textdir TRT\else + \pardir TLT\leavevmode\textdir TLT\fi + \fi + \if@pkg@parnotes + \if@parnotesroman + \renewcommand*{\theparnotemark}{\roman{parnotemark}}\fi + \parnoteclear\fi + \ekd@inside@apptrue + \ekd@appfontsize + \ifekd@mapps + \ifdefined\ekd@initial@rule + \ekd@initial@rule + \fi + \fi + \apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi + \ekd@inside@appfalse + \if@pkg@parnotes\parnotes\parnotereset\fi +}% \def\add@@apparatus{% \if@pkg@parnotes\parnotes\else\fi \if@pkg@footins @@ -428,26 +525,15 @@ \egroup \fi \if@pkg@float - \keyparbox[!b]{}{% - \unless\ifekd@mapps - \ifrtl@app\pardir TRT\leavevmode\textdir TRT\else - \pardir TLT\leavevmode\textdir TLT\fi - \fi - \if@pkg@parnotes - \if@parnotesroman - \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi - \parnoteclear\else\fi - \ekd@inside@apptrue - \ekd@appfontsize - \ifekd@mapps - \ifdefined\ekd@initial@rule - \ekd@initial@rule - \fi - \fi - \apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi - \ekd@inside@appfalse - \if@pkg@parnotes\parnotes\parnotereset\else\fi - }% + \begin{ekdapparatus}[!b]% + \ekd@insert@apparatus + \end{ekdapparatus}% + \fi + \if@pkg@keyfloat + \ekd@insert@keyparapp + \fi + \if@pkg@fitfloat + \ekd@fitapp{\ekd@insert@apparatus}% \fi } \def\add@apparatus{% @@ -498,7 +584,9 @@ \newif\ifekd@elidednumbers \ekvdefinekeys{ekd@lineation}{ choice lineation = {page = \ekd@pagelineationtrue, - document = \ekd@pagelineationfalse}, + document = \ekd@pagelineationfalse, + none = \ekd@pagelineationtrue + \renewcommand\thelinenumber{}}, unknown-choice lineation = \PackageError{ekdosis}{unknown lineation=#1}{`lineation' must be either `page' or `document'.}, choice vlineation = {page = \ekd@pagevlineationtrue, @@ -544,14 +632,16 @@ \leavevmode \begingroup \ekvset{appnote}{#1}% - \ekd@isinapptrue% + \ifekd@isinapp\ekd@appinapptrue\fi + \ekd@isinapptrue \stepcounter{ekd@lab}% \zlabel{ekd:\theekd@lab}% \luadirect{ekdosis.storeabspg( \luastring{\zref@extract{ekd:\theekd@lab}{abspage}})}% - \ifekd@state\add@apparatus\fi% + \ifekd@state\add@apparatus\fi \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% - \ekd@isinappfalse% + \ekd@isinappfalse + \ekd@appinappfalse \endgroup} \def\current@ref@arg#1#2{{%\textdir TLT% \unexpanded\expandafter{\ekd@refnumstyle}% @@ -604,10 +694,16 @@ \fi \fi% \else - \LRnum{\getrefnumber{#1}}--% - \LRnum{\getpagerefnumber{#2}}.% - \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos + \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}} + {\LRnum{\getrefnumber{#1}}--% + \LRnum{\getpagerefnumber{#2}}.% + \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos + {\LRnum{\getrefnumber{#1}}--% + \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}}% issue the nos \fi% + \ifekdn@forcenum + \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% force the no + \fi }% } \def\current@ref{{%\textdir TLT% @@ -632,6 +728,28 @@ {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}} = 0 + %%%begin + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-e}} + = + 0 + \ifekd@appinapp + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}} + = + 0 + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + \fi + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + %%% end \else \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% \unexpanded\expandafter{\ekd@postrefnum}% issue the no @@ -646,6 +764,28 @@ {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}} = 0 + %%%begin + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-e}} + = + 0 + \ifekd@appinapp + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}} + = + 0 + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + \fi + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + %%% end \else \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% \unexpanded\expandafter{\ekd@postrefnum}% issue the no @@ -670,13 +810,23 @@ \fi \fi% \else - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% - \LRnum{\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}.% - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% - \unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos + \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}} + {\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% + \LRnum{\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}.% + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + \unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos + {\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + \unexpanded\expandafter{\ekd@postrefnum}}% issue the nos \fi% + \ifekdl@forcenum + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% force the no + \fi }% } +\newif\ifekdl@forcenum +\newif\ifekdl@nonum \ekvdefinekeys{lem}{ code wit = \def\ekdlr@wit{#1}, code source = \def\ekdlr@source{#1}, @@ -688,6 +838,8 @@ code postwit = \def\ekdlr@postwit{#1}, store type = \ekdlr@type, store sep = \ekdl@sep, + noval nonum = \ekdl@nonumtrue, + noval num = \ekdl@forcenumtrue, bool nolem = \ifekdl@nolem, bool nosep = \ifekdl@nosep, initial sep = \ekdsep @@ -714,12 +866,22 @@ \ekd@singleapp@lang \fi } +\def\app@note@lang{% + \ifekd@mapps + \luadirect{tex.sprint(ekdosis.getappnotelang(\luastring{\ekdan@type}))}% + \else + \ekd@singleapp@note@lang + \fi +} \NewDocumentCommand{\lem}{O{} m}{% \ekd@isinlemtrue% \luadirect{ekdosis.dolnlab(\luastringN{#2})}% \null \bgroup% + \ekdl@forcenumfalse + \ekdl@nonumfalse \ekvset{lem}{#1}% + \ekd@test@lang \ifekd@mapps% \ifnum% \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))} @@ -739,7 +901,7 @@ \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref}%\hskip .25em}% + \unless\ifekdl@nonum\current@ref\fi}%\hskip .25em}% \else% \ifbool{al@rlmode}{% \edef\lem@app{% @@ -750,7 +912,7 @@ \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref%\hskip .25em + \unless\ifekdl@nonum\current@ref\fi%\hskip .25em \ifdefined\ekdlr@alt% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi @@ -785,11 +947,11 @@ \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref%\hskip .25em + \unless\ifekdl@nonum\current@ref\fi%\hskip .25em \ifdefined\ekdlr@alt% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdlr@alt}}}% @@ -800,7 +962,7 @@ \else \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded{#2}}}{% @@ -831,6 +993,7 @@ \NewDocumentCommand{\rdg}{O{} m}{% \bgroup% \ekvset{rdg}{#1}% + \ekd@test@lang % \ifekdr@nordg\append@app{}\else% do we need \append@app{} here? If % % so, keep in mind \ifekd@mapps, % like so: @@ -872,7 +1035,7 @@ \ifdefined\ekdlr@alt% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@readingstyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdlr@alt}}}% @@ -883,7 +1046,7 @@ \else \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@readingstyle}% \noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% {\unexpanded\expandafter{\ekd@readingstyle}\unexpanded{#2}}}% @@ -907,6 +1070,7 @@ \fi% \egroup% } +\newif\ifekdn@forcenum \ekvdefinekeys{note}{ store type = \ekdan@type, store lem = \ekdn@lem, @@ -915,12 +1079,15 @@ store sep = \ekdn@sep, bool nosep = \ifekdn@nosep, initial type = default, - initial sep = \ekdsep + initial sep = \ekdsep, + bool nonum = \ifekdn@nonum, + noval num = \ekdn@forcenumtrue } \NewDocumentCommand{\note@noapp}{O{} +m}{% \leavevmode \bgroup% \ekvset{note}{#1}% + \ekd@test@lang \stepcounter{ekd@lab}% \zlabel{ekd:\theekd@lab}% \luadirect{ekdosis.storeabspg( @@ -951,7 +1118,7 @@ \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em + \unless\ifekdn@nonum\current@ref@arg{\ekdn@labelb}{\ekdn@labele}\fi%\hskip .25em \ifdefined\ekdn@lem% {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}% \unexpanded\expandafter{\ekdn@lem}}% @@ -967,9 +1134,9 @@ \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em + \unless\ifekdn@nonum\current@ref@arg{\ekdn@labelb}{\ekdn@labele}\fi%\hskip .25em \ifdefined\ekdn@lem - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdn@lem}}}% @@ -978,8 +1145,8 @@ \unless\ifekdn@nosep \unexpanded\expandafter{\ekdn@sep}\fi \else\fi% - \ltx@ifpackageloaded{babel}% - {{\noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% + \ifbool{ekd@lang@pkg}% + {{\noexpand\selectlanguage{\app@note@lang}\unexpanded{#2}}}{% {\unexpanded{#2}}}}}% \ifekd@mapps% \unconditional@appin[\ekdan@type]{\note@contents}% @@ -1013,25 +1180,25 @@ \egroup% } \NewDocumentCommand{\ekd@note@star}{O{} m}{% - \if@pkg@parnotes - \bgroup% - \ekvset{ekd@note}{#1}% - \edef\note@contents{% - \ekvifdefinedNoVal{ekd@note}{pre}{}{% - \unexpanded\expandafter{\pre@value}}% - \unskip\noexpand\parnote{\unexpanded{#2}}% - \ekvifdefinedNoVal{ekd@note}{post}{}{% - \unexpanded\expandafter{\post@value}}% - }% - \append@app{\note@contents}% - \egroup% - \else - \ifekd@mapps% + \bgroup + \ekvset{ekd@note}{#1}% + \edef\note@contents{% + \ekvifdefinedNoVal{ekd@note}{pre}{}{% + \unexpanded\expandafter{\pre@value}}% + \if@pkg@parnotes + \unskip\noexpand\parnote{\unexpanded{#2}}% + \else + \unskip\noexpand\footnote{\unexpanded{#2}}% + \fi + \ekvifdefinedNoVal{ekd@note}{post}{}{% + \unexpanded\expandafter{\post@value}}% + }% + \ifekd@mapps \append@app[\ekdan@type]{\note@contents}% - \else% + \else \append@app{\note@contents}% - \fi% - \fi% + \fi + \egroup } \NewDocumentCommand{\note@app}{s O{} +m}{% \ifbool{al@rlmode}{% @@ -1207,6 +1374,54 @@ \luadirect{ekdosis.flushenvdata()} \luadirect{ekdosis.flushcolnums()} } +\NewDocumentCommand{\ekd@storemark}{m}{% + \stepcounter{ekd@lab}% + \label{ekd:\theekd@lab}% + \luadirect{ekdosis.storehfmark( + \luastring{\getpagerefnumber{ekd:\theekd@lab}}, + \luastringN{#1})}% +} +\NewDocumentCommand{\endmark}{}{% + \stepcounter{ekd@lab}% + \label{ekd:\theekd@lab}% + \luadirect{ekdosis.storehfmark( + \luastring{\getpagerefnumber{ekd:\theekd@lab}}, + "", "endmk")}% + \ifdefined\xspace\xspace\fi +} +\NewDocumentCommand{\ekdmark}{}{% + \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}% +} +\ekvdefinekeys{ekd@marks}{ + choice mark = {HEL = \def\ekd@mk{HEL}, + HEC = \def\ekd@mk{HEC}, + HER = \def\ekd@mk{HER}, + HOL = \def\ekd@mk{HOL}, + HOC = \def\ekd@mk{HOC}, + HOR = \def\ekd@mk{HOR}, + FEL = \def\ekd@mk{FEL}, + FEC = \def\ekd@mk{FEC}, + FEL = \def\ekd@mk{FER}, + FOL = \def\ekd@mk{FOL}, + FOC = \def\ekd@mk{FOC}, + FOL = \def\ekd@mk{FOR}}, + unknown-choice mark = \PackageError{ekdosis}{unknown mark=#1}{`mark' + must be either `HEL', `HEC', `HER', `HOL', `HOC', `HOR', `FEL', + \MessageBreak `FEC', `FER', `FOL', `FOC' or `FOR'.} +} +\NewDocumentCommand{\ekdprintmark}{m m}{% + \bgroup + \ekvset{ekd@marks}{mark = #1}% + \luadirect{tex.sprint(ekdosis.printmark(\luastringN{#2}, + \luastringO{\ekd@mk}))}% + \egroup +} +\NewDocumentCommand{\ekdnohfmark}{}{% + \luadirect{ekdosis.nohfmark()}% +} +\NewDocumentCommand{\ekdresethfmarks}{}{% + \luadirect{ekdosis.resethfmark()}% +} \NewDocumentCommand{\MkBodyDivs}{mmmmmm}{ \luadirect{ekdosis.mkdivdepths( \luastringN{#1}, @@ -1224,6 +1439,7 @@ code head = \def\head@value{#1}, code barehead = \def\barehead@value{#1}, store depth = \depth@value, + code mark = \ekd@storemark{#1}, choice toc = {book = \def\toc@value{book}, part = \def\toc@value{part}, chapter = \def\toc@value{chapter}, |