From 90cf4bb17e7fa6363050630b74668722dd857fbe Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Thu, 22 Jun 2023 18:54:08 +0200 Subject: new functions for combining footnotes into a single paragraph --- Makefile | 3 +- ekdosis.dtx | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- ekdosis.el | 16 +++++ 3 files changed, 182 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index 0772401..2dc72eb 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ SAMPLES := samples exts := md html ins dtx el files := AUTHORS.md LICENSE +zfiles := {AUTHORS.md,LICENSE} findopts := $(foreach ext,$(exts),-or -iname "*.$(ext)") findfiles := $(foreach file,$(files), -or -iname "$(file)") @@ -107,7 +108,7 @@ uninstall: zip: all ln -sf . $(NAME) - zip -Drq $(PWD)/$(NAME)-$(VERS).zip $(NAME)/{$(files),samples,README.md,$(NAME).{pdf,sty,lua,el}} + zip -Drq $(PWD)/$(NAME)-$(VERS).zip $(NAME)/{$(zfiles),samples,README.md,$(NAME).{pdf,sty,lua,el}} rm $(NAME) hal: clean diff --git a/ekdosis.dtx b/ekdosis.dtx index 203415b..8230ead 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -59,7 +59,7 @@ Alessi %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{ekdosis} %<*package> - [2023/06/17 v1.5-dev Typesetting TEI xml-compliant critical editions] + [2023/06/22 v1.5-dev Typesetting TEI xml-compliant critical editions] % %<*driver> \begin{filecontents}[noheader,overwrite]{bibdata.xml} @@ -372,6 +372,15 @@ Alessi version = {1.0} } +@Software{footmisc, + title = {The Footmisc package}, + titleaddon = {A range of footnote options}, + author = {Mittelbach, Frank and Fairbairns, Robin}, + url = {https://ctan.org/pkg/footmisc}, + date = {2022-05-26}, + version = {6.0e}, +} + @Software{keyfloat, title = {The Keyfloat package}, titleaddon = {Provides a key/value interface for generating @@ -3618,6 +3627,13 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % just loading the \pkg{fnpos} package in the % preamble.\footcite{fnpos} % +% \danger The \pkg{footmisc} package\footcite{footmisc} is not +% compatible with \pkg{ekdosis}. More precisely, \pkg{footmisc} is +% incompatible with the way the \cs{footnote} command is defined +% inside the |alignment| environment. Therefore, \pkg{footmisc} can +% only be used on the condition that no regular \cs{footnote} be +% inserted in the |alignment| environment. +% % \section{Laying Out the Apparatus Criticus} % \label{sec:apparatus-layout} % @@ -4392,6 +4408,9 @@ argument of the % element (ll.~5--7). Otherwise, the \texttt{TEI} output would not be % valid. % +% \subsection{Footnotes Combined Into a Single Paragraph} +% \label{sec:footnotes} +% % \needspace{4\baselineskip} % \section{Poetry} % \label{sec:poetry} @@ -8225,7 +8244,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \paragraph{\textsf{ekdosis} Symbol} % \begin{macro}{\eKd} -% \changes{v1.5}{2023/06/17}{Prints \textsf{ekdosis} indentifying +% \changes{v1.5}{2023/06/22}{Prints \textsf{ekdosis} indentifying % symbol} As of v1.5, \pkg{ekdosis} has its own identifying % symbol. It is produced by \cs{eKd} and best printed with the Old % Standard Greek font. @@ -8488,7 +8507,7 @@ Sample text with a \textcolor{red}{word} in red. % \begin{macro}{\teidirectE} % \changes{v1.3}{2021/08/18}{direct insertion of elements in the % \texttt{TEI xml} file} -% \changes{v1.5}{2023/06/17}{direct insertion of empty elements in the +% \changes{v1.5}{2023/06/22}{direct insertion of empty elements in the % \texttt{TEI xml} file} % \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code} % does nothing in \LaTeX. It is only used to insert elements in the @@ -8503,7 +8522,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macro} % \end{macro} % \begin{macro}{\getTEIxmlid} -% \changes{v1.5}{2023/06/17}{returns \texttt{TEI xml:ids} from a +% \changes{v1.5}{2023/06/22}{returns \texttt{TEI xml:ids} from a % csv-list of ids} This command returns from a csv-list of unique % identifiers declared in commands such as \cs{DeclareWitness} and the % like a space-separated list of their corresponding |xml:id|s, each @@ -8979,7 +8998,7 @@ Sample text with a \textcolor{red}{word} in red. \newlength{\ekd@app@localheight} % \end{macrocode} % \begin{macro}{\localappheight} -% \changes{v1.5}{2023/06/17}{changes the height of the apparatus +% \changes{v1.5}{2023/06/22}{changes the height of the apparatus % criticus} % \cs{localappheight}\marg{dimen} can be used to change locally the % length of \cs{ekd@app@height} set by the |appheight| option of @@ -8998,7 +9017,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % \begin{macro}{\addtoappheight} -% \changes{v1.5}{2023/06/17}{increases or decreases the height of the +% \changes{v1.5}{2023/06/22}{increases or decreases the height of the % apparatus criticus} % As the name suggests, in contrast to \cs{localappheight}, % \cs{addtoappheight}\marg{dimen} is used to increase or decrease @@ -9285,7 +9304,7 @@ Sample text with a \textcolor{red}{word} in red. % The following commands are provided to set and control the maximum % number of lines printed on each page. % \begin{macro}{\setmaxlines} -% \changes{v1.5}{2023/06/17}{limits the number of lines per page} +% \changes{v1.5}{2023/06/22}{limits the number of lines per page} % \cs{setmaxlines}\marg{n}, where \meta{n} is a positive integer % $\geq 1$, can be used either in the preamble or at any point of the % document to set the maximum number of lines to be printed on each @@ -9296,7 +9315,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % \begin{macro}{\localmaxlines} -% \changes{v1.5}{2023/06/17}{changes the maximum number of lines +% \changes{v1.5}{2023/06/22}{changes the maximum number of lines % locally} % Once a maximum number of lines per page has been set, % \cs{localmaxlines}\marg{n} can be used to adjust this number on a @@ -9309,7 +9328,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % \begin{macro}{\addtomaxlines} -% \changes{v1.5}{2023/06/17}{adds or subtracts lines from a given page} +% \changes{v1.5}{2023/06/22}{adds or subtracts lines from a given page} % Unlike \cs{localmaxlines}, \cs{addtomaxlines}\meta{n} takes as % argument the number of lines one wishes to add or substract from the % number that has been set by \cs{setmaxlines}. As a result, \meta{n} @@ -9322,7 +9341,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % \begin{macro}{\nomaxlines} -% \changes{v1.5}{2023/06/17}{unsets \cs{setmaxlines}} +% \changes{v1.5}{2023/06/22}{unsets \cs{setmaxlines}} % \cs{nomaxlines} unsets any limit previously set by \cs{setmaxlines}. % \begin{macrocode} \def\nomaxlines{\luadirect{tex.sprint(ekdosis.resetlocalmaxlines())}} @@ -9386,7 +9405,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % \begin{macro}{\App} -% \changes{v1.5}{2023/06/17}{To be used conjointly with +% \changes{v1.5}{2023/06/22}{To be used conjointly with % \texttt{ekdosis.el}} % In contrast to \cs{app}, \cs{App} takes two mandatory arguments and % accepts one optional argument like so: @@ -9950,13 +9969,13 @@ Sample text with a \textcolor{red}{word} in red. }% }% \ifekd@mapps - \append@app[\ekdan@type]{\rdg@app}% + \append@app[\ekdan@type]{\rdg@app}% \else - \append@app{\rdg@app}% + \append@app{\rdg@app}% \fi - \fi - \egroup - \ekd@subsq@rdgtrue +\fi +\egroup +\ekd@subsq@rdgtrue } % \end{macrocode} % \end{macro} @@ -10059,11 +10078,11 @@ Sample text with a \textcolor{red}{word} in red. \ifbool{ekd@lang@pkg}% {{\noexpand\selectlanguage{\app@note@lang}\unexpanded{#2}}}{% {\unexpanded{#2}}}}}% - \ifekd@mapps% - \unconditional@appin[\ekdan@type]{\note@contents}% - \else% - \unconditional@appin{\note@contents}% - \fi% + \ifekd@mapps + \unconditional@appin[\ekdan@type]{\note@contents}% + \else + \unconditional@appin{\note@contents}% + \fi \luadirect{ekdosis.setprevnotelab(\luastringO{\ekdn@labelb})}% \egroup \subsq@unittrue @@ -10158,6 +10177,92 @@ Sample text with a \textcolor{red}{word} in red. } % \end{macrocode} % \end{macro} +% \paragraph{Combining Footnotes Into a Single Paragraph} +% Footnotes combined as one paragraph are inserted with the standard +% \cs{footnote} command which is redirected to +% \cs{unconditional@appin} when |ekd@parafootnotes| is set to +% |true|:--- +% \begin{macrocode} +\newif\ifekd@parafootnotes +% \end{macrocode} +% The keys to be used by \cs{SetFootnotes} are defined below:--- +% \begin{macrocode} +\ekvdefinekeys{ekd@footnotes}{ + choice layout = { + default = \relax, + paragraph = \ekd@parafootnotestrue + }, + initial layout = default, + unknown-choice layout = \PackageError{ekdosis}{unknown + layout=#1}{`layout' must be either `default' or `paragraph'.}, + store type = \ekdfn@type, + initial type = default, + code textfnmark = \protected\def\ekd@around@fnmark##1{#1}, + initial textfnmark = \textsuperscript{#1}, + code appfnmark = \protected\def\ekdappfnmark##1{#1}, + initial appfnmark = \textsuperscript{#1} +} +\newif\ifekd@fnmark +\ekvdefinekeys{ekd@infootnotes}{ + store type = \ekdfn@type, + initial type = default, + code mark = \ekd@fnmarktrue + \protected\def\ekd@fnmark@value{#1} +} +% \end{macrocode} +% \begin{macro}{\SetFootnotes} +% \changes{v1.5}{2023/06/22}{footnotes combined into a single +% paragraph} \cs{SetFootnotes}\marg{options} can be used in the +% preamble or at any point of the document. |layout=paragraph| +% instructs \pkg{ekdosis} to combine all footnotes into a single +% paragraph. Then the other |key-value| options that are defined +% just above allow to format the marks and specify the layer where +% the notes are to be printed. +% \begin{macrocode} +\ekvsetdef\SetFootnotes{ekd@footnotes} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ekd@parafootnote} +% \cs{ekd@parafootnote}\oarg{layer}\marg{contents} holds the new +% definition of \cs{footnote}. This command accepts an optional +% argument that can be used to specify the layer in which the +% contents of the footnote is to be printed. +% \begin{macrocode} +\NewDocumentCommand{\ekd@parafootnote}{O{} m}{% + \ifekd@state + \bgroup + \ekvset{ekd@infootnotes}{#1}% + \ifekd@fnmark + \edef\ekd@parafn@mark{% + \LRnum{\unexpanded\expandafter{\ekd@fnmark@value}}}% + \edef\ekd@inparafn@mark{% + \ekdappfnmark{\LRnum{\unexpanded\expandafter{\ekd@fnmark@value}}}}% + \else + \refstepcounter{footnote}% + \edef\ekd@parafn@mark{\LRnum{\thefootnote}}% + \edef\ekd@inparafn@mark{\ekdappfnmark{\LRnum{\thefootnote}}}% + \fi + \leavevmode + \stepcounter{ekd@lab}% + \zlabel{ekd:\theekd@lab}% + \luadirect{ekdosis.storeabspg( + \luastring{\zref@extract{ekd:\theekd@lab}{abspage}})}% + \add@apparatus + \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdfn@type})}% + \luadirect{tex.sprint(ekdosis.limit_bagunits(\luastringO{\ekdan@type}))}% + \ekd@around@fnmark{\ekd@parafn@mark}% + \ifekd@mapps + \unconditional@appin[\ekdfn@type]{\ekd@inparafn@mark #2}% + \else + \unconditional@appin{\ekd@inparafn@mark #2}% + \fi + \egroup + \else + \footnote{#2}% + \fi +} +% \end{macrocode} +% \end{macro} % \paragraph{Emendations and Conjectures} % Here follows the |key-value| options to be used by % \cs{SetCritSymbols} below:--- @@ -10270,7 +10375,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macro} % \paragraph{Lacunae} % \begin{macro}{\ilabel} -% \changes{v1.5}{2023/06/17}{recalls and sets the ending label of +% \changes{v1.5}{2023/06/22}{recalls and sets the ending label of % lemmas used to mark lacunae in witnesses} When \cs{lem} has been % used with the optional argument |ilabel=