texlive[56856] Master/texmf-dist: ekdosis (4nov20)

commits+karl at tug.org commits+karl at tug.org
Wed Nov 4 22:36:42 CET 2020


Revision: 56856
          http://tug.org/svn/texlive?view=revision&revision=56856
Author:   karl
Date:     2020-11-04 22:36:41 +0100 (Wed, 04 Nov 2020)
Log Message:
-----------
ekdosis (4nov20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/lualatex/ekdosis/README.md
    trunk/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf
    trunk/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf
    trunk/Master/texmf-dist/source/lualatex/ekdosis/Makefile
    trunk/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx
    trunk/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua
    trunk/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty

Modified: trunk/Master/texmf-dist/doc/lualatex/ekdosis/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/ekdosis/README.md	2020-11-04 21:36:26 UTC (rev 56855)
+++ trunk/Master/texmf-dist/doc/lualatex/ekdosis/README.md	2020-11-04 21:36:41 UTC (rev 56856)
@@ -12,7 +12,7 @@
 arranged in running paragraphs or on facing pages, in any number of
 columns which in turn can be synchronized or not. In addition to
 printed texts, `ekdosis` can convert `.tex` source files so as to
-produce `TEI xml` compliant critical editions. Database-driven
+produce `TEI xml`-compliant critical editions. Database-driven
 encoding under LaTeX then allows extraction of texts entered segment
 by segment according to various criteria: main edited text, variant
 readings, translations or annotated borrowings between texts. It is
@@ -21,7 +21,7 @@
 
 License and Disclamer
 =====================
-ekdosis – Typesetting TEI xml Compliant Critical Editions
+ekdosis – Typesetting TEI xml-Compliant Critical Editions
 
 Copyright ⓒ 2020 Robert Alessi
 
@@ -81,7 +81,7 @@
     `ekdosis.lua` files.
 
 2.  To finish the installation you have to move the `ekdosis.sty` and
-    `ekdosis.lua` files into a directory where LaTeX can find it. See
+    `ekdosis.lua` files into a directory where LaTeX can find them. See
     the FAQ on `texfaq.org` at <https://texfaq.org/FAQ-inst-wlcf> for
     more on this.
 

Modified: trunk/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/lualatex/ekdosis/Makefile
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/ekdosis/Makefile	2020-11-04 21:36:26 UTC (rev 56855)
+++ trunk/Master/texmf-dist/source/lualatex/ekdosis/Makefile	2020-11-04 21:36:41 UTC (rev 56856)
@@ -34,6 +34,8 @@
 	if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi
 	if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi
 	$(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null
+	$(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null
+	$(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null
 
 samples: clean sty
 	$(MAKE) --directory=$(SAMPLES)

Modified: trunk/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx	2020-11-04 21:36:26 UTC (rev 56855)
+++ trunk/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx	2020-11-04 21:36:41 UTC (rev 56856)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 % 
-% ekdosis -- Typesetting TEI xml compliant critical editions
+% ekdosis -- Typesetting TEI xml-compliant critical editions
 % Copyright (C) 2020  Robert Alessi
 % 
 % Please send error reports and suggestions for improvements to Robert
@@ -27,7 +27,7 @@
 --[[
 This file is part of the `ekdosis' package
 
-ekdosis -- Typesetting TEI xml compliant critical editions
+ekdosis -- Typesetting TEI xml-compliant critical editions
 Copyright (C) 2020  Robert Alessi
 
 Please send error reports and suggestions for improvements to Robert
@@ -61,11 +61,11 @@
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{ekdosis}
 %<*package>
-    [2020/08/14 v1.0 Typesetting TEI xml compliant critical editions]
+    [2020/11/04 v1.1 Typesetting TEI xml-compliant critical editions]
 %</package>
 %<*driver>
 \begin{filecontents}[noheader,overwrite]{bibdata.xml}
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <listBibl xmlns="http://www.tei-c.org/ns/1.0">
   <biblStruct type="book" xml:id="ReynoldsWilson1991">
     <monogr>
@@ -86,6 +86,24 @@
       </imprint>
     </monogr>
   </biblStruct>
+  <biblStruct type="book" xml:id="sDrak">
+    <monogr>
+      <title level="m">Punicorum libri septemdecim</title>
+      <author>
+        <forename>Tiberius Catius</forename>
+        <surname>Silius Italicus</surname>
+      </author>
+      <editor>
+        <forename>Arnold</forename>
+        <surname>Drakenborch</surname>
+      </editor>
+      <edition>Trajecti ad Rhenum</edition>
+      <imprint>
+        <pubPlace>Utrecht</pubPlace>
+        <date>1717</date>
+      </imprint>
+    </monogr>
+  </biblStruct>
 </listBibl>
 \end{filecontents}
 \begin{filecontents}[overwrite]{\jobname.bib}
@@ -92,7 +110,7 @@
 @Article{Alessi2020,
   author =	 {Alessi, Robert},
   title =	 {ekdosis: Using Lua\LaTeX{} for Producing \texttt{TEI
-                  xml} Compliant Critical Editions and Highlighting
+                  xml}-Compliant Critical Editions and Highlighting
                   Parallel Writings},
   journaltitle = {Journal of Data Mining and Digital Humanities},
   date =	 2020,
@@ -139,6 +157,15 @@
   location =	 {Oxford}
 }
 
+ at Book{West1973,
+  author =	 {West, Martin L.},
+  title =	 {Textual Criticism and Editorial Technique},
+  date =	 1973,
+  titleaddon =	 {Applicable to Greek and Latin Texts},
+  publisher =	 {B. G. Teubner},
+  location =	 {Stuttgart}
+}
+
 @Online{DLL-TC,
   author =	 {{Digital Latin Library}},
   title =	 {Textual Criticism},
@@ -165,6 +192,15 @@
   url =		 {http://www.teibyexample.org}
 }
 
+ at Software{fnpos,
+  title =	 {The Fnpos package},
+  titleaddon =	 {Control the position of footnotes on the page},
+  author =	 {Nakashima, Hiroshi},
+  url =		 {http://www.ctan.org/pkg/fnpos},
+  date =	 {2018-09-03},
+  version =	 {1.0}
+}
+
 @Software{lineno,
   title =	 {The Lineno package},
   titleaddon =	 {Line numbers on paragraphs},
@@ -174,6 +210,15 @@
   version =	 {4.41}
 }
 
+ at Software{paracol,
+  title =	 {The Paracol package},
+  titleaddon =	 {Multiple columns with texts “in parallel”},
+  author =	 {Nakashima, Hiroshi},
+  url =		 {http://www.ctan.org/pkg/paracol},
+  date =	 {2018-12-31},
+  version =	 {1.35}
+}
+
 @Software{polyglossia,
   title =	 {The Polyglossia package},
   titleaddon =	 {An alternative to babel for XeLaTeX and LuaLaTeX},
@@ -222,13 +267,12 @@
 \end{filecontents}
 \begin{filecontents}[overwrite]{\jobname-cfg.tex}
 \footnotelayout{m}
+\EnvtoTEI{ancientgreek}{p}[xml:lang="grc"]
 \DeclareApparatus{fontium}[
         delim=\hskip0.75em,
-        bhook=\textbf{Sources:},
-        ehook=.]
+        bhook=\textbf{Sources:}]
 \DeclareApparatus{default}[
-        delim=\hskip0.75em,
-        ehook=.]
+        delim=\hskip0.75em]
 \DeclareApparatus{ltr}[
         delim=\hskip0.75em]
 \DeclareApparatus{rtl}[
@@ -246,6 +290,7 @@
 % Peter and John Story:
 \DeclareWitness{pjA}{A}{Manuscript A Call No 123}
 \DeclareWitness{pjB}{B}{Manuscript B Call No 456}
+\DeclareWitness{pjC}{C}{Manuscript C Call No 789}
 % Caesar's Gallic War:
 \DeclareWitness{cA}{A}{\emph{Bongarsianus} 81}[
                msName=Bongarsianus,
@@ -280,8 +325,21 @@
 % Hippocrates Epidemics, Book 2:
 \DeclareWitness{hV}{V}{\emph{Vaticanus Gr.} 276}
 \DeclareWitness{hI}{I}{\emph{Parisinus Gr.} 2140}
+\DeclareHand{hIac}{hI}{I\textsuperscript{ac}}[Lectio ante correctionem]
+\DeclareHand{hIpc}{hI}{I\textsuperscript{pc}}[Lectio post correctionem]
 \DeclareWitness{hR}{R}{\emph{Vaticanus Gr.} 277}
 \DeclareWitness{hH}{H}{\emph{Parisinus Gr.} 2142}
+\DeclareSource{Lit}{Littré}
+\DeclareSource{Erm}{Ermerins}
+\DeclareSource{Sm}{Smith}
+\DeclareSource{Gal}{Gal.}
+\DeclareScholar{ego}{ego}[
+                forename=Robert,
+                surname=Alessi]
+\DeclareShorthand{egomute}{\unskip}{ego}
+\DeclareShorthand{hcodd}{codd.}{hV,hI,hR,hH}
+\DeclareShorthand{hedd}{edd.}{Lit,Erm,Sm}
+\DeclareShorthand{hegoscr}{\emph{scripsi}}{ego}
 % Silius Italicus' Punica, IX, 30--2:
 \DeclareWitness{sL}{L}{Laurentianus, plut, XXXVII, cod. 16}[
                       origDate=s. XV]
@@ -291,7 +349,7 @@
                       origDate=s. XV]                      
 \DeclareWitness{sV}{V}{Vaticanus lat. 1652}[
                       origDate=s. XV]
-\DeclareScholar{sDrak}{\emph{Drakenborch}}
+\DeclareSource{sDrak}{\emph{Drakenborch}}
 \end{filecontents}
 \documentclass{ltxdoc}
  %\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry}
@@ -320,9 +378,9 @@
 \def\sg#1{\textancientgreek{#1}}
 \usepackage[Old Standard]{mathfont}
 \usepackage{arabluatex}
-\usepackage[parnotes=roman,teiexport=tidy]{ekdosis}
+\usepackage[parnotes=roman,teiexport=tidy,verse]{ekdosis}
 \input{ekdosis-cfg}
-\SetxmlBibResource{bibdata}
+\AddxmlBibResource{bibdata.xml}
 \usepackage{booktabs}
 \usepackage{xltabular}
 \usepackage[prevent-all]{widows-and-orphans}
@@ -369,8 +427,6 @@
 \labelformat{subsection}{sect.~#1}
 \labelformat{subsubsection}{sect.~#1}
 \labelformat{figure}{fig.~#1}
-\newcounter{dummy}
-\newcommand{\dummy}{\refstepcounter{dummy}}
 \usepackage[defaultindex=none,citecmd=autocite]{icite}
 \bibinput{ekdosis}
 \usepackage[nospace,american]{varioref}
@@ -385,8 +441,8 @@
 }
 \ifbool{nocolordoc}
 {
-  \usepackage{fontawesome}
-  \def\oasymbol{\faUnlock}
+  \usepackage{academicons}
+  \def\oasymbol{\aiOpenAccess}
   \usepackage{biblatex-ext-oa}
 }
 {\usepackage[symbolpackage=tikz]{biblatex-ext-oa}}
@@ -422,9 +478,9 @@
 \metaset{title}{ἔκδοσις}
 \metaset{date}{\filedate}
 \metaset{draft}{\fileversion}
-\metaset{subject}{TEI xml compliant critical editions}
-\metaset{subtitle}{Typesetting TEI xml Compliant Critical Editions}
-\metaset[print]{subtitle}{Typesetting \texttt{TEI xml} Compliant
+\metaset{subject}{TEI xml-compliant critical editions}
+\metaset{subtitle}{Typesetting TEI xml-Compliant Critical Editions}
+\metaset[print]{subtitle}{Typesetting \texttt{TEI xml}-Compliant
   Critical Editions}
 \metaset{author}{Robert Alessi}
 \metaset{keywords}{LaTeX, Lua, TEI xml, multilingual critical
@@ -496,8 +552,7 @@
 \ifbool{nocolordoc}{\usemintedstyle{bw}}{}
 \setminted{bgcolor=ekdcolor,linenos, fontsize=\small}
 \newminted[ekdlua]{lua}{bgcolor={}, linenos, fontsize=\relsize{-0.5},
-  xleftmargin=12pt, breaklines, numberblanklines=false, numbersep=3pt,
-  firstnumber=last}
+  xleftmargin=12pt, breaklines, numberblanklines=false, numbersep=3pt}
 \renewcommand{\theFancyVerbLine}{\normalfont\smaller\arabic{FancyVerbLine}}
 \usepackage[contents]{colordoc}
 \newcommand{\pkg}[1]{\textsf{#1}\index{#1=#1 (package)}}
@@ -513,6 +568,13 @@
   \captionof{#1}{#2}%
   #3%
   \egroup}
+\NewDocumentCommand{\newfeature}{o}{%
+  \leavevmode
+  \IfNoValueTF{#1}
+  {\marginpar{\hfill\emph{New feature}}}
+  {\marginpar{\hfill\emph{New feature} #1}}%
+  \ignorespaces
+}
 % \usepackage{etoc}
 % \etocsettocdepth{paragraph}
 % \newcommand{\ekdtableofcontents}{%
@@ -538,14 +600,14 @@
 \RecordChanges
  %\OnlyDescription
 \begin{document}
-  \DocInput{\jobname.dtx}
-  \PrintChanges
-  \PrintIndex
+\DocInput{\jobname.dtx}
+\PrintChanges
+\PrintIndex
 \end{document}
 %</driver>
 % \fi
 %
-% \CheckSum{1669}
+% \CheckSum{1893}
 %
 % \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
@@ -587,6 +649,7 @@
 %
 % \changes{v0.99a}{2020/07/08}{First public release (documentation in
 % progress)}
+% \changes{v1.0}{2020/08/14}{Documentation complete}
 %
 % \begin{abstract}
 %   \pkg{ekdosis} is a Lua\LaTeX{} package designed for
@@ -596,7 +659,7 @@
 %   facing pages, in any number of columns which in turn can be
 %   synchronized or not. In addition to printed texts,
 %   \pkg{ekdosis} can convert \texttt{.tex} source files so as to
-%   produce \texttt{TEI xml} compliant critical
+%   produce \texttt{TEI xml}-compliant critical
 %   editions. Database-driven encoding under \LaTeX{} then allows
 %   extraction of texts entered segment by segment according to
 %   various criteria: main edited text, variant readings, translations
@@ -802,9 +865,10 @@
 %</example>
 % \fi
 %
-% \needspace{5\baselineskip}
 % PDF output:---
 % \medskip
+% 
+% \needspace{7\baselineskip}
 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
 %   \begin{specimen}
 %   I 
@@ -850,7 +914,7 @@
 % the first lemma above spans several lines whereas the second one is
 % written in sequence without spaces.
 %
-% In the PDF ouput, the edition text is printed in the upper part of
+% In the PDF output, the edition text is printed in the upper part of
 % the page, above the line, and naturally shows the accepted
 % readings. The margins are used for numeration. In the apparatus
 % criticus, below the line, reference to the text is made by
@@ -956,14 +1020,28 @@
 %</example>
 % \fi
 %
-% \subsection{Witnesses, Hands, Shorthands \& Scholars}
+% \subsection{Witnesses, Hands, Sources, Scholars \& Shorthands}
 % \label{sec:declarations}
+% \paragraph{Terminology}
+% \label{sec:terminology}
+% Strictly speaking, the term \enquote{witness} should apply to any
+% manuscript evidence dating back to the Middle Ages used by the
+% editor to establish the edition text. That said, editors often
+% consult many other types of documents, such as modern editions,
+% articles, notes, correspondence and the like, all of which fall into
+% the category of \enquote{sources}. Furthermore, unpublished
+% conjectures are also taken into account, not to mention the
+% corrections and emendations that are proposed in many places by the
+% editor of the text. As it is necessary to refer to scholars as
+% individuals, \enquote{scholars} naturally emerges as a third
+% category.
+%
 % Any reference that is to be used in the apparatus criticus must be
 % \enquote{declared} in the preamble beforehand, namely: manuscript
 % sigla (either for single manuscripts or manuscript families, primary
-% or later hands, \emph{\&c.}) or abbreviated last names of scholars.
-% To that effect, \pkg{ekdosis} provides the following preamble-only
-% commands:---
+% or later hands, \emph{\&c.}), abbreviated last names of sources
+% and scholars.  To that effect, \pkg{ekdosis} provides the following
+% preamble-only commands:---
 % 
 % \paragraph{Witnesses}
 % \DescribeMacro{\DeclareWitness} \cs{DeclareWitness}\marg{unique
@@ -1008,8 +1086,10 @@
 % \label{ref:marcianus-b}
 % To take here one example, a witness such as the \emph{Marcianus
 % Graecus}~269, referred to as manuscript \enquote*{M} in the
-% editions, which contains sixty treatises from Hippocrates, could be
-% declared as follows:--- \iffalse
+% editions, which contains sixty treatises transmitted under the name
+% of Hippocrates, could be declared as follows:---
+%
+%\iffalse
 %<*example>
 % \fi
 \begin{minted}[linenos=false]{latex}
@@ -1034,7 +1114,7 @@
 % \item The unique identifier of the hand to be used both in the
 % |.tex| source file and as an |xml:id| in the \texttt{TEI xml} output
 % if any.
-% \item The unique idendifier of the witness the hand is related
+% \item The unique identifier of the witness the hand is related
 % to. Of course, this witness must have been declared beforehand.
 % \item The rendition to be used in the printed apparatus criticus,
 % which also will be found within the |<handNote>| element of the
@@ -1061,7 +1141,7 @@
 % source file will be printed as \getsiglum{M}, \getsiglum{M1} and
 % \getsiglum{M2} respectively. Not only the code gains legibility, but
 % also flexibility for simply changing any declared rendition will
-% update corresponding sigla thoughout the entire edition.
+% update corresponding sigla throughout the entire edition.
 %
 % As a final example, here is how \pkg{ekdosis} would encode
 % information as declared above for the \emph{Marcianus Gr.}~269
@@ -1081,7 +1161,7 @@
         <institution>Marciana Library</institution>
         <idno>269</idno>
         <msName>
-          <emph>Marcianus Gr.</emph>
+          Marcianus Gr.
         </msName>
       </msIdentifier>
       <physDesc>
@@ -1112,9 +1192,91 @@
 % \fi
 % \label{ref:marcianus-e}
 %
+% \paragraph{Sources}
+% \label{ref:declare-source}
+% \DescribeMacro{\DeclareSource} \cs{DeclareSource}\marg{unique
+% label}\marg{rendition}\newfeature[v1.1]\\
+% The \emph{Conspectus Siglorum} that is placed ahead of the edition
+% text is traditionally divided into two parts: a)~\emph{Codices},
+% which provides the list of sigla used in the apparatus,
+% b)~\emph{Editiones uel Studia}, which provides references to
+% sources, either published or unpublished, which contain conjectures
+% used in the apparatus criticus. \cs{DeclareSource} takes two
+% mandatory arguments used to specify consecutively:---
+% \begin{enumerate}
+% \item A unique label used in the |.tex| source file to refer to the
+%   work where the conjecture is found.
+% \item The rendition to be used in the printed apparatus criticus.
+% \end{enumerate}
+%
+% \danger As \pkg{ekdosis} can include and use \texttt{TEI
+% xml}-compliant lists of references,\footnote{See below
+% \vref{sec:references-cited-works}.} it is advisable to use
+% Bib\hologo{(La)TeX} labels in the first argument of
+% \cs{DeclareSource}. Otherwise, the unique label used to declare the
+% source would point to no |xml:id| and the \texttt{TEI xml} would not
+% be valid. Likewise, shorthands fields from the bibliographical
+% database can be recalled from within the second argument of
+% \cs{DeclareSource}:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{latex}
+\DeclareSource{Wil}{Wilamowitz}
+% or for example:
+\DeclareSource{Wil}{\citename{Wil}{shorteditor}}
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+% \label{sec:declarations-end}
+%
+% \paragraph{Scholars}
+% \label{ref:declare-scholar}
+% \DescribeMacro{\DeclareScholar}\cs{DeclareScholar}\marg{unique
+% id}\marg{rendition}\oarg{options}\newfeature[v1.1]\\
+% Occasionally, it is necessary to refer to a scholar as a person. For
+% example, corrections and conjectures are commonly inserted as
+% self-references to the editor of the text in the apparatus criticus
+% in print with such words as \emph{scripsi}, \emph{addidi},
+% \emph{correxi} and the like. Other examples come from unpublished
+% conjectures of other scholars found in private
+% libraries. \cs{DeclareScholar} takes two mandatory arguments to
+% specify consecutively:---
+% \begin{enumerate}
+% \item The unique identifier of the scholar to be used both in the
+% |.tex| source file and as an |xml:id| in the \texttt{TEI xml} output
+% if any.
+% \item The rendition to be used in the apparatus criticus in print,
+% which also will be found within the |<sourceDesc>| element of the
+% \texttt{TEI} header where the description of the persons cited
+% occurs, within an |<abbr type="siglum">| element.
+% \end{enumerate}
+% Finally, the optional argument of \cs{DeclareScholar} accepts the
+% following comma-separated list of |key-value| arguments:---\\
+% \DescribeOption{rawname}|rawname|$=$\meta{name}\\
+% |rawname| refers to a name that is not to be dissected into name
+% part components such as forename, surname and the like. If |rawname|
+% be used, then \pkg{ekdosis} will ignore the following three optional
+% arguments: |forename|, |surname| and |addname|.\\
+% \DescribeOption{forename}|forename|$=$\meta{forename}\\
+% |forename| refers to first and middle names or initials.\\
+% \DescribeOption{surname}|surname|$=$\meta{surname}\\
+% |surname| stores the last name.\\
+% \DescribeOption{addname} |addname|$=$\meta{additional name}\\
+% |addname| refers to an additional or alternate name by which the
+% scholar is known viz.\ a Latinized form of the name, a nickname, an
+% epithet or alias.\\
+% \DescribeOption{note} |note|$=$\meta{note}\\
+% |note| may hold any relevant information about the material used by
+% the editor. For example, a note may specify that this material has
+% been found as marginal notes by the hand of the scholar in some
+% edition in print.
+%
 % \paragraph{Shorthands}
 % \DescribeMacro{\DeclareShorthand} \cs{DeclareShorthand}\marg{unique
-% id}\marg{rendition}\marg{csv list of witnesses}\\
+% id}\marg{rendition}\marg{csv list of identifiers}\\
 % This command provides a convenient way to declare \emph{families} of
 % witnesses. It takes three mandatory arguments used to specify
 % consecutively:---
@@ -1147,50 +1309,39 @@
 % Then, symbols |a| and |b| can be used in the |.tex| source file in
 % place of manuscripts that belong to either family.
 %
-% \paragraph{Scholars}
-% \label{ref:declare-scholar}
-% \DescribeMacro{\DeclareScholar} \cs{DeclareScholar}\marg{unique
-% label}\marg{rendition}\\
-% The \emph{Conspectus Siglorum} that is placed ahead of the edition
-% text is traditionally divided into two parts: a)~\emph{Codices},
-% which provides the list of sigla used in the apparatus,
-% b)~\emph{Editiones uel Studia}, which provides references to
-% scholars whose published or unpublished works contain conjectures
-% used in the apparatus criticus. \cs{DeclareScholar} takes two
-% mandatory arguments used to specify consecutively:---
-% \begin{enumerate}
-% \item A unique label used in the |.tex| source file to refer to the
-%   work where the conjecture is found.
-% \item The rendition to be used in the printed apparatus criticus.
-% \end{enumerate}
+% That said, \cs{DeclareShorthand} is not meant to be restricted to
+% declared witnesses. On the contrary, it also applies to any declared
+% sources and scholars by means of \cs{DeclareSource} and
+% \cs{DeclareScholar}. As an example, assuming that a self-reference
+% to the person responsible for the edition has been set in the
+% preamble, an associated shorthand can be defined like so:---
 %
-% As \pkg{ekdosis} can include and use \texttt{TEI xml} compliant
-% lists of references,\footnote{See below
-% \vref{sec:references-cited-works}.} it is avisable to use
-% Bib\hologo{(La)TeX} labels in the first argument of
-% \cs{DeclareScholar}. Likewise, shorthands fields from the
-% bibliographical database can be recalled from within the second
-% argument of \cs{DeclareScholar}:---
-% 
 % \iffalse
 %<*example>
 % \fi
-\begin{minted}[linenos=false]{latex}
-\DeclareScholar{Wil}{Wilamowitz}
-% or for example:
-\DeclareScholar{Wil}{\citename{Wil}{shorteditor}}
+\begin{minted}{latex}
+\DeclareScholar{ego}{ego}[
+     forename=John,
+     surname=Smith,
+     note=Main editor of the text]
+\DeclareShorthand{egoscr}{\emph{scripsi}}{ego}
 \end{minted}
 % \iffalse
 %</example>
 % \fi
-% \label{sec:declarations-end}
 %
+% Then, the shorthand |egoscr| (l.~5) can be used to print in the
+% apparatus criticus the technical term \emph{scripsi} and use at the
+% same time the pointer |#ego| that is expected in the \texttt{TEI
+% xml} output file. Detailed examples of this technique will be
+% provided below in \vref{sec:emendations-conjectures}.
+%
 % \subsubsection{Printing Formatted Witnesses
 % --- Conspectus Siglorum}
 % \label{sec:print-witnesses}
-% Once witnesses, hands and scholars have been declared, \pkg{ekdosis}
-% provides two commands to have them printed as declared from their
-% indentifiers.
+% Once witnesses, hands, scholars and sources have been declared,
+% \pkg{ekdosis} provides two commands to have them printed as declared
+% from their identifiers.
 %
 % \DescribeMacro{\getsiglum} \cs{getsiglum}\marg{csv list of witnesses
 % or single witness} behaves exactly as the |wit| optional argument of
@@ -1254,12 +1405,12 @@
 %   \SigLine{cl}\\
 % \end{xltabular}
 %
-% \subsection{Editing a Single Text With No Translation}
+% \subsection{Editing a Single Text}
 % \label{sec:single-text-editing}
 % \DescribeEnv{ekdosis}
 % Running paragraphs of one single text to be edited should be
-% inserted in the \env{ekdosis} environment, like so:---\footnote{See
-% above \vref{lst:pj1}.}
+% inserted in the \env{ekdosis} environment, like so:\footnote{See
+% above \vref{lst:pj1}.}---
 % \iffalse
 %<*example>
 % \fi
@@ -1323,7 +1474,11 @@
 % \emph{reading}, which contains deviant readings rejected by the
 % editor.
 %
-% \paragraph{Lemmata} \DescribeMacro{\lem}
+% \danger What follows refers to the notions of \enquote{witness},
+% \enquote{source} and \enquote{scholar} as defined above
+% \vpageref{sec:terminology}.
+%
+% \paragraph{Lemmata} \label{ref:lemmata}\DescribeMacro{\lem}
 % \cs{lem}\oarg{options}\marg{lemma text}\\
 % As \meta{lemma text} is a word or a phrase judged by the editor to
 % be authentic or authoritative, \cs{lem} prints it by default both in
@@ -1338,18 +1493,38 @@
 % While a single witness may be recorded as in |wit=A|,
 % comma-separated lists of multiple witnesses must obviously be
 % enclosed in curly braces, like so:
-% |wit={A,B,C}|. \label{ref:mss-sep-families}It must be noted
-% that witnesses can be grouped by using spaces as separators, like
-% so: \verb*|wit={A,B,C, D,E,F}|.\\
+% |wit={A,B,C}|. \label{ref:mss-sep-families}It must be noted that
+% witnesses can be grouped by using spaces as separators, like so:
+% \verb*|wit={A,B,C, D,E,F}|. Although any unique identifiers or
+% labels used to \enquote{declare} sources and scholars as described
+% above \vpagerefrange{ref:declare-source}{ref:declare-scholar} can
+% also be used as values of the |wit| optional argument, it is
+% recommended to use |sources| and |resp| to refer to either category
+% respectively as described below.\\
+% \DescribeOption{source} |source|$=$\meta{csv list of
+% sources}\label{ref:lem-source}\newfeature[v1.1]\\
+% A \enquote{source} refers to any type of document consulted by the
+% editor to establish the edition text. Most commonly, corrections and
+% emendations from previous editions are cited in the apparatus
+% criticus.\footnote{For edition texts used as sources, see examples
+% below in \vref{sec:emendations-conjectures} and
+% \vref{sec:references-cited-works}.}\\
+% \DescribeOption{resp} |resp|$=$\meta{csv list of
+% scholars}\label{ref:lem-resp}\newfeature[v1.1]\\
+% |resp| refers to scholars responsible for the emendations,
+% conjectures and corrections that are cited in the apparatus
+% criticus.\footnote{See detailed examples in
+% \vref{sec:emendations-conjectures}.}\\
 % \DescribeOption{alt} |alt|$=$\meta{alternate lemma}\\
 % While the mandatory argument of \cs{lem}, \meta{lemma text}, is
 % always used to print the edition text in the upper part of the page,
 % \meta{alternate lemma}, if specified, supersedes what is printed in
-% the related entry of the apparatus criticus. This mechanism is useful
-% in more than one respect. For instance, it can be used to insert
-% abbreviated lemmata in the apparatus criticus, or to introduce an
-% alternate way of writing entries with Latin technical terms in the
-% apparatus criticus as will be demonstrated below in the example
+% the related entry of the apparatus criticus. This mechanism is
+% useful in more than one respect. For instance, it can be used to
+% insert abbreviated lemmata in the apparatus criticus, or to
+% introduce an alternate way of writing entries with Latin technical
+% terms in the apparatus criticus as will be demonstrated below in the
+% example
 % provided by \vref{lst:pj2}.\\
 % \DescribeOption{sep} |sep|$=$\meta{separator}\\
 % |sep| allows to change the symbol used to separate the lemma text
@@ -1357,8 +1532,17 @@
 % bracket (|]|)\\
 % \DescribeOption{nosep} |nosep|$=$\verb+true|false+\\
 % This named argument does not need a value as it defaults to |true|
-% if it is used. Obviously, |nosep| removes the separator mentioned
-% above.\\
+% if it is used. |nosep| removes the separator mentioned
+% above. Obviously, |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.
+% \danger \DescribeMacro{\ekdsep} If |nosep| has been 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.\\
 % \DescribeOption{nolem} |nolem|$=$\verb+true|false+\\
 % This named argument does not need a value as it defaults to |true|
 % if it is used. |nolem| completely removes the lemma text from the
@@ -1366,10 +1550,12 @@
 % entry in the apparatus criticus.\\
 % \DescribeOption{type} |type|$=$\meta{value}\\
 % This named argument has no effect on the apparatus criticus of the
-% edition in print, but it is used in the \texttt{TEI xml} ouput to
+% edition in print, but it is used in the \texttt{TEI xml} output to
 % classify the variation recorded in the entry according to some
 % convenient typology. Categories such as lexical, morphological,
-% orthographical and the like may apply.
+% orthographical and the like may apply. Obviously, |type=emendation|
+% should be restricted to lemma texts and |type=conjecture| to variant
+% readings recorded by means of \cs{rdg} described below.
 %
 % \needspace{11\baselineskip}
 % Finally, four named arguments can be used to insert words at the
@@ -1404,6 +1590,8 @@
 % more detailed information:---\\
 % \DescribeOption{wit} |wit|$=$\meta{csv list of
 % witnesses}\label{ref:rdg-wit}\\
+% \DescribeOption{source} |source|$=$\meta{csv list of sources}\\
+% \DescribeOption{resp} |resp|$=$\meta{csv list of scholars}\\
 % \DescribeOption{alt} |alt|$=$\meta{alternate reading}\\
 % \DescribeOption{nordg} |nordg|$=$\verb+true|false+\\
 % This named argument does not need a value as it defaults to |true|
@@ -1410,6 +1598,9 @@
 % if it is used. |nordg| completely removes the variant reading from
 % the related entry in the apparatus criticus.\\
 % \DescribeOption{type} |type|$=$\meta{value}\\
+% Obviously, |type=conjecture| should be restricted to variant
+% readings and |type=emendation| to lemma texts recorded by means of
+% \cs{lem} described above.\\
 % \DescribeOption{pre} |pre|$=$\meta{words}\\
 % \DescribeOption{post} |post|$=$\meta{words}\\
 % \DescribeOption{prewit} |prewit|$=$\meta{words}\\
@@ -1416,7 +1607,7 @@
 % \DescribeOption{postwit} |postwit|$=$\meta{words}\\
 %
 % \paragraph{Notes}
-% \DescribeMacro{\note}\DescribeMacro{\note*}
+% \DescribeMacro{\note}\label{ref:notes-b}\DescribeMacro{\note*}
 % \cs{note}\oarg{options}\marg{text} or
 % \cs{note*}\oarg{options}\marg{text}\label{ref:editorial-notes}\\
 % It may happen that editorial notes be needed to record short
@@ -1485,6 +1676,8 @@
 % \iffalse
 %</example> 
 % \fi
+%
+% \needspace{7\baselineskip}
 % \resetlinenumber
 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
 %   \begin{specimen}
@@ -1566,7 +1759,581 @@
 % \iffalse
 %</example>
 % \fi
+% \label{ref:notes-e}
 %
+% \subsection{Indicating Subvariation in Apparatus Entries}
+% \label{sec:indic-subv-appar}
+% It must be noted that grouping readings so as to keep emphasis on
+% subvariation, regardless of its cause, is entirely optional.
+% Furthermore, the applicability of this technique is limited to the
+% \texttt{TEI xml} output as it helps the machines to understand a
+% grouping otherwise immediately accessible to human mind from the
+% information that is available in well-written
+% apparatus. \pkg{ekdosis} provides two ways of expressing
+% subvariation.
+%
+% \subsubsection{Implicit Grouping}
+% \label{sec:implicit-grouping}
+% Because apparatus entries may nest recursively, the \cs{app} command
+% can be used to group similar readings.
+%
+% \danger However, for nesting to work, the |alt| optional argument
+% must be used in every \cs{lem} and \cs{rdg} command involved in the
+% nesting. This rule applies to both parent and child commands, as
+% demonstrated in the following example:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{latex}
+As I was walking home through Times Square, I saw my friend
+\app{
+  \lem[wit={A,B}, alt={Peter\---Street}]{Peter at the
+    \app{
+      \lem[wit=A, alt=station]{station}
+      \rdg[wit=B, alt=bookstore]{bookstore}
+    }
+    on 42nd Street}
+  \rdg[wit=C, alt={John on Broadway}]{John on Broadway}
+}.
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% PDF output:---
+% \medskip
+% 
+% \needspace{7\baselineskip}
+% \resetlinenumber
+% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
+%   \begin{specimen}
+%    As I was walking home through Times Square, I saw my friend
+%    \app{
+%      \lem[wit={pjA,pjB}, alt={Peter\---Street}]{Peter at the
+%        \app{
+%          \lem[wit=pjA, alt=station]{station}
+%          \rdg[wit=pjB, alt=bookstore]{bookstore}}
+%        on 42nd Street}
+%      \rdg[wit=pjC, alt={John on Broadway}]{John on Broadway}}.
+%   \end{specimen}
+% \end{alignment}
+% 
+% \begin{remarks}
+% \item[\textsc{Rem.}] Two \cs{app} commands naturally insert two
+%   entries in the apparatus criticus. As the subvariation comes
+%   first, what ms.\ C reads is only mentioned in the subsequent
+%   entry.
+% \end{remarks}
+% 
+% \texttt{TEI xml} output:---
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{xml}
+<p>As I was walking home through Times Square, I saw my
+friend 
+<app>
+  <lem wit="#A #B">Peter at the 
+  <app>
+    <lem wit="#A">station</lem>
+    <rdg wit="#B">bookstore</rdg>
+  </app>on 42nd Street</lem>
+  <rdg wit="#C">John on Broadway</rdg>
+</app>.</p>
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% \subsubsection{Explicit Grouping}
+% \label{sec:explicit-grouping}
+% \DescribeMacro{\rdgGrp} \cs{rdgGrp}\oarg{options}\marg{lemma text
+% \textbar\ readings}\newfeature[v1.1]\\
+% Explicit grouping of readings can be achieved by means of the
+% \cs{rdgGrp} command. It takes as mandatory argument the commands
+% used for inserting lemma texts, readings and notes that are
+% described \vpagerefrange{ref:lemmata}{ref:notes-e}, viz.\ \cs{lem},
+% \cs{rdg} and \cs{note}. \cs{rdgGrp} accepts one further optional
+% argument:---\\
+% \DescribeOption{type} |type|$=$\meta{value}\\
+% This named argument is used in the \texttt{TEI xml} output to
+% define an attribute common to all elements representing the
+% variation.
+%
+% Here follows how the technique of explicit grouping would apply to
+% the same passage as above:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{latex}
+As I was walking home through Times Square, I saw my friend
+\app{
+  \rdgGrp[type=subvariation]{
+    \lem[wit=A, alt={Peter\---Street}]{Peter at the station
+      on 42nd Street}
+    \rdg[wit=B, alt={bookstore \emph{pro} station}]{Peter at the
+      bookstore on 42nd Street}
+  }
+  \rdg[wit=C]{John on Broadway}
+}.
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+% 
+% PDF output:---
+% \medskip
+% 
+% \needspace{7\baselineskip}
+% \resetlinenumber
+% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
+%   \begin{specimen}
+% As I was walking home through Times Square, I saw my friend
+% \app{
+%   \rdgGrp[type=subvariation]{
+%     \lem[wit=pjA, alt={Peter\---Street}]{Peter at the station
+%       on 42nd Street}
+%     \rdg[wit=pjB, alt={bookstore \emph{pro} station}]{Peter at the
+%       bookstore on 42nd Street}
+%   }
+%   \rdg[wit=pjC]{John on Broadway}
+% }.
+%   \end{specimen}
+% \end{alignment}
+% 
+% \begin{remarks}
+% \item[\textsc{Rem.}] In this example, the subvariation is emphasized
+%   with a Latin technical term and may be expressed in one single
+%   entry in a more economical manner.
+% \end{remarks}
+% 
+% \texttt{TEI xml} output:---
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{xml}
+<p>As I was walking home through Times Square, I saw my
+friend 
+<app>
+  <rdgGrp type="subvariation">
+    <lem wit="#A">Peter at the station on 42nd
+    Street</lem>
+    <rdg wit="#B">Peter at the bookstore on 42nd
+    Street</rdg>
+  </rdgGrp>
+  <rdg wit="#C">John on Broadway</rdg>
+</app>.</p>
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% \section{Emendations and Conjectures}
+% \label{sec:emendations-conjectures}
+% From a technical standpoint, \enquote{conjectures} are readings that
+% are not supported by manuscript evidence, but are instead proposed
+% by scholars to be taken into consideration for establishing the
+% edition text. A conjecture is called an \enquote{emendation} if it
+% is adopted in place of what is provided by or missing from the text
+% provided by the manuscripts. Emendations and conjectures are
+% therefore readings and as such expected to be found within |<lem>|
+% or |<rdg>| elements. However, as both come from editions or
+% scholars, not from manuscripts, they are naturally associated with
+% |source| or |resp| attributes as described above
+% \vpagerefrange{ref:lem-source}{ref:lem-resp},\footnote{See also
+% \vpagerefrange{ref:declare-source}{ref:declare-scholar}.} and can be
+% distinguished from one another by the |type| attribute, eg.\ either
+% |emendation| or |conjecture|.
+%
+% As an example, the representation of witnesses, editors and
+% shorthands of Hippocrates' \emph{Epidemics}, Book~2 could be
+% summarized as follows:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}{latex}
+% Witnesses:
+\DeclareWitness{V}{V}{\emph{Vaticanus Gr.} 276}
+\DeclareWitness{I}{I}{\emph{Parisinus Gr.} 2140}
+\DeclareHand{Iac}{I}{I\textsuperscript{ac}}[Lectio ante correctionem]
+\DeclareHand{Ipc}{I}{I\textsuperscript{pc}}[Lectio post correctionem]
+\DeclareWitness{R}{R}{\emph{Vaticanus Gr.} 277}
+\DeclareWitness{H}{H}{\emph{Parisinus Gr.} 2142}
+% Sources (the first arguments below must refer to biblatex labels and
+% an xml bibliographical database must be supplied):
+\DeclareSource{Lit}{Littré}
+\DeclareSource{Erm}{Ermerins}
+\DeclareSource{Sm}{Smith}
+% Persons:
+\DeclareScholar{ego}{ego}[
+                forename=Robert,
+                surname=Alessi]
+% Useful shorthands:
+\DeclareShorthand{codd}{codd.}{V,I,R,H}
+\DeclareShorthand{edd}{edd.}{Lit,Erm,Sm}
+\DeclareShorthand{egoscr}{\emph{scripsi}}{ego}
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% As can be seen from lines~18--20, three useful shorthands have been
+% defined: |codd| prints \enquote{codd.} for Latin pl.\ \emph{codices}
+% viz.\ \enquote{all manuscripts} and refers to the three \texttt{xml}
+% identifiers |V|, |I|, |R| and |H| declared at ll.~2--3 and 6--7;
+% |edd| prints \enquote{edd.} for Latin pl.\ \emph{editores} viz.\
+% \enquote{all editors} and refers to the three \texttt{xml}
+% identifiers |Lit|, |Erm| and |Sm| declared at
+% ll.~10--12;\footnote{For detailed information on how to use
+% \cs{DeclareSource} and insert references to cited works, the reader
+% is invited to refer to \vref{sec:references-cited-works}.} finally,
+% |egoscr| (l.~20) is used to print the technical Latin term
+% \enquote{\emph{scripsi}}, \enquote{I wrote}, to denote a personal
+% conjecture. Then, the |.tex| source file can be structured as
+% follows:---
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}{latex}
+\begin{ekdosis}
+  καὶ ἐγίνετο μᾶλλον \app{
+    \lem[wit={V, Ipc,R,H}]{νότῳ}
+    \rdg[wit=Iac]{νότου}
+    \rdg[source=Erm, type=conjecture]{ἐν νώτῳ}}· [...] % conjecture
+  
+  εἰ
+  \app{
+    \lem[resp=egoscr, type=emendation]{μὲν} % emendation
+    \rdg[wit=codd, source=edd]{μὴ}
+  } εἴη διὰ ταῦτα [...]
+\end{ekdosis}
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+% 
+% \begin{remarks}
+% \item Line~5 introduces a \emph{conjecture} which has been annotated
+%   with |type=conjecture| to facilitate its identification. Other
+%   optional arguments could have been used, such as
+%   |prewit=|\texttt{coni.} or |prewit=|\texttt{falso coni.}, to print
+%   explanatory words in the apparatus criticus before the abridged
+%   name of the scholar.
+% \item \label{it:egomute}Conversely, line~9 introduces an
+%   \emph{emendation} for which the shorthand |egoscr| has been used
+%   to print the exact term \emph{scripsi} in the apparatus criticus
+%   while keeping |ego| as an |xml:id| for the \texttt{TEI xml} output
+%   file. Other strategies could have been used. For example, one
+%   could have defined a specific shorthand to print nothing in place
+%   of |ego| and leave the insertion of technical terms to the |post|
+%   optional argument of \cs{lem}, like so:---
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{latex}
+% Preamble:
+% (\unskip is for removing the space left by the empty 2nd argument
+% below.)
+\DeclareShorthand{egomute}{\unskip}{ego}
+
+% Document:
+  \app{
+    \lem[resp=egomute, post=\emph{scripsi}, type=emendation]{μὲν}
+    \rdg[wit=codd, source=edd]{μὴ}
+  } εἴη διὰ ταῦτα [...]
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+% \end{remarks}
+% 
+% PDF output:---
+% \medskip
+%
+% \needspace{7\baselineskip}
+% \resetlinenumber
+% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
+%   \begin{specimen}
+%     \begin{ancientgreek}
+%       καὶ ἐγίνετο μᾶλλον \app{
+%       \lem[wit={hV, hIpc,hR,hH}]{νότῳ}
+%       \rdg[wit=hIac]{νότου}
+%       \rdg[source=Erm, type=conjecture]{ἐν νώτῳ}}· [...]
+%
+%       εἰ \app{
+%       \lem[resp=hegoscr, type=emendation]{μὲν}
+%       \rdg[wit=hcodd, source=hedd]{μὴ}
+%     } εἴη διὰ ταῦτα [...]
+%     \end{ancientgreek}
+%   \end{specimen}
+% \end{alignment}
+%
+% \texttt{TEI xml} output:---
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{xml}
+<p xml:lang="grc">καὶ ἐγίνετο μᾶλλον 
+<app>
+  <lem wit="#V #Ipc #R #H">νότῳ</lem>
+  <rdg wit="#Iac">νότου</rdg>
+  <rdg source="#Erm" type="conjecture">ἐν νώτῳ</rdg>
+</app>· [...]</p>
+<p>εἰ 
+<app>
+  <lem resp="#ego" type="emendation">μὲν</lem>
+  <rdg wit="#V #I #R #H" source="#Lit #Erm #Sm">
+  μὴ</rdg>
+</app>εἴη διὰ ταῦτα [...]</p>
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% \subsection{Editorial Addition and Deletion}
+% \label{sec:editorial-add-del}
+% \pkg{ekdosis} provides a set of commands to indicate that text has
+% been supplied or removed by conjecture. As regards critical
+% symbols conventionally used for representing emendations, lacunae,
+% omissions, gaps, editorial deletions or additions and the like,
+% \pkg{ekdosis} follows the standards as described by
+% \textcite[80--82]{West1973}:---
+% \begin{description}[font=\ttfamily]
+% \item[<>] text added by conjecture or from a parallel source.
+% \item[***] lacuna in the whole textual tradition.
+% \item[<***>] conjectured lacuna.
+% \item[\{\}] editorial deletion.
+% \item[\dag\dag] text judged by the editor to be corrupt. Note that if
+% only one word is suspect, only one crux is needed. 
+% \end{description}
+%
+% \DescribeMacro{\SetCritSymbols}\newfeature[v1.1]
+% \cs{SetCritSymbols}\marg{csv list of options} can be used to change
+% the critical symbols described above. This command accepts the
+% following list of |key-value|
+% optional arguments:---\\
+% \DescribeOption{suppbegin}|suppbegin|$=$\meta{symbol}
+% \hfill\tcboxverb{Default: <}\\
+% The opening symbol used to mark the text that is supplied.\\
+% \DescribeOption{suppend}|suppend|$=$\meta{symbol}
+% \hfill\tcboxverb{Default: >}\\
+% The closing symbol used to mark the text that is supplied.\\
+% \DescribeOption{delbegin}|delbegin|$=$\meta{symbol}
+% \hfill\tcboxverb|Default: {|\\
+% The opening symbol used to mark the text that is deleted.\\
+% \DescribeOption{delend}|delend|$=$\meta{symbol}
+% \hfill\tcboxverb|Default: }|\\
+% The closing symbol used to mark the text that is deleted.\\
+% \DescribeOption{sicbegin}|sicbegin|$=$\meta{symbol}
+% \hfill\tcboxverb{Default: †}\\
+% The opening symbol used to mark the text that is deemed to be
+% suspect.\\
+% \DescribeOption{sicend}|sicend|$=$\meta{symbol}
+% \hfill\tcboxverb{Default: †}\\
+% The closing symbol used to mark the text that is deemed to be
+% suspect.\\
+% \DescribeOption{gapmark}|gapmark|$=$\meta{symbols}
+% \hfill\tcboxverb{Default: ***}\\
+% The symbols used to mark lacunae.\\
+%
+% As an example, what follows sets |[]| for deletions and |...| for
+% lacunae:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{latex}
+\SetCritSymbols{
+  delbegin = [,
+  delend = ],
+  gapmark = \dots
+}
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% \danger If modified, brackets can be adapted to languages that are
+% written from right to left. To that effect, \pkg{ekdosis} provides a
+% boolean expression |al at rlmode| which is evaluated as |true| if the
+% writing direction is set from right to left and as |false|
+% otherwise. As the \pkg{etoolbox} package is loaded by \pkg{ekdosis},
+% \cs{ifboolean}|{al at rlmode}|\marg{rtl symbol}\marg{ltr symbol} can be
+% used to perform the test.
+%
+% \paragraph{Editorial Addition}
+% \DescribeMacro{\supplied}\newfeature[v1.1]\cs{supplied}\marg{text}
+% is used to mark \meta{text} that is by definition missing from the
+% tradition as supplied by the editor or some other scholar. This
+% command is normally expected in \cs{lem}|{}| or \cs{rdg}|{}|.
+%
+% \paragraph{Editorial Deletion}
+% \DescribeMacro{\surplus}\newfeature[v1.1] \cs{surplus}\marg{text}
+% is used to mark \meta{text} that is deemed to be inauthentic, but
+% nevertheless retained between braces in the edition text as it is
+% transmitted by all witnesses. This command is normally expected in
+% \cs{lem}|{}| or \cs{rdg}|{}|.
+%
+% \paragraph{Crux}
+% \DescribeMacro{\sic}\newfeature[v1.1] \cs{sic}\marg{text} takes as
+% mandatory argument the text deemed by the editor to be readable but
+% not understandable. \cs{sic} inserts \meta{text} between cruces
+% while \cs{sic*} prints only one crux before \meta{text}.
+%
+% \paragraph{Lacuna}
+% \DescribeMacro{\gap}\newfeature[v1.1] \cs{gap}\marg{csv list of
+% options} indicates that some amount of text has fallen away from the
+% entire tradition. It takes as mandatory argument a comma-separated
+% list of options that can be used to further specify the reason for
+% omission, the unit of measurement, the quantity or the extent, as
+% follows:---\\
+% \DescribeOption{reason}|reason|$=$\meta{reason}\\
+% |reason| gives the reason for omission.\\
+% \DescribeOption{unit} |unit|$=$\meta{unit}\\
+% |unit| provides some regularized measurement, such as |character|,
+% |word|, |line| and the like.
+% \DescribeOption{quantity} |quantity|$=$\meta{n}\\
+% |quantity| specifies the number of the given unit that comprise the
+% measurement.\\
+% \DescribeOption{extent} |extent|$=$\meta{description}\\
+% |extent| describes the size, including quantity and unit in a single
+% string of words.
+%
+% \paragraph{Conjectured Lacuna}
+% Assumably, the conjectured lacuna should be enclosed by
+% \cs{supplied} and as such contained by \cs{lem} with
+% |type=emendation| to indicate that the lacuna has been accepted by
+% the editor.
+%
+% Examples follow:\footnote{On the use of \texttt{egomute} (l.~2), see
+% above \vref{it:egomute}.}---
+%
+% \captof{Emendations, conjectures and
+% corrections}[\label{lst:emend-coni-corr}]
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}{latex}
+% Preamble:
+\DeclareShorthand{egomute}{\unskip}{ego}
+
+% Document:
+\begin{ekdosis}
+  σχεδὸν \app{
+    \lem[resp=egomute, nosep, post={post σχεδὸν quattuor uerba
+      excidisse uid.}, type=emendation]{\supplied{\gap{reason=lost,
+          unit=word, quantity=4}}}
+  } οὗτοι
+
+  subsidiis magnis \sic*{epicuri} constabilitas
+
+  declinare quis est qui \sic{possit cernere sese}.
+
+  \app{
+    \lem[resp=egomute, type=emendation, nosep, post={ante
+      ὑπογίν.}]{\surplus{καὶ}}
+    \note{deleui e Gal.P}
+  } ὑπογίνονται
+
+  Πάντων δὲ \app{
+    \lem[resp=egomute, type=emendation, nosep]{\supplied{τῶν πυρετῶν}}
+    \note[post=\ekdsep]{addidi (\arb{^gamI`a 'l-.hummayAti}
+      \getsiglum{Gal})}
+    \rdg[nordg, source=Gal]{\arb{^gamI`a 'l-.hummayAti}}
+    \rdg[wit=codd, source=edd, alt=om.]{}
+  },
+\end{ekdosis}
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+% 
+% PDF output:---
+% \medskip
+% 
+% \needspace{7\baselineskip}
+% \resetlinenumber
+% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
+%   \begin{specimen}
+%  σχεδὸν \app{
+%    \lem[resp=egomute, nosep, post={post σχεδὸν quattuor uerba
+%      excidisse uid.}, type=emendation]{\supplied{\gap{reason=lost,
+%          unit=word, quantity=4}}}
+%  } οὗτοι
+%
+%  subsidiis magnis \sic*{epicuri} constabilitas
+%
+%  declinare quis est qui \sic{possit cernere sese}.
+%
+%  \app{
+%    \lem[resp=egomute, type=emendation, nosep, post={ante
+%      ὑπογίν.}]{\surplus{καὶ}}
+%    \note{deleui e Gal.P}
+%  } ὑπογίνονται
+%
+%
+%  Πάντων δὲ \app{
+%    \lem[resp=egomute, type=emendation, nosep]{\supplied{τῶν πυρετῶν}}
+%    \note[post=\ekdsep]{addidi (\arb{^gamI`a 'l-.hummayAti}
+%      \getsiglum{Gal})}
+%    \rdg[nordg, source=Gal]{\arb{^gamI`a 'l-.hummayAti}}
+%    \rdg[wit=hcodd, source=hedd, alt=om.]{}
+%  },
+%   \end{specimen}
+% \end{alignment}
+%
+% \texttt{TEI xml} output:---
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{xml}
+<p>σχεδὸν 
+<app>
+  <lem resp="#ego" type="emendation">
+    <supplied>
+      <gap reason="lost" unit="word" quantity="4" />
+    </supplied>
+  </lem>
+</app>οὗτοι</p>
+<p>subsidiis magnis 
+<sic>epicuri</sic> constabilitas</p>
+<p>declinare quis est qui 
+<sic>possit cernere sese</sic>.</p>
+<p>
+<app>
+  <lem resp="#ego" type="emendation">
+    <surplus>καὶ</surplus>
+  </lem>
+  <note>deleui e Gal.P</note>
+</app>ὑπογίνονται</p>
+<p>Πάντων δὲ 
+<app>
+  <lem resp="#ego" type="emendation">
+    <supplied>τῶν πυρετῶν</supplied>
+  </lem>
+  <note>addidi (
+  <foreign xml:lang="ar-Latn" type="transliterated"
+  subtype="arabtex">^gamI`a 'l-.hummayAti</foreign>
+  <ref target="#Gal">Gal.</ref>)</note>
+  <rdg source="#Gal">
+    <foreign xml:lang="ar-Latn" type="transliterated"
+    subtype="arabtex">^gamI`a 'l-.hummayAti</foreign>
+  </rdg>
+  <rdg wit="#V #I #R #H" source="#Lit #Erm #Sm" />
+</app>,</p>
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
 % \section{Alignment of Parallel Texts}
 % \label{sec:alignment-basic}
 % As already said above,\footnote{See point
@@ -1578,7 +2345,7 @@
 % accompanied by a translation into a modern language on the facing
 % page. One can also imagine an edition of two classical texts or two
 % different recensions of the same text, each of which provides
-% variants recorded in separate apparatus crititus, laid out on the
+% variants recorded in separate apparatus criticus, laid out on the
 % left-hand pages, with one or more translations on the corresponding
 % right-hand pages, and so forth.
 %
@@ -1645,10 +2412,12 @@
 % manuscripts and manuscript families above
 % \vpageref{ref:caesar-bg-sigla}. As this document is not set for
 % duplex printing, both texts have been put together on the same
-% page. However, the reader will find the full |.tex| source file
-% in \vref{sec:caesar-gw-tex} and \texttt{TEI xml} output in
+% page. However, the reader will find the full |.tex| source file in
+% \vref{sec:caesar-gw-tex} and \texttt{TEI xml} output in
 % \vref{sec:caesar-gw-tei}. The corresponding PDF output is available
-% in \href{samples/Caesar_BG-6-13-1.pdf}{a separate file}:---
+% in \href{samples/Caesar_BG-6-13-1.pdf}{a separate file}:\footnote{On
+% the use of \cs{ekddiv} (ll.~3 and 20), see below
+% \vref{sec:ekddiv}.}---
 %
 % \captof{Caesar's \emph{Gallic War}, VI, 13.1}[\label{lst:caesar-bg}]
 % \iffalse
@@ -1686,6 +2455,7 @@
 %</example>
 % \fi
 %
+% \needspace{7\baselineskip}
 % \resetlinenumber
 % \FormatDiv{2}{}{.}
 % \begin{alignment}[flush,lcols=2,
@@ -1820,11 +2590,10 @@
 %   \item[\dbend] The colon at the end of line~3 closes the whole
 %     value of |text| and acts as a higher level separator.
 %   \end{enumerate}
-% \item Each name may be followed by a \enquote*{suboptional} argument
-%   between square brackets which will then be used to insert
-%   \texttt{TEI xml} attributes in the corresponding |<div>|
-%   element. For example,
-% \iffalse
+% \item \label{it:lang-subopt} Each name may be followed by a
+%   \enquote*{suboptional} argument between square brackets which will
+%   then be used to insert \texttt{TEI xml} attributes in the
+%   corresponding |<div>| element. For example, \iffalse
 %<*example>
 % \fi
 \begin{minted}[escapeinside=++]{latex}
@@ -1959,12 +2728,11 @@
 % \label{sec:alignment-hooks}
 % \DescribeMacro{\AtBeginEnvironment} Once environments corresponding
 % to texts to be aligned have been defined, it is advisable to use the
-% \cs{AtBeginEnvironment}\marg{environment}\marg{code} command that is
-% provided by the \pkg{etoolbox} package\footnote{This package is
-% loaded by \pkg{ekdosis}.} to further adjust languages, hyphenation
-% rules, and/or fonts to be applied in each environment. To return to
-% the example provided above, once \cs{SetAlignment} has been
-% used, the languages can be set as follows:---
+% \cs{AtBeginEnvironment}\marg{environment}\marg{code} command to
+% further adjust languages, hyphenation rules, and/or fonts to be
+% applied in each environment. To return to the example provided
+% above, once \cs{SetAlignment} has been used, the languages can be
+% set as follows:---
 % 
 % \iffalse
 %<*example>
@@ -1978,7 +2746,135 @@
 %</example>
 % \fi
 %
-% \section{Laying Out the Apparatus Criticus }
+% \subsection{Laying Out Parallel Texts}
+% \label{sec:laying-out-parallel}
+% As \pkg{ekdosis} uses the \pkg{paracol} package for the layout of
+% parallel texts, most of the commands provided by this package
+% apply. In this respect, quite useful are the commands described in
+% sections 7.3 to 7.6 on pp.~15--21 of the documentation of this
+% package.\footcite{paracol}
+%
+% \danger It must be noted that all these commands are to be inserted
+% \emph{before} the \env{alignment} environments on which they are
+% supposed to operate.
+%
+% \subsubsection{Columns and Gutters}
+% \label{sec:columns-gutters}
+% 
+% \paragraph{Column Ratio on Single Pages}
+% \DescribeMacro{\columnratio}
+% \cs{columnratio}\marg{r\textsubscript{1}, r\textsubscript{2}, \dots\
+% , r\textsubscript{n}}, where \emph{r\textsubscript{1}} refers to the
+% leftmost column, can be used to set the ratio of the columns in
+% relation to each other.  Depending on the total number of columns on
+% which one wishes to operate, a comma-separated list of decimal
+% numbers is expected. As an example, \cs{columnratio}|{0.6}| will
+% instruct \pkg{ekdosis} to have the first column spread over 60~\% of
+% the total width of the text block, minus the total width of
+% intercolumnar gutters.
+%
+% \paragraph{Column Ratio on Facing Pages}
+% \cs{columnratio} accepts an optional argument which can be used as
+% described above to set the ratio of columns to be printed on
+% right-hand pages, like so: \cs{columnratio}\marg{r\textsubscript{1},
+% r\textsubscript{2}, \dots\ ,
+% r\textsubscript{n}}\oarg{r\textsubscript{1}, r\textsubscript{2},
+% \dots\ , r\textsubscript{n}}.
+%
+% \paragraph{Column Width on Single Pages}
+% \DescribeMacro{\setcolumnwidth}
+% \cs{setcolumnwidth}\marg{w\textsubscript{1}, w\textsubscript{2},
+% \dots\ , w\textsubscript{n}} operates the same way as
+% \cs{columnratio} described above, except that dimensions are
+% expected instead of ratios. As an example,
+% \cs{setcolumnwidth}|{1in}| will have the width of the first column
+% set to \unit[1]{in}.
+%
+% \paragraph{Gutter Width}
+% Each value accepted by \cs{setcolumnwidth} can be expressed as a
+% pair as in
+% \cs{setcolumnwidth}\marg{w\textsubscript{1}/g\textsubscript{1},
+% w\textsubscript{2}/g\textsubscript{2}, \dots\ ,
+% w\textsubscript{n}/g\textsubscript{n}} where the character |/| acts
+% as a separator, in which case \emph{g\textsubscript{x}} is used to
+% set the width of the gutter that follows the
+% \emph{x}\textsuperscript{th} column. As an example,
+% \cs{setcolumnwidth}|{1in/0.25in}| will print a
+% \unit[1]{in} first column, followed by a \unit[0.25]{in} gutter.
+%
+% \paragraph{Automatically Computed Values}
+% Widths of columns and widths of gutters can be replaced with
+% \cs{fill} and \cs{columnsep} respectively. As an example,
+% \cs{setcolumnwidth}|{\fill/0.25|\allowbreak|in}| will only operate
+% on the width that follows the first column, all remaining values
+% being computed automatically.
+%
+% \paragraph{Column and Gutter Width on Facing Pages}
+% Just like \cs{columnratio}, \cs{setcolumnwidth} accepts an optional
+% argument which can be used to set the width of columns and gutters
+% to be printed on right-hand pages, like so:
+% \cs{setcolumnwidth}\marg{w\textsubscript{1}, w\textsubscript{2},
+% \dots\ , w\textsubscript{n}}\oarg{w\textsubscript{1},
+% w\textsubscript{2}, \dots\ , w\textsubscript{n}} for columns only,
+% and \cs{setcolumnwidth}\marg{w\textsubscript{1}/g\textsubscript{1},
+% w\textsubscript{2}/g\textsubscript{2}, \dots\ ,
+% w\textsubscript{n}/g\textsubscript{n}}%
+% \oarg{w\textsubscript{1}/g\textsubscript{1},
+% w\textsubscript{2}/g\textsubscript{2}, \dots\ ,
+% w\textsubscript{n}/g\textsubscript{n}} for columns and gutters.
+%
+% \paragraph{Vertical Rules}
+% Vertical rules between columns can be drawn by setting the length of
+% the \LaTeX\ \cs{columnseprule} register to a non-zero value, like
+% so:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{latex}
+\setlength{\columnseprule}{0.4pt}
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% \subsubsection{Marginal Notes}
+% \label{sec:marginal-notes}
+% By default, marginal notes that refer to the first column are
+% printed in the left margin, while notes that refer to subsequent
+% columns are printed in the right margin.
+%
+% \DescribeMacro{\marginparthreshold} \cs{marginparthreshold}\marg{n},
+% where \emph{n} is an integer, can be used to change the default
+% settings. This command instructs \pkg{ekdosis} that columns of text,
+% up to the \emph{n}\textsuperscript{th} column included, shall have
+% their marginal notes printed to the left. As a result, to take an
+% example, \cs{marginparthreshold}|{0}| will have all marginal notes
+% printed in the right margin. \cs{marginparthreshold} also accepts an
+% optional argument, namely
+% \cs{marginparthreshold}\allowbreak\marg{n}\oarg{n'}, that can be
+% used to set the threshold for columns printed in right-hand pages.
+%
+% \subsubsection{Regular Footnotes}
+% \label{sec:regular-footnotes}
+% \DescribeMacro{\footnotelayout} By default, regular footnotes are
+% printed at the bottom of the column on which they are
+% called. \cs{footnotelayout}\marg{key-letter} can be used to change
+% this setting. This command accepts as mandatory argument a
+% key-letter which can be either |c|, |p| or |m|. |c| means
+% \emph{column-wise} footnotes, which is the default value. |p| means
+% \emph{page-wise}: footnotes from all columns are gathered in a
+% single spanning block at the bottom of the page. Finally, |m| stands
+% for \emph{merge}, which means that all footnotes that are called on
+% a given page, including notes that are called outside the
+% \env{alignment} environment, are printed in a single spanning block
+% at the bottom of the page.
+%
+% \danger Regular footnotes are printed above the block of critical
+% notes. Places can be interchanged by just loading the \pkg{fnpos}
+% package in the preamble.\footcite{fnpos}
+%
+% \section{Laying Out the Apparatus Criticus}
 % \label{sec:apparatus-layout}
 %
 % \subsection{General Hooks}
@@ -2041,11 +2937,14 @@
 % indentation of one em.
 %
 % \DescribeMacro{\SetEndApparatus}
+% \label{ref:setendapparatus}
 % \cs{SetEndApparatus}\marg{characters} can be used to append
 % \meta{characters} at the end of the apparatus block. By default,
-% nothing is appended. As an example of use, |\SetEndApparatus{.}|
-% will have a period printed at the end of the apparatus as it is
-% customary in some editions.
+% nothing is appended. \label{ref:ending-dot}As an example of use,
+% |\SetEndApparatus{.}| will have a period printed at the end of the
+% apparatus as it is customary in some
+% editions.\footnote{\label{fn:rm-dots}See also below
+% \vpageref{sec:superfluous-dots} on how to remove superfluous dots.}
 %
 % \DescribeMacro{\SetUnitDelimiter}
 % \cs{SetUnitDelimiter}\marg{delimiter} can be used to set the
@@ -2086,7 +2985,8 @@
 % apparatus block.\\
 % \DescribeOption{ehook} |ehook|$=$\meta{characters}
 % \hfill\tcboxverb{Default: empty}\\
-% The characters to be appended at the end of the apparatus block.\\
+% The characters to be appended at the end of the apparatus
+% block.\footnote{See also n.~\vref{fn:rm-dots}.}\\
 % \DescribeOption{rule} |rule|$=$\meta{command}\verb+|+|none|
 % \hfill\tcboxverb{Default: \rule{0.4\columnwidth}{0.4pt}}\\
 % As described above, |rule| is used to draw the separating line
@@ -2145,8 +3045,8 @@
 % preamble, this |default| layer must be included in the list of
 % declared layers.\\
 % \DescribeMacro{\SetDefaultApparatus}\label{ref:ekd-default-app}
-% \cs{SetDefaultApparatus}\marg{name} can be used at any point of
-% the document to change the default name that is used by
+% \cs{SetDefaultApparatus}\marg{name} can be used at any point of the
+% document to change the name to be used as the default one by
 % \pkg{ekdosis}.
 %
 % \subsubsection{Declaring Additional Layers}
@@ -2189,7 +3089,7 @@
 % \DescribeOption{ehook}
 % \DescribeOption{rule}
 % \DescribeOption{norule}
-% With regard to layout, any declared layer inherits the defaut values
+% 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
 % |key-value| options as \cs{SetApparatus} described
@@ -2322,9 +3222,9 @@
 %</example>
 % \fi
 %
-% At any rate, |type=default| or |type=rec1|, depending on what has
-% been chosen, must be used if the editor wishes to retain that
-% information in the \texttt{TEI xml} output file.
+% \danger At any rate, |type=default| or |type=rec1|, depending on
+% what has been chosen, must be used if the editor wishes to retain
+% that information in the \texttt{TEI xml} output file.
 %
 % \subsection{Other Notes for Comments, Sources or Testimonia}
 % \label{ref:type-note}
@@ -2406,12 +3306,12 @@
   Asia; a language, copious, elastic, inviting self-explaining
   combinations and independent development; lending itself alike to
   daily life and imagination, to description and abstract thought.
-  \note[type=fontium, labelb=61e, labele=62a, lem={They
+  \note[type=fontium, labelb=B61e, labele=B62a, lem={They
     had... slave}]{Waitz, \emph{Deutsche Verfassungs Geschichte},
     i. 86} They had a class of nobles, but their tongue knew no word
-  for slave.\linelabel{62a}\footnote{George Bancroft, \emph{History of
-      the United States from the Discovery of the American Continent},
-    II.61--2.}
+  for slave.\linelabel{B62a}\footnote{George Bancroft, \emph{History
+      of the United States from the Discovery of the American
+      Continent}, II.61--2.}
 \end{ekdosis}
 \end{minted}
 % \iffalse
@@ -2418,9 +3318,10 @@
 %</example>
 % \fi
 %
-% \needspace{5\baselineskip}
 % PDF output:---
 % \medskip
+% 
+% \needspace{7\baselineskip}
 % \resetlinenumber
 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
 %   \begin{specimen}
@@ -2430,10 +3331,10 @@
 %     self-explaining combinations and independent development;
 %     lending itself alike to daily life and imagination, to
 %     description and abstract thought.  \note[type=fontium,
-%     labelb=61e, labele=62a, lem={They had... slave}]{Waitz,
+%     labelb=B61e, labele=B62a, lem={They had... slave}]{Waitz,
 %     \emph{Deutsche Verfassungs Geschichte}, i. 86} They had a class
 %     of nobles, but their tongue knew no word for
-%     slave.\linelabel{62a}\footnote{George Bancroft, \emph{History of
+%     slave.\linelabel{B62a}\footnote{George Bancroft, \emph{History of
 %     the United States from the Discovery of the American Continent},
 %     II.61--2.}
 %   \end{specimen}
@@ -2451,11 +3352,11 @@
 inviting self-explaining combinations and independent
 development; lending itself alike to daily life and
 imagination, to description and abstract thought. 
-<note type="fontium" target="#range(right(61e),left(62a))">Waitz, 
+<note type="fontium" target="#range(right(B61e),left(B62a))">Waitz, 
 <emph>Deutsche Verfassungs Geschichte</emph>, i. 86</note>
-<anchor xml:id="61e" />They had a class of nobles, but
+<anchor xml:id="B61e" />They had a class of nobles, but
 their tongue knew no word for slave.
-<anchor xml:id="#62a" />
+<anchor xml:id="B62a" />
 <note place="bottom">George Bancroft, 
 <emph>History of the United States from the Discovery of
 the American Continent</emph>, II.61--2.</note></p>
@@ -2488,9 +3389,10 @@
 %</example>
 % \fi
 %
-% \needspace{5\baselineskip}
 % PDF output:---
 % \medskip
+% 
+% \needspace{7\baselineskip}
 % \resetlinenumber
 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
 %   \begin{specimen}
@@ -2641,7 +3543,7 @@
 % apparatus, as described in \vref{sec:single-layer-app}, can be
 % typeset within the Arabic environment that is provided by
 % \pkg{polyglossia}. Unfortunately, the same cannot be said for
-% multi-layer apparatus.
+% multiple-layer apparatus.
 %
 % Whether \pkg{babel} or \pkg{polyglossia} is used, \pkg{ekdosis}
 % automatically applies the current language to the entries of the
@@ -2650,7 +3552,9 @@
 % \pkg{polyglossia} can use the same language switching commands as
 % \pkg{babel},\footcite[See][3.2 \pno~14]{polyglossia} the general
 % advice given above in \vref{sec:alignment-hooks} applies in all
-% cases.
+% cases. As regards setting languages in the \texttt{TEI xml} output
+% file, the reader is invited to refer to point \vref{it:lang-subopt}
+% and \vref{sec:teixml-output}.
 %
 % \subsection{Languages Written From Right to Left}
 % \label{sec:rtl-languages}
@@ -2808,9 +3712,10 @@
 % \vref{sec:multilayer-apparatus} (multiple-layer apparatus
 % criticus).}
 %
-% \needspace{5\baselineskip}
 % The PDF output with left-to-right apparatus criticus follows:---
 % \medskip
+% 
+% \needspace{7\baselineskip}
 % \resetlinenumber
 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
 %   \begin{specimen}
@@ -2826,7 +3731,10 @@
 % \needspace{5\baselineskip}
 % And here follows the PDF output with right-to-left apparatus
 % criticus:---
-% \medskip \resetlinenumber
+% \medskip
+% 
+% \needspace{7\baselineskip}
+% \resetlinenumber
 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
 %   \begin{specimen}
 %     \begin{arab}[fullvoc]
@@ -2867,7 +3775,7 @@
 % Preamble:
 % load ekdosis and ask for TEI xml output:
 \usepackage[teiexport]{ekdosis}
-% load arabluatex and request a LaTeX ouput with Unicode Arabic:
+% load arabluatex and request a LaTeX output with Unicode Arabic:
 \usepackage[export,fullvoc]{arabluatex}
 
 % document:
@@ -2888,9 +3796,11 @@
 %</example>
 % \fi
 %
-% \needspace{7\baselineskip}
 % The PDF output with left-to-right apparatus criticus is of course
 % the same as above:---
+% \medskip
+% 
+% \needspace{7\baselineskip}
 % \resetlinenumber
 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
 %   \begin{specimen}
@@ -3015,12 +3925,13 @@
 % Variant readings can be inserted in headings. In this case, the
 % optional argument of the \LaTeX\ sectional command must naturally be
 % used to prevent variants from going into headers, footers or the
-% table of contents, like so:---
+% table of contents, like so:\footnote{On the use of \texttt{egomute}
+% (l.~13), see above \vref{it:egomute}.}---
 % 
 % \iffalse
 %<*example>
 % \fi
-\begin{minted}[linenos=false]{latex}
+\begin{minted}{latex}
 % Preamble:
 \usepackage[teiexport=tidy, divs=latex]{ekdosis}
 \MkBodyDivs{chapter}{section}{}{}{}{}
@@ -3031,7 +3942,11 @@
     \lem[wit={I,R,H}]{βιβλίον δεύτερον}
     \rdg[wit=V]{λόγος β’}}}
 
-\section{<Τμῆμα πρῶτον>}
+\section[Τμῆμα πρῶτον]{
+  \app{
+    \lem[resp=egomute, type=emendation, nosep,
+     post=suppleui]{\supplied{Τμῆμα πρῶτον}}
+   }}
 Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]
 \end{minted}
 % \iffalse
@@ -3051,7 +3966,12 @@
     <rdg wit="#V">λόγος β’</rdg>
   </app></head>
   <div2 type="section">
-    <head><Τμῆμα πρῶτον></head>
+    <head>
+      <app>
+        <lem><supplied resp="#ego" type="emendation">Τμῆμα
+         πρῶτον</supplied></lem>
+      </app>
+    </head>
     <p>Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]</p>
   </div2>
 </div1>
@@ -3104,7 +4024,7 @@
 % indicate the depth of the division within the hierarchy, the largest
 % being |1| and the smallest being |9|.\\
 % \DescribeOption{toc}
-% |toc|$=$\verb+|book|part|chapter|section|subsection|subsubsection|paragraph+\\
+% |toc|$=$\verb+book|part|chapter|section|subsection|subsubsection|paragraph|+\\
 % |subparagraph|\hfill\tcboxverb{Default: not set}\\
 % If |toc| be set, the title of the division goes into the table of
 % contents at the hierarchic level that is specified as value.
@@ -3134,7 +4054,7 @@
 % To elaborate on the example provided above in \vref{sec:latex-divs},
 % here follows how the first three hierarchical levels could be
 % formatted as un-numbered divisions:---
-% 
+%
 % \iffalse
 %<*example>
 % \fi
@@ -3157,7 +4077,10 @@
   }
 
   \ekddiv{
-    head={<Τμῆμα πρῶτον>},
+    head={\app{
+        \lem[resp=egomute, post=suppleui,
+        type=emendation]{\supplied{Τμῆμα πρῶτον}}
+        \rdg[wit=codd, alt=om.]{}}},
     type=section,
     depth=2,
     n=II.1
@@ -3171,10 +4094,10 @@
 %</example>
 % \fi
 %
-% \needspace{5\baselineskip}
 % PDF output:---
 % \medskip
 % 
+% \needspace{7\baselineskip}
 % \resetlinenumber
 % \FormatDiv{1}{\begin{center}\Large}{\end{center}}
 % \FormatDiv{2}{\begin{center}\large}{\end{center}}
@@ -3194,7 +4117,15 @@
 %         depth=1,
 %         n=II}
 % 
-%       \ekddiv{head={<Τμῆμα πρῶτον>}, type=section, depth=2, n=II.1}
+%         \ekddiv{
+%         head={\app{
+%           \lem[resp=egomute, post=suppleui,
+%             type=emendation]{\supplied{Τμῆμα πρῶτον}}
+%           \rdg[wit=hcodd, alt=om.]{}}},
+%         type=section,
+%         depth=2,
+%         n=II.1
+%       }
 % 
 %       \ekddiv{head=1, type=paragraph, depth=3, n=II.1.1} Ἄνθρακες
 %       θερινοὶ ἐν Κραννῶνι· [...]
@@ -3215,7 +4146,14 @@
       <rdg wit="#V">λόγος β’</rdg>
     </app></head>
     <div type="section" n="II.1">
-      <head><Τμῆμα πρῶτον></head>
+      <head>
+        <app>
+          <lem resp="#ego" type="emendation">
+            <supplied>Τμῆμα πρῶτον</supplied>
+          </lem>
+          <rdg wit="#V #I #R #H" />
+        </app>
+      </head>
       <div type="paragraph" n="II.1.1">
         <head>1</head>
         <p>Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]</p>
@@ -3237,11 +4175,11 @@
 % the apparatus criticus does not show. Instead, \pkg{ekdosis}
 % produces an auxiliary file named \cs{jobname}|.ekd| in which all the
 % entries of the apparatus criticus are collected. Then, on the second
-% run a test is performed on this auxliary file to determine whether
+% run a test is performed on this auxiliary file to determine whether
 % there are entries\---and if so, which ones\---to be printed on the
 % current page. At the same time, references to the line numbers are
-% updated if necessary. Then, on the third run, the apparatus criticus
-% is printed.
+% updated if necessary. Finally, on the third run, the apparatus
+% criticus is printed.
 %
 % Of course, every change made to the input may similarly require
 % \hologo{LuaLaTeX} to be run three more times to get everything to
@@ -3269,7 +4207,7 @@
 % a good way to get out of the vicious circle. And surely, if only a
 % few pages are at stake, this is the way to go. However,
 % \cs{pagebreak} commands should only be inserted when the whole
-% edition text is ready for any subtantial change in the preceding
+% edition text is ready for any substantial change in the preceding
 % pages may result in pages that break just after they begin.
 %
 % Another way\---should the edition text fall into the vicious circle
@@ -3277,16 +4215,16 @@
 % layer of apparatus criticus may accept as described above
 % \vpageref{ref:maxentries}. As a result, \pkg{ekdosis} will take care
 % of inserting automatic breakpoints between pages whenever the number
-% of entries on a given page reaches the value set as |maxnumber|.
+% of entries on a given page reaches the value set as |maxentries|.
 %
-% |maxnumber| must not be too small: otherwise offensive to look at
+% |maxentries| must not be too small: otherwise offensive to look at
 % vertical spaces may come between the edition text and the apparatus
-% criticus. Conversely, |maxnumber| must not be too big: otherwise,
+% criticus. Conversely, |maxentries| must not be too big: otherwise,
 % should entries overflow on a given page, the edition text and the
-% apparatus criticus may clash. As said above, a couple of clashes can
-% be managed with a couple of manually inserted page breaks. But if
-% there are too many ot them, it is a good indication that the
-% selected value of |maxentries| is too to high.
+% apparatus criticus may clash again. As said above, a couple of
+% clashes can be managed with a couple of manually inserted page
+% breaks. But if there are too many of them, it is a good indication
+% that the selected value of |maxentries| is too to high.
 %
 % Complex edition texts do have a magic number. An advisable way to
 % figure it out would be to start from a sample of only a few pages,
@@ -3294,6 +4232,124 @@
 % pages would need to be compiled, the magic number should emerge
 % quite rapidly.
 %
+% \paragraph{Adding and Removing Entries}
+% \DescribeMacro{\addentries} \cs{addentries}\oarg{layer}\marg{n}
+% \newfeature[v1.1]\\
+% If |maxentries| be set for a given layer of critical notes,
+% \cs{addentries}\oarg{layer}\marg{n}, where \meta{n} is an integer,
+% can be used to add \meta{n} to\---or remove it from if \meta{n} be
+% negative\---the number of accepted entries on the current
+% page. \cs{addentries} operates on the default layer of notes, but
+% any other declared layer can be specified in the optional argument
+% of the command.
+%
+% \danger Of course, \cs{addentries} must be issued before the
+% number of entries on a given page has reached the value set as
+% |maxentries|.
+%
+% Once a sensible value for |maxentries| has been found,
+% \cs{addentries} can further be used with a positive integer to allow
+% for more entries and more lines on some pages so that offending
+% vertical spaces are decreased. Conversely, \cs{addentries} with a
+% negative integer will remove entries on pages where there are too
+% many of them and \pkg{ekdosis} still oscillates between different
+% sets of page decisions.
+%
+% \subsection{Variae Quaestiones}
+% \label{sec:variae-quaestiones}
+% This section is about issues that are not strictly speaking part of
+% the documentation of \pkg{ekdosis} but may nevertheless
+% circumstantially arise.
+%
+% \paragraph{Superfluous Dots}
+% \label{sec:superfluous-dots}
+% As said above \vpageref{ref:ending-dot}, it is customary in some
+% editions to have a full stop printed at the end of the apparatus
+% criticus. \pkg{ekdosis} provides specific commands to achieve this
+% in a straightforward way, such as \cs{SetEndApparatus} and the
+% |ehook| optional argument of \cs{SetApparatus} and
+% \cs{DeclareApparatus}.\footnote{See above
+% \vpagerefrange{ref:setendapparatus}{sec:declaring-layers}.} However,
+% if the last word of the apparatus criticus on a given page be an
+% abbreviation followed by a dot, such a setting will have two dots
+% printed at the end of the apparatus instead of one. The solution is
+% to define a command to have a dot printed only if it is not followed
+% by a dot, and append this command to the abbreviated form of the
+% word, like so:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}{latex}
+% Preamble:
+\usepackage{xspace}
+\usepackage{ekdosis}
+
+\makeatletter
+\newcommand{\ekddot}{%
+  \ltx at ifnextchar{.}{\xspace}{.\xspace}}
+\makeatother
+
+\DeclareApparatus{default}[ehook=.]
+\DeclareScholar{Erm}{Erm\ekddot}
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% \begin{remarks}
+% \item Line~2: The \pkg{xspace} package is needed for \cs{xspace} is
+%   used by the \cs{ekddot} command that is defined at l.~6.
+% \item Line~7: \cs{ltx at ifnextchar} is part of the \pkg{ltxcmds}
+%   package which is loaded by \pkg{ekdosis}. As this command uses a
+%   private control sequence, it must be found within
+%   \cs{makeatletter} \dots\ \cs{makeatother}.
+% \item Line~10: \cs{ekddot} will only work with multiple-layer
+%   apparatus criticus. Therefore, \cs{DeclareAppa{\allowbreak}ratus}
+%   must be used even if only one layer of critical notes is needed.
+% \end{remarks}
+%
+% \paragraph{Backup of Essential Files}
+% Each time the |.tex| source file is compiled, \pkg{ekdosis} reads
+% the |.aux| corresponding \LaTeX\ auxiliary file and its own |.ekd|
+% auxiliary file so as to process labels and collect entries of the
+% apparatus criticus. If for whatever reason\---e.g.\ some unknown
+% command has been inserted\---the compilation freezes and so must be
+% aborted, it may happen that most of the edition text has to be
+% reconstructed page after page. For large and complex editions, this
+% makes advisable to have current versions of those files backed up
+% each time a new compilation begins, which can be achieved by
+% inserting the following lines before the line that loads the
+% document class:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{latex}
+\RequirePackage{verbatimcopy}
+\IfFileExists{\jobname.aux}{%
+  \OldVerbatimCopy{\jobname.aux}{\jobname.aux.bak}}{}
+\IfFileExists{\jobname.ekd}{%
+  \OldVerbatimCopy{\jobname.ekd}{\jobname.ekd.bak}}{}
+\documentclass{book}
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% This way, both |.aux| and |.ekd| files can be recovered from
+% |.aux.bak| and |.ekd.bak| just after the compilation has been
+% aborted. Should this be needed, one must proceed carefully as
+% follows:---
+% \begin{enumerate}
+% \item Just after the compilation has been aborted, move both
+%   |aux.bak| and |ekd.bak| files to a safe place.
+% \item Remove or correct the offending command or lines that broke
+%   the compilation and make sure that the issue is solved.
+% \item Restore the |.aux| and |.ekd| files from |aux.bak| and
+% |.ekd.bak| and resume work where it was left off.
+% \end{enumerate}
+%
 % \section{\texttt{TEI xml} Output}
 % \label{sec:teixml-output}
 % Several examples of \texttt{TEI xml} output have been provided
@@ -3311,10 +4367,10 @@
 % language (Latin, English and French) is to be found in two different
 % places, namely for \texttt{TEI xml} output (ll.~21--3) and for PDF
 % output through \LaTeX\ (ll.~27--9). Finally, it provides examples of
-% declaring witnesses, hands, scholars and shorthands (ll.~31--60). As
-% to the document itself, it shows how to lay out a conspectus
-% siglorum in a table (ll.~64--80), before giving detailed examples of
-% how the edition text is entered (ll.~85--101) and sectional commands
+% declaring witnesses, hands and shorthands (ll.~31--60). As to the
+% document itself, it shows how to lay out a conspectus siglorum in a
+% table (ll.~64--80), before giving detailed examples of how the
+% edition text is entered (ll.~85--101) and sectional commands
 % provided by \pkg{ekdosis} are used (ll.~86, 103 and
 % 110).\footnote{The PDF output is available as
 % \href{samples/Caesar_BG-6-13-1.pdf}{a separate file}.}
@@ -3356,7 +4412,7 @@
 % The \texttt{TEI} validator is here:
 % \url{http://teibyexample.com/xquery/TBEvalidator.xq}.} As for
 % \pkg{ekdosis}, it is designed to produce on request, in addition to
-% an edition in print, a \texttt{TEI xml} compliant output file. That
+% an edition in print, a \texttt{TEI xml}-compliant output file. That
 % said, one must keep in mind that the \LaTeX\ packages that are part
 % of {\TeX}Live can be counted in thousands, and the commands they
 % provide in tens of thousands. There may even be grounds in asserting
@@ -3383,7 +4439,7 @@
 % are marked in \LaTeX\ with \enquote{open} commands such as
 % \cs{chapter} or \cs{section} with no clear indication where the
 % closure of divisions occurs, contrary to \texttt{TEI xml} markup
-% with numered or un-numbered |<div>| elements allowed to nest
+% with numbered or un-numbered |<div>| elements allowed to nest
 % recursively. As regards running paragraphs of text, the situation is
 % even worse than in the latter case, as the following simple example
 % shows:---
@@ -3434,29 +4490,6 @@
 % \textsf{Lua} functions which involve string matching (both forward
 % and reverse matching) and recursions.
 %
-% \paragraph{The \texttt{xml:id} Attribute}
-% As a general rule, the |xml:id| global attribute must be unique for
-% the element that bears the attribute. Furthermore, it must begin
-% with a letter or an underscore and contain no characters other that
-% letters, digits, hyphens underscores and full stops. \pkg{ekdosis}
-% issues a warning when it finds that any \meta{unique id} of
-% \meta{unique label} expected in the first argument of
-% \cs{DeclareWitness}, \cs{DeclareHand} or \cs{DeclareScholar} is not
-% unique or breaks the rules just described, but does not prevent the
-% |.tex| source file from compiling. Instead, it prints the string
-% |<??>| in place of the expected formatted siglum so that the error
-% in the |.tex| source file can be easily spotted and corrected.
-%
-% \danger As the \meta{unique id} declared with \cs{DeclareShorthand}
-% is not to be exported in the \texttt{TEI xml} outputfile,
-% \pkg{ekdosis} checks neither its uniqueness nor its validness.
-%
-% \danger It must be noted that \LaTeX\ labels that are provided in
-% commands such as \cs{label}, \cs{cite} and the like must also be
-% unique in the document. As \LaTeX\ will issue warnings if it finds
-% duplicates, \cs{ekdosis} does not check their uniqueness but will
-% issue warnings if such labels contain invalid strings.
-%
 % \paragraph{\texttt{TEI xml} Export Settings}
 % \label{ref:setteixmlexport}
 % \DescribeMacro{\SetTEIxmlExport} \cs{SetTEIxmlExport}\marg{csv list
@@ -3488,6 +4521,30 @@
 % paragraphs within |<p>| elements when |autopar| has been set to
 % |false| by means of \cs{SetTEIxmlExport} described above.
 %
+% \paragraph{The \texttt{xml:id} Attribute}
+% As a general rule, the |xml:id| global attribute must be unique for
+% the element that bears the attribute. Furthermore, it must begin
+% with a letter or an underscore and contain no characters other that
+% letters, digits, hyphens, underscores and full stops. \pkg{ekdosis}
+% issues a warning when it finds that any \meta{unique id} of
+% \meta{unique label} expected in the first argument of
+% \cs{DeclareWitness}, \cs{DeclareHand}, \cs{DeclareSource} or
+% \cs{DeclareScholar} is not unique or breaks the rules just
+% described, but does not prevent the |.tex| source file from
+% compiling. Instead, it prints the string |<??>| in place of the
+% expected formatted siglum so that the error in the |.tex| source
+% file can be easily spotted and corrected.
+%
+% \danger As the \meta{unique id} declared with \cs{DeclareShorthand}
+% is not to be exported in the \texttt{TEI xml} output file,
+% \pkg{ekdosis} checks neither its uniqueness nor its validness.
+%
+% \danger It must be noted that \LaTeX\ labels that are provided in
+% commands such as \cs{label}, \cs{cite} and the like must also be
+% unique in the document. As \LaTeX\ will issue warnings if it finds
+% duplicates, \cs{ekdosis} does not check their uniqueness but will
+% issue warnings if such labels contain invalid strings.
+%
 % \subsection{Routine \LaTeX\ Commands and Environments}
 % \label{sec:routine-cmds}
 % The list of \LaTeX\ commands known by \pkg{ekdosis} at the time of
@@ -3509,6 +4566,7 @@
 %     \cs{textsc}|{}| & |<hi rend="smallcaps"></hi>| \\
 %     \cs{textsf}|{}| & |<hi rend="sf"></hi>| \\
 %     \cs{footnote}|{}| & |<note place="bottom"></note>| \\
+%     \cs{marginpar}|{}| & |<note place="margin"></note>| \\
 %     \cs{enquote}\meta{*}|{}| & |<quote></quote>| \\
 %     \cs{label}|{label}| & |<anchor xml:id="label"/>| \\
 %     \cs{linelabel}|{label}| & |<anchor xml:id="label"/>| \\
@@ -3517,7 +4575,7 @@
 %     \cs{vref}|{label}| & |<ptr ="#label"/>| \\
 %     \cs{vpageref}|{label}| & |<ptr ="#label"/>| \\
 %     \cs{pagebreak}\meta{\oarg{1-4}} & no output \\
-%     \cs{mbox}|{}| & no output \\
+%     \cs{mbox}\marg{text} &  \meta{text} \\
 %     \bottomrule
 % \end{xltabular}
 %
@@ -3610,7 +4668,7 @@
 % \texttt{TEI} element it is to be converted into and any additional
 % \texttt{xml} attributes to be appended to the opening \texttt{TEI}
 % element. For example, the \cs{sidenote} command that is provided by
-% the \cs{sidenotes} package can be processed like so:---
+% the \pkg{sidenotes} package can be processed like so:---
 %
 % \iffalse
 %<*example>
@@ -3650,13 +4708,16 @@
 %
 % Even more subtly, provided that the code |#STC| points to some more
 % information identifying the agency concerned:\footnote{At the time
-% of writing, \enquote*{scholars} can be declared with
-% \cs{DeclareScholar} as described above
-% \vpageref{ref:declare-scholar}. Then the unique ID used in the first
-% argument of this command can point to the list of references
-% inserted by \pkg{ekdosis} in the back matter section of the
-% \texttt{TEI} ouput file. See below \vref{sec:references-cited-works}
-% for more information on how to do this.}---
+% of writing, \enquote*{sources} can be declared with
+% \cs{DeclareSource} as described above
+% \vpageref{ref:declare-source}. Then the unique identifier used in
+% the first argument of this command can point to the list of
+% references inserted by \pkg{ekdosis} in the back matter section of
+% the \texttt{TEI} output file. See below
+% \vref{sec:references-cited-works} for more information on how to do
+% this. Scholars can also be referred to as individuals by means of
+% the \cs{DeclareScholar} command. See above
+% \vpageref{ref:declare-source}.}---
 % 
 % \iffalse
 %<*example>
@@ -3754,8 +4815,8 @@
 %</example>
 % \fi
 %
-% \DescribeMacro{\TeXtoTEIPatt}
-% \cs{TeXtoTEIPatt}\marg{\TeX\ pattern}\marg{TEI pattern}\\
+% \DescribeMacro{\TeXtoTEIPat}
+% \cs{TeXtoTEIPat}\marg{\TeX\ pattern}\marg{TEI pattern}\\
 % Finally, this more flexible\---and more delicate to
 % handle\---command uses pattern matching to instruct \pkg{ekdosis}
 % how to convert \hologo{(La)TeX} commands into \texttt{TEI}
@@ -3780,7 +4841,7 @@
 %<*example>
 % \fi
 \begin{minted}[linenos=false]{latex}
-\TeXtoTEIPatt{\textcolor {#1}{#2}}{<hi rend="#1">#2</hi>}
+\TeXtoTEIPat{\textcolor␣{#1}{#2}}{<hi rend="#1">#2</hi>}
 
 Sample text with a \textcolor{red}{word} in red.
 \end{minted}
@@ -3841,12 +4902,12 @@
 %
 % \begin{remarks}
 % \item Lines~2--3 define a basic environment meant to contain
-% indivivual speeches and a command to hold the name of the
+% individual speeches and a command to hold the name of the
 % speaker. This name is printed in bold face and followed by a new
 % paragraph in the PDF output.
 % \item Line~4 instructs \pkg{ekdosis} to convert \env{speech} \LaTeX\
 %   environments into |<sp>| \texttt{TEI xml} elements.
-% \item Line~6 disables the |autopar| algorithm that \cs{ekdosis}
+% \item Line~6 disables the |autopar| algorithm that \pkg{ekdosis}
 %   provides by default for running paragraphs of text. As a
 %   consequence, \env{ekdpar} is used to mark the paragraphs.
 % \end{remarks}
@@ -3854,6 +4915,7 @@
 % PDF output:---
 % \medskip
 %
+% \needspace{7\baselineskip}
 % \SetTEIxmlExport{autopar=false}
 % \begingroup
 % \newenvironment{speech}{\par\selectlanguage{greek}}{\par}
@@ -3911,18 +4973,19 @@
 % the |<listWit>| element of the \texttt{TEI} header, whereas the
 % latter is to be found within the |<listBibl>| element.
 %
-% \DescribeMacro{\SetxmlBibResource}
-% \cs{SetxmlBibResource}\marg{basename} is a preamble-only command. If
-% a base name for a \texttt{TEI xml} compliant bibliographical
-% database be provided, \pkg{ekdosis} will use it and insert formatted
-% data in the back matter section of its own \texttt{TEI xml} output
-% file, as |<biblStruct>| elements within a |listBibl| section.
+% \DescribeMacro{\AddxmlBibResource}
+% \cs{AddxmlBibResource}\marg{basename or name.xml} is a preamble-only
+% command. If a base name (either suffixed with |.xml| or not) for a
+% \texttt{TEI xml}-compliant bibliographical database be provided,
+% \pkg{ekdosis} will use it and insert formatted data in the back
+% matter section of its own \texttt{TEI xml} output file, as
+% |<biblStruct>| elements within a |listBibl| section.
 %
 % As an example, the following Bib\hologo{(La)TeX} entry and its
-% \texttt{TEI} equivalent follow:\footnote{\label{fn:zotero}To the
-% author's knowledge, \textsf{Zotero} (\url{https://www.zotero.org})
-% provides excellent \texttt{TEI xml} output from Bib\hologo{(La)TeX}
-% input files.}---
+% \texttt{TEI} equivalent are provided:\footnote{\label{fn:zotero}To
+% the author's knowledge, \textsf{Zotero}
+% (\url{https://www.zotero.org}) provides excellent \texttt{TEI xml}
+% output from Bib\hologo{(La)TeX} input files.}---
 %
 % \iffalse
 %<*example>
@@ -3975,7 +5038,7 @@
 % the Bib\hologo{(La)TeX} file (l.~1) and an |xml:id| in the
 % \texttt{TEI} file (l.~3). This same label must be used again in the
 % preamble of the |.tex| source file to declare Arnold Drakenborch as a
-% scholar,\footnote{See above \vpageref{ref:declare-scholar}.} like
+% source,\footnote{See above \vpageref{ref:declare-source}.} like
 % so:---
 %
 % \iffalse
@@ -3983,10 +5046,10 @@
 % \fi
 \begin{minted}{latex}
 % Use 'bibl.xml' as a TEI xml bibliographical database:
-\SetxmlBibResource{bibl} % 'bibl' is the basename of 'bibl.xml'
+\AddxmlBibResource{bibdata.xml}
 
-% Declare A. Drakenborch as scholar:
-\DeclareScholar{Drak}{\emph{Drakenborch}}
+% Declare A. Drakenborch as source:
+\DeclareSource{Drak}{\emph{Drakenborch}}
 \end{minted}
 % \iffalse
 %</example>
@@ -4002,20 +5065,25 @@
 % \fi
 \begin{minted}{latex}
 % Preamble:
+\usepackage[style=oxnotes]{biblatex}
+\addbibresource{bibdata.bib}
+
 \usepackage[teiexport=tidy]{ekdosis}
 
+% basename of the .xml bibliographical database:
+\AddxmlBibResource{bibdata.xml}
+
 % Witnesses:
 \DeclareWitness{L}{L}{Laurentianus, plut, XXXVII, cod. 16}[
                       origDate=s. XV]
 % Other witnesses [...]
 
-% Scholars:
-\DeclareScholar{Drak}{\emph{Drakenborch}}
-% Other scholars [...]
+% Sources:
+\DeclareSource{Drak}{\emph{Drakenborch}}
+% Alternatively, use BibLaTeX for the rendition:
+% \DeclareSource{Drak}{\citename{Drak}{editor}}
+% Other sources [...]
 
-% basename of the .xml bibliographical database:
-\SetxmlBibResource{bibl}
-
 % Document:
 \begin{ekdosis}
   \begin{ekdverse}
@@ -4022,10 +5090,10 @@
     Sed uos, quorum oculos atque ora humentia uidi,\\
     uertere cum consul terga et remeare iuberet,\\
     \app{
-      \lem[wit=Drak]{ne morem}
+      \lem[source=Drak, type=emendation]{ne morem}
       \rdg[wit={L, F}]{me morem}
       \rdg[wit={O, V}]{memorem}
-    } et pugnae signum exspectate petendae:
+    } et pugnae signum exspectate petendae:\\
   \end{ekdverse}
 \end{ekdosis}
 \end{minted}
@@ -4033,22 +5101,22 @@
 %</example>
 % \fi
 %
-% \needspace{7\baselineskip}
 % PDF output:---
 % \medskip
 %
+% \needspace{7\baselineskip}
 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
-% \resetlinenumber[30]\rightlinenumbers
-% \setlength{\linenumbersep}{-1.5in}
+% \setverselinenums{30}{0}
+% \setlength{\vrightskip}{-1.5in}
 %   \begin{specimen}
 %     \begin{ekdverse}
 %       Sed uos, quorum oculos atque ora humentia uidi,\\
 %       uertere cum consul terga et remeare iuberet,\\
 %       \app{
-%         \lem[wit=sDrak]{ne morem}
+%         \lem[source=sDrak, type=emendation]{ne morem}
 %         \rdg[wit={sL, sF}]{me morem}
 %         \rdg[wit={sO, sV}]{memorem}
-%       } et pugnae signum exspectate petendae:
+%       } et pugnae signum exspectate petendae:\\
 %     \end{ekdverse}
 %   \end{specimen}
 % \end{alignment}
@@ -4067,7 +5135,7 @@
       <l>uertere cum consul terga et remeare iuberet,</l>
       <l>
       <app>
-        <lem wit="#Drak">ne morem</lem>
+        <lem source="#Drak" type="emendation">ne morem</lem>
         <rdg wit="#L #F">me morem</rdg>
         <rdg wit="#O #V">memorem</rdg>
       </app>et pugnae signum exspectate petendae:</l>
@@ -4106,18 +5174,18 @@
 % \pkg{ekdosis} can also convert into \texttt{TEI xml} references to
 % cited works. Depending on the optional arguments used in the
 % citation command, references will be converted into |<ptr>| or
-% |<ref>| elements with the appropriate ID supplied by means of the
-% |target| attribute.
+% |<ref>| elements with the appropriate identifier supplied by means
+% of the |target| attribute.
 %
 % Of course, for this mechanism to work, Bib\TeX\ or Bib\LaTeX\ must
 % be used and connected to some |.bib| bibliographical database
 % file. Additionally, this |.bib| file must have been converted into a
-% \texttt{TEI xml} compliant file where all the Bib\hologo{(La)TeX}
+% \texttt{TEI xml}-compliant file where all the Bib\hologo{(La)TeX}
 % entries that are used in the document are found within
 % |<biblStruct>| elements.\footnote{See above n.~\vref{fn:zotero} for
 % information on how to do this.} Finally, this |.xml| bibliographical
 % database must have been connected to the |.tex| source file by means
-% of \cs{SetxmlBibResource} described above in
+% of \cs{AddxmlBibResource} described above in
 % \vref{sec:references-cited-works}.
 %
 % As an example, the following |sample.bib| file is used:---
@@ -4175,7 +5243,7 @@
 % \fi
 %
 % Once both files have been prepared, inserting references and
-% exporting them into the \texttt{TEI xml} ouput file can be achieved
+% exporting them into the \texttt{TEI xml} output file can be achieved
 % in a straightforward way. (The full |sample.tex| is provided
 % below.)---
 %
@@ -4186,8 +5254,7 @@
 \documentclass{article}
 
 \usepackage[teiexport=tidy]{ekdosis}
-\SetxmlBibResource{sample} % base name supplied here, without the
-                           % extension
+\AddxmlBibResource{sample.xml}
 
 \usepackage[style=oxnotes]{biblatex}
 \addbibresource{sample.bib}
@@ -4205,6 +5272,7 @@
 % PDF output:---
 % \medskip
 %
+% \needspace{7\baselineskip}
 % \resetlinenumber
 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
 %   \begin{specimen}
@@ -4213,7 +5281,7 @@
 % \end{alignment}
 %
 % \medskip
-% \texttt{TEI xml} ouput narrowed down to the contents of the |<text>|
+% \texttt{TEI xml} output narrowed down to the contents of the |<text>|
 % element:---
 %
 % \iffalse
@@ -4284,14 +5352,18 @@
 % 
 % \section{Future Work}
 % \label{sec:future-work}
-% A short, uncommented list of what is planned in the versions of
+% A short, un-commented list of what is planned in the versions of
 % \pkg{ekdosis} to come follows:---
 % \begin{enumerate}
 % \item Very short-term (weeks):---
 %   \begin{enumerate}
-%   \item Editorial changes, for inserting corrections and
-%   conjectures.
 %   \item Text structure: milestone elements.
+%   \item Marginal edition texts: It may happen that the marginalia of
+%     manuscripts contain texts worth editing in addition to and along
+%     the main text to which they are linked by reference
+%     signs. 
+%   \item Headers and footers: \cs{ekddiv} will provide top and bottom
+%     marks to be used in headers and footers.
 %   \end{enumerate}
 % \item Short-term (months):---
 %   \begin{enumerate}
@@ -4896,7 +5968,7 @@
 % instruct ekdosis to output TEI xml (arabic-sample-tei.xml):
 \usepackage[teiexport=tidy]{ekdosis}
 
-% instruct arabluatex to ouput sample-arabic_out.tex with Unicode
+% instruct arabluatex to output sample-arabic_out.tex with Unicode
 % Arabic strings in place of arabtex ASCII scheme:
 \usepackage[fullvoc,export]{arabluatex}
 
@@ -4961,7 +6033,8 @@
       \AtBeginDocument{\luadirect{ekdosis.setekddivsfalse()}}}},
   initial divs = ekdosis,
   unknown-choice divs = \PackageError{ekdosis}{unknown divs=#1}{`divs'
-    must be either `ekdosis' or `latex'.}, 
+    must be either `ekdosis' or `latex'.},
+  bool verse = \if at pkg@verse,
   choice parnotes = {false = {},
     true = {\@pkg at parnotestrue},
     roman = {\@pkg at parnotestrue\@parnotesromantrue}},
@@ -4992,7 +6065,6 @@
 % \RequirePackage{expkv-def} % already loaded above
 \RequirePackage{luacode}
 \RequirePackage{paracol}
-\RequirePackage{xparse}
 \RequirePackage{etoolbox}
 \RequirePackage{lineno}
 \RequirePackage{keyfloat}
@@ -5000,8 +6072,11 @@
 \RequirePackage{zref-user}
 \RequirePackage{zref-abspage}
 \RequirePackage{ltxcmds}
-\RequirePackage{atbegshi}
+\RequirePackage{pdftexcmds}
 \RequirePackage{ifoddpage}
+\if at pkg@verse
+  \RequirePackage{verse}
+\fi
 \if at pkg@parnotes
   \RequirePackage{parnotes}
 \fi
@@ -5070,11 +6145,11 @@
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\DeclareHand} As \cs{DeclareWitness}, \cs{DeclareHand}
-%   is a preamble-only command meant to collect data and store them in
-%   |Lua| tables. It takes three mandatory arguments and one optional
-%   argument. The second argument is used to connect the hand to a
-%   declared witness it is related to. Then the table in which this
-%   witness is recorded can be fed with new data.
+% is a preamble-only command meant to collect data and store them in
+% |Lua| tables. It takes three mandatory arguments and one optional
+% argument. The second argument is used to connect the hand to a
+% declared witness it is related to. Then the table in which this
+% witness is recorded can be fed with new data.
 %    \begin{macrocode}
 \NewDocumentCommand{\DeclareHand}{m m m +O{}}{
   \luadirect{ekdosis.newhand(\luastringN{#1},
@@ -5085,20 +6160,57 @@
 \@onlypreamble\DeclareHand
 %    \end{macrocode}
 % \end{macro}
-% \begin{macro}{\DeclareScholar} There is also a table in which are
-%   collected data related to scholars' names to be used in the
-%   apparatus criticus. \cs{DeclareScholar} is a preamble-only command
-%   and takes two mandatory arguments: a unique id and a shorthand to
-%   be used in the apparatus criticus which can be extracted from a
-%   bibliographic database.
+% Build and process the list of scholars:---
 %    \begin{macrocode}
-\NewDocumentCommand{\DeclareScholar}{m m}{
-  \luadirect{ekdosis.newscholar(\luastringN{#1},
-    \luastringN{#2})}
+\ekvdefinekeys{ekd at scholar}{
+  store rawname = \rawname at value,
+  store forename = \forename at value,
+  store surname = \surname at value,
+  store addname = \addname at value,
+  store note = \note at value
 }
+%    \end{macrocode}
+% \begin{macro}{\DeclareScholar}
+% \changes{v1.1}{2020/11/04}{nows builds a list of persons}
+% \cs{DeclareScholar} is used to build a list of persons within the
+% |<listPerson>| element. It takes two mandatory arguments to specify
+% consecutively a unique identifier and the rendition to be used in
+% the apparatus criticus in print, and one optional argument used to
+% collect the name parts components and further items of information
+% from |key-value| \enquote*{named} arguments.
+%    \begin{macrocode}
+\NewDocumentCommand{\DeclareScholar}{m m O{}}{%
+  \bgroup
+  \ekvset{ekd at scholar}{#3}
+    \luadirect{ekdosis.newscholar(
+      \luastringN{#1},
+      \luastringN{#2},
+      \luastringO{\rawname at value},
+      \luastringO{\forename at value},
+      \luastringO{\surname at value},
+      \luastringO{\addname at value},
+      \luastringO{\note at value})}
+    \egroup
+  }
 \@onlypreamble\DeclareScholar
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{\DeclareSource}
+% \changes{v1.1}{2020/11/04}{new command added}There is also a table in
+% which are collected data related to sources to be used in the
+% apparatus criticus. \cs{DeclareSource} is a preamble-only 
+% command and takes two mandatory arguments: a unique id and a
+% shorthand (preferably a Bib\hologo{(La)TeX} label) to be used in
+% the apparatus criticus which can be extracted from a bibliographic
+% database.
+%    \begin{macrocode}
+\NewDocumentCommand{\DeclareSource}{m m}{
+  \luadirect{ekdosis.newsource(\luastringN{#1},
+    \luastringN{#2})}
+}
+\@onlypreamble\DeclareSource
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{\DeclareShorthand} \cs{DeclareShorthand} is a
 %   preamble-only command that can be used to record manuscript
 %   families or any kind of shorthand to be used to refer to
@@ -5118,7 +6230,7 @@
 % \begin{macro}{\getsiglum}
 % \cs{getsiglum}\marg{csv list} takes a comma-separated list of
 % declared ids by means of \cs{DeclareWitness}, \cs{DeclareHand},
-% \cs{DeclareShorthand} or \cs{DeclareScholar} and returns their
+% \cs{DeclareShorthand} or \cs{DeclareSource} and returns their
 % respective renditions.
 %    \begin{macrocode}
 \NewDocumentCommand{\getsiglum}{m}{%
@@ -5207,14 +6319,15 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
-% \begin{macro}{\TeXtoTEIPatt}
+% \begin{macro}{\TeXtoTEIPat}
+% \changes{v1.1}{2020/11/04}{renamed, formerly \cs{TeXtoTEIPatt}}
 % Finally, the more flexible\---and more delicate to
-% handle\---\cs{TeXtoTEIPatt}\marg{\TeX\
+% handle\---\cs{TeXtoTEIPat}\marg{\TeX\
 % pattern}\allowbreak\marg{\texttt{TEI} pattern} uses pattern matching
 % to instruct \pkg{ekdosis} how to convert \hologo{(La)TeX} commands
 % into \texttt{TEI} equivalents.
 %    \begin{macrocode}
-\NewDocumentCommand{\TeXtoTEIPatt}{m m}{%
+\NewDocumentCommand{\TeXtoTEIPat}{m m}{%
   \luadirect{ekdosis.newpatttotag(\luastringN{#1}, \luastringN{#2})}
 }
 %    \end{macrocode}
@@ -5230,22 +6343,22 @@
 \@onlypreamble\SetTEIFileName
 %    \end{macrocode}
 % \end{macro}
-% \begin{macro}{\SetxmlBibResource} This is a preamble-only command.
-%   If a base name for a \texttt{TEI xml} compliant bibliographical
-%   database file is provided with
-%   \cs{SetxmlBibResource}\marg{basename}, \pkg{ekdosis} will use it
-%   and insert formatted data in the back matter section of its own
-%   \texttt{TEI xml} output file, as |<biblStruct>| elements within a
-%   |<listBibl>| section.
+% \begin{macro}{\AddxmlBibResource} This is a preamble-only command.
+%   If a base name (either suffixed with |.xml| or not) for a
+%   \texttt{TEI xml}-compliant bibliographical database file be
+%   provided with \cs{AddxmlBibResource}\marg{basename or name.xml},
+%   \pkg{ekdosis} will use it and insert formatted data in the back
+%   matter section of its own \texttt{TEI xml} output file, as
+%   |<biblStruct>| elements within a |<listBibl>| section.
 %    \begin{macrocode}
-\NewDocumentCommand{\SetxmlBibResource}{m}{
-  \luadirect{ekdosis.setxmlbibresource(\luastringN{#1})}
+\NewDocumentCommand{\AddxmlBibResource}{m}{
+  \luadirect{ekdosis.addxmlbibresource(\luastringN{#1})}
 }
-\@onlypreamble\SetxmlBibResource
+\@onlypreamble\AddxmlBibResource
 %    \end{macrocode}
 % \end{macro}
 %
-%\paragraph{Multi-layer apparatuses}
+%\paragraph{Multiple-layer apparatuses}
 % \pkg{ekdosis} must know if an entry is to be processed in a single-
 % or multiple-layer context:---
 %    \begin{macrocode}
@@ -5302,7 +6415,24 @@
 }
 \@onlypreamble\DeclareApparatus
 %    \end{macrocode}
+% \begin{macro}{\addentries}
+% \changes{v1.1}{2020/11/04}{modifies the number of accepted entries
+% on the current page.}
+% If |maxentries| be set for a given layer of critical notes,
+% \cs{addentries}\oarg{layer}\marg{n}, where \meta{n} is an integer,
+% can be used to add \meta{n} to\---or remove it from if \meta{n} be
+% negative\---the number of accepted entries on the current
+% page. \cs{addentries} operates on the default layer of notes, but
+% any other declared layer can be specified in the optional argument
+% of the command.
+%    \begin{macrocode}
+\NewDocumentCommand{\addentries}{O{\ekdan at type} m}{%
+  \luadirect{ekdosis.addto_bagunits(\luastringO{#1}, \luastringN{#2})}%
+  \ignorespaces
+}
+%    \end{macrocode}
 % \end{macro}
+% \end{macro}
 % Apparatus-related settings and functions. Some booleans to check if
 % an apparatus should be inserted and what is the current environment.
 %    \begin{macrocode}
@@ -5505,8 +6635,11 @@
 %    \end{macrocode}
 % \cs{add@@apparatus} inserts the apparatus block on a given page
 % either in the footnote floating block or in a float of its own,
-% depending on the value set in the |layout| global option.
+% depending on the value set in the |layout| global option. As some
+% commands need to know whether they are called from inside the
+% apparatus criticus, a conditional is first defined.
 %    \begin{macrocode}
+\newif\ifekd at inside@app
 \def\add@@apparatus{%
   \if at pkg@parnotes\parnotes\else\fi%
   \if at pkg@footins%
@@ -5517,8 +6650,10 @@
     \if at parnotesroman%
     \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi%
     \parnoteclear\else\fi%
+    \ekd at inside@apptrue
     \footnotesize\apparatus\unless\ifekd at mapps\ekd at end@apparatus\fi%
-    \if at pkg@parnotes\parnotes\parnotereset\else\fi%
+    \ekd at inside@appfalse
+    \if at pkg@parnotes\parnotes\parnotereset\else\fi
   }%
   \egroup%
   \fi%
@@ -5528,7 +6663,9 @@
     \if at parnotesroman%
     \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi%
     \parnoteclear\else\fi%
+    \ekd at inside@apptrue
     \ekd at appfontsize\apparatus\unless\ifekd at mapps\ekd at end@apparatus\fi%
+    \ekd at inside@appfalse
     \if at pkg@parnotes\parnotes\parnotereset\else\fi%
   }%
   \fi%
@@ -5605,7 +6742,7 @@
 \NewDocumentCommand{\ekdatbegshihook}{}{%
   \ifekd at pagelineation\resetlinenumber\fi
 }
-\AtBeginShipout{\ekdatbegshihook}
+\AddToHook{shipout/before}{\ekdatbegshihook}
 \newif\ifekd at elidednumbers
 \ekvdefinekeys{ekd at lineation}{
   choice lineation = {page = \ekd at pagelineationtrue,
@@ -5614,6 +6751,9 @@
     lineation=#1}{`lineation' must be either `page' or `document'.},
   code modulonum = \chardef\c at linenumbermodulo#1\relax,
   noval modulo = \modulolinenumbers,
+  code vmodulonum = \if at pkg@verse\poemlines{#1}\fi,
+  initial vmodulonum = 1,
+  noval vmodulo = \if at pkg@verse\poemlines{5}\fi,
   choice numbers = {elided = \ekd at elidednumberstrue,
     full = \ekd at elidednumbersfalse},
   unknown-choice numbers = \PackageError{ekdosis}{unknown
@@ -5664,6 +6804,7 @@
 % \cs{rdg} or \cs{note}\meta{*}:---
 %    \begin{macrocode}
 \NewDocumentCommand{\app}{O{} > { \TrimSpaces } +m}{%
+  \leavevmode
   \begingroup
   \ekvset{appnote}{#1}%
   \ekd at isinapptrue%
@@ -5685,9 +6826,9 @@
 \def\current at ref@arg#1#2{{%\textdir TLT%
     \unexpanded\expandafter{\ekd at refnumstyle}%
     \ifnum%
-    \getpagerefnumber{#1}
+    \pdf at strcmp{\getpagerefnumber{#1}}{\getpagerefnumber{#2}}
     =
-    \getpagerefnumber{#2}
+    0
     \ifnum%
     \getrefnumber{#1}
     =
@@ -5744,9 +6885,11 @@
 \def\current at ref{{%\textdir TLT%
     \unexpanded\expandafter{\ekd at refnumstyle}%
     \ifnum%
-    \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}
+    \pdf at strcmp{%
+      \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
+      {\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}
     =
-    \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}
+    0
     \ifnum%
     \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}
     =
@@ -5801,6 +6944,8 @@
 %    \begin{macrocode}
 \ekvdefinekeys{lem}{
   code wit = \def\ekdlr at wit{#1},
+  code source = \def\ekdlr at source{#1},
+  code resp = \def\ekdlr at resp{#1},
   code alt  = \def\ekdlr at alt{#1},
   code pre = \def\ekdlr at pre{#1},
   code post = \def\ekdlr at post{#1},
@@ -5814,6 +6959,8 @@
 }
 \ekvdefinekeys{rdg}{
   code wit = \def\ekdlr at wit{#1},
+  code source = \def\ekdlr at source{#1},
+  code resp = \def\ekdlr at resp{#1},
   code alt  = \def\ekdlr at alt{#1},
   code pre = \def\ekdlr at pre{#1},
   code post = \def\ekdlr at post{#1},
@@ -5823,6 +6970,20 @@
   bool nordg = \ifekdr at nordg
 }
 %    \end{macrocode}
+% \begin{macro}{\rdgGrp}
+% \changes{v1.1}{2020/11/04}{new macro for grouping readings}
+% \cs{rdgGrp}\oarg{option}\marg{lemma and/or readings} may be used to
+% group readings so as to indicate subvariation in apparatus
+% entries. This command is expected inside \cs{app}|{}|, and takes as
+% argument readings to be grouped introduced by means of \cs{lem}
+% and/or \cs{rdg} commands.  It further accepts |type| as an optional
+% key-value argument to describe the type of grouping.
+%    \begin{macrocode}
+\NewDocumentCommand{\rdgGrp}{O{} > {\TrimSpaces } m}{%
+  \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}%
+}
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{\lem}
 % \cs{lem}\oarg{options}\marg{lemma text} inserts \meta{lemma text}
 % both in the edition text and in the apparatus criticus by default,
@@ -5882,6 +7043,8 @@
       \fi
       \ifdefined\ekdlr at postwit%
         \space\unexpanded\expandafter{\ekdlr at postwit}\else\fi
+      \ifdefined\ekdlr at resp\space\getsiglum{\ekdlr at resp}\else\fi
+      \ifdefined\ekdlr at source\space\getsiglum{\ekdlr at source}\else\fi
       \ifdefined\ekdlr at wit\space\getsiglum{\ekdlr at wit}\else\fi
       \ifdefined\ekdlr at prewit%
         \space\unexpanded\expandafter{\ekdlr at prewit}\space\else\fi
@@ -5919,6 +7082,8 @@
       \ifdefined\ekdlr at prewit%
         \space\unexpanded\expandafter{\ekdlr at prewit}\space\else\fi
       \ifdefined\ekdlr at wit\space\getsiglum{\ekdlr at wit}\else\fi
+      \ifdefined\ekdlr at source\space\getsiglum{\ekdlr at source}\else\fi
+      \ifdefined\ekdlr at resp\space\getsiglum{\ekdlr at resp}\else\fi
       \ifdefined\ekdlr at postwit%
         \space\unexpanded\expandafter{\ekdlr at postwit}\else\fi
       \ifekdl at nosep\else\unexpanded\expandafter{\ekdl at sep}\fi
@@ -5972,6 +7137,8 @@
       \fi
       \ifdefined\ekdlr at postwit%
         \space\unexpanded\expandafter{\ekdlr at postwit}\else\fi
+      \ifdefined\ekdlr at resp\space\getsiglum{\ekdlr at resp}\else\fi
+      \ifdefined\ekdlr at source\space\getsiglum{\ekdlr at source}\else\fi
       \ifdefined\ekdlr at wit\space\getsiglum{\ekdlr at wit}\else\fi
       \ifdefined\ekdlr at prewit%
         \space\unexpanded\expandafter{\ekdlr at prewit}\space\else\fi
@@ -6000,6 +7167,8 @@
       \ifdefined\ekdlr at prewit%
         \space\unexpanded\expandafter{\ekdlr at prewit}\space\else\fi
       \ifdefined\ekdlr at wit\space\getsiglum{\ekdlr at wit}\else\fi
+      \ifdefined\ekdlr at source\space\getsiglum{\ekdlr at source}\else\fi
+      \ifdefined\ekdlr at resp\space\getsiglum{\ekdlr at resp}\else\fi
       \ifdefined\ekdlr at postwit%
         \space\unexpanded\expandafter{\ekdlr at postwit}\else\fi
     }%
@@ -6037,7 +7206,7 @@
 % specified; otherwise \pkg{ekdosis} will issue an error message.
 %    \begin{macrocode}
 \NewDocumentCommand{\note at noapp}{O{} +m}{%
-  \null
+  \leavevmode
   \bgroup%
   \ekvset{note}{#1}%
   \stepcounter{ekd at lab}%
@@ -6128,10 +7297,10 @@
   \bgroup%
   \ekvset{ekd at note}{#1}%
   \edef\note at contents{%
-    \ekvifdefinedNoVal{note}{pre}{}{%
+    \ekvifdefinedNoVal{ekd at note}{pre}{}{%
       \unexpanded\expandafter{\pre at value}}%
     {\unexpanded{#2}}%
-    \ekvifdefinedNoVal{note}{post}{}{%
+    \ekvifdefinedNoVal{ekd at note}{post}{}{%
       \unexpanded\expandafter{\post at value}}%
   }%
   \append at app{\note at contents}%
@@ -6142,10 +7311,10 @@
     \bgroup%
       \ekvset{ekd at note}{#1}%
       \edef\note at contents{%
-        \ekvifdefinedNoVal{note}{pre}{}{%
+        \ekvifdefinedNoVal{ekd at note}{pre}{}{%
           \unexpanded\expandafter{\pre at value}}%
         \unskip\noexpand\parnote{\unexpanded{#2}}%
-        \ekvifdefinedNoVal{note}{post}{}{%
+        \ekvifdefinedNoVal{ekd at note}{post}{}{%
           \unexpanded\expandafter{\post at value}}%
       }%
       \append at app{\note at contents}%
@@ -6186,6 +7355,101 @@
 }
 %    \end{macrocode}
 % \end{macro}
+% \paragraph{Emendations and Conjectures}
+% Here follows the |key-value| options to be used by
+% \cs{SetCritSymbols} below:---
+%    \begin{macrocode}
+\ekvdefinekeys{ekd at corr}{
+  store suppbegin = \suppb at value,
+  store suppend = \suppe at value,
+  store delbegin = \delb at value,
+  store delend = \dele at value,
+  store sicbegin = \sicb at value,
+  store sicend = \sice at value,
+  store gapmark = \gapm at value,
+  initial suppbegin = \ifbool{al at rlmode}{>}{<},
+  initial suppend = \ifbool{al at rlmode}{<}{>},
+  initial delbegin = \ifbool{al at rlmode}{\}}{\{},
+  initial delend = \ifbool{al at rlmode}{\{}{\}},
+  initial sicbegin = \dag,
+  initial sicend = \dag,
+  initial gapmark = ***
+}
+%    \end{macrocode}
+% \begin{macro}{\supplied}
+% \changes{v1.1}{2020/11/04}{new macro for editorial additions}
+% \cs{supplied}\marg{text} takes as mandatory argument the text added
+% or supplied by conjecture.
+%    \begin{macrocode}
+\NewDocumentCommand{\supplied}{m}{%
+  \ifekd at inside@app
+  #1%
+  \else
+  \suppb at value #1\suppe at value
+  \fi
+}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\surplus}
+% \changes{v1.1}{2020/11/04}{new macro for editorial deletions}
+% \cs{surplus}\marg{text} takes as mandatory argument the text
+% considered by the editor to be inauthentic, but nevertheless
+% retained between braces in the edition text as it is transmitted by
+% all witnesses.
+%    \begin{macrocode}
+\NewDocumentCommand{\surplus}{m}{%
+  \ifekd at inside@app
+  #1%
+  \else
+  \delb at value #1\dele at value
+  \fi
+}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\sic}
+% \changes{v1.1}{2020/11/04}{new macro for text deemed to be not
+% understandable}
+% \cs{sic}\marg{text} takes as mandatory argument the text deemed by
+% the editor to be readable but not understandable. \cs{sic} insert
+% \meta{text} between cruces while \cs{sic*} prints only one crux
+% before \meta{text}.
+%    \begin{macrocode}
+\NewDocumentCommand{\sic}{s m}{%
+  \ifekd at inside@app
+  #2%
+  \else
+  \IfBooleanTF{#1}
+    {\sicb at value #2}
+    {\sicb at value #2\sice at value}%
+  \fi
+}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\gap}
+% \changes{v1.1}{2020/11/04}{new macro for lacunae}
+% \cs{gap}\marg{options} indicates that some amount of text has fallen
+% away from the entire tradition. It takes as mandatory argument a
+% comma-separated list of options that can be used to further specify
+% the reason for omission, the unit of measurement, the quantity and
+% extent.
+%    \begin{macrocode}
+\NewDocumentCommand{\gap}{m}{%
+  \gapm at value
+}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\SetCritSymbols}
+% \changes{v1.1}{2020/11/04}{new macro to set the symbols to be
+% used to mark the corrections} \cs{SetCritSymbols}\marg{csv list of
+% options} is used to change the symbols that \pkg{ekdosis} uses by
+% default for representing emendations, lacunae, omissions, gaps and
+% editorial deletions.
+%    \begin{macrocode}
+\NewDocumentCommand{\SetCritSymbols}{m}{
+  \ekvset{ekd at corr}{#1}
+}
+%    \end{macrocode}
+% \end{macro}
 % \cs{apparatus} is used internally by \pkg{ekdosis} to print the
 % apparatus at the bottom of pages. Therefore, it is not documented,
 % but this may change in the future for it will be possible to have
@@ -6457,12 +7721,45 @@
 }
 %    \end{macrocode}
 % \end{macro}
-% A very basic and provisional implementation of poetry lines
-% follows:---
+% \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 at pkg@verse
+\verselinenumfont{\normalfont\footnotesize}
+\setcounter{poemline}{1}
+\NewDocumentEnvironment{ekdverse}{O{\linewidth}}{%
+  \nolinenumbers
+  \let\linelabel\label
+  \stepcounter{verse at envctr}%
+  \addtocounter{poemline}{-1}\refstepcounter{poemline}%
+  \setcounter{vslineno}{1}%
+  \let\\=\@vscentercr
+  \list{}{\itemsep \z@
+          \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}
-\newenvironment*{ekdverse}[1][\ekdverseindentlength]{
+\NewDocumentEnvironment{ekdverse}{O{\ekdverseindentlength}}{
   \begin{list}{}{%
       \setlength{\leftmargin}{#1}
       \setlength{\itemsep}{0pt}
@@ -6471,7 +7768,9 @@
     }
   \item[]
   }{\end{list}}
+\fi
 %    \end{macrocode}
+% \end{environment}
 % \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
@@ -6560,7 +7859,8 @@
 local next = next
 
 -- General
-xmlids = {}
+local xmlids = {}
+table.insert(xmlids, {xmlid = "scholars"} )
 
 local function xmlidfound(element)
    for i = 1,#xmlids do
@@ -6582,10 +7882,13 @@
 end
 
 -- Witnesses
-listWit = {}
-idsRend = {}
-shorthands = {}
+local listWit = {}
+-- Persons/Scholars
+local listPerson = {}
 
+local idsRend = {}
+local shorthands = {}
+
 local function isfound(table, value)
    for i = 1,#table do
       if table[i] == value then
@@ -6727,14 +8030,67 @@
    return true
 end
 
+function ekdosis.newscholar(id,
+			    siglum,
+			    rawname,
+			    Forename,
+			    Surname,
+			    AddName,
+			    Note)
+   if xmlidfound(id)
+   then
+      tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
+      	 ..id..
+      	 "\" already exists as an xml:id. "
+      	 ..
+      	 "Please pick another id.}}")
+   elseif not checkxmlid(id)
+   then
+      tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
+      	 ..id..
+      	 "\" is not a valid xml:id. \\MessageBreak "
+      	 ..
+      	 "Please pick another id.}}")
+   else
+      table.insert(xmlids, {xmlid = id})
+      table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
+      table.insert(idsRend, {xmlid = id, abbr = siglum})
+      table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
+      if rawname ~= ""
+      then
+	 table.insert(listPerson, {xmlid = id,
+				   abbr = siglum,
+				   note = Note,
+				   persName = {
+				      name = rawname}
+	 })
+      else
+	 table.insert(listPerson, {xmlid = id,
+				   abbr = siglum,
+				   note = Note,
+				   persName = {
+				      forename = Forename,
+				      surname = Surname,
+				      addName = AddName}
+	 })
+      end
+   end
+   return true
+end
+
 local xmlbibresource = nil
 
-function ekdosis.setxmlbibresource(str)
-   xmlbibresource = str..".xml"
+function ekdosis.addxmlbibresource(str)
+   if string.find(str, "%.xml$")
+   then
+      xmlbibresource = str
+   else
+      xmlbibresource = str..".xml"
+   end
    return true
 end
 
-function ekdosis.newscholar(id, siglum)
+function ekdosis.newsource(id, siglum)
    if xmlidfound(id)
    then
       tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
@@ -6796,6 +8152,7 @@
    {a="LRfootnote", b="note", c=" place=\"bottom\""},
    {a="RLfootnote", b="note", c=" place=\"bottom\""},
    {a="enquote *", b="quote", c=""},
+   {a="marginpar", b="note", c=" place=\"margin\""},
    {a="footnote", b="note", c=" place=\"bottom\""},
    {a="enquote", b="quote", c=""},
    {a="txtrans", b="s", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""},
@@ -6805,15 +8162,21 @@
    {a="textsf", b="hi", c=" rend=\"sf\""},
    {a="arbup", b="hi", c=" rend=\"sup\""},
    {a="txarb", b="s", c=" xml:lang=\"arb\""},
-   {a="mbox", b="", c=""},
    {a="arb", b="foreign",
     c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""}
 }
 
 local texpatttotags = {
+   {a="\\addentries%s+%[(.-)%]{(.-)}", b=""},
+   {a="\\addentries%s+{(.-)}", b=""},
+   {a="\\setverselinenums%s+{(.-)}{(.-)}", b=""},
+   {a="\\resetlinenumber%s+%[(.-)%]", b=""},
+   {a="\\resetlinenumber%s+", b=""},
+   {a="\\poemlines%s+{(.-)}", b=""},
    {a="\\pagebreak%s+%[[1-4]%]", b=""},
    {a="\\pagebreak%s+", b=""},
    {a="\\altrfont%s+", b=""},
+   {a="\\mbox%s+{(.-)}", b="%1"},
    {a="\\LR%s+{(.-)}", b="%1"},
    {a="\\RL%s+{(.-)}", b="%1"}
 }
@@ -6890,6 +8253,10 @@
 -- Get values of attributes
 local function get_attr_value(str, attr)
    str = str..","
+   str = string.gsub(str, "%b{}", function(body)
+			body = string.gsub(body, attr, attr.."@ekd")
+			return string.format("%s", body)
+   end)
    local attrval = string.match(str, "%f[%w]"..attr.."%s?%=%s?%b{}")
       or string.match(str, "%f[%w]"..attr.."%s?%=%s?.-%,")
       or ""
@@ -6898,6 +8265,7 @@
 			    return string.format("%s", bbraces)
    end)
    attrval = string.gsub(attrval, attr.."%s?%=%s?(.-)%s?%,", "%1")
+   str = string.gsub(str, attr.."@ekd", attr)
    return attrval
 end
 
@@ -6922,16 +8290,21 @@
 		 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
 		 right = get_attr_value(opt, "labelb")
 		 left = get_attr_value(opt, "labele")
-		 if left ~= ""
+		 if right == ""
 		 then
-		    return string.format(
-		       "<%s%s target=\"#range(right(%s),left(%s))\">%s</%s><anchor xml:id=\"%s\"/>",
-		       cmd, teitype, right, left, arg, cmd, right)
-		 elseif left == ""
-		 then
-		    return string.format(
-		       "<%s%s target=\"#right(%s)\">%s</%s><anchor xml:id=\"%s\"/>",
-		       cmd, teitype, right, arg, cmd, right)
+		    return string.format("<%s>%s</%s>", cmd, arg, cmd)
+		 else
+		    if left ~= ""
+		    then
+		       return string.format(
+			  "<%s%s target=\"#range(right(%s),left(%s))\">%s</%s><anchor xml:id=\"%s\"/>",
+			  cmd, teitype, right, left, arg, cmd, right)
+		    elseif left == ""
+		    then
+		       return string.format(
+			  "<%s%s target=\"#right(%s)\">%s</%s><anchor xml:id=\"%s\"/>",
+			  cmd, teitype, right, arg, cmd, right)
+		    end
 		 end
    end)
    return str
@@ -6956,6 +8329,31 @@
    return str
 end
 
+local function rdgGrp_totei(str)
+   str = gsub(str,
+	      dblbkslash *
+		 lpeg.Cs("rdgGrp") *
+		 spcenc^-1 *
+		 bsqbrackets *
+		 bcbraces *
+		 spcenc^-1,
+	      function(bkslash, cmd, opt, arg)
+		 opt = string.sub(opt, 2, -2)
+		 arg = string.sub(arg, 2, -2)
+		 teitype = get_attr_value(opt, "type")
+		 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
+		 if opt == ""
+		 then
+		    return rdgGrp_totei(string.format("<%s>%s</%s>",
+						       cmd, arg, cmd))
+		 else
+		    return rdgGrp_totei(string.format("<%s%s>%s</%s>",
+						       cmd, teitype, arg, cmd))
+		 end
+   end)
+   return str
+end
+
 local function lem_rdg_totei(str)
    str = gsub(str,
 	      spcenc^-1 *
@@ -6972,6 +8370,10 @@
 		 --
 		 teiwit = get_attr_value(opt, "wit")
 		 if teiwit ~= "" then teiwit = " wit=\""..ekdosis.getsiglum(teiwit, "tei").."\"" else end
+		 teisource = get_attr_value(opt, "source")
+		 if teisource ~= "" then teisource = " source=\""..ekdosis.getsiglum(teisource, "tei").."\"" else end
+		 teiresp = get_attr_value(opt, "resp")
+		 if teiresp ~= "" then teiresp = " resp=\""..ekdosis.getsiglum(teiresp, "tei").."\"" else end
 		 teitype = get_attr_value(opt, "type")
 		 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
 		 --
@@ -6981,8 +8383,8 @@
 						       cmd, arg, cmd))
 		 else
 		    -- opt = ekdosis.getsiglum(opt, "tei")
-		    return lem_rdg_totei(string.format("<%s%s%s>%s</%s>",
-						       cmd, teiwit, teitype, arg, cmd))
+		    return lem_rdg_totei(string.format("<%s%s%s%s%s>%s</%s>",
+						       cmd, teiwit, teisource, teiresp, teitype, arg, cmd))
 		 end
    end)
    str = gsub(str, spcenc^-0 * dblbkslash * lemrdg * spcenc^-1 * bcbraces * spcenc^-1,
@@ -7000,7 +8402,7 @@
 
 local function linestotei(str)
 --   str = "\n<l>"..str
-   str = string.gsub(str, "^%s?(.-)%s?$", "\n<l>%1</l>\n")
+   str = string.gsub(str, "^%s?(.-)\\\\[%!%*]?%s?$", "\n<l>%1</l>\n")
 --   str = gsub(str, endpoem, "</l>\n")
    str = gsub(str, poemline * spcenc^-1 * lpeg.P(">"), "\n<lb/>")
    str = gsub(str, poemline * spcenc^-1, "</l>\n<l>")
@@ -7087,7 +8489,7 @@
 		 * bsqbrackets
 		 * bsqbrackets
 		 * bcbraces
-		 * bsqbrackets^-1,
+		 * (bsqbrackets + bcbraces)^-1,
 	      function(cmd, pre, post, body, opt)
 		 pre = string.sub(pre, 2, -2)
 		 post = string.sub(post, 2, -2)
@@ -7108,7 +8510,7 @@
 		 * spcenc^-1
 		 * bsqbrackets
 		 * bcbraces
-		 * bsqbrackets^-1,
+		 * (bsqbrackets + bcbraces)^-1,
 	      function(cmd, post, body, opt)
 		 post = string.sub(post, 2, -2)
 		 body = string.sub(body, 2, -2)
@@ -7127,7 +8529,7 @@
 		 * citecmds
 		 * spcenc^-1
 		 * bcbraces
-		 * bsqbrackets^-1,
+		 * (bsqbrackets + bcbraces)^-1,
 	      function(cmd, body, opt)
 		 body = string.sub(body, 2, -2)
 		 if not checkxmlid(body)
@@ -7179,6 +8581,19 @@
 			return string.format("<ref target=\"%s\">%s</ref>",
 					     teisiglum, printsiglum)
    end)
+   str = string.gsub(str, "\\(gap)%s?(%b{})",
+		     function(cmd, body)
+			body = string.sub(body, 2, -2)
+			teireason = get_attr_value(body, "reason")
+			if teireason ~= "" then teireason = " reason=\""..teireason.."\"" else end
+			teiunit = get_attr_value(body, "unit")
+			if teiunit ~= "" then teiunit = " unit=\""..teiunit.."\"" else end
+			teiquantity = get_attr_value(body, "quantity")
+			if teiquantity ~= "" then teiquantity = " quantity=\""..teiquantity.."\"" else end
+			teiextent = get_attr_value(body, "extent")
+			if teiextent ~= "" then teiextent = " extent=\""..teiextent.."\"" else end
+			return string.format("<gap%s%s%s%s/>", teireason, teiunit, teiquantity, teiextent)
+   end)
    str = gsub(str, lpeg.P("\\") * labelrefcmds * spcenc^-1 * bcbraces,
 	      function(cmd, body)
 		 body = string.sub(body, 2, -2)
@@ -7542,6 +8957,7 @@
    str = texpatttotei(str)
    str = note_totei(str)
    str = app_totei(str)
+   str = rdgGrp_totei(str)
    str = lem_rdg_totei(str)
    str = relocate_notes(str)
    str = versetotei(str)
@@ -7587,68 +9003,113 @@
    f:write("<distributor><!-- Distributor name  --></distributor>", "\n")
    f:write("</publicationStmt>", "\n")
    f:write("<sourceDesc>", "\n")
-   f:write("<listWit>", "\n")
-   for i = 1,#listWit do
-      f:write('<witness xml:id=\"', listWit[i].xmlid, "\">", "\n")
-      f:write('<abbr type="siglum">', textotei(listWit[i].abbr), "</abbr>", "\n")
-      f:write(textotei(listWit[i].detailsDesc), "\n")
-      f:write("<msDesc>", "\n")
-      if listWit[i].msIdentifier.settlement == ""
-	 and listWit[i].msIdentifier.institution == ""
-	 and listWit[i].msIdentifier.repository == ""
-	 and listWit[i].msIdentifier.collection == ""
-	 and listWit[i].msIdentifier.idno == ""
-	 and listWit[i].msIdentifier.msName == ""
+   if next(listWit) == nil and next(listPerson) == nil
+   then
+      f:write("<p>No source, born digital</p>", "\n")
+   else
+      if next(listWit) ~= nil
       then
-	 f:write("<msIdentifier/>", "\n")
-      else
-	 f:write("<msIdentifier>", "\n")
-	 if listWit[i].msIdentifier.settlement ~= "" then
-	    f:write("<settlement>", textotei(listWit[i].msIdentifier.settlement), "</settlement>", "\n")
+	 f:write("<listWit>", "\n")
+	 for i = 1,#listWit do
+	    f:write('<witness xml:id=\"', listWit[i].xmlid, "\">", "\n")
+	    f:write('<abbr type="siglum">', textotei(listWit[i].abbr), "</abbr>", "\n")
+	    f:write(textotei(listWit[i].detailsDesc), "\n")
+	    f:write("<msDesc>", "\n")
+	    if listWit[i].msIdentifier.settlement == ""
+	       and listWit[i].msIdentifier.institution == ""
+	       and listWit[i].msIdentifier.repository == ""
+	       and listWit[i].msIdentifier.collection == ""
+	       and listWit[i].msIdentifier.idno == ""
+	       and listWit[i].msIdentifier.msName == ""
+	    then
+	       f:write("<msIdentifier/>", "\n")
+	    else
+	       f:write("<msIdentifier>", "\n")
+	       if listWit[i].msIdentifier.settlement ~= "" then
+		  f:write("<settlement>", textotei(listWit[i].msIdentifier.settlement), "</settlement>", "\n")
 	 else end
-	 if listWit[i].msIdentifier.institution ~= "" then
-	    f:write("<institution>", textotei(listWit[i].msIdentifier.institution), "</institution>", "\n")
+	       if listWit[i].msIdentifier.institution ~= "" then
+		  f:write("<institution>", textotei(listWit[i].msIdentifier.institution), "</institution>", "\n")
 	 else end
-	 if listWit[i].msIdentifier.repository ~= "" then
-	    f:write("<repository>", textotei(listWit[i].msIdentifier.repository), "</repository>", "\n")
+	       if listWit[i].msIdentifier.repository ~= "" then
+		  f:write("<repository>", textotei(listWit[i].msIdentifier.repository), "</repository>", "\n")
 	 else end
-	 if listWit[i].msIdentifier.collection ~= "" then
-	    f:write("<collection>", textotei(listWit[i].msIdentifier.collection), "</collection>", "\n")
+	       if listWit[i].msIdentifier.collection ~= "" then
+		  f:write("<collection>", textotei(listWit[i].msIdentifier.collection), "</collection>", "\n")
 	 else end
-	 if listWit[i].msIdentifier.idno ~= "" then
-	    f:write("<idno>", textotei(listWit[i].msIdentifier.idno), "</idno>", "\n")
+	       if listWit[i].msIdentifier.idno ~= "" then
+		  f:write("<idno>", textotei(listWit[i].msIdentifier.idno), "</idno>", "\n")
 	 else end
-	 if listWit[i].msIdentifier.msName ~= "" then
-	    f:write("<msName>", textotei(listWit[i].msIdentifier.msName), "</msName>", "\n")
+	       if listWit[i].msIdentifier.msName ~= "" then
+		  f:write("<msName>", textotei(listWit[i].msIdentifier.msName), "</msName>", "\n")
 	 else end
-	 f:write("</msIdentifier>", "\n")
+	       f:write("</msIdentifier>", "\n")
+	    end
+	    if listWit[i].handDesc ~= nil then
+	       f:write("<physDesc>", "\n")
+	       f:write("<handDesc hands=\"", #listWit[i].handDesc, "\">", "\n")
+	       local j = 1
+	       while listWit[i].handDesc[j]
+	       do
+		  f:write("<handNote xml:id=\"", listWit[i].handDesc[j].xmlid, "\">", "\n")
+		  f:write('<abbr type="siglum">', textotei(listWit[i].handDesc[j].abbr), "</abbr>", "\n")
+		  f:write("<p>", textotei(listWit[i].handDesc[j].detailsDesc), "</p>", "\n")
+		  f:write("</handNote>", "\n")
+		  j = j + 1
+	       end
+	       f:write("</handDesc>", "\n")
+	       f:write("</physDesc>", "\n")
+      else end
+	    if listWit[i].history ~= nil then
+	       f:write("<history>", "\n")
+	       f:write("<origin>", "\n")
+	       f:write("<origDate>", textotei(listWit[i].history.origin.origDate), "</origDate>", "\n")
+	       f:write("</origin>", "\n")
+	       f:write("</history>", "\n")
+	    end
+	    f:write("</msDesc>", "\n")
+	    f:write("</witness>", "\n")
+	 end
+	 f:write("</listWit>", "\n")
       end
-      if listWit[i].handDesc ~= nil then
-	 f:write("<physDesc>", "\n")
-	 f:write("<handDesc hands=\"", #listWit[i].handDesc, "\">", "\n")
-	 local j = 1
-	 while listWit[i].handDesc[j]
-	 do
-	    f:write("<handNote xml:id=\"", listWit[i].handDesc[j].xmlid, "\">", "\n")
-	    f:write('<abbr type="siglum">', textotei(listWit[i].handDesc[j].abbr), "</abbr>", "\n")
-	    f:write("<p>", textotei(listWit[i].handDesc[j].detailsDesc), "</p>", "\n")
-	    f:write("</handNote>", "\n")
-	    j = j + 1
+      if next(listPerson) ~= nil
+      then
+	 f:write("<listPerson xml:id=\"scholars\">", "\n")
+	 for i = 1,#listPerson do
+	    f:write('<person xml:id=\"', listPerson[i].xmlid, "\">", "\n")
+	    f:write('<persName>', "\n")
+	    f:write('<abbr type="siglum">', textotei(listPerson[i].abbr), "</abbr>", "\n")
+	    if listPerson[i].persName.name ~= nil
+	    then
+	       f:write(textotei(listPerson[i].persName.name))
+	    else
+	       if listPerson[i].persName.forename ~= ""
+	       then
+		  f:write("<forename>", textotei(listPerson[i].persName.forename), "</forename>", "\n")
+	       else
+		  f:write("<forename><!-- forename --></forename>", "\n")
+	       end
+	       if textotei(listPerson[i].persName.surname) ~= ""
+	       then
+		  f:write("<surname>", textotei(listPerson[i].persName.surname), "</surname>", "\n")
+	       else
+		  f:write("<surname><!-- surname --></surname>", "\n")
+	       end
+	       if textotei(listPerson[i].persName.addName) ~= ""
+	       then
+		  f:write("<addName>", textotei(listPerson[i].persName.addName), "</addName>", "\n")
+	       end
+	    end
+	    if listPerson[i].note ~= ""
+	    then
+	       f:write("<note>", textotei(listPerson[i].note), "</note>", "\n")
+	    end
+	    f:write('</persName>', "\n")      
+	    f:write('</person>', "\n")      
 	 end
-	 f:write("</handDesc>", "\n")
-	 f:write("</physDesc>", "\n")
-      else end
-      if listWit[i].history ~= nil then
-	 f:write("<history>", "\n")
-	 f:write("<origin>", "\n")
-	 f:write("<origDate>", textotei(listWit[i].history.origin.origDate), "</origDate>", "\n")
-	 f:write("</origin>", "\n")
-	 f:write("</history>", "\n")
+	 f:write("</listPerson>", "\n")
       end
-      f:write("</msDesc>", "\n")
-      f:write("</witness>", "\n")
    end
-   f:write("</listWit>", "\n")
    f:write("</sourceDesc>", "\n")
    f:write("</fileDesc>", "\n")
    f:write("<encodingDesc>", "\n")
@@ -8052,10 +9513,10 @@
    return bagunits[teitype]
 end
 
-local function getapplimit(str)
+local function getapplimit(teitype)
    for i = 1,#apparatuses
    do
-      if apparatuses[i].a == str then
+      if apparatuses[i].a == teitype then
 	 limitfound = apparatuses[i].limit
 	 break
       end
@@ -8084,6 +9545,14 @@
    end
 end
 
+function ekdosis.addto_bagunits(teitype, n)
+   if tonumber(getapplimit(teitype)) ~= 0
+   then
+      n = tonumber(n)
+      bagunits[teitype] = bagunits[teitype] - n
+   end
+end
+
 function ekdosis.increment_bagunits(teitype)
    bagunits[teitype] = (bagunits[teitype] or 0) + 1
 end

Modified: trunk/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua	2020-11-04 21:36:26 UTC (rev 56855)
+++ trunk/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua	2020-11-04 21:36:41 UTC (rev 56856)
@@ -1,7 +1,7 @@
 --[[
 This file is part of the `ekdosis' package
 
-ekdosis -- Typesetting TEI xml compliant critical editions
+ekdosis -- Typesetting TEI xml-compliant critical editions
 Copyright (C) 2020  Robert Alessi
 
 Please send error reports and suggestions for improvements to Robert
@@ -90,7 +90,8 @@
 local next = next
 
 -- General
-xmlids = {}
+local xmlids = {}
+table.insert(xmlids, {xmlid = "scholars"} )
 
 local function xmlidfound(element)
    for i = 1,#xmlids do
@@ -112,10 +113,13 @@
 end
 
 -- Witnesses
-listWit = {}
-idsRend = {}
-shorthands = {}
+local listWit = {}
+-- Persons/Scholars
+local listPerson = {}
 
+local idsRend = {}
+local shorthands = {}
+
 local function isfound(table, value)
    for i = 1,#table do
       if table[i] == value then
@@ -257,14 +261,67 @@
    return true
 end
 
+function ekdosis.newscholar(id,
+			    siglum,
+			    rawname,
+			    Forename,
+			    Surname,
+			    AddName,
+			    Note)
+   if xmlidfound(id)
+   then
+      tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
+      	 ..id..
+      	 "\" already exists as an xml:id. "
+      	 ..
+      	 "Please pick another id.}}")
+   elseif not checkxmlid(id)
+   then
+      tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
+      	 ..id..
+      	 "\" is not a valid xml:id. \\MessageBreak "
+      	 ..
+      	 "Please pick another id.}}")
+   else
+      table.insert(xmlids, {xmlid = id})
+      table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
+      table.insert(idsRend, {xmlid = id, abbr = siglum})
+      table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
+      if rawname ~= ""
+      then
+	 table.insert(listPerson, {xmlid = id,
+				   abbr = siglum,
+				   note = Note,
+				   persName = {
+				      name = rawname}
+	 })
+      else
+	 table.insert(listPerson, {xmlid = id,
+				   abbr = siglum,
+				   note = Note,
+				   persName = {
+				      forename = Forename,
+				      surname = Surname,
+				      addName = AddName}
+	 })
+      end
+   end
+   return true
+end
+
 local xmlbibresource = nil
 
-function ekdosis.setxmlbibresource(str)
-   xmlbibresource = str..".xml"
+function ekdosis.addxmlbibresource(str)
+   if string.find(str, "%.xml$")
+   then
+      xmlbibresource = str
+   else
+      xmlbibresource = str..".xml"
+   end
    return true
 end
 
-function ekdosis.newscholar(id, siglum)
+function ekdosis.newsource(id, siglum)
    if xmlidfound(id)
    then
       tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
@@ -326,6 +383,7 @@
    {a="LRfootnote", b="note", c=" place=\"bottom\""},
    {a="RLfootnote", b="note", c=" place=\"bottom\""},
    {a="enquote *", b="quote", c=""},
+   {a="marginpar", b="note", c=" place=\"margin\""},
    {a="footnote", b="note", c=" place=\"bottom\""},
    {a="enquote", b="quote", c=""},
    {a="txtrans", b="s", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""},
@@ -335,15 +393,21 @@
    {a="textsf", b="hi", c=" rend=\"sf\""},
    {a="arbup", b="hi", c=" rend=\"sup\""},
    {a="txarb", b="s", c=" xml:lang=\"arb\""},
-   {a="mbox", b="", c=""},
    {a="arb", b="foreign",
     c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""}
 }
 
 local texpatttotags = {
+   {a="\\addentries%s+%[(.-)%]{(.-)}", b=""},
+   {a="\\addentries%s+{(.-)}", b=""},
+   {a="\\setverselinenums%s+{(.-)}{(.-)}", b=""},
+   {a="\\resetlinenumber%s+%[(.-)%]", b=""},
+   {a="\\resetlinenumber%s+", b=""},
+   {a="\\poemlines%s+{(.-)}", b=""},
    {a="\\pagebreak%s+%[[1-4]%]", b=""},
    {a="\\pagebreak%s+", b=""},
    {a="\\altrfont%s+", b=""},
+   {a="\\mbox%s+{(.-)}", b="%1"},
    {a="\\LR%s+{(.-)}", b="%1"},
    {a="\\RL%s+{(.-)}", b="%1"}
 }
@@ -420,6 +484,10 @@
 -- Get values of attributes
 local function get_attr_value(str, attr)
    str = str..","
+   str = string.gsub(str, "%b{}", function(body)
+			body = string.gsub(body, attr, attr.."@ekd")
+			return string.format("%s", body)
+   end)
    local attrval = string.match(str, "%f[%w]"..attr.."%s?%=%s?%b{}")
       or string.match(str, "%f[%w]"..attr.."%s?%=%s?.-%,")
       or ""
@@ -428,6 +496,7 @@
 			    return string.format("%s", bbraces)
    end)
    attrval = string.gsub(attrval, attr.."%s?%=%s?(.-)%s?%,", "%1")
+   str = string.gsub(str, attr.."@ekd", attr)
    return attrval
 end
 
@@ -452,16 +521,21 @@
 		 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
 		 right = get_attr_value(opt, "labelb")
 		 left = get_attr_value(opt, "labele")
-		 if left ~= ""
+		 if right == ""
 		 then
-		    return string.format(
-		       "<%s%s target=\"#range(right(%s),left(%s))\">%s</%s><anchor xml:id=\"%s\"/>",
-		       cmd, teitype, right, left, arg, cmd, right)
-		 elseif left == ""
-		 then
-		    return string.format(
-		       "<%s%s target=\"#right(%s)\">%s</%s><anchor xml:id=\"%s\"/>",
-		       cmd, teitype, right, arg, cmd, right)
+		    return string.format("<%s>%s</%s>", cmd, arg, cmd)
+		 else
+		    if left ~= ""
+		    then
+		       return string.format(
+			  "<%s%s target=\"#range(right(%s),left(%s))\">%s</%s><anchor xml:id=\"%s\"/>",
+			  cmd, teitype, right, left, arg, cmd, right)
+		    elseif left == ""
+		    then
+		       return string.format(
+			  "<%s%s target=\"#right(%s)\">%s</%s><anchor xml:id=\"%s\"/>",
+			  cmd, teitype, right, arg, cmd, right)
+		    end
 		 end
    end)
    return str
@@ -486,6 +560,31 @@
    return str
 end
 
+local function rdgGrp_totei(str)
+   str = gsub(str,
+	      dblbkslash *
+		 lpeg.Cs("rdgGrp") *
+		 spcenc^-1 *
+		 bsqbrackets *
+		 bcbraces *
+		 spcenc^-1,
+	      function(bkslash, cmd, opt, arg)
+		 opt = string.sub(opt, 2, -2)
+		 arg = string.sub(arg, 2, -2)
+		 teitype = get_attr_value(opt, "type")
+		 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
+		 if opt == ""
+		 then
+		    return rdgGrp_totei(string.format("<%s>%s</%s>",
+						       cmd, arg, cmd))
+		 else
+		    return rdgGrp_totei(string.format("<%s%s>%s</%s>",
+						       cmd, teitype, arg, cmd))
+		 end
+   end)
+   return str
+end
+
 local function lem_rdg_totei(str)
    str = gsub(str,
 	      spcenc^-1 *
@@ -502,6 +601,10 @@
 		 --
 		 teiwit = get_attr_value(opt, "wit")
 		 if teiwit ~= "" then teiwit = " wit=\""..ekdosis.getsiglum(teiwit, "tei").."\"" else end
+		 teisource = get_attr_value(opt, "source")
+		 if teisource ~= "" then teisource = " source=\""..ekdosis.getsiglum(teisource, "tei").."\"" else end
+		 teiresp = get_attr_value(opt, "resp")
+		 if teiresp ~= "" then teiresp = " resp=\""..ekdosis.getsiglum(teiresp, "tei").."\"" else end
 		 teitype = get_attr_value(opt, "type")
 		 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
 		 --
@@ -511,8 +614,8 @@
 						       cmd, arg, cmd))
 		 else
 		    -- opt = ekdosis.getsiglum(opt, "tei")
-		    return lem_rdg_totei(string.format("<%s%s%s>%s</%s>",
-						       cmd, teiwit, teitype, arg, cmd))
+		    return lem_rdg_totei(string.format("<%s%s%s%s%s>%s</%s>",
+						       cmd, teiwit, teisource, teiresp, teitype, arg, cmd))
 		 end
    end)
    str = gsub(str, spcenc^-0 * dblbkslash * lemrdg * spcenc^-1 * bcbraces * spcenc^-1,
@@ -530,7 +633,7 @@
 
 local function linestotei(str)
 --   str = "\n<l>"..str
-   str = string.gsub(str, "^%s?(.-)%s?$", "\n<l>%1</l>\n")
+   str = string.gsub(str, "^%s?(.-)\\\\[%!%*]?%s?$", "\n<l>%1</l>\n")
 --   str = gsub(str, endpoem, "</l>\n")
    str = gsub(str, poemline * spcenc^-1 * lpeg.P(">"), "\n<lb/>")
    str = gsub(str, poemline * spcenc^-1, "</l>\n<l>")
@@ -617,7 +720,7 @@
 		 * bsqbrackets
 		 * bsqbrackets
 		 * bcbraces
-		 * bsqbrackets^-1,
+		 * (bsqbrackets + bcbraces)^-1,
 	      function(cmd, pre, post, body, opt)
 		 pre = string.sub(pre, 2, -2)
 		 post = string.sub(post, 2, -2)
@@ -638,7 +741,7 @@
 		 * spcenc^-1
 		 * bsqbrackets
 		 * bcbraces
-		 * bsqbrackets^-1,
+		 * (bsqbrackets + bcbraces)^-1,
 	      function(cmd, post, body, opt)
 		 post = string.sub(post, 2, -2)
 		 body = string.sub(body, 2, -2)
@@ -657,7 +760,7 @@
 		 * citecmds
 		 * spcenc^-1
 		 * bcbraces
-		 * bsqbrackets^-1,
+		 * (bsqbrackets + bcbraces)^-1,
 	      function(cmd, body, opt)
 		 body = string.sub(body, 2, -2)
 		 if not checkxmlid(body)
@@ -709,6 +812,19 @@
 			return string.format("<ref target=\"%s\">%s</ref>",
 					     teisiglum, printsiglum)
    end)
+   str = string.gsub(str, "\\(gap)%s?(%b{})",
+		     function(cmd, body)
+			body = string.sub(body, 2, -2)
+			teireason = get_attr_value(body, "reason")
+			if teireason ~= "" then teireason = " reason=\""..teireason.."\"" else end
+			teiunit = get_attr_value(body, "unit")
+			if teiunit ~= "" then teiunit = " unit=\""..teiunit.."\"" else end
+			teiquantity = get_attr_value(body, "quantity")
+			if teiquantity ~= "" then teiquantity = " quantity=\""..teiquantity.."\"" else end
+			teiextent = get_attr_value(body, "extent")
+			if teiextent ~= "" then teiextent = " extent=\""..teiextent.."\"" else end
+			return string.format("<gap%s%s%s%s/>", teireason, teiunit, teiquantity, teiextent)
+   end)
    str = gsub(str, lpeg.P("\\") * labelrefcmds * spcenc^-1 * bcbraces,
 	      function(cmd, body)
 		 body = string.sub(body, 2, -2)
@@ -1072,6 +1188,7 @@
    str = texpatttotei(str)
    str = note_totei(str)
    str = app_totei(str)
+   str = rdgGrp_totei(str)
    str = lem_rdg_totei(str)
    str = relocate_notes(str)
    str = versetotei(str)
@@ -1117,68 +1234,113 @@
    f:write("<distributor><!-- Distributor name  --></distributor>", "\n")
    f:write("</publicationStmt>", "\n")
    f:write("<sourceDesc>", "\n")
-   f:write("<listWit>", "\n")
-   for i = 1,#listWit do
-      f:write('<witness xml:id=\"', listWit[i].xmlid, "\">", "\n")
-      f:write('<abbr type="siglum">', textotei(listWit[i].abbr), "</abbr>", "\n")
-      f:write(textotei(listWit[i].detailsDesc), "\n")
-      f:write("<msDesc>", "\n")
-      if listWit[i].msIdentifier.settlement == ""
-	 and listWit[i].msIdentifier.institution == ""
-	 and listWit[i].msIdentifier.repository == ""
-	 and listWit[i].msIdentifier.collection == ""
-	 and listWit[i].msIdentifier.idno == ""
-	 and listWit[i].msIdentifier.msName == ""
+   if next(listWit) == nil and next(listPerson) == nil
+   then
+      f:write("<p>No source, born digital</p>", "\n")
+   else
+      if next(listWit) ~= nil
       then
-	 f:write("<msIdentifier/>", "\n")
-      else
-	 f:write("<msIdentifier>", "\n")
-	 if listWit[i].msIdentifier.settlement ~= "" then
-	    f:write("<settlement>", textotei(listWit[i].msIdentifier.settlement), "</settlement>", "\n")
+	 f:write("<listWit>", "\n")
+	 for i = 1,#listWit do
+	    f:write('<witness xml:id=\"', listWit[i].xmlid, "\">", "\n")
+	    f:write('<abbr type="siglum">', textotei(listWit[i].abbr), "</abbr>", "\n")
+	    f:write(textotei(listWit[i].detailsDesc), "\n")
+	    f:write("<msDesc>", "\n")
+	    if listWit[i].msIdentifier.settlement == ""
+	       and listWit[i].msIdentifier.institution == ""
+	       and listWit[i].msIdentifier.repository == ""
+	       and listWit[i].msIdentifier.collection == ""
+	       and listWit[i].msIdentifier.idno == ""
+	       and listWit[i].msIdentifier.msName == ""
+	    then
+	       f:write("<msIdentifier/>", "\n")
+	    else
+	       f:write("<msIdentifier>", "\n")
+	       if listWit[i].msIdentifier.settlement ~= "" then
+		  f:write("<settlement>", textotei(listWit[i].msIdentifier.settlement), "</settlement>", "\n")
 	 else end
-	 if listWit[i].msIdentifier.institution ~= "" then
-	    f:write("<institution>", textotei(listWit[i].msIdentifier.institution), "</institution>", "\n")
+	       if listWit[i].msIdentifier.institution ~= "" then
+		  f:write("<institution>", textotei(listWit[i].msIdentifier.institution), "</institution>", "\n")
 	 else end
-	 if listWit[i].msIdentifier.repository ~= "" then
-	    f:write("<repository>", textotei(listWit[i].msIdentifier.repository), "</repository>", "\n")
+	       if listWit[i].msIdentifier.repository ~= "" then
+		  f:write("<repository>", textotei(listWit[i].msIdentifier.repository), "</repository>", "\n")
 	 else end
-	 if listWit[i].msIdentifier.collection ~= "" then
-	    f:write("<collection>", textotei(listWit[i].msIdentifier.collection), "</collection>", "\n")
+	       if listWit[i].msIdentifier.collection ~= "" then
+		  f:write("<collection>", textotei(listWit[i].msIdentifier.collection), "</collection>", "\n")
 	 else end
-	 if listWit[i].msIdentifier.idno ~= "" then
-	    f:write("<idno>", textotei(listWit[i].msIdentifier.idno), "</idno>", "\n")
+	       if listWit[i].msIdentifier.idno ~= "" then
+		  f:write("<idno>", textotei(listWit[i].msIdentifier.idno), "</idno>", "\n")
 	 else end
-	 if listWit[i].msIdentifier.msName ~= "" then
-	    f:write("<msName>", textotei(listWit[i].msIdentifier.msName), "</msName>", "\n")
+	       if listWit[i].msIdentifier.msName ~= "" then
+		  f:write("<msName>", textotei(listWit[i].msIdentifier.msName), "</msName>", "\n")
 	 else end
-	 f:write("</msIdentifier>", "\n")
+	       f:write("</msIdentifier>", "\n")
+	    end
+	    if listWit[i].handDesc ~= nil then
+	       f:write("<physDesc>", "\n")
+	       f:write("<handDesc hands=\"", #listWit[i].handDesc, "\">", "\n")
+	       local j = 1
+	       while listWit[i].handDesc[j]
+	       do
+		  f:write("<handNote xml:id=\"", listWit[i].handDesc[j].xmlid, "\">", "\n")
+		  f:write('<abbr type="siglum">', textotei(listWit[i].handDesc[j].abbr), "</abbr>", "\n")
+		  f:write("<p>", textotei(listWit[i].handDesc[j].detailsDesc), "</p>", "\n")
+		  f:write("</handNote>", "\n")
+		  j = j + 1
+	       end
+	       f:write("</handDesc>", "\n")
+	       f:write("</physDesc>", "\n")
+      else end
+	    if listWit[i].history ~= nil then
+	       f:write("<history>", "\n")
+	       f:write("<origin>", "\n")
+	       f:write("<origDate>", textotei(listWit[i].history.origin.origDate), "</origDate>", "\n")
+	       f:write("</origin>", "\n")
+	       f:write("</history>", "\n")
+	    end
+	    f:write("</msDesc>", "\n")
+	    f:write("</witness>", "\n")
+	 end
+	 f:write("</listWit>", "\n")
       end
-      if listWit[i].handDesc ~= nil then
-	 f:write("<physDesc>", "\n")
-	 f:write("<handDesc hands=\"", #listWit[i].handDesc, "\">", "\n")
-	 local j = 1
-	 while listWit[i].handDesc[j]
-	 do
-	    f:write("<handNote xml:id=\"", listWit[i].handDesc[j].xmlid, "\">", "\n")
-	    f:write('<abbr type="siglum">', textotei(listWit[i].handDesc[j].abbr), "</abbr>", "\n")
-	    f:write("<p>", textotei(listWit[i].handDesc[j].detailsDesc), "</p>", "\n")
-	    f:write("</handNote>", "\n")
-	    j = j + 1
+      if next(listPerson) ~= nil
+      then
+	 f:write("<listPerson xml:id=\"scholars\">", "\n")
+	 for i = 1,#listPerson do
+	    f:write('<person xml:id=\"', listPerson[i].xmlid, "\">", "\n")
+	    f:write('<persName>', "\n")
+	    f:write('<abbr type="siglum">', textotei(listPerson[i].abbr), "</abbr>", "\n")
+	    if listPerson[i].persName.name ~= nil
+	    then
+	       f:write(textotei(listPerson[i].persName.name))
+	    else
+	       if listPerson[i].persName.forename ~= ""
+	       then
+		  f:write("<forename>", textotei(listPerson[i].persName.forename), "</forename>", "\n")
+	       else
+		  f:write("<forename><!-- forename --></forename>", "\n")
+	       end
+	       if textotei(listPerson[i].persName.surname) ~= ""
+	       then
+		  f:write("<surname>", textotei(listPerson[i].persName.surname), "</surname>", "\n")
+	       else
+		  f:write("<surname><!-- surname --></surname>", "\n")
+	       end
+	       if textotei(listPerson[i].persName.addName) ~= ""
+	       then
+		  f:write("<addName>", textotei(listPerson[i].persName.addName), "</addName>", "\n")
+	       end
+	    end
+	    if listPerson[i].note ~= ""
+	    then
+	       f:write("<note>", textotei(listPerson[i].note), "</note>", "\n")
+	    end
+	    f:write('</persName>', "\n")
+	    f:write('</person>', "\n")
 	 end
-	 f:write("</handDesc>", "\n")
-	 f:write("</physDesc>", "\n")
-      else end
-      if listWit[i].history ~= nil then
-	 f:write("<history>", "\n")
-	 f:write("<origin>", "\n")
-	 f:write("<origDate>", textotei(listWit[i].history.origin.origDate), "</origDate>", "\n")
-	 f:write("</origin>", "\n")
-	 f:write("</history>", "\n")
+	 f:write("</listPerson>", "\n")
       end
-      f:write("</msDesc>", "\n")
-      f:write("</witness>", "\n")
    end
-   f:write("</listWit>", "\n")
    f:write("</sourceDesc>", "\n")
    f:write("</fileDesc>", "\n")
    f:write("<encodingDesc>", "\n")
@@ -1582,10 +1744,10 @@
    return bagunits[teitype]
 end
 
-local function getapplimit(str)
+local function getapplimit(teitype)
    for i = 1,#apparatuses
    do
-      if apparatuses[i].a == str then
+      if apparatuses[i].a == teitype then
 	 limitfound = apparatuses[i].limit
 	 break
       end
@@ -1614,6 +1776,14 @@
    end
 end
 
+function ekdosis.addto_bagunits(teitype, n)
+   if tonumber(getapplimit(teitype)) ~= 0
+   then
+      n = tonumber(n)
+      bagunits[teitype] = bagunits[teitype] - n
+   end
+end
+
 function ekdosis.increment_bagunits(teitype)
    bagunits[teitype] = (bagunits[teitype] or 0) + 1
 end

Modified: trunk/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty	2020-11-04 21:36:26 UTC (rev 56855)
+++ trunk/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty	2020-11-04 21:36:41 UTC (rev 56856)
@@ -41,7 +41,7 @@
 %% Running "make inst" installs the files in the user's TeX tree.
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesPackage{ekdosis}
-    [2020/08/14 v1.0 Typesetting TEI xml compliant critical editions]
+    [2020/11/04 v1.1 Typesetting TEI xml-compliant critical editions]
 \RequirePackage{iftex}
 \RequireLuaTeX
 \RequirePackage{expkv-opt}
@@ -64,6 +64,7 @@
   initial divs = ekdosis,
   unknown-choice divs = \PackageError{ekdosis}{unknown divs=#1}{`divs'
     must be either `ekdosis' or `latex'.},
+  bool verse = \if at pkg@verse,
   choice parnotes = {false = {},
     true = {\@pkg at parnotestrue},
     roman = {\@pkg at parnotestrue\@parnotesromantrue}},
@@ -86,7 +87,6 @@
 \ekvoProcessLocalOptions{ekdosis}
 \RequirePackage{luacode}
 \RequirePackage{paracol}
-\RequirePackage{xparse}
 \RequirePackage{etoolbox}
 \RequirePackage{lineno}
 \RequirePackage{keyfloat}
@@ -94,8 +94,11 @@
 \RequirePackage{zref-user}
 \RequirePackage{zref-abspage}
 \RequirePackage{ltxcmds}
-\RequirePackage{atbegshi}
+\RequirePackage{pdftexcmds}
 \RequirePackage{ifoddpage}
+\if at pkg@verse
+  \RequirePackage{verse}
+\fi
 \if at pkg@parnotes
   \RequirePackage{parnotes}
 \fi
@@ -145,11 +148,32 @@
     \luastringN{#4})}
 }
 \@onlypreamble\DeclareHand
-\NewDocumentCommand{\DeclareScholar}{m m}{
-  \luadirect{ekdosis.newscholar(\luastringN{#1},
+\ekvdefinekeys{ekd at scholar}{
+  store rawname = \rawname at value,
+  store forename = \forename at value,
+  store surname = \surname at value,
+  store addname = \addname at value,
+  store note = \note at value
+}
+\NewDocumentCommand{\DeclareScholar}{m m O{}}{%
+  \bgroup
+  \ekvset{ekd at scholar}{#3}
+    \luadirect{ekdosis.newscholar(
+      \luastringN{#1},
+      \luastringN{#2},
+      \luastringO{\rawname at value},
+      \luastringO{\forename at value},
+      \luastringO{\surname at value},
+      \luastringO{\addname at value},
+      \luastringO{\note at value})}
+    \egroup
+  }
+\@onlypreamble\DeclareScholar
+\NewDocumentCommand{\DeclareSource}{m m}{
+  \luadirect{ekdosis.newsource(\luastringN{#1},
     \luastringN{#2})}
 }
-\@onlypreamble\DeclareScholar
+\@onlypreamble\DeclareSource
 \NewDocumentCommand{\DeclareShorthand}{m m m}{
   \luadirect{ekdosis.newshorthand(\luastringN{#1},
     \luastringN{#2},
@@ -189,7 +213,7 @@
     \luastringN{#4})}
   }
 }
-\NewDocumentCommand{\TeXtoTEIPatt}{m m}{%
+\NewDocumentCommand{\TeXtoTEIPat}{m m}{%
   \luadirect{ekdosis.newpatttotag(\luastringN{#1}, \luastringN{#2})}
 }
 \NewDocumentCommand{\SetTEIFileName}{m}{
@@ -196,10 +220,10 @@
   \luadirect{ekdosis.setteifilename(\luastringN{#1})}
 }
 \@onlypreamble\SetTEIFileName
-\NewDocumentCommand{\SetxmlBibResource}{m}{
-  \luadirect{ekdosis.setxmlbibresource(\luastringN{#1})}
+\NewDocumentCommand{\AddxmlBibResource}{m}{
+  \luadirect{ekdosis.addxmlbibresource(\luastringN{#1})}
 }
-\@onlypreamble\SetxmlBibResource
+\@onlypreamble\AddxmlBibResource
 \newif\ifekd at mapps
 \ekvdefinekeys{ekd at newapp}{
   choice direction = {LR = \def\direction at val{LR},
@@ -236,6 +260,10 @@
   \egroup
 }
 \@onlypreamble\DeclareApparatus
+\NewDocumentCommand{\addentries}{O{\ekdan at type} m}{%
+  \luadirect{ekdosis.addto_bagunits(\luastringO{#1}, \luastringN{#2})}%
+  \ignorespaces
+}
 \newbool{do at app}
 \newif\ifekd at state
 \newif\ifekd at isinapp
@@ -327,6 +355,7 @@
   \ignorespaces}
 \newif\ifsubsq at unit
 \subsq at unittrue
+\newif\ifekd at inside@app
 \def\add@@apparatus{%
   \if at pkg@parnotes\parnotes\else\fi%
   \if at pkg@footins%
@@ -337,8 +366,10 @@
     \if at parnotesroman%
     \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi%
     \parnoteclear\else\fi%
+    \ekd at inside@apptrue
     \footnotesize\apparatus\unless\ifekd at mapps\ekd at end@apparatus\fi%
-    \if at pkg@parnotes\parnotes\parnotereset\else\fi%
+    \ekd at inside@appfalse
+    \if at pkg@parnotes\parnotes\parnotereset\else\fi
   }%
   \egroup%
   \fi%
@@ -348,7 +379,9 @@
     \if at parnotesroman%
     \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi%
     \parnoteclear\else\fi%
+    \ekd at inside@apptrue
     \ekd at appfontsize\apparatus\unless\ifekd at mapps\ekd at end@apparatus\fi%
+    \ekd at inside@appfalse
     \if at pkg@parnotes\parnotes\parnotereset\else\fi%
   }%
   \fi%
@@ -396,7 +429,7 @@
 \NewDocumentCommand{\ekdatbegshihook}{}{%
   \ifekd at pagelineation\resetlinenumber\fi
 }
-\AtBeginShipout{\ekdatbegshihook}
+\AddToHook{shipout/before}{\ekdatbegshihook}
 \newif\ifekd at elidednumbers
 \ekvdefinekeys{ekd at lineation}{
   choice lineation = {page = \ekd at pagelineationtrue,
@@ -405,6 +438,9 @@
     lineation=#1}{`lineation' must be either `page' or `document'.},
   code modulonum = \chardef\c at linenumbermodulo#1\relax,
   noval modulo = \modulolinenumbers,
+  code vmodulonum = \if at pkg@verse\poemlines{#1}\fi,
+  initial vmodulonum = 1,
+  noval vmodulo = \if at pkg@verse\poemlines{5}\fi,
   choice numbers = {elided = \ekd at elidednumberstrue,
     full = \ekd at elidednumbersfalse},
   unknown-choice numbers = \PackageError{ekdosis}{unknown
@@ -429,6 +465,7 @@
 \NewDocumentCommand{\SetDefaultApparatus}{m}{%
   \ekvset{appnote}{type=#1}}
 \NewDocumentCommand{\app}{O{} > { \TrimSpaces } +m}{%
+  \leavevmode
   \begingroup
   \ekvset{appnote}{#1}%
   \ekd at isinapptrue%
@@ -443,9 +480,9 @@
 \def\current at ref@arg#1#2{{%\textdir TLT%
     \unexpanded\expandafter{\ekd at refnumstyle}%
     \ifnum%
-    \getpagerefnumber{#1}
+    \pdf at strcmp{\getpagerefnumber{#1}}{\getpagerefnumber{#2}}
     =
-    \getpagerefnumber{#2}
+    0
     \ifnum%
     \getrefnumber{#1}
     =
@@ -497,9 +534,11 @@
 \def\current at ref{{%\textdir TLT%
     \unexpanded\expandafter{\ekd at refnumstyle}%
     \ifnum%
-    \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}
+    \pdf at strcmp{%
+      \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
+      {\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}
     =
-    \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}
+    0
     \ifnum%
     \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}
     =
@@ -550,6 +589,8 @@
 }
 \ekvdefinekeys{lem}{
   code wit = \def\ekdlr at wit{#1},
+  code source = \def\ekdlr at source{#1},
+  code resp = \def\ekdlr at resp{#1},
   code alt  = \def\ekdlr at alt{#1},
   code pre = \def\ekdlr at pre{#1},
   code post = \def\ekdlr at post{#1},
@@ -563,6 +604,8 @@
 }
 \ekvdefinekeys{rdg}{
   code wit = \def\ekdlr at wit{#1},
+  code source = \def\ekdlr at source{#1},
+  code resp = \def\ekdlr at resp{#1},
   code alt  = \def\ekdlr at alt{#1},
   code pre = \def\ekdlr at pre{#1},
   code post = \def\ekdlr at post{#1},
@@ -571,6 +614,9 @@
   store type = \ekdlr at type,
   bool nordg = \ifekdr at nordg
 }
+\NewDocumentCommand{\rdgGrp}{O{} > {\TrimSpaces } m}{%
+  \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}%
+}
 \NewDocumentCommand{\lem}{O{} m}{%
   \ekd at isinlemtrue%
   \luadirect{ekdosis.dolnlab(\luastringN{#2})}%
@@ -623,6 +669,8 @@
       \fi
       \ifdefined\ekdlr at postwit%
         \space\unexpanded\expandafter{\ekdlr at postwit}\else\fi
+      \ifdefined\ekdlr at resp\space\getsiglum{\ekdlr at resp}\else\fi
+      \ifdefined\ekdlr at source\space\getsiglum{\ekdlr at source}\else\fi
       \ifdefined\ekdlr at wit\space\getsiglum{\ekdlr at wit}\else\fi
       \ifdefined\ekdlr at prewit%
         \space\unexpanded\expandafter{\ekdlr at prewit}\space\else\fi
@@ -660,6 +708,8 @@
       \ifdefined\ekdlr at prewit%
         \space\unexpanded\expandafter{\ekdlr at prewit}\space\else\fi
       \ifdefined\ekdlr at wit\space\getsiglum{\ekdlr at wit}\else\fi
+      \ifdefined\ekdlr at source\space\getsiglum{\ekdlr at source}\else\fi
+      \ifdefined\ekdlr at resp\space\getsiglum{\ekdlr at resp}\else\fi
       \ifdefined\ekdlr at postwit%
         \space\unexpanded\expandafter{\ekdlr at postwit}\else\fi
       \ifekdl at nosep\else\unexpanded\expandafter{\ekdl at sep}\fi
@@ -705,6 +755,8 @@
       \fi
       \ifdefined\ekdlr at postwit%
         \space\unexpanded\expandafter{\ekdlr at postwit}\else\fi
+      \ifdefined\ekdlr at resp\space\getsiglum{\ekdlr at resp}\else\fi
+      \ifdefined\ekdlr at source\space\getsiglum{\ekdlr at source}\else\fi
       \ifdefined\ekdlr at wit\space\getsiglum{\ekdlr at wit}\else\fi
       \ifdefined\ekdlr at prewit%
         \space\unexpanded\expandafter{\ekdlr at prewit}\space\else\fi
@@ -733,6 +785,8 @@
       \ifdefined\ekdlr at prewit%
         \space\unexpanded\expandafter{\ekdlr at prewit}\space\else\fi
       \ifdefined\ekdlr at wit\space\getsiglum{\ekdlr at wit}\else\fi
+      \ifdefined\ekdlr at source\space\getsiglum{\ekdlr at source}\else\fi
+      \ifdefined\ekdlr at resp\space\getsiglum{\ekdlr at resp}\else\fi
       \ifdefined\ekdlr at postwit%
         \space\unexpanded\expandafter{\ekdlr at postwit}\else\fi
     }%
@@ -756,7 +810,7 @@
   initial sep = \ekdsep
 }
 \NewDocumentCommand{\note at noapp}{O{} +m}{%
-  \null
+  \leavevmode
   \bgroup%
   \ekvset{note}{#1}%
   \stepcounter{ekd at lab}%
@@ -834,10 +888,10 @@
   \bgroup%
   \ekvset{ekd at note}{#1}%
   \edef\note at contents{%
-    \ekvifdefinedNoVal{note}{pre}{}{%
+    \ekvifdefinedNoVal{ekd at note}{pre}{}{%
       \unexpanded\expandafter{\pre at value}}%
     {\unexpanded{#2}}%
-    \ekvifdefinedNoVal{note}{post}{}{%
+    \ekvifdefinedNoVal{ekd at note}{post}{}{%
       \unexpanded\expandafter{\post at value}}%
   }%
   \append at app{\note at contents}%
@@ -848,10 +902,10 @@
     \bgroup%
       \ekvset{ekd at note}{#1}%
       \edef\note at contents{%
-        \ekvifdefinedNoVal{note}{pre}{}{%
+        \ekvifdefinedNoVal{ekd at note}{pre}{}{%
           \unexpanded\expandafter{\pre at value}}%
         \unskip\noexpand\parnote{\unexpanded{#2}}%
-        \ekvifdefinedNoVal{note}{post}{}{%
+        \ekvifdefinedNoVal{ekd at note}{post}{}{%
           \unexpanded\expandafter{\post at value}}%
       }%
       \append at app{\note at contents}%
@@ -883,6 +937,51 @@
       \fi%
   \fi%
 }
+\ekvdefinekeys{ekd at corr}{
+  store suppbegin = \suppb at value,
+  store suppend = \suppe at value,
+  store delbegin = \delb at value,
+  store delend = \dele at value,
+  store sicbegin = \sicb at value,
+  store sicend = \sice at value,
+  store gapmark = \gapm at value,
+  initial suppbegin = \ifbool{al at rlmode}{>}{<},
+  initial suppend = \ifbool{al at rlmode}{<}{>},
+  initial delbegin = \ifbool{al at rlmode}{\}}{\{},
+  initial delend = \ifbool{al at rlmode}{\{}{\}},
+  initial sicbegin = \dag,
+  initial sicend = \dag,
+  initial gapmark = ***
+}
+\NewDocumentCommand{\supplied}{m}{%
+  \ifekd at inside@app
+  #1%
+  \else
+  \suppb at value #1\suppe at value
+  \fi
+}
+\NewDocumentCommand{\surplus}{m}{%
+  \ifekd at inside@app
+  #1%
+  \else
+  \delb at value #1\dele at value
+  \fi
+}
+\NewDocumentCommand{\sic}{s m}{%
+  \ifekd at inside@app
+  #2%
+  \else
+  \IfBooleanTF{#1}
+    {\sicb at value #2}
+    {\sicb at value #2\sice at value}%
+  \fi
+}
+\NewDocumentCommand{\gap}{m}{%
+  \gapm at value
+}
+\NewDocumentCommand{\SetCritSymbols}{m}{
+  \ekvset{ekd at corr}{#1}
+}
 \NewDocumentCommand{\apparatus}{}{%
   \luadirect{tex.sprint(ekdosis.appout())}}
 \NewDocumentCommand{\test at apparatus}{}{%
@@ -1048,9 +1147,39 @@
   \fi
   \endgroup
 }
+\if at pkg@verse
+\verselinenumfont{\normalfont\footnotesize}
+\setcounter{poemline}{1}
+\NewDocumentEnvironment{ekdverse}{O{\linewidth}}{%
+  \nolinenumbers
+  \let\linelabel\label
+  \stepcounter{verse at envctr}%
+  \addtocounter{poemline}{-1}\refstepcounter{poemline}%
+  \setcounter{vslineno}{1}%
+  \let\\=\@vscentercr
+  \list{}{\itemsep \z@
+          \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}
-\newenvironment*{ekdverse}[1][\ekdverseindentlength]{
+\NewDocumentEnvironment{ekdverse}{O{\ekdverseindentlength}}{
   \begin{list}{}{%
       \setlength{\leftmargin}{#1}
       \setlength{\itemsep}{0pt}
@@ -1059,6 +1188,7 @@
     }
   \item[]
   }{\end{list}}
+\fi
 \NewDocumentEnvironment{ekdpar}{}{\par}{\par}
 \endinput
 %%



More information about the tex-live-commits mailing list.