From 91ae07ecf4472b679343b95f67d59996a6fb5bb1 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Thu, 25 Oct 2018 10:13:41 +0200 Subject: optionally use parnotes for inserting paragraphed footnotes in apparatuses --- ekdosis.dtx | 68 +++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 17 deletions(-) (limited to 'ekdosis.dtx') diff --git a/ekdosis.dtx b/ekdosis.dtx index 461eaac..3bb4f9c 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -131,6 +131,7 @@ Running "make install" installs the files in the local TeX tree. %<*driver> \documentclass{ltxdoc} \usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} +\usepackage{hologo} \usepackage{hyperxmp} \usepackage{uri} \usepackage[numbered]{hypdoc} @@ -148,8 +149,9 @@ Running "make install" installs the files in the local TeX tree. pdfmetalang={en-US}, pdftype={Text}, pdfkeywords={Arabic language, arabtex, luatex}} \usepackage[lot]{multitoc} -\usepackage{\jobname} -\usepackage{fontspec,luatextra} +%\usepackage{\jobname} +\usepackage{ekdosis} +\usepackage{fontspec} \setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] \usepackage{newunicodechar} \newunicodechar{ǧ}{ǧ} % Old Standard does not include ǧ/Ǧ @@ -162,7 +164,6 @@ Running "make install" installs the files in the local TeX tree. numberblanklines=false, numbersep=3pt, firstnumber=last} \renewcommand{\theFancyVerbLine}{\rmfamily\smaller\arabic{FancyVerbLine}} \usepackage[contents]{colordoc} -\usepackage{authblk} \newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}} \usepackage{tikz} \usepackage[breakable, skins, xparse, minted]{tcolorbox} @@ -271,7 +272,7 @@ Running "make install" installs the files in the local TeX tree. % \begin{macrocode} \RequirePackage{ifluatex} % \end{macrocode} -% \package{ekdosis} requires \LuaLaTeX\ of course. Issue a warning +% \package{ekdosis} requires \hologo{LuaLaTeX} of course. Issue a warning % if the document is processed with another engine. % \begin{macrocode} \ifluatex\else @@ -284,15 +285,35 @@ Running "make install" installs the files in the local TeX tree. % \end{macrocode} % Packages that are required by \package{ekdosis}: % \begin{macrocode} +\RequirePackage{xkeyval} +\newif\if@parnotesroman +\newif\if@pkg@parnotes +\define@choicekey+{ekdosis.sty}{parnotes}{true, false, roman}[true]{% + \edef\@pntrue{true}\edef\@pnfalse{false}\edef\@pnrm{roman} + \edef\@tempa{#1} + \ifx\@tempa\@pnfalse + \else + \ifx\@tempa\@pntrue\@pkg@parnotestrue + \else + \ifx\@tempa\@pnrm + \@pkg@parnotestrue\@parnotesromantrue + \fi\fi\fi +}{\PackageWarning{ekdosis}{parnotes: erroneous input (ignored)}} +\ExecuteOptionsX{} +\ProcessOptionsX\relax \RequirePackage{luacode} \RequirePackage{xparse} \RequirePackage{etoolbox} -\RequirePackage{lineno} -\PassOptionsToPackage{addpageno}{lineno} +\RequirePackage[addpageno]{lineno} \RequirePackage{vplref} \RequirePackage{keyfloat} \RequirePackage{afterpage} \RequirePackage{refcount} +\RequirePackage{calc} +\RequirePackage{zref-savepos} +\if@pkg@parnotes + \RequirePackage{parnotes} +\fi % \end{macrocode} % Here begins the real work: load |ekdosis.lua|: % \begin{macrocode} @@ -310,16 +331,15 @@ Running "make install" installs the files in the local TeX tree. \NewDocumentCommand{\append}{+m}{% \ifbool{ekdstate}{% \label{ekd:\theekd@lab}% - \luadirect{appin(\luastring{<\getpagerefnumber{ekd:\theekd@lab}>}, "no")}% + \luadirect{appin(\luastring{<\getpagerefnumber{ekd:\theekd@lab}>}, + "no")}% \luadirect{appin(\luastringN{#1}, "no")}% - \luadirect{appin(\luastring{}, "yes")}% + \luadirect{appin(\luastring{}, + "yes")}% \stepcounter{ekd@lab}}{}} \NewDocumentCommand{\obappend}{+m}% - {\luadirect{tex.sprint(mdvappend(\luastringN{#1}))}} + {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringN{#1}))}} \NewDocumentCommand{\app}{+m}{#1} -% \NewDocumentCommand{\lem}{o +m}{% -% \IfNoValueTF{#1}{#2\obappend{#2:}}{#2\obappend{#2 #1:}}% -% } \NewDocumentCommand{\lem}{o +m}{% \ifbool{al@rlmode}% {\IfNoValueTF{#1}% @@ -335,17 +355,28 @@ Running "make install" installs the files in the local TeX tree. {\IfNoValueTF{#1}{\append{#2}}{\append{#2 #1}}}% } \NewDocumentCommand{\note}{s +m}{% - \IfBooleanTF{#1}{\append{\footnote{#2}}}{\append{#2}}% + \IfBooleanTF{#1}{% + \if@pkg@parnotes\append{\parnote{#2}} + \else\append{\footnote{#2}}\fi}{\append{#2}}% } \NewDocumentCommand{\apparatus}{}{\luadirect{tex.sprint(appout())}} -\NewDocumentCommand{\testapparatus}{}{\luadirect{tex.sprint(testapparatus())}} +\NewDocumentCommand{\testapparatus}{}{% + \luadirect{tex.sprint(testapparatus())}} \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext} \def\add@@apparatus{% \testapparatus% \ifbool{isapp}{% % \blfootnote{\apparatus}% - \keyparbox[b]{}{\rule{5cm}{0.5pt}\\ - \footnotesize\apparatus}% + \if@pkg@parnotes\parnotes\else\fi% + \keyparbox[b!]{}{% + \rule{5cm}{0.5pt}\\ + \if@pkg@parnotes% + \if@parnotesroman% + \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi% + \parnoteclear\begin{autopn}\else\fi% + \footnotesize\apparatus% + \if@pkg@parnotes\end{autopn}\parnotereset\else\fi% + }% }{}} \def\add@apparatus{% \add@@apparatus% @@ -368,6 +399,9 @@ Running "make install" installs the files in the local TeX tree. %<*lua> % \fi % \begin{ekdlua} + +ekdosis = {} + function closestream() os.remove(tex.jobname..".ekd") os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") @@ -428,7 +462,7 @@ end md5items = {} local salt = 0 -function mdvappend(str) +ekdosis.mdvappend = function(str) i = md5.sumhexa(str) if not isintable(md5items, i) then table.insert(md5items, i) -- cgit v1.2.3