From dbc90c86e991409053bbeef7f966517bb02ac1cc Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Tue, 24 Aug 2021 11:47:51 +0200
Subject: new commands and options for subseparators between variant readings

---
 ekdosis.dtx | 150 +++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 119 insertions(+), 31 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 30b19f0..0237235 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -61,7 +61,7 @@ along with this program.  If not, see
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{ekdosis}
 %<*package>
-    [2021/08/18 v1.3 Typesetting TEI xml-compliant critical editions]
+    [2021/08/24 v1.4-dev Typesetting TEI xml-compliant critical editions]
 %</package>
 %<*driver>
 \begin{filecontents}[noheader,overwrite]{bibdata.xml}
@@ -441,6 +441,11 @@ along with this program.  If not, see
 }
 \end{filecontents}
 \begin{filecontents}[overwrite]{\jobname-ekd.cfg}
+%% fixfoot:---
+\DeclareFixedFootnote{\seeekdsep}{See below
+  \vpageref{ref:ekdsep-subsep} for more information and
+  \vref{lst:emend-coni-corr}, ll.~23--5 for an illustrative example.}
+%% ekdosis:---
 \footnotelayout{m}
 \SetCritSymbols{suppbegin = 〈,suppend = 〉}
 \EnvtoTEI{ancientgreek}{p}[xml:lang="grc"]
@@ -558,14 +563,14 @@ along with this program.  If not, see
 \defaultfontfeatures{Renderer=Harfbuzz}
 \usepackage[latin.classic,greek.ancient,american]{babel}
 \babelfont{rm}{Old Standard}
-\babelfont{sf}{NewComputerModernSans10}
-\babelfont{tt}{NewComputerModernMono10}
+\babelfont{sf}{NewCMSans10-Book}
+\babelfont{tt}{NewCMMono10-Book}
 \babelfont[greek]{rm}[
       Script=Greek,
       RawFeature={+ss05;+ss06}
       ]{Old Standard}
-\babelfont[greek]{sf}[Script=Greek]{NewComputerModernSans10}
-\babelfont[greek]{tt}[Script=Greek]{NewComputerModernMono10}
+\babelfont[greek]{sf}[Script=Greek]{NewCMSans10-Book}
+\babelfont[greek]{tt}[Script=Greek]{NewCMMono10-Book}
 \newfontfamily{\junicode}{Junicode}[
                 Ligatures=TeX,
                 RawFeature={+hist}]
@@ -575,6 +580,10 @@ along with this program.  If not, see
 \usepackage[Old Standard]{mathfont}
 \usepackage[biblatex=true]{embrac}
 \usepackage{chifoot}
+\usepackage{fixfoot}
+\usepackage[nospace,american]{varioref}
+\newcommand\phts{\phantomsection}
+\usepackage{nameref}
 \usepackage{arabluatex}
 \usepackage[parnotes=roman, teiexport=tidy, poetry=verse]{ekdosis}
 \AddxmlBibResource{bibdata.xml}
@@ -628,9 +637,6 @@ along with this program.  If not, see
 \labelformat{figure}{fig.~#1}
 \usepackage[defaultindex=none,citecmd=autocite]{icite}
 \bibinput{ekdosis}
-\usepackage[nospace,american]{varioref}
-\newcommand\phts{\phantomsection}
-\usepackage{nameref}
 \newcommand\vnref[1]{\vref{#1}, \enquote{\nameref{#1}}}
 \usepackage[style=oxnotes-inote,dashed]{biblatex}
 \DefineBibliographyStrings{english}{
@@ -849,7 +855,7 @@ along with this program.  If not, see
 %</driver>
 % \fi
 %
-% \CheckSum{2519}
+% \CheckSum{0}
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -1905,14 +1911,12 @@ yesterday.
 % |nosep| must be used when for some reason no \cs{rdg} command
 % follows a \cs{lem} command that has just been used, as shown below
 % in \vref{lst:emend-coni-corr}, l.~7.
-% 
-% \needspace{2\baselineskip}
-% \danger \DescribeMacro{\ekdsep} If |nosep| be used so as to insert
-% an explanatory note after the lemma text with the \cs{note} command
-% described below \vpageref{ref:editorial-notes}, then \cs{ekdsep} can
-% be used\---for instance as value of the |post| optional argument of
-% the note\---to put back in the separator. This technique is
-% demonstrated below in \vref{lst:emend-coni-corr}, ll.~23--5.\\
+% \danger If |nosep| be used so as to insert an explanatory note after
+% the lemma text with the \cs{note} command described below
+% \vpageref{ref:editorial-notes}, then the |sep| optional argument of
+% \cs{note} can be used to put back in the separator. This technique
+% is demonstrated below in
+% \vref{lst:emend-coni-corr}, ll.~23--5.\\
 % \DescribeOption{nolem} |nolem|$=$\verb+true|false+\\
 % This named argument does not need a value as it defaults to |true|
 % if used. |nolem| completely removes the lemma text from the related
@@ -1987,6 +1991,19 @@ yesterday.
 % \DescribeOption{post} |post|$=$\meta{words}\\
 % \DescribeOption{prewit} |prewit|$=$\meta{words}\\
 % \DescribeOption{postwit} |postwit|$=$\meta{words}\\
+% \DescribeOption{subsep} |subsep|$=$\meta{subseparator}\\
+% \newfeature[v1.4] |subsep| inserts a subseparator to be printed
+% \emph{before} the current entry as described below
+% \vpageref{ref:setsubseparator}. This option is supposed to be used
+% when no subseparator is defined, or when one is defined but for some
+% reason a different subseparator is needed for the current
+% entry.\\
+% \DescribeOption{nosubsep} This argument-less option removes the
+% subseparator from the current entry, provided one has been set by
+% means of \cs{SetSubseparator}, \cs{SetApparatus} or
+% \cs{DeclareApparatus}.\footnote{See
+% \vpagerefrange{ref:setsubseparator}{ref:apparatus-settings-e} and
+% \vref{sec:declaring-layers} for details.}
 %
 % \paragraph{Notes}
 % \DescribeMacro{\note}\phts\label{ref:notes-b}\DescribeMacro{\note*}
@@ -2007,6 +2024,10 @@ yesterday.
 % |pre| inserts \meta{words} immediately before the note.\\
 % \DescribeOption{post} |post|$=$\meta{words}\\
 % |post| inserts \meta{words} immediately after the note.\\
+% \DescribeOption{sep} This argument-less option is equivalent to
+% |post=\ekdsep|.\seeekdsep\\
+% \DescribeOption{subsep} This argument-less option is equivalent to
+% |pre=\ekdsubsep|.\seeekdsep\\
 %
 % \danger Under no circumstances is it permitted to insert this
 % command \cs{note} or \cs{note*} inside the argument of \cs{lem} or
@@ -2639,7 +2660,7 @@ friend
 
   Πάντων δὲ \app{
     \lem[resp=egomute, type=emendation, nosep]{\supplied{τῶν πυρετῶν}}
-    \note[post=\ekdsep]{addidi (\arb{^gamI`a 'l-.hummayAti}
+    \note[sep]{addidi (\arb{^gamI`a 'l-.hummayAti}
       \getsiglum{Gal})}
     \rdg[nordg, source=Gal]{\arb{al-.hummayAti}}
     \rdg[wit=codd, source=edd, alt=om.]{}
@@ -2676,7 +2697,7 @@ friend
 %
 %  Πάντων δὲ \app{
 %    \lem[resp=egomute, type=emendation, nosep]{\supplied{τῶν πυρετῶν}}
-%    \note[post=\ekdsep]{addidi (\arb{^gamI`a 'l-.hummayAti}
+%    \note[sep]{addidi (\arb{^gamI`a 'l-.hummayAti}
 %      \getsiglum{Gal})}
 %    \rdg[nordg, source=Gal]{\arb{al-.hummayAti}}
 %    \rdg[wit=hcodd, source=hedd, alt=om.]{}
@@ -2985,7 +3006,7 @@ friend
 %   \emph{semicolons}, as shown in red in the listing below at the end
 %   of lines~1 and 2.
 %   \begin{enumerate}
-%   \item[\dbend] The colon at the end of line~3 closes the whole
+%   \item[\dbend] The comma at the end of line~3 closes the whole
 %     value of |text| and acts as a higher level separator.
 %   \end{enumerate}
 % \item \phts\label{it:lang-subopt} Each name may be followed by a
@@ -3386,10 +3407,38 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % right-to-left.
 %
 % \DescribeMacro{\SetSeparator} \cs{SetSeparator}\marg{separator} is
-% used to change the separator between lemma texts and variants
+% used to change the separator between lemma texts and variant
 % readings. By default, the separator is a closing square bracket
 % followed by a space (\verb*+] +).
 %
+% \DescribeMacro{\SetSubseparator}\label{ref:setsubseparator}
+% \newfeature[v1.4] \cs{SetSubseparator}\marg{subseparator} is used to
+% set or change the \enquote{subseparator} between succeeding variant
+% readings. By default, no subseparator is set.
+%
+% \danger As the subseparator applies to subsequent variant readings
+% only, it is naturally preceded by a breakable space. This space can
+% be removed by \cs{unskip}. As an example, what follows replaces the
+% breakable space with an unbreakable space, then prints a colon as
+% subseparator followed by a space:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{latex}
+\SetSubseparator{\unskip~: }
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% \danger \DescribeMacro{\ekdsep} \DescribeMacro{\ekdsubsep}
+% \phts\label{ref:ekdsep-subsep} Once the separator and if applicable
+% the subseparator have been set, they can be accessed by \cs{ekdsep}
+% and \cs{ekdsubsep} respectively. It is therefore advisable to use
+% these commands instead of the mere symbols at whatever place one
+% would have them printed.
+%
 % \DescribeMacro{\SetBeginApparatus}
 % \cs{SetBeginApparatus}\marg{characters\textbar commands} can be used
 % to append \meta{characters} or \meta{commands} at the beginning of
@@ -3452,6 +3501,9 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % \DescribeOption{sep} |sep|$=$\meta{command \textbar\ chars}
 % \hfill\tcboxverb{Default: ]␣}\\
 % The separator between lemma texts and variant readings.\\
+% \DescribeOption{subsep} |subsep|$=$\meta{command \textbar\ chars}
+% \hfill\tcboxverb{Default: not set}\\
+% The \enquote{subseparator} between succeeding variant readings.\\
 % \DescribeOption{delim} |delim|$=$\meta{delimiter}
 % \hfill\tcboxverb{Default: not set}\\
 % The delimiter between entries in the apparatus criticus. As said
@@ -3470,7 +3522,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % between the edition text and the apparatus criticus.\\
 % \DescribeOption{norule}\hfill\tcboxverb{Default: not set}\\
 % |norule| does not accept any value and is used to remove the
-% line.\phts\label{ref:apparatus-settings-e}\\
+% line.\\
 % \DescribeOption{lang} |lang|$=$\meta{languagename}
 % \newfeature[v1.2]\phts\label{ref:app-lang-opt}
 % \hfill\tcboxverb{Default: not set}\\
@@ -3489,7 +3541,8 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % \cs{note}\oarg{options}\marg{text}\===a language different from the
 % one that is selected in the edition text. |languagename| can be any
 % value accepted by \pkg{babel} or \pkg{polyglossia}.
-% 
+% \phts\label{ref:apparatus-settings-e}
+%
 % As an example, an apparatus criticus with references to line numbers
 % printed in normal font, a colon as a separator between lemma texts
 % and variant readings, a broad space as a delimiter between entries
@@ -3578,6 +3631,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % \label{sec:layout-layers}
 % \DescribeOption{direction}
 % \DescribeOption{sep}
+% \DescribeOption{subsep}
 % \DescribeOption{delim}
 % \DescribeOption{bhook}
 % \DescribeOption{ehook}
@@ -3603,7 +3657,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % \iffalse
 %<*example>
 % \fi
-\begin{minted}{latex}
+\begin{minted}[numbersep=6pt]{latex}
 \SetHooks{
   refnumstyle=\normalfont,
   initialrule=\rule{0.7in}{0.4pt}
@@ -8008,6 +8062,7 @@ Sample text with a \textcolor{red}{word} in red.
   nmeta norule = {rule=none},
   code delim = \def\delim@val{\unexpanded{#1}},
   store sep = \sep@val,
+  store subsep = \subsep@val,
   store bhook = \bhook@val,
   store ehook = \ehook@val,
   store maxentries = \limit@val,
@@ -8042,6 +8097,7 @@ Sample text with a \textcolor{red}{word} in red.
     \luastringO{\rule@val},
     \luastringO{\delim@val},
     \luastringO{\sep@val},
+    \luastringO{\subsep@val},
     \luastringO{\bhook@val},
     \luastringO{\ehook@val},
     \luastringO{\limit@val},
@@ -8181,12 +8237,14 @@ Sample text with a \textcolor{red}{word} in red.
 %    \begin{macrocode}
 \newif\ifrtl@app
 \edef\ekdsep{] }
+\edef\ekdsubsep{}
 \ekvdefinekeys{default@app}{
   choice direction = {LR = \rtl@appfalse,
     RL = \rtl@apptrue},
   unknown-choice direction = \PackageError{ekdosis}{unknown
     direction=#1}{`direction' must be either `LR' or `RL'.},
   code sep = \edef\ekdsep{#1},
+  code subsep = \edef\ekdsubsep{#1},
   store bhook = \ekd@begin@apparatus,
   initial bhook = {},
   store ehook = \ekd@end@apparatus,
@@ -8232,6 +8290,15 @@ Sample text with a \textcolor{red}{word} in red.
 \NewDocumentCommand{\SetSeparator}{m}{\edef\ekdsep{#1}}
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{\SetSubseparator}
+% \changes{v1.4}{2021/08/24}{New command for subseparators}
+% \cs{SetSubseparator}\marg{sub-separator} allows to change the
+% \enquote{subseparator} between variant readings. By default,
+% no subseparator is set:---
+%    \begin{macrocode}
+\NewDocumentCommand{\SetSubseparator}{m}{\edef\ekdsubsep{#1}}
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{\SetBeginApparatus}
 %   \cs{SetBeginApparatus}\marg{characters} can be used to append
 %   characters at the beginning of the apparatus block. By default,
@@ -8817,6 +8884,9 @@ Sample text with a \textcolor{red}{word} in red.
   code post = \def\ekdlr@post{#1},
   code prewit = \def\ekdlr@prewit{#1},
   code postwit = \def\ekdlr@postwit{#1},
+  store subsep = \ekdr@subsep,
+  initial subsep = \ekdsubsep,
+  bool nosubsep = \ifekdr@nosubsep,
   store type = \ekdlr@type,
   bool nordg = \ifekdr@nordg
 }
@@ -8987,8 +9057,11 @@ Sample text with a \textcolor{red}{word} in red.
 % \cs{rdg}\oarg{options}\marg{variant reading} inserts \meta{variant
 % reading} in the second part of the entry, after the lemma text and
 % the separator, in the apparatus criticus. This command accepts the
-% optional key-value arguments defined above.
+% optional key-value arguments defined above. This command sets
+% \cs{ifekd@subsq@rdg} to true, which instructs \pkg{ekdosis} that
+% \enquote{subseparators} may be used for subsequent entries.
 %    \begin{macrocode}
+\newif\ifekd@subsq@rdg
 \NewDocumentCommand{\rdg}{O{} m}{%
   \bgroup%
   \ekvset{rdg}{#1}%
@@ -9005,6 +9078,9 @@ Sample text with a \textcolor{red}{word} in red.
   \else%
   \ifbool{al@rlmode}{%
     \edef\rdg@app{%
+      \ifekd@subsq@rdg
+        \unless\ifekdr@nosubsep\unexpanded\expandafter{\ekdr@subsep}\fi
+      \fi
       \ifdefined\ekdlr@alt%
         \ifdefined\ekdlr@post%
           \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
@@ -9031,6 +9107,9 @@ Sample text with a \textcolor{red}{word} in red.
   }%
   {%
     \edef\rdg@app{%
+      \ifekd@subsq@rdg
+        \unless\ifekdr@nosubsep\unexpanded\expandafter{\ekdr@subsep}\fi
+      \fi
       \ifdefined\ekdlr@alt%
         \ifdefined\ekdlr@pre%
           \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
@@ -9061,13 +9140,14 @@ Sample text with a \textcolor{red}{word} in red.
         \space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
     }%
   }%
-  \ifekd@mapps%
+  \ifekd@mapps
       \append@app[\ekdan@type]{\rdg@app}%
-  \else%
+  \else
   \append@app{\rdg@app}%
-  \fi%
-  \fi%
-  \egroup%
+  \fi
+  \fi
+  \egroup
+  \ekd@subsq@rdgtrue
 }
 %    \end{macrocode}
 % \end{macro}
@@ -9177,7 +9257,9 @@ Sample text with a \textcolor{red}{word} in red.
 %    \begin{macrocode}
 \ekvdefinekeys{ekd@note}{
   store pre = \pre@value,
-  store post = \post@value
+  store post = \post@value,
+  nmeta sep = {post=\ekdsep},
+  nmeta subsep = {pre=\ekdsubsep}
 }
 %    \end{macrocode}
 % The following three commands, \cs{note@app}, \cs{ekd@note} and
@@ -11806,6 +11888,7 @@ function ekdosis.newapparatus(teitype,
 			      apprule,
 			      appdelim,
 			      appsep,
+			      appsubsep,
 			      appbhook,
 			      appehook,
 			      applimit,
@@ -11822,6 +11905,7 @@ function ekdosis.newapparatus(teitype,
 				 rule = apprule,
 				 delim = appdelim,
 				 sep = appsep,
+				 subsep = appsubsep,
 				 bhook = appbhook,
 				 ehook = appehook,
 				 limit = applimit,
@@ -12026,6 +12110,10 @@ function ekdosis.appout()
 		  table.insert(output, "\\edef\\ekdsep{" .. apparatuses[n].sep .. "}")
 	       else
 	       end
+	       if apparatuses[n].subsep ~= ""
+	       then
+		  table.insert(output, "\\edef\\ekdsubsep{" .. apparatuses[n].subsep .. "}")
+	       end
 	       if apparatuses[n].bhook ~= ""
 	       then
 		  table.insert(output, apparatuses[n].bhook)
-- 
cgit v1.2.3

