From 67361972da8072e57f1afe3226bf387de99c5bb8 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Sun, 7 Mar 2021 13:47:53 +0100
Subject: improved makefile. new command/options for setting the language in
 the apparatus. new command \resetvlinenumber. improving verse patterns and
 documenting for v1.2

---
 ekdosis.dtx | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 101 insertions(+), 12 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 6f85753..36d6e8c 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -145,6 +145,16 @@ along with this program.  If not, see
   publisher =	 {Harper \& Brothers},
   location =	 {New York}}
 
+@MVBook{HomerMurray,
+  author =	 {{Homer}},
+  title =	 {The Odyssey},
+  date =	 1919,
+  editor =	 {Murray, A.T\adddot},
+  volumes =	 2,
+  publisher =	 {Harvard University Press -- William Heinemann},
+  location =	 {Cambridge, MA. -- London}
+}
+
 @Book{ReynoldsWilson1991,
   author =	 {Reynolds, L. D. and Wilson, N. G},
   title =	 {Scribes and Scholars},
@@ -245,6 +255,15 @@ along with this program.  If not, see
   version =	 {3.47}
 }
 
+@Software{verse,
+  title =	 {The Verse package},
+  subtitle =	 {Aids for typesetting simple verse},
+  author =	 {Wilson, Peter R. and Robertson, Will},
+  url =		 {http://www.ctan.org/pkg/verse},
+  date =	 {2014-05-10},
+  version =	 {2.4b}
+}
+
 @Software{arabluatex,
   title =	 {The Arabluatex package},
   titleaddon =	 {ArabTeX for LuaLaTeX},
@@ -358,6 +377,8 @@ along with this program.  If not, see
 \DeclareWitness{sV}{V}{Vaticanus lat. 1652}[
                       origDate=s. XV]
 \DeclareSource{sDrak}{\emph{Drakenborch}}
+% Homer, Odyssey
+\DeclareScholar{Zen}{Zen.}[rawname=Zenodotus]
 \end{filecontents}
 \documentclass{ltxdoc}
  %\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry}
@@ -988,7 +1009,17 @@ along with this program.  If not, see
 %
 % \danger It must be noted that the two styles are mutually exclusive.
 % \vskip\baselineskip
-% 
+%
+% \DescribeOption{verse}\label{ref:verse-opt}
+% |verse|$=$\verb+true|false+
+% \hfill\tcboxverb{Default: false}\\
+% This named argument does not need a value as it defaults to |true|
+% if it is used. |verse| instructs \pkg{ekdosis} to load and use the
+% facilites supplied by the \pkg{verse} package for typesetting lines
+% of poetry. The \env{ekdverse} environment must then be used instead
+% of the \env{verse} environment that is provided by the \pkg{verse}
+% package as described below in \vref{sec:poetry}.
+%
 % \DescribeOption{parnotes}\label{ref:parnotes-opt}
 % |parnotes|$=$\verb+true|false|roman+%
 % \hfill\tcboxverb{Default: not set}\\
@@ -2981,7 +3012,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 %
 % \DescribeMacro{\SetApparatusLanguage}
 % \label{ref:app-lang}\newfeature[v1.2]
-% \cs{SetApparatusLang}\marg{languagename} can be used when it is
+% \cs{SetApparatusLanguage}\marg{languagename} can be used when it is
 % needed to apply in the apparatus criticus a language different from
 % the one that is selected in the edition text.
 % 
@@ -3019,7 +3050,8 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % |norule| does not accept any value and has the same effect as
 % |rule=none|.\label{ref:apparatus-settings-e}\\
 % \DescribeOption{lang} |lang|$=$\meta{languagename}
-% \newfeature[v1.2]\hfill\tcboxverb{Default: not set}\\
+% \newfeature[v1.2]\label{ref:app-lang-opt}
+% \hfill\tcboxverb{Default: not set}\\
 % |lang=<languagename>| is used as described \vpageref{ref:app-lang}
 % when it is needed to apply in the apparatus criticus a language
 % different from the one that is selected in the edition
@@ -3119,7 +3151,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % \DescribeOption{ehook}
 % \DescribeOption{rule}
 % \DescribeOption{norule}
-% \DescribeOption{lang}
+% \DescribeOption{lang}\label{ref:apps-lang-opt}
 % With regard to layout, any declared layer inherits the default values
 % described above in \vref{sec:single-layer-app}. That said, as the
 % optional argument of \cs{DeclareApparatus} accepts the exact same
@@ -3470,6 +3502,40 @@ argument of the
 % \section{Poetry}
 % \label{sec:poetry}
 % 
+% \begingroup
+% \setcolumnwidth{0.6\textwidth}
+% \setlength{\leftmargini}{0em}
+% \needspace{7\baselineskip}
+% \resetlinenumber
+% \begin{alignment}[flush,
+%   lcols=2,
+%   texts=homer[xml:lang="grc"];murray,
+%   apparatus=homer]
+%   \AtBeginEnvironment{homer}{\selectlanguage{greek}}
+%   \setlength{\vrightskip}{0.25em}
+%   \setverselinenums{1}{0}
+%   \begin{homer}
+%     \begin{ekdverse}
+%        Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ \\
+%        πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν· \\
+%        πολλῶν δ' ἀνθρώπων ἴδεν ἄστεα καὶ
+%                      \app{\lem{νόον}
+%                           \rdg[resp=Zen]{νόμον}
+%                           \note{Cf. Schol.}} ἔγνω, \\
+%        πολλὰ δ' ὅ γ' ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν, \\ 
+%        ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων. \\
+%      \end{ekdverse}
+%   \end{homer}
+%   \begin{murray}
+%     Tell me, O Muse, of the man of many devices, who wandered full
+%     many ways after he had sacked the sacred citadel of Troy. Many
+%     were the men whose cities he saw and whose mind he learned, aye,
+%     and many the woes he suffered in his heart upon the sea, seeking
+%     to win his own life and the return of his
+%     comrades.\footcite{HomerMurray}
+%   \end{murray}
+% \end{alignment}
+% \endgroup
 %
 % \section{Lineation Settings}
 % \label{sec:lineation}
@@ -3591,6 +3657,14 @@ argument of the
 % file, the reader is invited to refer to point \vref{it:lang-subopt}
 % and \vref{sec:teixml-output}.
 %
+% \danger In some cases, it may be needed to apply in the apparatus
+% criticus a language different from the one that is selected in the
+% edition text.  To this end, \pkg{ekdosis} provides a set of
+% facilities which are described
+% \vpagerefrange{ref:app-lang}{ref:app-lang-opt} for single-layer
+% apparatus and \vpageref{ref:apps-lang-opt} for multiple-layer
+% apparatus.
+%
 % \subsection{Languages Written From Right to Left}
 % \label{sec:rtl-languages}
 % As said above, \pkg{polyglossia} is not supported by \pkg{ekdosis}
@@ -6856,9 +6930,9 @@ Sample text with a \textcolor{red}{word} in red.
     lineation=#1}{`lineation' must be either `page' or `document'.},
   code modulonum = \chardef\c@linenumbermodulo#1\relax,
   noval modulo = \modulolinenumbers,
-  code vmodulonum = \if@pkg@verse\poemlines{#1}\fi,
-  initial vmodulonum = 1,
-  noval vmodulo = \if@pkg@verse\poemlines{5}\fi,
+  code vmodulo = \if@pkg@verse\poemlines{#1}\fi,
+  initial vmodulo = 1,
+  default vmodulo = 5,
   bool continuousvnum = \if@continuous@vnum,
   choice numbers = {elided = \ekd@elidednumberstrue,
     full = \ekd@elidednumbersfalse},
@@ -7915,6 +7989,17 @@ Sample text with a \textcolor{red}{word} in red.
 \fi
 %    \end{macrocode}
 % \end{environment}
+% \begin{macro}{\resetvlinenumber}
+% \changes{v1.2}{2021/03/06}{resets line numbers in poetry environments}
+% This command is the equivalent of \cs{resetlinenumber} for lines of
+% poetry. It takes an integer (which is |1| by default) as optional
+% argument. 
+%    \begin{macrocode}
+\NewDocumentCommand{\resetvlinenumber}{O{1}}{%
+  \setverselinenums{#1}{0}%
+}
+%    \end{macrocode}
+% \end{macro}
 % \begin{environment}{ekdpar}
 %   When |autopar| is set to |false| by means of \cs{SetTEIxmlExport},
 %   \env{ekdpar}\---or any other environment set to be inserted within
@@ -7965,7 +8050,8 @@ local app = lpeg.Cs("app")
 local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg"))
 local note = lpeg.Cs("note")
 local lnbrk = lpeg.Cs("\\\\")
-local poemline = lpeg.Cs(lnbrk * bsqbrackets^-1)
+local poemline = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.S("*!")^-1 * bsqbrackets^-1)
+local poemlineb = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.P("&gt;") * bsqbrackets^-1)
 local endpoem = lpeg.Cs(lnbrk * lpeg.S("*!") * bsqbrackets^-1)
 local sections = lpeg.Cs(lpeg.P("book") + lpeg.P("part") + lpeg.P("chapter")
 			    + lpeg.P("section") + lpeg.P("subsection")
@@ -8314,6 +8400,8 @@ local texpatttotags = {
    {a="\\addentries%s+%[(.-)%]{(.-)}", b=""},
    {a="\\addentries%s+{(.-)}", b=""},
    {a="\\setverselinenums%s+{(.-)}{(.-)}", b=""},
+   {a="\\resetvlinenumber%s+%[(.-)%]", b=""},
+   {a="\\resetvlinenumber%s+", b=""},
    {a="\\resetlinenumber%s+%[(.-)%]", b=""},
    {a="\\resetlinenumber%s+", b=""},
    {a="\\poemlines%s+{(.-)}", b=""},
@@ -8559,11 +8647,12 @@ local function relocate_notes(str)
 end
 
 local function linestotei(str)
---   str = "\n<l>"..str
-   str = string.gsub(str, "^%s?(.-)\\\\[%!%*]?%s?$", "\n<l>%1</l>\n")
+   str = "\n<l>"..str
+--   str = string.gsub(str, "^%s?(.-)\\\\[%!%*]?%s?$", "\n<l>%1</l>\n")
+   str = gsub(str, poemline * spcenc^-1 * -1, "</l>\n")
 --   str = gsub(str, endpoem, "</l>\n")
-   str = gsub(str, poemline * spcenc^-1 * lpeg.P("&gt;"), "\n<lb/>")
-   str = gsub(str, poemline * spcenc^-1, "</l>\n<l>")
+   str = gsub(str, poemlineb, "\n<lb/>")
+   str = gsub(str, poemline, "</l>\n<l>")
 --   str = str.."</l>\n"
    return str
 end
-- 
cgit v1.2.3

