From 76cf94c130ce042b2d2f2fd67258ba5815976abe Mon Sep 17 00:00:00 2001
From: Norbert Preining #1#2}
+\DeclareSource{shGildon1710}{G}
+\DeclareSource{shGildon1714}{G\textsuperscript{2}}
+\DeclareSource{shSewell1725}{S}
+\DeclareSource{shEwing1771}{E}
+\DeclareSource{shHudson1856}{Hu\textsuperscript{2}}
+\DeclareSource{shButler1899}{But}
+\DeclareSource{shWalsh1908}{Wa}
+\DeclareScholar{shGod}{Godwin}[rawname=Godwin]
+\DeclareScholar{shStee}{Stee}[rawname=Steevens, note=Notes in Malone]
\end{filecontents}
\documentclass{ltxdoc}
%\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry}
@@ -358,28 +521,27 @@ along with this program. If not, see
\doxitem{Option}{option}{options}
\usepackage{microtype}
\usepackage[no-math]{fontspec}
+\defaultfontfeatures{Renderer=Harfbuzz}
\usepackage[latin.classic,greek.ancient,american]{babel}
-\babelfont{rm}[
- SlantedFont={Old Standard},
- SlantedFeatures={FakeSlant=0.25},
- BoldSlantedFont={Old Standard},
- BoldSlantedFeatures={FakeBold=1.5,FakeSlant=0.25}]{Old Standard}
+\babelfont{rm}{Old Standard}
\babelfont{sf}{NewComputerModern Sans}
\babelfont{tt}{NewComputerModern Mono}
\babelfont[greek]{rm}[
- Script=Greek, RawFeature={+ss05;+ss06},
- SlantedFont={Old Standard},
- SlantedFeatures={FakeSlant=0.25},
- BoldSlantedFont={Old Standard},
- BoldSlantedFeatures={FakeBold=1.5,FakeSlant=0.25}]{Old Standard}
+ Script=Greek,
+ RawFeature={+ss05;+ss06}
+ ]{Old Standard}
\babelfont[greek]{sf}[Script=Greek]{NewComputerModern Sans}
\babelfont[greek]{tt}[Script=Greek]{NewComputerModern Mono}
+\newfontfamily{\junicode}{Junicode}[
+ Ligatures=TeX,
+ RawFeature={+hist}]
\babeltags{ancientgreek = greek}
\def\sg#1{\textancientgreek{#1}}
\usepackage[Old Standard]{mathfont}
+\usepackage[biblatex=true]{embrac}
+\usepackage{chifoot}
\usepackage{arabluatex}
-\usepackage[parnotes=roman,teiexport=tidy,verse]{ekdosis}
-\input{ekdosis-cfg}
+\usepackage[parnotes=roman, teiexport=tidy, poetry=verse]{ekdosis}
\AddxmlBibResource{bibdata.xml}
\usepackage{booktabs}
\usepackage{xltabular}
@@ -430,6 +592,7 @@ along with this program. If not, see
\usepackage[defaultindex=none,citecmd=autocite]{icite}
\bibinput{ekdosis}
\usepackage[nospace,american]{varioref}
+\newcommand\phts{\phantomsection}
\usepackage[style=oxnotes-inote,dashed]{biblatex}
\DeclareSourcemap{
\maps[datatype=bibtex]{
@@ -458,6 +621,15 @@ along with this program. If not, see
\DeclareOpenAccessEprintUrl[always]{hal}{%
http://hal.archives-ouvertes.fr/\thefield{eprint}}
\DeclareOpenAccessEprintAlias{HAL}{hal}
+\newcommand*{\jdmdhurl}[1]{https://jdmdh.episciences.org/#1}
+\DeclareFieldFormat{eprint:jdmdh}{%
+ \ifhyperref
+ {\href{\jdmdhurl{#1}}{jdmdh:~\nolinkurl{#1}}}
+ {jdmdh:~\nolinkurl{#1}}}
+\DeclareFieldAlias{eprint:JDMDH}{eprint:jdmdh}
+\DeclareOpenAccessEprintUrl[always]{jdmdh}{%
+ https://jdmdh.episciences.org/\thefield{eprint}}
+\DeclareOpenAccessEprintAlias{JDMDH}{jdmdh}
\addbibresource{ekdosis.bib}
\metaset{titletext}{%
\metapick[#1]{title}%
@@ -491,7 +663,7 @@ along with this program. If not, see
\metaset{partof}{The ekdosis Package}
\metaset[print]{partof}{The \textsf{ekdosis} Package}
\metaset{copyrightowner}{\metapick[#1]{author}}
-\metaset{copyrightdate}{2020}
+\metaset{copyrightdate}{2020--2021}
\metaset{licensemessage}{Permission is granted to copy, distribute
and/or modify this document under the terms of the GNU Free
Documentation License, Version 1.3 or any later version published by
@@ -555,6 +727,7 @@ along with this program. If not, see
xleftmargin=12pt, breaklines, numberblanklines=false, numbersep=3pt}
\renewcommand{\theFancyVerbLine}{\normalfont\smaller\arabic{FancyVerbLine}}
\usepackage[contents]{colordoc}
+\newcommand{\cls}[1]{\textsf{#1}\index{#1=#1 (class)}}
\newcommand{\pkg}[1]{\textsf{#1}\index{#1=#1 (package)}}
\newcommand{\env}[1]{\texttt{#1}\index{#1=#1 (environment)}}
\backgroundcolor{c}{ekdcolor}
@@ -607,7 +780,7 @@ along with this program. If not, see
%
% \fi
%
-% \CheckSum{1893}
+% \CheckSum{2188}
%
% \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
@@ -688,7 +861,7 @@ along with this program. If not, see
% \item website: \url{http://www.robertalessi.net/ekdosis}
% \item development: \url{http://git.robertalessi.net/ekdosis}
% \item comments, feature requests, bug reports:
-% \url{https://gitlab.com/ralessi/eksodis/issues}
+% \url{https://gitlab.com/ralessi/ekdosis/issues}
% \end{itemize}
%
% \leavevmode\marginpar{\hfill\texttt{gpl3+}}
@@ -743,8 +916,7 @@ along with this program. If not, see
% \end{comment}
%
% The reader will find here, by way of introduction, a summarized
-% version of the first part of an article that the author submitted
-% some weeks ago to the
+% version of the first part of an article published in the
% \mkbibemph{\citefield{Alessi2020}{journaltitle}} as a contribution
% to a Digital Humanities workshop held at Stanford University
% (\printdate{2019-04-15}).\footcite{Alessi2020}
@@ -820,7 +992,7 @@ along with this program. If not, see
% \label{sec:features}
% A list of the main features of \pkg{ekdosis} follows:---
% \begin{enumerate}
-% \item \label{it:multicol-feature}\emph{Multilingual critical
+% \item \phts\label{it:multicol-feature}\emph{Multilingual critical
% editions\/}: \pkg{ekdosis} can be used to typeset any number of
% texts in any direction accepted by \hologo{LuaTeX}. Running
% paragraphs of text can be arranged in any number of columns,
@@ -828,7 +1000,7 @@ along with this program. If not, see
% synchronized or not. \pkg{ekdosis} is also suitable for complex
% layouts as in the case of Arabic poetry or images where three-way
% alignment is required, or diagrams, \emph{\&c}.
-% \item \label{it:multilayer-feature}\emph{Apparatus criticus\/}:
+% \item \phts\label{it:multilayer-feature}\emph{Apparatus criticus\/}:
% Edited texts can receive multiple layers of apparatus, e.g.\
% apparatus criticus (to record variant readings), apparatus fontium
% (to collect references to texts quoted or cited in the edited
@@ -931,8 +1103,8 @@ along with this program. If not, see
% \section{The Basics of \pkg{ekdosis}}
% \label{sec:ekdosis-basics}
%
-%\subsection{Loading the Package\---General Options}
-%\label{sec:load-general-options}
+% \subsection{Loading the Package\---General Options}
+% \label{sec:load-general-options}
%
% \pkg{ekdosis} is loaded in the preamble like so:---
% \iffalse
@@ -945,7 +1117,7 @@ along with this program. If not, see
%
% \fi
%
-% \pkg{ekdosis} may be loaded with four optional \enquote*{named
+% \pkg{ekdosis} may be loaded with five optional \enquote*{named
% arguments} either of which is set using the syntax
% \meta{key}$=$\meta{value}. The description of the optional arguments
% follows.
@@ -953,7 +1125,7 @@ along with this program. If not, see
% \danger The reader is invited to refer to the relevant sections of
% this documentation for more information on how to use them.
%
-% \DescribeOption{layout}\label{ref:layout-opt}
+% \DescribeOption{layout}\phts\label{ref:layout-opt}
% |layout|$=$\verb+float|footins+\hfill\tcboxverb{Default: float}\\
% By default, layers of critical notes are inserted as a floating
% environment to be printed at the bottom of pages. |layout=footins|
@@ -963,7 +1135,7 @@ along with this program. If not, see
% will be inserted between regular numbered footnotes, but will carry
% no footnote mark of its own.
%
-% \DescribeOption{divs}\label{ref:divs-opt}
+% \DescribeOption{divs}\phts\label{ref:divs-opt}
% |divs|$=$\verb+ekdosis|latex+\hfill\tcboxverb{Default: ekdosis}\\
% In many occasions, \LaTeX{} standard textual divisions do not meet
% the specific requirements of classical and literary texts, the
@@ -978,22 +1150,33 @@ along with this program. If not, see
%
% \danger It must be noted that the two styles are mutually exclusive.
% \vskip\baselineskip
-%
-% \DescribeOption{parnotes}\label{ref:parnotes-opt}
+%
+% \DescribeOption{poetry}\phts\label{ref:poetry-opt}
+% \newfeature[v1.2] |poetry|$=$\verb+verse+
+% \hfill\tcboxverb{Default: not set}\\
+% |poetry=verse| instructs \pkg{ekdosis} to load and use the facilites
+% supplied by the \pkg{verse} package for the typesetting of lines of
+% poetry.\footnote{\texttt{verse} does not need to be set if the
+% \cls{memoir} class be used. See \vref{sec:verse-package} for more
+% detail.} The \env{ekdverse} environment must then be used instead of
+% the \env{verse} environment that is provided by the \pkg{verse}
+% package as described below in \vref{sec:verse-package}.
+%
+% \DescribeOption{parnotes}\phts\label{ref:parnotes-opt}
% |parnotes|$=$\verb+true|false|roman+%
% \hfill\tcboxverb{Default: not set}\\
% This named argument does not need a value as it defaults to |true|
-% if it is used. Apparatus criticus typeset by \pkg{ekdosis} may
-% contain notes and footnotes. The latter can be laid out as
-% paragraphed notes below the block of critical notes by means of the
-% \pkg{parnotes} package. Additionally, |parnotes=roman| prints these
-% footnotes numbered with Roman numerals.
+% if used. Apparatus criticus typeset by \pkg{ekdosis} may contain
+% notes and footnotes. The latter can be laid out as paragraphed notes
+% below the block of critical notes by means of the \pkg{parnotes}
+% package. Additionally, |parnotes=roman| prints these footnotes
+% numbered with Roman numerals.
%
-% \DescribeOption{teiexport}\label{ref:teiexport-option}
+% \DescribeOption{teiexport}\phts\label{ref:teiexport-option}
% |teiexport|$=$\verb+true|false|tidy+%
% \hfill\tcboxverb{Default: not set}\\
% This named argument does not need a value as it defaults to |true|
-% if it is used. If |teiexport| be set to |true|, \pkg{ekdosis} is
+% if used. If |teiexport| be set to |true|, \pkg{ekdosis} is
% instructed to output both PDF and \texttt{TEI xml} files at the same
% time. By default, the \texttt{TEI} file will receive the same
% basename as the |.tex| source file, suffixed with |-tei.xml|. The
@@ -1020,6 +1203,18 @@ along with this program. If not, see
%
% \fi
%
+% \subsection{Using a Configuration File}
+% \label{sec:using-conf-file}
+% Complex editions may use a large number of witnesses, sources and
+% scholars. It may also be required to define a multiple-layer
+% apparatus criticus, several text environments to be aligned and
+% quite a number of new commands. \pkg{ekdosis} provides a convenient
+% way to avoid overloading the document preamble: all the settings
+% related to the critical edition can be gathered in a separate
+% configuration file named |\jobname-ekd.cfg|. If such a file can be
+% found, its contents is automatically read and used by
+% \pkg{ekdosis}.
+%
% \subsection{Witnesses, Hands, Sources, Scholars \& Shorthands}
% \label{sec:declarations}
% \paragraph{Terminology}
@@ -1046,7 +1241,7 @@ along with this program. If not, see
% \paragraph{Witnesses}
% \DescribeMacro{\DeclareWitness} \cs{DeclareWitness}\marg{unique
% id}\marg{rendition}\marg{description}\oarg{options}
-% \label{ref:declarewitness}\\
+% \phts\label{ref:declarewitness}\\
% This command requires three mandatory arguments enclosed between
% curly braces used to specify consecutively:
% \begin{enumerate}
@@ -1065,9 +1260,9 @@ along with this program. If not, see
% comma-separated list of the following \enquote{name=value} arguments
% that are used to collect items of information to be found within
% the |
Tell me, O Muse, of the man of many devices, who + wandered full many ways after he had sacked the sacred + citadel of Troy. Many were the men whose cities he saw and + whose mind he learned, aye, and many the woes he suffered + in his heart upon the sea, seeking to win his own life and + the return of his comrades.
+| element, such as \env{ekdpar} +% associated with the \texttt{xml} element |
|, such as \env{ekdpar}
% or any other environment declared as such by means of \cs{EnvtoTEI}
% described below in \vref{sec:new-cmds-envs}. A typical use case of
% |autopar=false| is provided below in
@@ -4541,8 +5551,8 @@ subtype="arabtex">'inna 'abI kAna mina
%
% \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
+% unique in the document. As \LaTeX\ will issue warnings if duplicates
+% be found, \cs{ekdosis} does not check their uniqueness but will
% issue warnings if such labels contain invalid strings.
%
% \subsection{Routine \LaTeX\ Commands and Environments}
@@ -4576,6 +5586,12 @@ subtype="arabtex">'inna 'abI kAna mina
% \cs{vpageref}|{label}| & |
| \\ % |quoting| & |
| \\ -% |ekdpar| & || \\ -% |ekdverse| & |
| respectively. % -% For the same simple reason, if one wishes to have words within a +% For the same simple reason, should one wish to have words within a % \texttt{TEI xml} element that does not have any \LaTeX\ equivalent, % all is needed is to define an inoperative \LaTeX\ command named % after the \texttt{TEI} element, like so:--- @@ -4816,6 +5830,7 @@ many mathematical writings and to the sense of % \fi % % \DescribeMacro{\TeXtoTEIPat} +% \phts\label{ref: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} @@ -5055,7 +6070,7 @@ Sample text with a \textcolor{red}{word} in red. % % \fi % -% \label{ref:ekdverse-ex} +% \phts\label{ref:ekdverse-ex} % Finally, an extract of Silius Italicus' \emph{Punica}, Book~9, % ll.~30-2 follows (|.tex| source file, PDF output and \texttt{TEI} % output files):--- @@ -5106,7 +6121,7 @@ Sample text with a \textcolor{red}{word} in red. % % \needspace{7\baselineskip} % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] -% \setverselinenums{30}{0} +% \resetlinenumber\resetvlinenumber[30] % \setlength{\vrightskip}{-1.5in} % \begin{specimen} % \begin{ekdverse} @@ -5360,23 +6375,24 @@ Sample text with a \textcolor{red}{word} in red. % \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. +% 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} -% \item Poetry: The standard \env{verse} environment is supported by -% the current version of \pkg{ekdosis}, in addition to -% \env{ekdverse} an example of which has been provided above -% \vpageref{ref:ekdverse-ex}. \env{ekdverse} will provide refined -% options, such as metrical analysis, stanzaic forms, \emph{\&c.} -% Arabic poetry through the environments and commands provided by -% the \pkg{arabluatex} package will also be supported. +% \item Poetry: \pkg{ekdosis} is now able to load and use the +% facilities provided by the \pkg{verse} package. Refined options +% will be added, such as metrical analysis. Arabic poetry through +% the environments and commands provided by the \pkg{arabluatex} +% package will also be supported. Other packages will also be +% considered for inclusion, such as \pkg{poetry} or +% \pkg{teubner}. In the end, \pkg{ekdosis} will provide a way for +% the typesetting of poetry which will allow for more flexibility +% and compatibility with \texttt{TEI xml}. % \item Correspondence and alignment, segmentation: The functions -% are being tested at the time of writing and will be included -% shortly in \pkg{ekdosis}. +% are being tested at the time of writing and will be included in +% \pkg{ekdosis}. % \end{enumerate} % \item Medium-term: Indexing, commands and environments for specific % modules of the \texttt{TEI}. @@ -6022,6 +7038,7 @@ Sample text with a \textcolor{red}{word} in red. \newif\if@parnotesroman \newif\if@pkg@parnotes \newif\iftei@export +\newif\if@pkg@poetry@verse \ekvdefinekeys{ekdosis}{ choice layout = {float = {\@pkg@floattrue}, footins = {\@pkg@floatfalse\@pkg@footinstrue}}, @@ -6034,7 +7051,9 @@ Sample text with a \textcolor{red}{word} in red. initial divs = ekdosis, unknown-choice divs = \PackageError{ekdosis}{unknown divs=#1}{`divs' must be either `ekdosis' or `latex'.}, - bool verse = \if@pkg@verse, + choice poetry = {verse = {\@pkg@poetry@versetrue}}, + unknown-choice poetry = \PackageError{ekdosis}{unknown + poetry=#1}{`poetry' must be `verse' for now.}, choice parnotes = {false = {}, true = {\@pkg@parnotestrue}, roman = {\@pkg@parnotestrue\@parnotesromantrue}}, @@ -6055,6 +7074,9 @@ Sample text with a \textcolor{red}{word} in red. `tidy'.} } \ekvoProcessLocalOptions{ekdosis} +\newif\ifekd@memoir@loaded +\@ifclassloaded{memoir}{% + \ekd@memoir@loadedtrue\@pkg@poetry@versetrue}{} % \end{macrocode} % \paragraph{Required Packages} \label{ref:ekdrequirements} In % addition to \pkg{iftex}, \pkg{expkv-opt} and \pkg{expkv-def}, a list @@ -6074,7 +7096,7 @@ Sample text with a \textcolor{red}{word} in red. \RequirePackage{ltxcmds} \RequirePackage{pdftexcmds} \RequirePackage{ifoddpage} -\if@pkg@verse +\if@pkg@poetry@verse \RequirePackage{verse} \fi \if@pkg@parnotes @@ -6094,14 +7116,25 @@ Sample text with a \textcolor{red}{word} in red. % hooks meant to be shared by all declared apparatuses, such as the % font size, the format of numerals, \emph{\&c.} This command can be % used in the preamble or at any point of the document. +% \changes{v1.2}{2021/04/02}{general hooks: new option +% \texttt{lemmastyle}} +% \changes{v1.2}{2021/04/02}{general hooks: new option +% \texttt{readingstyle}} % \begin{macrocode} \ekvdefinekeys{ekd@hooks}{ store appfontsize = \ekd@appfontsize, store refnumstyle = \ekd@refnumstyle, store postrefnum = \ekd@postrefnum, + store lemmastyle = \ekd@lemmastyle, + store readingstyle = \ekd@readingstyle, + code initialrule = \def\ekd@initial@rule{#1\NLS}, + default initialrule = \rule{0.4\columnwidth}{0.4pt}, + noval noinitialrule = \undef\ekd@initial@rule, initial appfontsize = \footnotesize, initial refnumstyle = \bfseries, - initial postrefnum = ~ + initial postrefnum = ~, + initial lemmastyle = {}, + initial readingstyle = {} } \NewDocumentCommand{\SetHooks}{m}{\ekvset{ekd@hooks}{#1}} % \end{macrocode} @@ -6378,6 +7411,7 @@ Sample text with a \textcolor{red}{word} in red. store bhook = \bhook@val, store ehook = \ehook@val, store maxentries = \limit@val, + store lang = \lang@val, initial direction = LR, initial delim = {}, initial ehook = {\csname ekd@end@apparatus\endcsname} @@ -6409,12 +7443,14 @@ Sample text with a \textcolor{red}{word} in red. \luastringO{\sep@val}, \luastringO{\bhook@val}, \luastringO{\ehook@val}, - \luastringO{\limit@val} + \luastringO{\limit@val}, + \luastringO{\lang@val} )} \egroup } \@onlypreamble\DeclareApparatus % \end{macrocode} +% \end{macro} % \begin{macro}{\addentries} % \changes{v1.1}{2020/11/04}{modifies the number of accepted entries % on the current page.} @@ -6432,6 +7468,37 @@ Sample text with a \textcolor{red}{word} in red. } % \end{macrocode} % \end{macro} +% \begin{macro}{\ekdpb} +% \changes{v1.2}{2021/04/02}{conditional page breaks} +% \cs{ekdpk}\oarg{page no}\marg{line no} is used to insert conditional +% page breaks by specifying that the page break should occur only on a +% given line and optionally a given page. If the specified conditions +% are met then this command triggers \cs{pagebreak}. +% \begin{macrocode} +\NewDocumentCommand{\ekdpb}{o m}{% + \def\@tmpoarg{#1}% + \def\@tmpmarg{#2}% + \luadirect{ekdosis.dolnlab(\luastringN{#2})}% + \linelabel{\luadirect{tex.sprint(ekdosis.getlnlab())}}% + \def\tmp@ln{% + \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% + \def\tmp@pg{% + \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% + \IfNoValueTF{#1} + {\ifnum + \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 + \pagebreak + \fi} + {\ifnum + \pdf@strcmp{\@tmpoarg}{\tmp@pg} = 0 + \ifnum + \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 + \pagebreak + \fi + \fi + }\ignorespaces +} +% \end{macrocode} % \end{macro} % Apparatus-related settings and functions. Some booleans to check if % an apparatus should be inserted and what is the current environment. @@ -6471,8 +7538,8 @@ Sample text with a \textcolor{red}{word} in red. % global optional argument |layout| be set to |footins|. Therefore, it % is not documented. % \begin{macrocode} - % \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext} -\def\blfootnote{\gdef\@thefnmark{}\@blfootnotetext} +\def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext} + % \def\blfootnote{\gdef\@thefnmark{}\@blfootnotetext} \long\def\@blfootnotetext#1{\insert\footins{% \reset@font\footnotesize \interlinepenalty\interfootnotelinepenalty @@ -6512,7 +7579,9 @@ Sample text with a \textcolor{red}{word} in red. initial delim = {}, store rule = \ekd@default@rule, initial rule = \rule{0.4\columnwidth}{0.4pt}, - noval norule = \def\ekd@default@rule{\mbox{}} + noval norule = \def\ekd@default@rule{\mbox{}}, + store lang = \ekd@singleapp@lang, + initial lang = \ltx@ifpackageloaded{babel}{\languagename}{} } % \end{macrocode} % \begin{macro}{\SetApparatus} @@ -6570,6 +7639,17 @@ Sample text with a \textcolor{red}{word} in red. \NewDocumentCommand{\SetUnitDelimiter}{m}{\def\ekd@unit@delim{#1}} % \end{macrocode} % \end{macro} +% \begin{macro}{\SetApparatusLanguage} +% \changes{v1.2}{2021/04/02}{defines an alternate language to be +% applied in apparatus entries} +% \cs{SetApparatusLang}\marg{languagename} can be used when +% it is needed to apply in the apparatus criticus a language +% different from the one that is selected in the edition text. +% \begin{macrocode} +\NewDocumentCommand{\SetApparatusLanguage}{m}{% + \def\ekd@singleapp@lang{#1}} +% \end{macrocode} +% \end{macro} % \begin{macro}{\footnoteruletrue} % \begin{macro}{\footnoterulefalse} % As \pkg{ekdosis} takes care of drawing a rule separating the main @@ -6614,17 +7694,20 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % \begin{macro}{\NLS} -% \cs{NLS} is adapted from a snippet written by Heiko Oberdiek. It is -% used by \pkg{ekdosis} internally to prevent page breaks between -% separating rules and subsequent notes. Therefore, it is not -% documented. +% \cs{NLS} was previously adapted from a snippet written by Heiko +% Oberdiek. It is used by \pkg{ekdosis} internally to prevent page +% breaks between separating rules and subsequent notes. Therefore, it +% is not documented. % \begin{macrocode} \newcommand*{\NLS}{% - \par% - \nobreak% - \vspace{-\parskip}% - \noindent% - \ignorespaces} + \nobreak\@normalcr\relax + % \par + % \nobreak + % \vspace{-\parskip}% + % \leavevmode + % \noindent + % \ignorespaces +} % \end{macrocode} % \end{macro} % This boolean is used to test if a given entry is to be preceded by a @@ -6641,34 +7724,53 @@ Sample text with a \textcolor{red}{word} in red. % \begin{macrocode} \newif\ifekd@inside@app \def\add@@apparatus{% - \if@pkg@parnotes\parnotes\else\fi% - \if@pkg@footins% - \bgroup% - \ifrtl@app\setRL\else\setLR\fi% + \if@pkg@parnotes\parnotes\else\fi + \if@pkg@footins + \bgroup + \unless\ifekd@mapps + \ifrtl@app\pardir TRT\leavevmode\textdir TRT\else + \pardir TLT\leavevmode\textdir TLT\fi + \fi \blfootnote{% - \if@pkg@parnotes% - \if@parnotesroman% - \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi% - \parnoteclear\else\fi% + \if@pkg@parnotes + \if@parnotesroman + \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi + \parnoteclear\else\fi \ekd@inside@apptrue - \footnotesize\apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi% + \ekd@appfontsize + \ifekd@mapps + \ifdefined\ekd@initial@rule + \ekd@initial@rule + \fi + \fi + \apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi \ekd@inside@appfalse \if@pkg@parnotes\parnotes\parnotereset\else\fi }% - \egroup% - \fi% - \if@pkg@float% - \keyparbox[!b]{}{\ifrtl@app\setRL\else\setLR\fi% - \if@pkg@parnotes% - \if@parnotesroman% - \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi% - \parnoteclear\else\fi% + \egroup + \fi + \if@pkg@float + \keyparbox[!b]{}{% + \unless\ifekd@mapps + \ifrtl@app\pardir TRT\leavevmode\textdir TRT\else + \pardir TLT\leavevmode\textdir TLT\fi + \fi + \if@pkg@parnotes + \if@parnotesroman + \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi + \parnoteclear\else\fi \ekd@inside@apptrue - \ekd@appfontsize\apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi% + \ekd@appfontsize + \ifekd@mapps + \ifdefined\ekd@initial@rule + \ekd@initial@rule + \fi + \fi + \apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi \ekd@inside@appfalse - \if@pkg@parnotes\parnotes\parnotereset\else\fi% + \if@pkg@parnotes\parnotes\parnotereset\else\fi }% - \fi% + \fi } % \end{macrocode} % Before inserting any new entry, \cs{add@apparatus} calls @@ -6709,8 +7811,8 @@ Sample text with a \textcolor{red}{word} in red. % addition to \cs{rightlinenum{\allowbreak}bers} and % \cs{leftlinenumbers}. % \begin{macrocode} -\def\outerlinenumbers{ - \def\makeLineNumberRunning{ +\def\outerlinenumbers{% + \def\makeLineNumberRunning{% \checkoddpage \ifoddpage \linenumberfont\hskip\linenumbersep\hskip\textwidth @@ -6718,10 +7820,10 @@ Sample text with a \textcolor{red}{word} in red. \else \hss\linenumberfont\LineNumber\hskip\linenumbersep \fi - } + }% } -\def\innerlinenumbers{ - \def\makeLineNumberRunning{ +\def\innerlinenumbers{% + \def\makeLineNumberRunning{% \checkoddpage \ifoddpage \hss\linenumberfont\LineNumber\hskip\linenumbersep @@ -6729,7 +7831,7 @@ Sample text with a \textcolor{red}{word} in red. \linenumberfont\hskip\linenumbersep\hskip\textwidth \hbox to\linenumberwidth{\hss\LineNumber}\hss \fi - } + }% } % \end{macrocode} % \end{macro} @@ -6739,6 +7841,7 @@ Sample text with a \textcolor{red}{word} in red. % numbering should start afresh at the top of each page. % \begin{macrocode} \newif\ifekd@pagelineation +\newif\ifekd@pagevlineation \NewDocumentCommand{\ekdatbegshihook}{}{% \ifekd@pagelineation\resetlinenumber\fi } @@ -6749,11 +7852,17 @@ Sample text with a \textcolor{red}{word} in red. document = \ekd@pagelineationfalse}, unknown-choice lineation = \PackageError{ekdosis}{unknown lineation=#1}{`lineation' must be either `page' or `document'.}, + choice vlineation = {page = \ekd@pagevlineationtrue, + document = \ekd@pagevlineationfalse}, + unknown-choice vlineation = \PackageError{ekdosis}{unknown + vlineation=#1}{`vlineation' must be either `page' or `document'.}, code modulonum = \chardef\c@linenumbermodulo#1\relax, noval modulo = \modulolinenumbers, - code vmodulonum = \if@pkg@verse\poemlines{#1}\fi, - initial vmodulonum = 1, - noval vmodulo = \if@pkg@verse\poemlines{5}\fi, + code vmodulo = \ifekd@memoir@loaded\linenumberfrequency{#1} + \else\if@pkg@poetry@verse\poemlines{#1}\fi\fi, + initial vmodulo = 1, + default vmodulo = 5, + bool continuousvnum = \if@continuous@vnum, choice numbers = {elided = \ekd@elidednumberstrue, full = \ekd@elidednumbersfalse}, unknown-choice numbers = \PackageError{ekdosis}{unknown @@ -6765,7 +7874,12 @@ Sample text with a \textcolor{red}{word} in red. outer = \outerlinenumbers}, unknown-choice margin = \PackageError{ekdosis}{unknown margin=#1}{`margin' must be either `left', `right', \MessageBreak - `inner' or `outer'} + `inner' or `outer'}, + choice vmargin = { + right = \if@pkg@poetry@verse\verselinenumbersright\fi, + left = \if@pkg@poetry@verse\verselinenumbersleft\fi}, + unknown-choice vmargin = \PackageError{ekdosis}{unknown + vmargin=#1}{`margin' must be either `left' ot `right'} } % \end{macrocode} % \begin{macro}{\SetLineation} @@ -6830,52 +7944,55 @@ Sample text with a \textcolor{red}{word} in red. = 0 \ifnum% - \getrefnumber{#1} + \pdf@strcmp{\getrefnumber{#1}}{\getrefnumber{#2}} = - \getrefnumber{#2} - % + 0 + % \ifekd@mapps% \ifbool{subsq@unit@\ekdan@type}{% \ifnum% - \getrefnumber{#1} + \pdf@strcmp{\getrefnumber{#1}}{% + \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}}} = - \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}} + 0 \else - \LRnum{\getrefnumber{#1}}% issue the no + \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% issue the no \fi% }% - {\LRnum{\getrefnumber{#1}}}% issue the no + {\LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}}% issue the no \else \ifsubsq@unit% - % + % \ifnum% - \getrefnumber{#1} + \pdf@strcmp{\getrefnumber{#1}}{% + \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}}} = - \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}} + 0 \else - \LRnum{\getrefnumber{#1}}% issue the no + \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% issue the no \fi - % + % \else - \LRnum{\getrefnumber{#1}}% issue the no + \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% issue the no \fi \fi - % + % \else \ifekd@elidednumbers \luadirect{tex.sprint(ekdosis.numrange(\luastring{\getrefnumber{#1}}, \luastring{\getrefnumber{#2}}))}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the nos \else \LRnum{\getrefnumber{#1}}--% - \LRnum{\getrefnumber{#2}}% issue the nos + \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}% issue the nos \fi \fi% \else \LRnum{\getrefnumber{#1}}--% \LRnum{\getpagerefnumber{#2}}.% - \LRnum{\getrefnumber{#2}}% issue pg and ln nos + \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos \fi% - }\unexpanded\expandafter{\ekd@postrefnum}% + }% } % \end{macrocode} % \cs{current@ref} is pretty much the same as \cs{current@reg@arg}, @@ -6891,52 +8008,63 @@ Sample text with a \textcolor{red}{word} in red. = 0 \ifnum% - \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b} + \pdf@strcmp{% + \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}} = - \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e} - % + 0 + % \ifekd@mapps% \ifbool{subsq@unit@\ekdan@type}{% \ifnum% - \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b} + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}} = - \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b} + 0 \else - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% issue the no + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no \fi% - }{\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}}% issue the no + }{\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}}% issue the no \else \ifsubsq@unit% - % + % \ifnum% - \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b} + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}} = - \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b} + 0 \else - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% issue the no + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no \fi - % + % \else - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% issue the no + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no \fi \fi - % + % \else \ifekd@elidednumbers \luadirect{tex.sprint(ekdosis.numrange( \luastring{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}, - \luastring{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}))}% issue the nos + \luastring{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}))}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the nos \else \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% issue the nos + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the nos \fi \fi% \else \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% \LRnum{\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}.% - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% issue pg and ln nos + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos \fi% - }\unexpanded\expandafter{\ekd@postrefnum}% + }% } % \end{macrocode} % Define keys to be used by the optional arguments of \cs{lem} and @@ -6984,6 +8112,19 @@ Sample text with a \textcolor{red}{word} in red. } % \end{macrocode} % \end{macro} +% \begin{macro}{\app@lang} +% This macro is used internally by \cs{lem}, \cs{rdg} and \cs{note} to +% set the language for apparatus entries. +% \begin{macrocode} +\def\app@lang{% + \ifekd@mapps + \luadirect{tex.sprint(ekdosis.getapplang(\luastring{\ekdan@type}))}% + \else + \ekd@singleapp@lang + \fi +} +% \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, @@ -7031,13 +8172,15 @@ Sample text with a \textcolor{red}{word} in red. \ifdefined\ekdlr@alt% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi - {\textdir TRT\unexpanded\expandafter{\ekdlr@alt}}% + {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}% + \unexpanded\expandafter{\ekdlr@alt}}% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \else \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi - {\textdir TRT\unexpanded{#2}}% + {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}% + \unexpanded{#2}}% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \fi @@ -7065,17 +8208,21 @@ Sample text with a \textcolor{red}{word} in red. \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \ltx@ifpackageloaded{babel}% - {\noexpand\selectlanguage{\languagename}% - \unexpanded\expandafter{\ekdlr@alt}}% - {\unexpanded\expandafter{\ekdlr@alt}}% + {{\unexpanded\expandafter{\ekd@lemmastyle}% + \noexpand\selectlanguage{\app@lang}% + \unexpanded\expandafter{\ekdlr@alt}}}% + {\unexpanded\expandafter{\ekd@lemmastyle}% + \unexpanded\expandafter{\ekdlr@alt}}% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi \else \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \ltx@ifpackageloaded{babel}% - {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% - {\unexpanded{#2}}}% + {{\unexpanded\expandafter{\ekd@lemmastyle}% + \noexpand\selectlanguage{\app@lang}% + \unexpanded{#2}}}{% + {\unexpanded\expandafter{\ekd@lemmastyle}\unexpanded{#2}}}% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi \fi @@ -7125,13 +8272,15 @@ Sample text with a \textcolor{red}{word} in red. \ifdefined\ekdlr@alt% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi - {\textdir TRT\unexpanded\expandafter{\ekdlr@alt}}% + {\textdir TRT\unexpanded\expandafter{\ekd@readingstyle}% + \unexpanded\expandafter{\ekdlr@alt}}% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \else \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi - {\textdir TRT\unexpanded{#2}}% + {\textdir TRT\unexpanded\expandafter{\ekd@readingstyle}% + \unexpanded{#2}}% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \fi @@ -7150,17 +8299,20 @@ Sample text with a \textcolor{red}{word} in red. \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \ltx@ifpackageloaded{babel}% - {\noexpand\selectlanguage{\languagename}% - \unexpanded\expandafter{\ekdlr@alt}}% - {\unexpanded\expandafter{\ekdlr@alt}}% + {{\unexpanded\expandafter{\ekd@readingstyle}% + \noexpand\selectlanguage{\app@lang}% + \unexpanded\expandafter{\ekdlr@alt}}}% + {\unexpanded\expandafter{\ekd@readingstyle}% + \unexpanded\expandafter{\ekdlr@alt}}% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi \else \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \ltx@ifpackageloaded{babel}% - {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% - {\unexpanded{#2}}}% + {{\unexpanded\expandafter{\ekd@readingstyle}% + \noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% + {\unexpanded\expandafter{\ekd@readingstyle}\unexpanded{#2}}}% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi \fi @@ -7241,7 +8393,8 @@ Sample text with a \textcolor{red}{word} in red. \fi% \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em \ifdefined\ekdn@lem% - {\textdir TRT\unexpanded\expandafter{\ekdn@lem}}% + {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}% + \unexpanded\expandafter{\ekdn@lem}}% \unless\ifekdn@nosep \unexpanded\expandafter{\ekdn@sep}\fi \else\fi% @@ -7257,14 +8410,16 @@ Sample text with a \textcolor{red}{word} in red. \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em \ifdefined\ekdn@lem \ltx@ifpackageloaded{babel}% - {\noexpand\selectlanguage{\languagename}% + {{\unexpanded\expandafter{\ekd@lemmastyle}% + \noexpand\selectlanguage{\app@lang}% + \unexpanded\expandafter{\ekdn@lem}}}% + {\unexpanded\expandafter{\ekd@lemmastyle}% \unexpanded\expandafter{\ekdn@lem}}% - {\unexpanded\expandafter{\ekdn@lem}}% \unless\ifekdn@nosep \unexpanded\expandafter{\ekdn@sep}\fi \else\fi% \ltx@ifpackageloaded{babel}% - {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% + {{\noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% {\unexpanded{#2}}}}}% \ifekd@mapps% \unconditional@appin[\ekdan@type]{\note@contents}% @@ -7303,7 +8458,11 @@ Sample text with a \textcolor{red}{word} in red. \ekvifdefinedNoVal{ekd@note}{post}{}{% \unexpanded\expandafter{\post@value}}% }% + \ifekd@mapps% + \append@app[\ekdan@type]{\note@contents}% + \else% \append@app{\note@contents}% + \fi% \egroup% } \NewDocumentCommand{\ekd@note@star}{O{} m}{% @@ -7320,7 +8479,11 @@ Sample text with a \textcolor{red}{word} in red. \append@app{\note@contents}% \egroup% \else - \append@app{\unskip\footnote{#2}}% + \ifekd@mapps% + \append@app[\ekdan@type]{\note@contents}% + \else% + \append@app{\note@contents}% + \fi% \fi% } \NewDocumentCommand{\note@app}{s O{} +m}{% @@ -7721,19 +8884,67 @@ Sample text with a \textcolor{red}{word} in red. } % \end{macrocode} % \end{macro} +% \paragraph{Poetry Settings} % \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|:--- +% |poetry|. +% \begin{macro}{\test@vpnum} +% \cs{test@vpnum} is used internally when |ekdosis| needs to know +% whether two subsequent lines are printed on the same page or not. +% \begin{macrocode} +\newif\ifekd@test@vpnum +\newcounter{ekd@vpnum} +\globalcounter{ekd@vpnum} +\NewDocumentCommand{\test@vpnum}{}{% + \ifekd@test@vpnum + \edef\@tempa{\theekd@vpnum}% + \stepcounter{ekd@vpnum}% + \label{vpnum:\theekd@vpnum}% + \ifnum + \pdf@strcmp{\getpagerefnumber{vpnum:\@tempa}}% + {\getpagerefnumber{vpnum:\theekd@vpnum}} + = 0 + \else + \resetvlinenumber + \fi + \else + \label{vpnum:\theekd@vpnum}% + \global\ekd@test@vpnumtrue + \fi +} +% \end{macrocode} +% \end{macro} +% A small patch is applied to the \pkg{verse} package, then +% \env{ekdverse} is defined:--- % \begin{macrocode} -\if@pkg@verse -\verselinenumfont{\normalfont\footnotesize} +\if@pkg@poetry@verse +\patchcmd{\start@vsline}{% + \ifaltindent}{% + \ifekd@pagevlineation\test@vpnum\fi + \ifaltindent}{}{} +\ekvdefinekeys{ekd@verse}{ + dimen width = \vwidth@val, + initial width = \linewidth, + code type = \def\type@value{#1}, +} +\ifekd@memoir@loaded + \linenumberfont{\normalfont\footnotesize} +\else + \verselinenumfont{\normalfont\footnotesize} +\fi \setcounter{poemline}{1} -\NewDocumentEnvironment{ekdverse}{O{\linewidth}}{% +\NewDocumentEnvironment{ekdverse}{!O{}}{% + \ekvset{ekd@verse}{#1}% + \if@continuous@vnum\setverselinenums{\thelinenumber}{0}\fi \nolinenumbers \let\linelabel\label - \stepcounter{verse@envctr}% + \ifekd@memoir@loaded + \refstepcounter{verse}% + \else + \stepcounter{verse@envctr}% + \fi \addtocounter{poemline}{-1}\refstepcounter{poemline}% \setcounter{vslineno}{1}% \let\\=\@vscentercr @@ -7744,22 +8955,26 @@ Sample text with a \textcolor{red}{word} in red. \setlength{\itemsep}{0pt}% \setlength{\topsep}{0pt}% \setlength{\partopsep}{0pt}% - \ifdim #1 < \linewidth + \ifdim\vwidth@val < \linewidth \rightmargin \z@ \setlength{\leftmargin}{\linewidth}% - \addtolength{\leftmargin}{-#1}% + \addtolength{\leftmargin}{-\vwidth@val}% \addtolength{\leftmargin}{-0.5\leftmargin}% \else \rightmargin \leftmargin \fi \addtolength{\leftmargin}{\vindent}}% - \item[]% + \item[]\ifekd@pagevlineation\test@vpnum\fi% } -{\endlist} +{\endlist + \if@continuous@vnum\resetlinenumber[\thepoemline]\fi} +% \end{macrocode} +% Finally, this is the standard \env{verse} environment:--- +% \begin{macrocode} \else \newlength{\ekdverseindentlength} \setlength{\ekdverseindentlength}{\parindent} -\NewDocumentEnvironment{ekdverse}{O{\ekdverseindentlength}}{ +\NewDocumentEnvironment{ekdverse}{!O{\ekdverseindentlength}}{ \begin{list}{}{% \setlength{\leftmargin}{#1} \setlength{\itemsep}{0pt} @@ -7771,6 +8986,35 @@ Sample text with a \textcolor{red}{word} in red. \fi % \end{macrocode} % \end{environment} +% \begin{macro}{\resetvlinenumber} +% \changes{v1.2}{2021/04/02}{resets line numbers in poetry environments} +% This command is the equivalent of \cs{resetlinenumber} for lines of +% poetry. It takes an integer as optional argument, which is |1| by +% default. +% \begin{macrocode} +\NewDocumentCommand{\resetvlinenumber}{O{1}}{% + \if@pkg@poetry@verse + \setverselinenums{#1}{0}% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{environment}{ekdstanza} +% \changes{v1.2}{2021/04/02}{new environment for stanzas} +% \env{ekdstanza} is needed when lines are grouped into stanzas, +% which can be further named by means of the |type| optional +% argument:--- +% \begin{macrocode} +\ekvdefinekeys{ekd@stanza}{ + code type = \def\type@value{#1} +} +\NewDocumentEnvironment{ekdstanza}{!O{}}{% + \leavevmode\unskip + \ekvset{ekd@stanza}{#1}% + \ignorespaces +}{} +% \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 @@ -7780,7 +9024,14 @@ Sample text with a \textcolor{red}{word} in red. \NewDocumentEnvironment{ekdpar}{}{\par}{\par} % \end{macrocode} % \end{environment} -% +% \paragraph{Configuration File} Finally, if a configuration file +% named |\jobname-ekd.cfg| can be found, this file is read and its +% contents loaded into the document preamble. This provides a +% convenient way to gather all the settings related to the critical +% edition in a separate file. +% \begin{macrocode} +\IfFileExists{\jobname-ekd.cfg}{\input{\jobname-ekd.cfg}}{} +% \end{macrocode} % \iffalse % % \fi @@ -7821,14 +9072,17 @@ local app = lpeg.Cs("app") local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg")) local note = lpeg.Cs("note") local lnbrk = lpeg.Cs("\\\\") -local poemline = lpeg.Cs(lnbrk * bsqbrackets^-1) -local endpoem = lpeg.Cs(lnbrk * lpeg.S("*!") * bsqbrackets^-1) +local poemline = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.S("*!")^-1 * bsqbrackets^-1 * spcenc^-1) +local poemlinebreak = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.P(">") * bsqbrackets^-1 * spcenc^-1) +local linegroup = lpeg.Cs{ "