From 80d4307b761b9a1836f5217657283783ca403681 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Mon, 27 Jul 2020 19:52:09 +0200
Subject: new options for pagewise line numbering. done documenting lineation
 settings

---
 ekdosis.dtx | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 131 insertions(+), 3 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 67e402c..dab30cc 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -121,6 +121,15 @@ along with this program.  If not, see
   {https://classicalstudies.org/scs-blog/donald-j-mastronarde/review-guidelines-encoding-critical-editions-library-digital-latin},
   organization = {Society for Classical Studies}
 }
+
+@Software{lineno,
+  title =	 {The Lineno package},
+  titleaddon =	 {Line numbers on paragraphs},
+  author =	 {Lück, Uwe and Böttcher, Stephan},
+  url =		 {http://www.ctan.org/pkg/lineno},
+  date =	 {2005-11-02},
+  version =	 {4.41}
+}
 \end{filecontents}
 \begin{filecontents}[overwrite]{\jobname-cfg.tex}
 \footnotelayout{m}
@@ -1102,7 +1111,7 @@ along with this program.  If not, see
 % \fi
 \begin{minted}[linenos=false]{latex}
 \begin{xltabular}[c]{0.75\linewidth}{lXl}
-  \caption*{\textbf{Conspectus siglorum}\label{tab:conspectus-siglorum}}\\
+  \caption*{\textbf{Conspectus siglorum}}\\
   \multicolumn{3}{c}{\emph{Familia} \getsiglum{a}}\\
   \SigLine{A}\\
   & \getsiglum{A1} \emph{Emendationes scribae ipsius} & \\
@@ -1120,7 +1129,7 @@ along with this program.  If not, see
 % \fi
 %
 % \begin{xltabular}[c]{0.75\linewidth}{lXl}
-%   \caption*{\textbf{Conspectus siglorum}\label{tab:conspectus-siglorum}}\\
+%   \caption*{\textbf{Conspectus siglorum}}\\
 %   \multicolumn{3}{c}{\emph{Familia} \getsiglum{ca}}\\
 %   \SigLine{cA}\\
 %   & \getsiglum{cA1} \emph{Emendationes scribae ipsius} & \\
@@ -2370,6 +2379,84 @@ argument of the
 % element (ll.~5--7). Otherwise, the \texttt{TEI} output would not be
 % valid.
 %
+% \section{Lineation Settings}
+% \label{sec:lineation}
+% \danger \pkg{ekdosis} uses \pkg{lineno} internally for line
+% numbering.\footcite{lineno} But it must be noted that \pkg{ekdosis}
+% strictly prohibits the \enquote{pagewise} mode of operation that is
+% provided by \pkg{lineno}. As a result of this hinderance, all
+% \enquote{margin switching} features of \pkg{lineno} are disabled
+% within the environments that are specific to \pkg{ekdosis},
+% viz. \env{ekdosis} and \env{alignment}.
+%
+% That said, \pkg{ekdosis} provides equivalents of its own to handle
+% the line numbers the same way as \pkg{lineno}'s \enquote{pagewise}
+% mode of operation does.
+%
+% \DescribeMacro{\SetLineation} \cs{SetLineation}\marg{csv list of
+% options} may be used in the preamble or at any point of the document
+% to set lineation preferences. Its argument processes the |key=value|
+% options that follow:---\\
+% \DescribeOption{lineation} |lineation|$=$\verb+page|document+
+% \hfill\tcboxverb{Default: document}\\
+% |lineation=document| has the lines numbered continuously throughout
+% the document while |lineation=page| instructs \pkg{ekdosis} that the
+% numbering should start afresh at the top of each page.\\
+% \DescribeOption{modulo} |modulo| \hfill\tcboxverb{Default: not set}\\
+% |modulo| does not accept any value. When this option is set, every
+% fifth line is numbered.\\
+% \DescribeOption{modulonum} |modulonum|$=$\emph{n} (where \emph{n} is
+% an integer)\hfill\tcboxverb{Default: not set}\\
+% |modulonum| allows to modify the interval between the numbers that
+% are printed. |modulo| must be set for this option to have effect. As
+% examples, |modulo, modulonum=3| has every third line numbered and
+% |modulonum=1| disables modulo numbering.\\
+% \DescribeOption{margin} |margin|$=$\verb+right|left|inner|outer+
+% \hfill\tcboxverb{Default: left}\\
+% |margin| sets the margin in which the line numbers are to be
+% printed.\\
+% \DescribeOption{numbers} |numbers|$=$\verb+elided|full+
+% \hfill\tcboxverb{Default: elided}\\
+% This option only has effect on the numbers that are printed in the
+% apparatus criticus. |numbers=elided| applies on spans of numbers and
+% elides the last number of a range to the fewest number of figures
+% possible\---viz. 35--7, 129--31 \emph{\&c.}\---without eliding
+% digits in the group 10 to 19 in each hundred\---viz. 17--19, 115--18
+% \emph{\&c.} |numbers=full| leaves the numbers untouched.
+%
+% \paragraph{Useful Lineation Commands}
+% As implied above, pretty much all commands that are provided by the
+% \enquote{running} mode of operation of the \pkg{lineno} package will
+% work with \pkg{ekdosis}, notably the following:---\\
+% \DescribeMacro{\modulolinenumbers} \cs{modulolinenumbers}\oarg{n}
+% can be used to enable modulo line numbering as described above.\\
+% \DescribeMacro{\resetlinenumber} \cs{resetlinenumber}\oarg{n} resets
+% the line number to one or to \emph{n} if specified.\\
+% \DescribeMacro{\linelabel} \DescribeMacro{\lineref}
+% \cs{linelabel}\marg{label} sets a line label that can be referred to
+% with \cs{lineref}\marg{label}.
+%
+% The reader is invited to refer to the documentation of the
+% \pkg{lineno} package for more information.
+%
+% As an example, what follows has every fifth line number printed in
+% the inner margins. Additionally, the numbering shall start afresh at
+% the top of each page:---
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{latex}
+\SetLineation{
+  lineation=page,
+  modulo,
+  margin=inner
+}
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+% 
 % \section{To Be Continued...}
 % v1.0 of \pkg{ekdosis}, which should be available by the end of July
 % 2020, will include a full documentation. At the time of writing, the
@@ -3005,6 +3092,7 @@ argument of the
 \RequirePackage{zref-abspage}
 \RequirePackage{ltxcmds}
 \RequirePackage{atbegshi}
+\RequirePackage{ifoddpage}
 \if@pkg@parnotes
   \RequirePackage{parnotes}
 \fi
@@ -3541,6 +3629,39 @@ argument of the
       \luastringO{#1}))}}}
 %    \end{macrocode}
 % \paragraph{Lineation settings}
+% \begin{macro}{\outerlinenumbers}
+% \begin{macro}{\innerlinenumbers}
+% \pkg{ekdosis} does not use the \enquote{pagewise} numbering mode
+% that is provided by \pkg{lineno}. Therefore,
+% \cs{outerlinenumbers} and \cs{innerlinenumbers} are defined in
+% addition to \cs{rightlinenum{\allowbreak}bers} and
+% \cs{leftlinenumbers}.
+%    \begin{macrocode}
+\def\outerlinenumbers{
+  \def\makeLineNumberRunning{
+    \checkoddpage
+    \ifoddpage
+    \linenumberfont\hskip\linenumbersep\hskip\textwidth
+    \hbox to\linenumberwidth{\hss\LineNumber}\hss
+    \else
+    \hss\linenumberfont\LineNumber\hskip\linenumbersep
+    \fi
+  }
+}
+\def\innerlinenumbers{
+  \def\makeLineNumberRunning{
+    \checkoddpage
+    \ifoddpage
+    \hss\linenumberfont\LineNumber\hskip\linenumbersep
+    \else
+    \linenumberfont\hskip\linenumbersep\hskip\textwidth
+    \hbox to\linenumberwidth{\hss\LineNumber}\hss
+    \fi
+  }
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
 % The keys to be used for lineation settings follow. A conditional is
 % defined beforehand so that \pkg{ekdosis} may know whether the
 % numbering should start afresh at the top of each page.
@@ -3562,7 +3683,14 @@ argument of the
     full = \ekd@elidednumbersfalse},
   unknown-choice numbers = \PackageError{ekdosis}{unknown
     numbers=#1}{`numbers' must be either `elided' or `full'.},
-  initial numbers = elided
+  initial numbers = elided,
+  choice margin = {right = \rightlinenumbers,
+    left = \leftlinenumbers,
+    inner = \innerlinenumbers,
+    outer = \outerlinenumbers},
+  unknown-choice margin = \PackageError{ekdosis}{unknown
+    margin=#1}{`margin' must be either `left', `right', \MessageBreak
+    `inner' or `outer'}
 }
 %    \end{macrocode}
 % \begin{macro}{\SetLineation}
-- 
cgit v1.2.3

