From 7efe15bd0380b1917379c8b870f8cd3f5979892b Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Mon, 12 Oct 2020 18:56:02 +0200
Subject: in the end, two separate ekdverse environments were needed

---
 ekdosis.dtx | 72 ++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 38 insertions(+), 34 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 7bd73a0..e92738f 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -7661,51 +7661,55 @@ Sample text with a \textcolor{red}{word} in red.
 }
 %    \end{macrocode}
 % \end{macro}
-% If \pkg{ekdosis} be loaded with the |verse| global option, the
-% \env{verse} environment needs to be redefined so that lines of
-% poetry are numbered continuously. Additionally,
-% \cs{verselinenumfont} is initially set to
-% \cs{normalfont}\cs{footnotesize}.
+% \begin{environment}{ekdverse}
+%   \env{ekdverse} provides an implementation of poetry lines. It is
+%   set to use either the \pkg{lineno} or the \pkg{verse} package
+%   depending on the value that is passed to the global option
+%   |verse|:---
 %    \begin{macrocode}
 \if@pkg@verse
 \verselinenumfont{\normalfont\footnotesize}
 \setcounter{poemline}{1}
-\renewenvironment{verse}[1][\linewidth]{%
+\NewDocumentEnvironment{ekdverse}{O{\linewidth}}{%
+  \nolinenumbers
+  \let\linelabel\label
   \stepcounter{verse@envctr}%
   \addtocounter{poemline}{-1}\refstepcounter{poemline}%
   \setcounter{vslineno}{1}%
   \let\\=\@vscentercr
   \list{}{\itemsep \z@
-    \itemindent  -\vindent%
-    \listparindent\itemindent
-    \parsep       \stanzaskip
-    \ifdim #1 < \linewidth
-    \rightmargin        \z@
-    \setlength{\leftmargin}{\linewidth}%
-    \addtolength{\leftmargin}{-#1}%
-    \addtolength{\leftmargin}{-0.5\leftmargin}%
-    \else
-    \rightmargin        \leftmargin
-    \fi
-    \addtolength{\leftmargin}{\vindent}}%
-\item[]%
-}{\endlist}
+          \itemindent  -\vindent%
+          \listparindent\itemindent
+          \parsep       \stanzaskip
+          \setlength{\itemsep}{0pt}%
+          \setlength{\topsep}{0pt}%
+          \setlength{\partopsep}{0pt}%
+          \ifdim #1 < \linewidth
+            \rightmargin        \z@
+            \setlength{\leftmargin}{\linewidth}%
+            \addtolength{\leftmargin}{-#1}%
+            \addtolength{\leftmargin}{-0.5\leftmargin}%
+          \else
+            \rightmargin        \leftmargin
+          \fi
+          \addtolength{\leftmargin}{\vindent}}%
+  \item[]%
+}
+{\endlist}
+\else
+\newlength{\ekdverseindentlength}
+\setlength{\ekdverseindentlength}{\parindent}
+\NewDocumentEnvironment{ekdverse}{O{\ekdverseindentlength}}{
+  \begin{list}{}{%
+      \setlength{\leftmargin}{#1}
+      \setlength{\itemsep}{0pt}
+      \setlength{\topsep}{0pt}
+      \setlength{\partopsep}{0pt}
+    }
+  \item[]
+  }{\end{list}}
 \fi
 %    \end{macrocode}
-% \begin{environment}{ekdverse}
-%   \env{ekdverse} provides an implementation of poetry lines. It is
-%   set to use either the \pkg{lineno} or the \pkg{verse} package
-%   depending on the value that is passed to the global option
-%   |verse|:---
-%    \begin{macrocode}
-\NewDocumentEnvironment{ekdverse}{}{%
-  \if@pkg@verse
-  \nolinenumbers
-  \let\linelabel\label
-  \fi
-  \begin{verse}}
-  {\end{verse}}
-%    \end{macrocode}
 % \end{environment}
 % \begin{environment}{ekdpar}
 %   When |autopar| is set to |false| by means of \cs{SetTEIxmlExport},
-- 
cgit v1.2.3

